@zibby/core 0.1.37 → 0.1.40

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. package/dist/agents/base.js +92 -230
  2. package/dist/framework/agents/assistant-strategy.js +9 -67
  3. package/dist/framework/agents/claude-strategy.js +16 -105
  4. package/dist/framework/agents/codex-strategy.js +12 -18
  5. package/dist/framework/agents/cursor-strategy.js +46 -81
  6. package/dist/framework/agents/gemini-strategy.js +13 -17
  7. package/dist/framework/agents/index.js +72 -210
  8. package/dist/framework/agents/utils/cursor-output-formatter.js +4 -8
  9. package/dist/framework/agents/utils/openai-proxy-formatter.js +5 -43
  10. package/dist/framework/agents/utils/structured-output-formatter.js +4 -8
  11. package/dist/framework/code-generator.js +85 -223
  12. package/dist/framework/function-bridge.js +1 -60
  13. package/dist/framework/graph-compiler.js +83 -221
  14. package/dist/framework/graph.js +80 -218
  15. package/dist/framework/index.js +96 -242
  16. package/dist/framework/mcp-client.js +2 -56
  17. package/dist/framework/node-registry.js +75 -213
  18. package/dist/framework/node.js +77 -215
  19. package/dist/framework/state-utils.js +1 -5
  20. package/dist/index.js +194 -332
  21. package/dist/package.json +35 -36
  22. package/dist/utils/ast-utils.js +1 -9
  23. package/dist/utils/node-schema-parser.js +1 -9
  24. package/package.json +5 -6
  25. package/templates/browser-test-automation/run-index.mjs +4 -4
  26. package/templates/code-analysis/nodes/analyze-ticket-node.js +3 -3
  27. package/templates/code-analysis/nodes/create-pr-node.js +1 -1
  28. package/templates/code-analysis/nodes/generate-code-node.js +1 -1
  29. package/templates/code-analysis/nodes/generate-test-cases-node.js +1 -1
  30. package/templates/code-analysis/nodes/services/prMetaService.js +1 -1
  31. package/templates/register-nodes.js +1 -1
  32. package/scripts/export-default-workflows.js +0 -51
  33. package/scripts/patch-cursor-mcp.js +0 -174
  34. package/scripts/setup-ci.sh +0 -115
  35. package/scripts/setup-official-playwright-mcp.sh +0 -173
  36. package/scripts/test-with-video.sh +0 -49
package/dist/index.js CHANGED
@@ -1,95 +1,53 @@
1
- var xW=Object.create;var Kv=Object.defineProperty;var $W=Object.getOwnPropertyDescriptor;var IW=Object.getOwnPropertyNames;var EW=Object.getPrototypeOf,PW=Object.prototype.hasOwnProperty;var Qi=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var N=(t,e)=>()=>(t&&(e=t(t=0)),e);var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),An=(t,e)=>{for(var r in e)Kv(t,r,{get:e[r],enumerable:!0})},TW=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of IW(e))!PW.call(t,n)&&n!==r&&Kv(t,n,{get:()=>e[n],enumerable:!(i=$W(e,n))||i.enumerable});return t};var Hv=(t,e,r)=>(r=t!=null?xW(EW(t)):{},TW(e||!t||!t.__esModule?Kv(r,"default",{value:t,enumerable:!0}):r,t));var Yt,Dn,ci,jp,Jv,OW,zW,NW,Yv,Ci=N(()=>{Yt=".zibby/output",Dn="sessions",ci=".session-info.json",jp=".zibby-studio-stop",Jv="result.json",OW="raw_stream_output.txt",zW="events.json",NW={BROWSER:"browser",JIRA:"jira",GITHUB:"github",SLACK:"slack",MEMORY:"memory",CHAT_MEMORY:"chat-memory",RUNNER:"runner",SKILL_INSTALLER:"skill-installer",CORE_TOOLS:"core-tools",WORKFLOW_BUILDER:"workflow-builder"},Yv=["CI_JOB_ID","GITHUB_RUN_ID","CIRCLE_WORKFLOW_ID","BUILD_ID"]});var Ri,ic=N(()=>{Ri=class t{constructor(){this.buffer="",this.extractedResult=null,this.rawText="",this.zodSchema=null,this.lastOutputLength=0,this.onToolCall=null,this._lastToolEmit=null}processChunk(e){if(!e)return null;this.buffer+=e;let r=this.buffer.split(`
2
- `);this.buffer=r.pop()||"";let i="";for(let n of r)if(n.trim())try{let o=JSON.parse(n);this._emitToolCalls(o);let s=this.extractText(o);if(s){if(this.rawText&&s.startsWith(this.rawText)){let a=s.substring(this.rawText.length);this.rawText=s,i+=a}else(!this.rawText.includes(s)||s.length<20)&&(this.rawText+=s,i+=s);this.tryExtractResult(this.rawText)}else this.isValidResult(o)&&(this.rawText+=`${n}
3
- `,i+=`${n}
4
- `,this.extractedResult=o)}catch{if(n.includes('"text"')||n.includes('"content"')){let s=n.match(/"text"\s*:\s*"([^"]*)/),a=n.match(/"content"\s*:\s*"([^"]*)/),u=s?s[1]:a?a[1]:null;u&&!this.rawText.includes(u)&&(i+=u,this.rawText+=u)}}return i||null}flush(){if(!this.buffer.trim())return null;let e="";try{let r=JSON.parse(this.buffer);this._emitToolCalls(r);let i=this.extractText(r);i&&(this.rawText+=i,e+=i,this.tryExtractResult(i))}catch{this.rawText+=this.buffer,e+=this.buffer,this.tryExtractResult(this.buffer)}return this.buffer="",e||null}_emitToolCalls(e){if(!this.onToolCall)return;let r=(s,a)=>{if(!s)return;let u=`${s}:${JSON.stringify(a??{})}`;this._lastToolEmit!==u&&(this._lastToolEmit=u,this.onToolCall(s,a??void 0))},i=s=>{if(s!=null){if(typeof s=="object"&&!Array.isArray(s))return s;if(typeof s=="string")try{return JSON.parse(s)}catch{return}}};if(e.type==="tool_use"||e.type==="tool_call"){if(e.name){r(e.name,i(e.input??e.arguments));return}let s=e.tool_call;if(s&&typeof s=="object"&&!Array.isArray(s)){let a=Object.keys(s);if(a.length===1){let u=a[0],l=s[u],c=l&&typeof l=="object"?l.args??l.input??l:void 0;r(u,i(c))}return}return}if(Array.isArray(e.tool_calls)){for(let s of e.tool_calls)r(s.name,i(s.input??s.arguments));return}let n=e.message??e;if(Array.isArray(n?.tool_calls)){for(let s of n.tool_calls)r(s.name,i(s.input??s.arguments));return}let o=n?.content??e.content;if(Array.isArray(o))for(let s of o)(s.type==="tool_use"||s.type==="tool_call")&&s.name&&r(s.name,i(s.input??s.arguments))}extractText(e){if(e.type==="assistant"&&e.message?.content){let r=e.message.content;if(Array.isArray(r))return r.filter(i=>i.type==="text"&&i.text).map(i=>i.text).join("")}return e.type==="thinking"&&e.text||e.text?e.text:e.content&&typeof e.content=="string"?e.content:e.delta?e.delta:null}tryExtractResult(e){if(!e||typeof e!="string")return;let r=[],i=/```json\s*\n?([\s\S]*?)\n?```/g,n;for(;(n=i.exec(e))!==null;){let d=n[1].trim();try{JSON.parse(d),r.push({text:d,source:"markdown"})}catch{}}let o=0,s=0;for(;o<e.length&&(o=e.indexOf("{",o),o!==-1);){let d=0,p=o;for(let f=o;f<e.length;f++)if(e[f]==="{")d++;else if(e[f]==="}"&&(d--,d===0)){p=f,r.push({text:e.substring(o,p+1),source:"brace"}),s++;break}o=p+1}let a=this.extractedResult,u=a?JSON.stringify(a).length:0,l=0,c=-1;for(let d=0;d<r.length;d++){let p=r[d];try{let f=p.text.replace(/,(\s*[}\]])/g,"$1"),m=JSON.parse(f);this.isValidResult(m)&&(l++,u=JSON.stringify(m).length,a=m,c=d)}catch{}}a&&(this.extractedResult=a)}isValidResult(e){if(!e||typeof e!="object"||Array.isArray(e)||e.session_id||e.timestamp_ms||e.type||e.call_id||e.tool_call||e.result&&typeof e.result=="object"&&(e.result.success&&typeof e.result.success=="object"||e.result.error&&typeof e.result.error=="object")||e.args&&typeof e.args=="object")return!1;if(this.zodSchema)try{return this.zodSchema.parse(e),!0}catch{return!1}return!0}getResult(){return this.extractedResult}getRawText(){return this.rawText}static extractResult(e,r=null){let i=new t;i.zodSchema=r,i.processChunk(e),i.flush();let n=i.getResult();return!n&&process.env.LOG_LEVEL==="debug"&&console.error("[StreamingParser] No result extracted from",e?.length||0,"chars"),n}}});var Xz={};An(Xz,{WorkflowState:()=>oc});function a_(t){if(nG.has(t))throw new Error(`Invalid state key: "${t}"`)}var nG,oc,u_=N(()=>{nG=new Set(["__proto__","constructor","prototype"]);oc=class{constructor(e={}){this._state=Object.create(null),Object.assign(this._state,{messages:[],errors:[],artifacts:{},metadata:{},...e}),this._history=[]}get(e){return this._state[e]}set(e,r){a_(e),this._history.push({...this._state}),this._state[e]=r}update(e){let r=Object.getOwnPropertyNames(e);for(let i of r)a_(i);this._history.push({...this._state});for(let i of r)this._state[i]=e[i]}append(e,r){a_(e),this._history.push({...this._state}),Array.isArray(this._state[e])||(this._state[e]=[]),this._state[e].push(r)}getAll(){return{...this._state}}rollback(){this._history.length>0&&(this._state=this._history.pop())}}});var Up,eN=N(()=>{Up=class{constructor(e){this.schema=e}parse(e){let r=e.match(/```json\s*([\s\S]*?)\s*```/);if(r)return this.validate(JSON.parse(r[1]));let i=e.match(/\{[\s\S]*\}/);return i?this.validate(JSON.parse(i[0])):this.validate({result:e.trim()})}validate(e){let r=[];for(let[i,n]of Object.entries(this.schema)){if(n.required&&!(i in e)&&r.push(`Missing required field: ${i}`),i in e&&n.type){let o=typeof e[i];o!==n.type&&r.push(`Field '${i}' expected ${n.type}, got ${o}`)}if(n.validate&&i in e){let o=n.validate(e[i]);o&&r.push(`Field '${i}': ${o}`)}}if(r.length>0)throw new Error(`Output validation failed:
5
- ${r.join(`
6
- `)}`);return e}}});import sc from"chalk";var di,Mp,U,Un=N(()=>{di={debug:0,info:1,warn:2,error:3,silent:4},Mp=class{constructor(){this._level=this._getLogLevel()}_getLogLevel(){if(process.env.ZIBBY_DEBUG==="true")return di.debug;if(process.env.ZIBBY_VERBOSE==="true")return di.info;let e=process.env.LOG_LEVEL?.toLowerCase();return e&&e in di?di[e]:di.info}_shouldLog(e){return di[e]>=this._level}_formatMessage(e,r,i={}){let n=new Date().toISOString(),s=`${this._getPrefix(e)} ${r}`;return Object.keys(i).length>0&&(s+=sc.dim(` ${JSON.stringify(i)}`)),s}_getPrefix(e){return{debug:sc.gray("[DEBUG]"),info:sc.cyan("[INFO]"),warn:sc.yellow("[WARN]"),error:sc.red("\u274C [ERROR]")}[e]||""}debug(e,r){this._shouldLog("debug")&&console.log(this._formatMessage("debug",e,r))}info(e,r){this._shouldLog("info")&&console.log(this._formatMessage("info",e,r))}warn(e,r){this._shouldLog("warn")&&console.warn(this._formatMessage("warn",e,r))}error(e,r){this._shouldLog("error")&&console.error(this._formatMessage("error",e,r))}setLevel(e){e in di&&(this._level=di[e])}getLevel(){return Object.keys(di).find(e=>di[e]===this._level)}},U=new Mp});import vr from"chalk";function sN(t){return t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function aN(t,e){return(r,i,n)=>{if(typeof r!="string")return t(r,i,n);let o=process.stdout.columns||120,s="";for(let a=0;a<r.length;a++){let u=r[a];e.lineStart&&(s+=iN,e.col=oN,e.lineStart=!1),u===`
7
- `?(s+=u,e.lineStart=!0,e.col=0,e.inEsc=!1):u==="\x1B"?(e.inEsc=!0,s+=u):e.inEsc?(s+=u,(u>="A"&&u<="Z"||u>="a"&&u<="z")&&(e.inEsc=!1)):(e.col++,s+=u,e.col>=o&&(s+=`
8
- ${iN}`,e.col=oN))}return t(s,i,n)}}var iG,ac,oG,tN,l_,rN,nN,c_,iN,oN,d_,Mt,vs=N(()=>{iG="__WORKFLOW_GRAPH_LOG__",ac=vr.gray("\u2502"),oG=vr.gray("\u250C"),tN=vr.gray("\u2514"),l_=vr.green("\u25C6"),rN=vr.hex("#c084fc")("\u25C6"),nN=vr.hex("#2dd4bf")("\u25C6"),c_=vr.red("\u25C6"),iN=`${ac} `,oN=2;d_=class{constructor(){this._currentNode=null,this._origStdoutWrite=null,this._origStderrWrite=null;let e=String(process.env.ZIBBY_RUN_SOURCE||"").trim().toLowerCase(),r=String(process.env.ZIBBY_WORKFLOW_GRAPH_LOG_MARKERS||"").trim()==="1";this._emitWorkflowGraphMarkers=r||e==="studio"}get isInsideNode(){return this._currentNode!==null}_startIntercepting(){this._origStdoutWrite=process.stdout.write.bind(process.stdout),this._origStderrWrite=process.stderr.write.bind(process.stderr);let e={lineStart:!0,col:0,inEsc:!1},r={lineStart:!0,col:0,inEsc:!1};this._outState=e,this._errState=r,process.stdout.write=aN(this._origStdoutWrite,e),process.stderr.write=aN(this._origStderrWrite,r)}_stopIntercepting(){this._origStdoutWrite&&(this._outState&&!this._outState.lineStart&&this._origStdoutWrite(`
1
+ var Sn=Object.defineProperty;var wn=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var M=(i,e)=>()=>(i&&(e=i(i=0)),e);var lt=(i,e)=>{for(var t in e)Sn(i,t,{get:e[t],enumerable:!0})};var B,H,q,ut,Rt,_n,bn,xn,kt,ee=M(()=>{B=".zibby/output",H="sessions",q=".session-info.json",ut=".zibby-studio-stop",Rt="result.json",_n="raw_stream_output.txt",bn="events.json",xn={BROWSER:"browser",JIRA:"jira",GITHUB:"github",SLACK:"slack",MEMORY:"memory",CHAT_MEMORY:"chat-memory",RUNNER:"runner",SKILL_INSTALLER:"skill-installer",CORE_TOOLS:"core-tools",WORKFLOW_BUILDER:"workflow-builder"},kt=["CI_JOB_ID","GITHUB_RUN_ID","CIRCLE_WORKFLOW_ID","BUILD_ID"]});var te,Je=M(()=>{te=class i{constructor(){this.buffer="",this.extractedResult=null,this.rawText="",this.zodSchema=null,this.lastOutputLength=0,this.onToolCall=null,this._lastToolEmit=null}processChunk(e){if(!e)return null;this.buffer+=e;let t=this.buffer.split(`
2
+ `);this.buffer=t.pop()||"";let r="";for(let s of t)if(s.trim())try{let n=JSON.parse(s);this._emitToolCalls(n);let o=this.extractText(n);if(o){if(this.rawText&&o.startsWith(this.rawText)){let c=o.substring(this.rawText.length);this.rawText=o,r+=c}else(!this.rawText.includes(o)||o.length<20)&&(this.rawText+=o,r+=o);this.tryExtractResult(this.rawText)}else this.isValidResult(n)&&(this.rawText+=`${s}
3
+ `,r+=`${s}
4
+ `,this.extractedResult=n)}catch{if(s.includes('"text"')||s.includes('"content"')){let o=s.match(/"text"\s*:\s*"([^"]*)/),c=s.match(/"content"\s*:\s*"([^"]*)/),l=o?o[1]:c?c[1]:null;l&&!this.rawText.includes(l)&&(r+=l,this.rawText+=l)}}return r||null}flush(){if(!this.buffer.trim())return null;let e="";try{let t=JSON.parse(this.buffer);this._emitToolCalls(t);let r=this.extractText(t);r&&(this.rawText+=r,e+=r,this.tryExtractResult(r))}catch{this.rawText+=this.buffer,e+=this.buffer,this.tryExtractResult(this.buffer)}return this.buffer="",e||null}_emitToolCalls(e){if(!this.onToolCall)return;let t=(o,c)=>{if(!o)return;let l=`${o}:${JSON.stringify(c??{})}`;this._lastToolEmit!==l&&(this._lastToolEmit=l,this.onToolCall(o,c??void 0))},r=o=>{if(o!=null){if(typeof o=="object"&&!Array.isArray(o))return o;if(typeof o=="string")try{return JSON.parse(o)}catch{return}}};if(e.type==="tool_use"||e.type==="tool_call"){if(e.name){t(e.name,r(e.input??e.arguments));return}let o=e.tool_call;if(o&&typeof o=="object"&&!Array.isArray(o)){let c=Object.keys(o);if(c.length===1){let l=c[0],a=o[l],u=a&&typeof a=="object"?a.args??a.input??a:void 0;t(l,r(u))}return}return}if(Array.isArray(e.tool_calls)){for(let o of e.tool_calls)t(o.name,r(o.input??o.arguments));return}let s=e.message??e;if(Array.isArray(s?.tool_calls)){for(let o of s.tool_calls)t(o.name,r(o.input??o.arguments));return}let n=s?.content??e.content;if(Array.isArray(n))for(let o of n)(o.type==="tool_use"||o.type==="tool_call")&&o.name&&t(o.name,r(o.input??o.arguments))}extractText(e){if(e.type==="assistant"&&e.message?.content){let t=e.message.content;if(Array.isArray(t))return t.filter(r=>r.type==="text"&&r.text).map(r=>r.text).join("")}return e.type==="thinking"&&e.text||e.text?e.text:e.content&&typeof e.content=="string"?e.content:e.delta?e.delta:null}tryExtractResult(e){if(!e||typeof e!="string")return;let t=[],r=/```json\s*\n?([\s\S]*?)\n?```/g,s;for(;(s=r.exec(e))!==null;){let p=s[1].trim();try{JSON.parse(p),t.push({text:p,source:"markdown"})}catch{}}let n=0,o=0;for(;n<e.length&&(n=e.indexOf("{",n),n!==-1);){let p=0,d=n;for(let f=n;f<e.length;f++)if(e[f]==="{")p++;else if(e[f]==="}"&&(p--,p===0)){d=f,t.push({text:e.substring(n,d+1),source:"brace"}),o++;break}n=d+1}let c=this.extractedResult,l=c?JSON.stringify(c).length:0,a=0,u=-1;for(let p=0;p<t.length;p++){let d=t[p];try{let f=d.text.replace(/,(\s*[}\]])/g,"$1"),m=JSON.parse(f);this.isValidResult(m)&&(a++,l=JSON.stringify(m).length,c=m,u=p)}catch{}}c&&(this.extractedResult=c)}isValidResult(e){if(!e||typeof e!="object"||Array.isArray(e)||e.session_id||e.timestamp_ms||e.type||e.call_id||e.tool_call||e.result&&typeof e.result=="object"&&(e.result.success&&typeof e.result.success=="object"||e.result.error&&typeof e.result.error=="object")||e.args&&typeof e.args=="object")return!1;if(this.zodSchema)try{return this.zodSchema.parse(e),!0}catch{return!1}return!0}getResult(){return this.extractedResult}getRawText(){return this.rawText}static extractResult(e,t=null){let r=new i;r.zodSchema=t,r.processChunk(e),r.flush();let s=r.getResult();return!s&&process.env.LOG_LEVEL==="debug"&&console.error("[StreamingParser] No result extracted from",e?.length||0,"chars"),s}}});var Wr={};lt(Wr,{WorkflowState:()=>We});function Jt(i){if(Kn.has(i))throw new Error(`Invalid state key: "${i}"`)}var Kn,We,Wt=M(()=>{Kn=new Set(["__proto__","constructor","prototype"]);We=class{constructor(e={}){this._state=Object.create(null),Object.assign(this._state,{messages:[],errors:[],artifacts:{},metadata:{},...e}),this._history=[]}get(e){return this._state[e]}set(e,t){Jt(e),this._history.push({...this._state}),this._state[e]=t}update(e){let t=Object.getOwnPropertyNames(e);for(let r of t)Jt(r);this._history.push({...this._state});for(let r of t)this._state[r]=e[r]}append(e,t){Jt(e),this._history.push({...this._state}),Array.isArray(this._state[e])||(this._state[e]=[]),this._state[e].push(t)}getAll(){return{...this._state}}rollback(){this._history.length>0&&(this._state=this._history.pop())}}});var ht,Yr=M(()=>{ht=class{constructor(e){this.schema=e}parse(e){let t=e.match(/```json\s*([\s\S]*?)\s*```/);if(t)return this.validate(JSON.parse(t[1]));let r=e.match(/\{[\s\S]*\}/);return r?this.validate(JSON.parse(r[0])):this.validate({result:e.trim()})}validate(e){let t=[];for(let[r,s]of Object.entries(this.schema)){if(s.required&&!(r in e)&&t.push(`Missing required field: ${r}`),r in e&&s.type){let n=typeof e[r];n!==s.type&&t.push(`Field '${r}' expected ${s.type}, got ${n}`)}if(s.validate&&r in e){let n=s.validate(e[r]);n&&t.push(`Field '${r}': ${n}`)}}if(t.length>0)throw new Error(`Output validation failed:
5
+ ${t.join(`
6
+ `)}`);return e}}});import Ye from"chalk";var X,gt,h,V=M(()=>{X={debug:0,info:1,warn:2,error:3,silent:4},gt=class{constructor(){this._level=this._getLogLevel()}_getLogLevel(){if(process.env.ZIBBY_DEBUG==="true")return X.debug;if(process.env.ZIBBY_VERBOSE==="true")return X.info;let e=process.env.LOG_LEVEL?.toLowerCase();return e&&e in X?X[e]:X.info}_shouldLog(e){return X[e]>=this._level}_formatMessage(e,t,r={}){let s=new Date().toISOString(),o=`${this._getPrefix(e)} ${t}`;return Object.keys(r).length>0&&(o+=Ye.dim(` ${JSON.stringify(r)}`)),o}_getPrefix(e){return{debug:Ye.gray("[DEBUG]"),info:Ye.cyan("[INFO]"),warn:Ye.yellow("[WARN]"),error:Ye.red("\u274C [ERROR]")}[e]||""}debug(e,t){this._shouldLog("debug")&&console.log(this._formatMessage("debug",e,t))}info(e,t){this._shouldLog("info")&&console.log(this._formatMessage("info",e,t))}warn(e,t){this._shouldLog("warn")&&console.warn(this._formatMessage("warn",e,t))}error(e,t){this._shouldLog("error")&&console.error(this._formatMessage("error",e,t))}setLevel(e){e in X&&(this._level=X[e])}getLevel(){return Object.keys(X).find(e=>X[e]===this._level)}},h=new gt});import j from"chalk";function Xr(i){return i<1e3?`${i}ms`:`${(i/1e3).toFixed(1)}s`}function Qr(i,e){return(t,r,s)=>{if(typeof t!="string")return i(t,r,s);let n=process.stdout.columns||120,o="";for(let c=0;c<t.length;c++){let l=t[c];e.lineStart&&(o+=Vr,e.col=qr,e.lineStart=!1),l===`
7
+ `?(o+=l,e.lineStart=!0,e.col=0,e.inEsc=!1):l==="\x1B"?(e.inEsc=!0,o+=l):e.inEsc?(o+=l,(l>="A"&&l<="Z"||l>="a"&&l<="z")&&(e.inEsc=!1)):(e.col++,o+=l,e.col>=n&&(o+=`
8
+ ${Vr}`,e.col=qr))}return i(o,r,s)}}var Zn,Ke,Hn,Kr,Yt,Zr,Hr,Kt,Vr,qr,Zt,D,le=M(()=>{Zn="__WORKFLOW_GRAPH_LOG__",Ke=j.gray("\u2502"),Hn=j.gray("\u250C"),Kr=j.gray("\u2514"),Yt=j.green("\u25C6"),Zr=j.hex("#c084fc")("\u25C6"),Hr=j.hex("#2dd4bf")("\u25C6"),Kt=j.red("\u25C6"),Vr=`${Ke} `,qr=2;Zt=class{constructor(){this._currentNode=null,this._origStdoutWrite=null,this._origStderrWrite=null;let e=String(process.env.ZIBBY_RUN_SOURCE||"").trim().toLowerCase(),t=String(process.env.ZIBBY_WORKFLOW_GRAPH_LOG_MARKERS||"").trim()==="1";this._emitWorkflowGraphMarkers=t||e==="studio"}get isInsideNode(){return this._currentNode!==null}_startIntercepting(){this._origStdoutWrite=process.stdout.write.bind(process.stdout),this._origStderrWrite=process.stderr.write.bind(process.stderr);let e={lineStart:!0,col:0,inEsc:!1},t={lineStart:!0,col:0,inEsc:!1};this._outState=e,this._errState=t,process.stdout.write=Qr(this._origStdoutWrite,e),process.stderr.write=Qr(this._origStderrWrite,t)}_stopIntercepting(){this._origStdoutWrite&&(this._outState&&!this._outState.lineStart&&this._origStdoutWrite(`
9
9
  `),process.stdout.write=this._origStdoutWrite),this._origStderrWrite&&(this._errState&&!this._errState.lineStart&&this._origStderrWrite(`
10
10
  `),process.stderr.write=this._origStderrWrite),this._origStdoutWrite=null,this._origStderrWrite=null}_rawWrite(e){(this._origStdoutWrite||process.stdout.write.bind(process.stdout))(`${e}
11
- `)}_emitGraphLogMarker(e){if(!this._emitWorkflowGraphMarkers)return;let r=`${iG}${JSON.stringify(e)}
12
- `;this._origStdoutWrite?this._origStdoutWrite(r):process.stdout.write(r)}_writeDot(e,r){this._origStdoutWrite?(this._outState&&!this._outState.lineStart&&(this._origStdoutWrite(`
13
- `),this._outState.lineStart=!0,this._outState.col=0),this._origStdoutWrite(`${e} ${r}
14
- `)):process.stdout.write.bind(process.stdout)(`${e} ${r}
15
- `)}step(e){this._origStdoutWrite?this._writeDot(l_,e):process.stdout.write.bind(process.stdout)(`${ac} ${l_} ${e}
16
- `)}stepTool(e){this._origStdoutWrite?this._writeDot(rN,e):process.stdout.write.bind(process.stdout)(`${ac} ${rN} ${e}
17
- `)}stepMemory(e){let r=vr.hex("#2dd4bf")(e);this._origStdoutWrite?this._writeDot(nN,r):process.stdout.write.bind(process.stdout)(`${ac} ${nN} ${r}
18
- `)}stepFail(e){this._origStdoutWrite?this._writeDot(c_,vr.red(e)):process.stdout.write.bind(process.stdout)(`${ac} ${c_} ${vr.red(e)}
19
- `)}nodeStart(e){this._currentNode=e,this._emitGraphLogMarker({phase:"node_begin",node:e}),this._rawWrite(`${oG} ${e}`),this._startIntercepting()}nodeComplete(e,r={}){this._stopIntercepting();let{duration:i,details:n}=r;if(n)for(let s of n)this._rawWrite(`${l_} ${s}`);let o=i?vr.dim(` ${sN(i)}`):"";this._rawWrite(`${tN} ${vr.green("done")}${o}`),this._emitGraphLogMarker({phase:"node_end",node:e}),this._rawWrite("")}nodeFailed(e,r,i={}){this._stopIntercepting();let{duration:n}=i,o=n?vr.dim(` ${sN(n)}`):"";this._rawWrite(`${c_} ${vr.red(r)}`),this._rawWrite(`${tN} ${vr.red("failed")}${o}`),this._emitGraphLogMarker({phase:"node_end",node:e}),this._rawWrite("")}route(e,r){this._rawWrite(vr.dim(` ${e} \u2192 ${r}`)),this._rawWrite("")}graphComplete(){this._rawWrite(vr.green.bold("\u2713 Workflow completed"))}},Mt=new d_});var Vr,_s=N(()=>{Vr=class{constructor(e,r,i=0){this.name=e,this.description=r,this.priority=i}async invoke(e,r={}){throw new Error("AgentStrategy.invoke() must be implemented by subclass")}canHandle(e){throw new Error("AgentStrategy.canHandle() must be implemented by subclass")}getName(){return this.name}getDescription(){return this.description}getPriority(){return this.priority}}});var Tr,sG,aG,f_,p_,uN,Zp,To=N(()=>{Tr={ASSISTANT:"gpt-5.4-nano-2026-03-17",CLAUDE:"claude-sonnet-4-6",CURSOR:"auto",CODEX:"o4-mini",GEMINI:"gemini-2.5-pro",OPENAI_POSTPROCESSING:"gpt-4o-mini"},sG={ASSISTANT:"assistant",CLAUDE:"claude",CURSOR:"cursor",CODEX:"codex",GEMINI:"gemini"},aG={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error",SILENT:"silent"},f_={auto:"claude-sonnet-4-6","sonnet-4.6":"claude-sonnet-4-6","sonnet-4-6":"claude-sonnet-4-6","opus-4.6":"claude-opus-4-6","opus-4-6":"claude-opus-4-6","sonnet-4.5":"claude-sonnet-4-5-20250929","sonnet-4-5":"claude-sonnet-4-5-20250929","opus-4.5":"claude-opus-4-20250514","opus-4-5":"claude-opus-4-20250514","claude-sonnet-4-6":"claude-sonnet-4-6","claude-opus-4-6":"claude-opus-4-6","claude-sonnet-4-5-20250929":"claude-sonnet-4-5-20250929","claude-opus-4-20250514":"claude-opus-4-20250514"},p_={auto:"o4-mini","o4-mini":"o4-mini",o3:"o3","o3-mini":"o3-mini","codex-mini":"codex-mini-latest","gpt-4o":"gpt-4o","gpt-4o-mini":"gpt-4o-mini","gpt-5.2-codex":"gpt-5.2-codex","gpt-5.2":"gpt-5.2","gpt-5.3":"gpt-5.3","gpt-5.4":"gpt-5.4"},uN={auto:"gemini-2.5-pro","gemini-2.5-pro":"gemini-2.5-pro","gemini-2.5-flash":"gemini-2.5-flash"},Zp={CURSOR_AGENT_DEFAULT:1200*1e3,OPENAI_REQUEST:18e4}});var m_={};An(m_,{getAllSkills:()=>Lp,getSkill:()=>Or,hasSkill:()=>cN,listSkillIds:()=>dN,registerSkill:()=>lN});function lN(t){if(!t||typeof t.id!="string")throw new Error("Skill definition must include a string id");uc.set(t.id,Object.freeze({...t}))}function Or(t){return uc.get(t)||null}function cN(t){return uc.has(t)}function Lp(){return new Map(uc)}function dN(){return Array.from(uc.keys())}var uc,Xi=N(()=>{uc=new Map});var g_,uG,h_,y_,qp=N(()=>{g_=Symbol("Let zodToJsonSchema decide on which parser to use"),uG=(t,e)=>{if(e.description)try{return{...t,...JSON.parse(e.description)}}catch{}return t},h_={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"},y_=t=>typeof t=="string"?{...h_,name:t}:{...h_,...t}});var v_,__=N(()=>{qp();v_=t=>{let e=y_(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([i,n])=>[n._def,{def:n._def,path:[...e.basePath,e.definitionPath,i],jsonSchema:void 0}]))}}});function Fp(t,e,r,i){i?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function at(t,e,r,i,n){t[e]=r,Fp(t,e,i,n)}var Oo=N(()=>{});var lc,Vp=N(()=>{lc=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")}});var ot,b_,ue,Ai,cc=N(()=>{(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let o={};for(let s of n)o[s]=s;return o},t.getValidEnumValues=n=>{let o=t.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),s={};for(let a of o)s[a]=n[a];return t.objectValues(s)},t.objectValues=n=>t.objectKeys(n).map(function(o){return n[o]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&o.push(s);return o},t.find=(n,o)=>{for(let s of n)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,o=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=i,t.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o})(ot||(ot={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(b_||(b_={}));ue=ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ai=t=>{switch(typeof t){case"undefined":return ue.undefined;case"string":return ue.string;case"number":return Number.isNaN(t)?ue.nan:ue.number;case"boolean":return ue.boolean;case"function":return ue.function;case"bigint":return ue.bigint;case"symbol":return ue.symbol;case"object":return Array.isArray(t)?ue.array:t===null?ue.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ue.promise:typeof Map<"u"&&t instanceof Map?ue.map:typeof Set<"u"&&t instanceof Set?ue.set:typeof Date<"u"&&t instanceof Date?ue.date:ue.object;default:return ue.unknown}}});var Y,lG,cn,Wp=N(()=>{cc();Y=ot.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"]),lG=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),cn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},i={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)i._errors.push(r(s));else{let a=i,u=0;for(;u<s.path.length;){let l=s.path[u];u===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],u++}}};return n(this),i}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ot.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),i=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];r[o]=r[o]||[],r[o].push(e(n))}else i.push(e(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};cn.create=t=>new cn(t)});var cG,eo,w_=N(()=>{Wp();cc();cG=(t,e)=>{let r;switch(t.code){case Y.invalid_type:t.received===ue.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case Y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ot.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:r=`Unrecognized key(s) in object: ${ot.joinValues(t.keys,", ")}`;break;case Y.invalid_union:r="Invalid input";break;case Y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ot.joinValues(t.options)}`;break;case Y.invalid_enum_value:r=`Invalid enum value. Expected ${ot.joinValues(t.options)}, received '${t.received}'`;break;case Y.invalid_arguments:r="Invalid function arguments";break;case Y.invalid_return_type:r="Invalid function return type";break;case Y.invalid_date:r="Invalid date";break;case Y.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ot.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case Y.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case Y.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case Y.custom:r="Invalid input";break;case Y.invalid_intersection_types:r="Intersection results could not be merged";break;case Y.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case Y.not_finite:r="Number must be finite";break;default:r=e.defaultError,ot.assertNever(t)}return{message:r}},eo=cG});function dG(t){fN=t}function Ua(){return fN}var fN,Gp=N(()=>{w_();fN=eo});function oe(t,e){let r=Ua(),i=dc({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===eo?void 0:eo].filter(n=>!!n)});t.common.issues.push(i)}var dc,fG,_r,$e,bs,zr,Bp,Kp,zo,Ma,S_=N(()=>{Gp();w_();dc=t=>{let{data:e,path:r,errorMaps:i,issueData:n}=t,o=[...r,...n.path||[]],s={...n,path:o};if(n.message!==void 0)return{...n,path:o,message:n.message};let a="",u=i.filter(l=>!!l).slice().reverse();for(let l of u)a=l(s,{data:e,defaultError:a}).message;return{...n,path:o,message:a}},fG=[];_r=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let i=[];for(let n of r){if(n.status==="aborted")return $e;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let n of r){let o=await n.key,s=await n.value;i.push({key:o,value:s})}return t.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let n of r){let{key:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return $e;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(i[o.value]=s.value)}return{status:e.value,value:i}}},$e=Object.freeze({status:"aborted"}),bs=t=>({status:"dirty",value:t}),zr=t=>({status:"valid",value:t}),Bp=t=>t.status==="aborted",Kp=t=>t.status==="dirty",zo=t=>t.status==="valid",Ma=t=>typeof Promise<"u"&&t instanceof Promise});var pN=N(()=>{});var ge,mN=N(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ge||(ge={}))});function Ze(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:i,description:n}=t;if(e&&(r||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(s,a)=>{let{message:u}=t;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??i??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:u??r??a.defaultError}},description:n}}function vN(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function TG(t){return new RegExp(`^${vN(t)}$`)}function _N(t){let e=`${yN}T${vN(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function OG(t,e){return!!((e==="v4"||!e)&&SG.test(t)||(e==="v6"||!e)&&xG.test(t))}function zG(t,e){if(!vG.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function NG(t,e){return!!((e==="v4"||!e)&&kG.test(t)||(e==="v6"||!e)&&$G.test(t))}function jG(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return o%s/10**n}function Za(t){if(t instanceof dn){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=Mn.create(Za(i))}return new dn({...t._def,shape:()=>e})}else return t instanceof no?new no({...t._def,type:Za(t.element)}):t instanceof Mn?Mn.create(Za(t.unwrap())):t instanceof Ui?Ui.create(Za(t.unwrap())):t instanceof Di?Di.create(t.items.map(e=>Za(e))):t}function x_(t,e){let r=Ai(t),i=Ai(e);if(t===e)return{valid:!0,data:t};if(r===ue.object&&i===ue.object){let n=ot.objectKeys(e),o=ot.objectKeys(t).filter(a=>n.indexOf(a)!==-1),s={...t,...e};for(let a of o){let u=x_(t[a],e[a]);if(!u.valid)return{valid:!1};s[a]=u.data}return{valid:!0,data:s}}else if(r===ue.array&&i===ue.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],u=x_(s,a);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return r===ue.date&&i===ue.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function bN(t,e){return new zs({values:t,typeName:X.ZodEnum,...Ze(e)})}function gN(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function wN(t,e={},r){return t?jo.create().superRefine((i,n)=>{let o=t(i);if(o instanceof Promise)return o.then(s=>{if(!s){let a=gN(e,i),u=a.fatal??r??!0;n.addIssue({code:"custom",...a,fatal:u})}});if(!o){let s=gN(e,i),a=s.fatal??r??!0;n.addIssue({code:"custom",...s,fatal:a})}}):jo.create()}var Zn,hN,Ke,pG,mG,hG,gG,yG,vG,_G,bG,wG,k_,SG,kG,xG,$G,IG,EG,yN,PG,No,ws,Ss,ks,xs,La,$s,Is,jo,ro,fi,qa,no,dn,Es,to,Hp,Ps,Di,Jp,Fa,Va,Yp,Ts,Os,zs,Ns,Co,Ln,Mn,Ui,js,Cs,Wa,CG,fc,pc,Rs,RG,X,AG,SN,kN,DG,UG,xN,MG,ZG,LG,qG,FG,VG,WG,GG,BG,$N,KG,HG,JG,YG,QG,XG,eB,tB,rB,nB,iB,oB,sB,aB,uB,lB,cB,dB,fB,pB,mB,hB,gB,yB,IN=N(()=>{Wp();Gp();mN();S_();cc();Zn=class{constructor(e,r,i,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,this._key=n}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}},hN=(t,e)=>{if(zo(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new cn(t.common.issues);return this._error=r,this._error}}};Ke=class{get description(){return this._def.description}_getType(e){return Ai(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ai(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _r,ctx:{common:e.parent.common,data:e.data,parsedType:Ai(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ma(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){let i={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ai(e)},n=this._parseSync({data:e,path:i.path,parent:i});return hN(i,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ai(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return zo(i)?{value:i.value}:{issues:r.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>zo(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ai(e)},n=this._parse({data:e,path:i.path,parent:i}),o=await(Ma(n)?n:Promise.resolve(n));return hN(i,o)}refine(e,r){let i=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,o)=>{let s=e(n),a=()=>o.addIssue({code:Y.custom,...i(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(e){return new Ln({schema:this,typeName:X.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Mn.create(this,this._def)}nullable(){return Ui.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return no.create(this)}promise(){return Co.create(this,this._def)}or(e){return Es.create([this,e],this._def)}and(e){return Ps.create(this,e,this._def)}transform(e){return new Ln({...Ze(this._def),schema:this,typeName:X.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new js({...Ze(this._def),innerType:this,defaultValue:r,typeName:X.ZodDefault})}brand(){return new fc({typeName:X.ZodBranded,type:this,...Ze(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Cs({...Ze(this._def),innerType:this,catchValue:r,typeName:X.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return pc.create(this,e)}readonly(){return Rs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},pG=/^c[^\s-]{8,}$/i,mG=/^[0-9a-z]+$/,hG=/^[0-9A-HJKMNP-TV-Z]{26}$/i,gG=/^[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,yG=/^[a-z0-9_-]{21}$/i,vG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_G=/^[-+]?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)?)??$/,bG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",SG=/^(?:(?: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])$/,kG=/^(?:(?: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])$/,xG=/^(([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]))$/,$G=/^(([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])$/,IG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,EG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,yN="((\\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])))",PG=new RegExp(`^${yN}$`);No=class t extends Ke{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ue.string){let o=this._getOrReturnCtx(e);return oe(o,{code:Y.invalid_type,expected:ue.string,received:o.parsedType}),$e}let i=new _r,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),oe(n,{code:Y.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),oe(n,{code:Y.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(n=this._getOrReturnCtx(e,n),s?oe(n,{code:Y.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&oe(n,{code:Y.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")bG.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"email",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")k_||(k_=new RegExp(wG,"u")),k_.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"emoji",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")gG.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"uuid",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")yG.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"nanoid",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")pG.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"cuid",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")mG.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"cuid2",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")hG.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"ulid",code:Y.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),oe(n,{validation:"url",code:Y.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"regex",code:Y.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(e,n),oe(n,{code:Y.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),oe(n,{code:Y.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),oe(n,{code:Y.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?_N(o).test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{code:Y.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?PG.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{code:Y.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?TG(o).test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{code:Y.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?_G.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"duration",code:Y.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?OG(e.data,o.version)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"ip",code:Y.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?zG(e.data,o.alg)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"jwt",code:Y.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?NG(e.data,o.version)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"cidr",code:Y.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?IG.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"base64",code:Y.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?EG.test(e.data)||(n=this._getOrReturnCtx(e,n),oe(n,{validation:"base64url",code:Y.invalid_string,message:o.message}),i.dirty()):ot.assertNever(o);return{status:i.value,value:e.data}}_regex(e,r,i){return this.refinement(n=>e.test(n),{validation:r,code:Y.invalid_string,...ge.errToObj(i)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ge.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ge.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ge.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ge.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ge.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ge.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ge.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ge.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ge.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ge.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ge.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ge.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ge.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ge.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ge.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ge.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ge.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ge.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ge.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ge.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ge.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ge.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ge.errToObj(r)})}nonempty(e){return this.min(1,ge.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};No.create=t=>new No({checks:[],typeName:X.ZodString,coerce:t?.coerce??!1,...Ze(t)});ws=class t extends Ke{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ue.number){let o=this._getOrReturnCtx(e);return oe(o,{code:Y.invalid_type,expected:ue.number,received:o.parsedType}),$e}let i,n=new _r;for(let o of this._def.checks)o.kind==="int"?ot.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{code:Y.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),oe(i,{code:Y.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),oe(i,{code:Y.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?jG(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),oe(i,{code:Y.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),oe(i,{code:Y.not_finite,message:o.message}),n.dirty()):ot.assertNever(o);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ge.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ge.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ge.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ge.toString(r))}setLimit(e,r,i,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:ge.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ge.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ge.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ge.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ot.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(r)&&Number.isFinite(e)}};ws.create=t=>new ws({checks:[],typeName:X.ZodNumber,coerce:t?.coerce||!1,...Ze(t)});Ss=class t extends Ke{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ue.bigint)return this._getInvalidInput(e);let i,n=new _r;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),oe(i,{code:Y.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),oe(i,{code:Y.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),oe(i,{code:Y.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):ot.assertNever(o);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return oe(r,{code:Y.invalid_type,expected:ue.bigint,received:r.parsedType}),$e}gte(e,r){return this.setLimit("min",e,!0,ge.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ge.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ge.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ge.toString(r))}setLimit(e,r,i,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:ge.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ge.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ge.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Ss.create=t=>new Ss({checks:[],typeName:X.ZodBigInt,coerce:t?.coerce??!1,...Ze(t)});ks=class extends Ke{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ue.boolean){let i=this._getOrReturnCtx(e);return oe(i,{code:Y.invalid_type,expected:ue.boolean,received:i.parsedType}),$e}return zr(e.data)}};ks.create=t=>new ks({typeName:X.ZodBoolean,coerce:t?.coerce||!1,...Ze(t)});xs=class t extends Ke{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ue.date){let o=this._getOrReturnCtx(e);return oe(o,{code:Y.invalid_type,expected:ue.date,received:o.parsedType}),$e}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return oe(o,{code:Y.invalid_date}),$e}let i=new _r,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),oe(n,{code:Y.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),oe(n,{code:Y.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):ot.assertNever(o);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ge.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ge.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};xs.create=t=>new xs({checks:[],coerce:t?.coerce||!1,typeName:X.ZodDate,...Ze(t)});La=class extends Ke{_parse(e){if(this._getType(e)!==ue.symbol){let i=this._getOrReturnCtx(e);return oe(i,{code:Y.invalid_type,expected:ue.symbol,received:i.parsedType}),$e}return zr(e.data)}};La.create=t=>new La({typeName:X.ZodSymbol,...Ze(t)});$s=class extends Ke{_parse(e){if(this._getType(e)!==ue.undefined){let i=this._getOrReturnCtx(e);return oe(i,{code:Y.invalid_type,expected:ue.undefined,received:i.parsedType}),$e}return zr(e.data)}};$s.create=t=>new $s({typeName:X.ZodUndefined,...Ze(t)});Is=class extends Ke{_parse(e){if(this._getType(e)!==ue.null){let i=this._getOrReturnCtx(e);return oe(i,{code:Y.invalid_type,expected:ue.null,received:i.parsedType}),$e}return zr(e.data)}};Is.create=t=>new Is({typeName:X.ZodNull,...Ze(t)});jo=class extends Ke{constructor(){super(...arguments),this._any=!0}_parse(e){return zr(e.data)}};jo.create=t=>new jo({typeName:X.ZodAny,...Ze(t)});ro=class extends Ke{constructor(){super(...arguments),this._unknown=!0}_parse(e){return zr(e.data)}};ro.create=t=>new ro({typeName:X.ZodUnknown,...Ze(t)});fi=class extends Ke{_parse(e){let r=this._getOrReturnCtx(e);return oe(r,{code:Y.invalid_type,expected:ue.never,received:r.parsedType}),$e}};fi.create=t=>new fi({typeName:X.ZodNever,...Ze(t)});qa=class extends Ke{_parse(e){if(this._getType(e)!==ue.undefined){let i=this._getOrReturnCtx(e);return oe(i,{code:Y.invalid_type,expected:ue.void,received:i.parsedType}),$e}return zr(e.data)}};qa.create=t=>new qa({typeName:X.ZodVoid,...Ze(t)});no=class t extends Ke{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),n=this._def;if(r.parsedType!==ue.array)return oe(r,{code:Y.invalid_type,expected:ue.array,received:r.parsedType}),$e;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,a=r.data.length<n.exactLength.value;(s||a)&&(oe(r,{code:s?Y.too_big:Y.too_small,minimum:a?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(oe(r,{code:Y.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(oe(r,{code:Y.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>n.type._parseAsync(new Zn(r,s,r.path,a)))).then(s=>_r.mergeArray(i,s));let o=[...r.data].map((s,a)=>n.type._parseSync(new Zn(r,s,r.path,a)));return _r.mergeArray(i,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:ge.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:ge.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:ge.toString(r)}})}nonempty(e){return this.min(1,e)}};no.create=(t,e)=>new no({type:t,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...Ze(e)});dn=class t extends Ke{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ot.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ue.object){let l=this._getOrReturnCtx(e);return oe(l,{code:Y.invalid_type,expected:ue.object,received:l.parsedType}),$e}let{status:i,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof fi&&this._def.unknownKeys==="strip"))for(let l in n.data)s.includes(l)||a.push(l);let u=[];for(let l of s){let c=o[l],d=n.data[l];u.push({key:{status:"valid",value:l},value:c._parse(new Zn(n,d,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof fi){let l=this._def.unknownKeys;if(l==="passthrough")for(let c of a)u.push({key:{status:"valid",value:c},value:{status:"valid",value:n.data[c]}});else if(l==="strict")a.length>0&&(oe(n,{code:Y.unrecognized_keys,keys:a}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let c of a){let d=n.data[c];u.push({key:{status:"valid",value:c},value:l._parse(new Zn(n,d,n.path,c)),alwaysSet:c in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let c of u){let d=await c.key,p=await c.value;l.push({key:d,value:p,alwaysSet:c.alwaysSet})}return l}).then(l=>_r.mergeObjectSync(i,l)):_r.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(e){return ge.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,i)=>{let n=this._def.errorMap?.(r,i).message??i.defaultError;return r.code==="unrecognized_keys"?{message:ge.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:X.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let i of ot.objectKeys(e))e[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let i of ot.objectKeys(this.shape))e[i]||(r[i]=this.shape[i]);return new t({...this._def,shape:()=>r})}deepPartial(){return Za(this)}partial(e){let r={};for(let i of ot.objectKeys(this.shape)){let n=this.shape[i];e&&!e[i]?r[i]=n:r[i]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let i of ot.objectKeys(this.shape))if(e&&!e[i])r[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof Mn;)o=o._def.innerType;r[i]=o}return new t({...this._def,shape:()=>r})}keyof(){return bN(ot.objectKeys(this.shape))}};dn.create=(t,e)=>new dn({shape:()=>t,unknownKeys:"strip",catchall:fi.create(),typeName:X.ZodObject,...Ze(e)});dn.strictCreate=(t,e)=>new dn({shape:()=>t,unknownKeys:"strict",catchall:fi.create(),typeName:X.ZodObject,...Ze(e)});dn.lazycreate=(t,e)=>new dn({shape:t,unknownKeys:"strip",catchall:fi.create(),typeName:X.ZodObject,...Ze(e)});Es=class extends Ke{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function n(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new cn(a.ctx.common.issues));return oe(r,{code:Y.invalid_union,unionErrors:s}),$e}if(r.common.async)return Promise.all(i.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let o,s=[];for(let u of i){let l={...r,common:{...r.common,issues:[]},parent:null},c=u._parseSync({data:r.data,path:r.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(u=>new cn(u));return oe(r,{code:Y.invalid_union,unionErrors:a}),$e}}get options(){return this._def.options}};Es.create=(t,e)=>new Es({options:t,typeName:X.ZodUnion,...Ze(e)});to=t=>t instanceof Ts?to(t.schema):t instanceof Ln?to(t.innerType()):t instanceof Os?[t.value]:t instanceof zs?t.options:t instanceof Ns?ot.objectValues(t.enum):t instanceof js?to(t._def.innerType):t instanceof $s?[void 0]:t instanceof Is?[null]:t instanceof Mn?[void 0,...to(t.unwrap())]:t instanceof Ui?[null,...to(t.unwrap())]:t instanceof fc||t instanceof Rs?to(t.unwrap()):t instanceof Cs?to(t._def.innerType):[],Hp=class t extends Ke{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ue.object)return oe(r,{code:Y.invalid_type,expected:ue.object,received:r.parsedType}),$e;let i=this.discriminator,n=r.data[i],o=this.optionsMap.get(n);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(oe(r,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),$e)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,i){let n=new Map;for(let o of r){let s=to(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,o)}}return new t({typeName:X.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...Ze(i)})}};Ps=class extends Ke{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=(o,s)=>{if(Bp(o)||Bp(s))return $e;let a=x_(o.value,s.value);return a.valid?((Kp(o)||Kp(s))&&r.dirty(),{status:r.value,value:a.data}):(oe(i,{code:Y.invalid_intersection_types}),$e)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,s])=>n(o,s)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Ps.create=(t,e,r)=>new Ps({left:t,right:e,typeName:X.ZodIntersection,...Ze(r)});Di=class t extends Ke{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ue.array)return oe(i,{code:Y.invalid_type,expected:ue.array,received:i.parsedType}),$e;if(i.data.length<this._def.items.length)return oe(i,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$e;!this._def.rest&&i.data.length>this._def.items.length&&(oe(i,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...i.data].map((s,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new Zn(i,s,i.path,a)):null}).filter(s=>!!s);return i.common.async?Promise.all(o).then(s=>_r.mergeArray(r,s)):_r.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Di.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Di({items:t,typeName:X.ZodTuple,rest:null,...Ze(e)})};Jp=class t extends Ke{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ue.object)return oe(i,{code:Y.invalid_type,expected:ue.object,received:i.parsedType}),$e;let n=[],o=this._def.keyType,s=this._def.valueType;for(let a in i.data)n.push({key:o._parse(new Zn(i,a,i.path,a)),value:s._parse(new Zn(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?_r.mergeObjectAsync(r,n):_r.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof Ke?new t({keyType:e,valueType:r,typeName:X.ZodRecord,...Ze(i)}):new t({keyType:No.create(),valueType:e,typeName:X.ZodRecord,...Ze(r)})}},Fa=class extends Ke{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ue.map)return oe(i,{code:Y.invalid_type,expected:ue.map,received:i.parsedType}),$e;let n=this._def.keyType,o=this._def.valueType,s=[...i.data.entries()].map(([a,u],l)=>({key:n._parse(new Zn(i,a,i.path,[l,"key"])),value:o._parse(new Zn(i,u,i.path,[l,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of s){let l=await u.key,c=await u.value;if(l.status==="aborted"||c.status==="aborted")return $e;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),a.set(l.value,c.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let u of s){let l=u.key,c=u.value;if(l.status==="aborted"||c.status==="aborted")return $e;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),a.set(l.value,c.value)}return{status:r.value,value:a}}}};Fa.create=(t,e,r)=>new Fa({valueType:e,keyType:t,typeName:X.ZodMap,...Ze(r)});Va=class t extends Ke{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ue.set)return oe(i,{code:Y.invalid_type,expected:ue.set,received:i.parsedType}),$e;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(oe(i,{code:Y.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(oe(i,{code:Y.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function s(u){let l=new Set;for(let c of u){if(c.status==="aborted")return $e;c.status==="dirty"&&r.dirty(),l.add(c.value)}return{status:r.value,value:l}}let a=[...i.data.values()].map((u,l)=>o._parse(new Zn(i,u,i.path,l)));return i.common.async?Promise.all(a).then(u=>s(u)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:ge.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:ge.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Va.create=(t,e)=>new Va({valueType:t,minSize:null,maxSize:null,typeName:X.ZodSet,...Ze(e)});Yp=class t extends Ke{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ue.function)return oe(r,{code:Y.invalid_type,expected:ue.function,received:r.parsedType}),$e;function i(a,u){return dc({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ua(),eo].filter(l=>!!l),issueData:{code:Y.invalid_arguments,argumentsError:u}})}function n(a,u){return dc({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ua(),eo].filter(l=>!!l),issueData:{code:Y.invalid_return_type,returnTypeError:u}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Co){let a=this;return zr(async function(...u){let l=new cn([]),c=await a._def.args.parseAsync(u,o).catch(f=>{throw l.addIssue(i(u,f)),l}),d=await Reflect.apply(s,this,c);return await a._def.returns._def.type.parseAsync(d,o).catch(f=>{throw l.addIssue(n(d,f)),l})})}else{let a=this;return zr(function(...u){let l=a._def.args.safeParse(u,o);if(!l.success)throw new cn([i(u,l.error)]);let c=Reflect.apply(s,this,l.data),d=a._def.returns.safeParse(c,o);if(!d.success)throw new cn([n(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Di.create(e).rest(ro.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,i){return new t({args:e||Di.create([]).rest(ro.create()),returns:r||ro.create(),typeName:X.ZodFunction,...Ze(i)})}},Ts=class extends Ke{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ts.create=(t,e)=>new Ts({getter:t,typeName:X.ZodLazy,...Ze(e)});Os=class extends Ke{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return oe(r,{received:r.data,code:Y.invalid_literal,expected:this._def.value}),$e}return{status:"valid",value:e.data}}get value(){return this._def.value}};Os.create=(t,e)=>new Os({value:t,typeName:X.ZodLiteral,...Ze(e)});zs=class t extends Ke{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return oe(r,{expected:ot.joinValues(i),received:r.parsedType,code:Y.invalid_type}),$e}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),i=this._def.values;return oe(r,{received:r.data,code:Y.invalid_enum_value,options:i}),$e}return zr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(i=>!e.includes(i)),{...this._def,...r})}};zs.create=bN;Ns=class extends Ke{_parse(e){let r=ot.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==ue.string&&i.parsedType!==ue.number){let n=ot.objectValues(r);return oe(i,{expected:ot.joinValues(n),received:i.parsedType,code:Y.invalid_type}),$e}if(this._cache||(this._cache=new Set(ot.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=ot.objectValues(r);return oe(i,{received:i.data,code:Y.invalid_enum_value,options:n}),$e}return zr(e.data)}get enum(){return this._def.values}};Ns.create=(t,e)=>new Ns({values:t,typeName:X.ZodNativeEnum,...Ze(e)});Co=class extends Ke{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ue.promise&&r.common.async===!1)return oe(r,{code:Y.invalid_type,expected:ue.promise,received:r.parsedType}),$e;let i=r.parsedType===ue.promise?r.data:Promise.resolve(r.data);return zr(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Co.create=(t,e)=>new Co({type:t,typeName:X.ZodPromise,...Ze(e)});Ln=class extends Ke{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:s=>{oe(i,s),s.fatal?r.abort():r.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(i.data,o);if(i.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return $e;let u=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return u.status==="aborted"?$e:u.status==="dirty"?bs(u.value):r.value==="dirty"?bs(u.value):u});{if(r.value==="aborted")return $e;let a=this._def.schema._parseSync({data:s,path:i.path,parent:i});return a.status==="aborted"?$e:a.status==="dirty"?bs(a.value):r.value==="dirty"?bs(a.value):a}}if(n.type==="refinement"){let s=a=>{let u=n.refinement(a,o);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?$e:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?$e:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(n.type==="transform")if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!zo(s))return $e;let a=n.transform(s.value,o);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:i.data,path:i.path,parent:i}).then(s=>zo(s)?Promise.resolve(n.transform(s.value,o)).then(a=>({status:r.value,value:a})):$e);ot.assertNever(n)}};Ln.create=(t,e,r)=>new Ln({schema:t,typeName:X.ZodEffects,effect:e,...Ze(r)});Ln.createWithPreprocess=(t,e,r)=>new Ln({schema:e,effect:{type:"preprocess",transform:t},typeName:X.ZodEffects,...Ze(r)});Mn=class extends Ke{_parse(e){return this._getType(e)===ue.undefined?zr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Mn.create=(t,e)=>new Mn({innerType:t,typeName:X.ZodOptional,...Ze(e)});Ui=class extends Ke{_parse(e){return this._getType(e)===ue.null?zr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ui.create=(t,e)=>new Ui({innerType:t,typeName:X.ZodNullable,...Ze(e)});js=class extends Ke{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===ue.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};js.create=(t,e)=>new js({innerType:t,typeName:X.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ze(e)});Cs=class extends Ke{_parse(e){let{ctx:r}=this._processInputParams(e),i={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Ma(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new cn(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new cn(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};Cs.create=(t,e)=>new Cs({innerType:t,typeName:X.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ze(e)});Wa=class extends Ke{_parse(e){if(this._getType(e)!==ue.nan){let i=this._getOrReturnCtx(e);return oe(i,{code:Y.invalid_type,expected:ue.nan,received:i.parsedType}),$e}return{status:"valid",value:e.data}}};Wa.create=t=>new Wa({typeName:X.ZodNaN,...Ze(t)});CG=Symbol("zod_brand"),fc=class extends Ke{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}},pc=class t extends Ke{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?$e:o.status==="dirty"?(r.dirty(),bs(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{let n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?$e:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(e,r){return new t({in:e,out:r,typeName:X.ZodPipeline})}},Rs=class extends Ke{_parse(e){let r=this._def.innerType._parse(e),i=n=>(zo(n)&&(n.value=Object.freeze(n.value)),n);return Ma(r)?r.then(n=>i(n)):i(r)}unwrap(){return this._def.innerType}};Rs.create=(t,e)=>new Rs({innerType:t,typeName:X.ZodReadonly,...Ze(e)});RG={object:dn.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(X||(X={}));AG=(t,e={message:`Input not instance of ${t.name}`})=>wN(r=>r instanceof t,e),SN=No.create,kN=ws.create,DG=Wa.create,UG=Ss.create,xN=ks.create,MG=xs.create,ZG=La.create,LG=$s.create,qG=Is.create,FG=jo.create,VG=ro.create,WG=fi.create,GG=qa.create,BG=no.create,$N=dn.create,KG=dn.strictCreate,HG=Es.create,JG=Hp.create,YG=Ps.create,QG=Di.create,XG=Jp.create,eB=Fa.create,tB=Va.create,rB=Yp.create,nB=Ts.create,iB=Os.create,oB=zs.create,sB=Ns.create,aB=Co.create,uB=Ln.create,lB=Mn.create,cB=Ui.create,dB=Ln.createWithPreprocess,fB=pc.create,pB=()=>SN().optional(),mB=()=>kN().optional(),hB=()=>xN().optional(),gB={string:(t=>No.create({...t,coerce:!0})),number:(t=>ws.create({...t,coerce:!0})),boolean:(t=>ks.create({...t,coerce:!0})),bigint:(t=>Ss.create({...t,coerce:!0})),date:(t=>xs.create({...t,coerce:!0}))},yB=$e});var $_={};An($_,{BRAND:()=>CG,DIRTY:()=>bs,EMPTY_PATH:()=>fG,INVALID:()=>$e,NEVER:()=>yB,OK:()=>zr,ParseStatus:()=>_r,Schema:()=>Ke,ZodAny:()=>jo,ZodArray:()=>no,ZodBigInt:()=>Ss,ZodBoolean:()=>ks,ZodBranded:()=>fc,ZodCatch:()=>Cs,ZodDate:()=>xs,ZodDefault:()=>js,ZodDiscriminatedUnion:()=>Hp,ZodEffects:()=>Ln,ZodEnum:()=>zs,ZodError:()=>cn,ZodFirstPartyTypeKind:()=>X,ZodFunction:()=>Yp,ZodIntersection:()=>Ps,ZodIssueCode:()=>Y,ZodLazy:()=>Ts,ZodLiteral:()=>Os,ZodMap:()=>Fa,ZodNaN:()=>Wa,ZodNativeEnum:()=>Ns,ZodNever:()=>fi,ZodNull:()=>Is,ZodNullable:()=>Ui,ZodNumber:()=>ws,ZodObject:()=>dn,ZodOptional:()=>Mn,ZodParsedType:()=>ue,ZodPipeline:()=>pc,ZodPromise:()=>Co,ZodReadonly:()=>Rs,ZodRecord:()=>Jp,ZodSchema:()=>Ke,ZodSet:()=>Va,ZodString:()=>No,ZodSymbol:()=>La,ZodTransformer:()=>Ln,ZodTuple:()=>Di,ZodType:()=>Ke,ZodUndefined:()=>$s,ZodUnion:()=>Es,ZodUnknown:()=>ro,ZodVoid:()=>qa,addIssueToContext:()=>oe,any:()=>FG,array:()=>BG,bigint:()=>UG,boolean:()=>xN,coerce:()=>gB,custom:()=>wN,date:()=>MG,datetimeRegex:()=>_N,defaultErrorMap:()=>eo,discriminatedUnion:()=>JG,effect:()=>uB,enum:()=>oB,function:()=>rB,getErrorMap:()=>Ua,getParsedType:()=>Ai,instanceof:()=>AG,intersection:()=>YG,isAborted:()=>Bp,isAsync:()=>Ma,isDirty:()=>Kp,isValid:()=>zo,late:()=>RG,lazy:()=>nB,literal:()=>iB,makeIssue:()=>dc,map:()=>eB,nan:()=>DG,nativeEnum:()=>sB,never:()=>WG,null:()=>qG,nullable:()=>cB,number:()=>kN,object:()=>$N,objectUtil:()=>b_,oboolean:()=>hB,onumber:()=>mB,optional:()=>lB,ostring:()=>pB,pipeline:()=>fB,preprocess:()=>dB,promise:()=>aB,quotelessJson:()=>lG,record:()=>XG,set:()=>tB,setErrorMap:()=>dG,strictObject:()=>KG,string:()=>SN,symbol:()=>ZG,transformer:()=>uB,tuple:()=>QG,undefined:()=>LG,union:()=>HG,unknown:()=>VG,util:()=>ot,void:()=>GG});var I_=N(()=>{Gp();S_();pN();cc();IN();Wp()});var Ga=N(()=>{I_();I_()});function qt(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?lc(e,t.currentPath):e.join("/")}}var qn=N(()=>{Vp()});function E_(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==X.ZodAny&&(r.items=Ie(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&at(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&at(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(at(r,"minItems",t.exactLength.value,t.exactLength.message,e),at(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}var P_=N(()=>{Ga();Oo();sr()});function T_(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let i of t.checks)switch(i.kind){case"min":e.target==="jsonSchema7"?i.inclusive?at(r,"minimum",i.value,i.message,e):at(r,"exclusiveMinimum",i.value,i.message,e):(i.inclusive||(r.exclusiveMinimum=!0),at(r,"minimum",i.value,i.message,e));break;case"max":e.target==="jsonSchema7"?i.inclusive?at(r,"maximum",i.value,i.message,e):at(r,"exclusiveMaximum",i.value,i.message,e):(i.inclusive||(r.exclusiveMaximum=!0),at(r,"maximum",i.value,i.message,e));break;case"multipleOf":at(r,"multipleOf",i.value,i.message,e);break}return r}var O_=N(()=>{Oo()});function z_(){return{type:"boolean"}}var N_=N(()=>{});function mc(t,e){return Ie(t.type._def,e)}var Qp=N(()=>{sr()});var j_,C_=N(()=>{sr();j_=(t,e)=>Ie(t.innerType._def,e)});function Xp(t,e,r){let i=r??e.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((n,o)=>Xp(t,e,n))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return _B(t,e)}}var _B,R_=N(()=>{Oo();_B=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let i of t.checks)switch(i.kind){case"min":at(r,"minimum",i.value,i.message,e);break;case"max":at(r,"maximum",i.value,i.message,e);break}return r}});function A_(t,e){return{...Ie(t.innerType._def,e),default:t.defaultValue()}}var D_=N(()=>{sr()});function U_(t,e){return e.effectStrategy==="input"?Ie(t.schema._def,e):qt(e)}var M_=N(()=>{sr();qn()});function Z_(t){return{type:"string",enum:Array.from(t.values)}}var L_=N(()=>{});function q_(t,e){let r=[Ie(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),Ie(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o),i=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach(o=>{if(bB(o))n.push(...o.allOf),o.unevaluatedProperties===void 0&&(i=void 0);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:a,...u}=o;s=u}else i=void 0;n.push(s)}}),n.length?{allOf:n,...i}:void 0}var bB,F_=N(()=>{sr();bB=t=>"type"in t&&t.type==="string"?!1:"allOf"in t});function V_(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var W_=N(()=>{});function hc(t,e){let r={type:"string"};if(t.checks)for(let i of t.checks)switch(i.kind){case"min":at(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,i.value):i.value,i.message,e);break;case"max":at(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,i.value):i.value,i.message,e);break;case"email":switch(e.emailStrategy){case"format:email":pi(r,"email",i.message,e);break;case"format:idn-email":pi(r,"idn-email",i.message,e);break;case"pattern:zod":Wr(r,Fn.email,i.message,e);break}break;case"url":pi(r,"uri",i.message,e);break;case"uuid":pi(r,"uuid",i.message,e);break;case"regex":Wr(r,i.regex,i.message,e);break;case"cuid":Wr(r,Fn.cuid,i.message,e);break;case"cuid2":Wr(r,Fn.cuid2,i.message,e);break;case"startsWith":Wr(r,RegExp(`^${B_(i.value,e)}`),i.message,e);break;case"endsWith":Wr(r,RegExp(`${B_(i.value,e)}$`),i.message,e);break;case"datetime":pi(r,"date-time",i.message,e);break;case"date":pi(r,"date",i.message,e);break;case"time":pi(r,"time",i.message,e);break;case"duration":pi(r,"duration",i.message,e);break;case"length":at(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,i.value):i.value,i.message,e),at(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,i.value):i.value,i.message,e);break;case"includes":{Wr(r,RegExp(B_(i.value,e)),i.message,e);break}case"ip":{i.version!=="v6"&&pi(r,"ipv4",i.message,e),i.version!=="v4"&&pi(r,"ipv6",i.message,e);break}case"base64url":Wr(r,Fn.base64url,i.message,e);break;case"jwt":Wr(r,Fn.jwt,i.message,e);break;case"cidr":{i.version!=="v6"&&Wr(r,Fn.ipv4Cidr,i.message,e),i.version!=="v4"&&Wr(r,Fn.ipv6Cidr,i.message,e);break}case"emoji":Wr(r,Fn.emoji(),i.message,e);break;case"ulid":{Wr(r,Fn.ulid,i.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{pi(r,"binary",i.message,e);break}case"contentEncoding:base64":{at(r,"contentEncoding","base64",i.message,e);break}case"pattern:zod":{Wr(r,Fn.base64,i.message,e);break}}break}case"nanoid":Wr(r,Fn.nanoid,i.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function B_(t,e){return e.patternStrategy==="escape"?SB(t):t}function SB(t){let e="";for(let r=0;r<t.length;r++)wB.has(t[r])||(e+="\\"),e+=t[r];return e}function pi(t,e,r,i){t.format||t.anyOf?.some(n=>n.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&i.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&i.errorMessages&&{errorMessage:{format:r}}})):at(t,"format",e,r,i)}function Wr(t,e,r,i){t.pattern||t.allOf?.some(n=>n.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&i.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:EN(e,i),...r&&i.errorMessages&&{errorMessage:{pattern:r}}})):at(t,"pattern",EN(e,i),r,i)}function EN(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},i=r.i?t.source.toLowerCase():t.source,n="",o=!1,s=!1,a=!1;for(let u=0;u<i.length;u++){if(o){n+=i[u],o=!1;continue}if(r.i){if(s){if(i[u].match(/[a-z]/)){a?(n+=i[u],n+=`${i[u-2]}-${i[u]}`.toUpperCase(),a=!1):i[u+1]==="-"&&i[u+2]?.match(/[a-z]/)?(n+=i[u],a=!0):n+=`${i[u]}${i[u].toUpperCase()}`;continue}}else if(i[u].match(/[a-z]/)){n+=`[${i[u]}${i[u].toUpperCase()}]`;continue}}if(r.m){if(i[u]==="^"){n+=`(^|(?<=[\r
20
- ]))`;continue}else if(i[u]==="$"){n+=`($|(?=[\r
21
- ]))`;continue}}if(r.s&&i[u]==="."){n+=s?`${i[u]}\r
22
- `:`[${i[u]}\r
23
- ]`;continue}n+=i[u],i[u]==="\\"?o=!0:s&&i[u]==="]"?s=!1:!s&&i[u]==="["&&(s=!0)}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return n}var G_,Fn,wB,em=N(()=>{Oo();Fn={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:()=>(G_===void 0&&(G_=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),G_),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-_]*$/};wB=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789")});function gc(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===X.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((i,n)=>({...i,[n]:Ie(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",n]})??qt(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:Ie(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===X.ZodString&&t.keyType._def.checks?.length){let{type:i,...n}=hc(t.keyType._def,e);return{...r,propertyNames:n}}else{if(t.keyType?._def.typeName===X.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===X.ZodBranded&&t.keyType._def.type._def.typeName===X.ZodString&&t.keyType._def.type._def.checks?.length){let{type:i,...n}=mc(t.keyType._def,e);return{...r,propertyNames:n}}}return r}var tm=N(()=>{Ga();sr();em();Qp();qn()});function K_(t,e){if(e.mapStrategy==="record")return gc(t,e);let r=Ie(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||qt(e),i=Ie(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||qt(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,i],minItems:2,maxItems:2}}}var H_=N(()=>{sr();tm();qn()});function J_(t){let e=t.values,i=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),n=Array.from(new Set(i.map(o=>typeof o)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:i}}var Y_=N(()=>{});function Q_(t){return t.target==="openAi"?void 0:{not:qt({...t,currentPath:[...t.currentPath,"not"]})}}var X_=N(()=>{qn()});function eb(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var tb=N(()=>{});function rb(t,e){if(e.target==="openApi3")return PN(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(i=>i._def.typeName in Ba&&(!i._def.checks||!i._def.checks.length))){let i=r.reduce((n,o)=>{let s=Ba[o._def.typeName];return s&&!n.includes(s)?[...n,s]:n},[]);return{type:i.length>1?i:i[0]}}else if(r.every(i=>i._def.typeName==="ZodLiteral"&&!i.description)){let i=r.reduce((n,o)=>{let s=typeof o._def.value;switch(s){case"string":case"number":case"boolean":return[...n,s];case"bigint":return[...n,"integer"];case"object":if(o._def.value===null)return[...n,"null"];default:return n}},[]);if(i.length===r.length){let n=i.filter((o,s,a)=>a.indexOf(o)===s);return{type:n.length>1?n:n[0],enum:r.reduce((o,s)=>o.includes(s._def.value)?o:[...o,s._def.value],[])}}}else if(r.every(i=>i._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((i,n)=>[...i,...n._def.values.filter(o=>!i.includes(o))],[])};return PN(t,e)}var Ba,PN,rm=N(()=>{sr();Ba={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};PN=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((i,n)=>Ie(i._def,{...e,currentPath:[...e.currentPath,"anyOf",`${n}`]})).filter(i=>!!i&&(!e.strictUnions||typeof i=="object"&&Object.keys(i).length>0));return r.length?{anyOf:r}:void 0}});function nb(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Ba[t.innerType._def.typeName],nullable:!0}:{type:[Ba[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let i=Ie(t.innerType._def,{...e,currentPath:[...e.currentPath]});return i&&"$ref"in i?{allOf:[i],nullable:!0}:i&&{...i,nullable:!0}}let r=Ie(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}var ib=N(()=>{sr();rm()});function ob(t,e){let r={type:"number"};if(!t.checks)return r;for(let i of t.checks)switch(i.kind){case"int":r.type="integer",Fp(r,"type",i.message,e);break;case"min":e.target==="jsonSchema7"?i.inclusive?at(r,"minimum",i.value,i.message,e):at(r,"exclusiveMinimum",i.value,i.message,e):(i.inclusive||(r.exclusiveMinimum=!0),at(r,"minimum",i.value,i.message,e));break;case"max":e.target==="jsonSchema7"?i.inclusive?at(r,"maximum",i.value,i.message,e):at(r,"exclusiveMaximum",i.value,i.message,e):(i.inclusive||(r.exclusiveMaximum=!0),at(r,"maximum",i.value,i.message,e));break;case"multipleOf":at(r,"multipleOf",i.value,i.message,e);break}return r}var sb=N(()=>{Oo()});function ab(t,e){let r=e.target==="openAi",i={type:"object",properties:{}},n=[],o=t.shape();for(let a in o){let u=o[a];if(u===void 0||u._def===void 0)continue;let l=xB(u);l&&r&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),l=!1);let c=Ie(u._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});c!==void 0&&(i.properties[a]=c,l||n.push(a))}n.length&&(i.required=n);let s=kB(t,e);return s!==void 0&&(i.additionalProperties=s),i}function kB(t,e){if(t.catchall._def.typeName!=="ZodNever")return Ie(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function xB(t){try{return t.isOptional()}catch{return!0}}var ub=N(()=>{sr()});var lb,cb=N(()=>{sr();qn();lb=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return Ie(t.innerType._def,e);let r=Ie(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:qt(e)},r]}:qt(e)}});var db,fb=N(()=>{sr();db=(t,e)=>{if(e.pipeStrategy==="input")return Ie(t.in._def,e);if(e.pipeStrategy==="output")return Ie(t.out._def,e);let r=Ie(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),i=Ie(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,i].filter(n=>n!==void 0)}}});function pb(t,e){return Ie(t.type._def,e)}var mb=N(()=>{sr()});function hb(t,e){let i={type:"array",uniqueItems:!0,items:Ie(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&at(i,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&at(i,"maxItems",t.maxSize.value,t.maxSize.message,e),i}var gb=N(()=>{Oo();sr()});function yb(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,i)=>Ie(r._def,{...e,currentPath:[...e.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[]),additionalItems:Ie(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,i)=>Ie(r._def,{...e,currentPath:[...e.currentPath,"items",`${i}`]})).reduce((r,i)=>i===void 0?r:[...r,i],[])}}var vb=N(()=>{sr()});function _b(t){return{not:qt(t)}}var bb=N(()=>{qn()});function wb(t){return qt(t)}var Sb=N(()=>{qn()});var kb,xb=N(()=>{sr();kb=(t,e)=>Ie(t.innerType._def,e)});var $b,Ib=N(()=>{Ga();qn();P_();O_();N_();Qp();C_();R_();D_();M_();L_();F_();W_();H_();Y_();X_();tb();ib();sb();ub();cb();fb();mb();tm();gb();em();vb();bb();rm();Sb();xb();$b=(t,e,r)=>{switch(e){case X.ZodString:return hc(t,r);case X.ZodNumber:return ob(t,r);case X.ZodObject:return ab(t,r);case X.ZodBigInt:return T_(t,r);case X.ZodBoolean:return z_();case X.ZodDate:return Xp(t,r);case X.ZodUndefined:return _b(r);case X.ZodNull:return eb(r);case X.ZodArray:return E_(t,r);case X.ZodUnion:case X.ZodDiscriminatedUnion:return rb(t,r);case X.ZodIntersection:return q_(t,r);case X.ZodTuple:return yb(t,r);case X.ZodRecord:return gc(t,r);case X.ZodLiteral:return V_(t,r);case X.ZodEnum:return Z_(t);case X.ZodNativeEnum:return J_(t);case X.ZodNullable:return nb(t,r);case X.ZodOptional:return lb(t,r);case X.ZodMap:return K_(t,r);case X.ZodSet:return hb(t,r);case X.ZodLazy:return()=>t.getter()._def;case X.ZodPromise:return pb(t,r);case X.ZodNaN:case X.ZodNever:return Q_(r);case X.ZodEffects:return U_(t,r);case X.ZodAny:return qt(r);case X.ZodUnknown:return wb(r);case X.ZodDefault:return A_(t,r);case X.ZodBranded:return mc(t,r);case X.ZodReadonly:return kb(t,r);case X.ZodCatch:return j_(t,r);case X.ZodPipeline:return db(t,r);case X.ZodFunction:case X.ZodVoid:case X.ZodSymbol:return;default:return(i=>{})(e)}}});function Ie(t,e,r=!1){let i=e.seen.get(t);if(e.override){let a=e.override?.(t,e,i,r);if(a!==g_)return a}if(i&&!r){let a=$B(i,e);if(a!==void 0)return a}let n={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,n);let o=$b(t,t.typeName,e),s=typeof o=="function"?Ie(o(),e):o;if(s&&IB(t,e,s),e.postProcess){let a=e.postProcess(s,t,e);return n.jsonSchema=s,a}return n.jsonSchema=s,s}var $B,IB,sr=N(()=>{qp();Ib();Vp();qn();$B=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:lc(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,i)=>e.currentPath[i]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),qt(e)):e.$refStrategy==="seen"?qt(e):void 0}},IB=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r)});var TN=N(()=>{});var Gr,Eb=N(()=>{sr();__();qn();Gr=(t,e)=>{let r=v_(e),i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((u,[l,c])=>({...u,[l]:Ie(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,l]},!0)??qt(r)}),{}):void 0,n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=Ie(t._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??qt(r),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(o.title=s),r.flags.hasReferencedOpenAiAnyType&&(i||(i={}),i[r.openAiAnyTypeName]||(i[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=n===void 0?i?{...o,[r.definitionPath]:i}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...i,[n]:o}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a}});var ON={};An(ON,{addErrorMessage:()=>Fp,default:()=>EB,defaultOptions:()=>h_,getDefaultOptions:()=>y_,getRefs:()=>v_,getRelativePath:()=>lc,ignoreOverride:()=>g_,jsonDescription:()=>uG,parseAnyDef:()=>qt,parseArrayDef:()=>E_,parseBigintDef:()=>T_,parseBooleanDef:()=>z_,parseBrandedDef:()=>mc,parseCatchDef:()=>j_,parseDateDef:()=>Xp,parseDef:()=>Ie,parseDefaultDef:()=>A_,parseEffectsDef:()=>U_,parseEnumDef:()=>Z_,parseIntersectionDef:()=>q_,parseLiteralDef:()=>V_,parseMapDef:()=>K_,parseNativeEnumDef:()=>J_,parseNeverDef:()=>Q_,parseNullDef:()=>eb,parseNullableDef:()=>nb,parseNumberDef:()=>ob,parseObjectDef:()=>ab,parseOptionalDef:()=>lb,parsePipelineDef:()=>db,parsePromiseDef:()=>pb,parseReadonlyDef:()=>kb,parseRecordDef:()=>gc,parseSetDef:()=>hb,parseStringDef:()=>hc,parseTupleDef:()=>yb,parseUndefinedDef:()=>_b,parseUnionDef:()=>rb,parseUnknownDef:()=>wb,primitiveMappings:()=>Ba,selectParser:()=>$b,setResponseValueAndErrors:()=>at,zodPatterns:()=>Fn,zodToJsonSchema:()=>Gr});var EB,Ro=N(()=>{qp();__();Oo();Vp();sr();TN();qn();P_();O_();N_();Qp();C_();R_();D_();M_();L_();F_();W_();H_();Y_();X_();tb();ib();sb();ub();cb();fb();mb();xb();tm();gb();em();vb();bb();rm();Sb();Ib();Eb();Eb();EB=Gr});var Ka,Pb=N(()=>{Ro();Ka=class{static generateFileOutputInstructions(e,r){let i;typeof e?.parse=="function"?i=Gr(e,{target:"openApi3"}):i=e;let n=this._buildExample(i);return`
11
+ `)}_emitGraphLogMarker(e){if(!this._emitWorkflowGraphMarkers)return;let t=`${Zn}${JSON.stringify(e)}
12
+ `;this._origStdoutWrite?this._origStdoutWrite(t):process.stdout.write(t)}_writeDot(e,t){this._origStdoutWrite?(this._outState&&!this._outState.lineStart&&(this._origStdoutWrite(`
13
+ `),this._outState.lineStart=!0,this._outState.col=0),this._origStdoutWrite(`${e} ${t}
14
+ `)):process.stdout.write.bind(process.stdout)(`${e} ${t}
15
+ `)}step(e){this._origStdoutWrite?this._writeDot(Yt,e):process.stdout.write.bind(process.stdout)(`${Ke} ${Yt} ${e}
16
+ `)}stepTool(e){this._origStdoutWrite?this._writeDot(Zr,e):process.stdout.write.bind(process.stdout)(`${Ke} ${Zr} ${e}
17
+ `)}stepMemory(e){let t=j.hex("#2dd4bf")(e);this._origStdoutWrite?this._writeDot(Hr,t):process.stdout.write.bind(process.stdout)(`${Ke} ${Hr} ${t}
18
+ `)}stepFail(e){this._origStdoutWrite?this._writeDot(Kt,j.red(e)):process.stdout.write.bind(process.stdout)(`${Ke} ${Kt} ${j.red(e)}
19
+ `)}nodeStart(e){this._currentNode=e,this._emitGraphLogMarker({phase:"node_begin",node:e}),this._rawWrite(`${Hn} ${e}`),this._startIntercepting()}nodeComplete(e,t={}){this._stopIntercepting();let{duration:r,details:s}=t;if(s)for(let o of s)this._rawWrite(`${Yt} ${o}`);let n=r?j.dim(` ${Xr(r)}`):"";this._rawWrite(`${Kr} ${j.green("done")}${n}`),this._emitGraphLogMarker({phase:"node_end",node:e}),this._rawWrite("")}nodeFailed(e,t,r={}){this._stopIntercepting();let{duration:s}=r,n=s?j.dim(` ${Xr(s)}`):"";this._rawWrite(`${Kt} ${j.red(t)}`),this._rawWrite(`${Kr} ${j.red("failed")}${n}`),this._emitGraphLogMarker({phase:"node_end",node:e}),this._rawWrite("")}route(e,t){this._rawWrite(j.dim(` ${e} \u2192 ${t}`)),this._rawWrite("")}graphComplete(){this._rawWrite(j.green.bold("\u2713 Workflow completed"))}},D=new Zt});var K,ue=M(()=>{K=class{constructor(e,t,r=0){this.name=e,this.description=t,this.priority=r}async invoke(e,t={}){throw new Error("AgentStrategy.invoke() must be implemented by subclass")}canHandle(e){throw new Error("AgentStrategy.canHandle() must be implemented by subclass")}getName(){return this.name}getDescription(){return this.description}getPriority(){return this.priority}}});var G,Vn,qn,Ht,Vt,es,yt,oe=M(()=>{G={ASSISTANT:"gpt-5.4-nano-2026-03-17",CLAUDE:"claude-sonnet-4-6",CURSOR:"auto",CODEX:"o4-mini",GEMINI:"gemini-2.5-pro",OPENAI_POSTPROCESSING:"gpt-4o-mini"},Vn={ASSISTANT:"assistant",CLAUDE:"claude",CURSOR:"cursor",CODEX:"codex",GEMINI:"gemini"},qn={DEBUG:"debug",INFO:"info",WARN:"warn",ERROR:"error",SILENT:"silent"},Ht={auto:"claude-sonnet-4-6","sonnet-4.6":"claude-sonnet-4-6","sonnet-4-6":"claude-sonnet-4-6","opus-4.6":"claude-opus-4-6","opus-4-6":"claude-opus-4-6","sonnet-4.5":"claude-sonnet-4-5-20250929","sonnet-4-5":"claude-sonnet-4-5-20250929","opus-4.5":"claude-opus-4-20250514","opus-4-5":"claude-opus-4-20250514","claude-sonnet-4-6":"claude-sonnet-4-6","claude-opus-4-6":"claude-opus-4-6","claude-sonnet-4-5-20250929":"claude-sonnet-4-5-20250929","claude-opus-4-20250514":"claude-opus-4-20250514"},Vt={auto:"o4-mini","o4-mini":"o4-mini",o3:"o3","o3-mini":"o3-mini","codex-mini":"codex-mini-latest","gpt-4o":"gpt-4o","gpt-4o-mini":"gpt-4o-mini","gpt-5.2-codex":"gpt-5.2-codex","gpt-5.2":"gpt-5.2","gpt-5.3":"gpt-5.3","gpt-5.4":"gpt-5.4"},es={auto:"gemini-2.5-pro","gemini-2.5-pro":"gemini-2.5-pro","gemini-2.5-flash":"gemini-2.5-flash"},yt={CURSOR_AGENT_DEFAULT:1200*1e3,OPENAI_REQUEST:18e4}});var qt={};lt(qt,{getAllSkills:()=>St,getSkill:()=>z,hasSkill:()=>rs,listSkillIds:()=>ss,registerSkill:()=>ts});function ts(i){if(!i||typeof i.id!="string")throw new Error("Skill definition must include a string id");Ze.set(i.id,Object.freeze({...i}))}function z(i){return Ze.get(i)||null}function rs(i){return Ze.has(i)}function St(){return new Map(Ze)}function ss(){return Array.from(Ze.keys())}var Ze,se=M(()=>{Ze=new Map});import{zodToJsonSchema as Xn}from"zod-to-json-schema";var _e,Xt=M(()=>{_e=class{static generateFileOutputInstructions(e,t){let r;typeof e?.parse=="function"?r=Xn(e,{target:"openApi3"}):r=e;let s=this._buildExample(r);return`
24
20
  \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
25
21
  \u{1F6A8} MANDATORY: WRITE RESULT TO FILE \u{1F6A8}
26
22
  \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
27
23
  You MUST write your final result as pure JSON to this EXACT file path:
28
24
 
29
- ${r}
25
+ ${t}
30
26
 
31
27
  Use your file writing tool (WriteFile or ApplyPatch) to create this file.
32
28
  DO NOT just output JSON to stdout. The file MUST exist when you finish.
33
29
  DO NOT skip this step. The workflow WILL FAIL if the file is missing.
34
30
 
35
31
  Required JSON structure:
36
- ${JSON.stringify(n,null,2)}
32
+ ${JSON.stringify(s,null,2)}
37
33
 
38
34
  JSON types (strict \u2014 validators reject wrong types):
39
35
  - Use bare JSON numbers for numeric fields (e.g. 3000). Do NOT quote them as strings (wrong: "3000").
40
36
  - Use true/false without quotes for booleans.
41
37
  - Use unquoted null where a field may be null.
42
38
 
43
- Rules: valid JSON only, no markdown wrapping, no extra text in the file.`}static _buildExample(e){if(!e)return{};let r=e.type;if(r==="object"&&e.properties){let i={};for(let[n,o]of Object.entries(e.properties))i[n]=this._buildExample(o);return i}if(r==="array"&&e.items)return[this._buildExample(e.items)];if(r==="string")return"<string>";if(r==="number"||r==="integer")return 0;if(r==="boolean")return!1;if(e.description)return`<${e.description}>`;if(e.nullable||e.oneOf||e.anyOf){let i=e.oneOf?.find(n=>n.type!=="null")||e.anyOf?.find(n=>n.type!=="null");return i?this._buildExample(i):null}return"<value>"}}});function z(t,e,r){function i(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,u);let l=s.prototype,c=Object.keys(l);for(let d=0;d<c.length;d++){let p=c[d];p in a||(a[p]=l[p].bind(a))}}let n=r?.Parent??Object;class o extends n{}Object.defineProperty(o,"name",{value:t});function s(a){var u;let l=r?.Parent?new o:this;i(l,a),(u=l._zod).deferred??(u.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}function cr(t){return t&&Object.assign(nm,t),nm}var zN,Mi,As,nm,Ha=N(()=>{zN=Object.freeze({status:"aborted"});Mi=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},As=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},nm={}});var ee={};An(ee,{BIGINT_FORMAT_RANGES:()=>Ub,Class:()=>Ob,NUMBER_FORMAT_RANGES:()=>Db,aborted:()=>Mo,allowsEval:()=>jb,assert:()=>NB,assertEqual:()=>PB,assertIs:()=>OB,assertNever:()=>zB,assertNotEqual:()=>TB,assignProp:()=>Do,base64ToUint8Array:()=>MN,base64urlToUint8Array:()=>FB,cached:()=>Ya,captureStackTrace:()=>om,cleanEnum:()=>qB,cleanRegex:()=>_c,clone:()=>Br,cloneDef:()=>CB,createTransparentProxy:()=>ZB,defineLazy:()=>qe,esc:()=>im,escapeRegex:()=>Vn,extend:()=>RN,finalizeIssue:()=>fn,floatSafeRemainder:()=>zb,getElementAtPath:()=>RB,getEnumValues:()=>vc,getLengthableOrigin:()=>Sc,getParsedType:()=>MB,getSizableOrigin:()=>wc,hexToUint8Array:()=>WB,isObject:()=>Ds,isPlainObject:()=>Uo,issue:()=>Qa,joinValues:()=>Ee,jsonStringifyReplacer:()=>Ja,merge:()=>LB,mergeDefs:()=>io,normalizeParams:()=>se,nullish:()=>Ao,numKeys:()=>UB,objectClone:()=>jB,omit:()=>CN,optionalKeys:()=>Ab,parsedType:()=>Te,partial:()=>DN,pick:()=>jN,prefixIssues:()=>xn,primitiveTypes:()=>Rb,promiseAllObject:()=>AB,propertyKeyTypes:()=>bc,randomString:()=>DB,required:()=>UN,safeExtend:()=>AN,shallowClone:()=>Cb,slugify:()=>Nb,stringifyPrimitive:()=>Pe,uint8ArrayToBase64:()=>ZN,uint8ArrayToBase64url:()=>VB,uint8ArrayToHex:()=>GB,unwrapMessage:()=>yc});function PB(t){return t}function TB(t){return t}function OB(t){}function zB(t){throw new Error("Unexpected value in exhaustive check")}function NB(t){}function vc(t){let e=Object.values(t).filter(i=>typeof i=="number");return Object.entries(t).filter(([i,n])=>e.indexOf(+i)===-1).map(([i,n])=>n)}function Ee(t,e="|"){return t.map(r=>Pe(r)).join(e)}function Ja(t,e){return typeof e=="bigint"?e.toString():e}function Ya(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ao(t){return t==null}function _c(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function zb(t,e){let r=(t.toString().split(".")[1]||"").length,i=e.toString(),n=(i.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test(i)){let u=i.match(/\d?e-(\d?)/);u?.[1]&&(n=Number.parseInt(u[1]))}let o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return s%a/10**o}function qe(t,e,r){let i;Object.defineProperty(t,e,{get(){if(i!==NN)return i===void 0&&(i=NN,i=r()),i},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function jB(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Do(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function io(...t){let e={};for(let r of t){let i=Object.getOwnPropertyDescriptors(r);Object.assign(e,i)}return Object.defineProperties({},e)}function CB(t){return io(t._zod.def)}function RB(t,e){return e?e.reduce((r,i)=>r?.[i],t):t}function AB(t){let e=Object.keys(t),r=e.map(i=>t[i]);return Promise.all(r).then(i=>{let n={};for(let o=0;o<e.length;o++)n[e[o]]=i[o];return n})}function DB(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let i=0;i<t;i++)r+=e[Math.floor(Math.random()*e.length)];return r}function im(t){return JSON.stringify(t)}function Nb(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Ds(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Uo(t){if(Ds(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(Ds(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Cb(t){return Uo(t)?{...t}:Array.isArray(t)?[...t]:t}function UB(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function Vn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Br(t,e,r){let i=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(i._zod.parent=t),i}function se(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function ZB(t){let e;return new Proxy({},{get(r,i,n){return e??(e=t()),Reflect.get(e,i,n)},set(r,i,n,o){return e??(e=t()),Reflect.set(e,i,n,o)},has(r,i){return e??(e=t()),Reflect.has(e,i)},deleteProperty(r,i){return e??(e=t()),Reflect.deleteProperty(e,i)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,i){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,i)},defineProperty(r,i,n){return e??(e=t()),Reflect.defineProperty(e,i,n)}})}function Pe(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Ab(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function jN(t,e){let r=t._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=io(t._zod.def,{get shape(){let s={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(s[a]=r.shape[a])}return Do(this,"shape",s),s},checks:[]});return Br(t,o)}function CN(t,e){let r=t._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=io(t._zod.def,{get shape(){let s={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete s[a]}return Do(this,"shape",s),s},checks:[]});return Br(t,o)}function RN(t,e){if(!Uo(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let o=t._zod.def.shape;for(let s in e)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=io(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return Do(this,"shape",o),o}});return Br(t,n)}function AN(t,e){if(!Uo(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=io(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Do(this,"shape",i),i}});return Br(t,r)}function LB(t,e){let r=io(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e._zod.def.shape};return Do(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:[]});return Br(t,r)}function DN(t,e,r){let n=e._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=io(e._zod.def,{get shape(){let a=e._zod.def.shape,u={...a};if(r)for(let l in r){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(u[l]=t?new t({type:"optional",innerType:a[l]}):a[l])}else for(let l in a)u[l]=t?new t({type:"optional",innerType:a[l]}):a[l];return Do(this,"shape",u),u},checks:[]});return Br(e,s)}function UN(t,e,r){let i=io(e._zod.def,{get shape(){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:n[s]}))}else for(let s in n)o[s]=new t({type:"nonoptional",innerType:n[s]});return Do(this,"shape",o),o}});return Br(e,i)}function Mo(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function xn(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function yc(t){return typeof t=="string"?t:t?.message}function fn(t,e,r){let i={...t,path:t.path??[]};if(!t.message){let n=yc(t.inst?._zod.def?.error?.(t))??yc(e?.error?.(t))??yc(r.customError?.(t))??yc(r.localeError?.(t))??"Invalid input";i.message=n}return delete i.inst,delete i.continue,e?.reportInput||delete i.input,i}function wc(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Sc(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Te(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Qa(...t){let[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}function qB(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function MN(t){let e=atob(t),r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i);return r}function ZN(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function FB(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return MN(e+r)}function VB(t){return ZN(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function WB(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let i=0;i<e.length;i+=2)r[i/2]=Number.parseInt(e.slice(i,i+2),16);return r}function GB(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var NN,om,jb,MB,bc,Rb,Db,Ub,Ob,_e=N(()=>{NN=Symbol("evaluating");om="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};jb=Ya(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});MB=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},bc=new Set(["string","number","symbol"]),Rb=new Set(["string","number","bigint","boolean","symbol","undefined"]);Db={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ub={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};Ob=class{constructor(...e){}}});function am(t,e=r=>r.message){let r={},i=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}function um(t,e=r=>r.message){let r={_errors:[]},i=n=>{for(let o of n.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)r._errors.push(e(o));else{let s=r,a=0;for(;a<o.path.length;){let u=o.path[a];a===o.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(e(o))):s[u]=s[u]||{_errors:[]},s=s[u],a++}}};return i(t),r}var LN,sm,kc,Mb=N(()=>{Ha();_e();LN=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Ja,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},sm=z("$ZodError",LN),kc=z("$ZodError",LN,{Parent:Error})});var xc,$c,Ic,Ec,Pc,Xa,Tc,Oc,qN,FN,VN,WN,GN,BN,KN,HN,Zb=N(()=>{Ha();Mb();_e();xc=t=>(e,r,i,n)=>{let o=i?Object.assign(i,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Mi;if(s.issues.length){let a=new(n?.Err??t)(s.issues.map(u=>fn(u,o,cr())));throw om(a,n?.callee),a}return s.value},$c=xc(kc),Ic=t=>async(e,r,i,n)=>{let o=i?Object.assign(i,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(n?.Err??t)(s.issues.map(u=>fn(u,o,cr())));throw om(a,n?.callee),a}return s.value},Ec=Ic(kc),Pc=t=>(e,r,i)=>{let n=i?{...i,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new Mi;return o.issues.length?{success:!1,error:new(t??sm)(o.issues.map(s=>fn(s,n,cr())))}:{success:!0,data:o.value}},Xa=Pc(kc),Tc=t=>async(e,r,i)=>{let n=i?Object.assign(i,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>fn(s,n,cr())))}:{success:!0,data:o.value}},Oc=Tc(kc),qN=t=>(e,r,i)=>{let n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return xc(t)(e,r,n)},FN=t=>(e,r,i)=>xc(t)(e,r,i),VN=t=>async(e,r,i)=>{let n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ic(t)(e,r,n)},WN=t=>async(e,r,i)=>Ic(t)(e,r,i),GN=t=>(e,r,i)=>{let n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Pc(t)(e,r,n)},BN=t=>(e,r,i)=>Pc(t)(e,r,i),KN=t=>async(e,r,i)=>{let n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Tc(t)(e,r,n)},HN=t=>async(e,r,i)=>Tc(t)(e,r,i)});var Wn={};An(Wn,{base64:()=>rw,base64url:()=>lm,bigint:()=>uw,boolean:()=>cw,browserEmail:()=>tK,cidrv4:()=>ew,cidrv6:()=>tw,cuid:()=>Lb,cuid2:()=>qb,date:()=>iw,datetime:()=>sw,domain:()=>iK,duration:()=>Bb,e164:()=>nw,email:()=>Hb,emoji:()=>Jb,extendedDuration:()=>KB,guid:()=>Kb,hex:()=>oK,hostname:()=>nK,html5Email:()=>QB,idnEmail:()=>eK,integer:()=>lw,ipv4:()=>Yb,ipv6:()=>Qb,ksuid:()=>Wb,lowercase:()=>pw,mac:()=>Xb,md5_base64:()=>aK,md5_base64url:()=>uK,md5_hex:()=>sK,nanoid:()=>Gb,null:()=>dw,number:()=>cm,rfc5322Email:()=>XB,sha1_base64:()=>cK,sha1_base64url:()=>dK,sha1_hex:()=>lK,sha256_base64:()=>pK,sha256_base64url:()=>mK,sha256_hex:()=>fK,sha384_base64:()=>gK,sha384_base64url:()=>yK,sha384_hex:()=>hK,sha512_base64:()=>_K,sha512_base64url:()=>bK,sha512_hex:()=>vK,string:()=>aw,time:()=>ow,ulid:()=>Fb,undefined:()=>fw,unicodeEmail:()=>JN,uppercase:()=>mw,uuid:()=>Us,uuid4:()=>HB,uuid6:()=>JB,uuid7:()=>YB,xid:()=>Vb});function Jb(){return new RegExp(rK,"u")}function QN(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ow(t){return new RegExp(`^${QN(t)}$`)}function sw(t){let e=QN({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${e}(?:${r.join("|")})`;return new RegExp(`^${YN}T(?:${i})$`)}function zc(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function Nc(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var Lb,qb,Fb,Vb,Wb,Gb,Bb,KB,Kb,Us,HB,JB,YB,Hb,QB,XB,JN,eK,tK,rK,Yb,Qb,Xb,ew,tw,rw,lm,nK,iK,nw,YN,iw,aw,uw,lw,cm,cw,dw,fw,pw,mw,oK,sK,aK,uK,lK,cK,dK,fK,pK,mK,hK,gK,yK,vK,_K,bK,dm=N(()=>{_e();Lb=/^[cC][^\s-]{8,}$/,qb=/^[0-9a-z]+$/,Fb=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Vb=/^[0-9a-vA-V]{20}$/,Wb=/^[A-Za-z0-9]{27}$/,Gb=/^[a-zA-Z0-9_-]{21}$/,Bb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,KB=/^[-+]?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)?)??$/,Kb=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Us=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,HB=Us(4),JB=Us(6),YB=Us(7),Hb=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,QB=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,XB=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,JN=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,eK=JN,tK=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,rK="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";Yb=/^(?:(?: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])$/,Qb=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Xb=t=>{let e=Vn(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},ew=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rw=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,lm=/^[A-Za-z0-9_-]*$/,nK=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,iK=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,nw=/^\+[1-9]\d{6,14}$/,YN="(?:(?:\\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])))",iw=new RegExp(`^${YN}$`);aw=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},uw=/^-?\d+n?$/,lw=/^-?\d+$/,cm=/^-?\d+(?:\.\d+)?$/,cw=/^(?:true|false)$/i,dw=/^null$/i,fw=/^undefined$/i,pw=/^[^A-Z]*$/,mw=/^[^a-z]*$/,oK=/^[0-9a-fA-F]*$/;sK=/^[0-9a-fA-F]{32}$/,aK=zc(22,"=="),uK=Nc(22),lK=/^[0-9a-fA-F]{40}$/,cK=zc(27,"="),dK=Nc(27),fK=/^[0-9a-fA-F]{64}$/,pK=zc(43,"="),mK=Nc(43),hK=/^[0-9a-fA-F]{96}$/,gK=zc(64,""),yK=Nc(64),vK=/^[0-9a-fA-F]{128}$/,_K=zc(86,"=="),bK=Nc(86)});function XN(t,e,r){t.issues.length&&e.issues.push(...xn(r,t.issues))}var zt,e1,hw,gw,t1,r1,n1,i1,o1,s1,a1,u1,l1,jc,c1,d1,f1,p1,m1,h1,g1,y1,v1,fm=N(()=>{Ha();dm();_e();zt=z("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),e1={number:"number",bigint:"bigint",object:"date"},hw=z("$ZodCheckLessThan",(t,e)=>{zt.init(t,e);let r=e1[typeof e.value];t._zod.onattach.push(i=>{let n=i._zod.bag,o=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),gw=z("$ZodCheckGreaterThan",(t,e)=>{zt.init(t,e);let r=e1[typeof e.value];t._zod.onattach.push(i=>{let n=i._zod.bag,o=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),t1=z("$ZodCheckMultipleOf",(t,e)=>{zt.init(t,e),t._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):zb(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),r1=z("$ZodCheckNumberFormat",(t,e)=>{zt.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),i=r?"int":"number",[n,o]=Db[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=n,a.maximum=o,r&&(a.pattern=lw)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:i,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!e.abort});return}}a<n&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!e.abort})}}),n1=z("$ZodCheckBigIntFormat",(t,e)=>{zt.init(t,e);let[r,i]=Ub[e.format];t._zod.onattach.push(n=>{let o=n._zod.bag;o.format=e.format,o.minimum=r,o.maximum=i}),t._zod.check=n=>{let o=n.value;o<r&&n.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),o>i&&n.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),i1=z("$ZodCheckMaxSize",(t,e)=>{var r;zt.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Ao(n)&&n.size!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(i._zod.bag.maximum=e.maximum)}),t._zod.check=i=>{let n=i.value;n.size<=e.maximum||i.issues.push({origin:wc(n),code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),o1=z("$ZodCheckMinSize",(t,e)=>{var r;zt.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Ao(n)&&n.size!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(i._zod.bag.minimum=e.minimum)}),t._zod.check=i=>{let n=i.value;n.size>=e.minimum||i.issues.push({origin:wc(n),code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),s1=z("$ZodCheckSizeEquals",(t,e)=>{var r;zt.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Ao(n)&&n.size!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=e.size,n.maximum=e.size,n.size=e.size}),t._zod.check=i=>{let n=i.value,o=n.size;if(o===e.size)return;let s=o>e.size;i.issues.push({origin:wc(n),...s?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:i.value,inst:t,continue:!e.abort})}}),a1=z("$ZodCheckMaxLength",(t,e)=>{var r;zt.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Ao(n)&&n.length!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(i._zod.bag.maximum=e.maximum)}),t._zod.check=i=>{let n=i.value;if(n.length<=e.maximum)return;let s=Sc(n);i.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),u1=z("$ZodCheckMinLength",(t,e)=>{var r;zt.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Ao(n)&&n.length!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(i._zod.bag.minimum=e.minimum)}),t._zod.check=i=>{let n=i.value;if(n.length>=e.minimum)return;let s=Sc(n);i.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),l1=z("$ZodCheckLengthEquals",(t,e)=>{var r;zt.init(t,e),(r=t._zod.def).when??(r.when=i=>{let n=i.value;return!Ao(n)&&n.length!==void 0}),t._zod.onattach.push(i=>{let n=i._zod.bag;n.minimum=e.length,n.maximum=e.length,n.length=e.length}),t._zod.check=i=>{let n=i.value,o=n.length;if(o===e.length)return;let s=Sc(n),a=o>e.length;i.issues.push({origin:s,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:i.value,inst:t,continue:!e.abort})}}),jc=z("$ZodCheckStringFormat",(t,e)=>{var r,i;zt.init(t,e),t._zod.onattach.push(n=>{let o=n._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(i=t._zod).check??(i.check=()=>{})}),c1=z("$ZodCheckRegex",(t,e)=>{jc.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),d1=z("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=pw),jc.init(t,e)}),f1=z("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=mw),jc.init(t,e)}),p1=z("$ZodCheckIncludes",(t,e)=>{zt.init(t,e);let r=Vn(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=i,t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),m1=z("$ZodCheckStartsWith",(t,e)=>{zt.init(t,e);let r=new RegExp(`^${Vn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),h1=z("$ZodCheckEndsWith",(t,e)=>{zt.init(t,e);let r=new RegExp(`.*${Vn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}});g1=z("$ZodCheckProperty",(t,e)=>{zt.init(t,e),t._zod.check=r=>{let i=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>XN(n,r,e.property));XN(i,r,e.property)}}),y1=z("$ZodCheckMimeType",(t,e)=>{zt.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(i=>{i._zod.bag.mime=e.mime}),t._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:e.mime,input:i.value.type,inst:t,continue:!e.abort})}}),v1=z("$ZodCheckOverwrite",(t,e)=>{zt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var pm,yw=N(()=>{pm=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let i=e.split(`
44
- `).filter(s=>s),n=Math.min(...i.map(s=>s.length-s.trimStart().length)),o=i.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,r=this?.args,n=[...(this?.content??[""]).map(o=>` ${o}`)];return new e(...r,n.join(`
45
- `))}}});var b1,vw=N(()=>{b1={major:4,minor:3,patch:6}});function N1(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function wK(t){if(!lm.test(t))return!1;let e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return N1(r)}function SK(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[i]=r;if(!i)return!1;let n=JSON.parse(atob(i));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}function w1(t,e,r){t.issues.length&&e.issues.push(...xn(r,t.issues)),e.value[r]=t.value}function vm(t,e,r,i,n){if(t.issues.length){if(n&&!(r in i))return;e.issues.push(...xn(r,t.issues))}t.value===void 0?r in i&&(e.value[r]=void 0):e.value[r]=t.value}function j1(t){let e=Object.keys(t.shape);for(let i of e)if(!t.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let r=Ab(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function C1(t,e,r,i,n,o){let s=[],a=n.keySet,u=n.catchall._zod,l=u.def.type,c=u.optout==="optional";for(let d in e){if(a.has(d))continue;if(l==="never"){s.push(d);continue}let p=u.run({value:e[d],issues:[]},i);p instanceof Promise?t.push(p.then(f=>vm(f,r,d,e,c))):vm(p,r,d,e,c)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:o}),t.length?Promise.all(t).then(()=>r):r}function S1(t,e,r,i){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;let n=t.filter(o=>!Mo(o));return n.length===1?(e.value=n[0].value,n[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>fn(s,i,cr())))}),e)}function k1(t,e,r,i){let n=t.filter(o=>o.issues.length===0);return n.length===1?(e.value=n[0].value,e):(n.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>fn(s,i,cr())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}function _w(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Uo(t)&&Uo(e)){let r=Object.keys(e),i=Object.keys(t).filter(o=>r.indexOf(o)!==-1),n={...t,...e};for(let o of i){let s=_w(t[o],e[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n[o]=s.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let i=0;i<t.length;i++){let n=t[i],o=e[i],s=_w(n,o);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function x1(t,e,r){let i=new Map,n;for(let a of e.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let u of a.keys)i.has(u)||i.set(u,{}),i.get(u).l=!0}else t.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let u of a.keys)i.has(u)||i.set(u,{}),i.get(u).r=!0;else t.issues.push(a);let o=[...i].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&n&&t.issues.push({...n,keys:o}),Mo(t))return t;let s=_w(e.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return t.value=s.data,t}function mm(t,e,r){t.issues.length&&e.issues.push(...xn(r,t.issues)),e.value[r]=t.value}function $1(t,e,r,i,n,o,s){t.issues.length&&(bc.has(typeof i)?r.issues.push(...xn(i,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:o,issues:t.issues.map(a=>fn(a,s,cr()))})),e.issues.length&&(bc.has(typeof i)?r.issues.push(...xn(i,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:o,key:i,issues:e.issues.map(a=>fn(a,s,cr()))})),r.value.set(t.value,e.value)}function I1(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function E1(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}function P1(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function T1(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function hm(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}function gm(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let n=e.transform(t.value,t);return n instanceof Promise?n.then(o=>ym(t,o,e.out,r)):ym(t,n,e.out,r)}else{let n=e.reverseTransform(t.value,t);return n instanceof Promise?n.then(o=>ym(t,o,e.in,r)):ym(t,n,e.in,r)}}function ym(t,e,r,i){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},i)}function O1(t){return t.value=Object.freeze(t.value),t}function z1(t,e,r,i){if(!t){let n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(Qa(n))}}var De,Ms,It,bw,ww,Sw,kw,xw,$w,Iw,Ew,Pw,Tw,Ow,zw,Nw,jw,Cw,Rw,Aw,Dw,Uw,Mw,Zw,Lw,qw,Fw,Vw,_m,Ww,Cc,bm,Gw,Bw,Kw,Hw,Jw,Yw,Qw,Xw,e0,t0,R1,A1,Rc,r0,n0,i0,wm,o0,s0,a0,u0,l0,c0,d0,Sm,f0,p0,m0,h0,g0,y0,v0,_0,b0,Ac,w0,S0,k0,x0,$0,I0,E0=N(()=>{fm();Ha();yw();Zb();dm();_e();vw();_e();De=z("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=b1;let i=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&i.unshift(t);for(let n of i)for(let o of n._zod.onattach)o(t);if(i.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=(s,a,u)=>{let l=Mo(s),c;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(l)continue;let p=s.issues.length,f=d._zod.check(s);if(f instanceof Promise&&u?.async===!1)throw new Mi;if(c||f instanceof Promise)c=(c??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(l||(l=Mo(s,p)))});else{if(s.issues.length===p)continue;l||(l=Mo(s,p))}}return c?c.then(()=>s):s},o=(s,a,u)=>{if(Mo(s))return s.aborted=!0,s;let l=n(a,i,u);if(l instanceof Promise){if(u.async===!1)throw new Mi;return l.then(c=>t._zod.parse(c,u))}return t._zod.parse(l,u)};t._zod.run=(s,a)=>{if(a.skipChecks)return t._zod.parse(s,a);if(a.direction==="backward"){let l=t._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(c=>o(c,s,a)):o(l,s,a)}let u=t._zod.parse(s,a);if(u instanceof Promise){if(a.async===!1)throw new Mi;return u.then(l=>n(l,i,a))}return n(u,i,a)}}qe(t,"~standard",()=>({validate:n=>{try{let o=Xa(t,n);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Oc(t,n).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),Ms=z("$ZodString",(t,e)=>{De.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??aw(t._zod.bag),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),It=z("$ZodStringFormat",(t,e)=>{jc.init(t,e),Ms.init(t,e)}),bw=z("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Kb),It.init(t,e)}),ww=z("$ZodUUID",(t,e)=>{if(e.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(i===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Us(i))}else e.pattern??(e.pattern=Us());It.init(t,e)}),Sw=z("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Hb),It.init(t,e)}),kw=z("$ZodURL",(t,e)=>{It.init(t,e),t._zod.check=r=>{try{let i=r.value.trim(),n=new URL(i);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=n.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),xw=z("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Jb()),It.init(t,e)}),$w=z("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Gb),It.init(t,e)}),Iw=z("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Lb),It.init(t,e)}),Ew=z("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=qb),It.init(t,e)}),Pw=z("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Fb),It.init(t,e)}),Tw=z("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Vb),It.init(t,e)}),Ow=z("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Wb),It.init(t,e)}),zw=z("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=sw(e)),It.init(t,e)}),Nw=z("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=iw),It.init(t,e)}),jw=z("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=ow(e)),It.init(t,e)}),Cw=z("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Bb),It.init(t,e)}),Rw=z("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Yb),It.init(t,e),t._zod.bag.format="ipv4"}),Aw=z("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Qb),It.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Dw=z("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=Xb(e.delimiter)),It.init(t,e),t._zod.bag.format="mac"}),Uw=z("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=ew),It.init(t,e)}),Mw=z("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=tw),It.init(t,e),t._zod.check=r=>{let i=r.value.split("/");try{if(i.length!==2)throw new Error;let[n,o]=i;if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});Zw=z("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=rw),It.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{N1(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});Lw=z("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=lm),It.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{wK(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),qw=z("$ZodE164",(t,e)=>{e.pattern??(e.pattern=nw),It.init(t,e)});Fw=z("$ZodJWT",(t,e)=>{It.init(t,e),t._zod.check=r=>{SK(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Vw=z("$ZodCustomStringFormat",(t,e)=>{It.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),_m=z("$ZodNumber",(t,e)=>{De.init(t,e),t._zod.pattern=t._zod.bag.pattern??cm,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let o=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...o?{received:o}:{}}),r}}),Ww=z("$ZodNumberFormat",(t,e)=>{r1.init(t,e),_m.init(t,e)}),Cc=z("$ZodBoolean",(t,e)=>{De.init(t,e),t._zod.pattern=cw,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}}),bm=z("$ZodBigInt",(t,e)=>{De.init(t,e),t._zod.pattern=uw,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),Gw=z("$ZodBigIntFormat",(t,e)=>{n1.init(t,e),bm.init(t,e)}),Bw=z("$ZodSymbol",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:t}),r}}),Kw=z("$ZodUndefined",(t,e)=>{De.init(t,e),t._zod.pattern=fw,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:t}),r}}),Hw=z("$ZodNull",(t,e)=>{De.init(t,e),t._zod.pattern=dw,t._zod.values=new Set([null]),t._zod.parse=(r,i)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),Jw=z("$ZodAny",(t,e)=>{De.init(t,e),t._zod.parse=r=>r}),Yw=z("$ZodUnknown",(t,e)=>{De.init(t,e),t._zod.parse=r=>r}),Qw=z("$ZodNever",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Xw=z("$ZodVoid",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:t}),r}}),e0=z("$ZodDate",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,o=n instanceof Date;return o&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...o?{received:"Invalid Date"}:{},inst:t}),r}});t0=z("$ZodArray",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let o=[];for(let s=0;s<n.length;s++){let a=n[s],u=e.element._zod.run({value:a,issues:[]},i);u instanceof Promise?o.push(u.then(l=>w1(l,r,s))):w1(u,r,s)}return o.length?Promise.all(o).then(()=>r):r}});R1=z("$ZodObject",(t,e)=>{if(De.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let u={...a};return Object.defineProperty(e,"shape",{value:u}),u}})}let i=Ya(()=>j1(e));qe(t._zod,"propValues",()=>{let a=e.shape,u={};for(let l in a){let c=a[l]._zod;if(c.values){u[l]??(u[l]=new Set);for(let d of c.values)u[l].add(d)}}return u});let n=Ds,o=e.catchall,s;t._zod.parse=(a,u)=>{s??(s=i.value);let l=a.value;if(!n(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:t}),a;a.value={};let c=[],d=s.shape;for(let p of s.keys){let f=d[p],m=f._zod.optout==="optional",g=f._zod.run({value:l[p],issues:[]},u);g instanceof Promise?c.push(g.then(v=>vm(v,a,p,l,m))):vm(g,a,p,l,m)}return o?C1(c,l,a,u,i.value,t):c.length?Promise.all(c).then(()=>a):a}}),A1=z("$ZodObjectJIT",(t,e)=>{R1.init(t,e);let r=t._zod.parse,i=Ya(()=>j1(e)),n=p=>{let f=new pm(["shape","payload","ctx"]),m=i.value,g=_=>{let b=im(_);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};f.write("const input = payload.value;");let v=Object.create(null),h=0;for(let _ of m.keys)v[_]=`key_${h++}`;f.write("const newResult = {};");for(let _ of m.keys){let b=v[_],w=im(_),k=p[_]?._zod?.optout==="optional";f.write(`const ${b} = ${g(_)};`),k?f.write(`
46
- if (${b}.issues.length) {
47
- if (${w} in input) {
48
- payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
49
- ...iss,
50
- path: iss.path ? [${w}, ...iss.path] : [${w}]
51
- })));
52
- }
53
- }
54
-
55
- if (${b}.value === undefined) {
56
- if (${w} in input) {
57
- newResult[${w}] = undefined;
58
- }
59
- } else {
60
- newResult[${w}] = ${b}.value;
61
- }
62
-
63
- `):f.write(`
64
- if (${b}.issues.length) {
65
- payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
66
- ...iss,
67
- path: iss.path ? [${w}, ...iss.path] : [${w}]
68
- })));
69
- }
70
-
71
- if (${b}.value === undefined) {
72
- if (${w} in input) {
73
- newResult[${w}] = undefined;
74
- }
75
- } else {
76
- newResult[${w}] = ${b}.value;
77
- }
78
-
79
- `)}f.write("payload.value = newResult;"),f.write("return payload;");let y=f.compile();return(_,b)=>y(p,_,b)},o,s=Ds,a=!nm.jitless,l=a&&jb.value,c=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=i.value);let m=p.value;return s(m)?a&&l&&f?.async===!1&&f.jitless!==!0?(o||(o=n(e.shape)),p=o(p,f),c?C1([],m,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p)}});Rc=z("$ZodUnion",(t,e)=>{De.init(t,e),qe(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),qe(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),qe(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),qe(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){let n=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${n.map(o=>_c(o.source)).join("|")})$`)}});let r=e.options.length===1,i=e.options[0]._zod.run;t._zod.parse=(n,o)=>{if(r)return i(n,o);let s=!1,a=[];for(let u of e.options){let l=u._zod.run({value:n.value,issues:[]},o);if(l instanceof Promise)a.push(l),s=!0;else{if(l.issues.length===0)return l;a.push(l)}}return s?Promise.all(a).then(u=>S1(u,n,t,o)):S1(a,n,t,o)}});r0=z("$ZodXor",(t,e)=>{Rc.init(t,e),e.inclusive=!1;let r=e.options.length===1,i=e.options[0]._zod.run;t._zod.parse=(n,o)=>{if(r)return i(n,o);let s=!1,a=[];for(let u of e.options){let l=u._zod.run({value:n.value,issues:[]},o);l instanceof Promise?(a.push(l),s=!0):a.push(l)}return s?Promise.all(a).then(u=>k1(u,n,t,o)):k1(a,n,t,o)}}),n0=z("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Rc.init(t,e);let r=t._zod.parse;qe(t._zod,"propValues",()=>{let n={};for(let o of e.options){let s=o._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[a,u]of Object.entries(s)){n[a]||(n[a]=new Set);for(let l of u)n[a].add(l)}}return n});let i=Ya(()=>{let n=e.options,o=new Map;for(let s of n){let a=s._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let u of a){if(o.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);o.set(u,s)}}return o});t._zod.parse=(n,o)=>{let s=n.value;if(!Ds(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),n;let a=i.value.get(s?.[e.discriminator]);return a?a._zod.run(n,o):e.unionFallback?r(n,o):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:s,path:[e.discriminator],inst:t}),n)}}),i0=z("$ZodIntersection",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>{let n=r.value,o=e.left._zod.run({value:n,issues:[]},i),s=e.right._zod.run({value:n,issues:[]},i);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([u,l])=>x1(r,u,l)):x1(r,o,s)}});wm=z("$ZodTuple",(t,e)=>{De.init(t,e);let r=e.items;t._zod.parse=(i,n)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:t,expected:"tuple",code:"invalid_type"}),i;i.value=[];let s=[],a=[...r].reverse().findIndex(c=>c._zod.optin!=="optional"),u=a===-1?0:r.length-a;if(!e.rest){let c=o.length>r.length,d=o.length<u-1;if(c||d)return i.issues.push({...c?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:o,inst:t,origin:"array"}),i}let l=-1;for(let c of r){if(l++,l>=o.length&&l>=u)continue;let d=c._zod.run({value:o[l],issues:[]},n);d instanceof Promise?s.push(d.then(p=>mm(p,i,l))):mm(d,i,l)}if(e.rest){let c=o.slice(r.length);for(let d of c){l++;let p=e.rest._zod.run({value:d,issues:[]},n);p instanceof Promise?s.push(p.then(f=>mm(f,i,l))):mm(p,i,l)}}return s.length?Promise.all(s).then(()=>i):i}});o0=z("$ZodRecord",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!Uo(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;let o=[],s=e.keyType._zod.values;if(s){r.value={};let a=new Set;for(let l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){a.add(typeof l=="number"?l.toString():l);let c=e.valueType._zod.run({value:n[l],issues:[]},i);c instanceof Promise?o.push(c.then(d=>{d.issues.length&&r.issues.push(...xn(l,d.issues)),r.value[l]=d.value})):(c.issues.length&&r.issues.push(...xn(l,c.issues)),r.value[l]=c.value)}let u;for(let l in n)a.has(l)||(u=u??[],u.push(l));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:u})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__")continue;let u=e.keyType._zod.run({value:a,issues:[]},i);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&cm.test(a)&&u.issues.length){let d=e.keyType._zod.run({value:Number(a),issues:[]},i);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(u=d)}if(u.issues.length){e.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(d=>fn(d,i,cr())),input:a,path:[a],inst:t});continue}let c=e.valueType._zod.run({value:n[a],issues:[]},i);c instanceof Promise?o.push(c.then(d=>{d.issues.length&&r.issues.push(...xn(a,d.issues)),r.value[u.value]=d.value})):(c.issues.length&&r.issues.push(...xn(a,c.issues)),r.value[u.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}}),s0=z("$ZodMap",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:t}),r;let o=[];r.value=new Map;for(let[s,a]of n){let u=e.keyType._zod.run({value:s,issues:[]},i),l=e.valueType._zod.run({value:a,issues:[]},i);u instanceof Promise||l instanceof Promise?o.push(Promise.all([u,l]).then(([c,d])=>{$1(c,d,r,s,n,t,i)})):$1(u,l,r,s,n,t,i)}return o.length?Promise.all(o).then(()=>r):r}});a0=z("$ZodSet",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:t,expected:"set",code:"invalid_type"}),r;let o=[];r.value=new Set;for(let s of n){let a=e.valueType._zod.run({value:s,issues:[]},i);a instanceof Promise?o.push(a.then(u=>I1(u,r))):I1(a,r)}return o.length?Promise.all(o).then(()=>r):r}});u0=z("$ZodEnum",(t,e)=>{De.init(t,e);let r=vc(e.entries),i=new Set(r);t._zod.values=i,t._zod.pattern=new RegExp(`^(${r.filter(n=>bc.has(typeof n)).map(n=>typeof n=="string"?Vn(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let s=n.value;return i.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:t}),n}}),l0=z("$ZodLiteral",(t,e)=>{if(De.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(i=>typeof i=="string"?Vn(i):i?Vn(i.toString()):String(i)).join("|")})$`),t._zod.parse=(i,n)=>{let o=i.value;return r.has(o)||i.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),i}}),c0=z("$ZodFile",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:t}),r}}),d0=z("$ZodTransform",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>{if(i.direction==="backward")throw new As(t.constructor.name);let n=e.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new Mi;return r.value=n,r}});Sm=z("$ZodOptional",(t,e)=>{De.init(t,e),t._zod.optin="optional",t._zod.optout="optional",qe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),qe(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${_c(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>{if(e.innerType._zod.optin==="optional"){let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>E1(o,r.value)):E1(n,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,i)}}),f0=z("$ZodExactOptional",(t,e)=>{Sm.init(t,e),qe(t._zod,"values",()=>e.innerType._zod.values),qe(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,i)=>e.innerType._zod.run(r,i)}),p0=z("$ZodNullable",(t,e)=>{De.init(t,e),qe(t._zod,"optin",()=>e.innerType._zod.optin),qe(t._zod,"optout",()=>e.innerType._zod.optout),qe(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${_c(r.source)}|null)$`):void 0}),qe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),m0=z("$ZodDefault",(t,e)=>{De.init(t,e),t._zod.optin="optional",qe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(i.direction==="backward")return e.innerType._zod.run(r,i);if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>P1(o,e)):P1(n,e)}});h0=z("$ZodPrefault",(t,e)=>{De.init(t,e),t._zod.optin="optional",qe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>(i.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,i))}),g0=z("$ZodNonOptional",(t,e)=>{De.init(t,e),qe(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(r,i)=>{let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>T1(o,t)):T1(n,t)}});y0=z("$ZodSuccess",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>{if(i.direction==="backward")throw new As("ZodSuccess");let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>(r.value=o.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),v0=z("$ZodCatch",(t,e)=>{De.init(t,e),qe(t._zod,"optin",()=>e.innerType._zod.optin),qe(t._zod,"optout",()=>e.innerType._zod.optout),qe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(i.direction==="backward")return e.innerType._zod.run(r,i);let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>fn(s,i,cr()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(o=>fn(o,i,cr()))},input:r.value}),r.issues=[]),r)}}),_0=z("$ZodNaN",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),b0=z("$ZodPipe",(t,e)=>{De.init(t,e),qe(t._zod,"values",()=>e.in._zod.values),qe(t._zod,"optin",()=>e.in._zod.optin),qe(t._zod,"optout",()=>e.out._zod.optout),qe(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,i)=>{if(i.direction==="backward"){let o=e.out._zod.run(r,i);return o instanceof Promise?o.then(s=>hm(s,e.in,i)):hm(o,e.in,i)}let n=e.in._zod.run(r,i);return n instanceof Promise?n.then(o=>hm(o,e.out,i)):hm(n,e.out,i)}});Ac=z("$ZodCodec",(t,e)=>{De.init(t,e),qe(t._zod,"values",()=>e.in._zod.values),qe(t._zod,"optin",()=>e.in._zod.optin),qe(t._zod,"optout",()=>e.out._zod.optout),qe(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,i)=>{if((i.direction||"forward")==="forward"){let o=e.in._zod.run(r,i);return o instanceof Promise?o.then(s=>gm(s,e,i)):gm(o,e,i)}else{let o=e.out._zod.run(r,i);return o instanceof Promise?o.then(s=>gm(s,e,i)):gm(o,e,i)}}});w0=z("$ZodReadonly",(t,e)=>{De.init(t,e),qe(t._zod,"propValues",()=>e.innerType._zod.propValues),qe(t._zod,"values",()=>e.innerType._zod.values),qe(t._zod,"optin",()=>e.innerType?._zod?.optin),qe(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,i)=>{if(i.direction==="backward")return e.innerType._zod.run(r,i);let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(O1):O1(n)}});S0=z("$ZodTemplateLiteral",(t,e)=>{De.init(t,e);let r=[];for(let i of e.parts)if(typeof i=="object"&&i!==null){if(!i._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);let n=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${i._zod.traits}`);let o=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(o,s))}else if(i===null||Rb.has(typeof i))r.push(Vn(`${i}`));else throw new Error(`Invalid template literal part: ${i}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(i,n)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:t,expected:"string",code:"invalid_type"}),i):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),i)}),k0=z("$ZodFunction",(t,e)=>(De.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...i){let n=t._def.input?$c(t._def.input,i):i,o=Reflect.apply(r,this,n);return t._def.output?$c(t._def.output,o):o}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...i){let n=t._def.input?await Ec(t._def.input,i):i,o=await Reflect.apply(r,this,n);return t._def.output?await Ec(t._def.output,o):o}},t._zod.parse=(r,i)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let i=t.constructor;return Array.isArray(r[0])?new i({type:"function",input:new wm({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new i({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let i=t.constructor;return new i({type:"function",input:t._def.input,output:r})},t)),x0=z("$ZodPromise",(t,e)=>{De.init(t,e),t._zod.parse=(r,i)=>Promise.resolve(r.value).then(n=>e.innerType._zod.run({value:n,issues:[]},i))}),$0=z("$ZodLazy",(t,e)=>{De.init(t,e),qe(t._zod,"innerType",()=>e.getter()),qe(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),qe(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),qe(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),qe(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,i)=>t._zod.innerType._zod.run(r,i)}),I0=z("$ZodCustom",(t,e)=>{zt.init(t,e),De.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{let i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(o=>z1(o,r,i,t));z1(n,r,i,t)}})});var D1=N(()=>{_e()});var U1=N(()=>{_e()});var M1=N(()=>{_e()});var Z1=N(()=>{_e()});var L1=N(()=>{_e()});var q1=N(()=>{_e()});var F1=N(()=>{_e()});var V1=N(()=>{_e()});function P0(){return{localeError:xK()}}var xK,T0=N(()=>{_e();xK=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let o=i[n.expected]??n.expected,s=Te(n.input),a=i[s]??s;return`Invalid input: expected ${o}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${Pe(n.values[0])}`:`Invalid option: expected one of ${Ee(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${s.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Ee(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}}});var W1=N(()=>{_e()});var G1=N(()=>{_e()});var B1=N(()=>{_e()});var K1=N(()=>{_e()});var H1=N(()=>{_e()});var J1=N(()=>{_e()});var Y1=N(()=>{_e()});var Q1=N(()=>{_e()});var X1=N(()=>{_e()});var ej=N(()=>{_e()});var tj=N(()=>{_e()});var rj=N(()=>{_e()});var nj=N(()=>{_e()});var ij=N(()=>{_e()});var O0=N(()=>{_e()});var oj=N(()=>{O0()});var sj=N(()=>{_e()});var aj=N(()=>{_e()});var uj=N(()=>{_e()});var lj=N(()=>{_e()});var cj=N(()=>{_e()});var dj=N(()=>{_e()});var fj=N(()=>{_e()});var pj=N(()=>{_e()});var mj=N(()=>{_e()});var hj=N(()=>{_e()});var gj=N(()=>{_e()});var yj=N(()=>{_e()});var vj=N(()=>{_e()});var _j=N(()=>{_e()});var bj=N(()=>{_e()});var wj=N(()=>{_e()});var z0=N(()=>{_e()});var Sj=N(()=>{z0()});var kj=N(()=>{_e()});var xj=N(()=>{_e()});var $j=N(()=>{_e()});var Ij=N(()=>{_e()});var Ej=N(()=>{_e()});var Pj=N(()=>{_e()});var km=N(()=>{D1();U1();M1();Z1();L1();q1();F1();V1();T0();W1();G1();B1();K1();H1();J1();Y1();Q1();X1();ej();tj();rj();nj();ij();oj();O0();sj();aj();uj();lj();cj();dj();fj();pj();mj();hj();gj();yj();vj();_j();bj();wj();Sj();z0();kj();xj();$j();Ij();Ej();Pj()});function C0(){return new j0}var Tj,j0,Kr,Dc=N(()=>{j0=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let i=r[0];return this._map.set(e,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let i={...this.get(r)??{}};delete i.id;let n={...i,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};(Tj=globalThis).__zod_globalRegistry??(Tj.__zod_globalRegistry=C0());Kr=globalThis.__zod_globalRegistry});function R0(t,e){return new t({type:"string",...se(e)})}function xm(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...se(e)})}function Uc(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...se(e)})}function $m(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...se(e)})}function Im(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...se(e)})}function Em(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...se(e)})}function Pm(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...se(e)})}function Mc(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...se(e)})}function Tm(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...se(e)})}function Om(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...se(e)})}function zm(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...se(e)})}function Nm(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...se(e)})}function jm(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...se(e)})}function Cm(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...se(e)})}function Rm(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...se(e)})}function Am(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...se(e)})}function Dm(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...se(e)})}function A0(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...se(e)})}function Um(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...se(e)})}function Mm(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...se(e)})}function Zm(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...se(e)})}function Lm(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...se(e)})}function qm(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...se(e)})}function Fm(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...se(e)})}function D0(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...se(e)})}function U0(t,e){return new t({type:"string",format:"date",check:"string_format",...se(e)})}function M0(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...se(e)})}function Z0(t,e){return new t({type:"string",format:"duration",check:"string_format",...se(e)})}function L0(t,e){return new t({type:"number",checks:[],...se(e)})}function q0(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...se(e)})}function F0(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...se(e)})}function V0(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...se(e)})}function W0(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...se(e)})}function G0(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...se(e)})}function B0(t,e){return new t({type:"boolean",...se(e)})}function K0(t,e){return new t({type:"bigint",...se(e)})}function H0(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...se(e)})}function J0(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...se(e)})}function Y0(t,e){return new t({type:"symbol",...se(e)})}function Q0(t,e){return new t({type:"undefined",...se(e)})}function X0(t,e){return new t({type:"null",...se(e)})}function eS(t){return new t({type:"any"})}function tS(t){return new t({type:"unknown"})}function rS(t,e){return new t({type:"never",...se(e)})}function nS(t,e){return new t({type:"void",...se(e)})}function iS(t,e){return new t({type:"date",...se(e)})}function oS(t,e){return new t({type:"nan",...se(e)})}function oo(t,e){return new hw({check:"less_than",...se(e),value:t,inclusive:!1})}function $n(t,e){return new hw({check:"less_than",...se(e),value:t,inclusive:!0})}function so(t,e){return new gw({check:"greater_than",...se(e),value:t,inclusive:!1})}function Hr(t,e){return new gw({check:"greater_than",...se(e),value:t,inclusive:!0})}function sS(t){return so(0,t)}function aS(t){return oo(0,t)}function uS(t){return $n(0,t)}function lS(t){return Hr(0,t)}function Zs(t,e){return new t1({check:"multiple_of",...se(e),value:t})}function Ls(t,e){return new i1({check:"max_size",...se(e),maximum:t})}function ao(t,e){return new o1({check:"min_size",...se(e),minimum:t})}function eu(t,e){return new s1({check:"size_equals",...se(e),size:t})}function tu(t,e){return new a1({check:"max_length",...se(e),maximum:t})}function Zo(t,e){return new u1({check:"min_length",...se(e),minimum:t})}function ru(t,e){return new l1({check:"length_equals",...se(e),length:t})}function Zc(t,e){return new c1({check:"string_format",format:"regex",...se(e),pattern:t})}function Lc(t){return new d1({check:"string_format",format:"lowercase",...se(t)})}function qc(t){return new f1({check:"string_format",format:"uppercase",...se(t)})}function Fc(t,e){return new p1({check:"string_format",format:"includes",...se(e),includes:t})}function Vc(t,e){return new m1({check:"string_format",format:"starts_with",...se(e),prefix:t})}function Wc(t,e){return new h1({check:"string_format",format:"ends_with",...se(e),suffix:t})}function cS(t,e,r){return new g1({check:"property",property:t,schema:e,...se(r)})}function Gc(t,e){return new y1({check:"mime_type",mime:t,...se(e)})}function Zi(t){return new v1({check:"overwrite",tx:t})}function Bc(t){return Zi(e=>e.normalize(t))}function Kc(){return Zi(t=>t.trim())}function Hc(){return Zi(t=>t.toLowerCase())}function Jc(){return Zi(t=>t.toUpperCase())}function Vm(){return Zi(t=>Nb(t))}function Oj(t,e,r){return new t({type:"array",element:e,...se(r)})}function dS(t,e){return new t({type:"file",...se(e)})}function fS(t,e,r){let i=se(r);return i.abort??(i.abort=!0),new t({type:"custom",check:"custom",fn:e,...i})}function pS(t,e,r){return new t({type:"custom",check:"custom",fn:e,...se(r)})}function mS(t){let e=PK(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(Qa(i,r.value,e._zod.def));else{let n=i;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=e),n.continue??(n.continue=!e._zod.def.abort),r.issues.push(Qa(n))}},t(r.value,r)));return e}function PK(t,e){let r=new zt({check:"custom",...se(e)});return r._zod.check=t,r}function hS(t){let e=new zt({check:"describe"});return e._zod.onattach=[r=>{let i=Kr.get(r)??{};Kr.add(r,{...i,description:t})}],e._zod.check=()=>{},e}function gS(t){let e=new zt({check:"meta"});return e._zod.onattach=[r=>{let i=Kr.get(r)??{};Kr.add(r,{...i,...t})}],e._zod.check=()=>{},e}function yS(t,e){let r=se(e),i=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(i=i.map(f=>typeof f=="string"?f.toLowerCase():f),n=n.map(f=>typeof f=="string"?f.toLowerCase():f));let o=new Set(i),s=new Set(n),a=t.Codec??Ac,u=t.Boolean??Cc,l=t.String??Ms,c=new l({type:"string",error:r.error}),d=new u({type:"boolean",error:r.error}),p=new a({type:"pipe",in:c,out:d,transform:((f,m)=>{let g=f;return r.case!=="sensitive"&&(g=g.toLowerCase()),o.has(g)?!0:s.has(g)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:m.value,inst:p,continue:!1}),{})}),reverseTransform:((f,m)=>f===!0?i[0]||"true":n[0]||"false"),error:r.error});return p}function nu(t,e,r,i={}){let n=se(i),o={...se(i),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...n};return r instanceof RegExp&&(o.pattern=r),new t(o)}var zj=N(()=>{fm();Dc();E0();_e()});function iu(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??Kr,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function Et(t,e,r={path:[],schemaPath:[]}){var i;let n=t._zod.def,o=e.seen.get(t);if(o)return o.count++,r.schemaPath.includes(t)&&(o.cycle=r.path),o.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,s);let a=t._zod.toJSONSchema?.();if(a)s.schema=a;else{let c={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,s.schema,c);else{let p=s.schema,f=e.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(t,e,p,c)}let d=t._zod.parent;d&&(s.ref||(s.ref=d),Et(d,e,c),e.seen.get(d).isParent=!0)}let u=e.metadataRegistry.get(t);return u&&Object.assign(s.schema,u),e.io==="input"&&Jr(t)&&(delete s.schema.examples,delete s.schema.default),e.io==="input"&&s.schema._prefault&&((i=s.schema).default??(i.default=s.schema._prefault)),delete s.schema._prefault,e.seen.get(t).schema}function ou(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=new Map;for(let s of t.seen.entries()){let a=t.metadataRegistry.get(s[0])?.id;if(a){let u=i.get(a);if(u&&u!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(a,s[0])}}let n=s=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(s[0])?.id,p=t.external.uri??(m=>m);if(d)return{ref:p(d)};let f=s[1].defId??s[1].schema.id??`schema${t.counter++}`;return s[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(s[1]===r)return{ref:"#"};let l=`#/${a}/`,c=s[1].schema.id??`__schema${t.counter++}`;return{defId:c,ref:l+c}},o=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:u,defId:l}=n(s);a.def={...a.schema},l&&(a.defId=l);let c=a.schema;for(let d in c)delete c[d];c.$ref=u};if(t.cycles==="throw")for(let s of t.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
80
-
81
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of t.seen.entries()){let a=s[1];if(e===s[0]){o(s);continue}if(t.external){let l=t.external.registry.get(s[0])?.id;if(e!==s[0]&&l){o(s);continue}}if(t.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&t.reused==="ref"){o(s);continue}}}function su(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=s=>{let a=t.seen.get(s);if(a.ref===null)return;let u=a.def??a.schema,l={...u},c=a.ref;if(a.ref=null,c){i(c);let p=t.seen.get(c),f=p.schema;if(f.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):Object.assign(u,f),Object.assign(u,l),s._zod.parent===c)for(let g in u)g==="$ref"||g==="allOf"||g in l||delete u[g];if(f.$ref&&p.def)for(let g in u)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(u[g])===JSON.stringify(p.def[g])&&delete u[g]}let d=s._zod.parent;if(d&&d!==c){i(d);let p=t.seen.get(d);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(let f in u)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(u[f])===JSON.stringify(p.def[f])&&delete u[f]}t.override({zodSchema:s,jsonSchema:u,path:a.path??[]})};for(let s of[...t.seen.entries()].reverse())i(s[0]);let n={};if(t.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let s=t.external.registry.get(e)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=t.external.uri(s)}Object.assign(n,r.def??r.schema);let o=t.external?.defs??{};for(let s of t.seen.entries()){let a=s[1];a.def&&a.defId&&(o[a.defId]=a.def)}t.external||Object.keys(o).length>0&&(t.target==="draft-2020-12"?n.$defs=o:n.definitions=o);try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...e["~standard"],jsonSchema:{input:Yc(e,"input",t.processors),output:Yc(e,"output",t.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function Jr(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let i=t._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Jr(i.element,r);if(i.type==="set")return Jr(i.valueType,r);if(i.type==="lazy")return Jr(i.getter(),r);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return Jr(i.innerType,r);if(i.type==="intersection")return Jr(i.left,r)||Jr(i.right,r);if(i.type==="record"||i.type==="map")return Jr(i.keyType,r)||Jr(i.valueType,r);if(i.type==="pipe")return Jr(i.in,r)||Jr(i.out,r);if(i.type==="object"){for(let n in i.shape)if(Jr(i.shape[n],r))return!0;return!1}if(i.type==="union"){for(let n of i.options)if(Jr(n,r))return!0;return!1}if(i.type==="tuple"){for(let n of i.items)if(Jr(n,r))return!0;return!!(i.rest&&Jr(i.rest,r))}return!1}var Nj,Yc,Qc=N(()=>{Dc();Nj=(t,e={})=>r=>{let i=iu({...r,processors:e});return Et(t,i),ou(i,t),su(i,t)},Yc=(t,e,r={})=>i=>{let{libraryOptions:n,target:o}=i??{},s=iu({...n??{},target:o,io:e,processors:r});return Et(t,s),ou(s,t),su(s,t)}});function au(t,e){if("_idmap"in t){let i=t,n=iu({...e,processors:vS}),o={};for(let u of i._idmap.entries()){let[l,c]=u;Et(c,n)}let s={},a={registry:i,uri:e?.uri,defs:o};n.external=a;for(let u of i._idmap.entries()){let[l,c]=u;ou(n,c),s[l]=su(n,c)}if(Object.keys(o).length>0){let u=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[u]:o}}return{schemas:s}}let r=iu({...e,processors:vS});return Et(t,r),ou(r,t),su(r,t)}var TK,_S,bS,wS,SS,kS,xS,$S,IS,ES,PS,TS,OS,zS,NS,jS,CS,RS,AS,DS,US,MS,ZS,LS,qS,FS,Wm,VS,WS,GS,BS,KS,HS,JS,YS,QS,XS,ek,Gm,tk,vS,uu=N(()=>{Qc();_e();TK={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},_S=(t,e,r,i)=>{let n=r;n.type="string";let{minimum:o,maximum:s,format:a,patterns:u,contentEncoding:l}=t._zod.bag;if(typeof o=="number"&&(n.minLength=o),typeof s=="number"&&(n.maxLength=s),a&&(n.format=TK[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),l&&(n.contentEncoding=l),u&&u.size>0){let c=[...u];c.length===1?n.pattern=c[0].source:c.length>1&&(n.allOf=[...c.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},bS=(t,e,r,i)=>{let n=r,{minimum:o,maximum:s,format:a,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:c}=t._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number",typeof c=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(n.minimum=c,n.exclusiveMinimum=!0):n.exclusiveMinimum=c),typeof o=="number"&&(n.minimum=o,typeof c=="number"&&e.target!=="draft-04"&&(c>=o?delete n.minimum:delete n.exclusiveMinimum)),typeof l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(n.maximum=l,n.exclusiveMaximum=!0):n.exclusiveMaximum=l),typeof s=="number"&&(n.maximum=s,typeof l=="number"&&e.target!=="draft-04"&&(l<=s?delete n.maximum:delete n.exclusiveMaximum)),typeof u=="number"&&(n.multipleOf=u)},wS=(t,e,r,i)=>{r.type="boolean"},SS=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},kS=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},xS=(t,e,r,i)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},$S=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},IS=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},ES=(t,e,r,i)=>{r.not={}},PS=(t,e,r,i)=>{},TS=(t,e,r,i)=>{},OS=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},zS=(t,e,r,i)=>{let n=t._zod.def,o=vc(n.entries);o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},NS=(t,e,r,i)=>{let n=t._zod.def,o=[];for(let s of n.values)if(s===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},jS=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},CS=(t,e,r,i)=>{let n=r,o=t._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=o.source},RS=(t,e,r,i)=>{let n=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:u}=t._zod.bag;s!==void 0&&(o.minLength=s),a!==void 0&&(o.maxLength=a),u?u.length===1?(o.contentMediaType=u[0],Object.assign(n,o)):(Object.assign(n,o),n.anyOf=u.map(l=>({contentMediaType:l}))):Object.assign(n,o)},AS=(t,e,r,i)=>{r.type="boolean"},DS=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},US=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},MS=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},ZS=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},LS=(t,e,r,i)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},qS=(t,e,r,i)=>{let n=r,o=t._zod.def,{minimum:s,maximum:a}=t._zod.bag;typeof s=="number"&&(n.minItems=s),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=Et(o.element,e,{...i,path:[...i.path,"items"]})},FS=(t,e,r,i)=>{let n=r,o=t._zod.def;n.type="object",n.properties={};let s=o.shape;for(let l in s)n.properties[l]=Et(s[l],e,{...i,path:[...i.path,"properties",l]});let a=new Set(Object.keys(s)),u=new Set([...a].filter(l=>{let c=o.shape[l]._zod;return e.io==="input"?c.optin===void 0:c.optout===void 0}));u.size>0&&(n.required=Array.from(u)),o.catchall?._zod.def.type==="never"?n.additionalProperties=!1:o.catchall?o.catchall&&(n.additionalProperties=Et(o.catchall,e,{...i,path:[...i.path,"additionalProperties"]})):e.io==="output"&&(n.additionalProperties=!1)},Wm=(t,e,r,i)=>{let n=t._zod.def,o=n.inclusive===!1,s=n.options.map((a,u)=>Et(a,e,{...i,path:[...i.path,o?"oneOf":"anyOf",u]}));o?r.oneOf=s:r.anyOf=s},VS=(t,e,r,i)=>{let n=t._zod.def,o=Et(n.left,e,{...i,path:[...i.path,"allOf",0]}),s=Et(n.right,e,{...i,path:[...i.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,u=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=u},WS=(t,e,r,i)=>{let n=r,o=t._zod.def;n.type="array";let s=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",u=o.items.map((p,f)=>Et(p,e,{...i,path:[...i.path,s,f]})),l=o.rest?Et(o.rest,e,{...i,path:[...i.path,a,...e.target==="openapi-3.0"?[o.items.length]:[]]}):null;e.target==="draft-2020-12"?(n.prefixItems=u,l&&(n.items=l)):e.target==="openapi-3.0"?(n.items={anyOf:u},l&&n.items.anyOf.push(l),n.minItems=u.length,l||(n.maxItems=u.length)):(n.items=u,l&&(n.additionalItems=l));let{minimum:c,maximum:d}=t._zod.bag;typeof c=="number"&&(n.minItems=c),typeof d=="number"&&(n.maxItems=d)},GS=(t,e,r,i)=>{let n=r,o=t._zod.def;n.type="object";let s=o.keyType,u=s._zod.bag?.patterns;if(o.mode==="loose"&&u&&u.size>0){let c=Et(o.valueType,e,{...i,path:[...i.path,"patternProperties","*"]});n.patternProperties={};for(let d of u)n.patternProperties[d.source]=c}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(n.propertyNames=Et(o.keyType,e,{...i,path:[...i.path,"propertyNames"]})),n.additionalProperties=Et(o.valueType,e,{...i,path:[...i.path,"additionalProperties"]});let l=s._zod.values;if(l){let c=[...l].filter(d=>typeof d=="string"||typeof d=="number");c.length>0&&(n.required=c)}},BS=(t,e,r,i)=>{let n=t._zod.def,o=Et(n.innerType,e,i),s=e.seen.get(t);e.target==="openapi-3.0"?(s.ref=n.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},KS=(t,e,r,i)=>{let n=t._zod.def;Et(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType},HS=(t,e,r,i)=>{let n=t._zod.def;Et(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},JS=(t,e,r,i)=>{let n=t._zod.def;Et(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},YS=(t,e,r,i)=>{let n=t._zod.def;Et(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},QS=(t,e,r,i)=>{let n=t._zod.def,o=e.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;Et(o,e,i);let s=e.seen.get(t);s.ref=o},XS=(t,e,r,i)=>{let n=t._zod.def;Et(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType,r.readOnly=!0},ek=(t,e,r,i)=>{let n=t._zod.def;Et(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType},Gm=(t,e,r,i)=>{let n=t._zod.def;Et(n.innerType,e,i);let o=e.seen.get(t);o.ref=n.innerType},tk=(t,e,r,i)=>{let n=t._zod.innerType;Et(n,e,i);let o=e.seen.get(t);o.ref=n},vS={string:_S,number:bS,boolean:wS,bigint:SS,symbol:kS,null:xS,undefined:$S,void:IS,never:ES,any:PS,unknown:TS,date:OS,enum:zS,literal:NS,nan:jS,template_literal:CS,file:RS,success:AS,custom:DS,function:US,transform:MS,map:ZS,set:LS,array:qS,object:FS,union:Wm,intersection:VS,tuple:WS,record:GS,nullable:BS,nonoptional:KS,default:HS,prefault:JS,catch:YS,pipe:QS,readonly:XS,promise:ek,optional:Gm,lazy:tk}});var jj=N(()=>{uu();Qc()});var Cj=N(()=>{});var rr=N(()=>{Ha();Zb();Mb();E0();fm();vw();_e();dm();km();Dc();yw();zj();Qc();uu();jj();Cj()});var Bm={};An(Bm,{endsWith:()=>Wc,gt:()=>so,gte:()=>Hr,includes:()=>Fc,length:()=>ru,lowercase:()=>Lc,lt:()=>oo,lte:()=>$n,maxLength:()=>tu,maxSize:()=>Ls,mime:()=>Gc,minLength:()=>Zo,minSize:()=>ao,multipleOf:()=>Zs,negative:()=>aS,nonnegative:()=>lS,nonpositive:()=>uS,normalize:()=>Bc,overwrite:()=>Zi,positive:()=>sS,property:()=>cS,regex:()=>Zc,size:()=>eu,slugify:()=>Vm,startsWith:()=>Vc,toLowerCase:()=>Hc,toUpperCase:()=>Jc,trim:()=>Kc,uppercase:()=>qc});var Km=N(()=>{rr()});var qs={};An(qs,{ZodISODate:()=>ik,ZodISODateTime:()=>rk,ZodISODuration:()=>uk,ZodISOTime:()=>sk,date:()=>ok,datetime:()=>nk,duration:()=>lk,time:()=>ak});function nk(t){return D0(rk,t)}function ok(t){return U0(ik,t)}function ak(t){return M0(sk,t)}function lk(t){return Z0(uk,t)}var rk,ik,sk,uk,Xc=N(()=>{rr();td();rk=z("ZodISODateTime",(t,e)=>{zw.init(t,e),Nt.init(t,e)});ik=z("ZodISODate",(t,e)=>{Nw.init(t,e),Nt.init(t,e)});sk=z("ZodISOTime",(t,e)=>{jw.init(t,e),Nt.init(t,e)});uk=z("ZodISODuration",(t,e)=>{Cw.init(t,e),Nt.init(t,e)})});var Rj,E$e,In,ck=N(()=>{rr();rr();_e();Rj=(t,e)=>{sm.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>um(t,r)},flatten:{value:r=>am(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Ja,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Ja,2)}},isEmpty:{get(){return t.issues.length===0}}})},E$e=z("ZodError",Rj),In=z("ZodError",Rj,{Parent:Error})});var Aj,Dj,Uj,Mj,Zj,Lj,qj,Fj,Vj,Wj,Gj,Bj,dk=N(()=>{rr();ck();Aj=xc(In),Dj=Ic(In),Uj=Pc(In),Mj=Tc(In),Zj=qN(In),Lj=FN(In),qj=VN(In),Fj=WN(In),Vj=GN(In),Wj=BN(In),Gj=KN(In),Bj=HN(In)});var ed={};An(ed,{ZodAny:()=>Qj,ZodArray:()=>rC,ZodBase64:()=>Ik,ZodBase64URL:()=>Ek,ZodBigInt:()=>rh,ZodBigIntFormat:()=>Ok,ZodBoolean:()=>th,ZodCIDRv4:()=>xk,ZodCIDRv6:()=>$k,ZodCUID:()=>yk,ZodCUID2:()=>vk,ZodCatch:()=>SC,ZodCodec:()=>Dk,ZodCustom:()=>uh,ZodCustomStringFormat:()=>nd,ZodDate:()=>Nk,ZodDefault:()=>gC,ZodDiscriminatedUnion:()=>iC,ZodE164:()=>Pk,ZodEmail:()=>mk,ZodEmoji:()=>hk,ZodEnum:()=>rd,ZodExactOptional:()=>pC,ZodFile:()=>dC,ZodFunction:()=>zC,ZodGUID:()=>Hm,ZodIPv4:()=>Sk,ZodIPv6:()=>kk,ZodIntersection:()=>oC,ZodJWT:()=>Tk,ZodKSUID:()=>wk,ZodLazy:()=>PC,ZodLiteral:()=>cC,ZodMAC:()=>Kj,ZodMap:()=>uC,ZodNaN:()=>xC,ZodNanoID:()=>gk,ZodNever:()=>eC,ZodNonOptional:()=>Rk,ZodNull:()=>Yj,ZodNullable:()=>hC,ZodNumber:()=>eh,ZodNumberFormat:()=>lu,ZodObject:()=>ih,ZodOptional:()=>Ck,ZodPipe:()=>Ak,ZodPrefault:()=>vC,ZodPromise:()=>OC,ZodReadonly:()=>$C,ZodRecord:()=>ah,ZodSet:()=>lC,ZodString:()=>Qm,ZodStringFormat:()=>Nt,ZodSuccess:()=>wC,ZodSymbol:()=>Hj,ZodTemplateLiteral:()=>EC,ZodTransform:()=>fC,ZodTuple:()=>sC,ZodType:()=>Fe,ZodULID:()=>_k,ZodURL:()=>Xm,ZodUUID:()=>uo,ZodUndefined:()=>Jj,ZodUnion:()=>oh,ZodUnknown:()=>Xj,ZodVoid:()=>tC,ZodXID:()=>bk,ZodXor:()=>nC,_ZodString:()=>pk,_default:()=>yC,_function:()=>jH,any:()=>hH,array:()=>tt,base64:()=>QK,base64url:()=>XK,bigint:()=>cH,boolean:()=>ar,catch:()=>kC,check:()=>CH,cidrv4:()=>JK,cidrv6:()=>YK,codec:()=>OH,cuid:()=>qK,cuid2:()=>FK,custom:()=>Uk,date:()=>yH,describe:()=>RH,discriminatedUnion:()=>sh,e164:()=>eH,email:()=>NK,emoji:()=>ZK,enum:()=>jr,exactOptional:()=>mC,file:()=>IH,float32:()=>sH,float64:()=>aH,function:()=>jH,guid:()=>jK,hash:()=>oH,hex:()=>iH,hostname:()=>nH,httpUrl:()=>MK,instanceof:()=>DH,int:()=>fk,int32:()=>uH,int64:()=>dH,intersection:()=>id,ipv4:()=>BK,ipv6:()=>HK,json:()=>MH,jwt:()=>tH,keyof:()=>vH,ksuid:()=>GK,lazy:()=>TC,literal:()=>be,looseObject:()=>Nr,looseRecord:()=>SH,mac:()=>KK,map:()=>kH,meta:()=>AH,nan:()=>TH,nanoid:()=>LK,nativeEnum:()=>$H,never:()=>zk,nonoptional:()=>bC,null:()=>nh,nullable:()=>Jm,nullish:()=>EH,number:()=>kt,object:()=>le,optional:()=>Zt,partialRecord:()=>wH,pipe:()=>Ym,prefault:()=>_C,preprocess:()=>lh,promise:()=>NH,readonly:()=>IC,record:()=>Pt,refine:()=>NC,set:()=>xH,strictObject:()=>_H,string:()=>F,stringFormat:()=>rH,stringbool:()=>UH,success:()=>PH,superRefine:()=>jC,symbol:()=>pH,templateLiteral:()=>zH,transform:()=>jk,tuple:()=>aC,uint32:()=>lH,uint64:()=>fH,ulid:()=>VK,undefined:()=>mH,union:()=>Ct,unknown:()=>jt,url:()=>UK,uuid:()=>CK,uuidv4:()=>RK,uuidv6:()=>AK,uuidv7:()=>DK,void:()=>gH,xid:()=>WK,xor:()=>bH});function F(t){return R0(Qm,t)}function NK(t){return xm(mk,t)}function jK(t){return Uc(Hm,t)}function CK(t){return $m(uo,t)}function RK(t){return Im(uo,t)}function AK(t){return Em(uo,t)}function DK(t){return Pm(uo,t)}function UK(t){return Mc(Xm,t)}function MK(t){return Mc(Xm,{protocol:/^https?$/,hostname:Wn.domain,...ee.normalizeParams(t)})}function ZK(t){return Tm(hk,t)}function LK(t){return Om(gk,t)}function qK(t){return zm(yk,t)}function FK(t){return Nm(vk,t)}function VK(t){return jm(_k,t)}function WK(t){return Cm(bk,t)}function GK(t){return Rm(wk,t)}function BK(t){return Am(Sk,t)}function KK(t){return A0(Kj,t)}function HK(t){return Dm(kk,t)}function JK(t){return Um(xk,t)}function YK(t){return Mm($k,t)}function QK(t){return Zm(Ik,t)}function XK(t){return Lm(Ek,t)}function eH(t){return qm(Pk,t)}function tH(t){return Fm(Tk,t)}function rH(t,e,r={}){return nu(nd,t,e,r)}function nH(t){return nu(nd,"hostname",Wn.hostname,t)}function iH(t){return nu(nd,"hex",Wn.hex,t)}function oH(t,e){let r=e?.enc??"hex",i=`${t}_${r}`,n=Wn[i];if(!n)throw new Error(`Unrecognized hash format: ${i}`);return nu(nd,i,n,e)}function kt(t){return L0(eh,t)}function fk(t){return q0(lu,t)}function sH(t){return F0(lu,t)}function aH(t){return V0(lu,t)}function uH(t){return W0(lu,t)}function lH(t){return G0(lu,t)}function ar(t){return B0(th,t)}function cH(t){return K0(rh,t)}function dH(t){return H0(Ok,t)}function fH(t){return J0(Ok,t)}function pH(t){return Y0(Hj,t)}function mH(t){return Q0(Jj,t)}function nh(t){return X0(Yj,t)}function hH(){return eS(Qj)}function jt(){return tS(Xj)}function zk(t){return rS(eC,t)}function gH(t){return nS(tC,t)}function yH(t){return iS(Nk,t)}function tt(t,e){return Oj(rC,t,e)}function vH(t){let e=t._zod.def.shape;return jr(Object.keys(e))}function le(t,e){let r={type:"object",shape:t??{},...ee.normalizeParams(e)};return new ih(r)}function _H(t,e){return new ih({type:"object",shape:t,catchall:zk(),...ee.normalizeParams(e)})}function Nr(t,e){return new ih({type:"object",shape:t,catchall:jt(),...ee.normalizeParams(e)})}function Ct(t,e){return new oh({type:"union",options:t,...ee.normalizeParams(e)})}function bH(t,e){return new nC({type:"union",options:t,inclusive:!1,...ee.normalizeParams(e)})}function sh(t,e,r){return new iC({type:"union",options:e,discriminator:t,...ee.normalizeParams(r)})}function id(t,e){return new oC({type:"intersection",left:t,right:e})}function aC(t,e,r){let i=e instanceof De,n=i?r:e,o=i?e:null;return new sC({type:"tuple",items:t,rest:o,...ee.normalizeParams(n)})}function Pt(t,e,r){return new ah({type:"record",keyType:t,valueType:e,...ee.normalizeParams(r)})}function wH(t,e,r){let i=Br(t);return i._zod.values=void 0,new ah({type:"record",keyType:i,valueType:e,...ee.normalizeParams(r)})}function SH(t,e,r){return new ah({type:"record",keyType:t,valueType:e,mode:"loose",...ee.normalizeParams(r)})}function kH(t,e,r){return new uC({type:"map",keyType:t,valueType:e,...ee.normalizeParams(r)})}function xH(t,e){return new lC({type:"set",valueType:t,...ee.normalizeParams(e)})}function jr(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new rd({type:"enum",entries:r,...ee.normalizeParams(e)})}function $H(t,e){return new rd({type:"enum",entries:t,...ee.normalizeParams(e)})}function be(t,e){return new cC({type:"literal",values:Array.isArray(t)?t:[t],...ee.normalizeParams(e)})}function IH(t){return dS(dC,t)}function jk(t){return new fC({type:"transform",transform:t})}function Zt(t){return new Ck({type:"optional",innerType:t})}function mC(t){return new pC({type:"optional",innerType:t})}function Jm(t){return new hC({type:"nullable",innerType:t})}function EH(t){return Zt(Jm(t))}function yC(t,e){return new gC({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():ee.shallowClone(e)}})}function _C(t,e){return new vC({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():ee.shallowClone(e)}})}function bC(t,e){return new Rk({type:"nonoptional",innerType:t,...ee.normalizeParams(e)})}function PH(t){return new wC({type:"success",innerType:t})}function kC(t,e){return new SC({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function TH(t){return oS(xC,t)}function Ym(t,e){return new Ak({type:"pipe",in:t,out:e})}function OH(t,e,r){return new Dk({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}function IC(t){return new $C({type:"readonly",innerType:t})}function zH(t,e){return new EC({type:"template_literal",parts:t,...ee.normalizeParams(e)})}function TC(t){return new PC({type:"lazy",getter:t})}function NH(t){return new OC({type:"promise",innerType:t})}function jH(t){return new zC({type:"function",input:Array.isArray(t?.input)?aC(t?.input):t?.input??tt(jt()),output:t?.output??jt()})}function CH(t){let e=new zt({check:"custom"});return e._zod.check=t,e}function Uk(t,e){return fS(uh,t??(()=>!0),e)}function NC(t,e={}){return pS(uh,t,e)}function jC(t){return mS(t)}function DH(t,e={}){let r=new uh({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...ee.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=i=>{i.value instanceof t||i.issues.push({code:"invalid_type",expected:t.name,input:i.value,inst:r,path:[...r._zod.def.path??[]]})},r}function MH(t){let e=TC(()=>Ct([F(t),kt(),ar(),nh(),tt(e),Pt(F(),e)]));return e}function lh(t,e){return Ym(jk(t),e)}var Fe,pk,Qm,Nt,mk,Hm,uo,Xm,hk,gk,yk,vk,_k,bk,wk,Sk,Kj,kk,xk,$k,Ik,Ek,Pk,Tk,nd,eh,lu,th,rh,Ok,Hj,Jj,Yj,Qj,Xj,eC,tC,Nk,rC,ih,oh,nC,iC,oC,sC,ah,uC,lC,rd,cC,dC,fC,Ck,pC,hC,gC,vC,Rk,wC,SC,xC,Ak,Dk,$C,EC,PC,OC,zC,uh,RH,AH,UH,td=N(()=>{rr();rr();uu();Qc();Km();Xc();dk();Fe=z("ZodType",(t,e)=>(De.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Yc(t,"input"),output:Yc(t,"output")}}),t.toJSONSchema=Nj(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(ee.mergeDefs(e,{checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0}),t.with=t.check,t.clone=(r,i)=>Br(t,r,i),t.brand=()=>t,t.register=((r,i)=>(r.add(t,i),t)),t.parse=(r,i)=>Aj(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>Uj(t,r,i),t.parseAsync=async(r,i)=>Dj(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>Mj(t,r,i),t.spa=t.safeParseAsync,t.encode=(r,i)=>Zj(t,r,i),t.decode=(r,i)=>Lj(t,r,i),t.encodeAsync=async(r,i)=>qj(t,r,i),t.decodeAsync=async(r,i)=>Fj(t,r,i),t.safeEncode=(r,i)=>Vj(t,r,i),t.safeDecode=(r,i)=>Wj(t,r,i),t.safeEncodeAsync=async(r,i)=>Gj(t,r,i),t.safeDecodeAsync=async(r,i)=>Bj(t,r,i),t.refine=(r,i)=>t.check(NC(r,i)),t.superRefine=r=>t.check(jC(r)),t.overwrite=r=>t.check(Zi(r)),t.optional=()=>Zt(t),t.exactOptional=()=>mC(t),t.nullable=()=>Jm(t),t.nullish=()=>Zt(Jm(t)),t.nonoptional=r=>bC(t,r),t.array=()=>tt(t),t.or=r=>Ct([t,r]),t.and=r=>id(t,r),t.transform=r=>Ym(t,jk(r)),t.default=r=>yC(t,r),t.prefault=r=>_C(t,r),t.catch=r=>kC(t,r),t.pipe=r=>Ym(t,r),t.readonly=()=>IC(t),t.describe=r=>{let i=t.clone();return Kr.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){return Kr.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Kr.get(t);let i=t.clone();return Kr.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=r=>r(t),t)),pk=z("_ZodString",(t,e)=>{Ms.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(i,n,o)=>_S(t,i,n,o);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...i)=>t.check(Zc(...i)),t.includes=(...i)=>t.check(Fc(...i)),t.startsWith=(...i)=>t.check(Vc(...i)),t.endsWith=(...i)=>t.check(Wc(...i)),t.min=(...i)=>t.check(Zo(...i)),t.max=(...i)=>t.check(tu(...i)),t.length=(...i)=>t.check(ru(...i)),t.nonempty=(...i)=>t.check(Zo(1,...i)),t.lowercase=i=>t.check(Lc(i)),t.uppercase=i=>t.check(qc(i)),t.trim=()=>t.check(Kc()),t.normalize=(...i)=>t.check(Bc(...i)),t.toLowerCase=()=>t.check(Hc()),t.toUpperCase=()=>t.check(Jc()),t.slugify=()=>t.check(Vm())}),Qm=z("ZodString",(t,e)=>{Ms.init(t,e),pk.init(t,e),t.email=r=>t.check(xm(mk,r)),t.url=r=>t.check(Mc(Xm,r)),t.jwt=r=>t.check(Fm(Tk,r)),t.emoji=r=>t.check(Tm(hk,r)),t.guid=r=>t.check(Uc(Hm,r)),t.uuid=r=>t.check($m(uo,r)),t.uuidv4=r=>t.check(Im(uo,r)),t.uuidv6=r=>t.check(Em(uo,r)),t.uuidv7=r=>t.check(Pm(uo,r)),t.nanoid=r=>t.check(Om(gk,r)),t.guid=r=>t.check(Uc(Hm,r)),t.cuid=r=>t.check(zm(yk,r)),t.cuid2=r=>t.check(Nm(vk,r)),t.ulid=r=>t.check(jm(_k,r)),t.base64=r=>t.check(Zm(Ik,r)),t.base64url=r=>t.check(Lm(Ek,r)),t.xid=r=>t.check(Cm(bk,r)),t.ksuid=r=>t.check(Rm(wk,r)),t.ipv4=r=>t.check(Am(Sk,r)),t.ipv6=r=>t.check(Dm(kk,r)),t.cidrv4=r=>t.check(Um(xk,r)),t.cidrv6=r=>t.check(Mm($k,r)),t.e164=r=>t.check(qm(Pk,r)),t.datetime=r=>t.check(nk(r)),t.date=r=>t.check(ok(r)),t.time=r=>t.check(ak(r)),t.duration=r=>t.check(lk(r))});Nt=z("ZodStringFormat",(t,e)=>{It.init(t,e),pk.init(t,e)}),mk=z("ZodEmail",(t,e)=>{Sw.init(t,e),Nt.init(t,e)});Hm=z("ZodGUID",(t,e)=>{bw.init(t,e),Nt.init(t,e)});uo=z("ZodUUID",(t,e)=>{ww.init(t,e),Nt.init(t,e)});Xm=z("ZodURL",(t,e)=>{kw.init(t,e),Nt.init(t,e)});hk=z("ZodEmoji",(t,e)=>{xw.init(t,e),Nt.init(t,e)});gk=z("ZodNanoID",(t,e)=>{$w.init(t,e),Nt.init(t,e)});yk=z("ZodCUID",(t,e)=>{Iw.init(t,e),Nt.init(t,e)});vk=z("ZodCUID2",(t,e)=>{Ew.init(t,e),Nt.init(t,e)});_k=z("ZodULID",(t,e)=>{Pw.init(t,e),Nt.init(t,e)});bk=z("ZodXID",(t,e)=>{Tw.init(t,e),Nt.init(t,e)});wk=z("ZodKSUID",(t,e)=>{Ow.init(t,e),Nt.init(t,e)});Sk=z("ZodIPv4",(t,e)=>{Rw.init(t,e),Nt.init(t,e)});Kj=z("ZodMAC",(t,e)=>{Dw.init(t,e),Nt.init(t,e)});kk=z("ZodIPv6",(t,e)=>{Aw.init(t,e),Nt.init(t,e)});xk=z("ZodCIDRv4",(t,e)=>{Uw.init(t,e),Nt.init(t,e)});$k=z("ZodCIDRv6",(t,e)=>{Mw.init(t,e),Nt.init(t,e)});Ik=z("ZodBase64",(t,e)=>{Zw.init(t,e),Nt.init(t,e)});Ek=z("ZodBase64URL",(t,e)=>{Lw.init(t,e),Nt.init(t,e)});Pk=z("ZodE164",(t,e)=>{qw.init(t,e),Nt.init(t,e)});Tk=z("ZodJWT",(t,e)=>{Fw.init(t,e),Nt.init(t,e)});nd=z("ZodCustomStringFormat",(t,e)=>{Vw.init(t,e),Nt.init(t,e)});eh=z("ZodNumber",(t,e)=>{_m.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(i,n,o)=>bS(t,i,n,o),t.gt=(i,n)=>t.check(so(i,n)),t.gte=(i,n)=>t.check(Hr(i,n)),t.min=(i,n)=>t.check(Hr(i,n)),t.lt=(i,n)=>t.check(oo(i,n)),t.lte=(i,n)=>t.check($n(i,n)),t.max=(i,n)=>t.check($n(i,n)),t.int=i=>t.check(fk(i)),t.safe=i=>t.check(fk(i)),t.positive=i=>t.check(so(0,i)),t.nonnegative=i=>t.check(Hr(0,i)),t.negative=i=>t.check(oo(0,i)),t.nonpositive=i=>t.check($n(0,i)),t.multipleOf=(i,n)=>t.check(Zs(i,n)),t.step=(i,n)=>t.check(Zs(i,n)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});lu=z("ZodNumberFormat",(t,e)=>{Ww.init(t,e),eh.init(t,e)});th=z("ZodBoolean",(t,e)=>{Cc.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>wS(t,r,i,n)});rh=z("ZodBigInt",(t,e)=>{bm.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(i,n,o)=>SS(t,i,n,o),t.gte=(i,n)=>t.check(Hr(i,n)),t.min=(i,n)=>t.check(Hr(i,n)),t.gt=(i,n)=>t.check(so(i,n)),t.gte=(i,n)=>t.check(Hr(i,n)),t.min=(i,n)=>t.check(Hr(i,n)),t.lt=(i,n)=>t.check(oo(i,n)),t.lte=(i,n)=>t.check($n(i,n)),t.max=(i,n)=>t.check($n(i,n)),t.positive=i=>t.check(so(BigInt(0),i)),t.negative=i=>t.check(oo(BigInt(0),i)),t.nonpositive=i=>t.check($n(BigInt(0),i)),t.nonnegative=i=>t.check(Hr(BigInt(0),i)),t.multipleOf=(i,n)=>t.check(Zs(i,n));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});Ok=z("ZodBigIntFormat",(t,e)=>{Gw.init(t,e),rh.init(t,e)});Hj=z("ZodSymbol",(t,e)=>{Bw.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>kS(t,r,i,n)});Jj=z("ZodUndefined",(t,e)=>{Kw.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>$S(t,r,i,n)});Yj=z("ZodNull",(t,e)=>{Hw.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>xS(t,r,i,n)});Qj=z("ZodAny",(t,e)=>{Jw.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>PS(t,r,i,n)});Xj=z("ZodUnknown",(t,e)=>{Yw.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>TS(t,r,i,n)});eC=z("ZodNever",(t,e)=>{Qw.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>ES(t,r,i,n)});tC=z("ZodVoid",(t,e)=>{Xw.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>IS(t,r,i,n)});Nk=z("ZodDate",(t,e)=>{e0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(i,n,o)=>OS(t,i,n,o),t.min=(i,n)=>t.check(Hr(i,n)),t.max=(i,n)=>t.check($n(i,n));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});rC=z("ZodArray",(t,e)=>{t0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>qS(t,r,i,n),t.element=e.element,t.min=(r,i)=>t.check(Zo(r,i)),t.nonempty=r=>t.check(Zo(1,r)),t.max=(r,i)=>t.check(tu(r,i)),t.length=(r,i)=>t.check(ru(r,i)),t.unwrap=()=>t.element});ih=z("ZodObject",(t,e)=>{A1.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>FS(t,r,i,n),ee.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>jr(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:jt()}),t.loose=()=>t.clone({...t._zod.def,catchall:jt()}),t.strict=()=>t.clone({...t._zod.def,catchall:zk()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>ee.extend(t,r),t.safeExtend=r=>ee.safeExtend(t,r),t.merge=r=>ee.merge(t,r),t.pick=r=>ee.pick(t,r),t.omit=r=>ee.omit(t,r),t.partial=(...r)=>ee.partial(Ck,t,r[0]),t.required=(...r)=>ee.required(Rk,t,r[0])});oh=z("ZodUnion",(t,e)=>{Rc.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Wm(t,r,i,n),t.options=e.options});nC=z("ZodXor",(t,e)=>{oh.init(t,e),r0.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Wm(t,r,i,n),t.options=e.options});iC=z("ZodDiscriminatedUnion",(t,e)=>{oh.init(t,e),n0.init(t,e)});oC=z("ZodIntersection",(t,e)=>{i0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>VS(t,r,i,n)});sC=z("ZodTuple",(t,e)=>{wm.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>WS(t,r,i,n),t.rest=r=>t.clone({...t._zod.def,rest:r})});ah=z("ZodRecord",(t,e)=>{o0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>GS(t,r,i,n),t.keyType=e.keyType,t.valueType=e.valueType});uC=z("ZodMap",(t,e)=>{s0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>ZS(t,r,i,n),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(ao(...r)),t.nonempty=r=>t.check(ao(1,r)),t.max=(...r)=>t.check(Ls(...r)),t.size=(...r)=>t.check(eu(...r))});lC=z("ZodSet",(t,e)=>{a0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>LS(t,r,i,n),t.min=(...r)=>t.check(ao(...r)),t.nonempty=r=>t.check(ao(1,r)),t.max=(...r)=>t.check(Ls(...r)),t.size=(...r)=>t.check(eu(...r))});rd=z("ZodEnum",(t,e)=>{u0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(i,n,o)=>zS(t,i,n,o),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(i,n)=>{let o={};for(let s of i)if(r.has(s))o[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new rd({...e,checks:[],...ee.normalizeParams(n),entries:o})},t.exclude=(i,n)=>{let o={...e.entries};for(let s of i)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new rd({...e,checks:[],...ee.normalizeParams(n),entries:o})}});cC=z("ZodLiteral",(t,e)=>{l0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>NS(t,r,i,n),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});dC=z("ZodFile",(t,e)=>{c0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>RS(t,r,i,n),t.min=(r,i)=>t.check(ao(r,i)),t.max=(r,i)=>t.check(Ls(r,i)),t.mime=(r,i)=>t.check(Gc(Array.isArray(r)?r:[r],i))});fC=z("ZodTransform",(t,e)=>{d0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>MS(t,r,i,n),t._zod.parse=(r,i)=>{if(i.direction==="backward")throw new As(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(ee.issue(o,r.value,e));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(ee.issue(s))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(o=>(r.value=o,r)):(r.value=n,r)}});Ck=z("ZodOptional",(t,e)=>{Sm.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Gm(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});pC=z("ZodExactOptional",(t,e)=>{f0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>Gm(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});hC=z("ZodNullable",(t,e)=>{p0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>BS(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});gC=z("ZodDefault",(t,e)=>{m0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>HS(t,r,i,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});vC=z("ZodPrefault",(t,e)=>{h0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>JS(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});Rk=z("ZodNonOptional",(t,e)=>{g0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>KS(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});wC=z("ZodSuccess",(t,e)=>{y0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>AS(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});SC=z("ZodCatch",(t,e)=>{v0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>YS(t,r,i,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});xC=z("ZodNaN",(t,e)=>{_0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>jS(t,r,i,n)});Ak=z("ZodPipe",(t,e)=>{b0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>QS(t,r,i,n),t.in=e.in,t.out=e.out});Dk=z("ZodCodec",(t,e)=>{Ak.init(t,e),Ac.init(t,e)});$C=z("ZodReadonly",(t,e)=>{w0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>XS(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});EC=z("ZodTemplateLiteral",(t,e)=>{S0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>CS(t,r,i,n)});PC=z("ZodLazy",(t,e)=>{$0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>tk(t,r,i,n),t.unwrap=()=>t._zod.def.getter()});OC=z("ZodPromise",(t,e)=>{x0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>ek(t,r,i,n),t.unwrap=()=>t._zod.def.innerType});zC=z("ZodFunction",(t,e)=>{k0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>US(t,r,i,n)});uh=z("ZodCustom",(t,e)=>{I0.init(t,e),Fe.init(t,e),t._zod.processJSONSchema=(r,i,n)=>DS(t,r,i,n)});RH=hS,AH=gS;UH=(...t)=>yS({Codec:Dk,Boolean:th,String:Qm},...t)});var CC,AC=N(()=>{rr();rr();CC||(CC={})});var R$e,DC=N(()=>{Dc();Km();Xc();td();R$e={...ed,...Bm,iso:qs}});var UC=N(()=>{rr();td()});var od=N(()=>{rr();td();Km();ck();dk();AC();rr();T0();rr();uu();DC();km();Xc();Xc();UC();cr(P0())});var ZC=N(()=>{od();od()});import YH from"axios";import{homedir as QH}from"node:os";import{join as XH}from"node:path";import{existsSync as e5,readFileSync as t5}from"node:fs";function r5(){if(process.env.OPENAI_PROXY_TOKEN)return U.debug("[Auth] Using OPENAI_PROXY_TOKEN (ECS execution)"),process.env.OPENAI_PROXY_TOKEN;if(process.env.ZIBBY_USER_TOKEN)return U.debug("[Auth] Using ZIBBY_USER_TOKEN (CI/CD PAT)"),process.env.ZIBBY_USER_TOKEN;try{let t=XH(QH(),".zibby","config.json");if(e5(t)){let e=JSON.parse(t5(t,"utf-8"));if(e.sessionToken)return U.debug("[Auth] Using session token from zibby login"),e.sessionToken}}catch(t){U.debug(`[Auth] Could not read zibby login session: ${t.message}`)}return null}function n5(){return process.env.OPENAI_PROXY_URL?process.env.OPENAI_PROXY_URL.replace(/\/v1\/?$/,""):"https://api-prod.zibby.app/openai-proxy"}function cu(t){if(!(typeof t!="object"||t===null)){if(Object.keys(t).length===0){t.type="object",t.additionalProperties=!0;return}if(t.type||(t.properties?t.type="object":t.items&&(t.type="array")),t.type==="object")if(t.properties){for(let[e,r]of Object.entries(t.properties))r.type==="object"&&r.additionalProperties&&r.additionalProperties!==!1&&(!r.properties||Object.keys(r.properties).length===0)&&(t.properties[e]={type:["object","null"]});t.additionalProperties=!1,t.required=Object.keys(t.properties),Object.values(t.properties).forEach(cu)}else"additionalProperties"in t||(t.additionalProperties=!0);t.type==="array"&&t.items&&cu(t.items),t.anyOf&&t.anyOf.forEach(cu),t.oneOf&&t.oneOf.forEach(cu),t.allOf&&t.allOf.forEach(cu)}}async function LC(t,e){U.info("\u{1F527} [OpenAI Proxy] Formatting structured output...");let r=r5();if(!r)throw new Error("Authentication required for structured output processing.\n Local development: Run `zibby login`\n CI/CD: Set ZIBBY_USER_TOKEN environment variable (Personal Access Token from UI settings)");let i=n5();U.info(`\u{1F517} Using OpenAI proxy: ${i}`);let n=au(e),o=n;if(n.$ref&&n.definitions){let c=n.$ref.split("/").pop();o=n.definitions[c]||n,U.debug(`Extracted schema from $ref: ${c}`)}delete o.$schema,cu(o);let s=4e5,a=t;t.length>s&&(U.warn(`\u26A0\uFE0F [OpenAI Proxy] Raw text (${t.length} chars) exceeds limit, keeping last ${s} chars`),a=`... [truncated early content] ...
82
- ${t.slice(-s)}`);let u=`Extract and format the following information into structured JSON matching the schema.
39
+ Rules: valid JSON only, no markdown wrapping, no extra text in the file.`}static _buildExample(e){if(!e)return{};let t=e.type;if(t==="object"&&e.properties){let r={};for(let[s,n]of Object.entries(e.properties))r[s]=this._buildExample(n);return r}if(t==="array"&&e.items)return[this._buildExample(e.items)];if(e.enum&&Array.isArray(e.enum)&&e.enum.length>0)return`<${e.enum.join("|")}>`;if(t==="string")return"<string>";if(t==="number"||t==="integer")return 0;if(t==="boolean")return!1;if(e.description)return`<${e.description}>`;if(e.nullable||e.oneOf||e.anyOf){let r=e.oneOf?.find(s=>s.type!=="null")||e.anyOf?.find(s=>s.type!=="null");return r?this._buildExample(r):null}return"<value>"}}});import Qn from"axios";import{homedir as eo}from"node:os";import{join as to}from"node:path";import{existsSync as ro,readFileSync as so}from"node:fs";import{toJSONSchema as no}from"zod";function oo(){if(process.env.OPENAI_PROXY_TOKEN)return h.debug("[Auth] Using OPENAI_PROXY_TOKEN (ECS execution)"),process.env.OPENAI_PROXY_TOKEN;if(process.env.ZIBBY_USER_TOKEN)return h.debug("[Auth] Using ZIBBY_USER_TOKEN (CI/CD PAT)"),process.env.ZIBBY_USER_TOKEN;try{let i=to(eo(),".zibby","config.json");if(ro(i)){let e=JSON.parse(so(i,"utf-8"));if(e.sessionToken)return h.debug("[Auth] Using session token from zibby login"),e.sessionToken}}catch(i){h.debug(`[Auth] Could not read zibby login session: ${i.message}`)}return null}function io(){return process.env.OPENAI_PROXY_URL?process.env.OPENAI_PROXY_URL.replace(/\/v1\/?$/,""):"https://api-prod.zibby.app/openai-proxy"}function be(i){if(!(typeof i!="object"||i===null)){if(Object.keys(i).length===0){i.type="object",i.additionalProperties=!0;return}if(i.type||(i.properties?i.type="object":i.items&&(i.type="array")),i.type==="object")if(i.properties){for(let[e,t]of Object.entries(i.properties))t.type==="object"&&t.additionalProperties&&t.additionalProperties!==!1&&(!t.properties||Object.keys(t.properties).length===0)&&(i.properties[e]={type:["object","null"]});i.additionalProperties=!1,i.required=Object.keys(i.properties),Object.values(i.properties).forEach(be)}else"additionalProperties"in i||(i.additionalProperties=!0);i.type==="array"&&i.items&&be(i.items),i.anyOf&&i.anyOf.forEach(be),i.oneOf&&i.oneOf.forEach(be),i.allOf&&i.allOf.forEach(be)}}async function ns(i,e){h.info("\u{1F527} [OpenAI Proxy] Formatting structured output...");let t=oo();if(!t)throw new Error("Authentication required for structured output processing.\n Local development: Run `zibby login`\n CI/CD: Set ZIBBY_USER_TOKEN environment variable (Personal Access Token from UI settings)");let r=io();h.info(`\u{1F517} Using OpenAI proxy: ${r}`);let s=no(e),n=s;if(s.$ref&&s.definitions){let u=s.$ref.split("/").pop();n=s.definitions[u]||s,h.debug(`Extracted schema from $ref: ${u}`)}delete n.$schema,be(n);let o=4e5,c=i;i.length>o&&(h.warn(`\u26A0\uFE0F [OpenAI Proxy] Raw text (${i.length} chars) exceeds limit, keeping last ${o} chars`),c=`... [truncated early content] ...
40
+ ${i.slice(-o)}`);let l=`Extract and format the following information into structured JSON matching the schema.
83
41
 
84
42
  RAW CONTENT:
85
- ${a}
43
+ ${c}
86
44
 
87
- Extract all relevant information and format it according to the schema. If any required fields are missing, do your best to infer them from the content.`,l={model:Tr.OPENAI_POSTPROCESSING,messages:[{role:"user",content:u}],response_format:{type:"json_schema",json_schema:{name:"extract",schema:o,strict:!0}}};U.info(`\u{1F4E4} Sending to OpenAI proxy: model=${Tr.OPENAI_POSTPROCESSING}, schema keys=${Object.keys(o.properties||{}).join(", ")}`),U.debug(` Schema size: ${JSON.stringify(o).length} chars`),U.debug(` Prompt size: ${u.length} chars`);try{let c={"Content-Type":"application/json"};process.env.OPENAI_PROXY_TOKEN?(c["x-proxy-token"]=r,c["x-execution-id"]=process.env.EXECUTION_ID||""):(c.Authorization=`Bearer ${r}`,c["x-api-key"]=process.env.ZIBBY_API_KEY||"",c["x-execution-id"]=process.env.EXECUTION_ID||"");let p=(await YH.post(i,l,{headers:c,timeout:Zp.OPENAI_REQUEST})).data?.choices?.[0]?.message?.content;if(!p)throw new Error("OpenAI proxy returned empty response");let f=JSON.parse(p);return U.info("\u2705 Successfully formatted with OpenAI proxy"),{structured:f,raw:t}}catch(c){if(c.response){let d=c.response.status,p=c.response.data;throw U.error(`\u274C OpenAI proxy request failed: ${d}`),U.error(` Status: ${d}`),U.error(` Response: ${JSON.stringify(p,null,2)}`),d===401||d===403?new Error(`Authentication failed for OpenAI proxy.
45
+ Extract all relevant information and format it according to the schema. If any required fields are missing, do your best to infer them from the content.`,a={model:G.OPENAI_POSTPROCESSING,messages:[{role:"user",content:l}],response_format:{type:"json_schema",json_schema:{name:"extract",schema:n,strict:!0}}};h.info(`\u{1F4E4} Sending to OpenAI proxy: model=${G.OPENAI_POSTPROCESSING}, schema keys=${Object.keys(n.properties||{}).join(", ")}`),h.debug(` Schema size: ${JSON.stringify(n).length} chars`),h.debug(` Prompt size: ${l.length} chars`);try{let u={"Content-Type":"application/json"};process.env.OPENAI_PROXY_TOKEN?(u["x-proxy-token"]=t,u["x-execution-id"]=process.env.EXECUTION_ID||""):(u.Authorization=`Bearer ${t}`,u["x-api-key"]=process.env.ZIBBY_API_KEY||"",u["x-execution-id"]=process.env.EXECUTION_ID||"");let d=(await Qn.post(r,a,{headers:u,timeout:yt.OPENAI_REQUEST})).data?.choices?.[0]?.message?.content;if(!d)throw new Error("OpenAI proxy returned empty response");let f=JSON.parse(d);return h.info("\u2705 Successfully formatted with OpenAI proxy"),{structured:f,raw:i}}catch(u){if(u.response){let p=u.response.status,d=u.response.data;throw h.error(`\u274C OpenAI proxy request failed: ${p}`),h.error(` Status: ${p}`),h.error(` Response: ${JSON.stringify(d,null,2)}`),p===401||p===403?new Error(`Authentication failed for OpenAI proxy.
88
46
  Run \`zibby login\` or set ZIBBY_USER_TOKEN environment variable.
89
- Response: ${JSON.stringify(p)}`,{cause:c}):new Error(`Failed to format Cursor output: ${p?.error?.message||"Unknown error"}`,{cause:c})}throw U.error(`\u274C OpenAI proxy request failed: ${c.message}`),new Error(`Failed to format output: ${c.message}`,{cause:c})}}var qC=N(()=>{ZC();Un();To()});import{copyFileSync as i5,existsSync as Mk,lstatSync as o5,mkdirSync as FC,rmSync as s5,symlinkSync as a5,unlinkSync as u5}from"node:fs";import{join as lo}from"node:path";import{homedir as l5}from"node:os";import{randomBytes as c5}from"node:crypto";function VC(t){return!(!t||typeof t!="string"||process.env.ZIBBY_CURSOR_USE_GLOBAL_MCP==="1"||process.env.ZIBBY_CURSOR_USE_GLOBAL_MCP==="true")}function WC(t){let e=lo(t||process.cwd(),".zibby","tmp");FC(e,{recursive:!0});let r=`${process.pid}-${Date.now()}-${c5(4).toString("hex")}`,i=lo(e,`cursor-agent-home-${r}`),n=lo(i,".cursor");FC(n,{recursive:!0});let o=l5(),s=lo(o,".cursor");if(Mk(s))for(let a of d5){let u=lo(s,a);if(Mk(u))try{i5(u,lo(n,a))}catch{}}if(process.platform==="darwin"){let a=lo(o,"Library");if(Mk(a))try{a5(a,lo(i,"Library"))}catch{}}return i}function GC(t){if(!(!t||typeof t!="string"))try{let e=lo(t,"Library");try{o5(e).isSymbolicLink()&&u5(e)}catch{}s5(t,{recursive:!0,force:!0})}catch{}}var d5,BC=N(()=>{d5=["cli-config.json","config.json","auth.json","argv.json"]});import{spawn as f5,execSync as Fs}from"node:child_process";import{writeFileSync as KC,readFileSync as HC,mkdirSync as JC,existsSync as sd,accessSync as YC,constants as QC,unlinkSync as p5}from"node:fs";import{join as hi,resolve as m5}from"node:path";import{homedir as ad}from"node:os";var du,XC=N(()=>{_s();Un();To();Ci();Xi();ic();Pb();qC();vs();BC();du=class extends Vr{constructor(){super("cursor","Cursor (CLI)",100)}canHandle(e){let r=[hi(ad(),".local","bin","cursor-agent"),hi(ad(),".cursor","bin","cursor-agent"),"/usr/local/bin/cursor-agent","/usr/local/bin/agent","/Applications/Cursor.app/Contents/Resources/app/bin/cursor","agent","cursor-agent"];for(let i of r)try{if(i.startsWith("/")){YC(i,QC.X_OK);let n=Fs(`"${i}" --version 2>&1`,{encoding:"utf-8",timeout:3e3,stdio:"pipe"});if(n&&n.length>0)return U.debug(`[Cursor] Found agent at: ${i} (version: ${n.trim().slice(0,50)})`),!0}else{let n=Fs(`which ${i}`,{encoding:"utf-8",timeout:2e3,stdio:"pipe"}).trim();if(!n)continue;let o=Fs(`${i} --version 2>&1`,{encoding:"utf-8",timeout:3e3,stdio:"pipe"});if(o&&o.length>0)return U.debug(`[Cursor] Found '${i}' in PATH at ${n} (version: ${o.trim().slice(0,50)})`),!0}}catch{continue}return U.warn("[Cursor] \u274C Cursor Agent CLI not found or not working. Run: agent --version"),!1}async invoke(e,r={}){let{workspace:i=process.cwd(),print:n=!1,schema:o=null,skills:s=null,sessionPath:a=null,nodeName:u=null,timeout:l=Zp.CURSOR_AGENT_DEFAULT,config:c={}}=r,d=c?.agent?.strictMode||!1,p=r.model??c?.agent?.cursor?.model??Tr.CURSOR;U.debug(`[Cursor] Invoking (model: ${p}, timeout: ${l/1e3}s, skills: ${JSON.stringify(s)})`);let m=(this._setupMcpConfig(a,i,c,s,u)||{}).isolatedMcpHome??null,g=[hi(ad(),".local","bin","cursor-agent"),hi(ad(),".cursor","bin","cursor-agent"),"/usr/local/bin/cursor-agent","/usr/local/bin/agent","/Applications/Cursor.app/Contents/Resources/app/bin/cursor","agent","cursor-agent"],v=null;for(let j of g)try{if(j.startsWith("/"))YC(j,QC.X_OK),Fs(`"${j}" --version 2>&1`,{encoding:"utf-8",timeout:3e3,stdio:"pipe"});else{if(!Fs(`which ${j}`,{encoding:"utf-8",timeout:2e3}).trim())throw new Error("not in PATH");Fs(`${j} --version 2>&1`,{encoding:"utf-8",timeout:3e3,stdio:"pipe"})}v=j,U.debug(`[Agent] Using binary: ${j}`);break}catch(I){U.debug(`[Agent] Binary '${j}' check failed: ${I.message}`);continue}if(!v)throw new Error(`Cursor Agent CLI not found or not working.
47
+ Response: ${JSON.stringify(d)}`,{cause:u}):new Error(`Failed to format Cursor output: ${d?.error?.message||"Unknown error"}`,{cause:u})}throw h.error(`\u274C OpenAI proxy request failed: ${u.message}`),new Error(`Failed to format output: ${u.message}`,{cause:u})}}var os=M(()=>{V();oe()});import{copyFileSync as ao,existsSync as Qt,lstatSync as co,mkdirSync as is,rmSync as lo,symlinkSync as uo,unlinkSync as po}from"node:fs";import{join as ne}from"node:path";import{homedir as fo}from"node:os";import{randomBytes as mo}from"node:crypto";function as(i){return!(!i||typeof i!="string"||process.env.ZIBBY_CURSOR_USE_GLOBAL_MCP==="1"||process.env.ZIBBY_CURSOR_USE_GLOBAL_MCP==="true")}function cs(i){let e=ne(i||process.cwd(),".zibby","tmp");is(e,{recursive:!0});let t=`${process.pid}-${Date.now()}-${mo(4).toString("hex")}`,r=ne(e,`cursor-agent-home-${t}`),s=ne(r,".cursor");is(s,{recursive:!0});let n=fo(),o=ne(n,".cursor");if(Qt(o))for(let c of ho){let l=ne(o,c);if(Qt(l))try{ao(l,ne(s,c))}catch{}}if(process.platform==="darwin"){let c=ne(n,"Library");if(Qt(c))try{uo(c,ne(r,"Library"))}catch{}}return r}function ls(i){if(!(!i||typeof i!="string"))try{let e=ne(i,"Library");try{co(e).isSymbolicLink()&&po(e)}catch{}lo(i,{recursive:!0,force:!0})}catch{}}var ho,us=M(()=>{ho=["cli-config.json","config.json","auth.json","argv.json"]});import{spawn as go,execSync as pe}from"node:child_process";import{writeFileSync as ps,readFileSync as fs,mkdirSync as ds,existsSync as He,accessSync as ms,constants as hs,unlinkSync as yo}from"node:fs";import{join as Q,resolve as So}from"node:path";import{homedir as Ve}from"node:os";var xe,gs=M(()=>{ue();V();oe();ee();se();Je();Xt();os();le();us();xe=class extends K{constructor(){super("cursor","Cursor (CLI)",100)}canHandle(e){let t=[Q(Ve(),".local","bin","cursor-agent"),Q(Ve(),".cursor","bin","cursor-agent"),"/usr/local/bin/cursor-agent","/usr/local/bin/agent","/Applications/Cursor.app/Contents/Resources/app/bin/cursor","agent","cursor-agent"];for(let r of t)try{if(r.startsWith("/")){ms(r,hs.X_OK);let s=pe(`"${r}" --version 2>&1`,{encoding:"utf-8",timeout:3e3,stdio:"pipe"});if(s&&s.length>0)return h.debug(`[Cursor] Found agent at: ${r} (version: ${s.trim().slice(0,50)})`),!0}else{let s=pe(`which ${r}`,{encoding:"utf-8",timeout:2e3,stdio:"pipe"}).trim();if(!s)continue;let n=pe(`${r} --version 2>&1`,{encoding:"utf-8",timeout:3e3,stdio:"pipe"});if(n&&n.length>0)return h.debug(`[Cursor] Found '${r}' in PATH at ${s} (version: ${n.trim().slice(0,50)})`),!0}}catch{continue}return h.warn("[Cursor] \u274C Cursor Agent CLI not found or not working. Run: agent --version"),!1}async invoke(e,t={}){let{workspace:r=process.cwd(),print:s=!1,schema:n=null,skills:o=null,sessionPath:c=null,nodeName:l=null,timeout:a=yt.CURSOR_AGENT_DEFAULT,config:u={}}=t,p=u?.agent?.strictMode||!1,d=t.model??u?.agent?.cursor?.model??G.CURSOR;h.debug(`[Cursor] Invoking (model: ${d}, timeout: ${a/1e3}s, skills: ${JSON.stringify(o)})`);let m=(this._setupMcpConfig(c,r,u,o,l)||{}).isolatedMcpHome??null,S=[Q(Ve(),".local","bin","cursor-agent"),Q(Ve(),".cursor","bin","cursor-agent"),"/usr/local/bin/cursor-agent","/usr/local/bin/agent","/Applications/Cursor.app/Contents/Resources/app/bin/cursor","agent","cursor-agent"],g=null;for(let N of S)try{if(N.startsWith("/"))ms(N,hs.X_OK),pe(`"${N}" --version 2>&1`,{encoding:"utf-8",timeout:3e3,stdio:"pipe"});else{if(!pe(`which ${N}`,{encoding:"utf-8",timeout:2e3}).trim())throw new Error("not in PATH");pe(`${N} --version 2>&1`,{encoding:"utf-8",timeout:3e3,stdio:"pipe"})}g=N,h.debug(`[Agent] Using binary: ${N}`);break}catch(b){h.debug(`[Agent] Binary '${N}' check failed: ${b.message}`);continue}if(!g)throw new Error(`Cursor Agent CLI not found or not working.
90
48
 
91
49
  Checked paths:
92
- ${g.map(j=>` - ${j}`).join(`
50
+ ${S.map(N=>` - ${N}`).join(`
93
51
  `)}
94
52
 
95
53
  Install cursor-agent:
@@ -98,178 +56,82 @@ Install cursor-agent:
98
56
  Then add to PATH:
99
57
  echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
100
58
 
101
- Test with: agent --version`);let h=null;if(o){let j=`zibby-result-${Date.now()}.json`;h=hi(i,".zibby","tmp",j);let I=hi(i,".zibby","tmp");sd(I)||JC(I,{recursive:!0});let R=Ka.generateFileOutputInstructions(o,h);e=`${e}
102
-
103
- ${R}`}let y=process.env.CURSOR_API_KEY,_=y?` | key: ***${y.slice(-4)}`:" | key: not set";console.log(`
104
- \u25C6 Model: ${p||"auto"}${_}
105
- `);let b=(await import("chalk")).default;console.log(`
106
- ${b.bold("Prompt sent to LLM:")}`),console.log(b.dim("\u2500".repeat(60))),console.log(b.dim(e)),console.log(b.dim("\u2500".repeat(60)));let w=["--print","--force","--approve-mcps","--output-format","stream-json","--stream-partial-output","--model",p||"auto"];if(process.env.CURSOR_API_KEY&&w.push("--api-key",process.env.CURSOR_API_KEY),w.push(e),U.debug(`[Agent] Prompt: ${e.length} chars, model: ${p||"auto"}`),U.debug(`[Agent] Workspace: ${i}`),process.env.LOG_LEVEL==="debug"||process.env.ZIBBY_LOG_CURSOR_CLI==="1")try{console.log(`\u{1F527} Cursor CLI --model ${p||"auto"} (from .zibby.config.js agent.cursor.model)
107
- `)}catch{}let S,k=null;try{let j=a||(process.env.ZIBBY_SESSION_PATH?String(process.env.ZIBBY_SESSION_PATH).trim():null);S=await this._spawnWithStreaming(v,w,i,l,null,j,m)}catch(j){k=j}let $=S?.stdout||"";if(o){let j=typeof o.parse=="function",I=null,R=!!(h&&sd(h));if(h&&U.info(`[Agent] Result file: ${R?"present":"missing"} at ${h}`),R)try{let O=HC(h,"utf-8").trim();I=JSON.parse(O),U.info(`[Agent] Parsed JSON from result file OK (${O.length} chars) \u2192 object ready for validation`),k&&U.debug("[Agent] Agent exited non-zero but result file was written \u2014 recovering")}catch(O){U.warn(`\u26A0\uFE0F [Agent] Result file exists on disk but is not valid JSON: ${O.message}`)}else if(k)U.warn(`[Agent] Result file missing at ${h} (agent process error \u2014 may still recover if strictMode repairs)`);else throw U.error(`\u274C [Agent] Result file was never created at ${h}`),new Error(`Agent did not write required result file at ${h}`);if(I&&j)try{let O=o.parse(I);return U.info("\u2705 [Agent] Zod validation passed for structured result file"),d&&U.debug("[Agent] strictMode enabled but not needed \u2014 agent wrote valid file"),{raw:$,structured:O}}catch(O){U.warn(`\u26A0\uFE0F [Agent] JSON parsed but Zod rejected it (wrong types/shape): ${O.message?.slice(0,400)}`)}else{if(I)return U.info("\u2705 [Agent] File-based output extracted (no Zod parse fn) \u2014 accepting as structured"),d&&U.debug("[Agent] strictMode enabled but not needed \u2014 agent wrote valid file"),{raw:$,structured:I};R&&U.error("\u274C [Agent] Result file exists but produced no in-memory JSON (parse failed earlier)")}if(d&&!k){let O=S.parsedText,Q=I?JSON.stringify(I):O;U.info(`[Agent] strictMode: calling OpenAI proxy to fix structured output (${Q.length} chars in)`);try{let K=await LC(Q,o);if(j){let Oe=o.parse(K.structured);return U.info("\u2705 [Agent] Proxy output passed Zod validation"),{raw:$,structured:Oe}}return{raw:$,...K}}catch(K){if(U.warn(`\u26A0\uFE0F [Agent] strictMode proxy failed: ${K.message}`),I)return U.warn("[Agent] Using agent's original result file as fallback"),{raw:$,structured:I}}}if(k)throw k;let q=R?I==null?"file existed but JSON.parse failed \u2014 see WARN log above":j?"JSON was valid but Zod validation failed \u2014 see WARN log above":"no structured object after read (unexpected)":"file never appeared (agent may not have run Write tool to the path above)";throw U.error(`\u274C [Agent] No validated structured output: ${q}`),U.error("\u{1F4A1} Tip: Set strictMode=true in .zibby.config.js for OpenAI proxy fallback"),new Error(`Agent did not produce a valid result file at ${h}. Enable strictMode for proxy fallback.`)}if(k)throw k;return this._extractFinalResult($)||S?.parsedText||$}_extractFinalResult(e){if(!e)return null;let r=e.split(`
108
- `),i=null;for(let n of r){let o=n.trim();if(o)try{let s=JSON.parse(o);if(s.type==="assistant"&&s.message?.content){let a=s.message.content;if(Array.isArray(a)){let u=a.filter(l=>l.type==="text"&&l.text).map(l=>l.text).join("");u&&(i=u)}else typeof a=="string"&&a&&(i=a)}}catch{}}return i?.trim()||null}_setupMcpConfig(e,r,i,n=null,o=null){let s=i?.headless,a=hi(ad(),".cursor"),u=hi(a,"mcp.json"),l={};if(sd(u))try{l=JSON.parse(HC(u,"utf-8"))}catch{}let c=l.mcpServers||{},d=i?.paths?.output||Yt,p=hi(r||process.cwd(),d,ci),f=Array.isArray(n)?n.map(v=>Or(v)).filter(Boolean):[...Lp()].map(([,v])=>v),m=new Set;for(let v of f)typeof v.resolve=="function"&&(m.has(v.serverName)||(m.add(v.serverName),this._ensureSkillConfigured(c,v,e,p,o,s)));if(e){let v=Or("browser");v&&typeof v.resolve=="function"&&!m.has(v.serverName)&&this._ensureSkillConfigured(c,v,e,p,"execute_live",s)}if(Object.keys(c).length===0)return U.debug("[MCP] No MCP servers configured - agent will run without tool access"),{isolatedMcpHome:null};let g=`${JSON.stringify({mcpServers:c},null,2)}
109
- `;if(VC(e)){let v=WC(r||process.cwd()),h=hi(v,".cursor","mcp.json");return KC(h,g,"utf8"),U.debug(`[MCP] Isolated cursor-agent HOME (session-scoped mcp.json): ${v} | servers: ${Object.keys(c).join(", ")}`),{isolatedMcpHome:v}}return sd(a)||JC(a,{recursive:!0}),KC(u,g,"utf8"),U.debug(`[MCP] Global ~/.cursor/mcp.json | servers: ${Object.keys(c).join(", ")}`),{isolatedMcpHome:null}}_ensureSkillConfigured(e,r,i,n,o=null,s){let a=r.cursorKey||r.serverName,u=e[a]?a:e[r.serverName]?r.serverName:null;if(u&&i){let c=typeof r.resolve=="function"?r.resolve({sessionPath:i,nodeName:o,headless:s}):null;c?.args?e[u].args=c.args:e[u].args=(e[u].args||[]).map(f=>f.startsWith("--output-dir=")?`--output-dir=${i}`:f);let d=c?.env||{},p=r.sessionEnvKey?{[r.sessionEnvKey]:n}:{};e[u].env={...e[u].env||{},...d,...p},U.debug(`[MCP] Updated ${u} session \u2192 ${i}`);return}if(u)return;let l=r.resolve({sessionPath:i,nodeName:o,headless:s});l&&(e[a]={...l,...r.sessionEnvKey&&{env:{...l.env||{},[r.sessionEnvKey]:n}}},U.debug(`[MCP] Configured ${a}`))}_spawnWithStreaming(e,r,i,n,o=null,s=null,a=null){return new Promise((u,l)=>{let c=Date.now(),d="",p="",f=Date.now(),m=0,g=!1,v=null,h=!1,y=!1,_=null;if(s)try{_=hi(m5(String(s)),jp)}catch{_=null}let b=!1,w=()=>{b||(b=!0,GC(a))},S={...process.env};a&&(S.HOME=a,process.platform==="win32"&&(S.USERPROFILE=a),U.debug(`[Agent] cursor-agent HOME=${a} (isolated MCP config)`));let k=f5(e,r,{cwd:i,shell:!1,stdio:["pipe","pipe","pipe"],env:S});U.debug(`[Agent] PID: ${k.pid}`),k.stdin.on("error",O=>{O.code!=="EPIPE"&&U.warn(`[Agent] stdin error: ${O.message}`)}),k.stdout.on("error",O=>{O.code!=="EPIPE"&&U.warn(`[Agent] stdout error: ${O.message}`)}),k.stderr.on("error",O=>{O.code!=="EPIPE"&&U.warn(`[Agent] stderr error: ${O.message}`)}),o?(k.stdin.write(o,O=>{O&&O.code!=="EPIPE"&&U.warn(`[Agent] Failed to write to stdin: ${O.message}`),k.stdin.end()}),U.debug(`[Agent] Prompt also piped to stdin (${o.length} chars)`)):k.stdin.end();let $=null;_&&($=setInterval(()=>{if(!(g||y))try{if(sd(_)){g=!0,v="studio-stop";try{p5(_)}catch{}U.warn("\u{1F6D1} Studio stop requested \u2014 terminating Cursor agent (and MCP browser session)"),k.kill("SIGTERM"),setTimeout(()=>{k.killed||k.kill("SIGKILL")},2e3)}}catch{}},600));let P=new Set,j=new Date(c).toISOString().replace(/\.\d+Z$/,""),I=setInterval(()=>{let O=Math.round((Date.now()-c)/1e3),Q=Math.round((Date.now()-f)/1e3),K=[];try{let st=Math.ceil(O/60)+1,pe=Fs(`find "${i}" -type f -mmin -${st} -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/target/*' 2>/dev/null | head -20`,{encoding:"utf-8",timeout:5e3}).trim();if(pe)for(let J of pe.split(`
110
- `)){let T=J.replace(`${i}/`,"");P.has(T)||(P.add(T),K.push(T))}}catch{}let Oe="";K.length>0&&(Oe=` | \u{1F4C1} new: ${K.map(pe=>pe.split("/").pop()).join(", ")}`),P.size>0&&(Oe+=` | \u{1F4E6} total: ${P.size} files`),U.debug(`\u{1F493} [Agent] Running for ${O}s | ${m} lines output${Oe}`),m===0&&O>=30&&P.size===0&&(O<35&&U.warn(`\u26A0\uFE0F [Agent] No output after ${O}s \u2014 agent may be stuck. Check your CURSOR_API_KEY.`),O>=60&&(g=!0,v=v||"stall",U.error(`\u274C [Agent] No response after ${O}s \u2014 killing. Verify CURSOR_API_KEY is valid and agent CLI works: agent --version`),k.kill("SIGTERM"),setTimeout(()=>{k.killed||k.kill("SIGKILL")},3e3)))},3e4),R=setTimeout(()=>{g=!0,v=v||"timeout";let O=Math.round((Date.now()-c)/1e3);U.error(`\u23F1\uFE0F [Agent] Timeout after ${O}s \u2014 killing process (PID: ${k.pid})`),d.trim()&&U.warn(`\u{1F4E4} [Agent] Partial output (${d.length} chars) before timeout:
111
- ${d.slice(-2e3)}`),k.kill("SIGTERM"),setTimeout(()=>{k.killed||k.kill("SIGKILL")},5e3)},n),q=new Ri;q.onToolCall=(O,Q)=>{let K=O,Oe=Q;if(O==="mcpToolCall"&&Q?.name)K=Q.name.replace(/^mcp_+[^_]+_+/,""),K.includes("-")&&K.split("-")[0]===K.split("-")[1]&&(K=K.split("-")[0]),Oe=Q.args??Q.input??Q;else{if(O==="readToolCall"||O==="editToolCall"||O==="writeToolCall")return;(O.startsWith("mcp__")||O.includes("ToolCall"))&&(K=O.replace(/^mcp_+[^_]+_+/,"").replace(/ToolCall$/,""))}if(K.includes("memory")?Mt.stepMemory(`Tool: ${K}`):Mt.stepTool(`Tool: ${K}`),Oe!=null&&typeof Oe=="object"&&Object.keys(Oe).length>0&&!y){let pe=JSON.stringify(Oe),J=pe.length>100?`${pe.substring(0,100)}...`:pe;console.log(` Input: ${J}`)}},k.stdout.on("data",O=>{let Q=O.toString();d+=Q,f=Date.now(),h||(h=!0);let K=q.processChunk(Q);K&&!y&&process.stdout.write(K);let Oe=Q.split(`
112
- `).filter(st=>st.trim());m+=Oe.length}),k.stderr.on("data",O=>{let Q=O.toString();p+=Q,f=Date.now(),h||(h=!0);let K=Q.split(`
113
- `).filter(Oe=>Oe.trim());for(let Oe of K)U.warn(`\u26A0\uFE0F [Agent stderr] ${Oe}`)}),k.on("close",(O,Q)=>{y=!0,w(),clearTimeout(R),clearInterval(I),$&&clearInterval($),q.flush();let K=Math.round((Date.now()-c)/1e3);if(U.debug(`[Agent] Exited: code=${O}, signal=${Q}, elapsed=${K}s, output=${d.length} chars`),g){if(v==="studio-stop"){l(new Error("Stopped from Zibby Studio"));return}l(new Error(`Cursor Agent timed out after ${K}s (limit: ${n/1e3}s). ${m} lines produced. Last output ${Math.round((Date.now()-f)/1e3)}s ago. ${d.trim()?`
59
+ Test with: agent --version`);let w=null;if(n){let N=`zibby-result-${Date.now()}.json`;w=Q(r,".zibby","tmp",N);let b=Q(r,".zibby","tmp");He(b)||ds(b,{recursive:!0});let A=_e.generateFileOutputInstructions(n,w);e=`${e}
60
+
61
+ ${A}`}let y=process.env.CURSOR_API_KEY,E=y?` | key: ***${y.slice(-4)}`:" | key: not set";console.log(`
62
+ \u25C6 Model: ${d||"auto"}${E}
63
+ `);let x=(await import("chalk")).default;console.log(`
64
+ ${x.bold("Prompt sent to LLM:")}`),console.log(x.dim("\u2500".repeat(60))),console.log(x.dim(e)),console.log(x.dim("\u2500".repeat(60)));let v=["--print","--force","--approve-mcps","--output-format","stream-json","--stream-partial-output","--model",d||"auto"];if(process.env.CURSOR_API_KEY&&v.push("--api-key",process.env.CURSOR_API_KEY),v.push(e),h.debug(`[Agent] Prompt: ${e.length} chars, model: ${d||"auto"}`),h.debug(`[Agent] Workspace: ${r}`),process.env.LOG_LEVEL==="debug"||process.env.ZIBBY_LOG_CURSOR_CLI==="1")try{console.log(`\u{1F527} Cursor CLI --model ${d||"auto"} (from .zibby.config.js agent.cursor.model)
65
+ `)}catch{}let $,T=null;try{let N=c||(process.env.ZIBBY_SESSION_PATH?String(process.env.ZIBBY_SESSION_PATH).trim():null);$=await this._spawnWithStreaming(g,v,r,a,null,N,m)}catch(N){T=N}let I=$?.stdout||"";if(n){let N=typeof n.parse=="function",b=null,A=!!(w&&He(w));if(w&&h.info(`[Agent] Result file: ${A?"present":"missing"} at ${w}`),A)try{let _=fs(w,"utf-8").trim();b=JSON.parse(_),h.info(`[Agent] Parsed JSON from result file OK (${_.length} chars) \u2192 object ready for validation`),T&&h.debug("[Agent] Agent exited non-zero but result file was written \u2014 recovering")}catch(_){h.warn(`\u26A0\uFE0F [Agent] Result file exists on disk but is not valid JSON: ${_.message}`)}else if(T)h.warn(`[Agent] Result file missing at ${w} (agent process error \u2014 may still recover if strictMode repairs)`);else throw h.error(`\u274C [Agent] Result file was never created at ${w}`),new Error(`Agent did not write required result file at ${w}`);if(b&&N)try{let _=n.parse(b);return h.info("\u2705 [Agent] Zod validation passed for structured result file"),p&&h.debug("[Agent] strictMode enabled but not needed \u2014 agent wrote valid file"),{raw:I,structured:_}}catch(_){let C=_.issues?_.issues.map(R=>` - ${R.path.join(".")}: ${R.message}`).join(`
66
+ `):_.message?.slice(0,400);if(h.error(`\u274C [Agent] Zod validation FAILED - invalid output schema:
67
+ ${C}`),h.error(`\u{1F4C4} [Agent] Invalid JSON written to file:
68
+ ${JSON.stringify(b,null,2).slice(0,500)}`),!p)throw new Error(`Agent output failed schema validation:
69
+ ${C}
70
+
71
+ The agent wrote invalid data that doesn't match the required outputSchema.
72
+ Enable strictMode in .zibby.config.js for automatic repair.`,{cause:_})}else{if(b)return h.info("\u2705 [Agent] File-based output extracted (no Zod parse fn) \u2014 accepting as structured"),p&&h.debug("[Agent] strictMode enabled but not needed \u2014 agent wrote valid file"),{raw:I,structured:b};A&&h.error("\u274C [Agent] Result file exists but produced no in-memory JSON (parse failed earlier)")}if(p&&!T){let _=$.parsedText,C=b?JSON.stringify(b):_;h.info(`[Agent] strictMode: calling OpenAI proxy to fix structured output (${C.length} chars in)`);try{let R=await ns(C,n);if(N){let L=n.parse(R.structured);return h.info("\u2705 [Agent] Proxy output passed Zod validation"),{raw:I,structured:L}}return{raw:I,...R}}catch(R){if(h.warn(`\u26A0\uFE0F [Agent] strictMode proxy failed: ${R.message}`),b)return h.warn("[Agent] Using agent's original result file as fallback"),{raw:I,structured:b}}}if(T)throw T;let O=A?b==null?"file existed but JSON.parse failed \u2014 see WARN log above":N?"JSON was valid but Zod validation failed \u2014 see WARN log above":"no structured object after read (unexpected)":"file never appeared (agent may not have run Write tool to the path above)";throw h.error(`\u274C [Agent] No validated structured output: ${O}`),h.error("\u{1F4A1} Tip: Set strictMode=true in .zibby.config.js for OpenAI proxy fallback"),new Error(`Agent did not produce a valid result file at ${w}. Enable strictMode for proxy fallback.`)}if(T)throw T;return this._extractFinalResult(I)||$?.parsedText||I}_extractFinalResult(e){if(!e)return null;let t=e.split(`
73
+ `),r=null;for(let s of t){let n=s.trim();if(n)try{let o=JSON.parse(n);if(o.type==="assistant"&&o.message?.content){let c=o.message.content;if(Array.isArray(c)){let l=c.filter(a=>a.type==="text"&&a.text).map(a=>a.text).join("");l&&(r=l)}else typeof c=="string"&&c&&(r=c)}}catch{}}return r?.trim()||null}_setupMcpConfig(e,t,r,s=null,n=null){let o=r?.headless,c=Q(Ve(),".cursor"),l=Q(c,"mcp.json"),a={};if(He(l))try{a=JSON.parse(fs(l,"utf-8"))}catch{}let u=a.mcpServers||{},p=r?.paths?.output||B,d=Q(t||process.cwd(),p,q),f=Array.isArray(s)?s.map(g=>z(g)).filter(Boolean):[...St()].map(([,g])=>g),m=new Set;for(let g of f)typeof g.resolve=="function"&&(m.has(g.serverName)||(m.add(g.serverName),this._ensureSkillConfigured(u,g,e,d,n,o)));if(e){let g=z("browser");g&&typeof g.resolve=="function"&&!m.has(g.serverName)&&this._ensureSkillConfigured(u,g,e,d,"execute_live",o)}if(Object.keys(u).length===0)return h.debug("[MCP] No MCP servers configured - agent will run without tool access"),{isolatedMcpHome:null};let S=`${JSON.stringify({mcpServers:u},null,2)}
74
+ `;if(as(e)){let g=cs(t||process.cwd()),w=Q(g,".cursor","mcp.json");return ps(w,S,"utf8"),h.debug(`[MCP] Isolated cursor-agent HOME (session-scoped mcp.json): ${g} | servers: ${Object.keys(u).join(", ")}`),{isolatedMcpHome:g}}return He(c)||ds(c,{recursive:!0}),ps(l,S,"utf8"),h.debug(`[MCP] Global ~/.cursor/mcp.json | servers: ${Object.keys(u).join(", ")}`),{isolatedMcpHome:null}}_ensureSkillConfigured(e,t,r,s,n=null,o){let c=t.cursorKey||t.serverName,l=e[c]?c:e[t.serverName]?t.serverName:null;if(l&&r){let u=typeof t.resolve=="function"?t.resolve({sessionPath:r,nodeName:n,headless:o}):null;u?.args?e[l].args=u.args:e[l].args=(e[l].args||[]).map(f=>f.startsWith("--output-dir=")?`--output-dir=${r}`:f);let p=u?.env||{},d=t.sessionEnvKey?{[t.sessionEnvKey]:s}:{};e[l].env={...e[l].env||{},...p,...d},h.debug(`[MCP] Updated ${l} session \u2192 ${r}`);return}if(l)return;let a=t.resolve({sessionPath:r,nodeName:n,headless:o});a&&(e[c]={...a,...t.sessionEnvKey&&{env:{...a.env||{},[t.sessionEnvKey]:s}}},h.debug(`[MCP] Configured ${c}`))}_spawnWithStreaming(e,t,r,s,n=null,o=null,c=null){return new Promise((l,a)=>{let u=Date.now(),p="",d="",f=Date.now(),m=0,S=!1,g=null,w=!1,y=!1,E=null;if(o)try{E=Q(So(String(o)),ut)}catch{E=null}let x=!1,v=()=>{x||(x=!0,ls(c))},$={...process.env};c&&($.HOME=c,process.platform==="win32"&&($.USERPROFILE=c),h.debug(`[Agent] cursor-agent HOME=${c} (isolated MCP config)`));let T=go(e,t,{cwd:r,shell:!1,stdio:["pipe","pipe","pipe"],env:$});h.debug(`[Agent] PID: ${T.pid}`),T.stdin.on("error",_=>{_.code!=="EPIPE"&&h.warn(`[Agent] stdin error: ${_.message}`)}),T.stdout.on("error",_=>{_.code!=="EPIPE"&&h.warn(`[Agent] stdout error: ${_.message}`)}),T.stderr.on("error",_=>{_.code!=="EPIPE"&&h.warn(`[Agent] stderr error: ${_.message}`)}),n?(T.stdin.write(n,_=>{_&&_.code!=="EPIPE"&&h.warn(`[Agent] Failed to write to stdin: ${_.message}`),T.stdin.end()}),h.debug(`[Agent] Prompt also piped to stdin (${n.length} chars)`)):T.stdin.end();let I=null;E&&(I=setInterval(()=>{if(!(S||y))try{if(He(E)){S=!0,g="studio-stop";try{yo(E)}catch{}h.warn("\u{1F6D1} Studio stop requested \u2014 terminating Cursor agent (and MCP browser session)"),T.kill("SIGTERM"),setTimeout(()=>{T.killed||T.kill("SIGKILL")},2e3)}}catch{}},600));let P=new Set,N=new Date(u).toISOString().replace(/\.\d+Z$/,""),b=setInterval(()=>{let _=Math.round((Date.now()-u)/1e3),C=Math.round((Date.now()-f)/1e3),R=[];try{let U=Math.ceil(_/60)+1,k=pe(`find "${r}" -type f -mmin -${U} -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/target/*' 2>/dev/null | head -20`,{encoding:"utf-8",timeout:5e3}).trim();if(k)for(let W of k.split(`
75
+ `)){let F=W.replace(`${r}/`,"");P.has(F)||(P.add(F),R.push(F))}}catch{}let L="";R.length>0&&(L=` | \u{1F4C1} new: ${R.map(k=>k.split("/").pop()).join(", ")}`),P.size>0&&(L+=` | \u{1F4E6} total: ${P.size} files`),h.debug(`\u{1F493} [Agent] Running for ${_}s | ${m} lines output${L}`),m===0&&_>=30&&P.size===0&&(_<35&&h.warn(`\u26A0\uFE0F [Agent] No output after ${_}s \u2014 agent may be stuck. Check your CURSOR_API_KEY.`),_>=60&&(S=!0,g=g||"stall",h.error(`\u274C [Agent] No response after ${_}s \u2014 killing. Verify CURSOR_API_KEY is valid and agent CLI works: agent --version`),T.kill("SIGTERM"),setTimeout(()=>{T.killed||T.kill("SIGKILL")},3e3)))},3e4),A=setTimeout(()=>{S=!0,g=g||"timeout";let _=Math.round((Date.now()-u)/1e3);h.error(`\u23F1\uFE0F [Agent] Timeout after ${_}s \u2014 killing process (PID: ${T.pid})`),p.trim()&&h.warn(`\u{1F4E4} [Agent] Partial output (${p.length} chars) before timeout:
76
+ ${p.slice(-2e3)}`),T.kill("SIGTERM"),setTimeout(()=>{T.killed||T.kill("SIGKILL")},5e3)},s),O=new te;O.onToolCall=(_,C)=>{let R=_,L=C;if(_==="mcpToolCall"&&C?.name)R=C.name.replace(/^mcp_+[^_]+_+/,""),R.includes("-")&&R.split("-")[0]===R.split("-")[1]&&(R=R.split("-")[0]),L=C.args??C.input??C;else{if(_==="readToolCall"||_==="editToolCall"||_==="writeToolCall")return;(_.startsWith("mcp__")||_.includes("ToolCall"))&&(R=_.replace(/^mcp_+[^_]+_+/,"").replace(/ToolCall$/,""))}if(R.includes("memory")?D.stepMemory(`Tool: ${R}`):D.stepTool(`Tool: ${R}`),L!=null&&typeof L=="object"&&Object.keys(L).length>0&&!y){let k=JSON.stringify(L),W=k.length>100?`${k.substring(0,100)}...`:k;console.log(` Input: ${W}`)}},T.stdout.on("data",_=>{let C=_.toString();p+=C,f=Date.now(),w||(w=!0);let R=O.processChunk(C);R&&!y&&process.stdout.write(R);let L=C.split(`
77
+ `).filter(U=>U.trim());m+=L.length}),T.stderr.on("data",_=>{let C=_.toString();d+=C,f=Date.now(),w||(w=!0);let R=C.split(`
78
+ `).filter(L=>L.trim());for(let L of R)h.warn(`\u26A0\uFE0F [Agent stderr] ${L}`)}),T.on("close",(_,C)=>{y=!0,v(),clearTimeout(A),clearInterval(b),I&&clearInterval(I),O.flush();let R=Math.round((Date.now()-u)/1e3);if(h.debug(`[Agent] Exited: code=${_}, signal=${C}, elapsed=${R}s, output=${p.length} chars`),S){if(g==="studio-stop"){a(new Error("Stopped from Zibby Studio"));return}a(new Error(`Cursor Agent timed out after ${R}s (limit: ${s/1e3}s). ${m} lines produced. Last output ${Math.round((Date.now()-f)/1e3)}s ago. ${p.trim()?`
114
79
  Partial output (last 500 chars):
115
- ${d.slice(-500)}`:"No output captured."}`));return}if(O!==0){l(new Error(`Cursor Agent failed: exit code ${O}, signal ${Q}. ${p.trim()?`
116
- Stderr: ${p.slice(-1e3)}`:""}${d.trim()?`
117
- Stdout (last 500 chars): ${d.slice(-500)}`:""}`));return}let Oe=q.getResult(),st=Oe?JSON.stringify(Oe,null,2):q.getRawText()||d||"";u({stdout:d||p||"",parsedText:st})}),k.on("error",O=>{w(),clearTimeout(R),clearInterval(I),$&&clearInterval($),l(new Error(`Cursor Agent spawn error: ${O.message}
80
+ ${p.slice(-500)}`:"No output captured."}`));return}if(_!==0){a(new Error(`Cursor Agent failed: exit code ${_}, signal ${C}. ${d.trim()?`
81
+ Stderr: ${d.slice(-1e3)}`:""}${p.trim()?`
82
+ Stdout (last 500 chars): ${p.slice(-500)}`:""}`));return}let L=O.getResult(),U=L?JSON.stringify(L,null,2):O.getRawText()||p||"";l({stdout:p||d||"",parsedText:U})}),T.on("error",_=>{v(),clearTimeout(A),clearInterval(b),I&&clearInterval(I),a(new Error(`Cursor Agent spawn error: ${_.message}
118
83
  Binary: ${e}
119
84
  This usually means the binary is not in PATH. Try:
120
- echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc`))})})}}});import{execFile as QJ}from"child_process";import{randomUUID as XJ}from"crypto";import{createReadStream as PIe,realpathSync as eY}from"fs";import{copyFile as tY,mkdir as Zk,readdir as OIe,readFile as rY,rm as nY,writeFile as TA}from"fs/promises";import{createRequire as iY}from"module";import{homedir as tx,tmpdir as oY}from"os";import{dirname as tR,isAbsolute as OA,join as gi,relative as sY,resolve as Rh,sep as zA}from"path";import{fileURLToPath as aY}from"url";import{setMaxListeners as uY}from"events";import{spawn as dY}from"child_process";import{createInterface as fY}from"readline";import{homedir as Y3}from"os";import{join as Q3}from"path";import{randomUUID as q8}from"crypto";import{appendFile as F8,mkdir as V8}from"fs/promises";import{join as NR}from"path";import{realpathSync as jR}from"fs";import{cwd as G8}from"process";import{randomUUID as px}from"crypto";import{appendFile as CR,mkdir as X8,symlink as e7,unlink as t7}from"fs/promises";import{dirname as uD,join as Kx}from"path";import*as Ue from"fs";import{mkdir as l7,open as c7,readdir as d7,readFile as AR,rename as f7,rmdir as p7,rm as m7,stat as h7,unlink as g7}from"fs/promises";import{fileURLToPath as tEe}from"url";import{readFile as nEe}from"fs/promises";import{once as MR}from"events";import{createWriteStream as L7}from"fs";import{open as aEe,readdir as uEe,realpath as lEe,stat as cEe}from"fs/promises";import{join as fEe}from"path";import{execFile as q7}from"child_process";import{promisify as F7}from"util";import{readdir as bEe,stat as wEe}from"fs/promises";import{basename as kEe,join as xEe}from"path";import{constants as IEe}from"fs";import{open as PEe,readdir as TEe,rm as OEe,stat as zEe}from"fs/promises";import{join as jEe}from"path";import{randomUUID as REe}from"crypto";import{readdir as DEe,readFile as UEe}from"fs/promises";import{join as ZEe}from"path";import{readdir as qEe,readFile as FEe}from"fs/promises";import{join as WEe}from"path";import{createHash as J7}from"crypto";import{userInfo as Y7}from"os";function _5(t){return this[t]}function k5(t,e){this[t]=S5.bind(null,e)}function NA(t=lY){let e=new AbortController;return uY(t,e.signal),e}function jA(t,e,r){return new Promise((i,n)=>{if(e?.aborted){r?.throwOnAbort||r?.abortError?n(r.abortError?.()??Error("aborted")):i();return}let o=setTimeout((a,u,l)=>{a?.removeEventListener("abort",u),l()},t,e,s,i);function s(){clearTimeout(o),r?.throwOnAbort||r?.abortError?n(r.abortError?.()??Error("aborted")):i()}e?.addEventListener("abort",s,{once:!0}),r?.unref&&o.unref()})}function cY(t,e){t(Error(e))}function Td(t,e,r){let i,n=new Promise((o,s)=>{i=setTimeout(cY,e,s,r),typeof i=="object"&&i.unref?.()});return Promise.race([t,n]).finally(()=>{i!==void 0&&clearTimeout(i)})}function CA(){return process.versions.bun!==void 0}function wu(t){if(!t)return!1;if(typeof t=="boolean")return t;let e=String(t).toLowerCase().trim();return["1","true","yes","on"].includes(e)}function Ux(){let t=new Set;return{subscribe(e){return t.add(e),()=>{t.delete(e)}},emit(...e){let r;for(let i of t)try{i(...e)}catch(n){(r??=[]).push(n)}if(r)throw r.length===1?r[0]:AggregateError(r,"Signal listener(s) threw")},clear(){t.clear()}}}function bY(t){var e=vY.call(t,ud),r=t[ud];try{t[ud]=void 0;var i=!0}catch{}var n=_Y.call(t);return i&&(e?t[ud]=r:delete t[ud]),n}function xY(t){return kY.call(t)}function PY(t){return t==null?t===void 0?EY:IY:rR&&rR in Object(t)?wY(t):$Y(t)}function OY(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function RY(t){if(!AA(t))return!1;var e=TY(t);return e==NY||e==jY||e==zY||e==CY}function UY(t){return!!nR&&nR in t}function qY(t){if(t!=null){try{return LY.call(t)}catch{}try{return t+""}catch{}}return""}function YY(t){if(!AA(t)||MY(t))return!1;var e=AY(t)?JY:WY;return e.test(FY(t))}function XY(t,e){return t?.[e]}function t3(t,e){var r=e3(t,e);return QY(r)?r:void 0}function n3(){this.__data__=zd?zd(null):{},this.size=0}function o3(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function c3(t){var e=this.__data__;if(zd){var r=e[t];return r===a3?void 0:r}return l3.call(e,t)?e[t]:void 0}function m3(t){var e=this.__data__;return zd?e[t]!==void 0:p3.call(e,t)}function y3(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=zd&&e===void 0?g3:e,this}function Wu(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function _3(){this.__data__=[],this.size=0}function w3(t,e){return t===e||t!==t&&e!==e}function k3(t,e){for(var r=t.length;r--;)if(S3(t[r][0],e))return r;return-1}function I3(t){var e=this.__data__,r=Og(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():$3.call(e,r,1),--this.size,!0}function P3(t){var e=this.__data__,r=Og(e,t);return r<0?void 0:e[r][1]}function O3(t){return Og(this.__data__,t)>-1}function N3(t,e){var r=this.__data__,i=Og(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}function Gu(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function D3(){this.size=0,this.__data__={hash:new iR,map:new(A3||C3),string:new iR}}function M3(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function L3(t,e){var r=t.__data__;return Z3(e)?r[typeof e=="string"?"string":"hash"]:r.map}function q3(t){var e=zg(this,t).delete(t);return this.size-=e?1:0,e}function V3(t){return zg(this,t).get(t)}function G3(t){return zg(this,t).has(t)}function K3(t,e){var r=zg(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}function Bu(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function Zx(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw TypeError(J3);var r=function(){var i=arguments,n=e?e.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=t.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(Zx.Cache||UA),r}function ce(t,e,r,i,n){if(i==="m")throw TypeError("Private method is not writable");if(i==="a"&&!n)throw TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function M(t,e,r,i){if(r==="a"&&!i)throw TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)}function Nd(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}function ix(t){return typeof t!="object"?{}:t??{}}function sR(t){if(!t)return!0;for(let e in t)return!1;return!0}function t8(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function o8(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}function a8(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let i=r.exec(navigator.userAgent);if(i){let n=i[1]||0,o=i[2]||0,s=i[3]||0;return{browser:e,version:`${n}.${o}.${s}`}}}return null}function l8(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function LA(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function qA(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return LA({start(){},async pull(r){let{done:i,value:n}=await e.next();i?r.close():r.enqueue(n)},async cancel(){await e.return?.()}})}function qx(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function c8(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}function f8(t){return Object.entries(t).filter(([e,r])=>typeof r<"u").map(([e,r])=>{if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")return`${encodeURIComponent(e)}=${encodeURIComponent(r)}`;if(r===null)return`${encodeURIComponent(e)}=`;throw new je(`Cannot stringify type ${typeof r}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}function p8(t){let e=0;for(let n of t)e+=n.length;let r=new Uint8Array(e),i=0;for(let n of t)r.set(n,i),i+=n.length;return r}function Fx(t){let e;return(cR??(e=new globalThis.TextEncoder,cR=e.encode.bind(e)))(t)}function fR(t){let e;return(dR??(e=new globalThis.TextDecoder,dR=e.decode.bind(e)))(t)}function m8(t,e){for(let r=e??0;r<t.length;r++){if(t[r]===10)return{preceding:r,index:r+1,carriage:!1};if(t[r]===13)return{preceding:r,index:r+1,carriage:!0}}return null}function h8(t){for(let e=0;e<t.length-1;e++){if(t[e]===10&&t[e+1]===10||t[e]===13&&t[e+1]===13)return e+2;if(t[e]===13&&t[e+1]===10&&e+3<t.length&&t[e+2]===13&&t[e+3]===10)return e+4}return-1}function $d(){}function ch(t,e,r){return!e||Gh[t]>Gh[r]?$d:e[t].bind(e)}function Yr(t){let e=t.logger,r=t.logLevel??"off";if(!e)return g8;let i=mR.get(e);if(i&&i[0]===r)return i[1];let n={error:ch("error",e,r),warn:ch("warn",e,r),info:ch("info",e,r),debug:ch("debug",e,r)};return mR.set(e,[r,n]),n}async function*y8(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new je("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new je("Attempted to iterate over a response with no body");let r=new ox,i=new Js,n=qx(t.body);for await(let o of v8(n))for(let s of i.decode(o)){let a=r.decode(s);a&&(yield a)}for(let o of i.flush()){let s=r.decode(o);s&&(yield s)}}async function*v8(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let i=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?Fx(r):r,n=new Uint8Array(e.length+i.length);n.set(e),n.set(i,e.length),e=n;let o;for(;(o=h8(e))!==-1;)yield e.slice(0,o),e=e.slice(o)}e.length>0&&(yield e)}function _8(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function FA(t,e){let{response:r,requestLogID:i,retryOfRequestLogID:n,startTime:o}=e,s=await(async()=>{if(e.options.stream)return Yr(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller):Ys.fromSSEResponse(r,e.controller);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let a=r.headers.get("content-type")?.split(";")[0]?.trim();if(a?.includes("application/json")||a?.endsWith("+json")){if(r.headers.get("content-length")==="0")return;let u=await r.json();return VA(u,r)}return await r.text()})();return Yr(t).debug(`[${i}] response parsed`,Bs({retryOfRequestLogID:n,url:r.url,status:r.status,body:s,durationMs:Date.now()-o})),s}function VA(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("request-id"),enumerable:!1})}function Su(t,e,r){return WA(),new File(t,e??"unknown_file",r)}function Th(t,e){let r=typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"";return e?r.split(/[\\/]/).pop()||void 0:r}function b8(t){let e=typeof t=="function"?t:t.fetch,r=hR.get(e);if(r)return r;let i=(async()=>{try{let n="Response"in e?e.Response:(await e("data:,")).constructor,o=new FormData;return o.toString()!==await new n(o).text()}catch{return!0}})();return hR.set(e,i),i}async function $8(t,e,r){if(WA(),t=await t,e||(e=Th(t,!0)),k8(t))return t instanceof File&&e==null&&r==null?t:Su([await t.arrayBuffer()],e??t.name,{type:t.type,lastModified:t.lastModified,...r});if(x8(t)){let n=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),Su(await ux(n),e,r)}let i=await ux(t);if(!r?.type){let n=i.find(o=>typeof o=="object"&&"type"in o&&o.type);typeof n=="string"&&(r={...r,type:n})}return Su(i,e,r)}async function ux(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(BA(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(GA(t))for await(let r of t)e.push(...await ux(r));else{let r=t?.constructor?.name;throw Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${I8(t)}`)}return e}function I8(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(e=>`"${e}"`).join(", ")}]`}function*E8(t){if(!t)return;if(KA in t){let{values:i,nulls:n}=t;yield*i.entries();for(let o of n)yield[o,null];return}let e=!1,r;t instanceof Headers?r=t.entries():oR(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let i of r){let n=i[0];if(typeof n!="string")throw TypeError("expected header name to be a string");let o=oR(i[1])?i[1]:[i[1]],s=!1;for(let a of o)a!==void 0&&(e&&!s&&(s=!0,yield[n,null]),yield[n,a])}}function Oh(t){return typeof t=="object"&&t!==null&&Od in t}function HA(t,e){let r=new Set;if(t)for(let i of t)Oh(i)&&r.add(i[Od]);if(e){for(let i of e)if(Oh(i)&&r.add(i[Od]),Array.isArray(i.content))for(let n of i.content)Oh(n)&&r.add(n[Od])}return Array.from(r)}function JA(t,e){let r=HA(t,e);return r.length===0?{}:{"x-stainless-helper":r.join(", ")}}function P8(t){return Oh(t)?{"x-stainless-helper":t[Od]}:{}}function YA(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}function XA(t){return t?.output_format??t?.output_config?.format}function yR(t,e,r){let i=XA(e);return!e||!("parse"in(i??{}))?{...t,content:t.content.map(n=>{if(n.type==="text"){let o=Object.defineProperty({...n},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(o,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return n}),parsed_output:null}:eD(t,e,r)}function eD(t,e,r){let i=null,n=t.content.map(o=>{if(o.type==="text"){let s=O8(e,o.text);i===null&&(i=s);let a=Object.defineProperty({...o},"parsed_output",{value:s,enumerable:!1});return Object.defineProperty(a,"parsed",{get(){return r.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),s},enumerable:!1})}return o});return{...t,content:n,parsed_output:i}}function O8(t,e){let r=XA(t);if(r?.type!=="json_schema")return null;try{return"parse"in r?r.parse(e):JSON.parse(e)}catch(i){throw new je(`Failed to parse structured output: ${i}`)}}function wR(t){return t.type==="tool_use"||t.type==="server_tool_use"||t.type==="mcp_tool_use"}function kR(){let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}}async function A8(t,e=t.messages.at(-1)){if(!e||e.role!=="assistant"||!e.content||typeof e.content=="string")return null;let r=e.content.filter(i=>i.type==="tool_use");return r.length===0?null:{role:"user",content:await Promise.all(r.map(async i=>{let n=t.tools.find(o=>("name"in o?o.name:o.mcp_server_name)===i.name);if(!n||!("run"in n))return{type:"tool_result",tool_use_id:i.id,content:`Error: Tool '${i.name}' not found`,is_error:!0};try{let o=i.input;"parse"in n&&n.parse&&(o=n.parse(o));let s=await n.run(o);return{type:"tool_result",tool_use_id:i.id,content:s}}catch(o){return{type:"tool_result",tool_use_id:i.id,content:o instanceof Qh?o.content:`Error: ${o instanceof Error?o.message:String(o)}`,is_error:!0}}}))}}function $R(t){if(!t.output_format)return t;if(t.output_config?.format)throw new je("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:e,...r}=t;return{...r,output_config:{...t.output_config,format:e}}}function rD(t){return t?.output_config?.format}function IR(t,e,r){let i=rD(e);return!e||!("parse"in(i??{}))?{...t,content:t.content.map(n=>n.type==="text"?Object.defineProperty({...n},"parsed_output",{value:null,enumerable:!1}):n),parsed_output:null}:nD(t,e,r)}function nD(t,e,r){let i=null,n=t.content.map(o=>{if(o.type==="text"){let s=U8(e,o.text);return i===null&&(i=s),Object.defineProperty({...o},"parsed_output",{value:s,enumerable:!1})}return o});return{...t,content:n,parsed_output:i}}function U8(t,e){let r=rD(t);if(r?.type!=="json_schema")return null;try{return"parse"in r?r.parse(e):JSON.parse(e)}catch(i){throw new je(`Failed to parse structured output: ${i}`)}}function OR(t){return t.type==="tool_use"||t.type==="server_tool_use"}function Gx(t){return t instanceof Error?t:Error(String(t))}function Nh(t){return t instanceof Error?t.message:String(t)}function ku(t){if(t&&typeof t=="object"&&"code"in t&&typeof t.code=="string")return t.code}function Bx(t){return ku(t)==="ENOENT"}function oD(t){return ku(t)==="EISDIR"}function sD(){if(hu)return hu;if(!wu(process.env.DEBUG_CLAUDE_AGENT_SDK))return Hs=null,hu=Promise.resolve(),hu;let t=NR(Lx(),"debug");return Hs=NR(t,`sdk-${q8()}.txt`),process.stderr.write(`SDK debug logs: ${Hs}
121
- `),hu=V8(t,{recursive:!0}).then(()=>{}).catch(()=>{}),hu}function W8(){return sD(),Hs??null}function Li(t){if(Hs===null)return;let e=`${new Date().toISOString()} ${t}
122
- `;sD().then(()=>{Hs&&F8(Hs,e).catch(()=>{})})}function K8(){let t="";if(typeof process<"u"&&typeof process.cwd=="function"&&typeof jR=="function"){let e=G8();try{t=jR(e).normalize("NFC")}catch{t=e.normalize("NFC")}}return{originalCwd:t,projectRoot:t,totalCostUSD:0,totalAPIDuration:0,totalAPIDurationWithoutRetries:0,totalToolDuration:0,startTime:Date.now(),lastInteractionTime:Date.now(),totalLinesAdded:0,totalLinesRemoved:0,hasUnknownModelCost:!1,cwd:t,modelUsage:{},mainLoopModelOverride:void 0,initialMainLoopModel:null,modelStrings:null,isInteractive:!1,hasStreamingInput:!1,kairosActive:!1,strictToolResultPairing:!1,memoryToggledOff:!1,teamMemoryServerStatus:void 0,sdkAgentProgressSummariesEnabled:!1,userMsgOptIn:!1,clientType:"cli",sessionSource:void 0,sessionStartType:"fresh",questionPreviewFormat:void 0,sessionIngressToken:void 0,oauthTokenFromFd:void 0,apiKeyFromFd:void 0,flagSettingsPath:void 0,flagSettingsInline:null,parentManagedSettings:null,allowedSettingSources:["userSettings","projectSettings","localSettings","flagSettings","policySettings"],meter:null,sessionCounter:null,locCounter:null,prCounter:null,commitCounter:null,costCounter:null,tokenCounter:null,codeEditToolDecisionCounter:null,activeTimeCounter:null,statsStore:null,sessionId:px(),parentSessionId:void 0,loggerProvider:null,eventLogger:null,meterProvider:null,tracerProvider:null,agentColorMap:new Map,agentColorIndex:0,lastAPIRequest:null,lastAPIRequestMessages:null,lastClassifierRequests:null,cachedClaudeMdContent:null,inMemoryErrorLog:[],inlinePlugins:[],chromeFlagOverride:void 0,useCoworkPlugins:!1,sessionBypassPermissionsMode:!1,scheduledTasksEnabled:!1,sessionCronTasks:[],loopChainStartedAt:Object.create(null),sessionCreatedTeams:new Set,sessionTrustAccepted:!1,sessionPersistenceDisabled:!1,hasExitedPlanMode:!1,needsPlanModeExitAttachment:!1,needsAutoModeExitAttachment:!1,lspRecommendationShownThisSession:!1,initJsonSchema:null,registeredHooks:null,planSlugCache:new Map,teleportedSessionInfo:null,invokedSkills:new Map,slowOperations:[],sdkBetas:void 0,sdkOAuthTokenRefreshCallback:null,mainThreadAgentType:void 0,mainThreadAgentHooks:void 0,sessionSkillAllowlist:void 0,caps:B8,replBridgeActive:!1,directConnectServerUrl:void 0,activeRoutine:void 0,systemPromptSectionCache:new Map,lastEmittedDate:null,additionalDirectoriesForClaudeMd:[],allowedChannels:[],activeInputs:new Map,hasDevChannels:!1,sessionProjectDir:null,promptCache1hAllowlist:null,afkModeHeaderLatched:null,fastModeHeaderLatched:null,cacheEditingHeaderLatched:null,cacheDiagnosisHeaderLatched:null,promptId:null,promptIndex:0,lastMainRequestId:void 0,lastApiCompletionTimestamp:null,pendingPostCompaction:!1}}function aD(){return H8.sessionId}function r7({writeFn:t,flushIntervalMs:e=1e3,maxBufferSize:r=100,maxBufferBytes:i=1/0,immediateMode:n=!1}){let o=[],s=0,a=null,u=null;function l(){a&&(clearTimeout(a),a=null)}function c(){u&&(t(u.join("")),u=null),o.length!==0&&(t(o.join("")),o=[],s=0,l())}function d(){a||(a=setTimeout(c,e))}function p(){if(u){u.push(...o),o=[],s=0,l();return}let f=o;o=[],s=0,l(),u=f,setImmediate(()=>{let m=u;u=null,m&&t(m.join(""))})}return{write(f){if(n){t(f);return}o.push(f),s+=f.length,d(),(o.length>=r||s>=i)&&p()},flush:c,dispose(){c()}}}function n7(t){return typeof t=="function"?t:Symbol.asyncDispose in t?()=>t[Symbol.asyncDispose]():()=>t[Symbol.dispose]()}function i7(t){let e=n7(t);return RR.add(e),()=>RR.delete(e)}function s7(t){let e=[],r=t.match(/^MCP server ["']([^"']+)["']/);if(r&&r[1])e.push("mcp"),e.push(r[1].toLowerCase());else{let o=t.match(/^([^:[]+):/);o&&o[1]&&e.push(o[1].trim().toLowerCase())}let i=t.match(/^\[([^\]]+)]/);i&&i[1]&&e.push(i[1].trim().toLowerCase()),t.toLowerCase().includes("1p event:")&&e.push("1p");let n=t.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(n&&n[1]){let o=n[1].trim().toLowerCase();o.length<30&&!o.includes(" ")&&e.push(o)}return Array.from(new Set(e))}function a7(t,e){return e?t.length===0?!1:e.isExclusive?!t.some(r=>e.exclude.includes(r)):t.some(r=>e.include.includes(r)):!0}function u7(t,e){if(!e)return!0;let r=s7(t);return a7(r,e)}function Yk(){return v7}function _7(t,e){t.destroyed||t.write(e)}function b7(t){_7(process.stderr,t)}function Ng(){return typeof process<"u"&&Array.isArray(process.argv)?process.argv:[]}function x7(t){if(!hx()||typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let e=k7();return u7(t,e)}function dD(t){return gx=Kx(t,`${aD()}.txt`),gx}async function I7(t,e,r,i){t&&await X8(e,{recursive:!0}).catch(()=>{});try{await CR(r,i)}catch(n){if(!oD(n))throw n;await CR(dD(r),i)}pD()}function E7(){}function P7(){if(!Ih){let t=null;Ih=r7({writeFn:e=>{let r=fD(),i=uD(r),n=t!==i;if(t=i,hx()){if(n)try{Yk().mkdirSync(i)}catch{}try{Yk().appendFileSync(r,e)}catch(o){if(!oD(o))throw o;Yk().appendFileSync(dD(r),e)}pD();return}Qk=Qk.then(I7.bind(null,n,i,r,e)).catch(E7)},flushIntervalMs:1e3,maxBufferSize:100,immediateMode:hx()}),i7(async()=>{Ih?.dispose(),await Qk})}return Ih}function Cr(t,{level:e}={level:"debug"}){if(mx[e]<mx[w7()]||!x7(t))return;$7&&t.includes(`
123
- `)&&(t=Qr(t));let r=`${new Date().toISOString()} [${e.toUpperCase()}] ${t.trim()}
124
- `;if(lD()){b7(r);return}P7().write(r)}function fD(){return cD()??gx??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??Kx(Lx(),"debug",`${aD()}.txt`)}function O7(){return T7}function Qr(t,e,r){let i=[];try{let s=Qt(i,er`JSON.stringify(${t})`,0);return JSON.stringify(t,e,r)}catch(s){var n=s,o=1}finally{Xt(i,n,o)}}function z7(t){let e=t.trim();return e.startsWith("{")&&e.endsWith("}")}function N7(t,e){let r={...t};if(e){let i=e.enabled===!0&&e.failIfUnavailable===void 0?{...e,failIfUnavailable:!0}:e,n=r.settings;if(n&&!z7(n))throw Error("Cannot use both a settings file path and the sandbox option. Include the sandbox configuration in your settings file instead.");let o={sandbox:i};if(n)try{o={...Hx(n),sandbox:i}}catch{}r.settings=Qr(o)}return r}function C7(){for(let t of sg)t.killed||t.kill("SIGTERM")}function R7(t){sg.add(t),!DR&&(DR=!0,process.on("exit",C7))}function A7(t){return![".js",".mjs",".tsx",".ts",".jsx"].some(e=>t.endsWith(e))}function D7(t,e=process.platform,r=process.arch){let i=e==="win32"?".exe":"",n=(e==="linux"?[`@anthropic-ai/claude-agent-sdk-linux-${r}-musl`,`@anthropic-ai/claude-agent-sdk-linux-${r}`]:[`@anthropic-ai/claude-agent-sdk-${e}-${r}`]).map(o=>`${o}/claude${i}`);for(let o of n)try{return t(o)}catch{}return null}function V7(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r)|0;return e}function G7(t){return typeof t!="string"?null:W7.test(t)?t:null}async function ZR(t,e){let r=L7(t,{mode:384});try{for(let i of e)r.write(JSON.stringify(i)+`
125
- `)||await MR(r,"drain");r.end(),await MR(r,"finish")}catch(i){throw r.destroy(),i}}function B7(t){return Math.abs(V7(t)).toString(36)}function K7(t){let e=t.replace(/[^a-zA-Z0-9]/g,"-");return e.length<=LR?e:`${e.slice(0,LR)}-${B7(t)}`}function Q7(t){return[...new Set(t)]}function X7(){return"prod"}function oQ(){let t=process.env.CLAUDE_LOCAL_OAUTH_API_BASE?.replace(/\/$/,"")??"http://localhost:8000",e=process.env.CLAUDE_LOCAL_OAUTH_APPS_BASE?.replace(/\/$/,"")??"http://localhost:4000",r=process.env.CLAUDE_LOCAL_OAUTH_CONSOLE_BASE?.replace(/\/$/,"")??"http://localhost:3000";return{BASE_API_URL:t,CONSOLE_AUTHORIZE_URL:`${r}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${e}/oauth/authorize`,CLAUDE_AI_ORIGIN:e,TOKEN_URL:`${t}/v1/oauth/token`,API_KEY_URL:`${t}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${t}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${r}/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code`,CLAUDEAI_SUCCESS_URL:`${r}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${r}/oauth/code/callback`,CLIENT_ID:"22422756-60c9-4084-8eb7-27705fd5cf9a",OAUTH_FILE_SUFFIX:"-local-oauth",MCP_PROXY_URL:"http://localhost:8205",MCP_PROXY_PATH:"/v1/toolbox/shttp/mcp/{server_id}"}}function aQ(){let t=(()=>{switch(X7()){case"local":return oQ();case"staging":return iQ??qR;case"prod":return qR}})(),e=process.env.CLAUDE_CODE_CUSTOM_OAUTH_URL;if(e){let i=e.replace(/\/$/,"");if(!sQ.includes(i))throw Error("CLAUDE_CODE_CUSTOM_OAUTH_URL is not an approved endpoint.");t={...t,BASE_API_URL:i,CONSOLE_AUTHORIZE_URL:`${i}/oauth/authorize`,CLAUDE_AI_AUTHORIZE_URL:`${i}/oauth/authorize`,CLAUDE_AI_ORIGIN:i,TOKEN_URL:`${i}/v1/oauth/token`,API_KEY_URL:`${i}/api/oauth/claude_cli/create_api_key`,ROLES_URL:`${i}/api/oauth/claude_cli/roles`,CONSOLE_SUCCESS_URL:`${i}/oauth/code/success?app=claude-code`,CLAUDEAI_SUCCESS_URL:`${i}/oauth/code/success?app=claude-code`,MANUAL_REDIRECT_URL:`${i}/oauth/code/callback`,OAUTH_FILE_SUFFIX:"-custom-oauth"}}let r=process.env.CLAUDE_CODE_OAUTH_CLIENT_ID;return r&&(t={...t,CLIENT_ID:r}),t}function lQ(t=""){let e=Lx(),r=process.env.CLAUDE_CONFIG_DIR?`-${J7("sha256").update(e).digest("hex").substring(0,8)}`:"";return`Claude Code${aQ().OAUTH_FILE_SUFFIX}${t}${r}`}function cQ(){try{return process.env.USER||Y7().username}catch{return"claude-code-user"}}function Sx(){return fQ}function ae(t,e){let r=Sx(),i=kx({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Rd?void 0:Rd].filter(n=>!!n)});t.common.issues.push(i)}function Le(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:i,description:n}=t;if(e&&(r||i))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(o,s)=>{let{message:a}=t;return o.code==="invalid_enum_value"?{message:a??s.defaultError}:typeof s.data>"u"?{message:a??i??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:a??r??s.defaultError}},description:n}}function gD(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function TQ(t){return new RegExp(`^${gD(t)}$`)}function OQ(t){let e=`${hD}T${gD(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function zQ(t,e){return!!((e==="v4"||!e)&&SQ.test(t)||(e==="v6"||!e)&&xQ.test(t))}function NQ(t,e){if(!vQ.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function jQ(t,e){return!!((e==="v4"||!e)&&kQ.test(t)||(e==="v6"||!e)&&$Q.test(t))}function CQ(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return o%s/10**n}function vu(t){if(t instanceof jn){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=yi.create(vu(i))}return new jn({...t._def,shape:()=>e})}else return t instanceof Ko?new Ko({...t._def,type:vu(t.element)}):t instanceof yi?yi.create(vu(t.unwrap())):t instanceof yo?yo.create(vu(t.unwrap())):t instanceof go?go.create(t.items.map(e=>vu(e))):t}function $x(t,e){let r=Vo(t),i=Vo(e);if(t===e)return{valid:!0,data:t};if(r===fe.object&&i===fe.object){let n=_t.objectKeys(e),o=_t.objectKeys(t).filter(a=>n.indexOf(a)!==-1),s={...t,...e};for(let a of o){let u=$x(t[a],e[a]);if(!u.valid)return{valid:!1};s[a]=u.data}return{valid:!0,data:s}}else if(r===fe.array&&i===fe.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let o=0;o<t.length;o++){let s=t[o],a=e[o],u=$x(s,a);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return r===fe.date&&i===fe.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}function yD(t,e){return new Ru({values:t,typeName:Ne.ZodEnum,...Le(e)})}function A(t,e,r){function i(a,u){var l;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(l=a._zod).traits??(l.traits=new Set),a._zod.traits.add(t),e(a,u);for(let c in s.prototype)c in a||Object.defineProperty(a,c,{value:s.prototype[c].bind(a)});a._zod.constr=s,a._zod.def=u}let n=r?.Parent??Object;class o extends n{}Object.defineProperty(o,"name",{value:t});function s(a){var u;let l=r?.Parent?new o:this;i(l,a),(u=l._zod).deferred??(u.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}function rn(t){return t&&Object.assign(cg,t),cg}function RQ(t){return t}function AQ(t){return t}function DQ(t){}function UQ(t){throw Error()}function MQ(t){}function Jx(t){let e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,i])=>e.indexOf(+r)===-1).map(([r,i])=>i)}function ie(t,e="|"){return t.map(r=>Ve(r)).join(e)}function wD(t,e){return typeof e=="bigint"?e.toString():e}function jg(t){return{get value(){{let e=t();return Object.defineProperty(this,"value",{value:e}),e}throw Error("cached value already set")}}}function ia(t){return t==null}function Cg(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function SD(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return o%s/10**n}function $t(t,e,r){Object.defineProperty(t,e,{get(){{let i=r();return t[e]=i,i}throw Error("cached value already set")},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function Yx(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ZQ(t,e){return e?e.reduce((r,i)=>r?.[i],t):t}function LQ(t){let e=Object.keys(t),r=e.map(i=>t[i]);return Promise.all(r).then(i=>{let n={};for(let o=0;o<e.length;o++)n[e[o]]=i[o];return n})}function qQ(t=10){let e="";for(let r=0;r<t;r++)e+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return e}function _u(t){return JSON.stringify(t)}function Gd(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Bd(t){if(Gd(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(Gd(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function FQ(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function oa(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Si(t,e,r){let i=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(i._zod.parent=t),i}function re(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function WQ(t){let e;return new Proxy({},{get(r,i,n){return e??(e=t()),Reflect.get(e,i,n)},set(r,i,n,o){return e??(e=t()),Reflect.set(e,i,n,o)},has(r,i){return e??(e=t()),Reflect.has(e,i)},deleteProperty(r,i){return e??(e=t()),Reflect.deleteProperty(e,i)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,i){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,i)},defineProperty(r,i,n){return e??(e=t()),Reflect.defineProperty(e,i,n)}})}function Ve(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function $D(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function GQ(t,e){let r={},i=t._zod.def;for(let n in e){if(!(n in i.shape))throw Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=i.shape[n])}return Si(t,{...t._zod.def,shape:r,checks:[]})}function BQ(t,e){let r={...t._zod.def.shape},i=t._zod.def;for(let n in e){if(!(n in i.shape))throw Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return Si(t,{...t._zod.def,shape:r,checks:[]})}function KQ(t,e){if(!Bd(e))throw Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let i={...t._zod.def.shape,...e};return Yx(this,"shape",i),i},checks:[]};return Si(t,r)}function HQ(t,e){return Si(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return Yx(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function JQ(t,e,r){let i=e._zod.def.shape,n={...i};if(r)for(let o in r){if(!(o in i))throw Error(`Unrecognized key: "${o}"`);r[o]&&(n[o]=t?new t({type:"optional",innerType:i[o]}):i[o])}else for(let o in i)n[o]=t?new t({type:"optional",innerType:i[o]}):i[o];return Si(e,{...e._zod.def,shape:n,checks:[]})}function YQ(t,e,r){let i=e._zod.def.shape,n={...i};if(r)for(let o in r){if(!(o in n))throw Error(`Unrecognized key: "${o}"`);r[o]&&(n[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(let o in i)n[o]=new t({type:"nonoptional",innerType:i[o]});return Si(e,{...e._zod.def,shape:n,checks:[]})}function xu(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Kn(t,e){return e.map(r=>{var i;return(i=r).path??(i.path=[]),r.path.unshift(t),r})}function Pd(t){return typeof t=="string"?t:t?.message}function bi(t,e,r){let i={...t,path:t.path??[]};if(!t.message){let n=Pd(t.inst?._zod.def?.error?.(t))??Pd(e?.error?.(t))??Pd(r.customError?.(t))??Pd(r.localeError?.(t))??"Invalid input";i.message=n}return delete i.inst,delete i.continue,!e?.reportInput&&delete i.input,i}function Rg(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Ag(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function PD(...t){let[e,r,i]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:i}:{...e}}function QQ(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function e$(t,e=r=>r.message){let r={},i=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}function t$(t,e){let r=e||function(o){return o.message},i={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>n({issues:a}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)i._errors.push(r(s));else{let a=i,u=0;for(;u<s.path.length;){let l=s.path[u];u!==s.path.length-1?a[l]=a[l]||{_errors:[]}:(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))),a=a[l],u++}}};return n(t),i}function OD(t,e){let r=e||function(o){return o.message},i={errors:[]},n=(o,s=[])=>{var a,u;for(let l of o.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(c=>n({issues:c},l.path));else if(l.code==="invalid_key")n({issues:l.issues},l.path);else if(l.code==="invalid_element")n({issues:l.issues},l.path);else{let c=[...s,...l.path];if(c.length===0){i.errors.push(r(l));continue}let d=i,p=0;for(;p<c.length;){let f=c[p],m=p===c.length-1;typeof f=="string"?(d.properties??(d.properties={}),(a=d.properties)[f]??(a[f]={errors:[]}),d=d.properties[f]):(d.items??(d.items=[]),(u=d.items)[f]??(u[f]={errors:[]}),d=d.items[f]),m&&d.errors.push(r(l)),p++}}};return n(t),i}function zD(t){let e=[];for(let r of t)typeof r=="number"?e.push(`[${r}]`):typeof r=="symbol"?e.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?e.push(`[${JSON.stringify(r)}]`):(e.length&&e.push("."),e.push(r));return e.join("")}function ND(t){let e=[],r=[...t.issues].sort((i,n)=>i.path.length-n.path.length);for(let i of r)e.push(`\u2716 ${i.message}`),i.path?.length&&e.push(` \u2192 at ${zD(i.path)}`);return e.join(`
126
- `)}function qD(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}function QD(t){return typeof t.precision=="number"?t.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":t.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${t.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function XD(t){return new RegExp(`^${QD(t)}$`)}function eU(t){let e=QD({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let i=`${e}(?:${r.join("|")})`;return new RegExp(`^${JD}T(?:${i})$`)}function BR(t,e,r){t.issues.length&&e.issues.push(...Kn(r,t.issues))}function f$(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function JU(t){if(!l$.test(t))return!1;let e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return f$(r)}function XU(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[i]=r;if(!i)return!1;let n=JSON.parse(atob(i));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}function KR(t,e,r){t.issues.length&&e.issues.push(...Kn(r,t.issues)),e.value[r]=t.value}function Eh(t,e,r){t.issues.length&&e.issues.push(...Kn(r,t.issues)),e.value[r]=t.value}function HR(t,e,r,i){t.issues.length?i[r]===void 0?r in i?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...Kn(r,t.issues)):t.value===void 0?r in i&&(e.value[r]=void 0):e.value[r]=t.value}function JR(t,e,r,i){for(let n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(o=>bi(o,i,rn())))}),e}function Tx(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Bd(t)&&Bd(e)){let r=Object.keys(e),i=Object.keys(t).filter(o=>r.indexOf(o)!==-1),n={...t,...e};for(let o of i){let s=Tx(t[o],e[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};n[o]=s.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let i=0;i<t.length;i++){let n=t[i],o=e[i],s=Tx(n,o);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function YR(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),xu(t))return t;let i=Tx(e.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}function Ph(t,e,r){t.issues.length&&e.issues.push(...Kn(r,t.issues)),e.value[r]=t.value}function QR(t,e,r,i,n,o,s){t.issues.length&&(dg.has(typeof i)?r.issues.push(...Kn(i,t.issues)):r.issues.push({origin:"map",code:"invalid_key",input:n,inst:o,issues:t.issues.map(a=>bi(a,s,rn()))})),e.issues.length&&(dg.has(typeof i)?r.issues.push(...Kn(i,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:o,key:i,issues:e.issues.map(a=>bi(a,s,rn()))})),r.value.set(t.value,e.value)}function XR(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function eA(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function tA(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function rA(t,e,r){return xu(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}function nA(t){return t.value=Object.freeze(t.value),t}function iA(t,e,r,i){if(!t){let n={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(n.params=i._zod.def.params),e.issues.push(PD(n))}}function cX(){return{localeError:lX()}}function fX(){return{localeError:dX()}}function oA(t,e,r,i){let n=Math.abs(t),o=n%10,s=n%100;return s>=11&&s<=19?i:o===1?e:o>=2&&o<=4?r:i}function mX(){return{localeError:pX()}}function gX(){return{localeError:hX()}}function vX(){return{localeError:yX()}}function bX(){return{localeError:_X()}}function NM(){return{localeError:SX()}}function $X(){return{localeError:xX()}}function EX(){return{localeError:IX()}}function TX(){return{localeError:PX()}}function zX(){return{localeError:OX()}}function jX(){return{localeError:NX()}}function RX(){return{localeError:CX()}}function DX(){return{localeError:AX()}}function MX(){return{localeError:UX()}}function LX(){return{localeError:ZX()}}function FX(){return{localeError:qX()}}function WX(){return{localeError:VX()}}function BX(){return{localeError:GX()}}function HX(){return{localeError:KX()}}function YX(){return{localeError:JX()}}function XX(){return{localeError:QX()}}function tee(){return{localeError:eee()}}function nee(){return{localeError:ree()}}function oee(){return{localeError:iee()}}function aee(){return{localeError:see()}}function lee(){return{localeError:uee()}}function dee(){return{localeError:cee()}}function sA(t,e,r,i){let n=Math.abs(t),o=n%10,s=n%100;return s>=11&&s<=19?i:o===1?e:o>=2&&o<=4?r:i}function pee(){return{localeError:fee()}}function hee(){return{localeError:mee()}}function yee(){return{localeError:gee()}}function _ee(){return{localeError:vee()}}function wee(){return{localeError:bee()}}function xee(){return{localeError:kee()}}function Iee(){return{localeError:$ee()}}function Pee(){return{localeError:Eee()}}function Oee(){return{localeError:Tee()}}function Nee(){return{localeError:zee()}}function Cee(){return{localeError:jee()}}function S$(){return new Kd}function RM(t,e){return new t({type:"string",...re(e)})}function AM(t,e){return new t({type:"string",coerce:!0,...re(e)})}function k$(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...re(e)})}function gg(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...re(e)})}function x$(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...re(e)})}function $$(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...re(e)})}function I$(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...re(e)})}function E$(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...re(e)})}function P$(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...re(e)})}function T$(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...re(e)})}function O$(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...re(e)})}function z$(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...re(e)})}function N$(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...re(e)})}function j$(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...re(e)})}function C$(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...re(e)})}function R$(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...re(e)})}function A$(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...re(e)})}function D$(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...re(e)})}function U$(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...re(e)})}function M$(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...re(e)})}function Z$(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...re(e)})}function L$(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...re(e)})}function q$(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...re(e)})}function F$(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...re(e)})}function UM(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...re(e)})}function MM(t,e){return new t({type:"string",format:"date",check:"string_format",...re(e)})}function ZM(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...re(e)})}function LM(t,e){return new t({type:"string",format:"duration",check:"string_format",...re(e)})}function qM(t,e){return new t({type:"number",checks:[],...re(e)})}function FM(t,e){return new t({type:"number",coerce:!0,checks:[],...re(e)})}function VM(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...re(e)})}function WM(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...re(e)})}function GM(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...re(e)})}function BM(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...re(e)})}function KM(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...re(e)})}function HM(t,e){return new t({type:"boolean",...re(e)})}function JM(t,e){return new t({type:"boolean",coerce:!0,...re(e)})}function YM(t,e){return new t({type:"bigint",...re(e)})}function QM(t,e){return new t({type:"bigint",coerce:!0,...re(e)})}function XM(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...re(e)})}function e4(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...re(e)})}function t4(t,e){return new t({type:"symbol",...re(e)})}function r4(t,e){return new t({type:"undefined",...re(e)})}function n4(t,e){return new t({type:"null",...re(e)})}function i4(t){return new t({type:"any"})}function yg(t){return new t({type:"unknown"})}function o4(t,e){return new t({type:"never",...re(e)})}function s4(t,e){return new t({type:"void",...re(e)})}function a4(t,e){return new t({type:"date",...re(e)})}function u4(t,e){return new t({type:"date",coerce:!0,...re(e)})}function l4(t,e){return new t({type:"nan",...re(e)})}function ta(t,e){return new c$({check:"less_than",...re(e),value:t,inclusive:!1})}function vi(t,e){return new c$({check:"less_than",...re(e),value:t,inclusive:!0})}function ra(t,e){return new d$({check:"greater_than",...re(e),value:t,inclusive:!1})}function On(t,e){return new d$({check:"greater_than",...re(e),value:t,inclusive:!0})}function c4(t){return ra(0,t)}function d4(t){return ta(0,t)}function f4(t){return vi(0,t)}function p4(t){return On(0,t)}function Hd(t,e){return new dU({check:"multiple_of",...re(e),value:t})}function Ug(t,e){return new mU({check:"max_size",...re(e),maximum:t})}function Jd(t,e){return new hU({check:"min_size",...re(e),minimum:t})}function V$(t,e){return new gU({check:"size_equals",...re(e),size:t})}function Mg(t,e){return new yU({check:"max_length",...re(e),maximum:t})}function Lu(t,e){return new vU({check:"min_length",...re(e),minimum:t})}function Zg(t,e){return new _U({check:"length_equals",...re(e),length:t})}function W$(t,e){return new bU({check:"string_format",format:"regex",...re(e),pattern:t})}function G$(t){return new wU({check:"string_format",format:"lowercase",...re(t)})}function B$(t){return new SU({check:"string_format",format:"uppercase",...re(t)})}function K$(t,e){return new kU({check:"string_format",format:"includes",...re(e),includes:t})}function H$(t,e){return new xU({check:"string_format",format:"starts_with",...re(e),prefix:t})}function J$(t,e){return new $U({check:"string_format",format:"ends_with",...re(e),suffix:t})}function m4(t,e,r){return new IU({check:"property",property:t,schema:e,...re(r)})}function Y$(t,e){return new EU({check:"mime_type",mime:t,...re(e)})}function sa(t){return new PU({check:"overwrite",tx:t})}function Q$(t){return sa(e=>e.normalize(t))}function X$(){return sa(t=>t.trim())}function eI(){return sa(t=>t.toLowerCase())}function tI(){return sa(t=>t.toUpperCase())}function rI(t,e,r){return new t({type:"array",element:e,...re(r)})}function Ree(t,e,r){return new t({type:"union",options:e,...re(r)})}function Aee(t,e,r,i){return new t({type:"union",options:r,discriminator:e,...re(i)})}function Dee(t,e,r){return new t({type:"intersection",left:e,right:r})}function h4(t,e,r,i){let n=r instanceof Me;return new t({type:"tuple",items:e,rest:n?r:null,...re(n?i:r)})}function Uee(t,e,r,i){return new t({type:"record",keyType:e,valueType:r,...re(i)})}function Mee(t,e,r,i){return new t({type:"map",keyType:e,valueType:r,...re(i)})}function Zee(t,e,r){return new t({type:"set",valueType:e,...re(r)})}function Lee(t,e,r){let i=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new t({type:"enum",entries:i,...re(r)})}function qee(t,e,r){return new t({type:"enum",entries:e,...re(r)})}function Fee(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...re(r)})}function g4(t,e){return new t({type:"file",...re(e)})}function Vee(t,e){return new t({type:"transform",transform:e})}function Wee(t,e){return new t({type:"optional",innerType:e})}function Gee(t,e){return new t({type:"nullable",innerType:e})}function Bee(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():r}})}function Kee(t,e,r){return new t({type:"nonoptional",innerType:e,...re(r)})}function Hee(t,e){return new t({type:"success",innerType:e})}function Jee(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function Yee(t,e,r){return new t({type:"pipe",in:e,out:r})}function Qee(t,e){return new t({type:"readonly",innerType:e})}function Xee(t,e,r){return new t({type:"template_literal",parts:e,...re(r)})}function ete(t,e){return new t({type:"lazy",getter:e})}function tte(t,e){return new t({type:"promise",innerType:e})}function y4(t,e,r){let i=re(r);return i.abort??(i.abort=!0),new t({type:"custom",check:"custom",fn:e,...i})}function v4(t,e,r){return new t({type:"custom",check:"custom",fn:e,...re(r)})}function _4(t,e){let r=re(e),i=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(i=i.map(p=>typeof p=="string"?p.toLowerCase():p),n=n.map(p=>typeof p=="string"?p.toLowerCase():p));let o=new Set(i),s=new Set(n),a=t.Pipe??b$,u=t.Boolean??m$,l=t.String??tf,c=new(t.Transform??_$)({type:"transform",transform:(p,f)=>{let m=p;return r.case!=="sensitive"&&(m=m.toLowerCase()),o.has(m)?!0:s.has(m)?!1:(f.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...s],input:f.value,inst:c}),{})},error:r.error}),d=new a({type:"pipe",in:new l({type:"string",error:r.error}),out:c,error:r.error});return new a({type:"pipe",in:d,out:new u({type:"boolean",error:r.error}),error:r.error})}function b4(t,e,r,i={}){let n=re(i),o={...re(i),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:s=>r.test(s),...n};return r instanceof RegExp&&(o.pattern=r),new t(o)}function w4(t){return new vg({type:"function",input:Array.isArray(t?.input)?h4(Dg,t?.input):t?.input??rI(g$,yg(hg)),output:t?.output??yg(hg)})}function S4(t,e){if(t instanceof Kd){let i=new Yd(e),n={};for(let a of t._idmap.entries()){let[u,l]=a;i.process(l)}let o={},s={registry:t,uri:e?.uri||(a=>a),defs:n};for(let a of t._idmap.entries()){let[u,l]=a;o[u]=i.emit(l,{...e,external:s})}if(Object.keys(n).length>0){let a=i.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[a]:n}}return{schemas:o}}let r=new Yd(e);return r.process(t),r.emit(t,e)}function fr(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let i=t._zod.def;switch(i.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return fr(i.element,r);case"object":{for(let n in i.shape)if(fr(i.shape[n],r))return!0;return!1}case"union":{for(let n of i.options)if(fr(n,r))return!0;return!1}case"intersection":return fr(i.left,r)||fr(i.right,r);case"tuple":{for(let n of i.items)if(fr(n,r))return!0;return!!(i.rest&&fr(i.rest,r))}case"record":return fr(i.keyType,r)||fr(i.valueType,r);case"map":return fr(i.keyType,r)||fr(i.valueType,r);case"set":return fr(i.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return fr(i.innerType,r);case"lazy":return fr(i.getter(),r);case"default":return fr(i.innerType,r);case"prefault":return fr(i.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return fr(i.in,r)||fr(i.out,r);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${i.type}`)}function k4(t){return UM(iI,t)}function x4(t){return MM(oI,t)}function $4(t){return ZM(sI,t)}function I4(t){return LM(aI,t)}function V(t){return RM(Lg,t)}function ote(t){return k$(lI,t)}function ste(t){return gg(_g,t)}function ate(t){return x$(ho,t)}function ute(t){return $$(ho,t)}function lte(t){return I$(ho,t)}function cte(t){return E$(ho,t)}function dte(t){return P$(cI,t)}function fte(t){return T$(dI,t)}function pte(t){return O$(fI,t)}function mte(t){return z$(pI,t)}function hte(t){return N$(mI,t)}function gte(t){return j$(hI,t)}function yte(t){return C$(gI,t)}function vte(t){return R$(yI,t)}function _te(t){return A$(vI,t)}function bte(t){return D$(_I,t)}function wte(t){return U$(bI,t)}function Ste(t){return M$(wI,t)}function kte(t){return Z$(SI,t)}function xte(t){return L$(kI,t)}function $te(t){return q$(xI,t)}function Ite(t){return F$($I,t)}function Ete(t,e,r={}){return b4(N4,t,e,r)}function xt(t){return qM(qg,t)}function Ox(t){return VM(Ku,t)}function Pte(t){return WM(Ku,t)}function Tte(t){return GM(Ku,t)}function Ote(t){return BM(Ku,t)}function zte(t){return KM(Ku,t)}function pr(t){return HM(Fg,t)}function Nte(t){return YM(Vg,t)}function jte(t){return XM(II,t)}function Cte(t){return e4(II,t)}function Rte(t){return t4(j4,t)}function Ate(t){return r4(C4,t)}function EI(t){return n4(R4,t)}function Dte(){return i4(A4)}function Ht(){return yg(D4)}function Wg(t){return o4(U4,t)}function Ute(t){return s4(M4,t)}function Mte(t){return a4(PI,t)}function lt(t,e){return rI(Z4,t,e)}function Zte(t){let e=t._zod.def.shape;return we(Object.keys(e))}function de(t,e){let r={type:"object",get shape(){return ut.assignProp(this,"shape",{...t}),this.shape},...ut.normalizeParams(e)};return new Gg(r)}function Lte(t,e){return new Gg({type:"object",get shape(){return ut.assignProp(this,"shape",{...t}),this.shape},catchall:Wg(),...ut.normalizeParams(e)})}function Xr(t,e){return new Gg({type:"object",get shape(){return ut.assignProp(this,"shape",{...t}),this.shape},catchall:Ht(),...ut.normalizeParams(e)})}function At(t,e){return new TI({type:"union",options:t,...ut.normalizeParams(e)})}function OI(t,e,r){return new L4({type:"union",options:e,discriminator:t,...ut.normalizeParams(r)})}function Bg(t,e){return new q4({type:"intersection",left:t,right:e})}function qte(t,e,r){let i=e instanceof Me,n=i?r:e;return new F4({type:"tuple",items:t,rest:i?e:null,...ut.normalizeParams(n)})}function Rt(t,e,r){return new zI({type:"record",keyType:t,valueType:e,...ut.normalizeParams(r)})}function Fte(t,e,r){return new zI({type:"record",keyType:At([t,Wg()]),valueType:e,...ut.normalizeParams(r)})}function Vte(t,e,r){return new V4({type:"map",keyType:t,valueType:e,...ut.normalizeParams(r)})}function Wte(t,e){return new W4({type:"set",valueType:t,...ut.normalizeParams(e)})}function mn(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new Qd({type:"enum",entries:r,...ut.normalizeParams(e)})}function Gte(t,e){return new Qd({type:"enum",entries:t,...ut.normalizeParams(e)})}function we(t,e){return new G4({type:"literal",values:Array.isArray(t)?t:[t],...ut.normalizeParams(e)})}function Bte(t){return g4(B4,t)}function jI(t){return new NI({type:"transform",transform:t})}function Ft(t){return new CI({type:"optional",innerType:t})}function bg(t){return new K4({type:"nullable",innerType:t})}function Kte(t){return Ft(bg(t))}function J4(t,e){return new H4({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function Q4(t,e){return new Y4({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function X4(t,e){return new RI({type:"nonoptional",innerType:t,...ut.normalizeParams(e)})}function Hte(t){return new eZ({type:"success",innerType:t})}function rZ(t,e){return new tZ({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function Jte(t){return l4(nZ,t)}function wg(t,e){return new AI({type:"pipe",in:t,out:e})}function oZ(t){return new iZ({type:"readonly",innerType:t})}function Yte(t,e){return new sZ({type:"template_literal",parts:t,...ut.normalizeParams(e)})}function uZ(t){return new aZ({type:"lazy",getter:t})}function Qte(t){return new lZ({type:"promise",innerType:t})}function cZ(t,e){let r=new nr({check:"custom",...ut.normalizeParams(e)});return r._zod.check=t,r}function dZ(t,e){return y4(Kg,t??(()=>!0),e)}function fZ(t,e={}){return v4(Kg,t,e)}function pZ(t,e){let r=cZ(i=>(i.addIssue=n=>{if(typeof n=="string")i.issues.push(ut.issue(n,i.value,r._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=i.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),i.issues.push(ut.issue(o))}},t(i.value,i)),e);return r}function Xte(t,e={error:`Input not instance of ${t.name}`}){let r=new Kg({type:"custom",check:"custom",fn:i=>i instanceof t,abort:!0,...ut.normalizeParams(e)});return r._zod.bag.Class=t,r}function tre(t){let e=uZ(()=>At([V(t),xt(),pr(),EI(),lt(e),Rt(V(),e)]));return e}function DI(t,e){return wg(jI(t),e)}function nre(t){rn({customError:t})}function ire(){return rn().customError}function ore(t){return AM(Lg,t)}function sre(t){return FM(qg,t)}function are(t){return JM(Fg,t)}function ure(t){return QM(Vg,t)}function lre(t){return u4(PI,t)}function eie(t){let e;return()=>e??=t()}async function tie(t,e){try{await tY(t,e)}catch(r){if(!Bx(r))throw r}}async function rie(t,e){if(!t)return;let r=t;try{let i=Hx(t);i?.claudeAiOauth?.refreshToken&&(delete i.claudeAiOauth.refreshToken,r=Qr(i))}catch{}await TA(e,r,{mode:384})}function nie(){if(process.platform!=="darwin")return Promise.resolve(void 0);let t=lQ(uQ);return new Promise(e=>{QJ("security",["find-generic-password","-a",cQ(),"-w","-s",t],{encoding:"utf-8",timeout:5e3},(r,i)=>e(r?void 0:i.trim()||void 0))})}async function iie(t,e,r,i,n=6e4){if(!G7(e))return;let o=LZ(r),s=await Td(t.load({projectKey:o,sessionId:e}),n,`SessionStore.load() timed out after ${n}ms for session ${e}`);if(!s||s.length===0)return;let a=gi(oY(),`claude-resume-${XJ()}`);try{let u=gi(a,"projects",o);await Zk(u,{recursive:!0});let l=gi(u,`${e}.jsonl`);await ZR(l,s);let c=i?.CLAUDE_CONFIG_DIR??process.env.CLAUDE_CONFIG_DIR,d=c??gi(tx(),".claude"),p;try{p=await rY(gi(d,".credentials.json"),"utf-8")}catch(f){if(!Bx(f))throw f}if(!c&&!(i??process.env).ANTHROPIC_API_KEY&&!(i??process.env).CLAUDE_CODE_OAUTH_TOKEN&&(p=await nie()??p),await rie(p,gi(a,".credentials.json")),await tie(gi(c??tx(),".claude.json"),gi(a,".claude.json")),t.listSubkeys){let f=gi(u,e),m=await Td(t.listSubkeys({projectKey:o,sessionId:e}),n,`SessionStore.listSubkeys() timed out after ${n}ms for session ${e}`);for(let g of m){let v=Rh(f,g+".jsonl");if(!g||OA(g)||g.split(/[\\/]/).includes("..")||!v.startsWith(f+zA)){Cr(`[SessionStore] skipping unsafe subpath from listSubkeys: ${g}`,{level:"warn"});continue}let h=await Td(t.load({projectKey:o,sessionId:e,subpath:g}),n,`SessionStore.load() timed out after ${n}ms for session ${e} subpath ${g}`);if(!h||h.length===0)continue;let y=[],_=[];for(let b of h)uie(b)?y.push(b):_.push(b);if(_.length>0&&(await Zk(tR(v),{recursive:!0}),await ZR(v,_)),y.length>0){let b=y.at(-1),w=Rh(f,g+".meta.json");await Zk(tR(w),{recursive:!0});let{type:S,...k}=b;await TA(w,Qr(k),{mode:384})}}}return a}catch(u){throw await MZ(a),u}}function lA(t,e,r,i){let{systemPrompt:n,settings:o,managedSettings:s,settingSources:a,sandbox:u,...l}=t??{},c,d,p;n===void 0?c="":typeof n=="string"||Array.isArray(n)?c=n:n.type==="preset"&&(d=n.append,p=n.excludeDynamicSections);let f=l.pathToClaudeCodeExecutable;if(!f){let kn=aY(import.meta.url),li=iY(kn),ji=D7(ec=>li.resolve(ec));if(ji)f=ji;else try{f=li.resolve("./cli.js")}catch{throw Error(`Native CLI binary for ${process.platform}-${process.arch} not found. Reinstall @anthropic-ai/claude-agent-sdk without --omit=optional, or set options.pathToClaudeCodeExecutable.`)}}process.env.CLAUDE_AGENT_SDK_VERSION="0.2.119";let{abortController:m=NA(),additionalDirectories:g=[],agent:v,agents:h,allowedTools:y=[],betas:_,canUseTool:b,continue:w,cwd:S,debug:k,debugFile:$,disallowedTools:P=[],tools:j,env:I,executable:R=CA()?"bun":"node",executableArgs:q=[],extraArgs:O={},fallbackModel:Q,enableFileCheckpointing:K,toolConfig:Oe,forkSession:st,hooks:pe,includeHookEvents:J,includePartialMessages:T,forwardSubagentText:G,onElicitation:C,persistSession:x,sessionStore:E,thinking:W,effort:he,maxThinkingTokens:me,maxTurns:vt,maxBudgetUsd:ct,taskBudget:Jt,mcpServers:D,model:Z,outputFormat:H,permissionMode:ne="default",allowDangerouslySkipPermissions:ve=!1,permissionPromptToolName:Be,plugins:ur,getOAuthToken:un,workload:gr,resume:yr,resumeSessionAt:lr,sessionId:Eo,stderr:ln,strictMcpConfig:Yl}=l;if(E&&x===!1)throw Error("sessionStore cannot be used with persistSession: false -- the storage adapter requires local writes to mirror from. Use CLAUDE_CONFIG_DIR=/tmp for ephemeral local writes with external mirroring.");if(E&&w&&!yr&&!E.listSessions)throw Error("Options.continue with sessionStore requires store.listSessions to be implemented");if(E&&K)throw Error("enableFileCheckpointing is not yet supported with sessionStore (backup blobs are not mirrored, so rewindFiles() fails after a store-backed resume).");E&&l.spawnClaudeCodeProcess&&Cr("sessionStore with custom spawnClaudeCodeProcess: ensure the subprocess CLAUDE_CONFIG_DIR matches the parent (same path, same separators) or transcript_mirror frames will be dropped.",{level:"warn"});let Po=H?.type==="json_schema"?H.schema:void 0,qr=I?{...I}:{...process.env};qr.CLAUDE_CODE_ENTRYPOINT||(qr.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),K&&(qr.CLAUDE_CODE_ENABLE_SDK_FILE_CHECKPOINTING="true"),un&&(qr.CLAUDE_CODE_SDK_HAS_OAUTH_REFRESH="1"),Oe?.askUserQuestion?.previewFormat&&(qr.CLAUDE_CODE_QUESTION_PREVIEW_FORMAT=Oe.askUserQuestion.previewFormat);let Aa={};if(UR.propagation.inject(UR.context.active(),Aa),"traceparent"in Aa)for(let kn of["TRACEPARENT","TRACESTATE"])kn in(I??{})||delete qr[kn];for(let[kn,li]of Object.entries(Aa)){let ji=kn.toUpperCase();ji in(I??{})||(qr[ji]=li)}let Ql={},Np=new Map;if(D)for(let[kn,li]of Object.entries(D))li.type==="sdk"&&li.instance?Np.set(kn,li.instance):Ql[kn]=li;let Xl;if(W)switch(W.type){case"adaptive":Xl={type:"adaptive",display:W.display};break;case"enabled":Xl={type:"enabled",budgetTokens:W.budgetTokens,display:W.display};break;case"disabled":Xl={type:"disabled"};break}else me!==void 0&&(Xl=me===0?{type:"disabled"}:{type:"enabled",budgetTokens:me});r&&(qr.CLAUDE_CONFIG_DIR=r);let Rz=new yx({abortController:m,additionalDirectories:g,agent:v,betas:_,cwd:S,debug:k,debugFile:$,executable:R,executableArgs:q,extraArgs:gr?{...O,workload:gr}:O,pathToClaudeCodeExecutable:f,env:qr,forkSession:st,stderr:ln,thinkingConfig:Xl,effort:he,maxTurns:vt,maxBudgetUsd:ct,taskBudget:Jt,model:Z,fallbackModel:Q,jsonSchema:Po,permissionMode:ne,allowDangerouslySkipPermissions:ve,permissionPromptToolName:Be,continueConversation:E?void 0:w,resume:yr,resumeSessionAt:lr,sessionId:Eo,settings:typeof o=="object"?Qr(o):o,managedSettings:s?Qr(s):void 0,settingSources:a,allowedTools:y,disallowedTools:P,tools:j,mcpServers:Ql,strictMcpConfig:Yl,canUseTool:!!b,hooks:!!pe,includeHookEvents:J,includePartialMessages:T,persistSession:x,sessionMirror:!!E,plugins:ur,sandbox:u,spawnClaudeCodeProcess:l.spawnClaudeCodeProcess,deferSpawn:i}),kW={systemPrompt:c,appendSystemPrompt:d,planModeInstructions:l.planModeInstructions,appendSubagentSystemPrompt:l.appendSubagentSystemPrompt,excludeDynamicSections:p,agents:h,title:l.title,promptSuggestions:l.promptSuggestions,agentProgressSummaries:l.agentProgressSummaries,forwardSubagentText:G},Bv=new bx(Rz,e,b,pe,m,Np,Po,kW,C,un);if(E){let kn=()=>gi(qr.CLAUDE_CONFIG_DIR??gi(tx(),".claude"),"projects"),li=new wx(async(ji,ec)=>{let tc=dA(ji,kn());tc?await E.append(tc,ec):Cr(`[SessionStore] dropping mirror frame: filePath ${ji} is not under ${kn()} -- subprocess CLAUDE_CONFIG_DIR likely differs from parent (custom spawnClaudeCodeProcess / container?)`,{level:"warn"})},void 0,(ji,ec)=>{let tc=dA(ji,kn());tc&&Bv.reportMirrorError(tc,ec.message)});Bv.setTranscriptMirrorBatcher(li)}return{queryInstance:Bv,transport:Rz,abortController:m,processEnv:qr}}function cA(t,e,r,i){typeof r=="string"?e.write(Qr({type:"user",session_id:"",message:{role:"user",content:[{type:"text",text:r}]},parent_tool_use_id:null})+`
127
- `):t.streamInput(r).catch(n=>i.abort(n))}async function MZ(t){for(let e=0;;e++)try{return await nY(t,{recursive:!0,force:!0})}catch(r){if(e>=4||!oie.has(ku(r)??""))return;await jA((e+1)*100)}}function sie(t,e){t.waitForExit().catch(()=>{}).finally(()=>MZ(e))}function ZZ({prompt:t,options:e}){if((e?.resume||e?.continue)&&e?.sessionStore){let{queryInstance:o,transport:s,abortController:a,processEnv:u}=lA({...e},typeof t=="string",void 0,!0),l=Rh(e.cwd??"."),c=e.sessionStore,d=e.loadTimeoutMs??6e4,p=e.resume;return(async()=>{if(p||(p=(await Td(c.listSessions(LZ(l)),d,`SessionStore.listSessions() timed out after ${d}ms`)).slice().sort((f,m)=>m.mtime-f.mtime)[0]?.sessionId),!!p)return iie(c,p,l,e.env,e.loadTimeoutMs)})().then(f=>{f&&(s.updateResume(p),s.updateEnv({CLAUDE_CONFIG_DIR:f}),u.CLAUDE_CONFIG_DIR=f,o.addCleanupCallback(()=>sie(s,f))),o.isClosed()||s.spawn()}).catch(f=>{let m=Gx(f);s.spawnAbort(m),o.setError(m)}),cA(o,s,t,a),o}let{queryInstance:r,transport:i,abortController:n}=lA(e,typeof t=="string");return cA(r,i,t,n),r}function aie(t){let e=Rh(t??"."),r;try{r=eY(e)}catch{r=e}return r.normalize("NFC")}function LZ(t){return K7(aie(t))}function uie(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="agent_metadata"}function dA(t,e){let r=sY(e,t),i=r.split(zA);if(i[0]===".."||OA(r)||i.length<2)return null;let n=i[0],o=i[1];if(i.length===2&&o.endsWith(".jsonl"))return{projectKey:n,sessionId:o.replace(/\.jsonl$/,"")};if(i.length>=4){let s=i.slice(2),a=s.length-1;return s[a]=s.at(-1).replace(/\.jsonl$/,""),{projectKey:n,sessionId:o,subpath:s.join("/")}}return null}var h5,g5,ex,y5,v5,b5,w5,kg,B,S5,na,x5,$5,Qt,Xt,I5,E5,P5,fA,T5,Fu,O5,zx,z5,Vu,N5,j5,pA,xg,C5,mA,R5,hA,A5,$g,gA,Nx,jx,yA,Cx,vA,_A,D5,bA,U5,M5,Z5,L5,q5,F5,V5,W5,G5,B5,K5,H5,J5,Y5,Q5,X5,eJ,wA,jh,eR,Je,bt,Jo,Ig,tJ,SA,kA,Ch,rJ,wi,nJ,iJ,xA,oJ,Eg,Pg,Rx,Tg,Ax,sJ,aJ,uJ,lJ,cJ,dJ,fJ,pJ,mJ,hJ,gJ,yJ,vJ,_J,bJ,wJ,SJ,kJ,Dx,xJ,$J,IJ,EJ,$A,IA,PJ,TJ,OJ,zJ,NJ,EA,jJ,CJ,RJ,AJ,DJ,UJ,MJ,ZJ,LJ,qJ,FJ,VJ,WJ,GJ,BJ,KJ,PA,HJ,JJ,YJ,lY,Wo,pY,mY,hY,gY,Mx,yY,Ah,RA,vY,_Y,ud,wY,SY,kY,$Y,IY,EY,rR,TY,AA,zY,NY,jY,CY,AY,DY,Lk,nR,MY,ZY,LY,FY,VY,WY,GY,BY,KY,HY,JY,QY,e3,DA,r3,zd,i3,s3,a3,u3,l3,d3,f3,p3,h3,g3,v3,iR,b3,S3,Og,x3,$3,E3,T3,z3,j3,C3,R3,A3,U3,Z3,zg,F3,W3,B3,H3,UA,J3,Yo,Lx,MA,rx,je,en,zn,$u,Dh,Uh,Mh,Zh,Lh,qh,Fh,Vh,Wh,X3,e8,nx,oR,r8,ZA,n8,gu,i8,s8,aR,uR,lR,u8,d8,cR,dR,Pn,Tn,Js,Gh,pR,g8,mR,Bs,ld,Ys,ox,Id,Bh,dh,Kh,sx,Qs,Hh,WA,GA,Vx,hR,w8,S8,ax,BA,k8,x8,Nn,KA,dt,Od,gR,T8,br,Jh,Yh,QA,z8,yu,N8,j8,tD,Gn,Lo,fu,cd,fh,dd,fd,ph,pd,co,md,mh,hh,Vs,gh,yh,hd,qk,vR,vh,Fk,Vk,Wk,_R,bR,lx,Qh,C8,R8,gd,pu,Ws,dr,yd,En,mo,qo,vd,SR,cx,Xh,eg,tg,xR,D8,Xs,rg,jd,Bo,ng,Bn,Fo,mu,_d,_h,bd,wd,bh,Sd,fo,kd,wh,Sh,Gs,kh,xh,xd,Gk,ER,Bk,Kk,Hk,Jk,PR,TR,dx,ig,Cd,zR,M8,og,$h,fx,Wx,zh,iD,Z8,L8,tr,Iu,Hs,hu,B8,H8,J8,GIe,Y8,BIe,Q8,KIe,RR,o7,y7,v7,mx,w7,S7,hx,k7,lD,cD,$7,Ih,Qk,gx,pD,QIe,T7,er,Hx,j7,sg,DR,yx,vx,_x,bx,U7,M7,Z7,wx,XIe,UR,hEe,W7,LR,gEe,yEe,H7,vEe,eQ,mD,tQ,rQ,nQ,KEe,qR,iQ,sQ,uQ,_t,FR,fe,Vo,te,Hn,dQ,Rd,fQ,kx,tn,ze,Ed,pn,VR,WR,Eu,ag,ye,Jn,GR,Ye,pQ,mQ,hQ,gQ,yQ,vQ,_Q,bQ,wQ,Xk,SQ,kQ,xQ,$Q,IQ,EQ,hD,PQ,Pu,Ad,Dd,Ud,Md,Zd,Tu,Ou,Ld,Go,qi,qd,Ko,jn,zu,po,xx,Nu,go,Ix,Fd,Vd,Ex,ju,Cu,Ru,Au,ea,_i,yi,yo,Du,Uu,Wd,ug,lg,Mu,HEe,Ne,JEe,YEe,QEe,XEe,ePe,tPe,rPe,nPe,iPe,oPe,sPe,aPe,uPe,lPe,cPe,dPe,fPe,pPe,mPe,hPe,gPe,yPe,vPe,_Pe,bPe,wPe,SPe,kPe,xPe,$Pe,IPe,EPe,PPe,TPe,vD,_D,bD,Ho,cg,ut,Qx,kD,VQ,dg,xD,ID,ED,Px,TD,Xx,Xd,r$,fg,n$,pg,i$,o$,s$,a$,u$,jD,CD,RD,AD,DD,UD,MD,XQ,ZD,Zu,eX,tX,rX,LD,nX,iX,oX,sX,aX,FD,VD,WD,GD,BD,l$,KD,uX,HD,JD,YD,tU,rU,nU,iU,oU,sU,aU,uU,lU,nr,cU,c$,d$,dU,fU,pU,mU,hU,gU,yU,vU,_U,ef,bU,wU,SU,kU,xU,$U,IU,EU,PU,mg,TU,Me,tf,Lt,OU,zU,NU,jU,CU,RU,AU,DU,UU,MU,ZU,LU,qU,FU,VU,WU,GU,BU,KU,HU,YU,QU,eM,tM,p$,rM,m$,h$,nM,iM,oM,sM,aM,hg,uM,lM,cM,g$,y$,v$,dM,fM,Dg,pM,mM,hM,gM,yM,vM,_$,_M,bM,wM,SM,kM,xM,$M,IM,b$,EM,PM,TM,OM,zM,w$,lX,dX,pX,hX,yX,_X,wX,SX,kX,xX,IX,PX,OX,NX,CX,AX,UX,ZX,qX,VX,GX,KX,JX,QX,eee,ree,iee,see,uee,cee,fee,mee,gee,vee,bee,See,kee,$ee,Eee,Tee,zee,jee,jM,CM,Kd,Ks,DM,vg,Yd,rte,nte,OPe,bu,nI,iI,oI,sI,aI,E4,ite,rf,P4,T4,O4,z4,Qe,uI,Lg,Vt,lI,_g,ho,cI,dI,fI,pI,mI,hI,gI,yI,vI,_I,bI,wI,SI,kI,xI,$I,N4,qg,Ku,Fg,Vg,II,j4,C4,R4,A4,D4,U4,M4,PI,Z4,Gg,TI,L4,q4,F4,zI,V4,W4,Qd,G4,B4,NI,CI,K4,H4,Y4,RI,eZ,tZ,nZ,AI,iZ,sZ,aZ,lZ,Kg,ere,rre,mZ,cre,Hg,mr,hZ,gZ,zPe,dre,fre,UI,Cn,Jg,wr,Yn,Qn,Sr,Yg,pre,mre,yZ,aA,vZ,NPe,jPe,_Z,hre,bZ,gre,nf,qu,wZ,yre,vre,_re,bre,wre,Sre,kre,xre,$re,Ire,SZ,Ere,Pre,kZ,Tre,of,sf,Ore,af,xZ,zre,$Z,IZ,EZ,PZ,CPe,TZ,OZ,zZ,RPe,NZ,jZ,MI,CZ,uf,Hu,RZ,Nre,jre,Cre,Rre,Are,ZI,Dre,Ure,Mre,Zre,Lre,qre,Fre,Vre,Wre,Gre,Bre,Kre,Hre,Jre,Yre,Qre,LI,qI,FI,Xre,ene,tne,VI,rne,nne,ine,one,sne,AZ,ane,une,DZ,APe,lne,cne,dne,DPe,UZ,fne,pne,mne,hne,gne,yne,vne,_ne,bne,Sg,wne,Sne,kne,xne,$ne,Ine,Ene,Pne,Tne,One,zne,Nne,jne,Cne,Rne,Ane,Dne,Une,Mne,Zne,Lne,qne,Fne,Vne,Wne,Gne,Bne,Kne,Hne,Jne,Yne,Qne,Xne,UPe,MPe,ZPe,LPe,qPe,FPe,VPe,WPe,GPe,uA,BPe,oie,qZ=N(()=>{h5=Object.create,{getPrototypeOf:g5,defineProperty:ex,getOwnPropertyNames:y5}=Object,v5=Object.prototype.hasOwnProperty;kg=(t,e,r)=>{var i=t!=null&&typeof t=="object";if(i){var n=e?b5??=new WeakMap:w5??=new WeakMap,o=n.get(t);if(o)return o}r=t!=null?h5(g5(t)):{};let s=e||!t||!t.__esModule?ex(r,"default",{value:t,enumerable:!0}):r;for(let a of y5(t))v5.call(s,a)||ex(s,a,{get:_5.bind(t,a),enumerable:!0});return i&&n.set(t,s),s},B=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),S5=t=>t;na=(t,e)=>{for(var r in e)ex(t,r,{get:e[r],enumerable:!0,configurable:!0,set:k5.bind(e,r)})},x5=Symbol.dispose||Symbol.for("Symbol.dispose"),$5=Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose"),Qt=(t,e,r)=>{if(e!=null){if(typeof e!="object"&&typeof e!="function")throw TypeError('Object expected to be assigned to "using" declaration');var i;if(r&&(i=e[$5]),i===void 0&&(i=e[x5]),typeof i!="function")throw TypeError("Object not disposable");t.push([r,i,e])}else r&&t.push([r]);return e},Xt=(t,e,r)=>{var i=typeof SuppressedError=="function"?SuppressedError:function(s,a,u,l){return l=Error(u),l.name="SuppressedError",l.error=s,l.suppressed=a,l},n=s=>e=r?new i(s,e,"An error was suppressed during disposal"):(r=!0,s),o=s=>{for(;s=t.pop();)try{var a=s[1]&&s[1].call(s[2]);if(s[0])return Promise.resolve(a).then(o,u=>(n(u),o()))}catch(u){n(u)}if(r)throw e};return o()},I5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t._globalThis=void 0,t._globalThis=typeof globalThis=="object"?globalThis:global}),E5=B(t=>{var e=t&&t.__createBinding||(Object.create?function(i,n,o,s){s===void 0&&(s=o),Object.defineProperty(i,s,{enumerable:!0,get:function(){return n[o]}})}:function(i,n,o,s){s===void 0&&(s=o),i[s]=n[o]}),r=t&&t.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(I5(),t)}),P5=B(t=>{var e=t&&t.__createBinding||(Object.create?function(i,n,o,s){s===void 0&&(s=o),Object.defineProperty(i,s,{enumerable:!0,get:function(){return n[o]}})}:function(i,n,o,s){s===void 0&&(s=o),i[s]=n[o]}),r=t&&t.__exportStar||function(i,n){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(n,o)&&e(n,i,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(E5(),t)}),fA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,t.VERSION="1.9.0"}),T5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isCompatible=t._makeCompatibilityCheck=void 0;var e=fA(),r=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function i(n){let o=new Set([n]),s=new Set,a=n.match(r);if(!a)return()=>!1;let u={major:+a[1],minor:+a[2],patch:+a[3],prerelease:a[4]};if(u.prerelease!=null)return function(d){return d===n};function l(d){return s.add(d),!1}function c(d){return o.add(d),!0}return function(d){if(o.has(d))return!0;if(s.has(d))return!1;let p=d.match(r);if(!p)return l(d);let f={major:+p[1],minor:+p[2],patch:+p[3],prerelease:p[4]};return f.prerelease!=null||u.major!==f.major?l(d):u.major===0?u.minor===f.minor&&u.patch<=f.patch?c(d):l(d):u.minor<=f.minor?c(d):l(d)}}t._makeCompatibilityCheck=i,t.isCompatible=i(e.VERSION)}),Fu=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unregisterGlobal=t.getGlobal=t.registerGlobal=void 0;var e=P5(),r=fA(),i=T5(),n=r.VERSION.split(".")[0],o=Symbol.for(`opentelemetry.js.api.${n}`),s=e._globalThis;function a(c,d,p,f=!1){var m;let g=s[o]=(m=s[o])!==null&&m!==void 0?m:{version:r.VERSION};if(!f&&g[c]){let v=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${c}`);return p.error(v.stack||v.message),!1}if(g.version!==r.VERSION){let v=Error(`@opentelemetry/api: Registration of version v${g.version} for ${c} does not match previously registered API v${r.VERSION}`);return p.error(v.stack||v.message),!1}return g[c]=d,p.debug(`@opentelemetry/api: Registered a global for ${c} v${r.VERSION}.`),!0}t.registerGlobal=a;function u(c){var d,p;let f=(d=s[o])===null||d===void 0?void 0:d.version;if(!(!f||!(0,i.isCompatible)(f)))return(p=s[o])===null||p===void 0?void 0:p[c]}t.getGlobal=u;function l(c,d){d.debug(`@opentelemetry/api: Unregistering a global for ${c} v${r.VERSION}.`);let p=s[o];p&&delete p[c]}t.unregisterGlobal=l}),O5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiagComponentLogger=void 0;var e=Fu();class r{constructor(o){this._namespace=o.namespace||"DiagComponentLogger"}debug(...o){return i("debug",this._namespace,o)}error(...o){return i("error",this._namespace,o)}info(...o){return i("info",this._namespace,o)}warn(...o){return i("warn",this._namespace,o)}verbose(...o){return i("verbose",this._namespace,o)}}t.DiagComponentLogger=r;function i(n,o,s){let a=(0,e.getGlobal)("diag");if(a)return s.unshift(o),a[n](...s)}}),zx=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiagLogLevel=void 0;var e;(function(r){r[r.NONE=0]="NONE",r[r.ERROR=30]="ERROR",r[r.WARN=50]="WARN",r[r.INFO=60]="INFO",r[r.DEBUG=70]="DEBUG",r[r.VERBOSE=80]="VERBOSE",r[r.ALL=9999]="ALL"})(e=t.DiagLogLevel||(t.DiagLogLevel={}))}),z5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createLogLevelDiagLogger=void 0;var e=zx();function r(i,n){i<e.DiagLogLevel.NONE?i=e.DiagLogLevel.NONE:i>e.DiagLogLevel.ALL&&(i=e.DiagLogLevel.ALL),n=n||{};function o(s,a){let u=n[s];return typeof u=="function"&&i>=a?u.bind(n):function(){}}return{error:o("error",e.DiagLogLevel.ERROR),warn:o("warn",e.DiagLogLevel.WARN),info:o("info",e.DiagLogLevel.INFO),debug:o("debug",e.DiagLogLevel.DEBUG),verbose:o("verbose",e.DiagLogLevel.VERBOSE)}}t.createLogLevelDiagLogger=r}),Vu=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiagAPI=void 0;var e=O5(),r=z5(),i=zx(),n=Fu(),o="diag";class s{constructor(){function u(d){return function(...p){let f=(0,n.getGlobal)("diag");if(f)return f[d](...p)}}let l=this,c=(d,p={logLevel:i.DiagLogLevel.INFO})=>{var f,m,g;if(d===l){let y=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return l.error((f=y.stack)!==null&&f!==void 0?f:y.message),!1}typeof p=="number"&&(p={logLevel:p});let v=(0,n.getGlobal)("diag"),h=(0,r.createLogLevelDiagLogger)((m=p.logLevel)!==null&&m!==void 0?m:i.DiagLogLevel.INFO,d);if(v&&!p.suppressOverrideMessage){let y=(g=Error().stack)!==null&&g!==void 0?g:"<failed to generate stacktrace>";v.warn(`Current logger will be overwritten from ${y}`),h.warn(`Current logger will overwrite one already registered from ${y}`)}return(0,n.registerGlobal)("diag",h,l,!0)};l.setLogger=c,l.disable=()=>{(0,n.unregisterGlobal)(o,l)},l.createComponentLogger=d=>new e.DiagComponentLogger(d),l.verbose=u("verbose"),l.debug=u("debug"),l.info=u("info"),l.warn=u("warn"),l.error=u("error")}static instance(){return this._instance||(this._instance=new s),this._instance}}t.DiagAPI=s}),N5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaggageImpl=void 0;class e{constructor(i){this._entries=i?new Map(i):new Map}getEntry(i){let n=this._entries.get(i);if(n)return Object.assign({},n)}getAllEntries(){return Array.from(this._entries.entries()).map(([i,n])=>[i,n])}setEntry(i,n){let o=new e(this._entries);return o._entries.set(i,n),o}removeEntry(i){let n=new e(this._entries);return n._entries.delete(i),n}removeEntries(...i){let n=new e(this._entries);for(let o of i)n._entries.delete(o);return n}clear(){return new e}}t.BaggageImpl=e}),j5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.baggageEntryMetadataSymbol=void 0,t.baggageEntryMetadataSymbol=Symbol("BaggageEntryMetadata")}),pA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.baggageEntryMetadataFromString=t.createBaggage=void 0;var e=Vu(),r=N5(),i=j5(),n=e.DiagAPI.instance();function o(a={}){return new r.BaggageImpl(new Map(Object.entries(a)))}t.createBaggage=o;function s(a){return typeof a!="string"&&(n.error(`Cannot create baggage metadata from unknown type: ${typeof a}`),a=""),{__TYPE__:i.baggageEntryMetadataSymbol,toString(){return a}}}t.baggageEntryMetadataFromString=s}),xg=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ROOT_CONTEXT=t.createContextKey=void 0;function e(i){return Symbol.for(i)}t.createContextKey=e;class r{constructor(n){let o=this;o._currentContext=n?new Map(n):new Map,o.getValue=s=>o._currentContext.get(s),o.setValue=(s,a)=>{let u=new r(o._currentContext);return u._currentContext.set(s,a),u},o.deleteValue=s=>{let a=new r(o._currentContext);return a._currentContext.delete(s),a}}}t.ROOT_CONTEXT=new r}),C5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiagConsoleLogger=void 0;var e=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}];class r{constructor(){function n(o){return function(...s){if(console){let a=console[o];if(typeof a!="function"&&(a=console.log),typeof a=="function")return a.apply(console,s)}}}for(let o=0;o<e.length;o++)this[e[o].n]=n(e[o].c)}}t.DiagConsoleLogger=r}),mA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createNoopMeter=t.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=t.NOOP_OBSERVABLE_GAUGE_METRIC=t.NOOP_OBSERVABLE_COUNTER_METRIC=t.NOOP_UP_DOWN_COUNTER_METRIC=t.NOOP_HISTOGRAM_METRIC=t.NOOP_GAUGE_METRIC=t.NOOP_COUNTER_METRIC=t.NOOP_METER=t.NoopObservableUpDownCounterMetric=t.NoopObservableGaugeMetric=t.NoopObservableCounterMetric=t.NoopObservableMetric=t.NoopHistogramMetric=t.NoopGaugeMetric=t.NoopUpDownCounterMetric=t.NoopCounterMetric=t.NoopMetric=t.NoopMeter=void 0;class e{constructor(){}createGauge(f,m){return t.NOOP_GAUGE_METRIC}createHistogram(f,m){return t.NOOP_HISTOGRAM_METRIC}createCounter(f,m){return t.NOOP_COUNTER_METRIC}createUpDownCounter(f,m){return t.NOOP_UP_DOWN_COUNTER_METRIC}createObservableGauge(f,m){return t.NOOP_OBSERVABLE_GAUGE_METRIC}createObservableCounter(f,m){return t.NOOP_OBSERVABLE_COUNTER_METRIC}createObservableUpDownCounter(f,m){return t.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC}addBatchObservableCallback(f,m){}removeBatchObservableCallback(f){}}t.NoopMeter=e;class r{}t.NoopMetric=r;class i extends r{add(f,m){}}t.NoopCounterMetric=i;class n extends r{add(f,m){}}t.NoopUpDownCounterMetric=n;class o extends r{record(f,m){}}t.NoopGaugeMetric=o;class s extends r{record(f,m){}}t.NoopHistogramMetric=s;class a{addCallback(f){}removeCallback(f){}}t.NoopObservableMetric=a;class u extends a{}t.NoopObservableCounterMetric=u;class l extends a{}t.NoopObservableGaugeMetric=l;class c extends a{}t.NoopObservableUpDownCounterMetric=c,t.NOOP_METER=new e,t.NOOP_COUNTER_METRIC=new i,t.NOOP_GAUGE_METRIC=new o,t.NOOP_HISTOGRAM_METRIC=new s,t.NOOP_UP_DOWN_COUNTER_METRIC=new n,t.NOOP_OBSERVABLE_COUNTER_METRIC=new u,t.NOOP_OBSERVABLE_GAUGE_METRIC=new l,t.NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC=new c;function d(){return t.NOOP_METER}t.createNoopMeter=d}),R5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueType=void 0;var e;(function(r){r[r.INT=0]="INT",r[r.DOUBLE=1]="DOUBLE"})(e=t.ValueType||(t.ValueType={}))}),hA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.defaultTextMapSetter=t.defaultTextMapGetter=void 0,t.defaultTextMapGetter={get(e,r){if(e!=null)return e[r]},keys(e){return e==null?[]:Object.keys(e)}},t.defaultTextMapSetter={set(e,r,i){e!=null&&(e[r]=i)}}}),A5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NoopContextManager=void 0;var e=xg();class r{active(){return e.ROOT_CONTEXT}with(n,o,s,...a){return o.call(s,...a)}bind(n,o){return o}enable(){return this}disable(){return this}}t.NoopContextManager=r}),$g=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ContextAPI=void 0;var e=A5(),r=Fu(),i=Vu(),n="context",o=new e.NoopContextManager;class s{constructor(){}static getInstance(){return this._instance||(this._instance=new s),this._instance}setGlobalContextManager(u){return(0,r.registerGlobal)(n,u,i.DiagAPI.instance())}active(){return this._getContextManager().active()}with(u,l,c,...d){return this._getContextManager().with(u,l,c,...d)}bind(u,l){return this._getContextManager().bind(u,l)}_getContextManager(){return(0,r.getGlobal)(n)||o}disable(){this._getContextManager().disable(),(0,r.unregisterGlobal)(n,i.DiagAPI.instance())}}t.ContextAPI=s}),gA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TraceFlags=void 0;var e;(function(r){r[r.NONE=0]="NONE",r[r.SAMPLED=1]="SAMPLED"})(e=t.TraceFlags||(t.TraceFlags={}))}),Nx=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.INVALID_SPAN_CONTEXT=t.INVALID_TRACEID=t.INVALID_SPANID=void 0;var e=gA();t.INVALID_SPANID="0000000000000000",t.INVALID_TRACEID="00000000000000000000000000000000",t.INVALID_SPAN_CONTEXT={traceId:t.INVALID_TRACEID,spanId:t.INVALID_SPANID,traceFlags:e.TraceFlags.NONE}}),jx=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NonRecordingSpan=void 0;var e=Nx();class r{constructor(n=e.INVALID_SPAN_CONTEXT){this._spanContext=n}spanContext(){return this._spanContext}setAttribute(n,o){return this}setAttributes(n){return this}addEvent(n,o){return this}addLink(n){return this}addLinks(n){return this}setStatus(n){return this}updateName(n){return this}end(n){}isRecording(){return!1}recordException(n,o){}}t.NonRecordingSpan=r}),yA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSpanContext=t.setSpanContext=t.deleteSpan=t.setSpan=t.getActiveSpan=t.getSpan=void 0;var e=xg(),r=jx(),i=$g(),n=(0,e.createContextKey)("OpenTelemetry Context Key SPAN");function o(d){return d.getValue(n)||void 0}t.getSpan=o;function s(){return o(i.ContextAPI.getInstance().active())}t.getActiveSpan=s;function a(d,p){return d.setValue(n,p)}t.setSpan=a;function u(d){return d.deleteValue(n)}t.deleteSpan=u;function l(d,p){return a(d,new r.NonRecordingSpan(p))}t.setSpanContext=l;function c(d){var p;return(p=o(d))===null||p===void 0?void 0:p.spanContext()}t.getSpanContext=c}),Cx=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.wrapSpanContext=t.isSpanContextValid=t.isValidSpanId=t.isValidTraceId=void 0;var e=Nx(),r=jx(),i=/^([0-9a-f]{32})$/i,n=/^[0-9a-f]{16}$/i;function o(l){return i.test(l)&&l!==e.INVALID_TRACEID}t.isValidTraceId=o;function s(l){return n.test(l)&&l!==e.INVALID_SPANID}t.isValidSpanId=s;function a(l){return o(l.traceId)&&s(l.spanId)}t.isSpanContextValid=a;function u(l){return new r.NonRecordingSpan(l)}t.wrapSpanContext=u}),vA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NoopTracer=void 0;var e=$g(),r=yA(),i=jx(),n=Cx(),o=e.ContextAPI.getInstance();class s{startSpan(l,c,d=o.active()){if(c?.root)return new i.NonRecordingSpan;let p=d&&(0,r.getSpanContext)(d);return a(p)&&(0,n.isSpanContextValid)(p)?new i.NonRecordingSpan(p):new i.NonRecordingSpan}startActiveSpan(l,c,d,p){let f,m,g;if(arguments.length<2)return;arguments.length===2?g=c:arguments.length===3?(f=c,g=d):(f=c,m=d,g=p);let v=m??o.active(),h=this.startSpan(l,f,v),y=(0,r.setSpan)(v,h);return o.with(y,g,void 0,h)}}t.NoopTracer=s;function a(u){return typeof u=="object"&&typeof u.spanId=="string"&&typeof u.traceId=="string"&&typeof u.traceFlags=="number"}}),_A=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProxyTracer=void 0;var e=vA(),r=new e.NoopTracer;class i{constructor(o,s,a,u){this._provider=o,this.name=s,this.version=a,this.options=u}startSpan(o,s,a){return this._getTracer().startSpan(o,s,a)}startActiveSpan(o,s,a,u){let l=this._getTracer();return Reflect.apply(l.startActiveSpan,l,arguments)}_getTracer(){if(this._delegate)return this._delegate;let o=this._provider.getDelegateTracer(this.name,this.version,this.options);return o?(this._delegate=o,this._delegate):r}}t.ProxyTracer=i}),D5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NoopTracerProvider=void 0;var e=vA();class r{getTracer(n,o,s){return new e.NoopTracer}}t.NoopTracerProvider=r}),bA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProxyTracerProvider=void 0;var e=_A(),r=D5(),i=new r.NoopTracerProvider;class n{getTracer(s,a,u){var l;return(l=this.getDelegateTracer(s,a,u))!==null&&l!==void 0?l:new e.ProxyTracer(this,s,a,u)}getDelegate(){var s;return(s=this._delegate)!==null&&s!==void 0?s:i}setDelegate(s){this._delegate=s}getDelegateTracer(s,a,u){var l;return(l=this._delegate)===null||l===void 0?void 0:l.getTracer(s,a,u)}}t.ProxyTracerProvider=n}),U5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SamplingDecision=void 0;var e;(function(r){r[r.NOT_RECORD=0]="NOT_RECORD",r[r.RECORD=1]="RECORD",r[r.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(e=t.SamplingDecision||(t.SamplingDecision={}))}),M5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SpanKind=void 0;var e;(function(r){r[r.INTERNAL=0]="INTERNAL",r[r.SERVER=1]="SERVER",r[r.CLIENT=2]="CLIENT",r[r.PRODUCER=3]="PRODUCER",r[r.CONSUMER=4]="CONSUMER"})(e=t.SpanKind||(t.SpanKind={}))}),Z5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SpanStatusCode=void 0;var e;(function(r){r[r.UNSET=0]="UNSET",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR"})(e=t.SpanStatusCode||(t.SpanStatusCode={}))}),L5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateValue=t.validateKey=void 0;var e="[_0-9a-z-*/]",r=`[a-z]${e}{0,255}`,i=`[a-z0-9]${e}{0,240}@[a-z]${e}{0,13}`,n=new RegExp(`^(?:${r}|${i})$`),o=/^[ -~]{0,255}[!-~]$/,s=/,|=/;function a(l){return n.test(l)}t.validateKey=a;function u(l){return o.test(l)&&!s.test(l)}t.validateValue=u}),q5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TraceStateImpl=void 0;var e=L5(),r=32,i=512,n=",",o="=";class s{constructor(u){this._internalState=new Map,u&&this._parse(u)}set(u,l){let c=this._clone();return c._internalState.has(u)&&c._internalState.delete(u),c._internalState.set(u,l),c}unset(u){let l=this._clone();return l._internalState.delete(u),l}get(u){return this._internalState.get(u)}serialize(){return this._keys().reduce((u,l)=>(u.push(l+o+this.get(l)),u),[]).join(n)}_parse(u){u.length>i||(this._internalState=u.split(n).reverse().reduce((l,c)=>{let d=c.trim(),p=d.indexOf(o);if(p!==-1){let f=d.slice(0,p),m=d.slice(p+1,c.length);(0,e.validateKey)(f)&&(0,e.validateValue)(m)&&l.set(f,m)}return l},new Map),this._internalState.size>r&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,r))))}_keys(){return Array.from(this._internalState.keys()).reverse()}_clone(){let u=new s;return u._internalState=new Map(this._internalState),u}}t.TraceStateImpl=s}),F5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createTraceState=void 0;var e=q5();function r(i){return new e.TraceStateImpl(i)}t.createTraceState=r}),V5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.context=void 0;var e=$g();t.context=e.ContextAPI.getInstance()}),W5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.diag=void 0;var e=Vu();t.diag=e.DiagAPI.instance()}),G5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NOOP_METER_PROVIDER=t.NoopMeterProvider=void 0;var e=mA();class r{getMeter(n,o,s){return e.NOOP_METER}}t.NoopMeterProvider=r,t.NOOP_METER_PROVIDER=new r}),B5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MetricsAPI=void 0;var e=G5(),r=Fu(),i=Vu(),n="metrics";class o{constructor(){}static getInstance(){return this._instance||(this._instance=new o),this._instance}setGlobalMeterProvider(a){return(0,r.registerGlobal)(n,a,i.DiagAPI.instance())}getMeterProvider(){return(0,r.getGlobal)(n)||e.NOOP_METER_PROVIDER}getMeter(a,u,l){return this.getMeterProvider().getMeter(a,u,l)}disable(){(0,r.unregisterGlobal)(n,i.DiagAPI.instance())}}t.MetricsAPI=o}),K5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.metrics=void 0;var e=B5();t.metrics=e.MetricsAPI.getInstance()}),H5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NoopTextMapPropagator=void 0;class e{inject(i,n){}extract(i,n){return i}fields(){return[]}}t.NoopTextMapPropagator=e}),J5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deleteBaggage=t.setBaggage=t.getActiveBaggage=t.getBaggage=void 0;var e=$g(),r=xg(),i=(0,r.createContextKey)("OpenTelemetry Baggage Key");function n(u){return u.getValue(i)||void 0}t.getBaggage=n;function o(){return n(e.ContextAPI.getInstance().active())}t.getActiveBaggage=o;function s(u,l){return u.setValue(i,l)}t.setBaggage=s;function a(u){return u.deleteValue(i)}t.deleteBaggage=a}),Y5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PropagationAPI=void 0;var e=Fu(),r=H5(),i=hA(),n=J5(),o=pA(),s=Vu(),a="propagation",u=new r.NoopTextMapPropagator;class l{constructor(){this.createBaggage=o.createBaggage,this.getBaggage=n.getBaggage,this.getActiveBaggage=n.getActiveBaggage,this.setBaggage=n.setBaggage,this.deleteBaggage=n.deleteBaggage}static getInstance(){return this._instance||(this._instance=new l),this._instance}setGlobalPropagator(d){return(0,e.registerGlobal)(a,d,s.DiagAPI.instance())}inject(d,p,f=i.defaultTextMapSetter){return this._getGlobalPropagator().inject(d,p,f)}extract(d,p,f=i.defaultTextMapGetter){return this._getGlobalPropagator().extract(d,p,f)}fields(){return this._getGlobalPropagator().fields()}disable(){(0,e.unregisterGlobal)(a,s.DiagAPI.instance())}_getGlobalPropagator(){return(0,e.getGlobal)(a)||u}}t.PropagationAPI=l}),Q5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.propagation=void 0;var e=Y5();t.propagation=e.PropagationAPI.getInstance()}),X5=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TraceAPI=void 0;var e=Fu(),r=bA(),i=Cx(),n=yA(),o=Vu(),s="trace";class a{constructor(){this._proxyTracerProvider=new r.ProxyTracerProvider,this.wrapSpanContext=i.wrapSpanContext,this.isSpanContextValid=i.isSpanContextValid,this.deleteSpan=n.deleteSpan,this.getSpan=n.getSpan,this.getActiveSpan=n.getActiveSpan,this.getSpanContext=n.getSpanContext,this.setSpan=n.setSpan,this.setSpanContext=n.setSpanContext}static getInstance(){return this._instance||(this._instance=new a),this._instance}setGlobalTracerProvider(l){let c=(0,e.registerGlobal)(s,this._proxyTracerProvider,o.DiagAPI.instance());return c&&this._proxyTracerProvider.setDelegate(l),c}getTracerProvider(){return(0,e.getGlobal)(s)||this._proxyTracerProvider}getTracer(l,c){return this.getTracerProvider().getTracer(l,c)}disable(){(0,e.unregisterGlobal)(s,o.DiagAPI.instance()),this._proxyTracerProvider=new r.ProxyTracerProvider}}t.TraceAPI=a}),eJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.trace=void 0;var e=X5();t.trace=e.TraceAPI.getInstance()}),wA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.trace=t.propagation=t.metrics=t.diag=t.context=t.INVALID_SPAN_CONTEXT=t.INVALID_TRACEID=t.INVALID_SPANID=t.isValidSpanId=t.isValidTraceId=t.isSpanContextValid=t.createTraceState=t.TraceFlags=t.SpanStatusCode=t.SpanKind=t.SamplingDecision=t.ProxyTracerProvider=t.ProxyTracer=t.defaultTextMapSetter=t.defaultTextMapGetter=t.ValueType=t.createNoopMeter=t.DiagLogLevel=t.DiagConsoleLogger=t.ROOT_CONTEXT=t.createContextKey=t.baggageEntryMetadataFromString=void 0;var e=pA();Object.defineProperty(t,"baggageEntryMetadataFromString",{enumerable:!0,get:function(){return e.baggageEntryMetadataFromString}});var r=xg();Object.defineProperty(t,"createContextKey",{enumerable:!0,get:function(){return r.createContextKey}}),Object.defineProperty(t,"ROOT_CONTEXT",{enumerable:!0,get:function(){return r.ROOT_CONTEXT}});var i=C5();Object.defineProperty(t,"DiagConsoleLogger",{enumerable:!0,get:function(){return i.DiagConsoleLogger}});var n=zx();Object.defineProperty(t,"DiagLogLevel",{enumerable:!0,get:function(){return n.DiagLogLevel}});var o=mA();Object.defineProperty(t,"createNoopMeter",{enumerable:!0,get:function(){return o.createNoopMeter}});var s=R5();Object.defineProperty(t,"ValueType",{enumerable:!0,get:function(){return s.ValueType}});var a=hA();Object.defineProperty(t,"defaultTextMapGetter",{enumerable:!0,get:function(){return a.defaultTextMapGetter}}),Object.defineProperty(t,"defaultTextMapSetter",{enumerable:!0,get:function(){return a.defaultTextMapSetter}});var u=_A();Object.defineProperty(t,"ProxyTracer",{enumerable:!0,get:function(){return u.ProxyTracer}});var l=bA();Object.defineProperty(t,"ProxyTracerProvider",{enumerable:!0,get:function(){return l.ProxyTracerProvider}});var c=U5();Object.defineProperty(t,"SamplingDecision",{enumerable:!0,get:function(){return c.SamplingDecision}});var d=M5();Object.defineProperty(t,"SpanKind",{enumerable:!0,get:function(){return d.SpanKind}});var p=Z5();Object.defineProperty(t,"SpanStatusCode",{enumerable:!0,get:function(){return p.SpanStatusCode}});var f=gA();Object.defineProperty(t,"TraceFlags",{enumerable:!0,get:function(){return f.TraceFlags}});var m=F5();Object.defineProperty(t,"createTraceState",{enumerable:!0,get:function(){return m.createTraceState}});var g=Cx();Object.defineProperty(t,"isSpanContextValid",{enumerable:!0,get:function(){return g.isSpanContextValid}}),Object.defineProperty(t,"isValidTraceId",{enumerable:!0,get:function(){return g.isValidTraceId}}),Object.defineProperty(t,"isValidSpanId",{enumerable:!0,get:function(){return g.isValidSpanId}});var v=Nx();Object.defineProperty(t,"INVALID_SPANID",{enumerable:!0,get:function(){return v.INVALID_SPANID}}),Object.defineProperty(t,"INVALID_TRACEID",{enumerable:!0,get:function(){return v.INVALID_TRACEID}}),Object.defineProperty(t,"INVALID_SPAN_CONTEXT",{enumerable:!0,get:function(){return v.INVALID_SPAN_CONTEXT}});var h=V5();Object.defineProperty(t,"context",{enumerable:!0,get:function(){return h.context}});var y=W5();Object.defineProperty(t,"diag",{enumerable:!0,get:function(){return y.diag}});var _=K5();Object.defineProperty(t,"metrics",{enumerable:!0,get:function(){return _.metrics}});var b=Q5();Object.defineProperty(t,"propagation",{enumerable:!0,get:function(){return b.propagation}});var w=eJ();Object.defineProperty(t,"trace",{enumerable:!0,get:function(){return w.trace}}),t.default={context:h.context,diag:y.diag,metrics:_.metrics,propagation:b.propagation,trace:w.trace}}),jh=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class e{}t._CodeOrName=e,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends e{constructor(y){if(super(),!t.IDENTIFIER.test(y))throw Error("CodeGen: name must be a valid identifier");this.str=y}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=r;class i extends e{constructor(y){super(),this._items=typeof y=="string"?[y]:y}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let y=this._items[0];return y===""||y==='""'}get str(){var y;return(y=this._str)!==null&&y!==void 0?y:this._str=this._items.reduce((_,b)=>`${_}${b}`,"")}get names(){var y;return(y=this._names)!==null&&y!==void 0?y:this._names=this._items.reduce((_,b)=>(b instanceof r&&(_[b.str]=(_[b.str]||0)+1),_),{})}}t._Code=i,t.nil=new i("");function n(h,...y){let _=[h[0]],b=0;for(;b<y.length;)a(_,y[b]),_.push(h[++b]);return new i(_)}t._=n;var o=new i("+");function s(h,...y){let _=[f(h[0])],b=0;for(;b<y.length;)_.push(o),a(_,y[b]),_.push(o,f(h[++b]));return u(_),new i(_)}t.str=s;function a(h,y){y instanceof i?h.push(...y._items):y instanceof r?h.push(y):h.push(d(y))}t.addCodeArg=a;function u(h){let y=1;for(;y<h.length-1;){if(h[y]===o){let _=l(h[y-1],h[y+1]);if(_!==void 0){h.splice(y-1,3,_);continue}h[y++]="+"}y++}}function l(h,y){if(y==='""')return h;if(h==='""')return y;if(typeof h=="string")return y instanceof r||h[h.length-1]!=='"'?void 0:typeof y!="string"?`${h.slice(0,-1)}${y}"`:y[0]==='"'?h.slice(0,-1)+y.slice(1):void 0;if(typeof y=="string"&&y[0]==='"'&&!(h instanceof r))return`"${h}${y.slice(1)}`}function c(h,y){return y.emptyStr()?h:h.emptyStr()?y:s`${h}${y}`}t.strConcat=c;function d(h){return typeof h=="number"||typeof h=="boolean"||h===null?h:f(Array.isArray(h)?h.join(","):h)}function p(h){return new i(f(h))}t.stringify=p;function f(h){return JSON.stringify(h).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.safeStringify=f;function m(h){return typeof h=="string"&&t.IDENTIFIER.test(h)?new i(`.${h}`):n`[${h}]`}t.getProperty=m;function g(h){if(typeof h=="string"&&t.IDENTIFIER.test(h))return new i(`${h}`);throw Error(`CodeGen: invalid export name: ${h}, use explicit $id name mapping`)}t.getEsmExportName=g;function v(h){return new i(h.toString())}t.regexpCode=v}),eR=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;var e=jh();class r extends Error{constructor(l){super(`CodeGen: "code" for ${l} not defined`),this.value=l.value}}var i;(function(u){u[u.Started=0]="Started",u[u.Completed=1]="Completed"})(i||(t.UsedValueState=i={})),t.varKinds={const:new e.Name("const"),let:new e.Name("let"),var:new e.Name("var")};class n{constructor({prefixes:l,parent:c}={}){this._names={},this._prefixes=l,this._parent=c}toName(l){return l instanceof e.Name?l:this.name(l)}name(l){return new e.Name(this._newName(l))}_newName(l){let c=this._names[l]||this._nameGroup(l);return`${l}${c.index++}`}_nameGroup(l){var c,d;if(!((d=(c=this._parent)===null||c===void 0?void 0:c._prefixes)===null||d===void 0)&&d.has(l)||this._prefixes&&!this._prefixes.has(l))throw Error(`CodeGen: prefix "${l}" is not allowed in this scope`);return this._names[l]={prefix:l,index:0}}}t.Scope=n;class o extends e.Name{constructor(l,c){super(c),this.prefix=l}setValue(l,{property:c,itemIndex:d}){this.value=l,this.scopePath=e._`.${new e.Name(c)}[${d}]`}}t.ValueScopeName=o;var s=e._`\n`;class a extends n{constructor(l){super(l),this._values={},this._scope=l.scope,this.opts={...l,_n:l.lines?s:e.nil}}get(){return this._scope}name(l){return new o(l,this._newName(l))}value(l,c){var d;if(c.ref===void 0)throw Error("CodeGen: ref must be passed in value");let p=this.toName(l),{prefix:f}=p,m=(d=c.key)!==null&&d!==void 0?d:c.ref,g=this._values[f];if(g){let y=g.get(m);if(y)return y}else g=this._values[f]=new Map;g.set(m,p);let v=this._scope[f]||(this._scope[f]=[]),h=v.length;return v[h]=c.ref,p.setValue(c,{property:f,itemIndex:h}),p}getValue(l,c){let d=this._values[l];if(d)return d.get(c)}scopeRefs(l,c=this._values){return this._reduceValues(c,d=>{if(d.scopePath===void 0)throw Error(`CodeGen: name "${d}" has no value`);return e._`${l}${d.scopePath}`})}scopeCode(l=this._values,c,d){return this._reduceValues(l,p=>{if(p.value===void 0)throw Error(`CodeGen: name "${p}" has no value`);return p.value.code},c,d)}_reduceValues(l,c,d={},p){let f=e.nil;for(let m in l){let g=l[m];if(!g)continue;let v=d[m]=d[m]||new Map;g.forEach(h=>{if(v.has(h))return;v.set(h,i.Started);let y=c(h);if(y){let _=this.opts.es5?t.varKinds.var:t.varKinds.const;f=e._`${f}${_} ${h} = ${y};${this.opts._n}`}else if(y=p?.(h))f=e._`${f}${y}${this.opts._n}`;else throw new r(h);v.set(h,i.Completed)})}return f}}t.ValueScope=a}),Je=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;var e=jh(),r=eR(),i=jh();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}});var n=eR();Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),t.operators={GT:new e._Code(">"),GTE:new e._Code(">="),LT:new e._Code("<"),LTE:new e._Code("<="),EQ:new e._Code("==="),NEQ:new e._Code("!=="),NOT:new e._Code("!"),OR:new e._Code("||"),AND:new e._Code("&&"),ADD:new e._Code("+")};class o{optimizeNodes(){return this}optimizeNames(x,E){return this}}class s extends o{constructor(x,E,W){super(),this.varKind=x,this.name=E,this.rhs=W}render({es5:x,_n:E}){let W=x?r.varKinds.var:this.varKind,he=this.rhs===void 0?"":` = ${this.rhs}`;return`${W} ${this.name}${he};`+E}optimizeNames(x,E){if(x[this.name.str])return this.rhs&&(this.rhs=O(this.rhs,x,E)),this}get names(){return this.rhs instanceof e._CodeOrName?this.rhs.names:{}}}class a extends o{constructor(x,E,W){super(),this.lhs=x,this.rhs=E,this.sideEffects=W}render({_n:x}){return`${this.lhs} = ${this.rhs};`+x}optimizeNames(x,E){if(!(this.lhs instanceof e.Name&&!x[this.lhs.str]&&!this.sideEffects))return this.rhs=O(this.rhs,x,E),this}get names(){let x=this.lhs instanceof e.Name?{}:{...this.lhs.names};return q(x,this.rhs)}}class u extends a{constructor(x,E,W,he){super(x,W,he),this.op=E}render({_n:x}){return`${this.lhs} ${this.op}= ${this.rhs};`+x}}class l extends o{constructor(x){super(),this.label=x,this.names={}}render({_n:x}){return`${this.label}:`+x}}class c extends o{constructor(x){super(),this.label=x,this.names={}}render({_n:x}){return`break${this.label?` ${this.label}`:""};`+x}}class d extends o{constructor(x){super(),this.error=x}render({_n:x}){return`throw ${this.error};`+x}get names(){return this.error.names}}class p extends o{constructor(x){super(),this.code=x}render({_n:x}){return`${this.code};`+x}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(x,E){return this.code=O(this.code,x,E),this}get names(){return this.code instanceof e._CodeOrName?this.code.names:{}}}class f extends o{constructor(x=[]){super(),this.nodes=x}render(x){return this.nodes.reduce((E,W)=>E+W.render(x),"")}optimizeNodes(){let{nodes:x}=this,E=x.length;for(;E--;){let W=x[E].optimizeNodes();Array.isArray(W)?x.splice(E,1,...W):W?x[E]=W:x.splice(E,1)}return x.length>0?this:void 0}optimizeNames(x,E){let{nodes:W}=this,he=W.length;for(;he--;){let me=W[he];me.optimizeNames(x,E)||(Q(x,me.names),W.splice(he,1))}return W.length>0?this:void 0}get names(){return this.nodes.reduce((x,E)=>R(x,E.names),{})}}class m extends f{render(x){return"{"+x._n+super.render(x)+"}"+x._n}}class g extends f{}class v extends m{}v.kind="else";class h extends m{constructor(x,E){super(E),this.condition=x}render(x){let E=`if(${this.condition})`+super.render(x);return this.else&&(E+="else "+this.else.render(x)),E}optimizeNodes(){super.optimizeNodes();let x=this.condition;if(x===!0)return this.nodes;let E=this.else;if(E){let W=E.optimizeNodes();E=this.else=Array.isArray(W)?new v(W):W}if(E)return x===!1?E instanceof h?E:E.nodes:this.nodes.length?this:new h(K(x),E instanceof h?[E]:E.nodes);if(!(x===!1||!this.nodes.length))return this}optimizeNames(x,E){var W;if(this.else=(W=this.else)===null||W===void 0?void 0:W.optimizeNames(x,E),!!(super.optimizeNames(x,E)||this.else))return this.condition=O(this.condition,x,E),this}get names(){let x=super.names;return q(x,this.condition),this.else&&R(x,this.else.names),x}}h.kind="if";class y extends m{}y.kind="for";class _ extends y{constructor(x){super(),this.iteration=x}render(x){return`for(${this.iteration})`+super.render(x)}optimizeNames(x,E){if(super.optimizeNames(x,E))return this.iteration=O(this.iteration,x,E),this}get names(){return R(super.names,this.iteration.names)}}class b extends y{constructor(x,E,W,he){super(),this.varKind=x,this.name=E,this.from=W,this.to=he}render(x){let E=x.es5?r.varKinds.var:this.varKind,{name:W,from:he,to:me}=this;return`for(${E} ${W}=${he}; ${W}<${me}; ${W}++)`+super.render(x)}get names(){let x=q(super.names,this.from);return q(x,this.to)}}class w extends y{constructor(x,E,W,he){super(),this.loop=x,this.varKind=E,this.name=W,this.iterable=he}render(x){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(x)}optimizeNames(x,E){if(super.optimizeNames(x,E))return this.iterable=O(this.iterable,x,E),this}get names(){return R(super.names,this.iterable.names)}}class S extends m{constructor(x,E,W){super(),this.name=x,this.args=E,this.async=W}render(x){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(x)}}S.kind="func";class k extends f{render(x){return"return "+super.render(x)}}k.kind="return";class $ extends m{render(x){let E="try"+super.render(x);return this.catch&&(E+=this.catch.render(x)),this.finally&&(E+=this.finally.render(x)),E}optimizeNodes(){var x,E;return super.optimizeNodes(),(x=this.catch)===null||x===void 0||x.optimizeNodes(),(E=this.finally)===null||E===void 0||E.optimizeNodes(),this}optimizeNames(x,E){var W,he;return super.optimizeNames(x,E),(W=this.catch)===null||W===void 0||W.optimizeNames(x,E),(he=this.finally)===null||he===void 0||he.optimizeNames(x,E),this}get names(){let x=super.names;return this.catch&&R(x,this.catch.names),this.finally&&R(x,this.finally.names),x}}class P extends m{constructor(x){super(),this.error=x}render(x){return`catch(${this.error})`+super.render(x)}}P.kind="catch";class j extends m{render(x){return"finally"+super.render(x)}}j.kind="finally";class I{constructor(x,E={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...E,_n:E.lines?`
128
- `:""},this._extScope=x,this._scope=new r.Scope({parent:x}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name(x){return this._scope.name(x)}scopeName(x){return this._extScope.name(x)}scopeValue(x,E){let W=this._extScope.value(x,E);return(this._values[W.prefix]||(this._values[W.prefix]=new Set)).add(W),W}getScopeValue(x,E){return this._extScope.getValue(x,E)}scopeRefs(x){return this._extScope.scopeRefs(x,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(x,E,W,he){let me=this._scope.toName(E);return W!==void 0&&he&&(this._constants[me.str]=W),this._leafNode(new s(x,me,W)),me}const(x,E,W){return this._def(r.varKinds.const,x,E,W)}let(x,E,W){return this._def(r.varKinds.let,x,E,W)}var(x,E,W){return this._def(r.varKinds.var,x,E,W)}assign(x,E,W){return this._leafNode(new a(x,E,W))}add(x,E){return this._leafNode(new u(x,t.operators.ADD,E))}code(x){return typeof x=="function"?x():x!==e.nil&&this._leafNode(new p(x)),this}object(...x){let E=["{"];for(let[W,he]of x)E.length>1&&E.push(","),E.push(W),(W!==he||this.opts.es5)&&(E.push(":"),(0,e.addCodeArg)(E,he));return E.push("}"),new e._Code(E)}if(x,E,W){if(this._blockNode(new h(x)),E&&W)this.code(E).else().code(W).endIf();else if(E)this.code(E).endIf();else if(W)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(x){return this._elseNode(new h(x))}else(){return this._elseNode(new v)}endIf(){return this._endBlockNode(h,v)}_for(x,E){return this._blockNode(x),E&&this.code(E).endFor(),this}for(x,E){return this._for(new _(x),E)}forRange(x,E,W,he,me=this.opts.es5?r.varKinds.var:r.varKinds.let){let vt=this._scope.toName(x);return this._for(new b(me,vt,E,W),()=>he(vt))}forOf(x,E,W,he=r.varKinds.const){let me=this._scope.toName(x);if(this.opts.es5){let vt=E instanceof e.Name?E:this.var("_arr",E);return this.forRange("_i",0,e._`${vt}.length`,ct=>{this.var(me,e._`${vt}[${ct}]`),W(me)})}return this._for(new w("of",he,me,E),()=>W(me))}forIn(x,E,W,he=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf(x,e._`Object.keys(${E})`,W);let me=this._scope.toName(x);return this._for(new w("in",he,me,E),()=>W(me))}endFor(){return this._endBlockNode(y)}label(x){return this._leafNode(new l(x))}break(x){return this._leafNode(new c(x))}return(x){let E=new k;if(this._blockNode(E),this.code(x),E.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(x,E,W){if(!E&&!W)throw Error('CodeGen: "try" without "catch" and "finally"');let he=new $;if(this._blockNode(he),this.code(x),E){let me=this.name("e");this._currNode=he.catch=new P(me),E(me)}return W&&(this._currNode=he.finally=new j,this.code(W)),this._endBlockNode(P,j)}throw(x){return this._leafNode(new d(x))}block(x,E){return this._blockStarts.push(this._nodes.length),x&&this.code(x).endBlock(E),this}endBlock(x){let E=this._blockStarts.pop();if(E===void 0)throw Error("CodeGen: not in self-balancing block");let W=this._nodes.length-E;if(W<0||x!==void 0&&W!==x)throw Error(`CodeGen: wrong number of nodes: ${W} vs ${x} expected`);return this._nodes.length=E,this}func(x,E=e.nil,W,he){return this._blockNode(new S(x,E,W)),he&&this.code(he).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(x=1){for(;x-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(x){return this._currNode.nodes.push(x),this}_blockNode(x){this._currNode.nodes.push(x),this._nodes.push(x)}_endBlockNode(x,E){let W=this._currNode;if(W instanceof x||E&&W instanceof E)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${E?`${x.kind}/${E.kind}`:x.kind}"`)}_elseNode(x){let E=this._currNode;if(!(E instanceof h))throw Error('CodeGen: "else" without "if"');return this._currNode=E.else=x,this}get _root(){return this._nodes[0]}get _currNode(){let x=this._nodes;return x[x.length-1]}set _currNode(x){let E=this._nodes;E[E.length-1]=x}}t.CodeGen=I;function R(C,x){for(let E in x)C[E]=(C[E]||0)+(x[E]||0);return C}function q(C,x){return x instanceof e._CodeOrName?R(C,x.names):C}function O(C,x,E){if(C instanceof e.Name)return W(C);if(!he(C))return C;return new e._Code(C._items.reduce((me,vt)=>(vt instanceof e.Name&&(vt=W(vt)),vt instanceof e._Code?me.push(...vt._items):me.push(vt),me),[]));function W(me){let vt=E[me.str];return vt===void 0||x[me.str]!==1?me:(delete x[me.str],vt)}function he(me){return me instanceof e._Code&&me._items.some(vt=>vt instanceof e.Name&&x[vt.str]===1&&E[vt.str]!==void 0)}}function Q(C,x){for(let E in x)C[E]=(C[E]||0)-(x[E]||0)}function K(C){return typeof C=="boolean"||typeof C=="number"||C===null?!C:e._`!${G(C)}`}t.not=K;var Oe=T(t.operators.AND);function st(...C){return C.reduce(Oe)}t.and=st;var pe=T(t.operators.OR);function J(...C){return C.reduce(pe)}t.or=J;function T(C){return(x,E)=>x===e.nil?E:E===e.nil?x:e._`${G(x)} ${C} ${G(E)}`}function G(C){return C instanceof e.Name?C:e._`(${C})`}}),bt=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;var e=Je(),r=jh();function i(S){let k={};for(let $ of S)k[$]=!0;return k}t.toHash=i;function n(S,k){return typeof k=="boolean"?k:Object.keys(k).length===0?!0:(o(S,k),!s(k,S.self.RULES.all))}t.alwaysValidSchema=n;function o(S,k=S.schema){let{opts:$,self:P}=S;if(!$.strictSchema||typeof k=="boolean")return;let j=P.RULES.keywords;for(let I in k)j[I]||w(S,`unknown keyword: "${I}"`)}t.checkUnknownRules=o;function s(S,k){if(typeof S=="boolean")return!S;for(let $ in S)if(k[$])return!0;return!1}t.schemaHasRules=s;function a(S,k){if(typeof S=="boolean")return!S;for(let $ in S)if($!=="$ref"&&k.all[$])return!0;return!1}t.schemaHasRulesButRef=a;function u({topSchemaRef:S,schemaPath:k},$,P,j){if(!j){if(typeof $=="number"||typeof $=="boolean")return $;if(typeof $=="string")return e._`${$}`}return e._`${S}${k}${(0,e.getProperty)(P)}`}t.schemaRefOrVal=u;function l(S){return p(decodeURIComponent(S))}t.unescapeFragment=l;function c(S){return encodeURIComponent(d(S))}t.escapeFragment=c;function d(S){return typeof S=="number"?`${S}`:S.replace(/~/g,"~0").replace(/\//g,"~1")}t.escapeJsonPointer=d;function p(S){return S.replace(/~1/g,"/").replace(/~0/g,"~")}t.unescapeJsonPointer=p;function f(S,k){if(Array.isArray(S))for(let $ of S)k($);else k(S)}t.eachItem=f;function m({mergeNames:S,mergeToName:k,mergeValues:$,resultToName:P}){return(j,I,R,q)=>{let O=R===void 0?I:R instanceof e.Name?(I instanceof e.Name?S(j,I,R):k(j,I,R),R):I instanceof e.Name?(k(j,R,I),I):$(I,R);return q===e.Name&&!(O instanceof e.Name)?P(j,O):O}}t.mergeEvaluated={props:m({mergeNames:(S,k,$)=>S.if(e._`${$} !== true && ${k} !== undefined`,()=>{S.if(e._`${k} === true`,()=>S.assign($,!0),()=>S.assign($,e._`${$} || {}`).code(e._`Object.assign(${$}, ${k})`))}),mergeToName:(S,k,$)=>S.if(e._`${$} !== true`,()=>{k===!0?S.assign($,!0):(S.assign($,e._`${$} || {}`),v(S,$,k))}),mergeValues:(S,k)=>S===!0?!0:{...S,...k},resultToName:g}),items:m({mergeNames:(S,k,$)=>S.if(e._`${$} !== true && ${k} !== undefined`,()=>S.assign($,e._`${k} === true ? true : ${$} > ${k} ? ${$} : ${k}`)),mergeToName:(S,k,$)=>S.if(e._`${$} !== true`,()=>S.assign($,k===!0?!0:e._`${$} > ${k} ? ${$} : ${k}`)),mergeValues:(S,k)=>S===!0?!0:Math.max(S,k),resultToName:(S,k)=>S.var("items",k)})};function g(S,k){if(k===!0)return S.var("props",!0);let $=S.var("props",e._`{}`);return k!==void 0&&v(S,$,k),$}t.evaluatedPropsToName=g;function v(S,k,$){Object.keys($).forEach(P=>S.assign(e._`${k}${(0,e.getProperty)(P)}`,!0))}t.setEvaluated=v;var h={};function y(S,k){return S.scopeValue("func",{ref:k,code:h[k.code]||(h[k.code]=new r._Code(k.code))})}t.useFunc=y;var _;(function(S){S[S.Num=0]="Num",S[S.Str=1]="Str"})(_||(t.Type=_={}));function b(S,k,$){if(S instanceof e.Name){let P=k===_.Num;return $?P?e._`"[" + ${S} + "]"`:e._`"['" + ${S} + "']"`:P?e._`"/" + ${S}`:e._`"/" + ${S}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return $?(0,e.getProperty)(S).toString():"/"+d(S)}t.getErrorPath=b;function w(S,k,$=S.opts.strictSchema){if($){if(k=`strict mode: ${k}`,$===!0)throw Error(k);S.self.logger.warn(k)}}t.checkStrictMode=w}),Jo=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};t.default=r}),Ig=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;var e=Je(),r=bt(),i=Jo();t.keywordError={message:({keyword:v})=>e.str`must pass "${v}" keyword validation`},t.keyword$DataError={message:({keyword:v,schemaType:h})=>h?e.str`"${v}" keyword must be ${h} ($data)`:e.str`"${v}" keyword is invalid ($data)`};function n(v,h=t.keywordError,y,_){let{it:b}=v,{gen:w,compositeRule:S,allErrors:k}=b,$=d(v,h,y);_??(S||k)?u(w,$):l(b,e._`[${$}]`)}t.reportError=n;function o(v,h=t.keywordError,y){let{it:_}=v,{gen:b,compositeRule:w,allErrors:S}=_,k=d(v,h,y);u(b,k),!(w||S)&&l(_,i.default.vErrors)}t.reportExtraError=o;function s(v,h){v.assign(i.default.errors,h),v.if(e._`${i.default.vErrors} !== null`,()=>v.if(h,()=>v.assign(e._`${i.default.vErrors}.length`,h),()=>v.assign(i.default.vErrors,null)))}t.resetErrorsCount=s;function a({gen:v,keyword:h,schemaValue:y,data:_,errsCount:b,it:w}){if(b===void 0)throw Error("ajv implementation error");let S=v.name("err");v.forRange("i",b,i.default.errors,k=>{v.const(S,e._`${i.default.vErrors}[${k}]`),v.if(e._`${S}.instancePath === undefined`,()=>v.assign(e._`${S}.instancePath`,(0,e.strConcat)(i.default.instancePath,w.errorPath))),v.assign(e._`${S}.schemaPath`,e.str`${w.errSchemaPath}/${h}`),w.opts.verbose&&(v.assign(e._`${S}.schema`,y),v.assign(e._`${S}.data`,_))})}t.extendErrors=a;function u(v,h){let y=v.const("err",h);v.if(e._`${i.default.vErrors} === null`,()=>v.assign(i.default.vErrors,e._`[${y}]`),e._`${i.default.vErrors}.push(${y})`),v.code(e._`${i.default.errors}++`)}function l(v,h){let{gen:y,validateName:_,schemaEnv:b}=v;b.$async?y.throw(e._`new ${v.ValidationError}(${h})`):(y.assign(e._`${_}.errors`,h),y.return(!1))}var c={keyword:new e.Name("keyword"),schemaPath:new e.Name("schemaPath"),params:new e.Name("params"),propertyName:new e.Name("propertyName"),message:new e.Name("message"),schema:new e.Name("schema"),parentSchema:new e.Name("parentSchema")};function d(v,h,y){let{createErrors:_}=v.it;return _===!1?e._`{}`:p(v,h,y)}function p(v,h,y={}){let{gen:_,it:b}=v,w=[f(b,y),m(v,y)];return g(v,h,w),_.object(...w)}function f({errorPath:v},{instancePath:h}){let y=h?e.str`${v}${(0,r.getErrorPath)(h,r.Type.Str)}`:v;return[i.default.instancePath,(0,e.strConcat)(i.default.instancePath,y)]}function m({keyword:v,it:{errSchemaPath:h}},{schemaPath:y,parentSchema:_}){let b=_?h:e.str`${h}/${v}`;return y&&(b=e.str`${b}${(0,r.getErrorPath)(y,r.Type.Str)}`),[c.schemaPath,b]}function g(v,{params:h,message:y},_){let{keyword:b,data:w,schemaValue:S,it:k}=v,{opts:$,propertyName:P,topSchemaRef:j,schemaPath:I}=k;_.push([c.keyword,b],[c.params,typeof h=="function"?h(v):h||e._`{}`]),$.messages&&_.push([c.message,typeof y=="function"?y(v):y]),$.verbose&&_.push([c.schema,S],[c.parentSchema,e._`${j}${I}`],[i.default.data,w]),P&&_.push([c.propertyName,P])}}),tJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;var e=Ig(),r=Je(),i=Jo(),n={message:"boolean schema is false"};function o(u){let{gen:l,schema:c,validateName:d}=u;c===!1?a(u,!1):typeof c=="object"&&c.$async===!0?l.return(i.default.data):(l.assign(r._`${d}.errors`,null),l.return(!0))}t.topBoolOrEmptySchema=o;function s(u,l){let{gen:c,schema:d}=u;d===!1?(c.var(l,!1),a(u)):c.var(l,!0)}t.boolOrEmptySchema=s;function a(u,l){let{gen:c,data:d}=u,p={gen:c,keyword:"false schema",data:d,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:u};(0,e.reportError)(p,n,void 0,l)}}),SA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;var e=["string","number","integer","boolean","null","object","array"],r=new Set(e);function i(o){return typeof o=="string"&&r.has(o)}t.isJSONType=i;function n(){let o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}t.getRules=n}),kA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0;function e({schema:n,self:o},s){let a=o.RULES.types[s];return a&&a!==!0&&r(n,a)}t.schemaHasRulesForType=e;function r(n,o){return o.rules.some(s=>i(n,s))}t.shouldUseGroup=r;function i(n,o){var s;return n[o.keyword]!==void 0||((s=o.definition.implements)===null||s===void 0?void 0:s.some(a=>n[a]!==void 0))}t.shouldUseRule=i}),Ch=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;var e=SA(),r=kA(),i=Ig(),n=Je(),o=bt(),s;(function(_){_[_.Correct=0]="Correct",_[_.Wrong=1]="Wrong"})(s||(t.DataType=s={}));function a(_){let b=u(_.type);if(b.includes("null")){if(_.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!b.length&&_.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');_.nullable===!0&&b.push("null")}return b}t.getSchemaTypes=a;function u(_){let b=Array.isArray(_)?_:_?[_]:[];if(b.every(e.isJSONType))return b;throw Error("type must be JSONType or JSONType[]: "+b.join(","))}t.getJSONTypes=u;function l(_,b){let{gen:w,data:S,opts:k}=_,$=d(b,k.coerceTypes),P=b.length>0&&!($.length===0&&b.length===1&&(0,r.schemaHasRulesForType)(_,b[0]));if(P){let j=g(b,S,k.strictNumbers,s.Wrong);w.if(j,()=>{$.length?p(_,b,$):h(_)})}return P}t.coerceAndCheckDataType=l;var c=new Set(["string","number","integer","boolean","null"]);function d(_,b){return b?_.filter(w=>c.has(w)||b==="array"&&w==="array"):[]}function p(_,b,w){let{gen:S,data:k,opts:$}=_,P=S.let("dataType",n._`typeof ${k}`),j=S.let("coerced",n._`undefined`);$.coerceTypes==="array"&&S.if(n._`${P} == 'object' && Array.isArray(${k}) && ${k}.length == 1`,()=>S.assign(k,n._`${k}[0]`).assign(P,n._`typeof ${k}`).if(g(b,k,$.strictNumbers),()=>S.assign(j,k))),S.if(n._`${j} !== undefined`);for(let R of w)(c.has(R)||R==="array"&&$.coerceTypes==="array")&&I(R);S.else(),h(_),S.endIf(),S.if(n._`${j} !== undefined`,()=>{S.assign(k,j),f(_,j)});function I(R){switch(R){case"string":S.elseIf(n._`${P} == "number" || ${P} == "boolean"`).assign(j,n._`"" + ${k}`).elseIf(n._`${k} === null`).assign(j,n._`""`);return;case"number":S.elseIf(n._`${P} == "boolean" || ${k} === null
129
- || (${P} == "string" && ${k} && ${k} == +${k})`).assign(j,n._`+${k}`);return;case"integer":S.elseIf(n._`${P} === "boolean" || ${k} === null
130
- || (${P} === "string" && ${k} && ${k} == +${k} && !(${k} % 1))`).assign(j,n._`+${k}`);return;case"boolean":S.elseIf(n._`${k} === "false" || ${k} === 0 || ${k} === null`).assign(j,!1).elseIf(n._`${k} === "true" || ${k} === 1`).assign(j,!0);return;case"null":S.elseIf(n._`${k} === "" || ${k} === 0 || ${k} === false`),S.assign(j,null);return;case"array":S.elseIf(n._`${P} === "string" || ${P} === "number"
131
- || ${P} === "boolean" || ${k} === null`).assign(j,n._`[${k}]`)}}}function f({gen:_,parentData:b,parentDataProperty:w},S){_.if(n._`${b} !== undefined`,()=>_.assign(n._`${b}[${w}]`,S))}function m(_,b,w,S=s.Correct){let k=S===s.Correct?n.operators.EQ:n.operators.NEQ,$;switch(_){case"null":return n._`${b} ${k} null`;case"array":$=n._`Array.isArray(${b})`;break;case"object":$=n._`${b} && typeof ${b} == "object" && !Array.isArray(${b})`;break;case"integer":$=P(n._`!(${b} % 1) && !isNaN(${b})`);break;case"number":$=P();break;default:return n._`typeof ${b} ${k} ${_}`}return S===s.Correct?$:(0,n.not)($);function P(j=n.nil){return(0,n.and)(n._`typeof ${b} == "number"`,j,w?n._`isFinite(${b})`:n.nil)}}t.checkDataType=m;function g(_,b,w,S){if(_.length===1)return m(_[0],b,w,S);let k,$=(0,o.toHash)(_);if($.array&&$.object){let P=n._`typeof ${b} != "object"`;k=$.null?P:n._`!${b} || ${P}`,delete $.null,delete $.array,delete $.object}else k=n.nil;$.number&&delete $.integer;for(let P in $)k=(0,n.and)(k,m(P,b,w,S));return k}t.checkDataTypes=g;var v={message:({schema:_})=>`must be ${_}`,params:({schema:_,schemaValue:b})=>typeof _=="string"?n._`{type: ${_}}`:n._`{type: ${b}}`};function h(_){let b=y(_);(0,i.reportError)(b,v)}t.reportTypeError=h;function y(_){let{gen:b,data:w,schema:S}=_,k=(0,o.schemaRefOrVal)(_,S,"type");return{gen:b,keyword:"type",data:w,schema:S.type,schemaCode:k,schemaValue:k,parentSchema:S,params:{},it:_}}}),rJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;var e=Je(),r=bt();function i(o,s){let{properties:a,items:u}=o.schema;if(s==="object"&&a)for(let l in a)n(o,l,a[l].default);else s==="array"&&Array.isArray(u)&&u.forEach((l,c)=>n(o,c,l.default))}t.assignDefaults=i;function n(o,s,a){let{gen:u,compositeRule:l,data:c,opts:d}=o;if(a===void 0)return;let p=e._`${c}${(0,e.getProperty)(s)}`;if(l){(0,r.checkStrictMode)(o,`default is ignored for: ${p}`);return}let f=e._`${p} === undefined`;d.useDefaults==="empty"&&(f=e._`${f} || ${p} === null || ${p} === ""`),u.if(f,e._`${p} = ${(0,e.stringify)(a)}`)}}),wi=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;var e=Je(),r=bt(),i=Jo(),n=bt();function o(_,b){let{gen:w,data:S,it:k}=_;w.if(d(w,S,b,k.opts.ownProperties),()=>{_.setParams({missingProperty:e._`${b}`},!0),_.error()})}t.checkReportMissingProp=o;function s({gen:_,data:b,it:{opts:w}},S,k){return(0,e.or)(...S.map($=>(0,e.and)(d(_,b,$,w.ownProperties),e._`${k} = ${$}`)))}t.checkMissingProp=s;function a(_,b){_.setParams({missingProperty:b},!0),_.error()}t.reportMissingProp=a;function u(_){return _.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}t.hasPropFunc=u;function l(_,b,w){return e._`${u(_)}.call(${b}, ${w})`}t.isOwnProperty=l;function c(_,b,w,S){let k=e._`${b}${(0,e.getProperty)(w)} !== undefined`;return S?e._`${k} && ${l(_,b,w)}`:k}t.propertyInData=c;function d(_,b,w,S){let k=e._`${b}${(0,e.getProperty)(w)} === undefined`;return S?(0,e.or)(k,(0,e.not)(l(_,b,w))):k}t.noPropertyInData=d;function p(_){return _?Object.keys(_).filter(b=>b!=="__proto__"):[]}t.allSchemaProperties=p;function f(_,b){return p(b).filter(w=>!(0,r.alwaysValidSchema)(_,b[w]))}t.schemaProperties=f;function m({schemaCode:_,data:b,it:{gen:w,topSchemaRef:S,schemaPath:k,errorPath:$},it:P},j,I,R){let q=R?e._`${_}, ${b}, ${S}${k}`:b,O=[[i.default.instancePath,(0,e.strConcat)(i.default.instancePath,$)],[i.default.parentData,P.parentData],[i.default.parentDataProperty,P.parentDataProperty],[i.default.rootData,i.default.rootData]];P.opts.dynamicRef&&O.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);let Q=e._`${q}, ${w.object(...O)}`;return I!==e.nil?e._`${j}.call(${I}, ${Q})`:e._`${j}(${Q})`}t.callValidateCode=m;var g=e._`new RegExp`;function v({gen:_,it:{opts:b}},w){let S=b.unicodeRegExp?"u":"",{regExp:k}=b.code,$=k(w,S);return _.scopeValue("pattern",{key:$.toString(),ref:$,code:e._`${k.code==="new RegExp"?g:(0,n.useFunc)(_,k)}(${w}, ${S})`})}t.usePattern=v;function h(_){let{gen:b,data:w,keyword:S,it:k}=_,$=b.name("valid");if(k.allErrors){let j=b.let("valid",!0);return P(()=>b.assign(j,!1)),j}return b.var($,!0),P(()=>b.break()),$;function P(j){let I=b.const("len",e._`${w}.length`);b.forRange("i",0,I,R=>{_.subschema({keyword:S,dataProp:R,dataPropType:r.Type.Num},$),b.if((0,e.not)($),j)})}}t.validateArray=h;function y(_){let{gen:b,schema:w,keyword:S,it:k}=_;if(!Array.isArray(w))throw Error("ajv implementation error");if(w.some(j=>(0,r.alwaysValidSchema)(k,j))&&!k.opts.unevaluated)return;let $=b.let("valid",!1),P=b.name("_valid");b.block(()=>w.forEach((j,I)=>{let R=_.subschema({keyword:S,schemaProp:I,compositeRule:!0},P);b.assign($,e._`${$} || ${P}`),!_.mergeValidEvaluated(R,P)&&b.if((0,e.not)($))})),_.result($,()=>_.reset(),()=>_.error(!0))}t.validateUnion=y}),nJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;var e=Je(),r=Jo(),i=wi(),n=Ig();function o(f,m){let{gen:g,keyword:v,schema:h,parentSchema:y,it:_}=f,b=m.macro.call(_.self,h,y,_),w=c(g,v,b);_.opts.validateSchema!==!1&&_.self.validateSchema(b,!0);let S=g.name("valid");f.subschema({schema:b,schemaPath:e.nil,errSchemaPath:`${_.errSchemaPath}/${v}`,topSchemaRef:w,compositeRule:!0},S),f.pass(S,()=>f.error(!0))}t.macroKeywordCode=o;function s(f,m){var g;let{gen:v,keyword:h,schema:y,parentSchema:_,$data:b,it:w}=f;l(w,m);let S=!b&&m.compile?m.compile.call(w.self,y,_,w):m.validate,k=c(v,h,S),$=v.let("valid");f.block$data($,P),f.ok((g=m.valid)!==null&&g!==void 0?g:$);function P(){if(m.errors===!1)R(),m.modifying&&a(f),q(()=>f.error());else{let O=m.async?j():I();m.modifying&&a(f),q(()=>u(f,O))}}function j(){let O=v.let("ruleErrs",null);return v.try(()=>R(e._`await `),Q=>v.assign($,!1).if(e._`${Q} instanceof ${w.ValidationError}`,()=>v.assign(O,e._`${Q}.errors`),()=>v.throw(Q))),O}function I(){let O=e._`${k}.errors`;return v.assign(O,null),R(e.nil),O}function R(O=m.async?e._`await `:e.nil){let Q=w.opts.passContext?r.default.this:r.default.self,K=!("compile"in m&&!b||m.schema===!1);v.assign($,e._`${O}${(0,i.callValidateCode)(f,k,Q,K)}`,m.modifying)}function q(O){var Q;v.if((0,e.not)((Q=m.valid)!==null&&Q!==void 0?Q:$),O)}}t.funcKeywordCode=s;function a(f){let{gen:m,data:g,it:v}=f;m.if(v.parentData,()=>m.assign(g,e._`${v.parentData}[${v.parentDataProperty}]`))}function u(f,m){let{gen:g}=f;g.if(e._`Array.isArray(${m})`,()=>{g.assign(r.default.vErrors,e._`${r.default.vErrors} === null ? ${m} : ${r.default.vErrors}.concat(${m})`).assign(r.default.errors,e._`${r.default.vErrors}.length`),(0,n.extendErrors)(f)},()=>f.error())}function l({schemaEnv:f},m){if(m.async&&!f.$async)throw Error("async keyword in sync schema")}function c(f,m,g){if(g===void 0)throw Error(`keyword "${m}" failed to compile`);return f.scopeValue("keyword",typeof g=="function"?{ref:g}:{ref:g,code:(0,e.stringify)(g)})}function d(f,m,g=!1){return!m.length||m.some(v=>v==="array"?Array.isArray(f):v==="object"?f&&typeof f=="object"&&!Array.isArray(f):typeof f==v||g&&typeof f>"u")}t.validSchemaType=d;function p({schema:f,opts:m,self:g,errSchemaPath:v},h,y){if(Array.isArray(h.keyword)?!h.keyword.includes(y):h.keyword!==y)throw Error("ajv implementation error");let _=h.dependencies;if(_?.some(b=>!Object.prototype.hasOwnProperty.call(f,b)))throw Error(`parent schema must have dependencies of ${y}: ${_.join(",")}`);if(h.validateSchema&&!h.validateSchema(f[y])){let b=`keyword "${y}" value is invalid at path "${v}": `+g.errorsText(h.validateSchema.errors);if(m.validateSchema==="log")g.logger.error(b);else throw Error(b)}}t.validateKeywordUsage=p}),iJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;var e=Je(),r=bt();function i(s,{keyword:a,schemaProp:u,schema:l,schemaPath:c,errSchemaPath:d,topSchemaRef:p}){if(a!==void 0&&l!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(a!==void 0){let f=s.schema[a];return u===void 0?{schema:f,schemaPath:e._`${s.schemaPath}${(0,e.getProperty)(a)}`,errSchemaPath:`${s.errSchemaPath}/${a}`}:{schema:f[u],schemaPath:e._`${s.schemaPath}${(0,e.getProperty)(a)}${(0,e.getProperty)(u)}`,errSchemaPath:`${s.errSchemaPath}/${a}/${(0,r.escapeFragment)(u)}`}}if(l!==void 0){if(c===void 0||d===void 0||p===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:c,topSchemaRef:p,errSchemaPath:d}}throw Error('either "keyword" or "schema" must be passed')}t.getSubschema=i;function n(s,a,{dataProp:u,dataPropType:l,data:c,dataTypes:d,propertyName:p}){if(c!==void 0&&u!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:f}=a;if(u!==void 0){let{errorPath:g,dataPathArr:v,opts:h}=a,y=f.let("data",e._`${a.data}${(0,e.getProperty)(u)}`,!0);m(y),s.errorPath=e.str`${g}${(0,r.getErrorPath)(u,l,h.jsPropertySyntax)}`,s.parentDataProperty=e._`${u}`,s.dataPathArr=[...v,s.parentDataProperty]}if(c!==void 0){let g=c instanceof e.Name?c:f.let("data",c,!0);m(g),p!==void 0&&(s.propertyName=p)}d&&(s.dataTypes=d);function m(g){s.data=g,s.dataLevel=a.dataLevel+1,s.dataTypes=[],a.definedProperties=new Set,s.parentData=a.data,s.dataNames=[...a.dataNames,g]}}t.extendSubschemaData=n;function o(s,{jtdDiscriminator:a,jtdMetadata:u,compositeRule:l,createErrors:c,allErrors:d}){l!==void 0&&(s.compositeRule=l),c!==void 0&&(s.createErrors=c),d!==void 0&&(s.allErrors=d),s.jtdDiscriminator=a,s.jtdMetadata=u}t.extendSubschemaMode=o}),xA=B((t,e)=>{e.exports=function r(i,n){if(i===n)return!0;if(i&&n&&typeof i=="object"&&typeof n=="object"){if(i.constructor!==n.constructor)return!1;var o,s,a;if(Array.isArray(i)){if(o=i.length,o!=n.length)return!1;for(s=o;s--!==0;)if(!r(i[s],n[s]))return!1;return!0}if(i.constructor===RegExp)return i.source===n.source&&i.flags===n.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===n.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===n.toString();if(a=Object.keys(i),o=a.length,o!==Object.keys(n).length)return!1;for(s=o;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[s]))return!1;for(s=o;s--!==0;){var u=a[s];if(!r(i[u],n[u]))return!1}return!0}return i!==i&&n!==n}}),oJ=B((t,e)=>{var r=e.exports=function(o,s,a){typeof s=="function"&&(a=s,s={}),a=s.cb||a;var u=typeof a=="function"?a:a.pre||function(){},l=a.post||function(){};i(s,u,l,o,"",o)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function i(o,s,a,u,l,c,d,p,f,m){if(u&&typeof u=="object"&&!Array.isArray(u)){s(u,l,c,d,p,f,m);for(var g in u){var v=u[g];if(Array.isArray(v)){if(g in r.arrayKeywords)for(var h=0;h<v.length;h++)i(o,s,a,v[h],l+"/"+g+"/"+h,c,l,g,u,h)}else if(g in r.propsKeywords){if(v&&typeof v=="object")for(var y in v)i(o,s,a,v[y],l+"/"+g+"/"+n(y),c,l,g,u,y)}else(g in r.keywords||o.allKeys&&!(g in r.skipKeywords))&&i(o,s,a,v,l+"/"+g,c,l,g,u)}a(u,l,c,d,p,f,m)}}function n(o){return o.replace(/~/g,"~0").replace(/\//g,"~1")}}),Eg=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;var e=bt(),r=xA(),i=oJ(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function o(v,h=!0){return typeof v=="boolean"?!0:h===!0?!a(v):h?u(v)<=h:!1}t.inlineRef=o;var s=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(v){for(let h in v){if(s.has(h))return!0;let y=v[h];if(Array.isArray(y)&&y.some(a)||typeof y=="object"&&a(y))return!0}return!1}function u(v){let h=0;for(let y in v){if(y==="$ref")return 1/0;if(h++,!n.has(y)&&(typeof v[y]=="object"&&(0,e.eachItem)(v[y],_=>h+=u(_)),h===1/0))return 1/0}return h}function l(v,h="",y){y!==!1&&(h=p(h));let _=v.parse(h);return c(v,_)}t.getFullPath=l;function c(v,h){return v.serialize(h).split("#")[0]+"#"}t._getFullPath=c;var d=/#\/?$/;function p(v){return v?v.replace(d,""):""}t.normalizeId=p;function f(v,h,y){return y=p(y),v.resolve(h,y)}t.resolveUrl=f;var m=/^[a-z_][-a-z0-9._]*$/i;function g(v,h){if(typeof v=="boolean")return{};let{schemaId:y,uriResolver:_}=this.opts,b=p(v[y]||h),w={"":b},S=l(_,b,!1),k={},$=new Set;return i(v,{allKeys:!0},(I,R,q,O)=>{if(O===void 0)return;let Q=S+R,K=w[O];typeof I[y]=="string"&&(K=Oe.call(this,I[y])),st.call(this,I.$anchor),st.call(this,I.$dynamicAnchor),w[R]=K;function Oe(pe){let J=this.opts.uriResolver.resolve;if(pe=p(K?J(K,pe):pe),$.has(pe))throw j(pe);$.add(pe);let T=this.refs[pe];return typeof T=="string"&&(T=this.refs[T]),typeof T=="object"?P(I,T.schema,pe):pe!==p(Q)&&(pe[0]==="#"?(P(I,k[pe],pe),k[pe]=I):this.refs[pe]=Q),pe}function st(pe){if(typeof pe=="string"){if(!m.test(pe))throw Error(`invalid anchor "${pe}"`);Oe.call(this,`#${pe}`)}}}),k;function P(I,R,q){if(R!==void 0&&!r(I,R))throw j(q)}function j(I){return Error(`reference "${I}" resolves to more than one schema`)}}t.getSchemaRefs=g}),Pg=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;var e=tJ(),r=Ch(),i=kA(),n=Ch(),o=rJ(),s=nJ(),a=iJ(),u=Je(),l=Jo(),c=Eg(),d=bt(),p=Ig();function f(D){if(S(D)&&($(D),w(D))){h(D);return}m(D,()=>(0,e.topBoolOrEmptySchema)(D))}t.validateFunctionCode=f;function m({gen:D,validateName:Z,schema:H,schemaEnv:ne,opts:ve},Be){ve.code.es5?D.func(Z,u._`${l.default.data}, ${l.default.valCxt}`,ne.$async,()=>{D.code(u._`"use strict"; ${_(H,ve)}`),v(D,ve),D.code(Be)}):D.func(Z,u._`${l.default.data}, ${g(ve)}`,ne.$async,()=>D.code(_(H,ve)).code(Be))}function g(D){return u._`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${D.dynamicRef?u._`, ${l.default.dynamicAnchors}={}`:u.nil}}={}`}function v(D,Z){D.if(l.default.valCxt,()=>{D.var(l.default.instancePath,u._`${l.default.valCxt}.${l.default.instancePath}`),D.var(l.default.parentData,u._`${l.default.valCxt}.${l.default.parentData}`),D.var(l.default.parentDataProperty,u._`${l.default.valCxt}.${l.default.parentDataProperty}`),D.var(l.default.rootData,u._`${l.default.valCxt}.${l.default.rootData}`),Z.dynamicRef&&D.var(l.default.dynamicAnchors,u._`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{D.var(l.default.instancePath,u._`""`),D.var(l.default.parentData,u._`undefined`),D.var(l.default.parentDataProperty,u._`undefined`),D.var(l.default.rootData,l.default.data),Z.dynamicRef&&D.var(l.default.dynamicAnchors,u._`{}`)})}function h(D){let{schema:Z,opts:H,gen:ne}=D;m(D,()=>{H.$comment&&Z.$comment&&O(D),I(D),ne.let(l.default.vErrors,null),ne.let(l.default.errors,0),H.unevaluated&&y(D),P(D),Q(D)})}function y(D){let{gen:Z,validateName:H}=D;D.evaluated=Z.const("evaluated",u._`${H}.evaluated`),Z.if(u._`${D.evaluated}.dynamicProps`,()=>Z.assign(u._`${D.evaluated}.props`,u._`undefined`)),Z.if(u._`${D.evaluated}.dynamicItems`,()=>Z.assign(u._`${D.evaluated}.items`,u._`undefined`))}function _(D,Z){let H=typeof D=="object"&&D[Z.schemaId];return H&&(Z.code.source||Z.code.process)?u._`/*# sourceURL=${H} */`:u.nil}function b(D,Z){if(S(D)&&($(D),w(D))){k(D,Z);return}(0,e.boolOrEmptySchema)(D,Z)}function w({schema:D,self:Z}){if(typeof D=="boolean")return!D;for(let H in D)if(Z.RULES.all[H])return!0;return!1}function S(D){return typeof D.schema!="boolean"}function k(D,Z){let{schema:H,gen:ne,opts:ve}=D;ve.$comment&&H.$comment&&O(D),R(D),q(D);let Be=ne.const("_errs",l.default.errors);P(D,Be),ne.var(Z,u._`${Be} === ${l.default.errors}`)}function $(D){(0,d.checkUnknownRules)(D),j(D)}function P(D,Z){if(D.opts.jtd)return Oe(D,[],!1,Z);let H=(0,r.getSchemaTypes)(D.schema),ne=(0,r.coerceAndCheckDataType)(D,H);Oe(D,H,!ne,Z)}function j(D){let{schema:Z,errSchemaPath:H,opts:ne,self:ve}=D;Z.$ref&&ne.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(Z,ve.RULES)&&ve.logger.warn(`$ref: keywords ignored in schema at path "${H}"`)}function I(D){let{schema:Z,opts:H}=D;Z.default!==void 0&&H.useDefaults&&H.strictSchema&&(0,d.checkStrictMode)(D,"default is ignored in the schema root")}function R(D){let Z=D.schema[D.opts.schemaId];Z&&(D.baseId=(0,c.resolveUrl)(D.opts.uriResolver,D.baseId,Z))}function q(D){if(D.schema.$async&&!D.schemaEnv.$async)throw Error("async schema in sync schema")}function O({gen:D,schemaEnv:Z,schema:H,errSchemaPath:ne,opts:ve}){let Be=H.$comment;if(ve.$comment===!0)D.code(u._`${l.default.self}.logger.log(${Be})`);else if(typeof ve.$comment=="function"){let ur=u.str`${ne}/$comment`,un=D.scopeValue("root",{ref:Z.root});D.code(u._`${l.default.self}.opts.$comment(${Be}, ${ur}, ${un}.schema)`)}}function Q(D){let{gen:Z,schemaEnv:H,validateName:ne,ValidationError:ve,opts:Be}=D;H.$async?Z.if(u._`${l.default.errors} === 0`,()=>Z.return(l.default.data),()=>Z.throw(u._`new ${ve}(${l.default.vErrors})`)):(Z.assign(u._`${ne}.errors`,l.default.vErrors),Be.unevaluated&&K(D),Z.return(u._`${l.default.errors} === 0`))}function K({gen:D,evaluated:Z,props:H,items:ne}){H instanceof u.Name&&D.assign(u._`${Z}.props`,H),ne instanceof u.Name&&D.assign(u._`${Z}.items`,ne)}function Oe(D,Z,H,ne){let{gen:ve,schema:Be,data:ur,allErrors:un,opts:gr,self:yr}=D,{RULES:lr}=yr;if(Be.$ref&&(gr.ignoreKeywordsWithRef||!(0,d.schemaHasRulesButRef)(Be,lr))){ve.block(()=>me(D,"$ref",lr.all.$ref.definition));return}gr.jtd||pe(D,Z),ve.block(()=>{for(let ln of lr.rules)Eo(ln);Eo(lr.post)});function Eo(ln){(0,i.shouldUseGroup)(Be,ln)&&(ln.type?(ve.if((0,n.checkDataType)(ln.type,ur,gr.strictNumbers)),st(D,ln),Z.length===1&&Z[0]===ln.type&&H&&(ve.else(),(0,n.reportTypeError)(D)),ve.endIf()):st(D,ln),un||ve.if(u._`${l.default.errors} === ${ne||0}`))}}function st(D,Z){let{gen:H,schema:ne,opts:{useDefaults:ve}}=D;ve&&(0,o.assignDefaults)(D,Z.type),H.block(()=>{for(let Be of Z.rules)(0,i.shouldUseRule)(ne,Be)&&me(D,Be.keyword,Be.definition,Z.type)})}function pe(D,Z){D.schemaEnv.meta||!D.opts.strictTypes||(J(D,Z),!D.opts.allowUnionTypes&&T(D,Z),G(D,D.dataTypes))}function J(D,Z){if(Z.length){if(!D.dataTypes.length){D.dataTypes=Z;return}Z.forEach(H=>{x(D.dataTypes,H)||W(D,`type "${H}" not allowed by context "${D.dataTypes.join(",")}"`)}),E(D,Z)}}function T(D,Z){Z.length>1&&!(Z.length===2&&Z.includes("null"))&&W(D,"use allowUnionTypes to allow union type keyword")}function G(D,Z){let H=D.self.RULES.all;for(let ne in H){let ve=H[ne];if(typeof ve=="object"&&(0,i.shouldUseRule)(D.schema,ve)){let{type:Be}=ve.definition;Be.length&&!Be.some(ur=>C(Z,ur))&&W(D,`missing type "${Be.join(",")}" for keyword "${ne}"`)}}}function C(D,Z){return D.includes(Z)||Z==="number"&&D.includes("integer")}function x(D,Z){return D.includes(Z)||Z==="integer"&&D.includes("number")}function E(D,Z){let H=[];for(let ne of D.dataTypes)x(Z,ne)?H.push(ne):Z.includes("integer")&&ne==="number"&&H.push("integer");D.dataTypes=H}function W(D,Z){let H=D.schemaEnv.baseId+D.errSchemaPath;Z+=` at "${H}" (strictTypes)`,(0,d.checkStrictMode)(D,Z,D.opts.strictTypes)}class he{constructor(Z,H,ne){if((0,s.validateKeywordUsage)(Z,H,ne),this.gen=Z.gen,this.allErrors=Z.allErrors,this.keyword=ne,this.data=Z.data,this.schema=Z.schema[ne],this.$data=H.$data&&Z.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(Z,this.schema,ne,this.$data),this.schemaType=H.schemaType,this.parentSchema=Z.schema,this.params={},this.it=Z,this.def=H,this.$data)this.schemaCode=Z.gen.const("vSchema",Jt(this.$data,Z));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,H.schemaType,H.allowUndefined))throw Error(`${ne} value must be ${JSON.stringify(H.schemaType)}`);("code"in H?H.trackErrors:H.errors!==!1)&&(this.errsCount=Z.gen.const("_errs",l.default.errors))}result(Z,H,ne){this.failResult((0,u.not)(Z),H,ne)}failResult(Z,H,ne){this.gen.if(Z),ne?ne():this.error(),H?(this.gen.else(),H(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(Z,H){this.failResult((0,u.not)(Z),void 0,H)}fail(Z){if(Z===void 0){this.error(),!this.allErrors&&this.gen.if(!1);return}this.gen.if(Z),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(Z){if(!this.$data)return this.fail(Z);let{schemaCode:H}=this;this.fail(u._`${H} !== undefined && (${(0,u.or)(this.invalid$data(),Z)})`)}error(Z,H,ne){if(H){this.setParams(H),this._error(Z,ne),this.setParams({});return}this._error(Z,ne)}_error(Z,H){(Z?p.reportExtraError:p.reportError)(this,this.def.error,H)}$dataError(){(0,p.reportError)(this,this.def.$dataError||p.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,p.resetErrorsCount)(this.gen,this.errsCount)}ok(Z){this.allErrors||this.gen.if(Z)}setParams(Z,H){H?Object.assign(this.params,Z):this.params=Z}block$data(Z,H,ne=u.nil){this.gen.block(()=>{this.check$data(Z,ne),H()})}check$data(Z=u.nil,H=u.nil){if(!this.$data)return;let{gen:ne,schemaCode:ve,schemaType:Be,def:ur}=this;ne.if((0,u.or)(u._`${ve} === undefined`,H)),Z!==u.nil&&ne.assign(Z,!0),(Be.length||ur.validateSchema)&&(ne.elseIf(this.invalid$data()),this.$dataError(),Z!==u.nil&&ne.assign(Z,!1)),ne.else()}invalid$data(){let{gen:Z,schemaCode:H,schemaType:ne,def:ve,it:Be}=this;return(0,u.or)(ur(),un());function ur(){if(ne.length){if(!(H instanceof u.Name))throw Error("ajv implementation error");let gr=Array.isArray(ne)?ne:[ne];return u._`${(0,n.checkDataTypes)(gr,H,Be.opts.strictNumbers,n.DataType.Wrong)}`}return u.nil}function un(){if(ve.validateSchema){let gr=Z.scopeValue("validate$data",{ref:ve.validateSchema});return u._`!${gr}(${H})`}return u.nil}}subschema(Z,H){let ne=(0,a.getSubschema)(this.it,Z);(0,a.extendSubschemaData)(ne,this.it,Z),(0,a.extendSubschemaMode)(ne,Z);let ve={...this.it,...ne,items:void 0,props:void 0};return b(ve,H),ve}mergeEvaluated(Z,H){let{it:ne,gen:ve}=this;ne.opts.unevaluated&&(ne.props!==!0&&Z.props!==void 0&&(ne.props=d.mergeEvaluated.props(ve,Z.props,ne.props,H)),ne.items!==!0&&Z.items!==void 0&&(ne.items=d.mergeEvaluated.items(ve,Z.items,ne.items,H)))}mergeValidEvaluated(Z,H){let{it:ne,gen:ve}=this;if(ne.opts.unevaluated&&(ne.props!==!0||ne.items!==!0))return ve.if(H,()=>this.mergeEvaluated(Z,u.Name)),!0}}t.KeywordCxt=he;function me(D,Z,H,ne){let ve=new he(D,H,Z);"code"in H?H.code(ve,ne):ve.$data&&H.validate?(0,s.funcKeywordCode)(ve,H):"macro"in H?(0,s.macroKeywordCode)(ve,H):(H.compile||H.validate)&&(0,s.funcKeywordCode)(ve,H)}var vt=/^\/(?:[^~]|~0|~1)*$/,ct=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Jt(D,{dataLevel:Z,dataNames:H,dataPathArr:ne}){let ve,Be;if(D==="")return l.default.rootData;if(D[0]==="/"){if(!vt.test(D))throw Error(`Invalid JSON-pointer: ${D}`);ve=D,Be=l.default.rootData}else{let yr=ct.exec(D);if(!yr)throw Error(`Invalid JSON-pointer: ${D}`);let lr=+yr[1];if(ve=yr[2],ve==="#"){if(lr>=Z)throw Error(gr("property/index",lr));return ne[Z-lr]}if(lr>Z)throw Error(gr("data",lr));if(Be=H[Z-lr],!ve)return Be}let ur=Be,un=ve.split("/");for(let yr of un)yr&&(Be=u._`${Be}${(0,u.getProperty)((0,d.unescapeJsonPointer)(yr))}`,ur=u._`${ur} && ${Be}`);return ur;function gr(yr,lr){return`Cannot access ${yr} ${lr} levels up, current level is ${Z}`}}t.getData=Jt}),Rx=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});class e extends Error{constructor(i){super("validation failed"),this.errors=i,this.ajv=this.validation=!0}}t.default=e}),Tg=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Eg();class r extends Error{constructor(n,o,s,a){super(a||`can't resolve reference ${s} from id ${o}`),this.missingRef=(0,e.resolveUrl)(n,o,s),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(n,this.missingRef))}}t.default=r}),Ax=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;var e=Je(),r=Rx(),i=Jo(),n=Eg(),o=bt(),s=Pg();class a{constructor(y){var _;this.refs={},this.dynamicAnchors={};let b;typeof y.schema=="object"&&(b=y.schema),this.schema=y.schema,this.schemaId=y.schemaId,this.root=y.root||this,this.baseId=(_=y.baseId)!==null&&_!==void 0?_:(0,n.normalizeId)(b?.[y.schemaId||"$id"]),this.schemaPath=y.schemaPath,this.localRefs=y.localRefs,this.meta=y.meta,this.$async=b?.$async,this.refs={}}}t.SchemaEnv=a;function u(h){let y=d.call(this,h);if(y)return y;let _=(0,n.getFullPath)(this.opts.uriResolver,h.root.baseId),{es5:b,lines:w}=this.opts.code,{ownProperties:S}=this.opts,k=new e.CodeGen(this.scope,{es5:b,lines:w,ownProperties:S}),$;h.$async&&($=k.scopeValue("Error",{ref:r.default,code:e._`require("ajv/dist/runtime/validation_error").default`}));let P=k.scopeName("validate");h.validateName=P;let j={gen:k,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:k.scopeValue("schema",this.opts.code.source===!0?{ref:h.schema,code:(0,e.stringify)(h.schema)}:{ref:h.schema}),validateName:P,ValidationError:$,schema:h.schema,schemaEnv:h,rootId:_,baseId:h.baseId||_,schemaPath:e.nil,errSchemaPath:h.schemaPath||(this.opts.jtd?"":"#"),errorPath:e._`""`,opts:this.opts,self:this},I;try{this._compilations.add(h),(0,s.validateFunctionCode)(j),k.optimize(this.opts.code.optimize);let R=k.toString();I=`${k.scopeRefs(i.default.scope)}return ${R}`,this.opts.code.process&&(I=this.opts.code.process(I,h));let q=Function(`${i.default.self}`,`${i.default.scope}`,I)(this,this.scope.get());if(this.scope.value(P,{ref:q}),q.errors=null,q.schema=h.schema,q.schemaEnv=h,h.$async&&(q.$async=!0),this.opts.code.source===!0&&(q.source={validateName:P,validateCode:R,scopeValues:k._values}),this.opts.unevaluated){let{props:O,items:Q}=j;q.evaluated={props:O instanceof e.Name?void 0:O,items:Q instanceof e.Name?void 0:Q,dynamicProps:O instanceof e.Name,dynamicItems:Q instanceof e.Name},q.source&&(q.source.evaluated=(0,e.stringify)(q.evaluated))}return h.validate=q,h}catch(R){throw delete h.validate,delete h.validateName,I&&this.logger.error("Error compiling schema, function code:",I),R}finally{this._compilations.delete(h)}}t.compileSchema=u;function l(h,y,_){var b;_=(0,n.resolveUrl)(this.opts.uriResolver,y,_);let w=h.refs[_];if(w)return w;let S=f.call(this,h,_);if(S===void 0){let k=(b=h.localRefs)===null||b===void 0?void 0:b[_],{schemaId:$}=this.opts;k&&(S=new a({schema:k,schemaId:$,root:h,baseId:y}))}if(S!==void 0)return h.refs[_]=c.call(this,S)}t.resolveRef=l;function c(h){return(0,n.inlineRef)(h.schema,this.opts.inlineRefs)?h.schema:h.validate?h:u.call(this,h)}function d(h){for(let y of this._compilations)if(p(y,h))return y}t.getCompilingSchema=d;function p(h,y){return h.schema===y.schema&&h.root===y.root&&h.baseId===y.baseId}function f(h,y){let _;for(;typeof(_=this.refs[y])=="string";)y=_;return _||this.schemas[y]||m.call(this,h,y)}function m(h,y){let _=this.opts.uriResolver.parse(y),b=(0,n._getFullPath)(this.opts.uriResolver,_),w=(0,n.getFullPath)(this.opts.uriResolver,h.baseId,void 0);if(Object.keys(h.schema).length>0&&b===w)return v.call(this,_,h);let S=(0,n.normalizeId)(b),k=this.refs[S]||this.schemas[S];if(typeof k=="string"){let $=m.call(this,h,k);return typeof $?.schema!="object"?void 0:v.call(this,_,$)}if(typeof k?.schema=="object"){if(k.validate||u.call(this,k),S===(0,n.normalizeId)(y)){let{schema:$}=k,{schemaId:P}=this.opts,j=$[P];return j&&(w=(0,n.resolveUrl)(this.opts.uriResolver,w,j)),new a({schema:$,schemaId:P,root:h,baseId:w})}return v.call(this,_,k)}}t.resolveSchema=m;var g=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function v(h,{baseId:y,schema:_,root:b}){var w;if(((w=h.fragment)===null||w===void 0?void 0:w[0])!=="/")return;for(let $ of h.fragment.slice(1).split("/")){if(typeof _=="boolean")return;let P=_[(0,o.unescapeFragment)($)];if(P===void 0)return;_=P;let j=typeof _=="object"&&_[this.opts.schemaId];!g.has($)&&j&&(y=(0,n.resolveUrl)(this.opts.uriResolver,y,j))}let S;if(typeof _!="boolean"&&_.$ref&&!(0,o.schemaHasRulesButRef)(_,this.RULES)){let $=(0,n.resolveUrl)(this.opts.uriResolver,y,_.$ref);S=m.call(this,b,$)}let{schemaId:k}=this.opts;if(S=S||new a({schema:_,schemaId:k,root:b,baseId:y}),S.schema!==S.root.schema)return S}}),sJ=B((t,e)=>{e.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}}),aJ=B((t,e)=>{var r={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};e.exports={HEX:r}}),uJ=B((t,e)=>{var{HEX:r}=aJ(),i=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function n(h){if(l(h,".")<3)return{host:h,isIPV4:!1};let y=h.match(i)||[],[_]=y;return _?{host:u(_,"."),isIPV4:!0}:{host:h,isIPV4:!1}}function o(h,y=!1){let _="",b=!0;for(let w of h){if(r[w]===void 0)return;w!=="0"&&b===!0&&(b=!1),b||(_+=w)}return y&&_.length===0&&(_="0"),_}function s(h){let y=0,_={error:!1,address:"",zone:""},b=[],w=[],S=!1,k=!1,$=!1;function P(){if(w.length){if(S===!1){let j=o(w);if(j!==void 0)b.push(j);else return _.error=!0,!1}w.length=0}return!0}for(let j=0;j<h.length;j++){let I=h[j];if(!(I==="["||I==="]"))if(I===":"){if(k===!0&&($=!0),!P())break;if(y++,b.push(":"),y>7){_.error=!0;break}j-1>=0&&h[j-1]===":"&&(k=!0);continue}else if(I==="%"){if(!P())break;S=!0}else{w.push(I);continue}}return w.length&&(S?_.zone=w.join(""):$?b.push(w.join("")):b.push(o(w))),_.address=b.join(""),_}function a(h){if(l(h,":")<2)return{host:h,isIPV6:!1};let y=s(h);if(y.error)return{host:h,isIPV6:!1};{let{address:_,address:b}=y;return y.zone&&(_+="%"+y.zone,b+="%25"+y.zone),{host:_,escapedHost:b,isIPV6:!0}}}function u(h,y){let _="",b=!0,w=h.length;for(let S=0;S<w;S++){let k=h[S];k==="0"&&b?(S+1<=w&&h[S+1]===y||S+1===w)&&(_+=k,b=!1):(k===y?b=!0:b=!1,_+=k)}return _}function l(h,y){let _=0;for(let b=0;b<h.length;b++)h[b]===y&&_++;return _}var c=/^\.\.?\//u,d=/^\/\.(?:\/|$)/u,p=/^\/\.\.(?:\/|$)/u,f=/^\/?(?:.|\n)*?(?=\/|$)/u;function m(h){let y=[];for(;h.length;)if(h.match(c))h=h.replace(c,"");else if(h.match(d))h=h.replace(d,"/");else if(h.match(p))h=h.replace(p,"/"),y.pop();else if(h==="."||h==="..")h="";else{let _=h.match(f);if(_){let b=_[0];h=h.slice(b.length),y.push(b)}else throw Error("Unexpected dot segment condition")}return y.join("")}function g(h,y){let _=y!==!0?escape:unescape;return h.scheme!==void 0&&(h.scheme=_(h.scheme)),h.userinfo!==void 0&&(h.userinfo=_(h.userinfo)),h.host!==void 0&&(h.host=_(h.host)),h.path!==void 0&&(h.path=_(h.path)),h.query!==void 0&&(h.query=_(h.query)),h.fragment!==void 0&&(h.fragment=_(h.fragment)),h}function v(h){let y=[];if(h.userinfo!==void 0&&(y.push(h.userinfo),y.push("@")),h.host!==void 0){let _=unescape(h.host),b=n(_);if(b.isIPV4)_=b.host;else{let w=a(b.host);w.isIPV6===!0?_=`[${w.escapedHost}]`:_=h.host}y.push(_)}return(typeof h.port=="number"||typeof h.port=="string")&&(y.push(":"),y.push(String(h.port))),y.length?y.join(""):void 0}e.exports={recomposeAuthority:v,normalizeComponentEncoding:g,removeDotSegments:m,normalizeIPv4:n,normalizeIPv6:a,stringArrayToHexStripped:o}}),lJ=B((t,e)=>{var r=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function n(b){return typeof b.secure=="boolean"?b.secure:String(b.scheme).toLowerCase()==="wss"}function o(b){return b.host||(b.error=b.error||"HTTP URIs must have a host."),b}function s(b){let w=String(b.scheme).toLowerCase()==="https";return(b.port===(w?443:80)||b.port==="")&&(b.port=void 0),b.path||(b.path="/"),b}function a(b){return b.secure=n(b),b.resourceName=(b.path||"/")+(b.query?"?"+b.query:""),b.path=void 0,b.query=void 0,b}function u(b){if((b.port===(n(b)?443:80)||b.port==="")&&(b.port=void 0),typeof b.secure=="boolean"&&(b.scheme=b.secure?"wss":"ws",b.secure=void 0),b.resourceName){let[w,S]=b.resourceName.split("?");b.path=w&&w!=="/"?w:void 0,b.query=S,b.resourceName=void 0}return b.fragment=void 0,b}function l(b,w){if(!b.path)return b.error="URN can not be parsed",b;let S=b.path.match(i);if(S){let k=w.scheme||b.scheme||"urn";b.nid=S[1].toLowerCase(),b.nss=S[2];let $=`${k}:${w.nid||b.nid}`,P=_[$];b.path=void 0,P&&(b=P.parse(b,w))}else b.error=b.error||"URN can not be parsed.";return b}function c(b,w){let S=w.scheme||b.scheme||"urn",k=b.nid.toLowerCase(),$=`${S}:${w.nid||k}`,P=_[$];P&&(b=P.serialize(b,w));let j=b,I=b.nss;return j.path=`${k||w.nid}:${I}`,w.skipEscape=!0,j}function d(b,w){let S=b;return S.uuid=S.nss,S.nss=void 0,!w.tolerant&&(!S.uuid||!r.test(S.uuid))&&(S.error=S.error||"UUID is not valid."),S}function p(b){let w=b;return w.nss=(b.uuid||"").toLowerCase(),w}var f={scheme:"http",domainHost:!0,parse:o,serialize:s},m={scheme:"https",domainHost:f.domainHost,parse:o,serialize:s},g={scheme:"ws",domainHost:!0,parse:a,serialize:u},v={scheme:"wss",domainHost:g.domainHost,parse:g.parse,serialize:g.serialize},h={scheme:"urn",parse:l,serialize:c,skipNormalize:!0},y={scheme:"urn:uuid",parse:d,serialize:p,skipNormalize:!0},_={http:f,https:m,ws:g,wss:v,urn:h,"urn:uuid":y};e.exports=_}),cJ=B((t,e)=>{var{normalizeIPv6:r,normalizeIPv4:i,removeDotSegments:n,recomposeAuthority:o,normalizeComponentEncoding:s}=uJ(),a=lJ();function u(y,_){return typeof y=="string"?y=p(v(y,_),_):typeof y=="object"&&(y=v(p(y,_),_)),y}function l(y,_,b){let w=Object.assign({scheme:"null"},b),S=c(v(y,w),v(_,w),w,!0);return p(S,{...w,skipEscape:!0})}function c(y,_,b,w){let S={};return w||(y=v(p(y,b),b),_=v(p(_,b),b)),b=b||{},!b.tolerant&&_.scheme?(S.scheme=_.scheme,S.userinfo=_.userinfo,S.host=_.host,S.port=_.port,S.path=n(_.path||""),S.query=_.query):(_.userinfo!==void 0||_.host!==void 0||_.port!==void 0?(S.userinfo=_.userinfo,S.host=_.host,S.port=_.port,S.path=n(_.path||""),S.query=_.query):(_.path?(_.path.charAt(0)==="/"?S.path=n(_.path):((y.userinfo!==void 0||y.host!==void 0||y.port!==void 0)&&!y.path?S.path="/"+_.path:y.path?S.path=y.path.slice(0,y.path.lastIndexOf("/")+1)+_.path:S.path=_.path,S.path=n(S.path)),S.query=_.query):(S.path=y.path,_.query!==void 0?S.query=_.query:S.query=y.query),S.userinfo=y.userinfo,S.host=y.host,S.port=y.port),S.scheme=y.scheme),S.fragment=_.fragment,S}function d(y,_,b){return typeof y=="string"?(y=unescape(y),y=p(s(v(y,b),!0),{...b,skipEscape:!0})):typeof y=="object"&&(y=p(s(y,!0),{...b,skipEscape:!0})),typeof _=="string"?(_=unescape(_),_=p(s(v(_,b),!0),{...b,skipEscape:!0})):typeof _=="object"&&(_=p(s(_,!0),{...b,skipEscape:!0})),y.toLowerCase()===_.toLowerCase()}function p(y,_){let b={host:y.host,scheme:y.scheme,userinfo:y.userinfo,port:y.port,path:y.path,query:y.query,nid:y.nid,nss:y.nss,uuid:y.uuid,fragment:y.fragment,reference:y.reference,resourceName:y.resourceName,secure:y.secure,error:""},w=Object.assign({},_),S=[],k=a[(w.scheme||b.scheme||"").toLowerCase()];k&&k.serialize&&k.serialize(b,w),b.path!==void 0&&(w.skipEscape?b.path=unescape(b.path):(b.path=escape(b.path),b.scheme!==void 0&&(b.path=b.path.split("%3A").join(":")))),w.reference!=="suffix"&&b.scheme&&S.push(b.scheme,":");let $=o(b);if($!==void 0&&(w.reference!=="suffix"&&S.push("//"),S.push($),b.path&&b.path.charAt(0)!=="/"&&S.push("/")),b.path!==void 0){let P=b.path;!w.absolutePath&&(!k||!k.absolutePath)&&(P=n(P)),$===void 0&&(P=P.replace(/^\/\//u,"/%2F")),S.push(P)}return b.query!==void 0&&S.push("?",b.query),b.fragment!==void 0&&S.push("#",b.fragment),S.join("")}var f=Array.from({length:127},(y,_)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(_)));function m(y){let _=0;for(let b=0,w=y.length;b<w;++b)if(_=y.charCodeAt(b),_>126||f[_])return!0;return!1}var g=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function v(y,_){let b=Object.assign({},_),w={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},S=y.indexOf("%")!==-1,k=!1;b.reference==="suffix"&&(y=(b.scheme?b.scheme+":":"")+"//"+y);let $=y.match(g);if($){if(w.scheme=$[1],w.userinfo=$[3],w.host=$[4],w.port=parseInt($[5],10),w.path=$[6]||"",w.query=$[7],w.fragment=$[8],isNaN(w.port)&&(w.port=$[5]),w.host){let j=i(w.host);if(j.isIPV4===!1){let I=r(j.host);w.host=I.host.toLowerCase(),k=I.isIPV6}else w.host=j.host,k=!0}w.scheme===void 0&&w.userinfo===void 0&&w.host===void 0&&w.port===void 0&&w.query===void 0&&!w.path?w.reference="same-document":w.scheme===void 0?w.reference="relative":w.fragment===void 0?w.reference="absolute":w.reference="uri",b.reference&&b.reference!=="suffix"&&b.reference!==w.reference&&(w.error=w.error||"URI is not a "+b.reference+" reference.");let P=a[(b.scheme||w.scheme||"").toLowerCase()];if(!b.unicodeSupport&&(!P||!P.unicodeSupport)&&w.host&&(b.domainHost||P&&P.domainHost)&&k===!1&&m(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(j){w.error=w.error||"Host's domain name can not be converted to ASCII: "+j}(!P||P&&!P.skipNormalize)&&(S&&w.scheme!==void 0&&(w.scheme=unescape(w.scheme)),S&&w.host!==void 0&&(w.host=unescape(w.host)),w.path&&(w.path=escape(unescape(w.path))),w.fragment&&(w.fragment=encodeURI(decodeURIComponent(w.fragment)))),P&&P.parse&&P.parse(w,b)}else w.error=w.error||"URI can not be parsed.";return w}var h={SCHEMES:a,normalize:u,resolve:l,resolveComponents:c,equal:d,serialize:p,parse:v};e.exports=h,e.exports.default=h,e.exports.fastUri=h}),dJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=cJ();e.code='require("ajv/dist/runtime/uri").default',t.default=e}),fJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var e=Pg();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return e.KeywordCxt}});var r=Je();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});var i=Rx(),n=Tg(),o=SA(),s=Ax(),a=Je(),u=Eg(),l=Ch(),c=bt(),d=sJ(),p=dJ(),f=(J,T)=>new RegExp(J,T);f.code="new RegExp";var m=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),v={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},h={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},y=200;function _(J){var T,G,C,x,E,W,he,me,vt,ct,Jt,D,Z,H,ne,ve,Be,ur,un,gr,yr,lr,Eo,ln,Yl;let Po=J.strict,qr=(T=J.code)===null||T===void 0?void 0:T.optimize,Aa=qr===!0||qr===void 0?1:qr||0,Ql=(C=(G=J.code)===null||G===void 0?void 0:G.regExp)!==null&&C!==void 0?C:f,Np=(x=J.uriResolver)!==null&&x!==void 0?x:p.default;return{strictSchema:(W=(E=J.strictSchema)!==null&&E!==void 0?E:Po)!==null&&W!==void 0?W:!0,strictNumbers:(me=(he=J.strictNumbers)!==null&&he!==void 0?he:Po)!==null&&me!==void 0?me:!0,strictTypes:(ct=(vt=J.strictTypes)!==null&&vt!==void 0?vt:Po)!==null&&ct!==void 0?ct:"log",strictTuples:(D=(Jt=J.strictTuples)!==null&&Jt!==void 0?Jt:Po)!==null&&D!==void 0?D:"log",strictRequired:(H=(Z=J.strictRequired)!==null&&Z!==void 0?Z:Po)!==null&&H!==void 0?H:!1,code:J.code?{...J.code,optimize:Aa,regExp:Ql}:{optimize:Aa,regExp:Ql},loopRequired:(ne=J.loopRequired)!==null&&ne!==void 0?ne:y,loopEnum:(ve=J.loopEnum)!==null&&ve!==void 0?ve:y,meta:(Be=J.meta)!==null&&Be!==void 0?Be:!0,messages:(ur=J.messages)!==null&&ur!==void 0?ur:!0,inlineRefs:(un=J.inlineRefs)!==null&&un!==void 0?un:!0,schemaId:(gr=J.schemaId)!==null&&gr!==void 0?gr:"$id",addUsedSchema:(yr=J.addUsedSchema)!==null&&yr!==void 0?yr:!0,validateSchema:(lr=J.validateSchema)!==null&&lr!==void 0?lr:!0,validateFormats:(Eo=J.validateFormats)!==null&&Eo!==void 0?Eo:!0,unicodeRegExp:(ln=J.unicodeRegExp)!==null&&ln!==void 0?ln:!0,int32range:(Yl=J.int32range)!==null&&Yl!==void 0?Yl:!0,uriResolver:Np}}class b{constructor(T={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,T=this.opts={...T,..._(T)};let{es5:G,lines:C}=this.opts.code;this.scope=new a.ValueScope({scope:{},prefixes:g,es5:G,lines:C}),this.logger=R(T.logger);let x=T.validateFormats;T.validateFormats=!1,this.RULES=(0,o.getRules)(),w.call(this,v,T,"NOT SUPPORTED"),w.call(this,h,T,"DEPRECATED","warn"),this._metaOpts=j.call(this),T.formats&&$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),T.keywords&&P.call(this,T.keywords),typeof T.meta=="object"&&this.addMetaSchema(T.meta),k.call(this),T.validateFormats=x}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:T,meta:G,schemaId:C}=this.opts,x=d;C==="id"&&(x={...d},x.id=x.$id,delete x.$id),G&&T&&this.addMetaSchema(x,x[C],!1)}defaultMeta(){let{meta:T,schemaId:G}=this.opts;return this.opts.defaultMeta=typeof T=="object"?T[G]||T:void 0}validate(T,G){let C;if(typeof T=="string"){if(C=this.getSchema(T),!C)throw Error(`no schema with key or ref "${T}"`)}else C=this.compile(T);let x=C(G);return"$async"in C||(this.errors=C.errors),x}compile(T,G){let C=this._addSchema(T,G);return C.validate||this._compileSchemaEnv(C)}compileAsync(T,G){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:C}=this.opts;return x.call(this,T,G);async function x(ct,Jt){await E.call(this,ct.$schema);let D=this._addSchema(ct,Jt);return D.validate||W.call(this,D)}async function E(ct){ct&&!this.getSchema(ct)&&await x.call(this,{$ref:ct},!0)}async function W(ct){try{return this._compileSchemaEnv(ct)}catch(Jt){if(!(Jt instanceof n.default))throw Jt;return he.call(this,Jt),await me.call(this,Jt.missingSchema),W.call(this,ct)}}function he({missingSchema:ct,missingRef:Jt}){if(this.refs[ct])throw Error(`AnySchema ${ct} is loaded but ${Jt} cannot be resolved`)}async function me(ct){let Jt=await vt.call(this,ct);this.refs[ct]||await E.call(this,Jt.$schema),this.refs[ct]||this.addSchema(Jt,ct,G)}async function vt(ct){let Jt=this._loading[ct];if(Jt)return Jt;try{return await(this._loading[ct]=C(ct))}finally{delete this._loading[ct]}}}addSchema(T,G,C,x=this.opts.validateSchema){if(Array.isArray(T)){for(let W of T)this.addSchema(W,void 0,C,x);return this}let E;if(typeof T=="object"){let{schemaId:W}=this.opts;if(E=T[W],E!==void 0&&typeof E!="string")throw Error(`schema ${W} must be string`)}return G=(0,u.normalizeId)(G||E),this._checkUnique(G),this.schemas[G]=this._addSchema(T,C,G,x,!0),this}addMetaSchema(T,G,C=this.opts.validateSchema){return this.addSchema(T,G,!0,C),this}validateSchema(T,G){if(typeof T=="boolean")return!0;let C;if(C=T.$schema,C!==void 0&&typeof C!="string")throw Error("$schema must be a string");if(C=C||this.opts.defaultMeta||this.defaultMeta(),!C)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let x=this.validate(C,T);if(!x&&G){let E="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(E);else throw Error(E)}return x}getSchema(T){let G;for(;typeof(G=S.call(this,T))=="string";)T=G;if(G===void 0){let{schemaId:C}=this.opts,x=new s.SchemaEnv({schema:{},schemaId:C});if(G=s.resolveSchema.call(this,x,T),!G)return;this.refs[T]=G}return G.validate||this._compileSchemaEnv(G)}removeSchema(T){if(T instanceof RegExp)return this._removeAllSchemas(this.schemas,T),this._removeAllSchemas(this.refs,T),this;switch(typeof T){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let G=S.call(this,T);return typeof G=="object"&&this._cache.delete(G.schema),delete this.schemas[T],delete this.refs[T],this}case"object":{let G=T;this._cache.delete(G);let C=T[this.opts.schemaId];return C&&(C=(0,u.normalizeId)(C),delete this.schemas[C],delete this.refs[C]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(T){for(let G of T)this.addKeyword(G);return this}addKeyword(T,G){let C;if(typeof T=="string")C=T,typeof G=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),G.keyword=C);else if(typeof T=="object"&&G===void 0){if(G=T,C=G.keyword,Array.isArray(C)&&!C.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(O.call(this,C,G),!G)return(0,c.eachItem)(C,E=>Q.call(this,E)),this;Oe.call(this,G);let x={...G,type:(0,l.getJSONTypes)(G.type),schemaType:(0,l.getJSONTypes)(G.schemaType)};return(0,c.eachItem)(C,x.type.length===0?E=>Q.call(this,E,x):E=>x.type.forEach(W=>Q.call(this,E,x,W))),this}getKeyword(T){let G=this.RULES.all[T];return typeof G=="object"?G.definition:!!G}removeKeyword(T){let{RULES:G}=this;delete G.keywords[T],delete G.all[T];for(let C of G.rules){let x=C.rules.findIndex(E=>E.keyword===T);x>=0&&C.rules.splice(x,1)}return this}addFormat(T,G){return typeof G=="string"&&(G=new RegExp(G)),this.formats[T]=G,this}errorsText(T=this.errors,{separator:G=", ",dataVar:C="data"}={}){return!T||T.length===0?"No errors":T.map(x=>`${C}${x.instancePath} ${x.message}`).reduce((x,E)=>x+G+E)}$dataMetaSchema(T,G){let C=this.RULES.all;T=JSON.parse(JSON.stringify(T));for(let x of G){let E=x.split("/").slice(1),W=T;for(let he of E)W=W[he];for(let he in C){let me=C[he];if(typeof me!="object")continue;let{$data:vt}=me.definition,ct=W[he];vt&&ct&&(W[he]=pe(ct))}}return T}_removeAllSchemas(T,G){for(let C in T){let x=T[C];(!G||G.test(C))&&(typeof x=="string"?delete T[C]:x&&!x.meta&&(this._cache.delete(x.schema),delete T[C]))}}_addSchema(T,G,C,x=this.opts.validateSchema,E=this.opts.addUsedSchema){let W,{schemaId:he}=this.opts;if(typeof T=="object")W=T[he];else{if(this.opts.jtd)throw Error("schema must be object");if(typeof T!="boolean")throw Error("schema must be object or boolean")}let me=this._cache.get(T);if(me!==void 0)return me;C=(0,u.normalizeId)(W||C);let vt=u.getSchemaRefs.call(this,T,C);return me=new s.SchemaEnv({schema:T,schemaId:he,meta:G,baseId:C,localRefs:vt}),this._cache.set(me.schema,me),E&&!C.startsWith("#")&&(C&&this._checkUnique(C),this.refs[C]=me),x&&this.validateSchema(T,!0),me}_checkUnique(T){if(this.schemas[T]||this.refs[T])throw Error(`schema with key or id "${T}" already exists`)}_compileSchemaEnv(T){if(T.meta?this._compileMetaSchema(T):s.compileSchema.call(this,T),!T.validate)throw Error("ajv implementation error");return T.validate}_compileMetaSchema(T){let G=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,T)}finally{this.opts=G}}}b.ValidationError=i.default,b.MissingRefError=n.default,t.default=b;function w(J,T,G,C="error"){for(let x in J){let E=x;E in T&&this.logger[C](`${G}: option ${x}. ${J[E]}`)}}function S(J){return J=(0,u.normalizeId)(J),this.schemas[J]||this.refs[J]}function k(){let J=this.opts.schemas;if(J)if(Array.isArray(J))this.addSchema(J);else for(let T in J)this.addSchema(J[T],T)}function $(){for(let J in this.opts.formats){let T=this.opts.formats[J];T&&this.addFormat(J,T)}}function P(J){if(Array.isArray(J)){this.addVocabulary(J);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let T in J){let G=J[T];G.keyword||(G.keyword=T),this.addKeyword(G)}}function j(){let J={...this.opts};for(let T of m)delete J[T];return J}var I={log(){},warn(){},error(){}};function R(J){if(J===!1)return I;if(J===void 0)return console;if(J.log&&J.warn&&J.error)return J;throw Error("logger must implement log, warn and error methods")}var q=/^[a-z_$][a-z0-9_$:-]*$/i;function O(J,T){let{RULES:G}=this;if((0,c.eachItem)(J,C=>{if(G.keywords[C])throw Error(`Keyword ${C} is already defined`);if(!q.test(C))throw Error(`Keyword ${C} has invalid name`)}),!!T&&T.$data&&!("code"in T||"validate"in T))throw Error('$data keyword must have "code" or "validate" function')}function Q(J,T,G){var C;let x=T?.post;if(G&&x)throw Error('keyword with "post" flag cannot have "type"');let{RULES:E}=this,W=x?E.post:E.rules.find(({type:me})=>me===G);if(W||(W={type:G,rules:[]},E.rules.push(W)),E.keywords[J]=!0,!T)return;let he={keyword:J,definition:{...T,type:(0,l.getJSONTypes)(T.type),schemaType:(0,l.getJSONTypes)(T.schemaType)}};T.before?K.call(this,W,he,T.before):W.rules.push(he),E.all[J]=he,(C=T.implements)===null||C===void 0||C.forEach(me=>this.addKeyword(me))}function K(J,T,G){let C=J.rules.findIndex(x=>x.keyword===G);C>=0?J.rules.splice(C,0,T):(J.rules.push(T),this.logger.warn(`rule ${G} is not defined`))}function Oe(J){let{metaSchema:T}=J;T!==void 0&&(J.$data&&this.opts.$data&&(T=pe(T)),J.validateSchema=this.compile(T,!0))}var st={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function pe(J){return{anyOf:[J,st]}}}),pJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};t.default=e}),mJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;var e=Tg(),r=wi(),i=Je(),n=Jo(),o=Ax(),s=bt(),a={keyword:"$ref",schemaType:"string",code(c){let{gen:d,schema:p,it:f}=c,{baseId:m,schemaEnv:g,validateName:v,opts:h,self:y}=f,{root:_}=g;if((p==="#"||p==="#/")&&m===_.baseId)return w();let b=o.resolveRef.call(y,_,m,p);if(b===void 0)throw new e.default(f.opts.uriResolver,m,p);if(b instanceof o.SchemaEnv)return S(b);return k(b);function w(){if(g===_)return l(c,v,g,g.$async);let $=d.scopeValue("root",{ref:_});return l(c,i._`${$}.validate`,_,_.$async)}function S($){let P=u(c,$);l(c,P,$,$.$async)}function k($){let P=d.scopeValue("schema",h.code.source===!0?{ref:$,code:(0,i.stringify)($)}:{ref:$}),j=d.name("valid"),I=c.subschema({schema:$,dataTypes:[],schemaPath:i.nil,topSchemaRef:P,errSchemaPath:p},j);c.mergeEvaluated(I),c.ok(j)}}};function u(c,d){let{gen:p}=c;return d.validate?p.scopeValue("validate",{ref:d.validate}):i._`${p.scopeValue("wrapper",{ref:d})}.validate`}t.getValidate=u;function l(c,d,p,f){let{gen:m,it:g}=c,{allErrors:v,schemaEnv:h,opts:y}=g,_=y.passContext?n.default.this:i.nil;f?b():w();function b(){if(!h.$async)throw Error("async schema referenced by sync schema");let $=m.let("valid");m.try(()=>{m.code(i._`await ${(0,r.callValidateCode)(c,d,_)}`),k(d),!v&&m.assign($,!0)},P=>{m.if(i._`!(${P} instanceof ${g.ValidationError})`,()=>m.throw(P)),S(P),!v&&m.assign($,!1)}),c.ok($)}function w(){c.result((0,r.callValidateCode)(c,d,_),()=>k(d),()=>S(d))}function S($){let P=i._`${$}.errors`;m.assign(n.default.vErrors,i._`${n.default.vErrors} === null ? ${P} : ${n.default.vErrors}.concat(${P})`),m.assign(n.default.errors,i._`${n.default.vErrors}.length`)}function k($){var P;if(!g.opts.unevaluated)return;let j=(P=p?.validate)===null||P===void 0?void 0:P.evaluated;if(g.props!==!0)if(j&&!j.dynamicProps)j.props!==void 0&&(g.props=s.mergeEvaluated.props(m,j.props,g.props));else{let I=m.var("props",i._`${$}.evaluated.props`);g.props=s.mergeEvaluated.props(m,I,g.props,i.Name)}if(g.items!==!0)if(j&&!j.dynamicItems)j.items!==void 0&&(g.items=s.mergeEvaluated.items(m,j.items,g.items));else{let I=m.var("items",i._`${$}.evaluated.items`);g.items=s.mergeEvaluated.items(m,I,g.items,i.Name)}}}t.callRef=l,t.default=a}),hJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=pJ(),r=mJ(),i=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,r.default];t.default=i}),gJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r=e.operators,i={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={message:({keyword:s,schemaCode:a})=>e.str`must be ${i[s].okStr} ${a}`,params:({keyword:s,schemaCode:a})=>e._`{comparison: ${i[s].okStr}, limit: ${a}}`},o={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:n,code(s){let{keyword:a,data:u,schemaCode:l}=s;s.fail$data(e._`${u} ${i[a].fail} ${l} || isNaN(${u})`)}};t.default=o}),yJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r={message:({schemaCode:n})=>e.str`must be multiple of ${n}`,params:({schemaCode:n})=>e._`{multipleOf: ${n}}`},i={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:r,code(n){let{gen:o,data:s,schemaCode:a,it:u}=n,l=u.opts.multipleOfPrecision,c=o.let("res"),d=l?e._`Math.abs(Math.round(${c}) - ${c}) > 1e-${l}`:e._`${c} !== parseInt(${c})`;n.fail$data(e._`(${a} === 0 || (${c} = ${s}/${a}, ${d}))`)}};t.default=i}),vJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});function e(r){let i=r.length,n=0,o=0,s;for(;o<i;)n++,s=r.charCodeAt(o++),s>=55296&&s<=56319&&o<i&&(s=r.charCodeAt(o),(s&64512)===56320&&o++);return n}t.default=e,e.code='require("ajv/dist/runtime/ucs2length").default'}),_J=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r=bt(),i=vJ(),n={message({keyword:s,schemaCode:a}){let u=s==="maxLength"?"more":"fewer";return e.str`must NOT have ${u} than ${a} characters`},params:({schemaCode:s})=>e._`{limit: ${s}}`},o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:n,code(s){let{keyword:a,data:u,schemaCode:l,it:c}=s,d=a==="maxLength"?e.operators.GT:e.operators.LT,p=c.opts.unicode===!1?e._`${u}.length`:e._`${(0,r.useFunc)(s.gen,i.default)}(${u})`;s.fail$data(e._`${p} ${d} ${l}`)}};t.default=o}),bJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=wi(),r=bt(),i=Je(),n={message:({schemaCode:s})=>i.str`must match pattern "${s}"`,params:({schemaCode:s})=>i._`{pattern: ${s}}`},o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:n,code(s){let{gen:a,data:u,$data:l,schema:c,schemaCode:d,it:p}=s,f=p.opts.unicodeRegExp?"u":"";if(l){let{regExp:m}=p.opts.code,g=m.code==="new RegExp"?i._`new RegExp`:(0,r.useFunc)(a,m),v=a.let("valid");a.try(()=>a.assign(v,i._`${g}(${d}, ${f}).test(${u})`),()=>a.assign(v,!1)),s.fail$data(i._`!${v}`)}else{let m=(0,e.usePattern)(s,c);s.fail$data(i._`!${m}.test(${u})`)}}};t.default=o}),wJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r={message({keyword:n,schemaCode:o}){let s=n==="maxProperties"?"more":"fewer";return e.str`must NOT have ${s} than ${o} properties`},params:({schemaCode:n})=>e._`{limit: ${n}}`},i={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:r,code(n){let{keyword:o,data:s,schemaCode:a}=n,u=o==="maxProperties"?e.operators.GT:e.operators.LT;n.fail$data(e._`Object.keys(${s}).length ${u} ${a}`)}};t.default=i}),SJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=wi(),r=Je(),i=bt(),n={message:({params:{missingProperty:s}})=>r.str`must have required property '${s}'`,params:({params:{missingProperty:s}})=>r._`{missingProperty: ${s}}`},o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:n,code(s){let{gen:a,schema:u,schemaCode:l,data:c,$data:d,it:p}=s,{opts:f}=p;if(!d&&u.length===0)return;let m=u.length>=f.loopRequired;if(p.allErrors?g():v(),f.strictRequired){let _=s.parentSchema.properties,{definedProperties:b}=s.it;for(let w of u)if(_?.[w]===void 0&&!b.has(w)){let S=p.schemaEnv.baseId+p.errSchemaPath,k=`required property "${w}" is not defined at "${S}" (strictRequired)`;(0,i.checkStrictMode)(p,k,p.opts.strictRequired)}}function g(){if(m||d)s.block$data(r.nil,h);else for(let _ of u)(0,e.checkReportMissingProp)(s,_)}function v(){let _=a.let("missing");if(m||d){let b=a.let("valid",!0);s.block$data(b,()=>y(_,b)),s.ok(b)}else a.if((0,e.checkMissingProp)(s,u,_)),(0,e.reportMissingProp)(s,_),a.else()}function h(){a.forOf("prop",l,_=>{s.setParams({missingProperty:_}),a.if((0,e.noPropertyInData)(a,c,_,f.ownProperties),()=>s.error())})}function y(_,b){s.setParams({missingProperty:_}),a.forOf(_,l,()=>{a.assign(b,(0,e.propertyInData)(a,c,_,f.ownProperties)),a.if((0,r.not)(b),()=>{s.error(),a.break()})},r.nil)}}};t.default=o}),kJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r={message({keyword:n,schemaCode:o}){let s=n==="maxItems"?"more":"fewer";return e.str`must NOT have ${s} than ${o} items`},params:({schemaCode:n})=>e._`{limit: ${n}}`},i={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:r,code(n){let{keyword:o,data:s,schemaCode:a}=n,u=o==="maxItems"?e.operators.GT:e.operators.LT;n.fail$data(e._`${s}.length ${u} ${a}`)}};t.default=i}),Dx=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=xA();e.code='require("ajv/dist/runtime/equal").default',t.default=e}),xJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Ch(),r=Je(),i=bt(),n=Dx(),o={message:({params:{i:a,j:u}})=>r.str`must NOT have duplicate items (items ## ${u} and ${a} are identical)`,params:({params:{i:a,j:u}})=>r._`{i: ${a}, j: ${u}}`},s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:o,code(a){let{gen:u,data:l,$data:c,schema:d,parentSchema:p,schemaCode:f,it:m}=a;if(!c&&!d)return;let g=u.let("valid"),v=p.items?(0,e.getSchemaTypes)(p.items):[];a.block$data(g,h,r._`${f} === false`),a.ok(g);function h(){let w=u.let("i",r._`${l}.length`),S=u.let("j");a.setParams({i:w,j:S}),u.assign(g,!0),u.if(r._`${w} > 1`,()=>(y()?_:b)(w,S))}function y(){return v.length>0&&!v.some(w=>w==="object"||w==="array")}function _(w,S){let k=u.name("item"),$=(0,e.checkDataTypes)(v,k,m.opts.strictNumbers,e.DataType.Wrong),P=u.const("indices",r._`{}`);u.for(r._`;${w}--;`,()=>{u.let(k,r._`${l}[${w}]`),u.if($,r._`continue`),v.length>1&&u.if(r._`typeof ${k} == "string"`,r._`${k} += "_"`),u.if(r._`typeof ${P}[${k}] == "number"`,()=>{u.assign(S,r._`${P}[${k}]`),a.error(),u.assign(g,!1).break()}).code(r._`${P}[${k}] = ${w}`)})}function b(w,S){let k=(0,i.useFunc)(u,n.default),$=u.name("outer");u.label($).for(r._`;${w}--;`,()=>u.for(r._`${S} = ${w}; ${S}--;`,()=>u.if(r._`${k}(${l}[${w}], ${l}[${S}])`,()=>{a.error(),u.assign(g,!1).break($)})))}}};t.default=s}),$J=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r=bt(),i=Dx(),n={message:"must be equal to constant",params:({schemaCode:s})=>e._`{allowedValue: ${s}}`},o={keyword:"const",$data:!0,error:n,code(s){let{gen:a,data:u,$data:l,schemaCode:c,schema:d}=s;l||d&&typeof d=="object"?s.fail$data(e._`!${(0,r.useFunc)(a,i.default)}(${u}, ${c})`):s.fail(e._`${d} !== ${u}`)}};t.default=o}),IJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r=bt(),i=Dx(),n={message:"must be equal to one of the allowed values",params:({schemaCode:s})=>e._`{allowedValues: ${s}}`},o={keyword:"enum",schemaType:"array",$data:!0,error:n,code(s){let{gen:a,data:u,$data:l,schema:c,schemaCode:d,it:p}=s;if(!l&&c.length===0)throw Error("enum must have non-empty array");let f=c.length>=p.opts.loopEnum,m,g=()=>m??(m=(0,r.useFunc)(a,i.default)),v;if(f||l)v=a.let("valid"),s.block$data(v,h);else{if(!Array.isArray(c))throw Error("ajv implementation error");let _=a.const("vSchema",d);v=(0,e.or)(...c.map((b,w)=>y(_,w)))}s.pass(v);function h(){a.assign(v,!1),a.forOf("v",d,_=>a.if(e._`${g()}(${u}, ${_})`,()=>a.assign(v,!0).break()))}function y(_,b){let w=c[b];return typeof w=="object"&&w!==null?e._`${g()}(${u}, ${_}[${b}])`:e._`${u} === ${w}`}}};t.default=o}),EJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=gJ(),r=yJ(),i=_J(),n=bJ(),o=wJ(),s=SJ(),a=kJ(),u=xJ(),l=$J(),c=IJ(),d=[e.default,r.default,i.default,n.default,o.default,s.default,a.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},l.default,c.default];t.default=d}),$A=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;var e=Je(),r=bt(),i={message:({params:{len:s}})=>e.str`must NOT have more than ${s} items`,params:({params:{len:s}})=>e._`{limit: ${s}}`},n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:i,code(s){let{parentSchema:a,it:u}=s,{items:l}=a;if(!Array.isArray(l)){(0,r.checkStrictMode)(u,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(s,l)}};function o(s,a){let{gen:u,schema:l,data:c,keyword:d,it:p}=s;p.items=!0;let f=u.const("len",e._`${c}.length`);if(l===!1)s.setParams({len:a.length}),s.pass(e._`${f} <= ${a.length}`);else if(typeof l=="object"&&!(0,r.alwaysValidSchema)(p,l)){let g=u.var("valid",e._`${f} <= ${a.length}`);u.if((0,e.not)(g),()=>m(g)),s.ok(g)}function m(g){u.forRange("i",a.length,f,v=>{s.subschema({keyword:d,dataProp:v,dataPropType:r.Type.Num},g),!p.allErrors&&u.if((0,e.not)(g),()=>u.break())})}}t.validateAdditionalItems=o,t.default=n}),IA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;var e=Je(),r=bt(),i=wi(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(s){let{schema:a,it:u}=s;if(Array.isArray(a))return o(s,"additionalItems",a);u.items=!0,!(0,r.alwaysValidSchema)(u,a)&&s.ok((0,i.validateArray)(s))}};function o(s,a,u=s.schema){let{gen:l,parentSchema:c,data:d,keyword:p,it:f}=s;v(c),f.opts.unevaluated&&u.length&&f.items!==!0&&(f.items=r.mergeEvaluated.items(l,u.length,f.items));let m=l.name("valid"),g=l.const("len",e._`${d}.length`);u.forEach((h,y)=>{(0,r.alwaysValidSchema)(f,h)||(l.if(e._`${g} > ${y}`,()=>s.subschema({keyword:p,schemaProp:y,dataProp:y},m)),s.ok(m))});function v(h){let{opts:y,errSchemaPath:_}=f,b=u.length,w=b===h.minItems&&(b===h.maxItems||h[a]===!1);if(y.strictTuples&&!w){let S=`"${p}" is ${b}-tuple, but minItems or maxItems/${a} are not specified or different at path "${_}"`;(0,r.checkStrictMode)(f,S,y.strictTuples)}}}t.validateTuple=o,t.default=n}),PJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=IA(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:i=>(0,e.validateTuple)(i,"items")};t.default=r}),TJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r=bt(),i=wi(),n=$A(),o={message:({params:{len:a}})=>e.str`must NOT have more than ${a} items`,params:({params:{len:a}})=>e._`{limit: ${a}}`},s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:o,code(a){let{schema:u,parentSchema:l,it:c}=a,{prefixItems:d}=l;c.items=!0,!(0,r.alwaysValidSchema)(c,u)&&(d?(0,n.validateAdditionalItems)(a,d):a.ok((0,i.validateArray)(a)))}};t.default=s}),OJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r=bt(),i={message:({params:{min:o,max:s}})=>s===void 0?e.str`must contain at least ${o} valid item(s)`:e.str`must contain at least ${o} and no more than ${s} valid item(s)`,params:({params:{min:o,max:s}})=>s===void 0?e._`{minContains: ${o}}`:e._`{minContains: ${o}, maxContains: ${s}}`},n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:i,code(o){let{gen:s,schema:a,parentSchema:u,data:l,it:c}=o,d,p,{minContains:f,maxContains:m}=u;c.opts.next?(d=f===void 0?1:f,p=m):d=1;let g=s.const("len",e._`${l}.length`);if(o.setParams({min:d,max:p}),p===void 0&&d===0){(0,r.checkStrictMode)(c,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&d>p){(0,r.checkStrictMode)(c,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,r.alwaysValidSchema)(c,a)){let b=e._`${g} >= ${d}`;p!==void 0&&(b=e._`${b} && ${g} <= ${p}`),o.pass(b);return}c.items=!0;let v=s.name("valid");p===void 0&&d===1?y(v,()=>s.if(v,()=>s.break())):d===0?(s.let(v,!0),p!==void 0&&s.if(e._`${l}.length > 0`,h)):(s.let(v,!1),h()),o.result(v,()=>o.reset());function h(){let b=s.name("_valid"),w=s.let("count",0);y(b,()=>s.if(b,()=>_(w)))}function y(b,w){s.forRange("i",0,g,S=>{o.subschema({keyword:"contains",dataProp:S,dataPropType:r.Type.Num,compositeRule:!0},b),w()})}function _(b){s.code(e._`${b}++`),p===void 0?s.if(e._`${b} >= ${d}`,()=>s.assign(v,!0).break()):(s.if(e._`${b} > ${p}`,()=>s.assign(v,!1).break()),d===1?s.assign(v,!0):s.if(e._`${b} >= ${d}`,()=>s.assign(v,!0)))}}};t.default=n}),zJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;var e=Je(),r=bt(),i=wi();t.error={message:({params:{property:u,depsCount:l,deps:c}})=>{let d=l===1?"property":"properties";return e.str`must have ${d} ${c} when property ${u} is present`},params:({params:{property:u,depsCount:l,deps:c,missingProperty:d}})=>e._`{property: ${u},
132
- missingProperty: ${d},
133
- depsCount: ${l},
134
- deps: ${c}}`};var n={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(u){let[l,c]=o(u);s(u,l),a(u,c)}};function o({schema:u}){let l={},c={};for(let d in u){if(d==="__proto__")continue;let p=Array.isArray(u[d])?l:c;p[d]=u[d]}return[l,c]}function s(u,l=u.schema){let{gen:c,data:d,it:p}=u;if(Object.keys(l).length===0)return;let f=c.let("missing");for(let m in l){let g=l[m];if(g.length===0)continue;let v=(0,i.propertyInData)(c,d,m,p.opts.ownProperties);u.setParams({property:m,depsCount:g.length,deps:g.join(", ")}),p.allErrors?c.if(v,()=>{for(let h of g)(0,i.checkReportMissingProp)(u,h)}):(c.if(e._`${v} && (${(0,i.checkMissingProp)(u,g,f)})`),(0,i.reportMissingProp)(u,f),c.else())}}t.validatePropertyDeps=s;function a(u,l=u.schema){let{gen:c,data:d,keyword:p,it:f}=u,m=c.name("valid");for(let g in l)(0,r.alwaysValidSchema)(f,l[g])||(c.if((0,i.propertyInData)(c,d,g,f.opts.ownProperties),()=>{let v=u.subschema({keyword:p,schemaProp:g},m);u.mergeValidEvaluated(v,m)},()=>c.var(m,!0)),u.ok(m))}t.validateSchemaDeps=a,t.default=n}),NJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r=bt(),i={message:"property name must be valid",params:({params:o})=>e._`{propertyName: ${o.propertyName}}`},n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:i,code(o){let{gen:s,schema:a,data:u,it:l}=o;if((0,r.alwaysValidSchema)(l,a))return;let c=s.name("valid");s.forIn("key",u,d=>{o.setParams({propertyName:d}),o.subschema({keyword:"propertyNames",data:d,dataTypes:["string"],propertyName:d,compositeRule:!0},c),s.if((0,e.not)(c),()=>{o.error(!0),!l.allErrors&&s.break()})}),o.ok(c)}};t.default=n}),EA=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=wi(),r=Je(),i=Jo(),n=bt(),o={message:"must NOT have additional properties",params:({params:a})=>r._`{additionalProperty: ${a.additionalProperty}}`},s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:o,code(a){let{gen:u,schema:l,parentSchema:c,data:d,errsCount:p,it:f}=a;if(!p)throw Error("ajv implementation error");let{allErrors:m,opts:g}=f;if(f.props=!0,g.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(f,l))return;let v=(0,e.allSchemaProperties)(c.properties),h=(0,e.allSchemaProperties)(c.patternProperties);y(),a.ok(r._`${p} === ${i.default.errors}`);function y(){u.forIn("key",d,k=>{!v.length&&!h.length?w(k):u.if(_(k),()=>w(k))})}function _(k){let $;if(v.length>8){let P=(0,n.schemaRefOrVal)(f,c.properties,"properties");$=(0,e.isOwnProperty)(u,P,k)}else v.length?$=(0,r.or)(...v.map(P=>r._`${k} === ${P}`)):$=r.nil;return h.length&&($=(0,r.or)($,...h.map(P=>r._`${(0,e.usePattern)(a,P)}.test(${k})`))),(0,r.not)($)}function b(k){u.code(r._`delete ${d}[${k}]`)}function w(k){if(g.removeAdditional==="all"||g.removeAdditional&&l===!1){b(k);return}if(l===!1){a.setParams({additionalProperty:k}),a.error(),!m&&u.break();return}if(typeof l=="object"&&!(0,n.alwaysValidSchema)(f,l)){let $=u.name("valid");g.removeAdditional==="failing"?(S(k,$,!1),u.if((0,r.not)($),()=>{a.reset(),b(k)})):(S(k,$),!m&&u.if((0,r.not)($),()=>u.break()))}}function S(k,$,P){let j={keyword:"additionalProperties",dataProp:k,dataPropType:n.Type.Str};P===!1&&Object.assign(j,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(j,$)}}};t.default=s}),jJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Pg(),r=wi(),i=bt(),n=EA(),o={keyword:"properties",type:"object",schemaType:"object",code(s){let{gen:a,schema:u,parentSchema:l,data:c,it:d}=s;d.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&n.default.code(new e.KeywordCxt(d,n.default,"additionalProperties"));let p=(0,r.allSchemaProperties)(u);for(let h of p)d.definedProperties.add(h);d.opts.unevaluated&&p.length&&d.props!==!0&&(d.props=i.mergeEvaluated.props(a,(0,i.toHash)(p),d.props));let f=p.filter(h=>!(0,i.alwaysValidSchema)(d,u[h]));if(f.length===0)return;let m=a.name("valid");for(let h of f)g(h)?v(h):(a.if((0,r.propertyInData)(a,c,h,d.opts.ownProperties)),v(h),!d.allErrors&&a.else().var(m,!0),a.endIf()),s.it.definedProperties.add(h),s.ok(m);function g(h){return d.opts.useDefaults&&!d.compositeRule&&u[h].default!==void 0}function v(h){s.subschema({keyword:"properties",schemaProp:h,dataProp:h},m)}}};t.default=o}),CJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=wi(),r=Je(),i=bt(),n=bt(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(s){let{gen:a,schema:u,data:l,parentSchema:c,it:d}=s,{opts:p}=d,f=(0,e.allSchemaProperties)(u),m=f.filter(w=>(0,i.alwaysValidSchema)(d,u[w]));if(f.length===0||m.length===f.length&&(!d.opts.unevaluated||d.props===!0))return;let g=p.strictSchema&&!p.allowMatchingProperties&&c.properties,v=a.name("valid");d.props!==!0&&!(d.props instanceof r.Name)&&(d.props=(0,n.evaluatedPropsToName)(a,d.props));let{props:h}=d;y();function y(){for(let w of f)g&&_(w),d.allErrors?b(w):(a.var(v,!0),b(w),a.if(v))}function _(w){for(let S in g)new RegExp(w).test(S)&&(0,i.checkStrictMode)(d,`property ${S} matches pattern ${w} (use allowMatchingProperties)`)}function b(w){a.forIn("key",l,S=>{a.if(r._`${(0,e.usePattern)(s,w)}.test(${S})`,()=>{let k=m.includes(w);k||s.subschema({keyword:"patternProperties",schemaProp:w,dataProp:S,dataPropType:n.Type.Str},v),d.opts.unevaluated&&h!==!0?a.assign(r._`${h}[${S}]`,!0):!k&&!d.allErrors&&a.if((0,r.not)(v),()=>a.break())})})}}};t.default=o}),RJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=bt(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(i){let{gen:n,schema:o,it:s}=i;if((0,e.alwaysValidSchema)(s,o)){i.fail();return}let a=n.name("valid");i.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),i.failResult(a,()=>i.reset(),()=>i.error())},error:{message:"must NOT be valid"}};t.default=r}),AJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=wi(),r={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:e.validateUnion,error:{message:"must match a schema in anyOf"}};t.default=r}),DJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r=bt(),i={message:"must match exactly one schema in oneOf",params:({params:o})=>e._`{passingSchemas: ${o.passing}}`},n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:i,code(o){let{gen:s,schema:a,parentSchema:u,it:l}=o;if(!Array.isArray(a))throw Error("ajv implementation error");if(l.opts.discriminator&&u.discriminator)return;let c=a,d=s.let("valid",!1),p=s.let("passing",null),f=s.name("_valid");o.setParams({passing:p}),s.block(m),o.result(d,()=>o.reset(),()=>o.error(!0));function m(){c.forEach((g,v)=>{let h;(0,r.alwaysValidSchema)(l,g)?s.var(f,!0):h=o.subschema({keyword:"oneOf",schemaProp:v,compositeRule:!0},f),v>0&&s.if(e._`${f} && ${d}`).assign(d,!1).assign(p,e._`[${p}, ${v}]`).else(),s.if(f,()=>{s.assign(d,!0),s.assign(p,v),h&&o.mergeEvaluated(h,e.Name)})})}}};t.default=n}),UJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=bt(),r={keyword:"allOf",schemaType:"array",code(i){let{gen:n,schema:o,it:s}=i;if(!Array.isArray(o))throw Error("ajv implementation error");let a=n.name("valid");o.forEach((u,l)=>{if((0,e.alwaysValidSchema)(s,u))return;let c=i.subschema({keyword:"allOf",schemaProp:l},a);i.ok(a),i.mergeEvaluated(c)})}};t.default=r}),MJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r=bt(),i={message:({params:s})=>e.str`must match "${s.ifClause}" schema`,params:({params:s})=>e._`{failingKeyword: ${s.ifClause}}`},n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:i,code(s){let{gen:a,parentSchema:u,it:l}=s;u.then===void 0&&u.else===void 0&&(0,r.checkStrictMode)(l,'"if" without "then" and "else" is ignored');let c=o(l,"then"),d=o(l,"else");if(!c&&!d)return;let p=a.let("valid",!0),f=a.name("_valid");if(m(),s.reset(),c&&d){let v=a.let("ifClause");s.setParams({ifClause:v}),a.if(f,g("then",v),g("else",v))}else c?a.if(f,g("then")):a.if((0,e.not)(f),g("else"));s.pass(p,()=>s.error(!0));function m(){let v=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},f);s.mergeEvaluated(v)}function g(v,h){return()=>{let y=s.subschema({keyword:v},f);a.assign(p,f),s.mergeValidEvaluated(y,p),h?a.assign(h,e._`${v}`):s.setParams({ifClause:v})}}}};function o(s,a){let u=s.schema[a];return u!==void 0&&!(0,r.alwaysValidSchema)(s,u)}t.default=n}),ZJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=bt(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:i,parentSchema:n,it:o}){n.if===void 0&&(0,e.checkStrictMode)(o,`"${i}" without "if" is ignored`)}};t.default=r}),LJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=$A(),r=PJ(),i=IA(),n=TJ(),o=OJ(),s=zJ(),a=NJ(),u=EA(),l=jJ(),c=CJ(),d=RJ(),p=AJ(),f=DJ(),m=UJ(),g=MJ(),v=ZJ();function h(y=!1){let _=[d.default,p.default,f.default,m.default,g.default,v.default,a.default,u.default,s.default,l.default,c.default];return y?_.push(r.default,n.default):_.push(e.default,i.default),_.push(o.default),_}t.default=h}),qJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r={message:({schemaCode:n})=>e.str`must match format "${n}"`,params:({schemaCode:n})=>e._`{format: ${n}}`},i={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:r,code(n,o){let{gen:s,data:a,$data:u,schema:l,schemaCode:c,it:d}=n,{opts:p,errSchemaPath:f,schemaEnv:m,self:g}=d;if(!p.validateFormats)return;u?v():h();function v(){let y=s.scopeValue("formats",{ref:g.formats,code:p.code.formats}),_=s.const("fDef",e._`${y}[${c}]`),b=s.let("fType"),w=s.let("format");s.if(e._`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>s.assign(b,e._`${_}.type || "string"`).assign(w,e._`${_}.validate`),()=>s.assign(b,e._`"string"`).assign(w,_)),n.fail$data((0,e.or)(S(),k()));function S(){return p.strictSchema===!1?e.nil:e._`${c} && !${w}`}function k(){let $=m.$async?e._`(${_}.async ? await ${w}(${a}) : ${w}(${a}))`:e._`${w}(${a})`,P=e._`(typeof ${w} == "function" ? ${$} : ${w}.test(${a}))`;return e._`${w} && ${w} !== true && ${b} === ${o} && !${P}`}}function h(){let y=g.formats[l];if(!y){S();return}if(y===!0)return;let[_,b,w]=k(y);_===o&&n.pass($());function S(){if(p.strictSchema===!1){g.logger.warn(P());return}throw Error(P());function P(){return`unknown format "${l}" ignored in schema at path "${f}"`}}function k(P){let j=P instanceof RegExp?(0,e.regexpCode)(P):p.code.formats?e._`${p.code.formats}${(0,e.getProperty)(l)}`:void 0,I=s.scopeValue("formats",{key:l,ref:P,code:j});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,e._`${I}.validate`]:["string",P,I]}function $(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!m.$async)throw Error("async format in sync schema");return e._`await ${w}(${a})`}return typeof b=="function"?e._`${w}(${a})`:e._`${w}.test(${a})`}}}};t.default=i}),FJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=qJ(),r=[e.default];t.default=r}),VJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]}),WJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=hJ(),r=EJ(),i=LJ(),n=FJ(),o=VJ(),s=[e.default,r.default,(0,i.default)(),n.default,o.metadataVocabulary,o.contentVocabulary];t.default=s}),GJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0;var e;(function(r){r.Tag="tag",r.Mapping="mapping"})(e||(t.DiscrError=e={}))}),BJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Je(),r=GJ(),i=Ax(),n=Tg(),o=bt(),s={message:({params:{discrError:u,tagName:l}})=>u===r.DiscrError.Tag?`tag "${l}" must be string`:`value of tag "${l}" must be in oneOf`,params:({params:{discrError:u,tag:l,tagName:c}})=>e._`{error: ${u}, tag: ${c}, tagValue: ${l}}`},a={keyword:"discriminator",type:"object",schemaType:"object",error:s,code(u){let{gen:l,data:c,schema:d,parentSchema:p,it:f}=u,{oneOf:m}=p;if(!f.opts.discriminator)throw Error("discriminator: requires discriminator option");let g=d.propertyName;if(typeof g!="string")throw Error("discriminator: requires propertyName");if(d.mapping)throw Error("discriminator: mapping is not supported");if(!m)throw Error("discriminator: requires oneOf keyword");let v=l.let("valid",!1),h=l.const("tag",e._`${c}${(0,e.getProperty)(g)}`);l.if(e._`typeof ${h} == "string"`,()=>y(),()=>u.error(!1,{discrError:r.DiscrError.Tag,tag:h,tagName:g})),u.ok(v);function y(){let w=b();l.if(!1);for(let S in w)l.elseIf(e._`${h} === ${S}`),l.assign(v,_(w[S]));l.else(),u.error(!1,{discrError:r.DiscrError.Mapping,tag:h,tagName:g}),l.endIf()}function _(w){let S=l.name("valid"),k=u.subschema({keyword:"oneOf",schemaProp:w},S);return u.mergeEvaluated(k,e.Name),S}function b(){var w;let S={},k=P(p),$=!0;for(let R=0;R<m.length;R++){let q=m[R];if(q?.$ref&&!(0,o.schemaHasRulesButRef)(q,f.self.RULES)){let Q=q.$ref;if(q=i.resolveRef.call(f.self,f.schemaEnv.root,f.baseId,Q),q instanceof i.SchemaEnv&&(q=q.schema),q===void 0)throw new n.default(f.opts.uriResolver,f.baseId,Q)}let O=(w=q?.properties)===null||w===void 0?void 0:w[g];if(typeof O!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${g}"`);$=$&&(k||P(q)),j(O,R)}if(!$)throw Error(`discriminator: "${g}" must be required`);return S;function P({required:R}){return Array.isArray(R)&&R.includes(g)}function j(R,q){if(R.const)I(R.const,q);else if(R.enum)for(let O of R.enum)I(O,q);else throw Error(`discriminator: "properties/${g}" must have "const" or "enum"`)}function I(R,q){if(typeof R!="string"||R in S)throw Error(`discriminator: "${g}" values must be unique strings`);S[R]=q}}}};t.default=a}),KJ=B((t,e)=>{e.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}),PA=B((t,e)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;var r=fJ(),i=WJ(),n=BJ(),o=KJ(),s=["/properties"],a="http://json-schema.org/draft-07/schema";class u extends r.default{_addVocabularies(){super._addVocabularies(),i.default.forEach(m=>this.addVocabulary(m)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let m=this.opts.$data?this.$dataMetaSchema(o,s):o;this.addMetaSchema(m,a,!1),this.refs["http://json-schema.org/schema"]=a}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}}t.Ajv=u,e.exports=t=u,e.exports.Ajv=u,Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var l=Pg();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var c=Je();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var d=Rx();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=Tg();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}),HJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0;function e(I,R){return{validate:I,compare:R}}t.fullFormats={date:e(o,s),time:e(u(!0),l),"date-time":e(p(!0),f),"iso-time":e(u(),c),"iso-date-time":e(p(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:h,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:j,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:_,int32:{type:"number",validate:S},int64:{type:"number",validate:k},float:{type:"number",validate:$},double:{type:"number",validate:$},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:e(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":e(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),"iso-time":e(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c),"iso-date-time":e(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},t.formatNames=Object.keys(t.fullFormats);function r(I){return I%4===0&&(I%100!==0||I%400===0)}var i=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(I){let R=i.exec(I);if(!R)return!1;let q=+R[1],O=+R[2],Q=+R[3];return O>=1&&O<=12&&Q>=1&&Q<=(O===2&&r(q)?29:n[O])}function s(I,R){if(I&&R)return I>R?1:I<R?-1:0}var a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function u(I){return function(R){let q=a.exec(R);if(!q)return!1;let O=+q[1],Q=+q[2],K=+q[3],Oe=q[4],st=q[5]==="-"?-1:1,pe=+(q[6]||0),J=+(q[7]||0);if(pe>23||J>59||I&&!Oe)return!1;if(O<=23&&Q<=59&&K<60)return!0;let T=Q-J*st,G=O-pe*st-(T<0?1:0);return(G===23||G===-1)&&(T===59||T===-1)&&K<61}}function l(I,R){if(!(I&&R))return;let q=new Date("2020-01-01T"+I).valueOf(),O=new Date("2020-01-01T"+R).valueOf();if(q&&O)return q-O}function c(I,R){if(!(I&&R))return;let q=a.exec(I),O=a.exec(R);if(q&&O)return I=q[1]+q[2]+q[3],R=O[1]+O[2]+O[3],I>R?1:I<R?-1:0}var d=/t|\s/i;function p(I){let R=u(I);return function(q){let O=q.split(d);return O.length===2&&o(O[0])&&R(O[1])}}function f(I,R){if(!(I&&R))return;let q=new Date(I).valueOf(),O=new Date(R).valueOf();if(q&&O)return q-O}function m(I,R){if(!(I&&R))return;let[q,O]=I.split(d),[Q,K]=R.split(d),Oe=s(q,Q);if(Oe!==void 0)return Oe||l(O,K)}var g=/\/|:/,v=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function h(I){return g.test(I)&&v.test(I)}var y=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function _(I){return y.lastIndex=0,y.test(I)}var b=-2147483648,w=2147483647;function S(I){return Number.isInteger(I)&&I<=w&&I>=b}function k(I){return Number.isInteger(I)}function $(){return!0}var P=/[^\\]\\Z/;function j(I){if(P.test(I))return!1;try{return new RegExp(I),!0}catch{return!1}}}),JJ=B(t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;var e=PA(),r=Je(),i=r.operators,n={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}},o={message:({keyword:a,schemaCode:u})=>r.str`should be ${n[a].okStr} ${u}`,params:({keyword:a,schemaCode:u})=>r._`{comparison: ${n[a].okStr}, limit: ${u}}`};t.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:o,code(a){let{gen:u,data:l,schemaCode:c,keyword:d,it:p}=a,{opts:f,self:m}=p;if(!f.validateFormats)return;let g=new e.KeywordCxt(p,m.RULES.all.format.definition,"format");g.$data?v():h();function v(){let _=u.scopeValue("formats",{ref:m.formats,code:f.code.formats}),b=u.const("fmt",r._`${_}[${g.schemaCode}]`);a.fail$data((0,r.or)(r._`typeof ${b} != "object"`,r._`${b} instanceof RegExp`,r._`typeof ${b}.compare != "function"`,y(b)))}function h(){let _=g.schema,b=m.formats[_];if(!b||b===!0)return;if(typeof b!="object"||b instanceof RegExp||typeof b.compare!="function")throw Error(`"${d}": format "${_}" does not define "compare" function`);let w=u.scopeValue("formats",{key:_,ref:b,code:f.code.formats?r._`${f.code.formats}${(0,r.getProperty)(_)}`:void 0});a.fail$data(y(w))}function y(_){return r._`${_}.compare(${l}, ${c}) ${n[d].fail} 0`}},dependencies:["format"]};var s=a=>(a.addKeyword(t.formatLimitDefinition),a);t.default=s}),YJ=B((t,e)=>{Object.defineProperty(t,"__esModule",{value:!0});var r=HJ(),i=JJ(),n=Je(),o=new n.Name("fullFormats"),s=new n.Name("fastFormats"),a=(l,c={keywords:!0})=>{if(Array.isArray(c))return u(l,c,r.fullFormats,o),l;let[d,p]=c.mode==="fast"?[r.fastFormats,s]:[r.fullFormats,o],f=c.formats||r.formatNames;return u(l,f,d,p),c.keywords&&(0,i.default)(l),l};a.get=(l,c="full")=>{let d=(c==="fast"?r.fastFormats:r.fullFormats)[l];if(!d)throw Error(`Unknown format "${l}"`);return d};function u(l,c,d,p){var f,m;(f=(m=l.opts.code).formats)!==null&&f!==void 0||(m.formats=n._`require("ajv-formats/dist/formats").${p}`);for(let g of c)l.addFormat(g,d[g])}e.exports=t=a,Object.defineProperty(t,"__esModule",{value:!0}),t.default=a}),lY=50;Wo=class extends Error{};pY=typeof global=="object"&&global&&global.Object===Object&&global,mY=pY,hY=typeof self=="object"&&self&&self.Object===Object&&self,gY=mY||hY||Function("return this")(),Mx=gY,yY=Mx.Symbol,Ah=yY,RA=Object.prototype,vY=RA.hasOwnProperty,_Y=RA.toString,ud=Ah?Ah.toStringTag:void 0;wY=bY,SY=Object.prototype,kY=SY.toString;$Y=xY,IY="[object Null]",EY="[object Undefined]",rR=Ah?Ah.toStringTag:void 0;TY=PY;AA=OY,zY="[object AsyncFunction]",NY="[object Function]",jY="[object GeneratorFunction]",CY="[object Proxy]";AY=RY,DY=Mx["__core-js_shared__"],Lk=DY,nR=(function(){var t=/[^.]+$/.exec(Lk&&Lk.keys&&Lk.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""})();MY=UY,ZY=Function.prototype,LY=ZY.toString;FY=qY,VY=/[\\^$.*+?()[\]{}|]/g,WY=/^\[object .+?Constructor\]$/,GY=Function.prototype,BY=Object.prototype,KY=GY.toString,HY=BY.hasOwnProperty,JY=RegExp("^"+KY.call(HY).replace(VY,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");QY=YY;e3=XY;DA=t3,r3=DA(Object,"create"),zd=r3;i3=n3;s3=o3,a3="__lodash_hash_undefined__",u3=Object.prototype,l3=u3.hasOwnProperty;d3=c3,f3=Object.prototype,p3=f3.hasOwnProperty;h3=m3,g3="__lodash_hash_undefined__";v3=y3;Wu.prototype.clear=i3;Wu.prototype.delete=s3;Wu.prototype.get=d3;Wu.prototype.has=h3;Wu.prototype.set=v3;iR=Wu;b3=_3;S3=w3;Og=k3,x3=Array.prototype,$3=x3.splice;E3=I3;T3=P3;z3=O3;j3=N3;Gu.prototype.clear=b3;Gu.prototype.delete=E3;Gu.prototype.get=T3;Gu.prototype.has=z3;Gu.prototype.set=j3;C3=Gu,R3=DA(Mx,"Map"),A3=R3;U3=D3;Z3=M3;zg=L3;F3=q3;W3=V3;B3=G3;H3=K3;Bu.prototype.clear=U3;Bu.prototype.delete=F3;Bu.prototype.get=W3;Bu.prototype.has=B3;Bu.prototype.set=H3;UA=Bu,J3="Expected a function";Zx.Cache=UA;Yo=Zx,Lx=Yo(()=>(process.env.CLAUDE_CONFIG_DIR??Q3(Y3(),".claude")).normalize("NFC"),()=>process.env.CLAUDE_CONFIG_DIR);MA=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return MA=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,i=>(+i^r()&15>>+i/4).toString(16))};rx=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return Error(JSON.stringify(t))}catch{}}return Error(t)},je=class extends Error{},en=class t extends je{constructor(e,r,i,n,o){super(`${t.makeMessage(e,r,i)}`),this.status=e,this.headers=n,this.requestID=n?.get("request-id"),this.error=r,this.type=o??null}static makeMessage(e,r,i){let n=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):i;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,r,i,n){if(!e||!n)return new $u({message:i,cause:rx(r)});let o=r,s=o?.error?.type;return e===400?new Uh(e,o,i,n,s):e===401?new Mh(e,o,i,n,s):e===403?new Zh(e,o,i,n,s):e===404?new Lh(e,o,i,n,s):e===409?new qh(e,o,i,n,s):e===422?new Fh(e,o,i,n,s):e===429?new Vh(e,o,i,n,s):e>=500?new Wh(e,o,i,n,s):new t(e,o,i,n,s)}},zn=class extends en{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},$u=class extends en{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Dh=class extends $u{constructor({message:e}={}){super({message:e??"Request timed out."})}},Uh=class extends en{},Mh=class extends en{},Zh=class extends en{},Lh=class extends en{},qh=class extends en{},Fh=class extends en{},Vh=class extends en{},Wh=class extends en{},X3=/^[a-z][a-z0-9+.-]*:/i,e8=t=>X3.test(t),nx=t=>(nx=Array.isArray,nx(t)),oR=nx;r8=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new je(`${t} must be an integer`);if(e<0)throw new je(`${t} must be a positive integer`);return e},ZA=t=>{try{return JSON.parse(t)}catch{return}},n8=t=>new Promise(e=>setTimeout(e,t)),gu="0.81.0",i8=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";s8=()=>{let t=o8();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gu,"X-Stainless-OS":uR(Deno.build.os),"X-Stainless-Arch":aR(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gu,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gu,"X-Stainless-OS":uR(globalThis.process.platform??"unknown"),"X-Stainless-Arch":aR(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=a8();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gu,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":gu,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};aR=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",uR=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),u8=()=>lR??(lR=s8());d8=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});Js=class{constructor(){Pn.set(this,void 0),Tn.set(this,void 0),ce(this,Pn,new Uint8Array,"f"),ce(this,Tn,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Fx(e):e;ce(this,Pn,p8([M(this,Pn,"f"),r]),"f");let i=[],n;for(;(n=m8(M(this,Pn,"f"),M(this,Tn,"f")))!=null;){if(n.carriage&&M(this,Tn,"f")==null){ce(this,Tn,n.index,"f");continue}if(M(this,Tn,"f")!=null&&(n.index!==M(this,Tn,"f")+1||n.carriage)){i.push(fR(M(this,Pn,"f").subarray(0,M(this,Tn,"f")-1))),ce(this,Pn,M(this,Pn,"f").subarray(M(this,Tn,"f")),"f"),ce(this,Tn,null,"f");continue}let o=M(this,Tn,"f")!==null?n.preceding-1:n.preceding,s=fR(M(this,Pn,"f").subarray(0,o));i.push(s),ce(this,Pn,M(this,Pn,"f").subarray(n.index),"f"),ce(this,Tn,null,"f")}return i}flush(){return M(this,Pn,"f").length?this.decode(`
135
- `):[]}};Pn=new WeakMap,Tn=new WeakMap;Js.NEWLINE_CHARS=new Set([`
136
- `,"\r"]);Js.NEWLINE_REGEXP=/\r\n|[\n\r]/g;Gh={off:0,error:200,warn:300,info:400,debug:500},pR=(t,e,r)=>{if(t){if(t8(Gh,t))return t;Yr(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(Gh))}`)}};g8={error:$d,warn:$d,info:$d,debug:$d},mR=new WeakMap;Bs=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="x-api-key"||e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t),Ys=class t{constructor(e,r,i){this.iterator=e,ld.set(this,void 0),this.controller=r,ce(this,ld,i,"f")}static fromSSEResponse(e,r,i){let n=!1,o=i?Yr(i):console;async function*s(){if(n)throw new je("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let u of y8(e,r)){if(u.event==="completion")try{yield JSON.parse(u.data)}catch(l){throw o.error("Could not parse message into JSON:",u.data),o.error("From chunk:",u.raw),l}if(u.event==="message_start"||u.event==="message_delta"||u.event==="message_stop"||u.event==="content_block_start"||u.event==="content_block_delta"||u.event==="content_block_stop")try{yield JSON.parse(u.data)}catch(l){throw o.error("Could not parse message into JSON:",u.data),o.error("From chunk:",u.raw),l}if(u.event!=="ping"&&u.event==="error"){let l=ZA(u.data)??u.data,c=l?.error?.type;throw new en(void 0,l,void 0,e.headers,c)}}a=!0}catch(u){if(Nd(u))return;throw u}finally{a||r.abort()}}return new t(s,r,i)}static fromReadableStream(e,r,i){let n=!1;async function*o(){let a=new Js,u=qx(e);for await(let l of u)for(let c of a.decode(l))yield c;for(let l of a.flush())yield l}async function*s(){if(n)throw new je("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let a=!1;try{for await(let u of o())a||u&&(yield JSON.parse(u));a=!0}catch(u){if(Nd(u))return;throw u}finally{a||r.abort()}}return new t(s,r,i)}[(ld=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],i=this.iterator(),n=o=>({next:()=>{if(o.length===0){let s=i.next();e.push(s),r.push(s)}return o.shift()}});return[new t(()=>n(e),this.controller,M(this,ld,"f")),new t(()=>n(r),this.controller,M(this,ld,"f"))]}toReadableStream(){let e=this,r;return LA({async start(){r=e[Symbol.asyncIterator]()},async pull(i){try{let{value:n,done:o}=await r.next();if(o)return i.close();let s=Fx(JSON.stringify(n)+`
137
- `);i.enqueue(s)}catch(n){i.error(n)}},async cancel(){await r.return?.()}})}};ox=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
138
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],o}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,i,n]=_8(e,":");return n.startsWith(" ")&&(n=n.substring(1)),r==="event"?this.event=n:r==="data"&&this.data.push(n),null}};Bh=class t extends Promise{constructor(e,r,i=FA){super(n=>{n(null)}),this.responsePromise=r,this.parseResponse=i,Id.set(this,void 0),ce(this,Id,e,"f")}_thenUnwrap(e){return new t(M(this,Id,"f"),this.responsePromise,async(r,i)=>VA(e(await this.parseResponse(r,i),i),i.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(M(this,Id,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Id=new WeakMap;Kh=class{constructor(e,r,i,n){dh.set(this,void 0),ce(this,dh,e,"f"),this.options=n,this.response=r,this.body=i}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new je("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await M(this,dh,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(dh=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},sx=class extends Bh{constructor(e,r,i){super(e,r,async(n,o)=>new i(n,o.response,await FA(n,o),o.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},Qs=class extends Kh{constructor(e,r,i,n){super(e,r,i,n),this.data=i.data||[],this.has_more=i.has_more||!1,this.first_id=i.first_id||null,this.last_id=i.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let r=this.first_id;return r?{...this.options,query:{...ix(this.options.query),before_id:r}}:null}let e=this.last_id;return e?{...this.options,query:{...ix(this.options.query),after_id:e}}:null}},Hh=class extends Kh{constructor(e,r,i,n){super(e,r,i,n),this.data=i.data||[],this.has_more=i.has_more||!1,this.next_page=i.next_page||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.next_page;return e?{...this.options,query:{...ix(this.options.query),page:e}}:null}},WA=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};GA=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",Vx=async(t,e,r=!0)=>({...t,body:await w8(t.body,e,r)}),hR=new WeakMap;w8=async(t,e,r=!0)=>{if(!await b8(e))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let i=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>ax(i,n,o,r))),i},S8=t=>t instanceof Blob&&"name"in t,ax=async(t,e,r,i)=>{if(r!==void 0){if(r==null)throw TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response){let n={},o=r.headers.get("Content-Type");o&&(n={type:o}),t.append(e,Su([await r.blob()],Th(r,i),n))}else if(GA(r))t.append(e,Su([await new Response(qA(r)).blob()],Th(r,i)));else if(S8(r))t.append(e,Su([r],Th(r,i),{type:r.type}));else if(Array.isArray(r))await Promise.all(r.map(n=>ax(t,e+"[]",n,i)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>ax(t,`${e}[${n}]`,o,i)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}},BA=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",k8=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&BA(t),x8=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";Nn=class{constructor(e){this._client=e}},KA=Symbol.for("brand.privateNullableHeaders");dt=t=>{let e=new Headers,r=new Set;for(let i of t){let n=new Set;for(let[o,s]of E8(i)){let a=o.toLowerCase();n.has(a)||(e.delete(o),n.add(a)),s===null?(e.delete(o),r.add(a)):(e.append(o,s),r.delete(a))}}return{[KA]:!0,values:e,nulls:r}},Od=Symbol("anthropic.sdk.stainlessHelper");gR=Object.freeze(Object.create(null)),T8=(t=YA)=>function(e,...r){if(e.length===1)return e[0];let i=!1,n=[],o=e.reduce((l,c,d)=>{/[?#]/.test(c)&&(i=!0);let p=r[d],f=(i?encodeURIComponent:t)(""+p);return d!==r.length&&(p==null||typeof p=="object"&&p.toString===Object.getPrototypeOf(Object.getPrototypeOf(p.hasOwnProperty??gR)??gR)?.toString)&&(f=p+"",n.push({start:l.length+c.length,length:f.length,error:`Value of type ${Object.prototype.toString.call(p).slice(8,-1)} is not a valid path parameter`})),l+c+(d===r.length?"":f)},""),s=o.split(/[?#]/,1)[0],a=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,u;for(;(u=a.exec(s))!==null;)n.push({start:u.index,length:u[0].length,error:`Value "${u[0]}" can't be safely passed as a path parameter`});if(n.sort((l,c)=>l.start-c.start),n.length>0){let l=0,c=n.reduce((d,p)=>{let f=" ".repeat(p.start-l),m="^".repeat(p.length);return l=p.start+p.length,d+f+m},"");throw new je(`Path parameters result in path with invalid segments:
139
- ${n.map(d=>d.error).join(`
140
- `)}
141
- ${o}
142
- ${c}`)}return o},br=T8(YA),Jh=class extends Nn{list(e={},r){let{betas:i,...n}=e??{};return this._client.getAPIList("/v1/files",Qs,{query:n,...r,headers:dt([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},r?.headers])})}delete(e,r={},i){let{betas:n}=r??{};return this._client.delete(br`/v1/files/${e}`,{...i,headers:dt([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},i?.headers])})}download(e,r={},i){let{betas:n}=r??{};return this._client.get(br`/v1/files/${e}/content`,{...i,headers:dt([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},i?.headers]),__binaryResponse:!0})}retrieveMetadata(e,r={},i){let{betas:n}=r??{};return this._client.get(br`/v1/files/${e}`,{...i,headers:dt([{"anthropic-beta":[...n??[],"files-api-2025-04-14"].toString()},i?.headers])})}upload(e,r){let{betas:i,...n}=e;return this._client.post("/v1/files",Vx({body:n,...r,headers:dt([{"anthropic-beta":[...i??[],"files-api-2025-04-14"].toString()},P8(n.file),r?.headers])},this._client))}},Yh=class extends Nn{retrieve(e,r={},i){let{betas:n}=r??{};return this._client.get(br`/v1/models/${e}?beta=true`,{...i,headers:dt([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},i?.headers])})}list(e={},r){let{betas:i,...n}=e??{};return this._client.getAPIList("/v1/models?beta=true",Qs,{query:n,...r,headers:dt([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},r?.headers])})}},QA={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};z8=t=>{let e=0,r=[];for(;e<t.length;){let i=t[e];if(i==="\\"){e++;continue}if(i==="{"){r.push({type:"brace",value:"{"}),e++;continue}if(i==="}"){r.push({type:"brace",value:"}"}),e++;continue}if(i==="["){r.push({type:"paren",value:"["}),e++;continue}if(i==="]"){r.push({type:"paren",value:"]"}),e++;continue}if(i===":"){r.push({type:"separator",value:":"}),e++;continue}if(i===","){r.push({type:"delimiter",value:","}),e++;continue}if(i==='"'){let s="",a=!1;for(i=t[++e];i!=='"';){if(e===t.length){a=!0;break}if(i==="\\"){if(e++,e===t.length){a=!0;break}s+=i+t[e],i=t[++e]}else s+=i,i=t[++e]}i=t[++e],!a&&r.push({type:"string",value:s});continue}if(i&&/\s/.test(i)){e++;continue}let n=/[0-9]/;if(i&&n.test(i)||i==="-"||i==="."){let s="";for(i==="-"&&(s+=i,i=t[++e]);i&&n.test(i)||i===".";)s+=i,i=t[++e];r.push({type:"number",value:s});continue}let o=/[a-z]/i;if(i&&o.test(i)){let s="";for(;i&&o.test(i)&&e!==t.length;)s+=i,i=t[++e];if(s=="true"||s=="false"||s==="null")r.push({type:"name",value:s});else{e++;continue}continue}e++}return r},yu=t=>{if(t.length===0)return t;let e=t[t.length-1];switch(e.type){case"separator":return t=t.slice(0,t.length-1),yu(t);case"number":let r=e.value[e.value.length-1];if(r==="."||r==="-")return t=t.slice(0,t.length-1),yu(t);case"string":let i=t[t.length-2];if(i?.type==="delimiter")return t=t.slice(0,t.length-1),yu(t);if(i?.type==="brace"&&i.value==="{")return t=t.slice(0,t.length-1),yu(t);break;case"delimiter":return t=t.slice(0,t.length-1),yu(t)}return t},N8=t=>{let e=[];return t.map(r=>{r.type==="brace"&&(r.value==="{"?e.push("}"):e.splice(e.lastIndexOf("}"),1)),r.type==="paren"&&(r.value==="["?e.push("]"):e.splice(e.lastIndexOf("]"),1))}),e.length>0&&e.reverse().map(r=>{r==="}"?t.push({type:"brace",value:"}"}):r==="]"&&t.push({type:"paren",value:"]"})}),t},j8=t=>{let e="";return t.map(r=>{r.type==="string"?e+='"'+r.value+'"':e+=r.value}),e},tD=t=>JSON.parse(j8(N8(yu(z8(t))))),bR="__json_buf";lx=class t{constructor(e,r){Gn.add(this),this.messages=[],this.receivedMessages=[],Lo.set(this,void 0),fu.set(this,null),this.controller=new AbortController,cd.set(this,void 0),fh.set(this,()=>{}),dd.set(this,()=>{}),fd.set(this,void 0),ph.set(this,()=>{}),pd.set(this,()=>{}),co.set(this,{}),md.set(this,!1),mh.set(this,!1),hh.set(this,!1),Vs.set(this,!1),gh.set(this,void 0),yh.set(this,void 0),hd.set(this,void 0),vh.set(this,i=>{if(ce(this,mh,!0,"f"),Nd(i)&&(i=new zn),i instanceof zn)return ce(this,hh,!0,"f"),this._emit("abort",i);if(i instanceof je)return this._emit("error",i);if(i instanceof Error){let n=new je(i.message);return n.cause=i,this._emit("error",n)}return this._emit("error",new je(String(i)))}),ce(this,cd,new Promise((i,n)=>{ce(this,fh,i,"f"),ce(this,dd,n,"f")}),"f"),ce(this,fd,new Promise((i,n)=>{ce(this,ph,i,"f"),ce(this,pd,n,"f")}),"f"),M(this,cd,"f").catch(()=>{}),M(this,fd,"f").catch(()=>{}),ce(this,fu,e,"f"),ce(this,hd,r?.logger??console,"f")}get response(){return M(this,gh,"f")}get request_id(){return M(this,yh,"f")}async withResponse(){ce(this,Vs,!0,"f");let e=await M(this,cd,"f");if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,i,{logger:n}={}){let o=new t(r,{logger:n});for(let s of r.messages)o._addMessageParam(s);return ce(o,fu,{...r,stream:!0},"f"),o._run(()=>o._createMessage(e,{...r,stream:!0},{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},M(this,vh,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,i){let n=i?.signal,o;n&&(n.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),n.addEventListener("abort",o));try{M(this,Gn,"m",Fk).call(this);let{response:s,data:a}=await e.create({...r,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(s);for await(let u of a)M(this,Gn,"m",Vk).call(this,u);if(a.controller.signal?.aborted)throw new zn;M(this,Gn,"m",Wk).call(this)}finally{n&&o&&n.removeEventListener("abort",o)}}_connected(e){this.ended||(ce(this,gh,e,"f"),ce(this,yh,e?.headers.get("request-id"),"f"),M(this,fh,"f").call(this,e),this._emit("connect"))}get ended(){return M(this,md,"f")}get errored(){return M(this,mh,"f")}get aborted(){return M(this,hh,"f")}abort(){this.controller.abort()}on(e,r){return(M(this,co,"f")[e]||(M(this,co,"f")[e]=[])).push({listener:r}),this}off(e,r){let i=M(this,co,"f")[e];if(!i)return this;let n=i.findIndex(o=>o.listener===r);return n>=0&&i.splice(n,1),this}once(e,r){return(M(this,co,"f")[e]||(M(this,co,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,i)=>{ce(this,Vs,!0,"f"),e!=="error"&&this.once("error",i),this.once(e,r)})}async done(){ce(this,Vs,!0,"f"),await M(this,fd,"f")}get currentMessage(){return M(this,Lo,"f")}async finalMessage(){return await this.done(),M(this,Gn,"m",qk).call(this)}async finalText(){return await this.done(),M(this,Gn,"m",vR).call(this)}_emit(e,...r){if(M(this,md,"f"))return;e==="end"&&(ce(this,md,!0,"f"),M(this,ph,"f").call(this));let i=M(this,co,"f")[e];if(i&&(M(this,co,"f")[e]=i.filter(n=>!n.once),i.forEach(({listener:n})=>n(...r))),e==="abort"){let n=r[0];!M(this,Vs,"f")&&!i?.length&&Promise.reject(n),M(this,dd,"f").call(this,n),M(this,pd,"f").call(this,n),this._emit("end");return}if(e==="error"){let n=r[0];!M(this,Vs,"f")&&!i?.length&&Promise.reject(n),M(this,dd,"f").call(this,n),M(this,pd,"f").call(this,n),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",M(this,Gn,"m",qk).call(this))}async _fromReadableStream(e,r){let i=r?.signal,n;i&&(i.aborted&&this.controller.abort(),n=this.controller.abort.bind(this.controller),i.addEventListener("abort",n));try{M(this,Gn,"m",Fk).call(this),this._connected(null);let o=Ys.fromReadableStream(e,this.controller);for await(let s of o)M(this,Gn,"m",Vk).call(this,s);if(o.controller.signal?.aborted)throw new zn;M(this,Gn,"m",Wk).call(this)}finally{i&&n&&i.removeEventListener("abort",n)}}[(Lo=new WeakMap,fu=new WeakMap,cd=new WeakMap,fh=new WeakMap,dd=new WeakMap,fd=new WeakMap,ph=new WeakMap,pd=new WeakMap,co=new WeakMap,md=new WeakMap,mh=new WeakMap,hh=new WeakMap,Vs=new WeakMap,gh=new WeakMap,yh=new WeakMap,hd=new WeakMap,vh=new WeakMap,Gn=new WeakSet,qk=function(){if(this.receivedMessages.length===0)throw new je("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},vR=function(){if(this.receivedMessages.length===0)throw new je("stream ended without producing a Message with role=assistant");let e=this.receivedMessages.at(-1).content.filter(r=>r.type==="text").map(r=>r.text);if(e.length===0)throw new je("stream ended without producing a content block with type=text");return e.join(" ")},Fk=function(){this.ended||ce(this,Lo,void 0,"f")},Vk=function(e){if(this.ended)return;let r=M(this,Gn,"m",_R).call(this,e);switch(this._emit("streamEvent",e,r),e.type){case"content_block_delta":{let i=r.content.at(-1);switch(e.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",e.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",e.delta.citation,i.citations??[]);break}case"input_json_delta":{wR(i)&&i.input&&this._emit("inputJson",e.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",e.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}case"compaction_delta":{i.type==="compaction"&&i.content&&this._emit("compaction",i.content);break}default:e.delta}break}case"message_stop":{this._addMessageParam(r),this._addMessage(yR(r,M(this,fu,"f"),{logger:M(this,hd,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",r.content.at(-1));break}case"message_start":{ce(this,Lo,r,"f");break}case"content_block_start":case"message_delta":break}},Wk=function(){if(this.ended)throw new je("stream has ended, this shouldn't happen");let e=M(this,Lo,"f");if(!e)throw new je("request ended without sending any chunks");return ce(this,Lo,void 0,"f"),yR(e,M(this,fu,"f"),{logger:M(this,hd,"f")})},_R=function(e){let r=M(this,Lo,"f");if(e.type==="message_start"){if(r)throw new je(`Unexpected event order, got ${e.type} before receiving "message_stop"`);return e.message}if(!r)throw new je(`Unexpected event order, got ${e.type} before "message_start"`);switch(e.type){case"message_stop":return r;case"message_delta":return r.container=e.delta.container,r.stop_reason=e.delta.stop_reason,r.stop_sequence=e.delta.stop_sequence,r.usage.output_tokens=e.usage.output_tokens,r.context_management=e.context_management,e.usage.input_tokens!=null&&(r.usage.input_tokens=e.usage.input_tokens),e.usage.cache_creation_input_tokens!=null&&(r.usage.cache_creation_input_tokens=e.usage.cache_creation_input_tokens),e.usage.cache_read_input_tokens!=null&&(r.usage.cache_read_input_tokens=e.usage.cache_read_input_tokens),e.usage.server_tool_use!=null&&(r.usage.server_tool_use=e.usage.server_tool_use),e.usage.iterations!=null&&(r.usage.iterations=e.usage.iterations),r;case"content_block_start":return r.content.push(e.content_block),r;case"content_block_delta":{let i=r.content.at(e.index);switch(e.delta.type){case"text_delta":{i?.type==="text"&&(r.content[e.index]={...i,text:(i.text||"")+e.delta.text});break}case"citations_delta":{i?.type==="text"&&(r.content[e.index]={...i,citations:[...i.citations??[],e.delta.citation]});break}case"input_json_delta":{if(i&&wR(i)){let n=i[bR]||"";n+=e.delta.partial_json;let o={...i};if(Object.defineProperty(o,bR,{value:n,enumerable:!1,writable:!0}),n)try{o.input=tD(n)}catch(s){let a=new je(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${s}. JSON: ${n}`);M(this,vh,"f").call(this,a)}r.content[e.index]=o}break}case"thinking_delta":{i?.type==="thinking"&&(r.content[e.index]={...i,thinking:i.thinking+e.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(r.content[e.index]={...i,signature:e.delta.signature});break}case"compaction_delta":{i?.type==="compaction"&&(r.content[e.index]={...i,content:(i.content||"")+e.delta.content});break}default:e.delta}return r}case"content_block_stop":return r}},Symbol.asyncIterator)](){let e=[],r=[],i=!1;return this.on("streamEvent",n=>{let o=r.shift();o?o.resolve(n):e.push(n)}),this.on("end",()=>{i=!0;for(let n of r)n.resolve(void 0);r.length=0}),this.on("abort",n=>{i=!0;for(let o of r)o.reject(n);r.length=0}),this.on("error",n=>{i=!0;for(let o of r)o.reject(n);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((n,o)=>r.push({resolve:n,reject:o})).then(n=>n?{value:n,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Ys(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}},Qh=class extends Error{constructor(e){let r=typeof e=="string"?e:e.map(i=>i.type==="text"?i.text:`[${i.type}]`).join(" ");super(r),this.name="ToolError",this.content=e}},C8=1e5,R8=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
143
- 1. Task Overview
144
- The user's core request and success criteria
145
- Any clarifications or constraints they specified
146
- 2. Current State
147
- What has been completed so far
148
- Files created, modified, or analyzed (with paths if relevant)
149
- Key outputs or artifacts produced
150
- 3. Important Discoveries
151
- Technical constraints or requirements uncovered
152
- Decisions made and their rationale
153
- Errors encountered and how they were resolved
154
- What approaches were tried that didn't work (and why)
155
- 4. Next Steps
156
- Specific actions needed to complete the task
157
- Any blockers or open questions to resolve
158
- Priority order if multiple steps remain
159
- 5. Context to Preserve
160
- User preferences or style requirements
161
- Domain-specific details that aren't obvious
162
- Any promises made to the user
163
- Be concise but complete\u2014err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
164
- Wrap your summary in <summary></summary> tags.`;Xh=class{constructor(e,r,i){gd.add(this),this.client=e,pu.set(this,!1),Ws.set(this,!1),dr.set(this,void 0),yd.set(this,void 0),En.set(this,void 0),mo.set(this,void 0),qo.set(this,void 0),vd.set(this,0),ce(this,dr,{params:{...r,messages:structuredClone(r.messages)}},"f");let n=["BetaToolRunner",...HA(r.tools,r.messages)].join(", ");ce(this,yd,{...i,headers:dt([{"x-stainless-helper":n},i?.headers])},"f"),ce(this,qo,kR(),"f")}async*[(pu=new WeakMap,Ws=new WeakMap,dr=new WeakMap,yd=new WeakMap,En=new WeakMap,mo=new WeakMap,qo=new WeakMap,vd=new WeakMap,gd=new WeakSet,SR=async function(){let e=M(this,dr,"f").params.compactionControl;if(!e||!e.enabled)return!1;let r=0;if(M(this,En,"f")!==void 0)try{let u=await M(this,En,"f");r=u.usage.input_tokens+(u.usage.cache_creation_input_tokens??0)+(u.usage.cache_read_input_tokens??0)+u.usage.output_tokens}catch{return!1}let i=e.contextTokenThreshold??C8;if(r<i)return!1;let n=e.model??M(this,dr,"f").params.model,o=e.summaryPrompt??R8,s=M(this,dr,"f").params.messages;if(s[s.length-1].role==="assistant"){let u=s[s.length-1];if(Array.isArray(u.content)){let l=u.content.filter(c=>c.type!=="tool_use");l.length===0?s.pop():u.content=l}}let a=await this.client.beta.messages.create({model:n,messages:[...s,{role:"user",content:[{type:"text",text:o}]}],max_tokens:M(this,dr,"f").params.max_tokens},{headers:{"x-stainless-helper":"compaction"}});if(a.content[0]?.type!=="text")throw new je("Expected text response for compaction");return M(this,dr,"f").params.messages=[{role:"user",content:a.content}],!0},Symbol.asyncIterator)](){var e;if(M(this,pu,"f"))throw new je("Cannot iterate over a consumed stream");ce(this,pu,!0,"f"),ce(this,Ws,!0,"f"),ce(this,mo,void 0,"f");try{for(;;){let r;try{if(M(this,dr,"f").params.max_iterations&&M(this,vd,"f")>=M(this,dr,"f").params.max_iterations)break;ce(this,Ws,!1,"f"),ce(this,mo,void 0,"f"),ce(this,vd,(e=M(this,vd,"f"),e++,e),"f"),ce(this,En,void 0,"f");let{max_iterations:i,compactionControl:n,...o}=M(this,dr,"f").params;if(o.stream?(r=this.client.beta.messages.stream({...o},M(this,yd,"f")),ce(this,En,r.finalMessage(),"f"),M(this,En,"f").catch(()=>{}),yield r):(ce(this,En,this.client.beta.messages.create({...o,stream:!1},M(this,yd,"f")),"f"),yield M(this,En,"f")),!await M(this,gd,"m",SR).call(this)){if(!M(this,Ws,"f")){let{role:a,content:u}=await M(this,En,"f");M(this,dr,"f").params.messages.push({role:a,content:u})}let s=await M(this,gd,"m",cx).call(this,M(this,dr,"f").params.messages.at(-1));if(s)M(this,dr,"f").params.messages.push(s);else if(!M(this,Ws,"f"))break}}finally{r&&r.abort()}}if(!M(this,En,"f"))throw new je("ToolRunner concluded without a message from the server");M(this,qo,"f").resolve(await M(this,En,"f"))}catch(r){throw ce(this,pu,!1,"f"),M(this,qo,"f").promise.catch(()=>{}),M(this,qo,"f").reject(r),ce(this,qo,kR(),"f"),r}}setMessagesParams(e){typeof e=="function"?M(this,dr,"f").params=e(M(this,dr,"f").params):M(this,dr,"f").params=e,ce(this,Ws,!0,"f"),ce(this,mo,void 0,"f")}async generateToolResponse(){let e=await M(this,En,"f")??this.params.messages.at(-1);return e?M(this,gd,"m",cx).call(this,e):null}done(){return M(this,qo,"f").promise}async runUntilDone(){if(!M(this,pu,"f"))for await(let e of this);return this.done()}get params(){return M(this,dr,"f").params}pushMessages(...e){this.setMessagesParams(r=>({...r,messages:[...r.messages,...e]}))}then(e,r){return this.runUntilDone().then(e,r)}};cx=async function(t){return M(this,mo,"f")!==void 0?M(this,mo,"f"):(ce(this,mo,A8(M(this,dr,"f").params,t),"f"),M(this,mo,"f"))};eg=class t{constructor(e,r){this.iterator=e,this.controller=r}async*decoder(){let e=new Js;for await(let r of this.iterator)for(let i of e.decode(r))yield JSON.parse(i);for(let r of e.flush())yield JSON.parse(r)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(e,r){if(!e.body)throw r.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new je("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new je("Attempted to iterate over a response with no body");return new t(qx(e.body),r)}},tg=class extends Nn{create(e,r){let{betas:i,...n}=e;return this._client.post("/v1/messages/batches?beta=true",{body:n,...r,headers:dt([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},r?.headers])})}retrieve(e,r={},i){let{betas:n}=r??{};return this._client.get(br`/v1/messages/batches/${e}?beta=true`,{...i,headers:dt([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},i?.headers])})}list(e={},r){let{betas:i,...n}=e??{};return this._client.getAPIList("/v1/messages/batches?beta=true",Qs,{query:n,...r,headers:dt([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString()},r?.headers])})}delete(e,r={},i){let{betas:n}=r??{};return this._client.delete(br`/v1/messages/batches/${e}?beta=true`,{...i,headers:dt([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},i?.headers])})}cancel(e,r={},i){let{betas:n}=r??{};return this._client.post(br`/v1/messages/batches/${e}/cancel?beta=true`,{...i,headers:dt([{"anthropic-beta":[...n??[],"message-batches-2024-09-24"].toString()},i?.headers])})}async results(e,r={},i){let n=await this.retrieve(e);if(!n.results_url)throw new je(`No batch \`results_url\`; Has it finished processing? ${n.processing_status} - ${n.id}`);let{betas:o}=r??{};return this._client.get(n.results_url,{...i,headers:dt([{"anthropic-beta":[...o??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},i?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((s,a)=>eg.fromResponse(a.response,a.controller))}},xR={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},D8=["claude-opus-4-6"],Xs=class extends Nn{constructor(){super(...arguments),this.batches=new tg(this._client)}create(e,r){let i=$R(e),{betas:n,...o}=i;o.model in xR&&console.warn(`The model '${o.model}' is deprecated and will reach end-of-life on ${xR[o.model]}
165
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),o.model in D8&&o.thinking&&o.thinking.type==="enabled"&&console.warn(`Using Claude with ${o.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let s=this._client._options.timeout;if(!o.stream&&s==null){let u=QA[o.model]??void 0;s=this._client.calculateNonstreamingTimeout(o.max_tokens,u)}let a=JA(o.tools,o.messages);return this._client.post("/v1/messages?beta=true",{body:o,timeout:s??6e5,...r,headers:dt([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},a,r?.headers]),stream:i.stream??!1})}parse(e,r){return r={...r,headers:dt([{"anthropic-beta":[...e.betas??[],"structured-outputs-2025-12-15"].toString()},r?.headers])},this.create(e,r).then(i=>eD(i,e,{logger:this._client.logger??console}))}stream(e,r){return lx.createMessage(this,e,r)}countTokens(e,r){let i=$R(e),{betas:n,...o}=i;return this._client.post("/v1/messages/count_tokens?beta=true",{body:o,...r,headers:dt([{"anthropic-beta":[...n??[],"token-counting-2024-11-01"].toString()},r?.headers])})}toolRunner(e,r){return new Xh(this._client,e,r)}};Xs.Batches=tg;Xs.BetaToolRunner=Xh;Xs.ToolError=Qh;rg=class extends Nn{create(e,r={},i){let{betas:n,...o}=r??{};return this._client.post(br`/v1/skills/${e}/versions?beta=true`,Vx({body:o,...i,headers:dt([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},i?.headers])},this._client))}retrieve(e,r,i){let{skill_id:n,betas:o}=r;return this._client.get(br`/v1/skills/${n}/versions/${e}?beta=true`,{...i,headers:dt([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},i?.headers])})}list(e,r={},i){let{betas:n,...o}=r??{};return this._client.getAPIList(br`/v1/skills/${e}/versions?beta=true`,Hh,{query:o,...i,headers:dt([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},i?.headers])})}delete(e,r,i){let{skill_id:n,betas:o}=r;return this._client.delete(br`/v1/skills/${n}/versions/${e}?beta=true`,{...i,headers:dt([{"anthropic-beta":[...o??[],"skills-2025-10-02"].toString()},i?.headers])})}},jd=class extends Nn{constructor(){super(...arguments),this.versions=new rg(this._client)}create(e={},r){let{betas:i,...n}=e??{};return this._client.post("/v1/skills?beta=true",Vx({body:n,...r,headers:dt([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},r?.headers])},this._client,!1))}retrieve(e,r={},i){let{betas:n}=r??{};return this._client.get(br`/v1/skills/${e}?beta=true`,{...i,headers:dt([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},i?.headers])})}list(e={},r){let{betas:i,...n}=e??{};return this._client.getAPIList("/v1/skills?beta=true",Hh,{query:n,...r,headers:dt([{"anthropic-beta":[...i??[],"skills-2025-10-02"].toString()},r?.headers])})}delete(e,r={},i){let{betas:n}=r??{};return this._client.delete(br`/v1/skills/${e}?beta=true`,{...i,headers:dt([{"anthropic-beta":[...n??[],"skills-2025-10-02"].toString()},i?.headers])})}};jd.Versions=rg;Bo=class extends Nn{constructor(){super(...arguments),this.models=new Yh(this._client),this.messages=new Xs(this._client),this.files=new Jh(this._client),this.skills=new jd(this._client)}};Bo.Models=Yh;Bo.Messages=Xs;Bo.Files=Jh;Bo.Skills=jd;ng=class extends Nn{create(e,r){let{betas:i,...n}=e;return this._client.post("/v1/complete",{body:n,timeout:this._client._options.timeout??6e5,...r,headers:dt([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},r?.headers]),stream:e.stream??!1})}};TR="__json_buf";dx=class t{constructor(e,r){Bn.add(this),this.messages=[],this.receivedMessages=[],Fo.set(this,void 0),mu.set(this,null),this.controller=new AbortController,_d.set(this,void 0),_h.set(this,()=>{}),bd.set(this,()=>{}),wd.set(this,void 0),bh.set(this,()=>{}),Sd.set(this,()=>{}),fo.set(this,{}),kd.set(this,!1),wh.set(this,!1),Sh.set(this,!1),Gs.set(this,!1),kh.set(this,void 0),xh.set(this,void 0),xd.set(this,void 0),Bk.set(this,i=>{if(ce(this,wh,!0,"f"),Nd(i)&&(i=new zn),i instanceof zn)return ce(this,Sh,!0,"f"),this._emit("abort",i);if(i instanceof je)return this._emit("error",i);if(i instanceof Error){let n=new je(i.message);return n.cause=i,this._emit("error",n)}return this._emit("error",new je(String(i)))}),ce(this,_d,new Promise((i,n)=>{ce(this,_h,i,"f"),ce(this,bd,n,"f")}),"f"),ce(this,wd,new Promise((i,n)=>{ce(this,bh,i,"f"),ce(this,Sd,n,"f")}),"f"),M(this,_d,"f").catch(()=>{}),M(this,wd,"f").catch(()=>{}),ce(this,mu,e,"f"),ce(this,xd,r?.logger??console,"f")}get response(){return M(this,kh,"f")}get request_id(){return M(this,xh,"f")}async withResponse(){ce(this,Gs,!0,"f");let e=await M(this,_d,"f");if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id")}}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createMessage(e,r,i,{logger:n}={}){let o=new t(r,{logger:n});for(let s of r.messages)o._addMessageParam(s);return ce(o,mu,{...r,stream:!0},"f"),o._run(()=>o._createMessage(e,{...r,stream:!0},{...i,headers:{...i?.headers,"X-Stainless-Helper-Method":"stream"}})),o}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},M(this,Bk,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,r=!0){this.receivedMessages.push(e),r&&this._emit("message",e)}async _createMessage(e,r,i){let n=i?.signal,o;n&&(n.aborted&&this.controller.abort(),o=this.controller.abort.bind(this.controller),n.addEventListener("abort",o));try{M(this,Bn,"m",Kk).call(this);let{response:s,data:a}=await e.create({...r,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(s);for await(let u of a)M(this,Bn,"m",Hk).call(this,u);if(a.controller.signal?.aborted)throw new zn;M(this,Bn,"m",Jk).call(this)}finally{n&&o&&n.removeEventListener("abort",o)}}_connected(e){this.ended||(ce(this,kh,e,"f"),ce(this,xh,e?.headers.get("request-id"),"f"),M(this,_h,"f").call(this,e),this._emit("connect"))}get ended(){return M(this,kd,"f")}get errored(){return M(this,wh,"f")}get aborted(){return M(this,Sh,"f")}abort(){this.controller.abort()}on(e,r){return(M(this,fo,"f")[e]||(M(this,fo,"f")[e]=[])).push({listener:r}),this}off(e,r){let i=M(this,fo,"f")[e];if(!i)return this;let n=i.findIndex(o=>o.listener===r);return n>=0&&i.splice(n,1),this}once(e,r){return(M(this,fo,"f")[e]||(M(this,fo,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,i)=>{ce(this,Gs,!0,"f"),e!=="error"&&this.once("error",i),this.once(e,r)})}async done(){ce(this,Gs,!0,"f"),await M(this,wd,"f")}get currentMessage(){return M(this,Fo,"f")}async finalMessage(){return await this.done(),M(this,Bn,"m",Gk).call(this)}async finalText(){return await this.done(),M(this,Bn,"m",ER).call(this)}_emit(e,...r){if(M(this,kd,"f"))return;e==="end"&&(ce(this,kd,!0,"f"),M(this,bh,"f").call(this));let i=M(this,fo,"f")[e];if(i&&(M(this,fo,"f")[e]=i.filter(n=>!n.once),i.forEach(({listener:n})=>n(...r))),e==="abort"){let n=r[0];!M(this,Gs,"f")&&!i?.length&&Promise.reject(n),M(this,bd,"f").call(this,n),M(this,Sd,"f").call(this,n),this._emit("end");return}if(e==="error"){let n=r[0];!M(this,Gs,"f")&&!i?.length&&Promise.reject(n),M(this,bd,"f").call(this,n),M(this,Sd,"f").call(this,n),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",M(this,Bn,"m",Gk).call(this))}async _fromReadableStream(e,r){let i=r?.signal,n;i&&(i.aborted&&this.controller.abort(),n=this.controller.abort.bind(this.controller),i.addEventListener("abort",n));try{M(this,Bn,"m",Kk).call(this),this._connected(null);let o=Ys.fromReadableStream(e,this.controller);for await(let s of o)M(this,Bn,"m",Hk).call(this,s);if(o.controller.signal?.aborted)throw new zn;M(this,Bn,"m",Jk).call(this)}finally{i&&n&&i.removeEventListener("abort",n)}}[(Fo=new WeakMap,mu=new WeakMap,_d=new WeakMap,_h=new WeakMap,bd=new WeakMap,wd=new WeakMap,bh=new WeakMap,Sd=new WeakMap,fo=new WeakMap,kd=new WeakMap,wh=new WeakMap,Sh=new WeakMap,Gs=new WeakMap,kh=new WeakMap,xh=new WeakMap,xd=new WeakMap,Bk=new WeakMap,Bn=new WeakSet,Gk=function(){if(this.receivedMessages.length===0)throw new je("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},ER=function(){if(this.receivedMessages.length===0)throw new je("stream ended without producing a Message with role=assistant");let e=this.receivedMessages.at(-1).content.filter(r=>r.type==="text").map(r=>r.text);if(e.length===0)throw new je("stream ended without producing a content block with type=text");return e.join(" ")},Kk=function(){this.ended||ce(this,Fo,void 0,"f")},Hk=function(e){if(this.ended)return;let r=M(this,Bn,"m",PR).call(this,e);switch(this._emit("streamEvent",e,r),e.type){case"content_block_delta":{let i=r.content.at(-1);switch(e.delta.type){case"text_delta":{i.type==="text"&&this._emit("text",e.delta.text,i.text||"");break}case"citations_delta":{i.type==="text"&&this._emit("citation",e.delta.citation,i.citations??[]);break}case"input_json_delta":{OR(i)&&i.input&&this._emit("inputJson",e.delta.partial_json,i.input);break}case"thinking_delta":{i.type==="thinking"&&this._emit("thinking",e.delta.thinking,i.thinking);break}case"signature_delta":{i.type==="thinking"&&this._emit("signature",i.signature);break}default:e.delta}break}case"message_stop":{this._addMessageParam(r),this._addMessage(IR(r,M(this,mu,"f"),{logger:M(this,xd,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",r.content.at(-1));break}case"message_start":{ce(this,Fo,r,"f");break}case"content_block_start":case"message_delta":break}},Jk=function(){if(this.ended)throw new je("stream has ended, this shouldn't happen");let e=M(this,Fo,"f");if(!e)throw new je("request ended without sending any chunks");return ce(this,Fo,void 0,"f"),IR(e,M(this,mu,"f"),{logger:M(this,xd,"f")})},PR=function(e){let r=M(this,Fo,"f");if(e.type==="message_start"){if(r)throw new je(`Unexpected event order, got ${e.type} before receiving "message_stop"`);return e.message}if(!r)throw new je(`Unexpected event order, got ${e.type} before "message_start"`);switch(e.type){case"message_stop":return r;case"message_delta":return r.stop_reason=e.delta.stop_reason,r.stop_sequence=e.delta.stop_sequence,r.usage.output_tokens=e.usage.output_tokens,e.usage.input_tokens!=null&&(r.usage.input_tokens=e.usage.input_tokens),e.usage.cache_creation_input_tokens!=null&&(r.usage.cache_creation_input_tokens=e.usage.cache_creation_input_tokens),e.usage.cache_read_input_tokens!=null&&(r.usage.cache_read_input_tokens=e.usage.cache_read_input_tokens),e.usage.server_tool_use!=null&&(r.usage.server_tool_use=e.usage.server_tool_use),r;case"content_block_start":return r.content.push({...e.content_block}),r;case"content_block_delta":{let i=r.content.at(e.index);switch(e.delta.type){case"text_delta":{i?.type==="text"&&(r.content[e.index]={...i,text:(i.text||"")+e.delta.text});break}case"citations_delta":{i?.type==="text"&&(r.content[e.index]={...i,citations:[...i.citations??[],e.delta.citation]});break}case"input_json_delta":{if(i&&OR(i)){let n=i[TR]||"";n+=e.delta.partial_json;let o={...i};Object.defineProperty(o,TR,{value:n,enumerable:!1,writable:!0}),n&&(o.input=tD(n)),r.content[e.index]=o}break}case"thinking_delta":{i?.type==="thinking"&&(r.content[e.index]={...i,thinking:i.thinking+e.delta.thinking});break}case"signature_delta":{i?.type==="thinking"&&(r.content[e.index]={...i,signature:e.delta.signature});break}default:e.delta}return r}case"content_block_stop":return r}},Symbol.asyncIterator)](){let e=[],r=[],i=!1;return this.on("streamEvent",n=>{let o=r.shift();o?o.resolve(n):e.push(n)}),this.on("end",()=>{i=!0;for(let n of r)n.resolve(void 0);r.length=0}),this.on("abort",n=>{i=!0;for(let o of r)o.reject(n);r.length=0}),this.on("error",n=>{i=!0;for(let o of r)o.reject(n);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((n,o)=>r.push({resolve:n,reject:o})).then(n=>n?{value:n,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Ys(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}},ig=class extends Nn{create(e,r){return this._client.post("/v1/messages/batches",{body:e,...r})}retrieve(e,r){return this._client.get(br`/v1/messages/batches/${e}`,r)}list(e={},r){return this._client.getAPIList("/v1/messages/batches",Qs,{query:e,...r})}delete(e,r){return this._client.delete(br`/v1/messages/batches/${e}`,r)}cancel(e,r){return this._client.post(br`/v1/messages/batches/${e}/cancel`,r)}async results(e,r){let i=await this.retrieve(e);if(!i.results_url)throw new je(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);return this._client.get(i.results_url,{...r,headers:dt([{Accept:"application/binary"},r?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((n,o)=>eg.fromResponse(o.response,o.controller))}},Cd=class extends Nn{constructor(){super(...arguments),this.batches=new ig(this._client)}create(e,r){e.model in zR&&console.warn(`The model '${e.model}' is deprecated and will reach end-of-life on ${zR[e.model]}
166
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),e.model in M8&&e.thinking&&e.thinking.type==="enabled"&&console.warn(`Using Claude with ${e.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let i=this._client._options.timeout;if(!e.stream&&i==null){let o=QA[e.model]??void 0;i=this._client.calculateNonstreamingTimeout(e.max_tokens,o)}let n=JA(e.tools,e.messages);return this._client.post("/v1/messages",{body:e,timeout:i??6e5,...r,headers:dt([n,r?.headers]),stream:e.stream??!1})}parse(e,r){return this.create(e,r).then(i=>nD(i,e,{logger:this._client.logger??console}))}stream(e,r){return dx.createMessage(this,e,r,{logger:this._client.logger??console})}countTokens(e,r){return this._client.post("/v1/messages/count_tokens",{body:e,...r})}},zR={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026"},M8=["claude-opus-4-6"];Cd.Batches=ig;og=class extends Nn{retrieve(e,r={},i){let{betas:n}=r??{};return this._client.get(br`/v1/models/${e}`,{...i,headers:dt([{...n?.toString()!=null?{"anthropic-beta":n?.toString()}:void 0},i?.headers])})}list(e={},r){let{betas:i,...n}=e??{};return this._client.getAPIList("/v1/models",Qs,{query:n,...r,headers:dt([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},r?.headers])})}},$h=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()},Z8="\\n\\nHuman:",L8="\\n\\nAssistant:",tr=class{constructor({baseURL:e=$h("ANTHROPIC_BASE_URL"),apiKey:r=$h("ANTHROPIC_API_KEY")??null,authToken:i=$h("ANTHROPIC_AUTH_TOKEN")??null,...n}={}){fx.add(this),zh.set(this,void 0);let o={apiKey:r,authToken:i,...n,baseURL:e||"https://api.anthropic.com"};if(!o.dangerouslyAllowBrowser&&i8())throw new je(`It looks like you're running in a browser-like environment.
167
-
168
- This is disabled by default, as it risks exposing your secret API credentials to attackers.
169
- If you understand the risks and have appropriate mitigations in place,
170
- you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
171
-
172
- new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
173
- `);this.baseURL=o.baseURL,this.timeout=o.timeout??Wx.DEFAULT_TIMEOUT,this.logger=o.logger??console;let s="warn";this.logLevel=s,this.logLevel=pR(o.logLevel,"ClientOptions.logLevel",this)??pR($h("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??s,this.fetchOptions=o.fetchOptions,this.maxRetries=o.maxRetries??2,this.fetch=o.fetch??l8(),ce(this,zh,d8,"f"),this._options=o,this.apiKey=typeof r=="string"?r:null,this.authToken=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){if(!(e.get("x-api-key")||e.get("authorization"))&&!(this.apiKey&&e.get("x-api-key"))&&!r.has("x-api-key")&&!(this.authToken&&e.get("authorization"))&&!r.has("authorization"))throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}async authHeaders(e){return dt([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return dt([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return dt([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return f8(e)}getUserAgent(){return`${this.constructor.name}/JS ${gu}`}defaultIdempotencyKey(){return`stainless-node-retry-${MA()}`}makeStatusError(e,r,i,n){return en.generate(e,r,i,n)}buildURL(e,r,i){let n=!M(this,fx,"m",iD).call(this)&&i||this.baseURL,o=e8(e)?new URL(e):new URL(n+(n.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),s=this.defaultQuery(),a=Object.fromEntries(o.searchParams);return(!sR(s)||!sR(a))&&(r={...a,...s,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(o.search=this.stringifyQuery(r)),o.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new je("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 6e5}async prepareOptions(e){}async prepareRequest(e,{url:r,options:i}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,i){return this.request(Promise.resolve(i).then(n=>({method:e,path:r,...n})))}request(e,r=null){return new Bh(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,i){let n=await e,o=n.maxRetries??this.maxRetries;r==null&&(r=o),await this.prepareOptions(n);let{req:s,url:a,timeout:u}=await this.buildRequest(n,{retryCount:o-r});await this.prepareRequest(s,{url:a,options:n});let l="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),c=i===void 0?"":`, retryOf: ${i}`,d=Date.now();if(Yr(this).debug(`[${l}] sending request`,Bs({retryOfRequestLogID:i,method:n.method,url:a,options:n,headers:s.headers})),n.signal?.aborted)throw new zn;let p=new AbortController,f=await this.fetchWithTimeout(a,s,u,p).catch(rx),m=Date.now();if(f instanceof globalThis.Error){let h=`retrying, ${r} attempts remaining`;if(n.signal?.aborted)throw new zn;let y=Nd(f)||/timed? ?out/i.test(String(f)+("cause"in f?String(f.cause):""));if(r)return Yr(this).info(`[${l}] connection ${y?"timed out":"failed"} - ${h}`),Yr(this).debug(`[${l}] connection ${y?"timed out":"failed"} (${h})`,Bs({retryOfRequestLogID:i,url:a,durationMs:m-d,message:f.message})),this.retryRequest(n,r,i??l);throw Yr(this).info(`[${l}] connection ${y?"timed out":"failed"} - error; no more retries left`),Yr(this).debug(`[${l}] connection ${y?"timed out":"failed"} (error; no more retries left)`,Bs({retryOfRequestLogID:i,url:a,durationMs:m-d,message:f.message})),y?new Dh:new $u({cause:f})}let g=[...f.headers.entries()].filter(([h])=>h==="request-id").map(([h,y])=>", "+h+": "+JSON.stringify(y)).join(""),v=`[${l}${c}${g}] ${s.method} ${a} ${f.ok?"succeeded":"failed"} with status ${f.status} in ${m-d}ms`;if(!f.ok){let h=await this.shouldRetry(f);if(r&&h){let S=`retrying, ${r} attempts remaining`;return await c8(f.body),Yr(this).info(`${v} - ${S}`),Yr(this).debug(`[${l}] response error (${S})`,Bs({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,durationMs:m-d})),this.retryRequest(n,r,i??l,f.headers)}let y=h?"error; no more retries left":"error; not retryable";Yr(this).info(`${v} - ${y}`);let _=await f.text().catch(S=>rx(S).message),b=ZA(_),w=b?void 0:_;throw Yr(this).debug(`[${l}] response error (${y})`,Bs({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,message:w,durationMs:Date.now()-d})),this.makeStatusError(f.status,b,w,f.headers)}return Yr(this).info(v),Yr(this).debug(`[${l}] response start`,Bs({retryOfRequestLogID:i,url:f.url,status:f.status,headers:f.headers,durationMs:m-d})),{response:f,options:n,controller:p,requestLogID:l,retryOfRequestLogID:i,startTime:d}}getAPIList(e,r,i){return this.requestAPIList(r,i&&"then"in i?i.then(n=>({method:"get",path:e,...n})):{method:"get",path:e,...i})}requestAPIList(e,r){let i=this.makeRequest(r,null,void 0);return new sx(this,i,e)}async fetchWithTimeout(e,r,i,n){let{signal:o,method:s,...a}=r||{},u=this._makeAbort(n);o&&o.addEventListener("abort",u,{once:!0});let l=setTimeout(u,i),c=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,d={signal:n.signal,...c?{duplex:"half"}:{},method:"GET",...a};s&&(d.method=s.toUpperCase());try{return await this.fetch.call(void 0,e,d)}finally{clearTimeout(l)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,i,n){let o,s=n?.get("retry-after-ms");if(s){let u=parseFloat(s);Number.isNaN(u)||(o=u)}let a=n?.get("retry-after");if(a&&!o){let u=parseFloat(a);Number.isNaN(u)?o=Date.parse(a)-Date.now():o=u*1e3}if(o===void 0){let u=e.maxRetries??this.maxRetries;o=this.calculateDefaultRetryTimeoutMillis(r,u)}return await n8(o),this.makeRequest(e,r-1,i)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,n=Math.min(.5*Math.pow(2,i),8),o=1-Math.random()*.25;return n*o*1e3}calculateNonstreamingTimeout(e,r){if(36e5*e/128e3>6e5||r!=null&&e>r)throw new je("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 6e5}async buildRequest(e,{retryCount:r=0}={}){let i={...e},{method:n,path:o,query:s,defaultBaseURL:a}=i,u=this.buildURL(o,s,a);"timeout"in i&&r8("timeout",i.timeout),i.timeout=i.timeout??this.timeout;let{bodyHeaders:l,body:c}=this.buildBody({options:i}),d=await this.buildHeaders({options:e,method:n,bodyHeaders:l,retryCount:r});return{req:{method:n,headers:d,...i.signal&&{signal:i.signal},...globalThis.ReadableStream&&c instanceof globalThis.ReadableStream&&{duplex:"half"},...c&&{body:c},...this.fetchOptions??{},...i.fetchOptions??{}},url:u,timeout:i.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:i,retryCount:n}){let o={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),o[this.idempotencyHeader]=e.idempotencyKey);let s=dt([o,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(n),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...u8(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(e),this._options.defaultHeaders,i,e.headers]);return this.validateHeaders(s),s.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let i=dt([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&i.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:qA(e)}:typeof e=="object"&&i.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)}:M(this,zh,"f").call(this,{body:e,headers:i})}};Wx=tr,zh=new WeakMap,fx=new WeakSet,iD=function(){return this.baseURL!=="https://api.anthropic.com"};tr.Anthropic=Wx;tr.HUMAN_PROMPT=Z8;tr.AI_PROMPT=L8;tr.DEFAULT_TIMEOUT=6e5;tr.AnthropicError=je;tr.APIError=en;tr.APIConnectionError=$u;tr.APIConnectionTimeoutError=Dh;tr.APIUserAbortError=zn;tr.NotFoundError=Lh;tr.ConflictError=qh;tr.RateLimitError=Vh;tr.BadRequestError=Uh;tr.AuthenticationError=Mh;tr.InternalServerError=Wh;tr.PermissionDeniedError=Zh;tr.UnprocessableEntityError=Fh;tr.toFile=$8;Iu=class extends tr{constructor(){super(...arguments),this.completions=new ng(this),this.messages=new Cd(this),this.models=new og(this),this.beta=new Bo(this)}};Iu.Completions=ng;Iu.Messages=Cd;Iu.Models=og;Iu.Beta=Bo;hu=null;B8={renderTarget:"ink",workspace:"local",canDrive:!0,transcriptSource:"local-jsonl",remote:null};H8=K8();J8=Ux(),GIe=J8.subscribe,Y8=Ux(),BIe=Y8.subscribe,Q8=Ux(),KIe=Q8.subscribe;RR=new Set;o7=Yo(t=>{if(!t||t.trim()==="")return null;let e=t.split(",").map(o=>o.trim()).filter(Boolean);if(e.length===0)return null;let r=e.some(o=>o.startsWith("!")),i=e.some(o=>!o.startsWith("!"));if(r&&i)return null;let n=e.map(o=>o.replace(/^!/,"").toLowerCase());return{include:r?[]:n,exclude:r?n:[],isExclusive:r}});y7={cwd(){return process.cwd()},existsSync(t){let e=[];try{let n=Qt(e,er`fs.existsSync(${t})`,0);return Ue.existsSync(t)}catch(n){var r=n,i=1}finally{Xt(e,r,i)}},async stat(t){return h7(t)},async readdir(t){return d7(t,{withFileTypes:!0})},async unlink(t){return g7(t)},async rmdir(t){return p7(t)},async rm(t,e){return m7(t,e)},async mkdir(t,e){try{await l7(t,{recursive:!0,...e})}catch(r){if(ku(r)!=="EEXIST")throw r}},async readFile(t,e){return AR(t,{encoding:e.encoding})},async rename(t,e){return f7(t,e)},statSync(t){let e=[];try{let n=Qt(e,er`fs.statSync(${t})`,0);return Ue.statSync(t)}catch(n){var r=n,i=1}finally{Xt(e,r,i)}},lstatSync(t){let e=[];try{let n=Qt(e,er`fs.lstatSync(${t})`,0);return Ue.lstatSync(t)}catch(n){var r=n,i=1}finally{Xt(e,r,i)}},readFileSync(t,e){let r=[];try{let o=Qt(r,er`fs.readFileSync(${t})`,0);return Ue.readFileSync(t,{encoding:e.encoding})}catch(o){var i=o,n=1}finally{Xt(r,i,n)}},readFileBytesSync(t){let e=[];try{let n=Qt(e,er`fs.readFileBytesSync(${t})`,0);return Ue.readFileSync(t)}catch(n){var r=n,i=1}finally{Xt(e,r,i)}},readSync(t,e){let r=[];try{let o=Qt(r,er`fs.readSync(${t}, ${e.length} bytes)`,0),s;try{s=Ue.openSync(t,"r");let a=Buffer.alloc(e.length),u=Ue.readSync(s,a,0,e.length,0);return{buffer:a,bytesRead:u}}finally{s&&Ue.closeSync(s)}}catch(o){var i=o,n=1}finally{Xt(r,i,n)}},appendFileSync(t,e,r){let i=[];try{let s=Qt(i,er`fs.appendFileSync(${t}, ${e.length} chars)`,0);if(r?.mode!==void 0)try{let a=Ue.openSync(t,"ax",r.mode);try{Ue.appendFileSync(a,e)}finally{Ue.closeSync(a)}return}catch(a){if(ku(a)!=="EEXIST")throw a}Ue.appendFileSync(t,e)}catch(s){var n=s,o=1}finally{Xt(i,n,o)}},copyFileSync(t,e){let r=[];try{let o=Qt(r,er`fs.copyFileSync(${t} → ${e})`,0);Ue.copyFileSync(t,e)}catch(o){var i=o,n=1}finally{Xt(r,i,n)}},unlinkSync(t){let e=[];try{let n=Qt(e,er`fs.unlinkSync(${t})`,0);Ue.unlinkSync(t)}catch(n){var r=n,i=1}finally{Xt(e,r,i)}},renameSync(t,e){let r=[];try{let o=Qt(r,er`fs.renameSync(${t} → ${e})`,0);Ue.renameSync(t,e)}catch(o){var i=o,n=1}finally{Xt(r,i,n)}},linkSync(t,e){let r=[];try{let o=Qt(r,er`fs.linkSync(${t} → ${e})`,0);Ue.linkSync(t,e)}catch(o){var i=o,n=1}finally{Xt(r,i,n)}},symlinkSync(t,e,r){let i=[];try{let s=Qt(i,er`fs.symlinkSync(${t} → ${e})`,0);Ue.symlinkSync(t,e,r)}catch(s){var n=s,o=1}finally{Xt(i,n,o)}},readlinkSync(t){let e=[];try{let n=Qt(e,er`fs.readlinkSync(${t})`,0);return Ue.readlinkSync(t)}catch(n){var r=n,i=1}finally{Xt(e,r,i)}},realpathSync(t){let e=[];try{let n=Qt(e,er`fs.realpathSync(${t})`,0);return Ue.realpathSync(t).normalize("NFC")}catch(n){var r=n,i=1}finally{Xt(e,r,i)}},mkdirSync(t,e){let r=[];try{let o=Qt(r,er`fs.mkdirSync(${t})`,0),s={recursive:!0};e?.mode!==void 0&&(s.mode=e.mode);try{Ue.mkdirSync(t,s)}catch(a){if(ku(a)!=="EEXIST")throw a}}catch(o){var i=o,n=1}finally{Xt(r,i,n)}},readdirSync(t){let e=[];try{let n=Qt(e,er`fs.readdirSync(${t})`,0);return Ue.readdirSync(t,{withFileTypes:!0})}catch(n){var r=n,i=1}finally{Xt(e,r,i)}},readdirStringSync(t){let e=[];try{let n=Qt(e,er`fs.readdirStringSync(${t})`,0);return Ue.readdirSync(t)}catch(n){var r=n,i=1}finally{Xt(e,r,i)}},isDirEmptySync(t){let e=[];try{let n=Qt(e,er`fs.isDirEmptySync(${t})`,0);return this.readdirSync(t).length===0}catch(n){var r=n,i=1}finally{Xt(e,r,i)}},rmdirSync(t){let e=[];try{let n=Qt(e,er`fs.rmdirSync(${t})`,0);Ue.rmdirSync(t)}catch(n){var r=n,i=1}finally{Xt(e,r,i)}},rmSync(t,e){let r=[];try{let o=Qt(r,er`fs.rmSync(${t})`,0);Ue.rmSync(t,e)}catch(o){var i=o,n=1}finally{Xt(r,i,n)}},createWriteStream(t){return Ue.createWriteStream(t)},async readFileBytes(t,e){if(e===void 0)return AR(t);let r=await c7(t,"r");try{let{size:i}=await r.stat(),n=Math.min(i,e),o=Buffer.allocUnsafe(n),s=0;for(;s<n;){let{bytesRead:a}=await r.read(o,s,n-s,s);if(a===0)break;s+=a}return s<n?o.subarray(0,s):o}finally{await r.close()}}},v7=y7;mx={verbose:0,debug:1,info:2,warn:3,error:4},w7=Yo(()=>{let t=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();return t&&Object.hasOwn(mx,t)?t:"debug"}),S7=!1;hx=Yo(()=>{let t=Ng();return S7||wu(process.env.DEBUG)||wu(process.env.DEBUG_SDK)||t.includes("--debug")||t.includes("-d")||lD()||t.some(e=>e.startsWith("--debug="))||cD()!==null}),k7=Yo(()=>{let t=Ng().find(r=>r.startsWith("--debug="));if(!t)return null;let e=t.substring(8);return o7(e)}),lD=Yo(()=>{let t=Ng();return t.includes("--debug-to-stderr")||t.includes("-d2e")}),cD=Yo(()=>{let t=Ng();for(let e=0;e<t.length;e++){let r=t[e];if(r.startsWith("--debug-file="))return r.substring(13);if(r==="--debug-file"&&e+1<t.length)return t[e+1]}return null});$7=!1,Ih=null,Qk=Promise.resolve(),gx=null;pD=Yo(async()=>{try{let t=fD(),e=uD(t),r=Kx(e,"latest");await t7(r).catch(()=>{}),await e7(t,r)}catch{}}),QIe=(()=>{let t=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(t!==void 0){let e=Number(t);if(!Number.isNaN(e)&&e>=0)return e}return 1/0})(),T7={[Symbol.dispose](){}};er=O7;Hx=(t,e)=>{let r=[];try{let o=Qt(r,er`JSON.parse(${t})`,0);return typeof e>"u"?JSON.parse(t):JSON.parse(t,e)}catch(o){var i=o,n=1}finally{Xt(r,i,n)}};j7=2e3,sg=new Set,DR=!1;yx=class{options;process;processStdin;processStdout;ready=!1;abortController;exitError;exitListeners=[];abortHandler;pendingWrites=[];pendingEndInput=!1;spawnResolve;spawnReject;spawnPromise;constructor(e){this.options=e,this.abortController=e.abortController||NA(),e.deferSpawn?(this.spawnPromise=new Promise((r,i)=>{this.spawnResolve=r,this.spawnReject=i}),this.spawnPromise.catch(()=>{})):this.initialize()}spawn(){try{this.initialize()}catch(r){throw this.spawnAbort(Gx(r)),r}let e=this.pendingWrites;this.pendingWrites=[],this.spawnResolve&&(this.spawnResolve(),this.spawnResolve=void 0,this.spawnReject=void 0);for(let r of e)this.write(r);this.pendingEndInput&&(this.pendingEndInput=!1,this.processStdin?.end())}spawnAbort(e){this.spawnReject&&(this.spawnReject(e),this.spawnReject=void 0,this.spawnResolve=void 0,this.pendingWrites=[])}updateEnv(e){this.options.env?Object.assign(this.options.env,e):this.options.env={...e}}updateResume(e){this.options.resume=e}getDefaultExecutable(){return CA()?"bun":"node"}spawnLocalProcess(e){let{command:r,args:i,cwd:n,env:o,signal:s}=e,a=wu(o.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr?"pipe":"ignore",u=dY(r,i,{cwd:n,stdio:["pipe","pipe",a],signal:s,env:o,windowsHide:!0});return(wu(o.DEBUG_CLAUDE_AGENT_SDK)||this.options.stderr)&&u.stderr.on("data",l=>{let c=l.toString();Li(c),this.options.stderr&&this.options.stderr(c)}),{stdin:u.stdin,stdout:u.stdout,get killed(){return u.killed},get exitCode(){return u.exitCode},kill:u.kill.bind(u),on:u.on.bind(u),once:u.once.bind(u),off:u.off.bind(u)}}initialize(){try{let{additionalDirectories:e=[],agent:r,betas:i,cwd:n,executable:o=this.getDefaultExecutable(),executableArgs:s=[],extraArgs:a={},pathToClaudeCodeExecutable:u,env:l={...process.env},thinkingConfig:c,maxTurns:d,maxBudgetUsd:p,taskBudget:f,model:m,fallbackModel:g,jsonSchema:v,permissionMode:h,allowDangerouslySkipPermissions:y,permissionPromptToolName:_,continueConversation:b,resume:w,settingSources:S,allowedTools:k=[],disallowedTools:$=[],tools:P,mcpServers:j,strictMcpConfig:I,canUseTool:R,includePartialMessages:q,plugins:O,sandbox:Q}=this.options,K=["--output-format","stream-json","--verbose","--input-format","stream-json"];if(c){switch(c.type){case"enabled":c.budgetTokens===void 0?K.push("--thinking","adaptive"):K.push("--max-thinking-tokens",c.budgetTokens.toString());break;case"disabled":K.push("--thinking","disabled");break;case"adaptive":K.push("--thinking","adaptive");break}c.type!=="disabled"&&c.display&&K.push("--thinking-display",c.display)}if(this.options.effort&&K.push("--effort",this.options.effort),d&&K.push("--max-turns",d.toString()),p!==void 0&&K.push("--max-budget-usd",p.toString()),f&&K.push("--task-budget",f.total.toString()),m&&K.push("--model",m),r&&K.push("--agent",r),i&&i.length>0&&K.push("--betas",i.join(",")),v&&K.push("--json-schema",Qr(v)),this.options.debugFile?K.push("--debug-file",this.options.debugFile):this.options.debug&&K.push("--debug"),!this.options.debugFile&&!this.options.spawnClaudeCodeProcess){let C=W8();C&&K.push("--debug-file",C)}if(R){if(_)throw Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other.");K.push("--permission-prompt-tool","stdio")}else _&&K.push("--permission-prompt-tool",_);if(b&&K.push("--continue"),w&&K.push("--resume",w),this.options.assistant&&K.push("--assistant"),this.options.channels&&this.options.channels.length>0&&K.push("--channels",...this.options.channels),k.length>0&&K.push("--allowedTools",k.join(",")),$.length>0&&K.push("--disallowedTools",$.join(",")),P!==void 0&&(Array.isArray(P)?P.length===0?K.push("--tools",""):K.push("--tools",P.join(",")):K.push("--tools","default")),j&&Object.keys(j).length>0&&K.push("--mcp-config",Qr({mcpServers:j})),S!==void 0&&K.push(`--setting-sources=${S.join(",")}`),I&&K.push("--strict-mcp-config"),h&&K.push("--permission-mode",h),y&&K.push("--allow-dangerously-skip-permissions"),g){if(m&&g===m)throw Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option.");K.push("--fallback-model",g)}this.options.includeHookEvents&&K.push("--include-hook-events"),q&&K.push("--include-partial-messages"),this.options.sessionMirror&&K.push("--session-mirror");for(let C of e)K.push("--add-dir",C);if(O&&O.length>0)for(let C of O)if(C.type==="local")K.push("--plugin-dir",C.path);else throw Error(`Unsupported plugin type: ${C.type}`);this.options.forkSession&&K.push("--fork-session"),this.options.resumeSessionAt&&K.push("--resume-session-at",this.options.resumeSessionAt),this.options.sessionId&&K.push("--session-id",this.options.sessionId),this.options.persistSession===!1&&K.push("--no-session-persistence"),this.options.managedSettings&&K.push("--managed-settings",this.options.managedSettings);let Oe={...a??{}};this.options.settings&&(Oe.settings=this.options.settings);let st=N7(Oe,Q);for(let[C,x]of Object.entries(st))x===null?K.push(`--${C}`):K.push(`--${C}`,x);l.CLAUDE_CODE_ENTRYPOINT||(l.CLAUDE_CODE_ENTRYPOINT="sdk-ts"),delete l.NODE_OPTIONS,wu(l.DEBUG_CLAUDE_AGENT_SDK)?l.DEBUG="1":delete l.DEBUG;let pe=A7(u),J=pe?u:o,T=pe?[...s,...K]:[...s,u,...K],G={command:J,args:T,cwd:n,env:l,signal:this.abortController.signal};this.options.spawnClaudeCodeProcess?(Li(`Spawning Claude Code (custom): ${J} ${T.join(" ")}`),this.process=this.options.spawnClaudeCodeProcess(G)):(Li(`Spawning Claude Code: ${J} ${T.join(" ")}`),this.process=this.spawnLocalProcess(G)),this.processStdin=this.process.stdin,this.processStdout=this.process.stdout,R7(this.process),this.abortHandler=()=>{this.process&&!this.process.killed&&this.process.kill("SIGTERM")},this.abortController.signal.addEventListener("abort",this.abortHandler),this.process.on("error",C=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new Wo("Claude Code process aborted by user");else if(Bx(C)){let x=pe?`Claude Code native binary not found at ${u}. Please ensure Claude Code is installed via native installer or specify a valid path with options.pathToClaudeCodeExecutable.`:`Claude Code executable not found at ${u}. Is options.pathToClaudeCodeExecutable set?`;this.exitError=ReferenceError(x),Li(this.exitError.message)}else this.exitError=Error(`Failed to spawn Claude Code process: ${C.message}`),Li(this.exitError.message)}),this.process.on("exit",(C,x)=>{if(this.ready=!1,this.abortController.signal.aborted)this.exitError=new Wo("Claude Code process aborted by user");else{let E=this.getProcessExitError(C,x);E&&(this.exitError=E,Li(E.message))}}),this.ready=!0}catch(e){throw this.ready=!1,e}}getProcessExitError(e,r){if(e!==0&&e!==null)return Error(`Claude Code process exited with code ${e}`);if(r)return Error(`Claude Code process terminated by signal ${r}`)}write(e){if(this.abortController.signal.aborted)throw new Wo("Operation aborted");if(this.spawnResolve){this.pendingWrites.push(e);return}if(!this.ready||!this.processStdin)throw Error("ProcessTransport is not ready for writing");if(this.processStdin.writableEnded){Li("[ProcessTransport] Dropping write to ended stdin stream");return}if(this.process?.killed||this.process?.exitCode!==null)throw Error("Cannot write to terminated process");if(this.exitError)throw Error(`Cannot write to process that exited with error: ${this.exitError.message}`);Li(`[ProcessTransport] Writing to stdin: ${e.substring(0,100)}`);try{this.processStdin.write(e)||Li("[ProcessTransport] Write buffer full, data queued")}catch(r){throw this.ready=!1,Error(`Failed to write to process stdin: ${Nh(r)}`)}}[Symbol.dispose](){this.close()}close(){this.spawnAbort(Error("Query closed before spawn")),this.processStdin&&(this.processStdin.end(),this.processStdin=void 0),this.abortHandler&&(this.abortController.signal.removeEventListener("abort",this.abortHandler),this.abortHandler=void 0);for(let{handler:r}of this.exitListeners)this.process?.off("exit",r);this.exitListeners=[];let e=this.process;e&&!e.killed&&e.exitCode===null?(setTimeout(r=>{r.killed||r.exitCode!==null||(r.kill("SIGTERM"),setTimeout(i=>{i.exitCode===null&&i.kill("SIGKILL")},5e3,r).unref())},j7,e).unref(),e.once("exit",()=>sg.delete(e))):e&&sg.delete(e),this.ready=!1}isReady(){return this.ready}async*readMessages(){if(this.spawnPromise&&(await this.spawnPromise,this.spawnPromise=void 0),!this.processStdout)throw Error("ProcessTransport output stream not available");if(this.exitError)throw this.exitError;let e=fY({input:this.processStdout}),r=this.process?(()=>{let i=this.process,n=()=>e.close();return i.on("error",n),()=>i.off("error",n)})():void 0;this.exitError&&e.close();try{for await(let i of e)if(i.trim()){let n;try{n=Hx(i)}catch{Li(`Non-JSON stdout: ${i}`);continue}yield n}if(this.exitError)throw this.exitError;await this.waitForExit()}catch(i){throw i}finally{r?.(),e.close()}}endInput(){if(this.spawnResolve){this.pendingEndInput=!0;return}this.processStdin&&this.processStdin.end()}getInputStream(){return this.processStdin}onExit(e){if(!this.process)return()=>{};let r=(i,n)=>{let o=this.getProcessExitError(i,n);e(o)};return this.process.on("exit",r),this.exitListeners.push({callback:e,handler:r}),()=>{this.process&&this.process.off("exit",r);let i=this.exitListeners.findIndex(n=>n.handler===r);i!==-1&&this.exitListeners.splice(i,1)}}async waitForExit(){if(!this.process){if(this.exitError)throw this.exitError;return}if(this.process.exitCode!==null||this.process.killed||this.exitError){if(this.exitError)throw this.exitError;return}return new Promise((e,r)=>{let i=(o,s)=>{if(this.abortController.signal.aborted){r(new Wo("Operation aborted"));return}let a=this.getProcessExitError(o,s);a?r(a):e()};this.process.once("exit",i);let n=o=>{this.process.off("exit",i),r(o)};this.process.once("error",n),this.process.once("exit",()=>{this.process.off("error",n)})})}};vx=class{returned;queue=[];readResolve;readReject;isDone=!1;hasError;started=!1;constructor(e){this.returned=e}[Symbol.asyncIterator](){if(this.started)throw Error("Stream can only be iterated once");return this.started=!0,this}next(){return this.queue.length>0?Promise.resolve({done:!1,value:this.queue.shift()}):this.isDone?Promise.resolve({done:!0,value:void 0}):this.hasError?Promise.reject(this.hasError):new Promise((e,r)=>{this.readResolve=e,this.readReject=r})}enqueue(e){if(this.readResolve){let r=this.readResolve;this.readResolve=void 0,this.readReject=void 0,r({done:!1,value:e})}else this.queue.push(e)}done(){if(this.isDone=!0,this.readResolve){let e=this.readResolve;this.readResolve=void 0,this.readReject=void 0,e({done:!0,value:void 0})}}error(e){if(this.hasError=e,this.readReject){let r=this.readReject;this.readResolve=void 0,this.readReject=void 0,r(e)}}return(){return this.isDone=!0,this.returned&&this.returned(),Promise.resolve({done:!0,value:void 0})}},_x=class{sendMcpMessage;isClosed=!1;constructor(e){this.sendMcpMessage=e}onclose;onerror;onmessage;async start(){}async send(e){if(this.isClosed)throw Error("Transport is closed");this.sendMcpMessage(e)}async close(){this.isClosed||(this.isClosed=!0,this.onclose?.())}},bx=class{transport;isSingleUserTurn;canUseTool;hooks;abortController;jsonSchema;initConfig;onElicitation;getOAuthToken;pendingControlResponses=new Map;cleanupPerformed=!1;sdkMessages;inputStream=new vx;initialization;cancelControllers=new Map;hookCallbacks=new Map;nextCallbackId=0;sdkMcpTransports=new Map;sdkMcpServerInstances=new Map;pendingMcpResponses=new Map;firstResultReceivedResolve;firstResultReceived=!1;lastErrorResultText;transcriptMirrorBatcher;cleanupCallbacks=[];cleanupPromise;setIsSingleUserTurn(e){this.isSingleUserTurn=e}setTranscriptMirrorBatcher(e){this.transcriptMirrorBatcher=e}reportMirrorError(e,r){let i={type:"system",subtype:"mirror_error",error:r,key:e,uuid:px(),session_id:e.sessionId};this.inputStream.enqueue(i)}addCleanupCallback(e){this.cleanupPerformed?e():this.cleanupCallbacks.push(e)}isClosed(){return this.cleanupPerformed}hasBidirectionalNeeds(){return this.sdkMcpTransports.size>0||this.hooks!==void 0&&Object.keys(this.hooks).length>0||this.canUseTool!==void 0||this.onElicitation!==void 0||this.getOAuthToken!==void 0}constructor(e,r,i,n,o,s=new Map,a,u,l,c){this.transport=e,this.isSingleUserTurn=r,this.canUseTool=i,this.hooks=n,this.abortController=o,this.jsonSchema=a,this.initConfig=u,this.onElicitation=l,this.getOAuthToken=c;for(let[d,p]of s)this.connectSdkMcpServer(d,p);this.sdkMessages=this.readSdkMessages(),this.readMessages(),this.initialization=this.initialize(),this.initialization.catch(()=>{})}setError(e){this.inputStream.error(e)}async stopTask(e){await this.request({subtype:"stop_task",task_id:e})}close(){this.cleanup()}cleanup(e){return this.cleanupPromise?this.cleanupPromise:(this.cleanupPerformed=!0,this.cleanupPromise=this.performCleanup(e),this.cleanupPromise)}async performCleanup(e){for(let r of this.cleanupCallbacks)try{r()}catch{}if(this.cleanupCallbacks=[],this.transcriptMirrorBatcher)try{await this.transcriptMirrorBatcher.flush()}catch{}try{for(let i of this.cancelControllers.values())i.abort();this.cancelControllers.clear(),this.transport.close();let r=e??Error("Query closed before response received");for(let{reject:i}of this.pendingControlResponses.values())i(r);this.pendingControlResponses.clear();for(let{reject:i}of this.pendingMcpResponses.values())i(r);this.pendingMcpResponses.clear(),this.hookCallbacks.clear();for(let i of this.sdkMcpTransports.values())i.close().catch(()=>{});this.sdkMcpTransports.clear(),e?this.inputStream.error(e):this.inputStream.done()}catch{}}next(...[e]){return this.sdkMessages.next(e)}async return(e){return await this.cleanup(),this.sdkMessages.return(e)}async throw(e){return await this.cleanup(),this.sdkMessages.throw(e)}[Symbol.asyncIterator](){return this.sdkMessages}async[Symbol.asyncDispose](){await this.cleanup()}async readMessages(){try{for await(let e of this.transport.readMessages()){if(e.type==="control_response"){let r=this.pendingControlResponses.get(e.response.request_id);r&&r.handler(e.response);continue}else if(e.type==="control_request"){this.handleControlRequest(e);continue}else if(e.type==="control_cancel_request"){this.handleControlCancelRequest(e);continue}else{if(e.type==="keep_alive")continue;if(e.type==="transcript_mirror"){this.transcriptMirrorBatcher?.enqueue(e.filePath,e.entries);continue}}if(e.type==="system"&&(e.subtype==="post_turn_summary"||e.subtype==="task_summary")){this.inputStream.enqueue(e);continue}e.type==="result"?(this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.lastErrorResultText=e.is_error?e.subtype==="success"?e.result:e.errors.join("; "):void 0,this.firstResultReceived=!0,this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.isSingleUserTurn&&(Cr("[Query.readMessages] First result received for single-turn query, closing stdin"),this.transport.endInput())):e.type==="system"&&e.subtype==="session_state_changed"||(this.lastErrorResultText=void 0),this.inputStream.enqueue(e)}this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.inputStream.done(),this.cleanup()}catch(e){if(this.transcriptMirrorBatcher&&await this.transcriptMirrorBatcher.flush(),this.firstResultReceivedResolve&&this.firstResultReceivedResolve(),this.lastErrorResultText!==void 0&&!(e instanceof Wo)){let r=Error(`Claude Code returned an error result: ${this.lastErrorResultText}`);Cr(`[Query.readMessages] Replacing exit error with result text. Original: ${Nh(e)}`),this.inputStream.error(r),this.cleanup(r);return}this.inputStream.error(e),this.cleanup(e)}}async handleControlRequest(e){let r=new AbortController;this.cancelControllers.set(e.request_id,r);try{let i=await this.processControlRequest(e,r.signal);if(this.cleanupPerformed)return;let n={type:"control_response",response:{subtype:"success",request_id:e.request_id,response:i}};await Promise.resolve(this.transport.write(Qr(n)+`
174
- `))}catch(i){if(this.cleanupPerformed)return;let n={type:"control_response",response:{subtype:"error",request_id:e.request_id,error:Nh(i)}};try{await Promise.resolve(this.transport.write(Qr(n)+`
175
- `))}catch(o){Cr(`[Query.handleControlRequest] Error-response write failed: ${Nh(o)}`,{level:"error"})}}finally{this.cancelControllers.delete(e.request_id)}}handleControlCancelRequest(e){let r=this.cancelControllers.get(e.request_id);r&&(r.abort(),this.cancelControllers.delete(e.request_id))}async processControlRequest(e,r){if(e.request.subtype==="can_use_tool"){if(!this.canUseTool)throw Error("canUseTool callback is not provided.");return{...await this.canUseTool(e.request.tool_name,e.request.input,{signal:r,suggestions:e.request.permission_suggestions,blockedPath:e.request.blocked_path,decisionReason:e.request.decision_reason,title:e.request.title,displayName:e.request.display_name,description:e.request.description,toolUseID:e.request.tool_use_id,agentID:e.request.agent_id}),toolUseID:e.request.tool_use_id}}else{if(e.request.subtype==="hook_callback")return await this.handleHookCallbacks(e.request.callback_id,e.request.input,e.request.tool_use_id,r);if(e.request.subtype==="mcp_message"){let i=e.request,n=this.sdkMcpTransports.get(i.server_name);if(!n)throw Error(`SDK MCP server not found: ${i.server_name}`);return"method"in i.message&&"id"in i.message&&i.message.id!==null?{mcp_response:await this.handleMcpControlRequest(i.server_name,i,n)}:(n.onmessage&&n.onmessage(i.message),{mcp_response:{jsonrpc:"2.0",result:{},id:0}})}else if(e.request.subtype==="elicitation"){let i=e.request;return this.onElicitation?await this.onElicitation({serverName:i.mcp_server_name,message:i.message,mode:i.mode,url:i.url,elicitationId:i.elicitation_id,requestedSchema:i.requested_schema,title:i.title,displayName:i.display_name,description:i.description},{signal:r}):{action:"decline"}}else if(e.request.subtype==="oauth_token_refresh"){if(!this.getOAuthToken)throw Error("getOAuthToken callback is not provided.");return{accessToken:await this.getOAuthToken({signal:r})??null}}}throw Error("Unsupported control request subtype: "+e.request.subtype)}async*readSdkMessages(){try{for await(let e of this.inputStream)yield e}finally{await this.cleanup()}}async initialize(){let e;if(this.hooks){e={};for(let[n,o]of Object.entries(this.hooks))o.length>0&&(e[n]=o.map(s=>{let a=[];for(let u of s.hooks){let l=`hook_${this.nextCallbackId++}`;this.hookCallbacks.set(l,u),a.push(l)}return{matcher:s.matcher,hookCallbackIds:a,timeout:s.timeout}}))}let r=this.sdkMcpTransports.size>0?Array.from(this.sdkMcpTransports.keys()):void 0,i={subtype:"initialize",hooks:e,sdkMcpServers:r,jsonSchema:this.jsonSchema,systemPrompt:typeof this.initConfig?.systemPrompt=="string"?[this.initConfig.systemPrompt]:this.initConfig?.systemPrompt,appendSystemPrompt:this.initConfig?.appendSystemPrompt,planModeInstructions:this.initConfig?.planModeInstructions,appendSubagentSystemPrompt:this.initConfig?.appendSubagentSystemPrompt,excludeDynamicSections:this.initConfig?.excludeDynamicSections,agents:this.initConfig?.agents,title:this.initConfig?.title,promptSuggestions:this.initConfig?.promptSuggestions,agentProgressSummaries:this.initConfig?.agentProgressSummaries,forwardSubagentText:this.initConfig?.forwardSubagentText};return(await this.request(i)).response}async interrupt(){await this.request({subtype:"interrupt"})}async setPermissionMode(e){await this.request({subtype:"set_permission_mode",mode:e})}async setModel(e){await this.request({subtype:"set_model",model:e})}async setMaxThinkingTokens(e){await this.request({subtype:"set_max_thinking_tokens",max_thinking_tokens:e})}async applyFlagSettings(e){await this.request({subtype:"apply_flag_settings",settings:e})}async getSettings(){return(await this.request({subtype:"get_settings"})).response}async rewindFiles(e,r){return(await this.request({subtype:"rewind_files",user_message_id:e,dry_run:r?.dryRun})).response}async cancelAsyncMessage(e){return(await this.request({subtype:"cancel_async_message",message_uuid:e})).response.cancelled}async seedReadState(e,r){await this.request({subtype:"seed_read_state",path:e,mtime:r})}async enableRemoteControl(e,r){return(await this.request({subtype:"remote_control",enabled:e,...r!==void 0&&{name:r}})).response}async generateSessionTitle(e,r){return(await this.request({subtype:"generate_session_title",description:e,persist:r?.persist})).response.title}async askSideQuestion(e){let r=(await this.request({subtype:"side_question",question:e})).response;return r.response===null?null:{response:r.response,synthetic:r.synthetic??!1}}async launchUltrareview(e,r){return(await this.request({subtype:"ultrareview_launch",args:e,confirm:r?.confirm??!1})).response}async messageRated(e){await this.request({subtype:"message_rated",messageUuid:e.messageUuid,sentiment:e.sentiment,surface:e.surface,cleared:e.cleared??!1})}processPendingPermissionRequests(e){for(let r of e)r.request.subtype==="can_use_tool"&&this.handleControlRequest(r).catch(()=>{})}request(e){let r=Math.random().toString(36).substring(2,15),i={request_id:r,type:"control_request",request:e};return new Promise((n,o)=>{this.pendingControlResponses.set(r,{handler:s=>{this.pendingControlResponses.delete(r),s.subtype==="success"?n(s):(o(Error(s.error)),s.pending_permission_requests&&this.processPendingPermissionRequests(s.pending_permission_requests))},reject:o}),Promise.resolve(this.transport.write(Qr(i)+`
176
- `)).catch(s=>{this.pendingControlResponses.delete(r),o(s)})})}initializationResult(){return this.initialization}async supportedCommands(){return(await this.initialization).commands}async supportedModels(){return(await this.initialization).models}async supportedAgents(){return(await this.initialization).agents}async reconnectMcpServer(e){await this.request({subtype:"mcp_reconnect",serverName:e})}async toggleMcpServer(e,r){await this.request({subtype:"mcp_toggle",serverName:e,enabled:r})}async enableChannel(e){await this.request({subtype:"channel_enable",serverName:e})}async mcpAuthenticate(e){return(await this.request({subtype:"mcp_authenticate",serverName:e})).response}async mcpClearAuth(e){return(await this.request({subtype:"mcp_clear_auth",serverName:e})).response}async mcpSubmitOAuthCallbackUrl(e,r){return(await this.request({subtype:"mcp_oauth_callback_url",serverName:e,callbackUrl:r})).response}async claudeAuthenticate(e){return(await this.request({subtype:"claude_authenticate",loginWithClaudeAi:e})).response}async claudeOAuthCallback(e,r){return(await this.request({subtype:"claude_oauth_callback",authorizationCode:e,state:r})).response}async claudeOAuthWaitForCompletion(){return(await this.request({subtype:"claude_oauth_wait_for_completion"})).response}async mcpServerStatus(){return(await this.request({subtype:"mcp_status"})).response.mcpServers}async getContextUsage(){return(await this.request({subtype:"get_context_usage"})).response}async readFile(e,r){try{return(await this.request({subtype:"read_file",path:e,max_bytes:r?.maxBytes})).response}catch{return null}}async reloadPlugins(){return(await this.request({subtype:"reload_plugins"})).response}async setMcpServers(e){let r={},i={};for(let[a,u]of Object.entries(e))u.type==="sdk"&&"instance"in u?r[a]=u.instance:i[a]=u;let n=new Set(this.sdkMcpServerInstances.keys()),o=new Set(Object.keys(r));for(let a of n)o.has(a)||await this.disconnectSdkMcpServer(a);for(let[a,u]of Object.entries(r))n.has(a)||this.connectSdkMcpServer(a,u);let s={};for(let a of Object.keys(r))s[a]={type:"sdk",name:a};return(await this.request({subtype:"mcp_set_servers",servers:{...i,...s}})).response}async accountInfo(){return(await this.initialization).account}async streamInput(e){Cr("[Query.streamInput] Starting to process input stream");try{let r=0;for await(let i of e){if(r++,Cr(`[Query.streamInput] Processing message ${r}: ${i.type}`),this.abortController?.signal.aborted)break;await Promise.resolve(this.transport.write(Qr(i)+`
177
- `))}Cr(`[Query.streamInput] Finished processing ${r} messages from input stream`),r>0&&this.hasBidirectionalNeeds()&&(Cr("[Query.streamInput] Has bidirectional needs, waiting for first result"),await this.waitForFirstResult()),Cr("[Query] Calling transport.endInput() to close stdin to CLI process"),this.transport.endInput()}catch(r){if(!(r instanceof Wo))throw r}}waitForFirstResult(){return this.firstResultReceived?(Cr("[Query.waitForFirstResult] Result already received, returning immediately"),Promise.resolve()):new Promise(e=>{if(this.abortController?.signal.aborted){e();return}this.abortController?.signal.addEventListener("abort",()=>e(),{once:!0}),this.firstResultReceivedResolve=e})}handleHookCallbacks(e,r,i,n){let o=this.hookCallbacks.get(e);if(!o)throw Error(`No hook callback found for ID: ${e}`);return o(r,i,{signal:n})}connectSdkMcpServer(e,r){let i=new _x(n=>this.sendMcpServerMessageToCli(e,n));this.sdkMcpTransports.set(e,i),this.sdkMcpServerInstances.set(e,r),r.connect(i).catch(n=>{this.sdkMcpTransports.get(e)===i&&this.sdkMcpTransports.delete(e),this.sdkMcpServerInstances.get(e)===r&&this.sdkMcpServerInstances.delete(e),Cr(`[Query.connectSdkMcpServer] Failed to connect MCP server '${e}': ${n}`,{level:"error"})})}async disconnectSdkMcpServer(e){let r=this.sdkMcpTransports.get(e);r&&(await r.close(),this.sdkMcpTransports.delete(e)),this.sdkMcpServerInstances.delete(e)}sendMcpServerMessageToCli(e,r){if("id"in r&&r.id!==null&&r.id!==void 0){let n=`${e}:${r.id}`,o=this.pendingMcpResponses.get(n);if(o){o.resolve(r),this.pendingMcpResponses.delete(n);return}}let i={type:"control_request",request_id:px(),request:{subtype:"mcp_message",server_name:e,message:r}};Promise.resolve(this.transport.write(Qr(i)+`
178
- `)).catch(n=>{Cr(`[Query.sendMcpServerMessageToCli] Transport write failed: ${n}`,{level:"error"})})}handleMcpControlRequest(e,r,i){let n="id"in r.message?r.message.id:null,o=`${e}:${n}`;return new Promise((s,a)=>{let u=()=>{this.pendingMcpResponses.delete(o)},l=d=>{u(),s(d)},c=d=>{u(),a(d)};if(this.pendingMcpResponses.set(o,{resolve:l,reject:c}),i.onmessage)i.onmessage(r.message);else{u(),a(Error("No message handler registered"));return}})}},U7=500,M7=1048576,Z7=[200,800],wx=class{send;sendTimeoutMs;onError;maxPendingEntries;maxPendingBytes;backoffMs;pending=[];pendingEntries=0;pendingBytes=0;flushPromise=null;constructor(e,r=6e4,i,n=U7,o=M7,s=Z7){this.send=e,this.sendTimeoutMs=r,this.onError=i,this.maxPendingEntries=n,this.maxPendingBytes=o,this.backoffMs=s}enqueue(e,r){let i=Qr(r).length;this.pending.push({filePath:e,entries:r,bytes:i}),this.pendingEntries+=r.length,this.pendingBytes+=i,(this.pendingEntries>this.maxPendingEntries||this.pendingBytes>this.maxPendingBytes)&&(this.flushPromise=this.drain(),this.flushPromise.catch(()=>{}))}async flush(){let e=this.drain();this.flushPromise=e,await e,this.flushPromise===e&&(this.flushPromise=null)}async drain(){let e=this.flushPromise,r=this.pending.splice(0);this.pendingEntries=0,this.pendingBytes=0,e&&await e,r.length!==0&&await this.doFlush(r)}async doFlush(e){let r=new Map;for(let n of e){let o=r.get(n.filePath);o?o.push(...n.entries):r.set(n.filePath,n.entries.slice())}let i=this.backoffMs.length+1;for(let[n,o]of r){let s=`SessionStore.append() timed out after ${this.sendTimeoutMs}ms for ${n}`,a,u=1;for(;u<=i;u++)try{await Td(this.send(n,o),this.sendTimeoutMs,s),a=void 0;break}catch(l){if(a=Gx(l),a.message===s)break;let c=this.backoffMs[u-1];if(c===void 0)break;await jA(c)}if(a){Cr(`[TranscriptMirrorBatcher] flush failed for ${n} after ${u} attempt(s): ${a}`,{level:"error"});try{this.onError?.(n,a)}catch(l){Cr(`[TranscriptMirrorBatcher] onError callback threw: ${l}`,{level:"error"})}}}}},XIe=kg(wA(),1),UR=kg(wA(),1),hEe=F7(q7);W7=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;LR=200;gEe=Buffer.from('{"type":"attribution-snapshot"'),yEe=Buffer.from('{"type":"system"'),H7=10,vEe=Buffer.from([H7]);eQ="user:inference",mD="user:profile",tQ="org:create_api_key",rQ=[tQ,mD],nQ=[mD,eQ,"user:sessions:claude_code","user:mcp_servers","user:file_upload"],KEe=Q7([...rQ,...nQ]),qR={BASE_API_URL:"https://api.anthropic.com",CONSOLE_AUTHORIZE_URL:"https://platform.claude.com/oauth/authorize",CLAUDE_AI_AUTHORIZE_URL:"https://claude.com/cai/oauth/authorize",CLAUDE_AI_ORIGIN:"https://claude.ai",TOKEN_URL:"https://platform.claude.com/v1/oauth/token",API_KEY_URL:"https://api.anthropic.com/api/oauth/claude_cli/create_api_key",ROLES_URL:"https://api.anthropic.com/api/oauth/claude_cli/roles",CONSOLE_SUCCESS_URL:"https://platform.claude.com/buy_credits?returnUrl=/oauth/code/success%3Fapp%3Dclaude-code",CLAUDEAI_SUCCESS_URL:"https://platform.claude.com/oauth/code/success?app=claude-code",MANUAL_REDIRECT_URL:"https://platform.claude.com/oauth/code/callback",CLIENT_ID:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",OAUTH_FILE_SUFFIX:"",MCP_PROXY_URL:"https://mcp-proxy.anthropic.com",MCP_PROXY_PATH:"/v1/mcp/{server_id}"},iQ=void 0;sQ=["https://beacon.claude-ai.staging.ant.dev","https://claude.fedstart.com","https://claude-staging.fedstart.com"];uQ="-credentials";(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw Error()}t.assertNever=r,t.arrayToEnum=n=>{let o={};for(let s of n)o[s]=s;return o},t.getValidEnumValues=n=>{let o=t.objectKeys(n).filter(a=>typeof n[n[a]]!="number"),s={};for(let a of o)s[a]=n[a];return t.objectValues(s)},t.objectValues=n=>t.objectKeys(n).map(function(o){return n[o]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&o.push(s);return o},t.find=(n,o)=>{for(let s of n)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,o=" | "){return n.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=i,t.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o})(_t||(_t={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(FR||(FR={}));fe=_t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Vo=t=>{switch(typeof t){case"undefined":return fe.undefined;case"string":return fe.string;case"number":return Number.isNaN(t)?fe.nan:fe.number;case"boolean":return fe.boolean;case"function":return fe.function;case"bigint":return fe.bigint;case"symbol":return fe.symbol;case"object":return Array.isArray(t)?fe.array:t===null?fe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?fe.promise:typeof Map<"u"&&t instanceof Map?fe.map:typeof Set<"u"&&t instanceof Set?fe.set:typeof Date<"u"&&t instanceof Date?fe.date:fe.object;default:return fe.unknown}},te=_t.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"]),Hn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},i={_errors:[]},n=o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)i._errors.push(r(s));else{let a=i,u=0;for(;u<s.path.length;){let l=s.path[u];u!==s.path.length-1?a[l]=a[l]||{_errors:[]}:(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))),a=a[l],u++}}};return n(this),i}static assert(e){if(!(e instanceof t))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_t.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let n of this.issues)if(n.path.length>0){let o=n.path[0];r[o]=r[o]||[],r[o].push(e(n))}else i.push(e(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};Hn.create=t=>new Hn(t);dQ=(t,e)=>{let r;switch(t.code){case te.invalid_type:t.received===fe.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case te.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,_t.jsonStringifyReplacer)}`;break;case te.unrecognized_keys:r=`Unrecognized key(s) in object: ${_t.joinValues(t.keys,", ")}`;break;case te.invalid_union:r="Invalid input";break;case te.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${_t.joinValues(t.options)}`;break;case te.invalid_enum_value:r=`Invalid enum value. Expected ${_t.joinValues(t.options)}, received '${t.received}'`;break;case te.invalid_arguments:r="Invalid function arguments";break;case te.invalid_return_type:r="Invalid function return type";break;case te.invalid_date:r="Invalid date";break;case te.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:_t.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case te.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case te.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case te.custom:r="Invalid input";break;case te.invalid_intersection_types:r="Intersection results could not be merged";break;case te.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case te.not_finite:r="Number must be finite";break;default:r=e.defaultError,_t.assertNever(t)}return{message:r}},Rd=dQ,fQ=Rd;kx=t=>{let{data:e,path:r,errorMaps:i,issueData:n}=t,o=[...r,...n.path||[]],s={...n,path:o};if(n.message!==void 0)return{...n,path:o,message:n.message};let a="",u=i.filter(l=>!!l).slice().reverse();for(let l of u)a=l(s,{data:e,defaultError:a}).message;return{...n,path:o,message:a}};tn=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let i=[];for(let n of r){if(n.status==="aborted")return ze;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let n of r){let o=await n.key,s=await n.value;i.push({key:o,value:s})}return t.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let n of r){let{key:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return ze;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(i[o.value]=s.value)}return{status:e.value,value:i}}},ze=Object.freeze({status:"aborted"}),Ed=t=>({status:"dirty",value:t}),pn=t=>({status:"valid",value:t}),VR=t=>t.status==="aborted",WR=t=>t.status==="dirty",Eu=t=>t.status==="valid",ag=t=>typeof Promise<"u"&&t instanceof Promise;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ye||(ye={}));Jn=class{constructor(e,r,i,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,this._key=n}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}},GR=(t,e)=>{if(Eu(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Hn(t.common.issues);return this._error=r,this._error}}};Ye=class{get description(){return this._def.description}_getType(e){return Vo(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Vo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tn,ctx:{common:e.parent.common,data:e.data,parsedType:Vo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(ag(r))throw Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){let i={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vo(e)},n=this._parseSync({data:e,path:i.path,parent:i});return GR(i,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vo(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return Eu(i)?{value:i.value}:{issues:r.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>Eu(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vo(e)},n=this._parse({data:e,path:i.path,parent:i}),o=await(ag(n)?n:Promise.resolve(n));return GR(i,o)}refine(e,r){let i=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,o)=>{let s=e(n),a=()=>o.addIssue({code:te.custom,...i(n)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,r){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(e){return new _i({schema:this,typeName:Ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return yi.create(this,this._def)}nullable(){return yo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ko.create(this)}promise(){return ea.create(this,this._def)}or(e){return zu.create([this,e],this._def)}and(e){return Nu.create(this,e,this._def)}transform(e){return new _i({...Le(this._def),schema:this,typeName:Ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Du({...Le(this._def),innerType:this,defaultValue:r,typeName:Ne.ZodDefault})}brand(){return new ug({typeName:Ne.ZodBranded,type:this,...Le(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Uu({...Le(this._def),innerType:this,catchValue:r,typeName:Ne.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return lg.create(this,e)}readonly(){return Mu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},pQ=/^c[^\s-]{8,}$/i,mQ=/^[0-9a-z]+$/,hQ=/^[0-9A-HJKMNP-TV-Z]{26}$/i,gQ=/^[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,yQ=/^[a-z0-9_-]{21}$/i,vQ=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,_Q=/^[-+]?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)?)??$/,bQ=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wQ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",SQ=/^(?:(?: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])$/,kQ=/^(?:(?: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])$/,xQ=/^(([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]))$/,$Q=/^(([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])$/,IQ=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,EQ=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hD="((\\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])))",PQ=new RegExp(`^${hD}$`);Pu=class t extends Ye{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==fe.string){let n=this._getOrReturnCtx(e);return ae(n,{code:te.invalid_type,expected:fe.string,received:n.parsedType}),ze}let r=new tn,i;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(i=this._getOrReturnCtx(e,i),ae(i,{code:te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="max")e.data.length>n.value&&(i=this._getOrReturnCtx(e,i),ae(i,{code:te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){let o=e.data.length>n.value,s=e.data.length<n.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?ae(i,{code:te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):s&&ae(i,{code:te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind==="email")bQ.test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"email",code:te.invalid_string,message:n.message}),r.dirty());else if(n.kind==="emoji")Xk||(Xk=new RegExp(wQ,"u")),Xk.test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"emoji",code:te.invalid_string,message:n.message}),r.dirty());else if(n.kind==="uuid")gQ.test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"uuid",code:te.invalid_string,message:n.message}),r.dirty());else if(n.kind==="nanoid")yQ.test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"nanoid",code:te.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid")pQ.test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"cuid",code:te.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid2")mQ.test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"cuid2",code:te.invalid_string,message:n.message}),r.dirty());else if(n.kind==="ulid")hQ.test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"ulid",code:te.invalid_string,message:n.message}),r.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ae(i,{validation:"url",code:te.invalid_string,message:n.message}),r.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,!n.regex.test(e.data)&&(i=this._getOrReturnCtx(e,i),ae(i,{validation:"regex",code:te.invalid_string,message:n.message}),r.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(i=this._getOrReturnCtx(e,i),ae(i,{code:te.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(i=this._getOrReturnCtx(e,i),ae(i,{code:te.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(i=this._getOrReturnCtx(e,i),ae(i,{code:te.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind==="datetime"?OQ(n).test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{code:te.invalid_string,validation:"datetime",message:n.message}),r.dirty()):n.kind==="date"?PQ.test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{code:te.invalid_string,validation:"date",message:n.message}),r.dirty()):n.kind==="time"?TQ(n).test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{code:te.invalid_string,validation:"time",message:n.message}),r.dirty()):n.kind==="duration"?_Q.test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"duration",code:te.invalid_string,message:n.message}),r.dirty()):n.kind==="ip"?zQ(e.data,n.version)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"ip",code:te.invalid_string,message:n.message}),r.dirty()):n.kind==="jwt"?NQ(e.data,n.alg)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"jwt",code:te.invalid_string,message:n.message}),r.dirty()):n.kind==="cidr"?jQ(e.data,n.version)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"cidr",code:te.invalid_string,message:n.message}),r.dirty()):n.kind==="base64"?IQ.test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"base64",code:te.invalid_string,message:n.message}),r.dirty()):n.kind==="base64url"?EQ.test(e.data)||(i=this._getOrReturnCtx(e,i),ae(i,{validation:"base64url",code:te.invalid_string,message:n.message}),r.dirty()):_t.assertNever(n);return{status:r.value,value:e.data}}_regex(e,r,i){return this.refinement(n=>e.test(n),{validation:r,code:te.invalid_string,...ye.errToObj(i)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ye.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ye.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ye.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ye.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ye.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ye.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ye.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ye.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ye.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ye.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ye.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ye.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ye.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ye.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ye.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ye.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...ye.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...ye.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...ye.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...ye.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...ye.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...ye.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...ye.errToObj(r)})}nonempty(e){return this.min(1,ye.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Pu.create=t=>new Pu({checks:[],typeName:Ne.ZodString,coerce:t?.coerce??!1,...Le(t)});Ad=class t extends Ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==fe.number){let n=this._getOrReturnCtx(e);return ae(n,{code:te.invalid_type,expected:fe.number,received:n.parsedType}),ze}let r,i=new tn;for(let n of this._def.checks)n.kind==="int"?_t.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ae(r,{code:te.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="multipleOf"?CQ(e.data,n.value)!==0&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ae(r,{code:te.not_finite,message:n.message}),i.dirty()):_t.assertNever(n);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,ye.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ye.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ye.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ye.toString(r))}setLimit(e,r,i,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:ye.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ye.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ye.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ye.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:ye.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ye.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ye.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_t.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Ad.create=t=>new Ad({checks:[],typeName:Ne.ZodNumber,coerce:t?.coerce||!1,...Le(t)});Dd=class t extends Ye{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==fe.bigint)return this._getInvalidInput(e);let r,i=new tn;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ae(r,{code:te.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):_t.assertNever(n);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:fe.bigint,received:r.parsedType}),ze}gte(e,r){return this.setLimit("min",e,!0,ye.toString(r))}gt(e,r){return this.setLimit("min",e,!1,ye.toString(r))}lte(e,r){return this.setLimit("max",e,!0,ye.toString(r))}lt(e,r){return this.setLimit("max",e,!1,ye.toString(r))}setLimit(e,r,i,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:ye.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ye.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ye.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ye.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ye.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:ye.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Dd.create=t=>new Dd({checks:[],typeName:Ne.ZodBigInt,coerce:t?.coerce??!1,...Le(t)});Ud=class extends Ye{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==fe.boolean){let r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:fe.boolean,received:r.parsedType}),ze}return pn(e.data)}};Ud.create=t=>new Ud({typeName:Ne.ZodBoolean,coerce:t?.coerce||!1,...Le(t)});Md=class t extends Ye{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==fe.date){let n=this._getOrReturnCtx(e);return ae(n,{code:te.invalid_type,expected:fe.date,received:n.parsedType}),ze}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return ae(n,{code:te.invalid_date}),ze}let r=new tn,i;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(i=this._getOrReturnCtx(e,i),ae(i,{code:te.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(i=this._getOrReturnCtx(e,i),ae(i,{code:te.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):_t.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:ye.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:ye.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Md.create=t=>new Md({checks:[],coerce:t?.coerce||!1,typeName:Ne.ZodDate,...Le(t)});Zd=class extends Ye{_parse(e){if(this._getType(e)!==fe.symbol){let r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:fe.symbol,received:r.parsedType}),ze}return pn(e.data)}};Zd.create=t=>new Zd({typeName:Ne.ZodSymbol,...Le(t)});Tu=class extends Ye{_parse(e){if(this._getType(e)!==fe.undefined){let r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:fe.undefined,received:r.parsedType}),ze}return pn(e.data)}};Tu.create=t=>new Tu({typeName:Ne.ZodUndefined,...Le(t)});Ou=class extends Ye{_parse(e){if(this._getType(e)!==fe.null){let r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:fe.null,received:r.parsedType}),ze}return pn(e.data)}};Ou.create=t=>new Ou({typeName:Ne.ZodNull,...Le(t)});Ld=class extends Ye{constructor(){super(...arguments),this._any=!0}_parse(e){return pn(e.data)}};Ld.create=t=>new Ld({typeName:Ne.ZodAny,...Le(t)});Go=class extends Ye{constructor(){super(...arguments),this._unknown=!0}_parse(e){return pn(e.data)}};Go.create=t=>new Go({typeName:Ne.ZodUnknown,...Le(t)});qi=class extends Ye{_parse(e){let r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:fe.never,received:r.parsedType}),ze}};qi.create=t=>new qi({typeName:Ne.ZodNever,...Le(t)});qd=class extends Ye{_parse(e){if(this._getType(e)!==fe.undefined){let r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:fe.void,received:r.parsedType}),ze}return pn(e.data)}};qd.create=t=>new qd({typeName:Ne.ZodVoid,...Le(t)});Ko=class t extends Ye{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),n=this._def;if(r.parsedType!==fe.array)return ae(r,{code:te.invalid_type,expected:fe.array,received:r.parsedType}),ze;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,a=r.data.length<n.exactLength.value;(s||a)&&(ae(r,{code:s?te.too_big:te.too_small,minimum:a?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(ae(r,{code:te.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(ae(r,{code:te.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>n.type._parseAsync(new Jn(r,s,r.path,a)))).then(s=>tn.mergeArray(i,s));let o=[...r.data].map((s,a)=>n.type._parseSync(new Jn(r,s,r.path,a)));return tn.mergeArray(i,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:ye.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:ye.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:ye.toString(r)}})}nonempty(e){return this.min(1,e)}};Ko.create=(t,e)=>new Ko({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ne.ZodArray,...Le(e)});jn=class t extends Ye{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=_t.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==fe.object){let u=this._getOrReturnCtx(e);return ae(u,{code:te.invalid_type,expected:fe.object,received:u.parsedType}),ze}let{status:r,ctx:i}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof qi&&this._def.unknownKeys==="strip"))for(let u in i.data)o.includes(u)||s.push(u);let a=[];for(let u of o){let l=n[u],c=i.data[u];a.push({key:{status:"valid",value:u},value:l._parse(new Jn(i,c,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof qi){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)a.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")s.length>0&&(ae(i,{code:te.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let c=i.data[l];a.push({key:{status:"valid",value:l},value:u._parse(new Jn(i,c,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of a){let c=await l.key,d=await l.value;u.push({key:c,value:d,alwaysSet:l.alwaysSet})}return u}).then(u=>tn.mergeObjectSync(r,u)):tn.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return ye.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,i)=>{let n=this._def.errorMap?.(r,i).message??i.defaultError;return r.code==="unrecognized_keys"?{message:ye.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ne.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let i of _t.objectKeys(e))e[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let i of _t.objectKeys(this.shape))e[i]||(r[i]=this.shape[i]);return new t({...this._def,shape:()=>r})}deepPartial(){return vu(this)}partial(e){let r={};for(let i of _t.objectKeys(this.shape)){let n=this.shape[i];e&&!e[i]?r[i]=n:r[i]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let i of _t.objectKeys(this.shape))if(e&&!e[i])r[i]=this.shape[i];else{let n=this.shape[i];for(;n instanceof yi;)n=n._def.innerType;r[i]=n}return new t({...this._def,shape:()=>r})}keyof(){return yD(_t.objectKeys(this.shape))}};jn.create=(t,e)=>new jn({shape:()=>t,unknownKeys:"strip",catchall:qi.create(),typeName:Ne.ZodObject,...Le(e)});jn.strictCreate=(t,e)=>new jn({shape:()=>t,unknownKeys:"strict",catchall:qi.create(),typeName:Ne.ZodObject,...Le(e)});jn.lazycreate=(t,e)=>new jn({shape:t,unknownKeys:"strip",catchall:qi.create(),typeName:Ne.ZodObject,...Le(e)});zu=class extends Ye{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function n(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(a=>new Hn(a.ctx.common.issues));return ae(r,{code:te.invalid_union,unionErrors:s}),ze}if(r.common.async)return Promise.all(i.map(async o=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let o,s=[];for(let u of i){let l={...r,common:{...r.common,issues:[]},parent:null},c=u._parseSync({data:r.data,path:r.path,parent:l});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=s.map(u=>new Hn(u));return ae(r,{code:te.invalid_union,unionErrors:a}),ze}}get options(){return this._def.options}};zu.create=(t,e)=>new zu({options:t,typeName:Ne.ZodUnion,...Le(e)});po=t=>t instanceof ju?po(t.schema):t instanceof _i?po(t.innerType()):t instanceof Cu?[t.value]:t instanceof Ru?t.options:t instanceof Au?_t.objectValues(t.enum):t instanceof Du?po(t._def.innerType):t instanceof Tu?[void 0]:t instanceof Ou?[null]:t instanceof yi?[void 0,...po(t.unwrap())]:t instanceof yo?[null,...po(t.unwrap())]:t instanceof ug||t instanceof Mu?po(t.unwrap()):t instanceof Uu?po(t._def.innerType):[],xx=class t extends Ye{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==fe.object)return ae(r,{code:te.invalid_type,expected:fe.object,received:r.parsedType}),ze;let i=this.discriminator,n=r.data[i],o=this.optionsMap.get(n);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(ae(r,{code:te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),ze)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,i){let n=new Map;for(let o of r){let s=po(o.shape[e]);if(!s.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of s){if(n.has(a))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,o)}}return new t({typeName:Ne.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,...Le(i)})}};Nu=class extends Ye{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=(o,s)=>{if(VR(o)||VR(s))return ze;let a=$x(o.value,s.value);return a.valid?((WR(o)||WR(s))&&r.dirty(),{status:r.value,value:a.data}):(ae(i,{code:te.invalid_intersection_types}),ze)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,s])=>n(o,s)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Nu.create=(t,e,r)=>new Nu({left:t,right:e,typeName:Ne.ZodIntersection,...Le(r)});go=class t extends Ye{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==fe.array)return ae(i,{code:te.invalid_type,expected:fe.array,received:i.parsedType}),ze;if(i.data.length<this._def.items.length)return ae(i,{code:te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ze;!this._def.rest&&i.data.length>this._def.items.length&&(ae(i,{code:te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let n=[...i.data].map((o,s)=>{let a=this._def.items[s]||this._def.rest;return a?a._parse(new Jn(i,o,i.path,s)):null}).filter(o=>!!o);return i.common.async?Promise.all(n).then(o=>tn.mergeArray(r,o)):tn.mergeArray(r,n)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};go.create=(t,e)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new go({items:t,typeName:Ne.ZodTuple,rest:null,...Le(e)})};Ix=class t extends Ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==fe.object)return ae(i,{code:te.invalid_type,expected:fe.object,received:i.parsedType}),ze;let n=[],o=this._def.keyType,s=this._def.valueType;for(let a in i.data)n.push({key:o._parse(new Jn(i,a,i.path,a)),value:s._parse(new Jn(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?tn.mergeObjectAsync(r,n):tn.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof Ye?new t({keyType:e,valueType:r,typeName:Ne.ZodRecord,...Le(i)}):new t({keyType:Pu.create(),valueType:e,typeName:Ne.ZodRecord,...Le(r)})}},Fd=class extends Ye{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==fe.map)return ae(i,{code:te.invalid_type,expected:fe.map,received:i.parsedType}),ze;let n=this._def.keyType,o=this._def.valueType,s=[...i.data.entries()].map(([a,u],l)=>({key:n._parse(new Jn(i,a,i.path,[l,"key"])),value:o._parse(new Jn(i,u,i.path,[l,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of s){let l=await u.key,c=await u.value;if(l.status==="aborted"||c.status==="aborted")return ze;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),a.set(l.value,c.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let u of s){let{key:l,value:c}=u;if(l.status==="aborted"||c.status==="aborted")return ze;(l.status==="dirty"||c.status==="dirty")&&r.dirty(),a.set(l.value,c.value)}return{status:r.value,value:a}}}};Fd.create=(t,e,r)=>new Fd({valueType:e,keyType:t,typeName:Ne.ZodMap,...Le(r)});Vd=class t extends Ye{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==fe.set)return ae(i,{code:te.invalid_type,expected:fe.set,received:i.parsedType}),ze;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(ae(i,{code:te.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(ae(i,{code:te.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function s(u){let l=new Set;for(let c of u){if(c.status==="aborted")return ze;c.status==="dirty"&&r.dirty(),l.add(c.value)}return{status:r.value,value:l}}let a=[...i.data.values()].map((u,l)=>o._parse(new Jn(i,u,i.path,l)));return i.common.async?Promise.all(a).then(u=>s(u)):s(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:ye.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:ye.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Vd.create=(t,e)=>new Vd({valueType:t,minSize:null,maxSize:null,typeName:Ne.ZodSet,...Le(e)});Ex=class t extends Ye{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==fe.function)return ae(r,{code:te.invalid_type,expected:fe.function,received:r.parsedType}),ze;function i(a,u){return kx({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Sx(),Rd].filter(l=>!!l),issueData:{code:te.invalid_arguments,argumentsError:u}})}function n(a,u){return kx({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Sx(),Rd].filter(l=>!!l),issueData:{code:te.invalid_return_type,returnTypeError:u}})}let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof ea){let a=this;return pn(async function(...u){let l=new Hn([]),c=await a._def.args.parseAsync(u,o).catch(p=>{throw l.addIssue(i(u,p)),l}),d=await Reflect.apply(s,this,c);return await a._def.returns._def.type.parseAsync(d,o).catch(p=>{throw l.addIssue(n(d,p)),l})})}else{let a=this;return pn(function(...u){let l=a._def.args.safeParse(u,o);if(!l.success)throw new Hn([i(u,l.error)]);let c=Reflect.apply(s,this,l.data),d=a._def.returns.safeParse(c,o);if(!d.success)throw new Hn([n(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:go.create(e).rest(Go.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,i){return new t({args:e||go.create([]).rest(Go.create()),returns:r||Go.create(),typeName:Ne.ZodFunction,...Le(i)})}},ju=class extends Ye{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ju.create=(t,e)=>new ju({getter:t,typeName:Ne.ZodLazy,...Le(e)});Cu=class extends Ye{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ae(r,{received:r.data,code:te.invalid_literal,expected:this._def.value}),ze}return{status:"valid",value:e.data}}get value(){return this._def.value}};Cu.create=(t,e)=>new Cu({value:t,typeName:Ne.ZodLiteral,...Le(e)});Ru=class t extends Ye{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return ae(r,{expected:_t.joinValues(i),received:r.parsedType,code:te.invalid_type}),ze}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),i=this._def.values;return ae(r,{received:r.data,code:te.invalid_enum_value,options:i}),ze}return pn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(i=>!e.includes(i)),{...this._def,...r})}};Ru.create=yD;Au=class extends Ye{_parse(e){let r=_t.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==fe.string&&i.parsedType!==fe.number){let n=_t.objectValues(r);return ae(i,{expected:_t.joinValues(n),received:i.parsedType,code:te.invalid_type}),ze}if(this._cache||(this._cache=new Set(_t.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=_t.objectValues(r);return ae(i,{received:i.data,code:te.invalid_enum_value,options:n}),ze}return pn(e.data)}get enum(){return this._def.values}};Au.create=(t,e)=>new Au({values:t,typeName:Ne.ZodNativeEnum,...Le(e)});ea=class extends Ye{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==fe.promise&&r.common.async===!1)return ae(r,{code:te.invalid_type,expected:fe.promise,received:r.parsedType}),ze;let i=r.parsedType===fe.promise?r.data:Promise.resolve(r.data);return pn(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ea.create=(t,e)=>new ea({type:t,typeName:Ne.ZodPromise,...Le(e)});_i=class extends Ye{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:s=>{ae(i,s),s.fatal?r.abort():r.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(i.data,o);if(i.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return ze;let u=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return u.status==="aborted"?ze:u.status==="dirty"||r.value==="dirty"?Ed(u.value):u});{if(r.value==="aborted")return ze;let a=this._def.schema._parseSync({data:s,path:i.path,parent:i});return a.status==="aborted"?ze:a.status==="dirty"||r.value==="dirty"?Ed(a.value):a}}if(n.type==="refinement"){let s=a=>{let u=n.refinement(a,o);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?ze:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?ze:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(n.type==="transform")if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Eu(s))return ze;let a=n.transform(s.value,o);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>Eu(s)?Promise.resolve(n.transform(s.value,o)).then(a=>({status:r.value,value:a})):ze);_t.assertNever(n)}};_i.create=(t,e,r)=>new _i({schema:t,typeName:Ne.ZodEffects,effect:e,...Le(r)});_i.createWithPreprocess=(t,e,r)=>new _i({schema:e,effect:{type:"preprocess",transform:t},typeName:Ne.ZodEffects,...Le(r)});yi=class extends Ye{_parse(e){return this._getType(e)===fe.undefined?pn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yi.create=(t,e)=>new yi({innerType:t,typeName:Ne.ZodOptional,...Le(e)});yo=class extends Ye{_parse(e){return this._getType(e)===fe.null?pn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yo.create=(t,e)=>new yo({innerType:t,typeName:Ne.ZodNullable,...Le(e)});Du=class extends Ye{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===fe.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Du.create=(t,e)=>new Du({innerType:t,typeName:Ne.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Le(e)});Uu=class extends Ye{_parse(e){let{ctx:r}=this._processInputParams(e),i={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return ag(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Hn(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Hn(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};Uu.create=(t,e)=>new Uu({innerType:t,typeName:Ne.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Le(e)});Wd=class extends Ye{_parse(e){if(this._getType(e)!==fe.nan){let r=this._getOrReturnCtx(e);return ae(r,{code:te.invalid_type,expected:fe.nan,received:r.parsedType}),ze}return{status:"valid",value:e.data}}};Wd.create=t=>new Wd({typeName:Ne.ZodNaN,...Le(t)});ug=class extends Ye{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}},lg=class t extends Ye{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?ze:n.status==="dirty"?(r.dirty(),Ed(n.value)):this._def.out._parseAsync({data:n.value,path:i.path,parent:i})})();{let n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?ze:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(e,r){return new t({in:e,out:r,typeName:Ne.ZodPipeline})}},Mu=class extends Ye{_parse(e){let r=this._def.innerType._parse(e),i=n=>(Eu(n)&&(n.value=Object.freeze(n.value)),n);return ag(r)?r.then(n=>i(n)):i(r)}unwrap(){return this._def.innerType}};Mu.create=(t,e)=>new Mu({innerType:t,typeName:Ne.ZodReadonly,...Le(e)});HEe={object:jn.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ne||(Ne={}));JEe=Pu.create,YEe=Ad.create,QEe=Wd.create,XEe=Dd.create,ePe=Ud.create,tPe=Md.create,rPe=Zd.create,nPe=Tu.create,iPe=Ou.create,oPe=Ld.create,sPe=Go.create,aPe=qi.create,uPe=qd.create,lPe=Ko.create,cPe=jn.create,dPe=jn.strictCreate,fPe=zu.create,pPe=xx.create,mPe=Nu.create,hPe=go.create,gPe=Ix.create,yPe=Fd.create,vPe=Vd.create,_Pe=Ex.create,bPe=ju.create,wPe=Cu.create,SPe=Ru.create,kPe=Au.create,xPe=ea.create,$Pe=_i.create,IPe=yi.create,EPe=yo.create,PPe=_i.createWithPreprocess,TPe=lg.create,vD={};na(vD,{version:()=>TU,util:()=>ut,treeifyError:()=>OD,toJSONSchema:()=>S4,toDotPath:()=>zD,safeParseAsync:()=>a$,safeParse:()=>o$,registry:()=>S$,regexes:()=>u$,prettifyError:()=>ND,parseAsync:()=>pg,parse:()=>fg,locales:()=>w$,isValidJWT:()=>XU,isValidBase64URL:()=>JU,isValidBase64:()=>f$,globalRegistry:()=>Ks,globalConfig:()=>cg,function:()=>w4,formatError:()=>t$,flattenError:()=>e$,config:()=>rn,clone:()=>Si,_xid:()=>C$,_void:()=>s4,_uuidv7:()=>E$,_uuidv6:()=>I$,_uuidv4:()=>$$,_uuid:()=>x$,_url:()=>P$,_uppercase:()=>B$,_unknown:()=>yg,_union:()=>Ree,_undefined:()=>r4,_ulid:()=>j$,_uint64:()=>e4,_uint32:()=>KM,_tuple:()=>h4,_trim:()=>X$,_transform:()=>Vee,_toUpperCase:()=>tI,_toLowerCase:()=>eI,_templateLiteral:()=>Xee,_symbol:()=>t4,_success:()=>Hee,_stringbool:()=>_4,_stringFormat:()=>b4,_string:()=>RM,_startsWith:()=>H$,_size:()=>V$,_set:()=>Zee,_safeParseAsync:()=>s$,_safeParse:()=>i$,_regex:()=>W$,_refine:()=>v4,_record:()=>Uee,_readonly:()=>Qee,_property:()=>m4,_promise:()=>tte,_positive:()=>c4,_pipe:()=>Yee,_parseAsync:()=>n$,_parse:()=>r$,_overwrite:()=>sa,_optional:()=>Wee,_number:()=>qM,_nullable:()=>Gee,_null:()=>n4,_normalize:()=>Q$,_nonpositive:()=>f4,_nonoptional:()=>Kee,_nonnegative:()=>p4,_never:()=>o4,_negative:()=>d4,_nativeEnum:()=>qee,_nanoid:()=>O$,_nan:()=>l4,_multipleOf:()=>Hd,_minSize:()=>Jd,_minLength:()=>Lu,_min:()=>On,_mime:()=>Y$,_maxSize:()=>Ug,_maxLength:()=>Mg,_max:()=>vi,_map:()=>Mee,_lte:()=>vi,_lt:()=>ta,_lowercase:()=>G$,_literal:()=>Fee,_length:()=>Zg,_lazy:()=>ete,_ksuid:()=>R$,_jwt:()=>F$,_isoTime:()=>ZM,_isoDuration:()=>LM,_isoDateTime:()=>UM,_isoDate:()=>MM,_ipv6:()=>D$,_ipv4:()=>A$,_intersection:()=>Dee,_int64:()=>XM,_int32:()=>BM,_int:()=>VM,_includes:()=>K$,_guid:()=>gg,_gte:()=>On,_gt:()=>ra,_float64:()=>GM,_float32:()=>WM,_file:()=>g4,_enum:()=>Lee,_endsWith:()=>J$,_emoji:()=>T$,_email:()=>k$,_e164:()=>q$,_discriminatedUnion:()=>Aee,_default:()=>Bee,_date:()=>a4,_custom:()=>y4,_cuid2:()=>N$,_cuid:()=>z$,_coercedString:()=>AM,_coercedNumber:()=>FM,_coercedDate:()=>u4,_coercedBoolean:()=>JM,_coercedBigint:()=>QM,_cidrv6:()=>M$,_cidrv4:()=>U$,_catch:()=>Jee,_boolean:()=>HM,_bigint:()=>YM,_base64url:()=>L$,_base64:()=>Z$,_array:()=>rI,_any:()=>i4,TimePrecision:()=>DM,NEVER:()=>_D,JSONSchemaGenerator:()=>Yd,JSONSchema:()=>rte,Doc:()=>mg,$output:()=>jM,$input:()=>CM,$constructor:()=>A,$brand:()=>bD,$ZodXID:()=>MU,$ZodVoid:()=>lM,$ZodUnknown:()=>hg,$ZodUnion:()=>v$,$ZodUndefined:()=>oM,$ZodUUID:()=>zU,$ZodURL:()=>jU,$ZodULID:()=>UU,$ZodType:()=>Me,$ZodTuple:()=>Dg,$ZodTransform:()=>_$,$ZodTemplateLiteral:()=>PM,$ZodSymbol:()=>iM,$ZodSuccess:()=>xM,$ZodStringFormat:()=>Lt,$ZodString:()=>tf,$ZodSet:()=>hM,$ZodRegistry:()=>Kd,$ZodRecord:()=>pM,$ZodRealError:()=>Xd,$ZodReadonly:()=>EM,$ZodPromise:()=>TM,$ZodPrefault:()=>SM,$ZodPipe:()=>b$,$ZodOptional:()=>_M,$ZodObject:()=>y$,$ZodNumberFormat:()=>rM,$ZodNumber:()=>p$,$ZodNullable:()=>bM,$ZodNull:()=>sM,$ZodNonOptional:()=>kM,$ZodNever:()=>uM,$ZodNanoID:()=>RU,$ZodNaN:()=>IM,$ZodMap:()=>mM,$ZodLiteral:()=>yM,$ZodLazy:()=>OM,$ZodKSUID:()=>ZU,$ZodJWT:()=>eM,$ZodIntersection:()=>fM,$ZodISOTime:()=>FU,$ZodISODuration:()=>VU,$ZodISODateTime:()=>LU,$ZodISODate:()=>qU,$ZodIPv6:()=>GU,$ZodIPv4:()=>WU,$ZodGUID:()=>OU,$ZodFunction:()=>vg,$ZodFile:()=>vM,$ZodError:()=>Xx,$ZodEnum:()=>gM,$ZodEmoji:()=>CU,$ZodEmail:()=>NU,$ZodE164:()=>QU,$ZodDiscriminatedUnion:()=>dM,$ZodDefault:()=>wM,$ZodDate:()=>cM,$ZodCustomStringFormat:()=>tM,$ZodCustom:()=>zM,$ZodCheckUpperCase:()=>SU,$ZodCheckStringFormat:()=>ef,$ZodCheckStartsWith:()=>xU,$ZodCheckSizeEquals:()=>gU,$ZodCheckRegex:()=>bU,$ZodCheckProperty:()=>IU,$ZodCheckOverwrite:()=>PU,$ZodCheckNumberFormat:()=>fU,$ZodCheckMultipleOf:()=>dU,$ZodCheckMinSize:()=>hU,$ZodCheckMinLength:()=>vU,$ZodCheckMimeType:()=>EU,$ZodCheckMaxSize:()=>mU,$ZodCheckMaxLength:()=>yU,$ZodCheckLowerCase:()=>wU,$ZodCheckLessThan:()=>c$,$ZodCheckLengthEquals:()=>_U,$ZodCheckIncludes:()=>kU,$ZodCheckGreaterThan:()=>d$,$ZodCheckEndsWith:()=>$U,$ZodCheckBigIntFormat:()=>pU,$ZodCheck:()=>nr,$ZodCatch:()=>$M,$ZodCUID2:()=>DU,$ZodCUID:()=>AU,$ZodCIDRv6:()=>KU,$ZodCIDRv4:()=>BU,$ZodBoolean:()=>m$,$ZodBigIntFormat:()=>nM,$ZodBigInt:()=>h$,$ZodBase64URL:()=>YU,$ZodBase64:()=>HU,$ZodAsyncError:()=>Ho,$ZodArray:()=>g$,$ZodAny:()=>aM});_D=Object.freeze({status:"aborted"});bD=Symbol("zod_brand"),Ho=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},cg={};ut={};na(ut,{unwrapMessage:()=>Pd,stringifyPrimitive:()=>Ve,required:()=>YQ,randomString:()=>qQ,propertyKeyTypes:()=>dg,promiseAllObject:()=>LQ,primitiveTypes:()=>xD,prefixIssues:()=>Kn,pick:()=>GQ,partial:()=>JQ,optionalKeys:()=>$D,omit:()=>BQ,numKeys:()=>FQ,nullish:()=>ia,normalizeParams:()=>re,merge:()=>HQ,jsonStringifyReplacer:()=>wD,joinValues:()=>ie,issue:()=>PD,isPlainObject:()=>Bd,isObject:()=>Gd,getSizableOrigin:()=>Rg,getParsedType:()=>VQ,getLengthableOrigin:()=>Ag,getEnumValues:()=>Jx,getElementAtPath:()=>ZQ,floatSafeRemainder:()=>SD,finalizeIssue:()=>bi,extend:()=>KQ,escapeRegex:()=>oa,esc:()=>_u,defineLazy:()=>$t,createTransparentProxy:()=>WQ,clone:()=>Si,cleanRegex:()=>Cg,cleanEnum:()=>QQ,captureStackTrace:()=>Qx,cached:()=>jg,assignProp:()=>Yx,assertNotEqual:()=>AQ,assertNever:()=>UQ,assertIs:()=>DQ,assertEqual:()=>RQ,assert:()=>MQ,allowsEval:()=>kD,aborted:()=>xu,NUMBER_FORMAT_RANGES:()=>ID,Class:()=>Px,BIGINT_FORMAT_RANGES:()=>ED});Qx=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};kD=jg(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch{return!1}});VQ=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw Error(`Unknown data type: ${e}`)}},dg=new Set(["string","number","symbol"]),xD=new Set(["string","number","bigint","boolean","symbol","undefined"]);ID={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ED={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};Px=class{constructor(...e){}},TD=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,wD,2)},enumerable:!0})},Xx=A("$ZodError",TD),Xd=A("$ZodError",TD,{Parent:Error});r$=t=>(e,r,i,n)=>{let o=i?Object.assign(i,{async:!1}):{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ho;if(s.issues.length){let a=new(n?.Err??t)(s.issues.map(u=>bi(u,o,rn())));throw Qx(a,n?.callee),a}return s.value},fg=r$(Xd),n$=t=>async(e,r,i,n)=>{let o=i?Object.assign(i,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(n?.Err??t)(s.issues.map(u=>bi(u,o,rn())));throw Qx(a,n?.callee),a}return s.value},pg=n$(Xd),i$=t=>(e,r,i)=>{let n=i?{...i,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new Ho;return o.issues.length?{success:!1,error:new(t??Xx)(o.issues.map(s=>bi(s,n,rn())))}:{success:!0,data:o.value}},o$=i$(Xd),s$=t=>async(e,r,i)=>{let n=i?Object.assign(i,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>bi(s,n,rn())))}:{success:!0,data:o.value}},a$=s$(Xd),u$={};na(u$,{xid:()=>AD,uuid7:()=>rX,uuid6:()=>tX,uuid4:()=>eX,uuid:()=>Zu,uppercase:()=>lU,unicodeEmail:()=>oX,undefined:()=>aU,ulid:()=>RD,time:()=>XD,string:()=>tU,rfc5322Email:()=>iX,number:()=>iU,null:()=>sU,nanoid:()=>UD,lowercase:()=>uU,ksuid:()=>DD,ipv6:()=>VD,ipv4:()=>FD,integer:()=>nU,html5Email:()=>nX,hostname:()=>KD,guid:()=>ZD,extendedDuration:()=>XQ,emoji:()=>qD,email:()=>LD,e164:()=>HD,duration:()=>MD,domain:()=>uX,datetime:()=>eU,date:()=>YD,cuid2:()=>CD,cuid:()=>jD,cidrv6:()=>GD,cidrv4:()=>WD,browserEmail:()=>sX,boolean:()=>oU,bigint:()=>rU,base64url:()=>l$,base64:()=>BD,_emoji:()=>aX});jD=/^[cC][^\s-]{8,}$/,CD=/^[0-9a-z]+$/,RD=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,AD=/^[0-9a-vA-V]{20}$/,DD=/^[A-Za-z0-9]{27}$/,UD=/^[a-zA-Z0-9_-]{21}$/,MD=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,XQ=/^[-+]?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)?)??$/,ZD=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Zu=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,eX=Zu(4),tX=Zu(6),rX=Zu(7),LD=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,nX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,iX=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,oX=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,sX=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,aX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";FD=/^(?:(?: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])$/,VD=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,WD=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,GD=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,BD=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,l$=/^[A-Za-z0-9_-]*$/,KD=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,uX=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,HD=/^\+(?:[0-9]){6,14}[0-9]$/,JD="(?:(?:\\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])))",YD=new RegExp(`^${JD}$`);tU=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},rU=/^\d+n?$/,nU=/^\d+$/,iU=/^-?\d+(?:\.\d+)?/i,oU=/true|false/i,sU=/null/i,aU=/undefined/i,uU=/^[^A-Z]*$/,lU=/^[^a-z]*$/,nr=A("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),cU={number:"number",bigint:"bigint",object:"date"},c$=A("$ZodCheckLessThan",(t,e)=>{nr.init(t,e);let r=cU[typeof e.value];t._zod.onattach.push(i=>{let n=i._zod.bag,o=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value<=e.value:i.value<e.value)||i.issues.push({origin:r,code:"too_big",maximum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),d$=A("$ZodCheckGreaterThan",(t,e)=>{nr.init(t,e);let r=cU[typeof e.value];t._zod.onattach.push(i=>{let n=i._zod.bag,o=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:r,code:"too_small",minimum:e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),dU=A("$ZodCheckMultipleOf",(t,e)=>{nr.init(t,e),t._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):SD(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),fU=A("$ZodCheckNumberFormat",(t,e)=>{nr.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),i=r?"int":"number",[n,o]=ID[e.format];t._zod.onattach.push(s=>{let a=s._zod.bag;a.format=e.format,a.minimum=n,a.maximum=o,r&&(a.pattern=nU)}),t._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:i,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,continue:!e.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,continue:!e.abort});return}}a<n&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inst:t})}}),pU=A("$ZodCheckBigIntFormat",(t,e)=>{nr.init(t,e);let[r,i]=ED[e.format];t._zod.onattach.push(n=>{let o=n._zod.bag;o.format=e.format,o.minimum=r,o.maximum=i}),t._zod.check=n=>{let o=n.value;o<r&&n.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),o>i&&n.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inst:t})}}),mU=A("$ZodCheckMaxSize",(t,e)=>{nr.init(t,e),t._zod.when=r=>{let i=r.value;return!ia(i)&&i.size!==void 0},t._zod.onattach.push(r=>{let i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{let i=r.value;i.size<=e.maximum||r.issues.push({origin:Rg(i),code:"too_big",maximum:e.maximum,input:i,inst:t,continue:!e.abort})}}),hU=A("$ZodCheckMinSize",(t,e)=>{nr.init(t,e),t._zod.when=r=>{let i=r.value;return!ia(i)&&i.size!==void 0},t._zod.onattach.push(r=>{let i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{let i=r.value;i.size>=e.minimum||r.issues.push({origin:Rg(i),code:"too_small",minimum:e.minimum,input:i,inst:t,continue:!e.abort})}}),gU=A("$ZodCheckSizeEquals",(t,e)=>{nr.init(t,e),t._zod.when=r=>{let i=r.value;return!ia(i)&&i.size!==void 0},t._zod.onattach.push(r=>{let i=r._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=r=>{let i=r.value,n=i.size;if(n===e.size)return;let o=n>e.size;r.issues.push({origin:Rg(i),...o?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),yU=A("$ZodCheckMaxLength",(t,e)=>{nr.init(t,e),t._zod.when=r=>{let i=r.value;return!ia(i)&&i.length!==void 0},t._zod.onattach.push(r=>{let i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{let i=r.value;if(i.length<=e.maximum)return;let n=Ag(i);r.issues.push({origin:n,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),vU=A("$ZodCheckMinLength",(t,e)=>{nr.init(t,e),t._zod.when=r=>{let i=r.value;return!ia(i)&&i.length!==void 0},t._zod.onattach.push(r=>{let i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{let i=r.value;if(i.length>=e.minimum)return;let n=Ag(i);r.issues.push({origin:n,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),_U=A("$ZodCheckLengthEquals",(t,e)=>{nr.init(t,e),t._zod.when=r=>{let i=r.value;return!ia(i)&&i.length!==void 0},t._zod.onattach.push(r=>{let i=r._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=r=>{let i=r.value,n=i.length;if(n===e.length)return;let o=Ag(i),s=n>e.length;r.issues.push({origin:o,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),ef=A("$ZodCheckStringFormat",(t,e)=>{var r,i;nr.init(t,e),t._zod.onattach.push(n=>{let o=n._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(i=t._zod).check??(i.check=()=>{})}),bU=A("$ZodCheckRegex",(t,e)=>{ef.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),wU=A("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=uU),ef.init(t,e)}),SU=A("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=lU),ef.init(t,e)}),kU=A("$ZodCheckIncludes",(t,e)=>{nr.init(t,e);let r=oa(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=i,t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),xU=A("$ZodCheckStartsWith",(t,e)=>{nr.init(t,e);let r=new RegExp(`^${oa(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),$U=A("$ZodCheckEndsWith",(t,e)=>{nr.init(t,e);let r=new RegExp(`.*${oa(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(i=>{let n=i._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}});IU=A("$ZodCheckProperty",(t,e)=>{nr.init(t,e),t._zod.check=r=>{let i=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(i instanceof Promise)return i.then(n=>BR(n,r,e.property));BR(i,r,e.property)}}),EU=A("$ZodCheckMimeType",(t,e)=>{nr.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(i=>{i._zod.bag.mime=e.mime}),t._zod.check=i=>{r.has(i.value.type)||i.issues.push({code:"invalid_value",values:e.mime,input:i.value.type,inst:t})}}),PU=A("$ZodCheckOverwrite",(t,e)=>{nr.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}}),mg=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
179
- `).filter(o=>o),i=Math.min(...r.map(o=>o.length-o.trimStart().length)),n=r.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(let o of n)this.content.push(o)}compile(){let e=Function,r=this?.args,i=[...(this?.content??[""]).map(n=>` ${n}`)];return new e(...r,i.join(`
180
- `))}},TU={major:4,minor:0,patch:0},Me=A("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=TU;let i=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&i.unshift(t);for(let n of i)for(let o of n._zod.onattach)o(t);if(i.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=(o,s,a)=>{let u=xu(o),l;for(let c of s){if(c._zod.when){if(!c._zod.when(o))continue}else if(u)continue;let d=o.issues.length,p=c._zod.check(o);if(p instanceof Promise&&a?.async===!1)throw new Ho;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,o.issues.length!==d&&(u||(u=xu(o,d)))});else{if(o.issues.length===d)continue;u||(u=xu(o,d))}}return l?l.then(()=>o):o};t._zod.run=(o,s)=>{let a=t._zod.parse(o,s);if(a instanceof Promise){if(s.async===!1)throw new Ho;return a.then(u=>n(u,i,s))}return n(a,i,s)}}t["~standard"]={validate:n=>{try{let o=o$(t,n);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return a$(t,n).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),tf=A("$ZodString",(t,e)=>{Me.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??tU(t._zod.bag),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),Lt=A("$ZodStringFormat",(t,e)=>{ef.init(t,e),tf.init(t,e)}),OU=A("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=ZD),Lt.init(t,e)}),zU=A("$ZodUUID",(t,e)=>{if(e.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Zu(r))}else e.pattern??(e.pattern=Zu());Lt.init(t,e)}),NU=A("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=LD),Lt.init(t,e)}),jU=A("$ZodURL",(t,e)=>{Lt.init(t,e),t._zod.check=r=>{try{let i=r.value,n=new URL(i),o=n.href;e.hostname&&(e.hostname.lastIndex=0,!e.hostname.test(n.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:KD.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,!e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!i.endsWith("/")&&o.endsWith("/")?r.value=o.slice(0,-1):r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),CU=A("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=qD()),Lt.init(t,e)}),RU=A("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=UD),Lt.init(t,e)}),AU=A("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=jD),Lt.init(t,e)}),DU=A("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=CD),Lt.init(t,e)}),UU=A("$ZodULID",(t,e)=>{e.pattern??(e.pattern=RD),Lt.init(t,e)}),MU=A("$ZodXID",(t,e)=>{e.pattern??(e.pattern=AD),Lt.init(t,e)}),ZU=A("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=DD),Lt.init(t,e)}),LU=A("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=eU(e)),Lt.init(t,e)}),qU=A("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=YD),Lt.init(t,e)}),FU=A("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=XD(e)),Lt.init(t,e)}),VU=A("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=MD),Lt.init(t,e)}),WU=A("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=FD),Lt.init(t,e),t._zod.onattach.push(r=>{let i=r._zod.bag;i.format="ipv4"})}),GU=A("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=VD),Lt.init(t,e),t._zod.onattach.push(r=>{let i=r._zod.bag;i.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),BU=A("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=WD),Lt.init(t,e)}),KU=A("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=GD),Lt.init(t,e),t._zod.check=r=>{let[i,n]=r.value.split("/");try{if(!n)throw Error();let o=Number(n);if(`${o}`!==n||o<0||o>128)throw Error();new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});HU=A("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=BD),Lt.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{f$(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});YU=A("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=l$),Lt.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{JU(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),QU=A("$ZodE164",(t,e)=>{e.pattern??(e.pattern=HD),Lt.init(t,e)});eM=A("$ZodJWT",(t,e)=>{Lt.init(t,e),t._zod.check=r=>{XU(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),tM=A("$ZodCustomStringFormat",(t,e)=>{Lt.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),p$=A("$ZodNumber",(t,e)=>{Me.init(t,e),t._zod.pattern=t._zod.bag.pattern??iU,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let o=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...o?{received:o}:{}}),r}}),rM=A("$ZodNumber",(t,e)=>{fU.init(t,e),p$.init(t,e)}),m$=A("$ZodBoolean",(t,e)=>{Me.init(t,e),t._zod.pattern=oU,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}}),h$=A("$ZodBigInt",(t,e)=>{Me.init(t,e),t._zod.pattern=rU,t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),nM=A("$ZodBigInt",(t,e)=>{pU.init(t,e),h$.init(t,e)}),iM=A("$ZodSymbol",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:t}),r}}),oM=A("$ZodUndefined",(t,e)=>{Me.init(t,e),t._zod.pattern=aU,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:t}),r}}),sM=A("$ZodNull",(t,e)=>{Me.init(t,e),t._zod.pattern=sU,t._zod.values=new Set([null]),t._zod.parse=(r,i)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}}),aM=A("$ZodAny",(t,e)=>{Me.init(t,e),t._zod.parse=r=>r}),hg=A("$ZodUnknown",(t,e)=>{Me.init(t,e),t._zod.parse=r=>r}),uM=A("$ZodNever",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),lM=A("$ZodVoid",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:t}),r}}),cM=A("$ZodDate",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,o=n instanceof Date;return o&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...o?{received:"Invalid Date"}:{},inst:t}),r}});g$=A("$ZodArray",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let o=[];for(let s=0;s<n.length;s++){let a=n[s],u=e.element._zod.run({value:a,issues:[]},i);u instanceof Promise?o.push(u.then(l=>KR(l,r,s))):KR(u,r,s)}return o.length?Promise.all(o).then(()=>r):r}});y$=A("$ZodObject",(t,e)=>{Me.init(t,e);let r=jg(()=>{let c=Object.keys(e.shape);for(let p of c)if(!(e.shape[p]instanceof Me))throw Error(`Invalid element at key "${p}": expected a Zod schema`);let d=$D(e.shape);return{shape:e.shape,keys:c,keySet:new Set(c),numKeys:c.length,optionalKeys:new Set(d)}});$t(t._zod,"propValues",()=>{let c=e.shape,d={};for(let p in c){let f=c[p]._zod;if(f.values){d[p]??(d[p]=new Set);for(let m of f.values)d[p].add(m)}}return d});let i=c=>{let d=new mg(["shape","payload","ctx"]),p=r.value,f=h=>{let y=_u(h);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};d.write("const input = payload.value;");let m=Object.create(null),g=0;for(let h of p.keys)m[h]=`key_${g++}`;d.write("const newResult = {}");for(let h of p.keys)if(p.optionalKeys.has(h)){let y=m[h];d.write(`const ${y} = ${f(h)};`);let _=_u(h);d.write(`
181
- if (${y}.issues.length) {
182
- if (input[${_}] === undefined) {
183
- if (${_} in input) {
184
- newResult[${_}] = undefined;
185
- }
186
- } else {
187
- payload.issues = payload.issues.concat(
188
- ${y}.issues.map((iss) => ({
189
- ...iss,
190
- path: iss.path ? [${_}, ...iss.path] : [${_}],
191
- }))
192
- );
193
- }
194
- } else if (${y}.value === undefined) {
195
- if (${_} in input) newResult[${_}] = undefined;
196
- } else {
197
- newResult[${_}] = ${y}.value;
198
- }
199
- `)}else{let y=m[h];d.write(`const ${y} = ${f(h)};`),d.write(`
200
- if (${y}.issues.length) payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
201
- ...iss,
202
- path: iss.path ? [${_u(h)}, ...iss.path] : [${_u(h)}]
203
- })));`),d.write(`newResult[${_u(h)}] = ${y}.value`)}d.write("payload.value = newResult;"),d.write("return payload;");let v=d.compile();return(h,y)=>v(c,h,y)},n,o=Gd,s=!cg.jitless,a=s&&kD.value,u=e.catchall,l;t._zod.parse=(c,d)=>{l??(l=r.value);let p=c.value;if(!o(p))return c.issues.push({expected:"object",code:"invalid_type",input:p,inst:t}),c;let f=[];if(s&&a&&d?.async===!1&&d.jitless!==!0)n||(n=i(e.shape)),c=n(c,d);else{c.value={};let y=l.shape;for(let _ of l.keys){let b=y[_],w=b._zod.run({value:p[_],issues:[]},d),S=b._zod.optin==="optional"&&b._zod.optout==="optional";w instanceof Promise?f.push(w.then(k=>S?HR(k,c,_,p):Eh(k,c,_))):S?HR(w,c,_,p):Eh(w,c,_)}}if(!u)return f.length?Promise.all(f).then(()=>c):c;let m=[],g=l.keySet,v=u._zod,h=v.def.type;for(let y of Object.keys(p)){if(g.has(y))continue;if(h==="never"){m.push(y);continue}let _=v.run({value:p[y],issues:[]},d);_ instanceof Promise?f.push(_.then(b=>Eh(b,c,y))):Eh(_,c,y)}return m.length&&c.issues.push({code:"unrecognized_keys",keys:m,input:p,inst:t}),f.length?Promise.all(f).then(()=>c):c}});v$=A("$ZodUnion",(t,e)=>{Me.init(t,e),$t(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),$t(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),$t(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),$t(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>Cg(i.source)).join("|")})$`)}}),t._zod.parse=(r,i)=>{let n=!1,o=[];for(let s of e.options){let a=s._zod.run({value:r.value,issues:[]},i);if(a instanceof Promise)o.push(a),n=!0;else{if(a.issues.length===0)return a;o.push(a)}}return n?Promise.all(o).then(s=>JR(s,r,t,i)):JR(o,r,t,i)}}),dM=A("$ZodDiscriminatedUnion",(t,e)=>{v$.init(t,e);let r=t._zod.parse;$t(t._zod,"propValues",()=>{let n={};for(let o of e.options){let s=o._zod.propValues;if(!s||Object.keys(s).length===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[a,u]of Object.entries(s)){n[a]||(n[a]=new Set);for(let l of u)n[a].add(l)}}return n});let i=jg(()=>{let n=e.options,o=new Map;for(let s of n){let a=s._zod.propValues[e.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let u of a){if(o.has(u))throw Error(`Duplicate discriminator value "${String(u)}"`);o.set(u,s)}}return o});t._zod.parse=(n,o)=>{let s=n.value;if(!Gd(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),n;let a=i.value.get(s?.[e.discriminator]);return a?a._zod.run(n,o):e.unionFallback?r(n,o):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[e.discriminator],inst:t}),n)}}),fM=A("$ZodIntersection",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>{let n=r.value,o=e.left._zod.run({value:n,issues:[]},i),s=e.right._zod.run({value:n,issues:[]},i);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([a,u])=>YR(r,a,u)):YR(r,o,s)}});Dg=A("$ZodTuple",(t,e)=>{Me.init(t,e);let r=e.items,i=r.length-[...r].reverse().findIndex(n=>n._zod.optin!=="optional");t._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({input:s,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[];if(!e.rest){let l=s.length>r.length,c=s.length<i-1;if(l||c)return n.issues.push({input:s,inst:t,origin:"array",...l?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length}}),n}let u=-1;for(let l of r){if(u++,u>=s.length&&u>=i)continue;let c=l._zod.run({value:s[u],issues:[]},o);c instanceof Promise?a.push(c.then(d=>Ph(d,n,u))):Ph(c,n,u)}if(e.rest){let l=s.slice(r.length);for(let c of l){u++;let d=e.rest._zod.run({value:c,issues:[]},o);d instanceof Promise?a.push(d.then(p=>Ph(p,n,u))):Ph(d,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});pM=A("$ZodRecord",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!Bd(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;let o=[];if(e.keyType._zod.values){let s=e.keyType._zod.values;r.value={};for(let u of s)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){let l=e.valueType._zod.run({value:n[u],issues:[]},i);l instanceof Promise?o.push(l.then(c=>{c.issues.length&&r.issues.push(...Kn(u,c.issues)),r.value[u]=c.value})):(l.issues.length&&r.issues.push(...Kn(u,l.issues)),r.value[u]=l.value)}let a;for(let u in n)s.has(u)||(a=a??[],a.push(u));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:a})}else{r.value={};for(let s of Reflect.ownKeys(n)){if(s==="__proto__")continue;let a=e.keyType._zod.run({value:s,issues:[]},i);if(a instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(l=>bi(l,i,rn())),input:s,path:[s],inst:t}),r.value[a.value]=a.value;continue}let u=e.valueType._zod.run({value:n[s],issues:[]},i);u instanceof Promise?o.push(u.then(l=>{l.issues.length&&r.issues.push(...Kn(s,l.issues)),r.value[a.value]=l.value})):(u.issues.length&&r.issues.push(...Kn(s,u.issues)),r.value[a.value]=u.value)}}return o.length?Promise.all(o).then(()=>r):r}}),mM=A("$ZodMap",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:t}),r;let o=[];r.value=new Map;for(let[s,a]of n){let u=e.keyType._zod.run({value:s,issues:[]},i),l=e.valueType._zod.run({value:a,issues:[]},i);u instanceof Promise||l instanceof Promise?o.push(Promise.all([u,l]).then(([c,d])=>{QR(c,d,r,s,n,t,i)})):QR(u,l,r,s,n,t,i)}return o.length?Promise.all(o).then(()=>r):r}});hM=A("$ZodSet",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:t,expected:"set",code:"invalid_type"}),r;let o=[];r.value=new Set;for(let s of n){let a=e.valueType._zod.run({value:s,issues:[]},i);a instanceof Promise?o.push(a.then(u=>XR(u,r))):XR(a,r)}return o.length?Promise.all(o).then(()=>r):r}});gM=A("$ZodEnum",(t,e)=>{Me.init(t,e);let r=Jx(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(i=>dg.has(typeof i)).map(i=>typeof i=="string"?oa(i):i.toString()).join("|")})$`),t._zod.parse=(i,n)=>{let o=i.value;return t._zod.values.has(o)||i.issues.push({code:"invalid_value",values:r,input:o,inst:t}),i}}),yM=A("$ZodLiteral",(t,e)=>{Me.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?oa(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,i)=>{let n=r.value;return t._zod.values.has(n)||r.issues.push({code:"invalid_value",values:e.values,input:n,inst:t}),r}}),vM=A("$ZodFile",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>{let n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:t}),r}}),_$=A("$ZodTransform",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>{let n=e.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(o=>(r.value=o,r));if(n instanceof Promise)throw new Ho;return r.value=n,r}}),_M=A("$ZodOptional",(t,e)=>{Me.init(t,e),t._zod.optin="optional",t._zod.optout="optional",$t(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),$t(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Cg(r.source)})?$`):void 0}),t._zod.parse=(r,i)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,i):r.value===void 0?r:e.innerType._zod.run(r,i)}),bM=A("$ZodNullable",(t,e)=>{Me.init(t,e),$t(t._zod,"optin",()=>e.innerType._zod.optin),$t(t._zod,"optout",()=>e.innerType._zod.optout),$t(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Cg(r.source)}|null)$`):void 0}),$t(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,i)=>r.value===null?r:e.innerType._zod.run(r,i)}),wM=A("$ZodDefault",(t,e)=>{Me.init(t,e),t._zod.optin="optional",$t(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>eA(o,e)):eA(n,e)}});SM=A("$ZodPrefault",(t,e)=>{Me.init(t,e),t._zod.optin="optional",$t(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,i))}),kM=A("$ZodNonOptional",(t,e)=>{Me.init(t,e),$t(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),t._zod.parse=(r,i)=>{let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>tA(o,t)):tA(n,t)}});xM=A("$ZodSuccess",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>{let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>(r.value=o.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),$M=A("$ZodCatch",(t,e)=>{Me.init(t,e),t._zod.optin="optional",$t(t._zod,"optout",()=>e.innerType._zod.optout),$t(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,i)=>{let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>bi(s,i,rn()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(o=>bi(o,i,rn()))},input:r.value}),r.issues=[]),r)}}),IM=A("$ZodNaN",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),b$=A("$ZodPipe",(t,e)=>{Me.init(t,e),$t(t._zod,"values",()=>e.in._zod.values),$t(t._zod,"optin",()=>e.in._zod.optin),$t(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,i)=>{let n=e.in._zod.run(r,i);return n instanceof Promise?n.then(o=>rA(o,e,i)):rA(n,e,i)}});EM=A("$ZodReadonly",(t,e)=>{Me.init(t,e),$t(t._zod,"propValues",()=>e.innerType._zod.propValues),$t(t._zod,"values",()=>e.innerType._zod.values),$t(t._zod,"optin",()=>e.innerType._zod.optin),$t(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,i)=>{let n=e.innerType._zod.run(r,i);return n instanceof Promise?n.then(nA):nA(n)}});PM=A("$ZodTemplateLiteral",(t,e)=>{Me.init(t,e);let r=[];for(let i of e.parts)if(i instanceof Me){if(!i._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...i._zod.traits].shift()}`);let n=i._zod.pattern instanceof RegExp?i._zod.pattern.source:i._zod.pattern;if(!n)throw Error(`Invalid template literal part: ${i._zod.traits}`);let o=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(o,s))}else if(i===null||xD.has(typeof i))r.push(oa(`${i}`));else throw Error(`Invalid template literal part: ${i}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(i,n)=>typeof i.value!="string"?(i.issues.push({input:i.value,inst:t,expected:"template_literal",code:"invalid_type"}),i):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(i.value)||i.issues.push({input:i.value,inst:t,code:"invalid_format",format:"template_literal",pattern:t._zod.pattern.source}),i)}),TM=A("$ZodPromise",(t,e)=>{Me.init(t,e),t._zod.parse=(r,i)=>Promise.resolve(r.value).then(n=>e.innerType._zod.run({value:n,issues:[]},i))}),OM=A("$ZodLazy",(t,e)=>{Me.init(t,e),$t(t._zod,"innerType",()=>e.getter()),$t(t._zod,"pattern",()=>t._zod.innerType._zod.pattern),$t(t._zod,"propValues",()=>t._zod.innerType._zod.propValues),$t(t._zod,"optin",()=>t._zod.innerType._zod.optin),$t(t._zod,"optout",()=>t._zod.innerType._zod.optout),t._zod.parse=(r,i)=>t._zod.innerType._zod.run(r,i)}),zM=A("$ZodCustom",(t,e)=>{nr.init(t,e),Me.init(t,e),t._zod.parse=(r,i)=>r,t._zod.check=r=>{let i=r.value,n=e.fn(i);if(n instanceof Promise)return n.then(o=>iA(o,r,i,t));iA(n,r,i,t)}});w$={};na(w$,{zhTW:()=>Cee,zhCN:()=>Nee,vi:()=>Oee,ur:()=>Pee,ua:()=>Iee,tr:()=>xee,th:()=>wee,ta:()=>_ee,sv:()=>yee,sl:()=>hee,ru:()=>pee,pt:()=>dee,ps:()=>aee,pl:()=>lee,ota:()=>oee,no:()=>nee,nl:()=>tee,ms:()=>XX,mk:()=>YX,ko:()=>HX,kh:()=>BX,ja:()=>WX,it:()=>FX,id:()=>LX,hu:()=>MX,he:()=>DX,frCA:()=>RX,fr:()=>jX,fi:()=>zX,fa:()=>TX,es:()=>EX,eo:()=>$X,en:()=>NM,de:()=>bX,cs:()=>vX,ca:()=>gX,be:()=>mX,az:()=>fX,ar:()=>cX});lX=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"};return n=>{switch(n.code){case"invalid_type":return`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${n.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${Ve(n.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${n.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${n.prefix}"`:o.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${o.suffix}"`:o.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${o.includes}"`:o.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${o.pattern}`:`${i[o.format]??n.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${n.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${n.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${n.keys.length>1?"\u0629":""}: ${ie(n.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};dX=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${n.expected}, daxil olan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${Ve(n.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${o}${n.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${o}${n.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${o.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:o.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${o.suffix}" il\u0259 bitm\u0259lidir`:o.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${o.includes}" daxil olmal\u0131d\u0131r`:o.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${o.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${i[o.format]??n.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${n.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${n.keys.length>1?"lar":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${n.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};pX=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"\u043B\u0456\u043A";case"object":{if(Array.isArray(n))return"\u043C\u0430\u0441\u0456\u045E";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"};return n=>{switch(n.code){case"invalid_type":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${n.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${Ve(n.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);if(s){let a=Number(n.maximum),u=oA(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${o}${n.maximum.toString()} ${u}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);if(s){let a=Number(n.minimum),u=oA(a,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${o}${n.minimum.toString()} ${u}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${i[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${n.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${ie(n.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${n.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};hX=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipus inv\xE0lid: s'esperava ${n.expected}, s'ha rebut ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Valor inv\xE0lid: s'esperava ${Ve(n.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${ie(n.values," o ")}`;case"too_big":{let o=n.inclusive?"com a m\xE0xim":"menys de",s=e(n.origin);return s?`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${o} ${n.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"com a m\xEDnim":"m\xE9s de",s=e(n.origin);return s?`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${o} ${n.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${o.prefix}"`:o.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${o.suffix}"`:o.format==="includes"?`Format inv\xE0lid: ha d'incloure "${o.includes}"`:o.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${o.pattern}`:`Format inv\xE0lid per a ${i[o.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${n.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${n.origin}`;default:return"Entrada inv\xE0lida"}}};yX=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"\u010D\xEDslo";case"string":return"\u0159et\u011Bzec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(n))return"pole";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"};return n=>{switch(n.code){case"invalid_type":return`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${n.expected}, obdr\u017Eeno ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${Ve(n.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${o}${n.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${o}${n.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${o.prefix}"`:o.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${o.suffix}"`:o.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${o.includes}"`:o.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${o.pattern}`:`Neplatn\xFD form\xE1t ${i[o.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${ie(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}};_X=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"Zahl";case"object":{if(Array.isArray(n))return"Array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return n=>{switch(n.code){case"invalid_type":return`Ung\xFCltige Eingabe: erwartet ${n.expected}, erhalten ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ung\xFCltige Eingabe: erwartet ${Ve(n.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${o}${n.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${o}${n.maximum.toString()} ist`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Zu klein: erwartet, dass ${n.origin} ${o}${n.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${o}${n.minimum.toString()} ist`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ung\xFCltiger String: muss mit "${o.prefix}" beginnen`:o.format==="ends_with"?`Ung\xFCltiger String: muss mit "${o.suffix}" enden`:o.format==="includes"?`Ung\xFCltiger String: muss "${o.includes}" enthalten`:o.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${o.pattern} entsprechen`:`Ung\xFCltig: ${i[o.format]??n.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${ie(n.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${n.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${n.origin}`;default:return"Ung\xFCltige Eingabe"}}};wX=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},SX=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(i){return t[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return i=>{switch(i.code){case"invalid_type":return`Invalid input: expected ${i.expected}, received ${wX(i.input)}`;case"invalid_value":return i.values.length===1?`Invalid input: expected ${Ve(i.values[0])}`:`Invalid option: expected one of ${ie(i.values,"|")}`;case"too_big":{let n=i.inclusive?"<=":"<",o=e(i.origin);return o?`Too big: expected ${i.origin??"value"} to have ${n}${i.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${n}${i.maximum.toString()}`}case"too_small":{let n=i.inclusive?">=":">",o=e(i.origin);return o?`Too small: expected ${i.origin} to have ${n}${i.minimum.toString()} ${o.unit}`:`Too small: expected ${i.origin} to be ${n}${i.minimum.toString()}`}case"invalid_format":{let n=i;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${ie(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};kX=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"nombro";case"object":{if(Array.isArray(t))return"tabelo";if(t===null)return"senvalora";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},xX=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(i){return t[i]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return i=>{switch(i.code){case"invalid_type":return`Nevalida enigo: atendi\u011Dis ${i.expected}, ricevi\u011Dis ${kX(i.input)}`;case"invalid_value":return i.values.length===1?`Nevalida enigo: atendi\u011Dis ${Ve(i.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${ie(i.values,"|")}`;case"too_big":{let n=i.inclusive?"<=":"<",o=e(i.origin);return o?`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${n}${i.maximum.toString()} ${o.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${n}${i.maximum.toString()}`}case"too_small":{let n=i.inclusive?">=":">",o=e(i.origin);return o?`Tro malgranda: atendi\u011Dis ke ${i.origin} havu ${n}${i.minimum.toString()} ${o.unit}`:`Tro malgranda: atendi\u011Dis ke ${i.origin} estu ${n}${i.minimum.toString()}`}case"invalid_format":{let n=i;return n.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${n.prefix}"`:n.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${n.suffix}"`:n.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${n.includes}"`:n.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`:`Nevalida ${r[n.format]??i.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${i.divisor}`;case"unrecognized_keys":return`Nekonata${i.keys.length>1?"j":""} \u015Dlosilo${i.keys.length>1?"j":""}: ${ie(i.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${i.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${i.origin}`;default:return"Nevalida enigo"}}};IX=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(n))return"arreglo";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype)return n.constructor.name}}return o},i={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Entrada inv\xE1lida: se esperaba ${n.expected}, recibido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: se esperaba ${Ve(n.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Demasiado grande: se esperaba que ${n.origin??"valor"} tuviera ${o}${n.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: se esperaba que ${n.origin??"valor"} fuera ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Demasiado peque\xF1o: se esperaba que ${n.origin} tuviera ${o}${n.minimum.toString()} ${s.unit}`:`Demasiado peque\xF1o: se esperaba que ${n.origin} fuera ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${o.prefix}"`:o.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${o.suffix}"`:o.format==="includes"?`Cadena inv\xE1lida: debe incluir "${o.includes}"`:o.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${o.pattern}`:`Inv\xE1lido ${i[o.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${n.origin}`;default:return"Entrada inv\xE1lida"}}};PX=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(n))return"\u0622\u0631\u0627\u06CC\u0647";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"};return n=>{switch(n.code){case"invalid_type":return`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${n.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${r(n.input)} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;case"invalid_value":return n.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${Ve(n.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${ie(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:o.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${o.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:o.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${o.includes}" \u0628\u0627\u0634\u062F`:o.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${o.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${i[o.format]??n.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${n.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${n.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${ie(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${n.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${n.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};OX=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return n=>{switch(n.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${n.expected}, oli ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${Ve(n.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${o}${n.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${o}${n.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${o.prefix}"`:o.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${o.suffix}"`:o.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${o.includes}"`:o.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${o.pattern}`:`Virheellinen ${i[o.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${ie(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};NX=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"nombre";case"object":{if(Array.isArray(n))return"tableau";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return n=>{switch(n.code){case"invalid_type":return`Entr\xE9e invalide : ${n.expected} attendu, ${r(n.input)} re\xE7u`;case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : ${Ve(n.values[0])} attendu`:`Option invalide : une valeur parmi ${ie(n.values,"|")} attendue`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Trop grand : ${n.origin??"valeur"} doit ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${n.origin??"valeur"} doit \xEAtre ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Trop petit : ${n.origin} doit ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Trop petit : ${n.origin} doit \xEAtre ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${o.pattern}`:`${i[o.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${ie(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};CX=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"};return n=>{switch(n.code){case"invalid_type":return`Entr\xE9e invalide : attendu ${n.expected}, re\xE7u ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : attendu ${Ve(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"\u2264":"<",s=e(n.origin);return s?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${o}${n.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"\u2265":">",s=e(n.origin);return s?`Trop petit : attendu que ${n.origin} ait ${o}${n.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${n.origin} soit ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${o.prefix}"`:o.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${o.suffix}"`:o.format==="includes"?`Cha\xEEne invalide : doit inclure "${o.includes}"`:o.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${o.pattern}`:`${i[o.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${ie(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}};AX=()=>{let t={string:{unit:"\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",verb:"\u05DC\u05DB\u05DC\u05D5\u05DC"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u05E7\u05DC\u05D8",email:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",url:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",emoji:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",date:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",time:"\u05D6\u05DE\u05DF ISO",duration:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",ipv4:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",ipv6:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",cidrv4:"\u05D8\u05D5\u05D5\u05D7 IPv4",cidrv6:"\u05D8\u05D5\u05D5\u05D7 IPv6",base64:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",base64url:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",json_string:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",e164:"\u05DE\u05E1\u05E4\u05E8 E.164",jwt:"JWT",template_literal:"\u05E7\u05DC\u05D8"};return n=>{switch(n.code){case"invalid_type":return`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${n.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA ${Ve(n.values[0])}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05D0\u05D7\u05EA \u05DE\u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${n.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${n.maximum.toString()} ${s.unit??"elements"}`:`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${n.origin??"value"} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${n.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${n.minimum.toString()} ${s.unit}`:`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${n.origin} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1"${o.prefix}"`:o.format==="ends_with"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${o.suffix}"`:o.format==="includes"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${o.includes}"`:o.format==="regex"?`\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05E0\u05D4: \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${o.pattern}`:`${i[o.format]??n.format} \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${n.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${n.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${n.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${ie(n.keys,", ")}`;case"invalid_key":return`\u05DE\u05E4\u05EA\u05D7 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${n.origin}`;case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${n.origin}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};UX=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"sz\xE1m";case"object":{if(Array.isArray(n))return"t\xF6mb";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"};return n=>{switch(n.code){case"invalid_type":return`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${n.expected}, a kapott \xE9rt\xE9k ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${Ve(n.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${o}${n.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${n.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${o}${n.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} t\xFAl kicsi ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\xC9rv\xE9nytelen string: "${o.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:o.format==="ends_with"?`\xC9rv\xE9nytelen string: "${o.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:o.format==="includes"?`\xC9rv\xE9nytelen string: "${o.includes}" \xE9rt\xE9ket kell tartalmaznia`:o.format==="regex"?`\xC9rv\xE9nytelen string: ${o.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${i[o.format]??n.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${n.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${n.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${n.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};ZX=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak valid: diharapkan ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${Ve(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${o}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Terlalu kecil: diharapkan ${n.origin} memiliki ${o}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`String tidak valid: harus dimulai dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak valid: harus berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak valid: harus menyertakan "${o.includes}"`:o.format==="regex"?`String tidak valid: harus sesuai pola ${o.pattern}`:`${i[o.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};qX=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"numero";case"object":{if(Array.isArray(n))return"vettore";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input non valido: atteso ${n.expected}, ricevuto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input non valido: atteso ${Ve(n.values[0])}`:`Opzione non valida: atteso uno tra ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Troppo grande: ${n.origin??"valore"} deve avere ${o}${n.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Troppo piccolo: ${n.origin} deve avere ${o}${n.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${n.origin} deve essere ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Stringa non valida: deve iniziare con "${o.prefix}"`:o.format==="ends_with"?`Stringa non valida: deve terminare con "${o.suffix}"`:o.format==="includes"?`Stringa non valida: deve includere "${o.includes}"`:o.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${o.pattern}`:`Invalid ${i[o.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${ie(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};VX=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"\u6570\u5024";case"object":{if(Array.isArray(n))return"\u914D\u5217";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"};return n=>{switch(n.code){case"invalid_type":return`\u7121\u52B9\u306A\u5165\u529B: ${n.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${r(n.input)}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;case"invalid_value":return n.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${Ve(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${ie(n.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let o=n.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=e(n.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${s.unit??"\u8981\u7D20"}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let o=n.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=e(n.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${s.unit}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${o}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${o.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:o.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${o.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${i[o.format]??n.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${n.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${n.keys.length>1?"\u7FA4":""}: ${ie(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};GX=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"\u1798\u17B7\u1793\u1798\u17C2\u1793\u1787\u17B6\u179B\u17C1\u1781 (NaN)":"\u179B\u17C1\u1781";case"object":{if(Array.isArray(n))return"\u17A2\u17B6\u179A\u17C1 (Array)";if(n===null)return"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"};return n=>{switch(n.code){case"invalid_type":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${Ve(n.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${n.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${o} ${n.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${o.prefix}"`:o.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${o.suffix}"`:o.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${o.includes}"`:o.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${o.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${i[o.format]??n.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${n.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${ie(n.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};KX=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"};return n=>{switch(n.code){case"invalid_type":return`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${r(n.input)}\uC785\uB2C8\uB2E4`;case"invalid_value":return n.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${Ve(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${ie(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let o=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=o==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(n.origin),u=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${u} ${o}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${o}${s}`}case"too_small":{let o=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=o==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(n.origin),u=a?.unit??"\uC694\uC18C";return a?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${u} ${o}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${o}${s}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:o.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${o.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:o.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${o.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${i[o.format]??n.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${n.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${ie(n.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${n.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${n.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};JX=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"\u0431\u0440\u043E\u0458";case"object":{if(Array.isArray(n))return"\u043D\u0438\u0437\u0430";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"};return n=>{switch(n.code){case"invalid_type":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${Ve(n.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${o}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0438\u043C\u0430 ${o}${n.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${o.pattern}`:`Invalid ${i[o.format]??n.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${ie(n.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${n.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${n.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};QX=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"nombor";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak sah: dijangka ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${Ve(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`String tidak sah: mesti bermula dengan "${o.prefix}"`:o.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${o.suffix}"`:o.format==="includes"?`String tidak sah: mesti mengandungi "${o.includes}"`:o.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${o.pattern}`:`${i[o.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${ie(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};eee=()=>{let t={string:{unit:"tekens"},file:{unit:"bytes"},array:{unit:"elementen"},set:{unit:"elementen"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"getal";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return n=>{switch(n.code){case"invalid_type":return`Ongeldige invoer: verwacht ${n.expected}, ontving ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${Ve(n.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Te lang: verwacht dat ${n.origin??"waarde"} ${o}${n.maximum.toString()} ${s.unit??"elementen"} bevat`:`Te lang: verwacht dat ${n.origin??"waarde"} ${o}${n.maximum.toString()} is`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Te kort: verwacht dat ${n.origin} ${o}${n.minimum.toString()} ${s.unit} bevat`:`Te kort: verwacht dat ${n.origin} ${o}${n.minimum.toString()} is`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ongeldige tekst: moet met "${o.prefix}" beginnen`:o.format==="ends_with"?`Ongeldige tekst: moet op "${o.suffix}" eindigen`:o.format==="includes"?`Ongeldige tekst: moet "${o.includes}" bevatten`:o.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${o.pattern}`:`Ongeldig: ${i[o.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};ree=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"tall";case"object":{if(Array.isArray(n))return"liste";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Ugyldig input: forventet ${n.expected}, fikk ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${Ve(n.values[0])}`:`Ugyldig valg: forventet en av ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`For lite(n): forventet ${n.origin} til \xE5 ha ${o}${n.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${n.origin} til \xE5 ha ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${o.prefix}"`:o.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${o.suffix}"`:o.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${o.includes}"`:o.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${o.pattern}`:`Ugyldig ${i[o.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${ie(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};iee=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"numara";case"object":{if(Array.isArray(n))return"saf";if(n===null)return"gayb";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"};return n=>{switch(n.code){case"invalid_type":return`F\xE2sit giren: umulan ${n.expected}, al\u0131nan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`F\xE2sit giren: umulan ${Ve(n.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${o}${n.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${o}${n.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${o}${n.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${o}${n.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let o=n;return o.format==="starts_with"?`F\xE2sit metin: "${o.prefix}" ile ba\u015Flamal\u0131.`:o.format==="ends_with"?`F\xE2sit metin: "${o.suffix}" ile bitmeli.`:o.format==="includes"?`F\xE2sit metin: "${o.includes}" ihtiv\xE2 etmeli.`:o.format==="regex"?`F\xE2sit metin: ${o.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${i[o.format]??n.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${n.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${n.keys.length>1?"s":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${n.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};see=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"\u0639\u062F\u062F";case"object":{if(Array.isArray(n))return"\u0627\u0631\u06D0";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"};return n=>{switch(n.code){case"invalid_type":return`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${n.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${r(n.input)} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;case"invalid_value":return n.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${Ve(n.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${ie(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${o}${n.maximum.toString()} \u0648\u064A`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${o}${n.minimum.toString()} \u0648\u064A`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:o.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${o.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:o.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${o.includes}" \u0648\u0644\u0631\u064A`:o.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${o.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${i[o.format]??n.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${n.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${n.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${ie(n.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${n.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${n.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};uee=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"liczba";case"object":{if(Array.isArray(n))return"tablica";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"};return n=>{switch(n.code){case"invalid_type":return`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${n.expected}, otrzymano ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${Ve(n.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${n.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${o}${n.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${o.prefix}"`:o.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${o.suffix}"`:o.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${o.includes}"`:o.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${o.pattern}`:`Nieprawid\u0142ow(y/a/e) ${i[o.format]??n.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${n.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${n.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};cee=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"n\xFAmero";case"object":{if(Array.isArray(n))return"array";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipo inv\xE1lido: esperado ${n.expected}, recebido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: esperado ${Ve(n.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${o}${n.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Muito pequeno: esperado que ${n.origin} tivesse ${o}${n.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${o.prefix}"`:o.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${o.suffix}"`:o.format==="includes"?`Texto inv\xE1lido: deve incluir "${o.includes}"`:o.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${o.pattern}`:`${i[o.format]??n.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${n.origin}`;default:return"Campo inv\xE1lido"}}};fee=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(n))return"\u043C\u0430\u0441\u0441\u0438\u0432";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"};return n=>{switch(n.code){case"invalid_type":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${Ve(n.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);if(s){let a=Number(n.maximum),u=sA(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${n.maximum.toString()} ${u}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);if(s){let a=Number(n.minimum),u=sA(a,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${o}${n.minimum.toString()} ${u}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${i[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${n.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0438":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};mee=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"\u0161tevilo";case"object":{if(Array.isArray(n))return"tabela";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"};return n=>{switch(n.code){case"invalid_type":return`Neveljaven vnos: pri\u010Dakovano ${n.expected}, prejeto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${Ve(n.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${o}${n.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${o}${n.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${o.prefix}"`:o.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${o.suffix}"`:o.format==="includes"?`Neveljaven niz: mora vsebovati "${o.includes}"`:o.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${o.pattern}`:`Neveljaven ${i[o.format]??n.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${ie(n.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};gee=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"antal";case"object":{if(Array.isArray(n))return"lista";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return n=>{switch(n.code){case"invalid_type":return`Ogiltig inmatning: f\xF6rv\xE4ntat ${n.expected}, fick ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${Ve(n.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${n.origin??"v\xE4rdet"} att ha ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${o.prefix}"`:o.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${o.suffix}"`:o.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${o.includes}"`:o.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${o.pattern}"`:`Ogiltig(t) ${i[o.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${ie(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${n.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};vee=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"\u0B8E\u0BA3\u0BCD \u0B85\u0BB2\u0BCD\u0BB2\u0BBE\u0BA4\u0BA4\u0BC1":"\u0B8E\u0BA3\u0BCD";case"object":{if(Array.isArray(n))return"\u0B85\u0BA3\u0BBF";if(n===null)return"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${Ve(n.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${ie(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${n.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${o}${n.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${o}${n.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${o}${n.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${o.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:o.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${o.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${i[o.format]??n.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${n.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${n.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};bee=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"\u0E44\u0E21\u0E48\u0E43\u0E0A\u0E48\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02 (NaN)":"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02";case"object":{if(Array.isArray(n))return"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)";if(n===null)return"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"};return n=>{switch(n.code){case"invalid_type":return`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${n.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${Ve(n.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=e(n.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=e(n.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${o} ${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${o.prefix}"`:o.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${o.suffix}"`:o.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${o.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:o.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${o.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${i[o.format]??n.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${n.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${ie(n.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};See=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},kee=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(i){return t[i]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"};return i=>{switch(i.code){case"invalid_type":return`Ge\xE7ersiz de\u011Fer: beklenen ${i.expected}, al\u0131nan ${See(i.input)}`;case"invalid_value":return i.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${Ve(i.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${ie(i.values,"|")}`;case"too_big":{let n=i.inclusive?"<=":"<",o=e(i.origin);return o?`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${n}${i.maximum.toString()} ${o.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${n}${i.maximum.toString()}`}case"too_small":{let n=i.inclusive?">=":">",o=e(i.origin);return o?`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${n}${i.minimum.toString()} ${o.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${n}${i.minimum.toString()}`}case"invalid_format":{let n=i;return n.format==="starts_with"?`Ge\xE7ersiz metin: "${n.prefix}" ile ba\u015Flamal\u0131`:n.format==="ends_with"?`Ge\xE7ersiz metin: "${n.suffix}" ile bitmeli`:n.format==="includes"?`Ge\xE7ersiz metin: "${n.includes}" i\xE7ermeli`:n.format==="regex"?`Ge\xE7ersiz metin: ${n.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[n.format]??i.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${i.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${i.keys.length>1?"lar":""}: ${ie(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${i.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};$ee=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"\u0447\u0438\u0441\u043B\u043E";case"object":{if(Array.isArray(n))return"\u043C\u0430\u0441\u0438\u0432";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"};return n=>{switch(n.code){case"invalid_type":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${n.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${Ve(n.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} \u0431\u0443\u0434\u0435 ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${o.prefix}"`:o.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${o.suffix}"`:o.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${o.includes}"`:o.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${o.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${i[o.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0456":""}: ${ie(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${n.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};Eee=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"\u0646\u0645\u0628\u0631";case"object":{if(Array.isArray(n))return"\u0622\u0631\u06D2";if(n===null)return"\u0646\u0644";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"};return n=>{switch(n.code){case"invalid_type":return`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${n.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${r(n.input)} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;case"invalid_value":return n.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${Ve(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${ie(n.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${o}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${o}${n.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${o}${n.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u0627 ${o}${n.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${o.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:o.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${o.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${i[o.format]??n.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${n.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${n.keys.length>1?"\u0632":""}: ${ie(n.keys,"\u060C ")}`;case"invalid_key":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};Tee=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"s\u1ED1";case"object":{if(Array.isArray(n))return"m\u1EA3ng";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"};return n=>{switch(n.code){case"invalid_type":return`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${n.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${Ve(n.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${o}${n.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${s.verb} ${o}${n.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${o.prefix}"`:o.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${o.suffix}"`:o.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${o.includes}"`:o.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${o.pattern}`:`${i[o.format]??n.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${n.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${ie(n.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};zee=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"\u975E\u6570\u5B57(NaN)":"\u6570\u5B57";case"object":{if(Array.isArray(n))return"\u6570\u7EC4";if(n===null)return"\u7A7A\u503C(null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"};return n=>{switch(n.code){case"invalid_type":return`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${Ve(n.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${o}${n.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${o}${n.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.prefix}" \u5F00\u5934`:o.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${o.suffix}" \u7ED3\u5C3E`:o.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${o.pattern}`:`\u65E0\u6548${i[o.format]??n.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${n.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${ie(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${n.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};jee=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(n){return t[n]??null}let r=n=>{let o=typeof n;switch(o){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return o},i={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"};return n=>{switch(n.code){case"invalid_type":return`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${n.expected}\uFF0C\u4F46\u6536\u5230 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${Ve(n.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${ie(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${o}${n.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${o}${n.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.prefix}" \u958B\u982D`:o.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${o.suffix}" \u7D50\u5C3E`:o.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${o.includes}"`:o.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${o.pattern}`:`\u7121\u6548\u7684 ${i[o.format]??n.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${n.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${n.keys.length>1?"\u5011":""}\uFF1A${ie(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};jM=Symbol("ZodOutput"),CM=Symbol("ZodInput"),Kd=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let i=r[0];if(this._map.set(e,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,e)}return this}remove(e){return this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let i={...this.get(r)??{}};return delete i.id,{...i,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};Ks=S$();DM={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};vg=class{constructor(e){this._def=e,this.def=e}implement(e){if(typeof e!="function")throw Error("implement() must be called with a function");let r=(...i)=>{let n=this._def.input?fg(this._def.input,i,void 0,{callee:r}):i;if(!Array.isArray(n))throw Error("Invalid arguments schema: not an array or tuple schema.");let o=e(...n);return this._def.output?fg(this._def.output,o,void 0,{callee:r}):o};return r}implementAsync(e){if(typeof e!="function")throw Error("implement() must be called with a function");let r=async(...i)=>{let n=this._def.input?await pg(this._def.input,i,void 0,{callee:r}):i;if(!Array.isArray(n))throw Error("Invalid arguments schema: not an array or tuple schema.");let o=await e(...n);return this._def.output?pg(this._def.output,o,void 0,{callee:r}):o};return r}input(...e){let r=this.constructor;return Array.isArray(e[0])?new r({type:"function",input:new Dg({type:"tuple",items:e[0],rest:e[1]}),output:this._def.output}):new r({type:"function",input:e[0],output:this._def.output})}output(e){return new this.constructor({type:"function",input:this._def.input,output:e})}};Yd=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ks,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var i;let n=e._zod.def,o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let u=e._zod.toJSONSchema?.();if(u)a.schema=u;else{let c={...r,schemaPath:[...r.schemaPath,e],path:r.path},d=e._zod.parent;if(d)a.ref=d,this.process(d,c),this.seen.get(d).isParent=!0;else{let p=a.schema;switch(n.type){case"string":{let f=p;f.type="string";let{minimum:m,maximum:g,format:v,patterns:h,contentEncoding:y}=e._zod.bag;if(typeof m=="number"&&(f.minLength=m),typeof g=="number"&&(f.maxLength=g),v&&(f.format=o[v]??v,f.format===""&&delete f.format),y&&(f.contentEncoding=y),h&&h.size>0){let _=[...h];_.length===1?f.pattern=_[0].source:_.length>1&&(a.schema.allOf=[..._.map(b=>({...this.target==="draft-7"?{type:"string"}:{},pattern:b.source}))])}break}case"number":{let f=p,{minimum:m,maximum:g,format:v,multipleOf:h,exclusiveMaximum:y,exclusiveMinimum:_}=e._zod.bag;typeof v=="string"&&v.includes("int")?f.type="integer":f.type="number",typeof _=="number"&&(f.exclusiveMinimum=_),typeof m=="number"&&(f.minimum=m,typeof _=="number"&&(_>=m?delete f.minimum:delete f.exclusiveMinimum)),typeof y=="number"&&(f.exclusiveMaximum=y),typeof g=="number"&&(f.maximum=g,typeof y=="number"&&(y<=g?delete f.maximum:delete f.exclusiveMaximum)),typeof h=="number"&&(f.multipleOf=h);break}case"boolean":{let f=p;f.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{p.type="null";break}case"any":break;case"unknown":break;case"undefined":case"never":{p.not={};break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let f=p,{minimum:m,maximum:g}=e._zod.bag;typeof m=="number"&&(f.minItems=m),typeof g=="number"&&(f.maxItems=g),f.type="array",f.items=this.process(n.element,{...c,path:[...c.path,"items"]});break}case"object":{let f=p;f.type="object",f.properties={};let m=n.shape;for(let h in m)f.properties[h]=this.process(m[h],{...c,path:[...c.path,"properties",h]});let g=new Set(Object.keys(m)),v=new Set([...g].filter(h=>{let y=n.shape[h]._zod;return this.io==="input"?y.optin===void 0:y.optout===void 0}));v.size>0&&(f.required=Array.from(v)),n.catchall?._zod.def.type==="never"?f.additionalProperties=!1:n.catchall?n.catchall&&(f.additionalProperties=this.process(n.catchall,{...c,path:[...c.path,"additionalProperties"]})):this.io==="output"&&(f.additionalProperties=!1);break}case"union":{let f=p;f.anyOf=n.options.map((m,g)=>this.process(m,{...c,path:[...c.path,"anyOf",g]}));break}case"intersection":{let f=p,m=this.process(n.left,{...c,path:[...c.path,"allOf",0]}),g=this.process(n.right,{...c,path:[...c.path,"allOf",1]}),v=y=>"allOf"in y&&Object.keys(y).length===1,h=[...v(m)?m.allOf:[m],...v(g)?g.allOf:[g]];f.allOf=h;break}case"tuple":{let f=p;f.type="array";let m=n.items.map((h,y)=>this.process(h,{...c,path:[...c.path,"prefixItems",y]}));if(this.target==="draft-2020-12"?f.prefixItems=m:f.items=m,n.rest){let h=this.process(n.rest,{...c,path:[...c.path,"items"]});this.target==="draft-2020-12"?f.items=h:f.additionalItems=h}n.rest&&(f.items=this.process(n.rest,{...c,path:[...c.path,"items"]}));let{minimum:g,maximum:v}=e._zod.bag;typeof g=="number"&&(f.minItems=g),typeof v=="number"&&(f.maxItems=v);break}case"record":{let f=p;f.type="object",f.propertyNames=this.process(n.keyType,{...c,path:[...c.path,"propertyNames"]}),f.additionalProperties=this.process(n.valueType,{...c,path:[...c.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let f=p,m=Jx(n.entries);m.every(g=>typeof g=="number")&&(f.type="number"),m.every(g=>typeof g=="string")&&(f.type="string"),f.enum=m;break}case"literal":{let f=p,m=[];for(let g of n.values)if(g===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(g))}else m.push(g);if(m.length!==0)if(m.length===1){let g=m[0];f.type=g===null?"null":typeof g,f.const=g}else m.every(g=>typeof g=="number")&&(f.type="number"),m.every(g=>typeof g=="string")&&(f.type="string"),m.every(g=>typeof g=="boolean")&&(f.type="string"),m.every(g=>g===null)&&(f.type="null"),f.enum=m;break}case"file":{let f=p,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:v,mime:h}=e._zod.bag;g!==void 0&&(m.minLength=g),v!==void 0&&(m.maxLength=v),h?h.length===1?(m.contentMediaType=h[0],Object.assign(f,m)):f.anyOf=h.map(y=>({...m,contentMediaType:y})):Object.assign(f,m);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let f=this.process(n.innerType,c);p.anyOf=[f,{type:"null"}];break}case"nonoptional":{this.process(n.innerType,c),a.ref=n.innerType;break}case"success":{let f=p;f.type="boolean";break}case"default":{this.process(n.innerType,c),a.ref=n.innerType,p.default=JSON.parse(JSON.stringify(n.defaultValue));break}case"prefault":{this.process(n.innerType,c),a.ref=n.innerType,this.io==="input"&&(p._prefault=JSON.parse(JSON.stringify(n.defaultValue)));break}case"catch":{this.process(n.innerType,c),a.ref=n.innerType;let f;try{f=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}p.default=f;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let f=p,m=e._zod.pattern;if(!m)throw Error("Pattern not found in template literal");f.type="string",f.pattern=m.source;break}case"pipe":{let f=this.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;this.process(f,c),a.ref=f;break}case"readonly":{this.process(n.innerType,c),a.ref=n.innerType,p.readOnly=!0;break}case"promise":{this.process(n.innerType,c),a.ref=n.innerType;break}case"optional":{this.process(n.innerType,c),a.ref=n.innerType;break}case"lazy":{let f=e._zod.innerType;this.process(f,c),a.ref=f;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}default:}}}let l=this.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),this.io==="input"&&fr(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((i=a.schema).default??(i.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let i={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},n=this.seen.get(e);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let o=c=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(i.external){let m=i.external.registry.get(c[0])?.id;if(m)return{ref:i.external.uri(m)};let g=c[1].defId??c[1].schema.id??`schema${this.counter++}`;return c[1].defId=g,{defId:g,ref:`${i.external.uri("__shared")}#/${d}/${g}`}}if(c[1]===n)return{ref:"#"};let p=`#/${d}/`,f=c[1].schema.id??`__schema${this.counter++}`;return{defId:f,ref:p+f}},s=c=>{if(c[1].schema.$ref)return;let d=c[1],{ref:p,defId:f}=o(c);d.def={...d.schema},f&&(d.defId=f);let m=d.schema;for(let g in m)delete m[g];m.$ref=p};for(let c of this.seen.entries()){let d=c[1];if(e===c[0]){s(c);continue}if(i.external){let p=i.external.registry.get(c[0])?.id;if(e!==c[0]&&p){s(c);continue}}if(this.metadataRegistry.get(c[0])?.id){s(c);continue}if(d.cycle){if(i.cycles==="throw")throw Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
204
-
205
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);i.cycles==="ref"&&s(c);continue}if(d.count>1&&i.reused==="ref"){s(c);continue}}let a=(c,d)=>{let p=this.seen.get(c),f=p.def??p.schema,m={...f};if(p.ref===null)return;let g=p.ref;if(p.ref=null,g){a(g,d);let v=this.seen.get(g).schema;v.$ref&&d.target==="draft-7"?(f.allOf=f.allOf??[],f.allOf.push(v)):(Object.assign(f,v),Object.assign(f,m))}p.isParent||this.override({zodSchema:c,jsonSchema:f,path:p.path??[]})};for(let c of[...this.seen.entries()].reverse())a(c[0],{target:this.target});let u={};this.target==="draft-2020-12"?u.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?u.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),Object.assign(u,n.def);let l=i.external?.defs??{};for(let c of this.seen.entries()){let d=c[1];d.def&&d.defId&&(l[d.defId]=d.def)}!i.external&&Object.keys(l).length>0&&(this.target==="draft-2020-12"?u.$defs=l:u.definitions=l);try{return JSON.parse(JSON.stringify(u))}catch{throw Error("Error converting schema to JSON.")}}};rte={},nte=A("ZodMiniType",(t,e)=>{if(!t._zod)throw Error("Uninitialized schema in ZodMiniType.");Me.init(t,e),t.def=e,t.parse=(r,i)=>fg(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>o$(t,r,i),t.parseAsync=async(r,i)=>pg(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>a$(t,r,i),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),t.clone=(r,i)=>Si(t,r,i),t.brand=()=>t,t.register=(r,i)=>(r.add(t,i),t)}),OPe=A("ZodMiniObject",(t,e)=>{y$.init(t,e),nte.init(t,e),ut.defineLazy(t,"shape",()=>e.shape)}),bu={};na(bu,{xid:()=>yte,void:()=>Ute,uuidv7:()=>cte,uuidv6:()=>lte,uuidv4:()=>ute,uuid:()=>ate,url:()=>dte,uppercase:()=>B$,unknown:()=>Ht,union:()=>At,undefined:()=>Ate,ulid:()=>gte,uint64:()=>Cte,uint32:()=>zte,tuple:()=>qte,trim:()=>X$,treeifyError:()=>OD,transform:()=>jI,toUpperCase:()=>tI,toLowerCase:()=>eI,toJSONSchema:()=>S4,templateLiteral:()=>Yte,symbol:()=>Rte,superRefine:()=>pZ,success:()=>Hte,stringbool:()=>ere,stringFormat:()=>Ete,string:()=>V,strictObject:()=>Lte,startsWith:()=>H$,size:()=>V$,setErrorMap:()=>nre,set:()=>Wte,safeParseAsync:()=>z4,safeParse:()=>O4,registry:()=>S$,regexes:()=>u$,regex:()=>W$,refine:()=>fZ,record:()=>Rt,readonly:()=>oZ,property:()=>m4,promise:()=>Qte,prettifyError:()=>ND,preprocess:()=>DI,prefault:()=>Q4,positive:()=>c4,pipe:()=>wg,partialRecord:()=>Fte,parseAsync:()=>T4,parse:()=>P4,overwrite:()=>sa,optional:()=>Ft,object:()=>de,number:()=>xt,nullish:()=>Kte,nullable:()=>bg,null:()=>EI,normalize:()=>Q$,nonpositive:()=>f4,nonoptional:()=>X4,nonnegative:()=>p4,never:()=>Wg,negative:()=>d4,nativeEnum:()=>Gte,nanoid:()=>pte,nan:()=>Jte,multipleOf:()=>Hd,minSize:()=>Jd,minLength:()=>Lu,mime:()=>Y$,maxSize:()=>Ug,maxLength:()=>Mg,map:()=>Vte,lte:()=>vi,lt:()=>ta,lowercase:()=>G$,looseObject:()=>Xr,locales:()=>w$,literal:()=>we,length:()=>Zg,lazy:()=>uZ,ksuid:()=>vte,keyof:()=>Zte,jwt:()=>Ite,json:()=>tre,iso:()=>nI,ipv6:()=>bte,ipv4:()=>_te,intersection:()=>Bg,int64:()=>jte,int32:()=>Ote,int:()=>Ox,instanceof:()=>Xte,includes:()=>K$,guid:()=>ste,gte:()=>On,gt:()=>ra,globalRegistry:()=>Ks,getErrorMap:()=>ire,function:()=>w4,formatError:()=>t$,float64:()=>Tte,float32:()=>Pte,flattenError:()=>e$,file:()=>Bte,enum:()=>mn,endsWith:()=>J$,emoji:()=>fte,email:()=>ote,e164:()=>$te,discriminatedUnion:()=>OI,date:()=>Mte,custom:()=>dZ,cuid2:()=>hte,cuid:()=>mte,core:()=>vD,config:()=>rn,coerce:()=>mZ,clone:()=>Si,cidrv6:()=>Ste,cidrv4:()=>wte,check:()=>cZ,catch:()=>rZ,boolean:()=>pr,bigint:()=>Nte,base64url:()=>xte,base64:()=>kte,array:()=>lt,any:()=>Dte,_default:()=>J4,_ZodString:()=>uI,ZodXID:()=>gI,ZodVoid:()=>M4,ZodUnknown:()=>D4,ZodUnion:()=>TI,ZodUndefined:()=>C4,ZodUUID:()=>ho,ZodURL:()=>cI,ZodULID:()=>hI,ZodType:()=>Qe,ZodTuple:()=>F4,ZodTransform:()=>NI,ZodTemplateLiteral:()=>sZ,ZodSymbol:()=>j4,ZodSuccess:()=>eZ,ZodStringFormat:()=>Vt,ZodString:()=>Lg,ZodSet:()=>W4,ZodRecord:()=>zI,ZodRealError:()=>rf,ZodReadonly:()=>iZ,ZodPromise:()=>lZ,ZodPrefault:()=>Y4,ZodPipe:()=>AI,ZodOptional:()=>CI,ZodObject:()=>Gg,ZodNumberFormat:()=>Ku,ZodNumber:()=>qg,ZodNullable:()=>K4,ZodNull:()=>R4,ZodNonOptional:()=>RI,ZodNever:()=>U4,ZodNanoID:()=>fI,ZodNaN:()=>nZ,ZodMap:()=>V4,ZodLiteral:()=>G4,ZodLazy:()=>aZ,ZodKSUID:()=>yI,ZodJWT:()=>$I,ZodIssueCode:()=>rre,ZodIntersection:()=>q4,ZodISOTime:()=>sI,ZodISODuration:()=>aI,ZodISODateTime:()=>iI,ZodISODate:()=>oI,ZodIPv6:()=>_I,ZodIPv4:()=>vI,ZodGUID:()=>_g,ZodFile:()=>B4,ZodError:()=>ite,ZodEnum:()=>Qd,ZodEmoji:()=>dI,ZodEmail:()=>lI,ZodE164:()=>xI,ZodDiscriminatedUnion:()=>L4,ZodDefault:()=>H4,ZodDate:()=>PI,ZodCustomStringFormat:()=>N4,ZodCustom:()=>Kg,ZodCatch:()=>tZ,ZodCUID2:()=>mI,ZodCUID:()=>pI,ZodCIDRv6:()=>wI,ZodCIDRv4:()=>bI,ZodBoolean:()=>Fg,ZodBigIntFormat:()=>II,ZodBigInt:()=>Vg,ZodBase64URL:()=>kI,ZodBase64:()=>SI,ZodArray:()=>Z4,ZodAny:()=>A4,TimePrecision:()=>DM,NEVER:()=>_D,$output:()=>jM,$input:()=>CM,$brand:()=>bD});nI={};na(nI,{time:()=>$4,duration:()=>I4,datetime:()=>k4,date:()=>x4,ZodISOTime:()=>sI,ZodISODuration:()=>aI,ZodISODateTime:()=>iI,ZodISODate:()=>oI});iI=A("ZodISODateTime",(t,e)=>{LU.init(t,e),Vt.init(t,e)});oI=A("ZodISODate",(t,e)=>{qU.init(t,e),Vt.init(t,e)});sI=A("ZodISOTime",(t,e)=>{FU.init(t,e),Vt.init(t,e)});aI=A("ZodISODuration",(t,e)=>{VU.init(t,e),Vt.init(t,e)});E4=(t,e)=>{Xx.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>t$(t,r)},flatten:{value:r=>e$(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},ite=A("ZodError",E4),rf=A("ZodError",E4,{Parent:Error}),P4=r$(rf),T4=n$(rf),O4=i$(rf),z4=s$(rf),Qe=A("ZodType",(t,e)=>(Me.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),t.clone=(r,i)=>Si(t,r,i),t.brand=()=>t,t.register=(r,i)=>(r.add(t,i),t),t.parse=(r,i)=>P4(t,r,i,{callee:t.parse}),t.safeParse=(r,i)=>O4(t,r,i),t.parseAsync=async(r,i)=>T4(t,r,i,{callee:t.parseAsync}),t.safeParseAsync=async(r,i)=>z4(t,r,i),t.spa=t.safeParseAsync,t.refine=(r,i)=>t.check(fZ(r,i)),t.superRefine=r=>t.check(pZ(r)),t.overwrite=r=>t.check(sa(r)),t.optional=()=>Ft(t),t.nullable=()=>bg(t),t.nullish=()=>Ft(bg(t)),t.nonoptional=r=>X4(t,r),t.array=()=>lt(t),t.or=r=>At([t,r]),t.and=r=>Bg(t,r),t.transform=r=>wg(t,jI(r)),t.default=r=>J4(t,r),t.prefault=r=>Q4(t,r),t.catch=r=>rZ(t,r),t.pipe=r=>wg(t,r),t.readonly=()=>oZ(t),t.describe=r=>{let i=t.clone();return Ks.add(i,{description:r}),i},Object.defineProperty(t,"description",{get(){return Ks.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ks.get(t);let i=t.clone();return Ks.add(i,r[0]),i},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),uI=A("_ZodString",(t,e)=>{tf.init(t,e),Qe.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...i)=>t.check(W$(...i)),t.includes=(...i)=>t.check(K$(...i)),t.startsWith=(...i)=>t.check(H$(...i)),t.endsWith=(...i)=>t.check(J$(...i)),t.min=(...i)=>t.check(Lu(...i)),t.max=(...i)=>t.check(Mg(...i)),t.length=(...i)=>t.check(Zg(...i)),t.nonempty=(...i)=>t.check(Lu(1,...i)),t.lowercase=i=>t.check(G$(i)),t.uppercase=i=>t.check(B$(i)),t.trim=()=>t.check(X$()),t.normalize=(...i)=>t.check(Q$(...i)),t.toLowerCase=()=>t.check(eI()),t.toUpperCase=()=>t.check(tI())}),Lg=A("ZodString",(t,e)=>{tf.init(t,e),uI.init(t,e),t.email=r=>t.check(k$(lI,r)),t.url=r=>t.check(P$(cI,r)),t.jwt=r=>t.check(F$($I,r)),t.emoji=r=>t.check(T$(dI,r)),t.guid=r=>t.check(gg(_g,r)),t.uuid=r=>t.check(x$(ho,r)),t.uuidv4=r=>t.check($$(ho,r)),t.uuidv6=r=>t.check(I$(ho,r)),t.uuidv7=r=>t.check(E$(ho,r)),t.nanoid=r=>t.check(O$(fI,r)),t.guid=r=>t.check(gg(_g,r)),t.cuid=r=>t.check(z$(pI,r)),t.cuid2=r=>t.check(N$(mI,r)),t.ulid=r=>t.check(j$(hI,r)),t.base64=r=>t.check(Z$(SI,r)),t.base64url=r=>t.check(L$(kI,r)),t.xid=r=>t.check(C$(gI,r)),t.ksuid=r=>t.check(R$(yI,r)),t.ipv4=r=>t.check(A$(vI,r)),t.ipv6=r=>t.check(D$(_I,r)),t.cidrv4=r=>t.check(U$(bI,r)),t.cidrv6=r=>t.check(M$(wI,r)),t.e164=r=>t.check(q$(xI,r)),t.datetime=r=>t.check(k4(r)),t.date=r=>t.check(x4(r)),t.time=r=>t.check($4(r)),t.duration=r=>t.check(I4(r))});Vt=A("ZodStringFormat",(t,e)=>{Lt.init(t,e),uI.init(t,e)}),lI=A("ZodEmail",(t,e)=>{NU.init(t,e),Vt.init(t,e)});_g=A("ZodGUID",(t,e)=>{OU.init(t,e),Vt.init(t,e)});ho=A("ZodUUID",(t,e)=>{zU.init(t,e),Vt.init(t,e)});cI=A("ZodURL",(t,e)=>{jU.init(t,e),Vt.init(t,e)});dI=A("ZodEmoji",(t,e)=>{CU.init(t,e),Vt.init(t,e)});fI=A("ZodNanoID",(t,e)=>{RU.init(t,e),Vt.init(t,e)});pI=A("ZodCUID",(t,e)=>{AU.init(t,e),Vt.init(t,e)});mI=A("ZodCUID2",(t,e)=>{DU.init(t,e),Vt.init(t,e)});hI=A("ZodULID",(t,e)=>{UU.init(t,e),Vt.init(t,e)});gI=A("ZodXID",(t,e)=>{MU.init(t,e),Vt.init(t,e)});yI=A("ZodKSUID",(t,e)=>{ZU.init(t,e),Vt.init(t,e)});vI=A("ZodIPv4",(t,e)=>{WU.init(t,e),Vt.init(t,e)});_I=A("ZodIPv6",(t,e)=>{GU.init(t,e),Vt.init(t,e)});bI=A("ZodCIDRv4",(t,e)=>{BU.init(t,e),Vt.init(t,e)});wI=A("ZodCIDRv6",(t,e)=>{KU.init(t,e),Vt.init(t,e)});SI=A("ZodBase64",(t,e)=>{HU.init(t,e),Vt.init(t,e)});kI=A("ZodBase64URL",(t,e)=>{YU.init(t,e),Vt.init(t,e)});xI=A("ZodE164",(t,e)=>{QU.init(t,e),Vt.init(t,e)});$I=A("ZodJWT",(t,e)=>{eM.init(t,e),Vt.init(t,e)});N4=A("ZodCustomStringFormat",(t,e)=>{tM.init(t,e),Vt.init(t,e)});qg=A("ZodNumber",(t,e)=>{p$.init(t,e),Qe.init(t,e),t.gt=(i,n)=>t.check(ra(i,n)),t.gte=(i,n)=>t.check(On(i,n)),t.min=(i,n)=>t.check(On(i,n)),t.lt=(i,n)=>t.check(ta(i,n)),t.lte=(i,n)=>t.check(vi(i,n)),t.max=(i,n)=>t.check(vi(i,n)),t.int=i=>t.check(Ox(i)),t.safe=i=>t.check(Ox(i)),t.positive=i=>t.check(ra(0,i)),t.nonnegative=i=>t.check(On(0,i)),t.negative=i=>t.check(ta(0,i)),t.nonpositive=i=>t.check(vi(0,i)),t.multipleOf=(i,n)=>t.check(Hd(i,n)),t.step=(i,n)=>t.check(Hd(i,n)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});Ku=A("ZodNumberFormat",(t,e)=>{rM.init(t,e),qg.init(t,e)});Fg=A("ZodBoolean",(t,e)=>{m$.init(t,e),Qe.init(t,e)});Vg=A("ZodBigInt",(t,e)=>{h$.init(t,e),Qe.init(t,e),t.gte=(i,n)=>t.check(On(i,n)),t.min=(i,n)=>t.check(On(i,n)),t.gt=(i,n)=>t.check(ra(i,n)),t.gte=(i,n)=>t.check(On(i,n)),t.min=(i,n)=>t.check(On(i,n)),t.lt=(i,n)=>t.check(ta(i,n)),t.lte=(i,n)=>t.check(vi(i,n)),t.max=(i,n)=>t.check(vi(i,n)),t.positive=i=>t.check(ra(BigInt(0),i)),t.negative=i=>t.check(ta(BigInt(0),i)),t.nonpositive=i=>t.check(vi(BigInt(0),i)),t.nonnegative=i=>t.check(On(BigInt(0),i)),t.multipleOf=(i,n)=>t.check(Hd(i,n));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});II=A("ZodBigIntFormat",(t,e)=>{nM.init(t,e),Vg.init(t,e)});j4=A("ZodSymbol",(t,e)=>{iM.init(t,e),Qe.init(t,e)});C4=A("ZodUndefined",(t,e)=>{oM.init(t,e),Qe.init(t,e)});R4=A("ZodNull",(t,e)=>{sM.init(t,e),Qe.init(t,e)});A4=A("ZodAny",(t,e)=>{aM.init(t,e),Qe.init(t,e)});D4=A("ZodUnknown",(t,e)=>{hg.init(t,e),Qe.init(t,e)});U4=A("ZodNever",(t,e)=>{uM.init(t,e),Qe.init(t,e)});M4=A("ZodVoid",(t,e)=>{lM.init(t,e),Qe.init(t,e)});PI=A("ZodDate",(t,e)=>{cM.init(t,e),Qe.init(t,e),t.min=(i,n)=>t.check(On(i,n)),t.max=(i,n)=>t.check(vi(i,n));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});Z4=A("ZodArray",(t,e)=>{g$.init(t,e),Qe.init(t,e),t.element=e.element,t.min=(r,i)=>t.check(Lu(r,i)),t.nonempty=r=>t.check(Lu(1,r)),t.max=(r,i)=>t.check(Mg(r,i)),t.length=(r,i)=>t.check(Zg(r,i)),t.unwrap=()=>t.element});Gg=A("ZodObject",(t,e)=>{y$.init(t,e),Qe.init(t,e),ut.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>mn(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Ht()}),t.loose=()=>t.clone({...t._zod.def,catchall:Ht()}),t.strict=()=>t.clone({...t._zod.def,catchall:Wg()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>ut.extend(t,r),t.merge=r=>ut.merge(t,r),t.pick=r=>ut.pick(t,r),t.omit=r=>ut.omit(t,r),t.partial=(...r)=>ut.partial(CI,t,r[0]),t.required=(...r)=>ut.required(RI,t,r[0])});TI=A("ZodUnion",(t,e)=>{v$.init(t,e),Qe.init(t,e),t.options=e.options});L4=A("ZodDiscriminatedUnion",(t,e)=>{TI.init(t,e),dM.init(t,e)});q4=A("ZodIntersection",(t,e)=>{fM.init(t,e),Qe.init(t,e)});F4=A("ZodTuple",(t,e)=>{Dg.init(t,e),Qe.init(t,e),t.rest=r=>t.clone({...t._zod.def,rest:r})});zI=A("ZodRecord",(t,e)=>{pM.init(t,e),Qe.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});V4=A("ZodMap",(t,e)=>{mM.init(t,e),Qe.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});W4=A("ZodSet",(t,e)=>{hM.init(t,e),Qe.init(t,e),t.min=(...r)=>t.check(Jd(...r)),t.nonempty=r=>t.check(Jd(1,r)),t.max=(...r)=>t.check(Ug(...r)),t.size=(...r)=>t.check(V$(...r))});Qd=A("ZodEnum",(t,e)=>{gM.init(t,e),Qe.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(i,n)=>{let o={};for(let s of i)if(r.has(s))o[s]=e.entries[s];else throw Error(`Key ${s} not found in enum`);return new Qd({...e,checks:[],...ut.normalizeParams(n),entries:o})},t.exclude=(i,n)=>{let o={...e.entries};for(let s of i)if(r.has(s))delete o[s];else throw Error(`Key ${s} not found in enum`);return new Qd({...e,checks:[],...ut.normalizeParams(n),entries:o})}});G4=A("ZodLiteral",(t,e)=>{yM.init(t,e),Qe.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});B4=A("ZodFile",(t,e)=>{vM.init(t,e),Qe.init(t,e),t.min=(r,i)=>t.check(Jd(r,i)),t.max=(r,i)=>t.check(Ug(r,i)),t.mime=(r,i)=>t.check(Y$(Array.isArray(r)?r:[r],i))});NI=A("ZodTransform",(t,e)=>{_$.init(t,e),Qe.init(t,e),t._zod.parse=(r,i)=>{r.addIssue=o=>{if(typeof o=="string")r.issues.push(ut.issue(o,r.value,e));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),s.continue??(s.continue=!0),r.issues.push(ut.issue(s))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(o=>(r.value=o,r)):(r.value=n,r)}});CI=A("ZodOptional",(t,e)=>{_M.init(t,e),Qe.init(t,e),t.unwrap=()=>t._zod.def.innerType});K4=A("ZodNullable",(t,e)=>{bM.init(t,e),Qe.init(t,e),t.unwrap=()=>t._zod.def.innerType});H4=A("ZodDefault",(t,e)=>{wM.init(t,e),Qe.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});Y4=A("ZodPrefault",(t,e)=>{SM.init(t,e),Qe.init(t,e),t.unwrap=()=>t._zod.def.innerType});RI=A("ZodNonOptional",(t,e)=>{kM.init(t,e),Qe.init(t,e),t.unwrap=()=>t._zod.def.innerType});eZ=A("ZodSuccess",(t,e)=>{xM.init(t,e),Qe.init(t,e),t.unwrap=()=>t._zod.def.innerType});tZ=A("ZodCatch",(t,e)=>{$M.init(t,e),Qe.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});nZ=A("ZodNaN",(t,e)=>{IM.init(t,e),Qe.init(t,e)});AI=A("ZodPipe",(t,e)=>{b$.init(t,e),Qe.init(t,e),t.in=e.in,t.out=e.out});iZ=A("ZodReadonly",(t,e)=>{EM.init(t,e),Qe.init(t,e)});sZ=A("ZodTemplateLiteral",(t,e)=>{PM.init(t,e),Qe.init(t,e)});aZ=A("ZodLazy",(t,e)=>{OM.init(t,e),Qe.init(t,e),t.unwrap=()=>t._zod.def.getter()});lZ=A("ZodPromise",(t,e)=>{TM.init(t,e),Qe.init(t,e),t.unwrap=()=>t._zod.def.innerType});Kg=A("ZodCustom",(t,e)=>{zM.init(t,e),Qe.init(t,e)});ere=(...t)=>_4({Pipe:AI,Boolean:Fg,String:Lg,Transform:NI},...t);rre={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};mZ={};na(mZ,{string:()=>ore,number:()=>sre,date:()=>lre,boolean:()=>are,bigint:()=>ure});rn(NM());cre="io.modelcontextprotocol/related-task",Hg="2.0",mr=dZ(t=>t!==null&&(typeof t=="object"||typeof t=="function")),hZ=At([V(),xt().int()]),gZ=V(),zPe=Xr({ttl:xt().optional(),pollInterval:xt().optional()}),dre=de({ttl:xt().optional()}),fre=de({taskId:V()}),UI=Xr({progressToken:hZ.optional(),[cre]:fre.optional()}),Cn=de({_meta:UI.optional()}),Jg=Cn.extend({task:dre.optional()}),wr=de({method:V(),params:Cn.loose().optional()}),Yn=de({_meta:UI.optional()}),Qn=de({method:V(),params:Yn.loose().optional()}),Sr=Xr({_meta:UI.optional()}),Yg=At([V(),xt().int()]),pre=de({jsonrpc:we(Hg),id:Yg,...wr.shape}).strict(),mre=de({jsonrpc:we(Hg),...Qn.shape}).strict(),yZ=de({jsonrpc:we(Hg),id:Yg,result:Sr}).strict();(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(aA||(aA={}));vZ=de({jsonrpc:we(Hg),id:Yg.optional(),error:de({code:xt().int(),message:V(),data:Ht().optional()})}).strict(),NPe=At([pre,mre,yZ,vZ]),jPe=At([yZ,vZ]),_Z=Sr.strict(),hre=Yn.extend({requestId:Yg.optional(),reason:V().optional()}),bZ=Qn.extend({method:we("notifications/cancelled"),params:hre}),gre=de({src:V(),mimeType:V().optional(),sizes:lt(V()).optional(),theme:mn(["light","dark"]).optional()}),nf=de({icons:lt(gre).optional()}),qu=de({name:V(),title:V().optional()}),wZ=qu.extend({...qu.shape,...nf.shape,version:V(),websiteUrl:V().optional(),description:V().optional()}),yre=Bg(de({applyDefaults:pr().optional()}),Rt(V(),Ht())),vre=DI(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Bg(de({form:yre.optional(),url:mr.optional()}),Rt(V(),Ht()).optional())),_re=Xr({list:mr.optional(),cancel:mr.optional(),requests:Xr({sampling:Xr({createMessage:mr.optional()}).optional(),elicitation:Xr({create:mr.optional()}).optional()}).optional()}),bre=Xr({list:mr.optional(),cancel:mr.optional(),requests:Xr({tools:Xr({call:mr.optional()}).optional()}).optional()}),wre=de({experimental:Rt(V(),mr).optional(),sampling:de({context:mr.optional(),tools:mr.optional()}).optional(),elicitation:vre.optional(),roots:de({listChanged:pr().optional()}).optional(),tasks:_re.optional(),extensions:Rt(V(),mr).optional()}),Sre=Cn.extend({protocolVersion:V(),capabilities:wre,clientInfo:wZ}),kre=wr.extend({method:we("initialize"),params:Sre}),xre=de({experimental:Rt(V(),mr).optional(),logging:mr.optional(),completions:mr.optional(),prompts:de({listChanged:pr().optional()}).optional(),resources:de({subscribe:pr().optional(),listChanged:pr().optional()}).optional(),tools:de({listChanged:pr().optional()}).optional(),tasks:bre.optional(),extensions:Rt(V(),mr).optional()}),$re=Sr.extend({protocolVersion:V(),capabilities:xre,serverInfo:wZ,instructions:V().optional()}),Ire=Qn.extend({method:we("notifications/initialized"),params:Yn.optional()}),SZ=wr.extend({method:we("ping"),params:Cn.optional()}),Ere=de({progress:xt(),total:Ft(xt()),message:Ft(V())}),Pre=de({...Yn.shape,...Ere.shape,progressToken:hZ}),kZ=Qn.extend({method:we("notifications/progress"),params:Pre}),Tre=Cn.extend({cursor:gZ.optional()}),of=wr.extend({params:Tre.optional()}),sf=Sr.extend({nextCursor:gZ.optional()}),Ore=mn(["working","input_required","completed","failed","cancelled"]),af=de({taskId:V(),status:Ore,ttl:At([xt(),EI()]),createdAt:V(),lastUpdatedAt:V(),pollInterval:Ft(xt()),statusMessage:Ft(V())}),xZ=Sr.extend({task:af}),zre=Yn.merge(af),$Z=Qn.extend({method:we("notifications/tasks/status"),params:zre}),IZ=wr.extend({method:we("tasks/get"),params:Cn.extend({taskId:V()})}),EZ=Sr.merge(af),PZ=wr.extend({method:we("tasks/result"),params:Cn.extend({taskId:V()})}),CPe=Sr.loose(),TZ=of.extend({method:we("tasks/list")}),OZ=sf.extend({tasks:lt(af)}),zZ=wr.extend({method:we("tasks/cancel"),params:Cn.extend({taskId:V()})}),RPe=Sr.merge(af),NZ=de({uri:V(),mimeType:Ft(V()),_meta:Rt(V(),Ht()).optional()}),jZ=NZ.extend({text:V()}),MI=V().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),CZ=NZ.extend({blob:MI}),uf=mn(["user","assistant"]),Hu=de({audience:lt(uf).optional(),priority:xt().min(0).max(1).optional(),lastModified:nI.datetime({offset:!0}).optional()}),RZ=de({...qu.shape,...nf.shape,uri:V(),description:Ft(V()),mimeType:Ft(V()),size:Ft(xt()),annotations:Hu.optional(),_meta:Ft(Xr({}))}),Nre=de({...qu.shape,...nf.shape,uriTemplate:V(),description:Ft(V()),mimeType:Ft(V()),annotations:Hu.optional(),_meta:Ft(Xr({}))}),jre=of.extend({method:we("resources/list")}),Cre=sf.extend({resources:lt(RZ)}),Rre=of.extend({method:we("resources/templates/list")}),Are=sf.extend({resourceTemplates:lt(Nre)}),ZI=Cn.extend({uri:V()}),Dre=ZI,Ure=wr.extend({method:we("resources/read"),params:Dre}),Mre=Sr.extend({contents:lt(At([jZ,CZ]))}),Zre=Qn.extend({method:we("notifications/resources/list_changed"),params:Yn.optional()}),Lre=ZI,qre=wr.extend({method:we("resources/subscribe"),params:Lre}),Fre=ZI,Vre=wr.extend({method:we("resources/unsubscribe"),params:Fre}),Wre=Yn.extend({uri:V()}),Gre=Qn.extend({method:we("notifications/resources/updated"),params:Wre}),Bre=de({name:V(),description:Ft(V()),required:Ft(pr())}),Kre=de({...qu.shape,...nf.shape,description:Ft(V()),arguments:Ft(lt(Bre)),_meta:Ft(Xr({}))}),Hre=of.extend({method:we("prompts/list")}),Jre=sf.extend({prompts:lt(Kre)}),Yre=Cn.extend({name:V(),arguments:Rt(V(),V()).optional()}),Qre=wr.extend({method:we("prompts/get"),params:Yre}),LI=de({type:we("text"),text:V(),annotations:Hu.optional(),_meta:Rt(V(),Ht()).optional()}),qI=de({type:we("image"),data:MI,mimeType:V(),annotations:Hu.optional(),_meta:Rt(V(),Ht()).optional()}),FI=de({type:we("audio"),data:MI,mimeType:V(),annotations:Hu.optional(),_meta:Rt(V(),Ht()).optional()}),Xre=de({type:we("tool_use"),name:V(),id:V(),input:Rt(V(),Ht()),_meta:Rt(V(),Ht()).optional()}),ene=de({type:we("resource"),resource:At([jZ,CZ]),annotations:Hu.optional(),_meta:Rt(V(),Ht()).optional()}),tne=RZ.extend({type:we("resource_link")}),VI=At([LI,qI,FI,tne,ene]),rne=de({role:uf,content:VI}),nne=Sr.extend({description:V().optional(),messages:lt(rne)}),ine=Qn.extend({method:we("notifications/prompts/list_changed"),params:Yn.optional()}),one=de({title:V().optional(),readOnlyHint:pr().optional(),destructiveHint:pr().optional(),idempotentHint:pr().optional(),openWorldHint:pr().optional()}),sne=de({taskSupport:mn(["required","optional","forbidden"]).optional()}),AZ=de({...qu.shape,...nf.shape,description:V().optional(),inputSchema:de({type:we("object"),properties:Rt(V(),mr).optional(),required:lt(V()).optional()}).catchall(Ht()),outputSchema:de({type:we("object"),properties:Rt(V(),mr).optional(),required:lt(V()).optional()}).catchall(Ht()).optional(),annotations:one.optional(),execution:sne.optional(),_meta:Rt(V(),Ht()).optional()}),ane=of.extend({method:we("tools/list")}),une=sf.extend({tools:lt(AZ)}),DZ=Sr.extend({content:lt(VI).default([]),structuredContent:Rt(V(),Ht()).optional(),isError:pr().optional()}),APe=DZ.or(Sr.extend({toolResult:Ht()})),lne=Jg.extend({name:V(),arguments:Rt(V(),Ht()).optional()}),cne=wr.extend({method:we("tools/call"),params:lne}),dne=Qn.extend({method:we("notifications/tools/list_changed"),params:Yn.optional()}),DPe=de({autoRefresh:pr().default(!0),debounceMs:xt().int().nonnegative().default(300)}),UZ=mn(["debug","info","notice","warning","error","critical","alert","emergency"]),fne=Cn.extend({level:UZ}),pne=wr.extend({method:we("logging/setLevel"),params:fne}),mne=Yn.extend({level:UZ,logger:V().optional(),data:Ht()}),hne=Qn.extend({method:we("notifications/message"),params:mne}),gne=de({name:V().optional()}),yne=de({hints:lt(gne).optional(),costPriority:xt().min(0).max(1).optional(),speedPriority:xt().min(0).max(1).optional(),intelligencePriority:xt().min(0).max(1).optional()}),vne=de({mode:mn(["auto","required","none"]).optional()}),_ne=de({type:we("tool_result"),toolUseId:V().describe("The unique identifier for the corresponding tool call."),content:lt(VI).default([]),structuredContent:de({}).loose().optional(),isError:pr().optional(),_meta:Rt(V(),Ht()).optional()}),bne=OI("type",[LI,qI,FI]),Sg=OI("type",[LI,qI,FI,Xre,_ne]),wne=de({role:uf,content:At([Sg,lt(Sg)]),_meta:Rt(V(),Ht()).optional()}),Sne=Jg.extend({messages:lt(wne),modelPreferences:yne.optional(),systemPrompt:V().optional(),includeContext:mn(["none","thisServer","allServers"]).optional(),temperature:xt().optional(),maxTokens:xt().int(),stopSequences:lt(V()).optional(),metadata:mr.optional(),tools:lt(AZ).optional(),toolChoice:vne.optional()}),kne=wr.extend({method:we("sampling/createMessage"),params:Sne}),xne=Sr.extend({model:V(),stopReason:Ft(mn(["endTurn","stopSequence","maxTokens"]).or(V())),role:uf,content:bne}),$ne=Sr.extend({model:V(),stopReason:Ft(mn(["endTurn","stopSequence","maxTokens","toolUse"]).or(V())),role:uf,content:At([Sg,lt(Sg)])}),Ine=de({type:we("boolean"),title:V().optional(),description:V().optional(),default:pr().optional()}),Ene=de({type:we("string"),title:V().optional(),description:V().optional(),minLength:xt().optional(),maxLength:xt().optional(),format:mn(["email","uri","date","date-time"]).optional(),default:V().optional()}),Pne=de({type:mn(["number","integer"]),title:V().optional(),description:V().optional(),minimum:xt().optional(),maximum:xt().optional(),default:xt().optional()}),Tne=de({type:we("string"),title:V().optional(),description:V().optional(),enum:lt(V()),default:V().optional()}),One=de({type:we("string"),title:V().optional(),description:V().optional(),oneOf:lt(de({const:V(),title:V()})),default:V().optional()}),zne=de({type:we("string"),title:V().optional(),description:V().optional(),enum:lt(V()),enumNames:lt(V()).optional(),default:V().optional()}),Nne=At([Tne,One]),jne=de({type:we("array"),title:V().optional(),description:V().optional(),minItems:xt().optional(),maxItems:xt().optional(),items:de({type:we("string"),enum:lt(V())}),default:lt(V()).optional()}),Cne=de({type:we("array"),title:V().optional(),description:V().optional(),minItems:xt().optional(),maxItems:xt().optional(),items:de({anyOf:lt(de({const:V(),title:V()}))}),default:lt(V()).optional()}),Rne=At([jne,Cne]),Ane=At([zne,Nne,Rne]),Dne=At([Ane,Ine,Ene,Pne]),Une=Jg.extend({mode:we("form").optional(),message:V(),requestedSchema:de({type:we("object"),properties:Rt(V(),Dne),required:lt(V()).optional()})}),Mne=Jg.extend({mode:we("url"),message:V(),elicitationId:V(),url:V().url()}),Zne=At([Une,Mne]),Lne=wr.extend({method:we("elicitation/create"),params:Zne}),qne=Yn.extend({elicitationId:V()}),Fne=Qn.extend({method:we("notifications/elicitation/complete"),params:qne}),Vne=Sr.extend({action:mn(["accept","decline","cancel"]),content:DI(t=>t===null?void 0:t,Rt(V(),At([V(),xt(),pr(),lt(V())])).optional())}),Wne=de({type:we("ref/resource"),uri:V()}),Gne=de({type:we("ref/prompt"),name:V()}),Bne=Cn.extend({ref:At([Gne,Wne]),argument:de({name:V(),value:V()}),context:de({arguments:Rt(V(),V()).optional()}).optional()}),Kne=wr.extend({method:we("completion/complete"),params:Bne}),Hne=Sr.extend({completion:Xr({values:lt(V()).max(100),total:Ft(xt().int()),hasMore:Ft(pr())})}),Jne=de({uri:V().startsWith("file://"),name:V().optional(),_meta:Rt(V(),Ht()).optional()}),Yne=wr.extend({method:we("roots/list"),params:Cn.optional()}),Qne=Sr.extend({roots:lt(Jne)}),Xne=Qn.extend({method:we("notifications/roots/list_changed"),params:Yn.optional()}),UPe=At([SZ,kre,Kne,pne,Qre,Hre,jre,Rre,Ure,qre,Vre,cne,ane,IZ,PZ,TZ,zZ]),MPe=At([bZ,kZ,Ire,Xne,$Z]),ZPe=At([_Z,xne,$ne,Vne,Qne,EZ,OZ,xZ]),LPe=At([SZ,kne,Lne,Yne,IZ,PZ,TZ,zZ]),qPe=At([bZ,kZ,hne,Gre,Zre,dne,ine,$Z,Fne]),FPe=At([_Z,$re,Hne,nne,Jre,Cre,Are,Mre,DZ,une,EZ,OZ,xZ]),VPe=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"),WPe=kg(PA(),1),GPe=kg(YJ(),1);(function(t){t.Completable="McpCompletable"})(uA||(uA={}));BPe=eie(()=>bu.object({session_id:bu.string(),ws_url:bu.string(),work_dir:bu.string().optional(),session_key:bu.string().optional()}));oie=new Set(["EBUSY","EMFILE","ENFILE","ENOTEMPTY","EPERM"])});var Ju,FZ=N(()=>{_s();qZ();Ro();Un();vs();To();Xi();Ju=class extends Vr{constructor(){super("claude","Claude (Anthropic API)",50)}canHandle(e){let r=!!process.env.ANTHROPIC_API_KEY;return r||U.debug("ClaudeAgentStrategy: ANTHROPIC_API_KEY not set"),r}async invoke(e,r={}){let{model:i,workspace:n=process.cwd(),schema:o=null,images:s=[],skills:a=null,sessionPath:u=null,nodeName:l=null,timeout:c,config:d={}}=r,p=i;(!p||p==="auto")&&(U.debug(`Model is '${p||"undefined"}', using default: ${Tr.CLAUDE}`),p=Tr.CLAUDE);let f=f_[p]||p;f_[p]&&p!==f&&U.debug(`Mapped model: ${p} \u2192 ${f}`),U.debug(`Invoking Claude Agent SDK with model: ${f}, skills: ${JSON.stringify(a)}`);let m=process.env.ANTHROPIC_API_KEY,g=m?` | key: ***${m.slice(-4)}`:" | key: not set";console.log(`
206
- \u25C6 Model: ${f}${g}
207
- `);let v=(await import("chalk")).default;console.log(`
208
- ${v.bold("Prompt sent to LLM:")}`),console.log(v.dim("\u2500".repeat(60))),console.log(v.dim(e)),console.log(v.dim("\u2500".repeat(60)));let{allowedTools:h,mcpServers:y}=this._resolveSkills(a,{sessionPath:u,workspace:n,nodeName:l});try{let _={cwd:n,allowedTools:h,permissionMode:"bypassPermissions",model:f,...Object.keys(y).length>0&&{mcpServers:y}};if(o){let R=typeof o.parse=="function"?Gr(o,{target:"openApi3"}):o;_.outputFormat={type:"json_schema",schema:R},U.debug("Structured output enforced via SDK outputFormat")}U.debug(`Agent SDK options: ${JSON.stringify({cwd:_.cwd,toolCount:h.length,permissionMode:_.permissionMode,model:_.model,hasOutputFormat:!!_.outputFormat})}`);let b="",w=0,S=[];U.debug("Starting Claude Agent SDK query stream");let k;try{k=ZZ({prompt:e,options:_})}catch(I){throw U.error(`Failed to initialize Claude Agent SDK: ${I.message}`),I}let $=null,P=0,j=3;try{for await(let I of k){if(S.push(I),I.type==="error"||I.error){let q=I.error?.message||I.error||I.message||"Unknown API error";throw new Error(typeof q=="string"?q:JSON.stringify(q))}let R=JSON.stringify(I.message?.content||I.text||"").slice(0,200);if(R===$){if(P++,P>=j){let q=(I.message?.content?.[0]?.text||I.text||"unknown").slice(0,100);throw new Error(`API stuck in loop (${P}x repeated): ${q}`)}}else $=R,P=1;if(I.type==="assistant"||I.constructor?.name==="AssistantMessage"){let q=I.message?.content||I.content||[];for(let O of q)if(O.type==="thinking"&&O.thinking)console.log(`${O.thinking.substring(0,200)}${O.thinking.length>200?"...":""}`);else if(O.type==="text"&&O.text)b+=O.text,O.text.length<500?console.log(`${O.text}`):console.log(`${O.text.substring(0,200)}... (${O.text.length} chars)`);else if(O.type==="tool_use"){w++,O.name.includes("memory")?Mt.stepMemory(`Tool: ${O.name}`):Mt.stepTool(`Tool: ${O.name}`);let K=JSON.stringify(O.input).substring(0,100);console.log(` Input: ${K}${JSON.stringify(O.input).length>100?"...":""}`)}}else if(!(I.type==="user"&&I.tool_use_result)){if(I.type==="result"||I.constructor?.name==="ResultMessage"){let q=I.result||I.text||I.content||b;if(o){if(I.structured_output){U.debug("Using SDK native structured_output");let Q=typeof o.parse=="function"?o.parse(I.structured_output):I.structured_output;return{raw:q,structured:Q}}if(q){let O=this._extractJson(q,o);if(O)return{raw:q,structured:O}}U.warn(`Could not extract structured output \u2014 returning raw text (${(q||"").length} chars)`)}return q||""}}}if(U.warn(`Agent SDK ended without result. Collected ${S.length} messages`),b.length>0)return U.debug("Returning accumulated text from messages"),b;throw new Error("Claude Agent SDK query ended without result")}catch(I){throw U.error(`Error during query stream: ${I.message}`),I}}catch(_){throw U.error("Claude Agent SDK call failed",{error:_.message}),_}}_resolveSkills(e,r){if(e===null)return U.debug("No skills \u2014 pure LLM mode"),{allowedTools:[],mcpServers:{}};if(!Array.isArray(e)||e.length===0)return U.debug("Default IDE skills for code generation"),{allowedTools:["Read","Write","Bash","Grep","Glob"],mcpServers:{}};let i=[],n={};for(let o of e){let s=Or(o);if(!s){U.warn(`Unknown skill "${o}" \u2014 skipping`);continue}if(s.allowedTools&&i.push(...s.allowedTools),typeof s.resolve=="function"){let a=s.resolve(r);a&&(n[s.serverName]=a,U.debug(`MCP: ${s.serverName} \u2192 ${a.command} ${a.args[0]}`))}}return{allowedTools:i,mcpServers:n}}_extractJson(e,r){let i=[()=>{if(e.includes("===JSON_START===")){let n=e.indexOf("===JSON_START===")+16,o=e.indexOf("===JSON_END===");return e.substring(n,o).trim()}},()=>e.match(/```json\s*\n([\s\S]*?)\n```/)?.[1]?.trim(),()=>{if(!e.startsWith("{"))return e.match(/```\s*\n([\s\S]*?)\n```/)?.[1]?.trim()},()=>e.trim(),()=>{let n=e.indexOf("{"),o=e.lastIndexOf("}");if(n!==-1&&o>n)return e.substring(n,o+1)}];for(let n of i)try{let o=n();if(!o)continue;let s=JSON.parse(o);if(typeof s!="object"||s===null)continue;return typeof r.parse=="function"?r.parse(s):s}catch{}return null}}});var HZ={};An(HZ,{Codex:()=>kie,Thread:()=>GI});import{promises as WI}from"fs";import lie from"os";import VZ from"path";import{spawn as pie}from"child_process";import Qg from"path";import mie from"readline";import{createRequire as BZ}from"module";async function cie(t){if(t===void 0)return{cleanup:async()=>{}};if(!die(t))throw new Error("outputSchema must be a plain JSON object");let e=await WI.mkdtemp(VZ.join(lie.tmpdir(),"codex-output-schema-")),r=VZ.join(e,"schema.json"),i=async()=>{try{await WI.rm(e,{recursive:!0,force:!0})}catch{}};try{return await WI.writeFile(r,JSON.stringify(t),"utf8"),{schemaPath:r,cleanup:i}}catch(n){throw await i(),n}}function die(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function fie(t){if(typeof t=="string")return{prompt:t,images:[]};let e=[],r=[];for(let i of t)i.type==="text"?e.push(i.text):i.type==="local_image"&&r.push(i.path);return{prompt:e.join(`
209
-
210
- `),images:r}}function _ie(t){let e=[];return KZ(t,"",e),e}function KZ(t,e,r){if(!BI(t))if(e){r.push(`${e}=${lf(t,e)}`);return}else throw new Error("Codex config overrides must be a plain object");let i=Object.entries(t);if(!(!e&&i.length===0)){if(e&&i.length===0){r.push(`${e}={}`);return}for(let[n,o]of i){if(!n)throw new Error("Codex config override keys must be non-empty strings");if(o===void 0)continue;let s=e?`${e}.${n}`:n;BI(o)?KZ(o,s,r):r.push(`${s}=${lf(o,s)}`)}}}function lf(t,e){if(typeof t=="string")return JSON.stringify(t);if(typeof t=="number"){if(!Number.isFinite(t))throw new Error(`Codex config override at ${e} must be a finite number`);return`${t}`}else{if(typeof t=="boolean")return t?"true":"false";if(Array.isArray(t))return`[${t.map((i,n)=>lf(i,`${e}[${n}]`)).join(", ")}]`;if(BI(t)){let r=[];for(let[i,n]of Object.entries(t)){if(!i)throw new Error("Codex config override keys must be non-empty strings");n!==void 0&&r.push(`${wie(i)} = ${lf(n,`${e}.${i}`)}`)}return`{${r.join(", ")}}`}else{if(t===null)throw new Error(`Codex config override at ${e} cannot be null`);{let r=typeof t;throw new Error(`Unsupported Codex config override value at ${e}: ${r}`)}}}}function wie(t){return bie.test(t)?t:JSON.stringify(t)}function BI(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Sie(){let{platform:t,arch:e}=process,r=null;switch(t){case"linux":case"android":switch(e){case"x64":r="x86_64-unknown-linux-musl";break;case"arm64":r="aarch64-unknown-linux-musl";break;default:break}break;case"darwin":switch(e){case"x64":r="x86_64-apple-darwin";break;case"arm64":r="aarch64-apple-darwin";break;default:break}break;case"win32":switch(e){case"x64":r="x86_64-pc-windows-msvc";break;case"arm64":r="aarch64-pc-windows-msvc";break;default:break}break;default:break}if(!r)throw new Error(`Unsupported platform: ${t} (${e})`);let i=gie[r];if(!i)throw new Error(`Unsupported target triple: ${r}`);let n;try{let u=yie.resolve(`${GZ}/package.json`),c=BZ(u).resolve(`${i}/package.json`);n=Qg.join(Qg.dirname(c),"vendor")}catch{throw new Error(`Unable to locate Codex CLI binaries. Ensure ${GZ} is installed with optional dependencies.`)}let o=Qg.join(n,r),s=process.platform==="win32"?"codex.exe":"codex";return Qg.join(o,"codex",s)}var GI,WZ,hie,GZ,gie,yie,vie,bie,kie,JZ=N(()=>{GI=class{_exec;_options;_id;_threadOptions;get id(){return this._id}constructor(t,e,r,i=null){this._exec=t,this._options=e,this._id=i,this._threadOptions=r}async runStreamed(t,e={}){return{events:this.runStreamedInternal(t,e)}}async*runStreamedInternal(t,e={}){let{schemaPath:r,cleanup:i}=await cie(e.outputSchema),n=this._threadOptions,{prompt:o,images:s}=fie(t),a=this._exec.run({input:o,baseUrl:this._options.baseUrl,apiKey:this._options.apiKey,threadId:this._id,images:s,model:n?.model,sandboxMode:n?.sandboxMode,workingDirectory:n?.workingDirectory,skipGitRepoCheck:n?.skipGitRepoCheck,outputSchemaFile:r,modelReasoningEffort:n?.modelReasoningEffort,signal:e.signal,networkAccessEnabled:n?.networkAccessEnabled,webSearchMode:n?.webSearchMode,webSearchEnabled:n?.webSearchEnabled,approvalPolicy:n?.approvalPolicy,additionalDirectories:n?.additionalDirectories});try{for await(let u of a){let l;try{l=JSON.parse(u)}catch(c){throw new Error(`Failed to parse item: ${u}`,{cause:c})}l.type==="thread.started"&&(this._id=l.thread_id),yield l}}finally{await i()}}async run(t,e={}){let r=this.runStreamedInternal(t,e),i=[],n="",o=null,s=null;for await(let a of r)if(a.type==="item.completed")a.item.type==="agent_message"&&(n=a.item.text),i.push(a.item);else if(a.type==="turn.completed")o=a.usage;else if(a.type==="turn.failed"){s=a.error;break}if(s)throw new Error(s.message);return{items:i,finalResponse:n,usage:o}}};WZ="CODEX_INTERNAL_ORIGINATOR_OVERRIDE",hie="codex_sdk_ts",GZ="@openai/codex",gie={"x86_64-unknown-linux-musl":"@openai/codex-linux-x64","aarch64-unknown-linux-musl":"@openai/codex-linux-arm64","x86_64-apple-darwin":"@openai/codex-darwin-x64","aarch64-apple-darwin":"@openai/codex-darwin-arm64","x86_64-pc-windows-msvc":"@openai/codex-win32-x64","aarch64-pc-windows-msvc":"@openai/codex-win32-arm64"},yie=BZ(import.meta.url),vie=class{executablePath;envOverride;configOverrides;constructor(t=null,e,r){this.executablePath=t||Sie(),this.envOverride=e,this.configOverrides=r}async*run(t){let e=["exec","--experimental-json"];if(this.configOverrides)for(let u of _ie(this.configOverrides))e.push("--config",u);if(t.baseUrl&&e.push("--config",`openai_base_url=${lf(t.baseUrl,"openai_base_url")}`),t.model&&e.push("--model",t.model),t.sandboxMode&&e.push("--sandbox",t.sandboxMode),t.workingDirectory&&e.push("--cd",t.workingDirectory),t.additionalDirectories?.length)for(let u of t.additionalDirectories)e.push("--add-dir",u);if(t.skipGitRepoCheck&&e.push("--skip-git-repo-check"),t.outputSchemaFile&&e.push("--output-schema",t.outputSchemaFile),t.modelReasoningEffort&&e.push("--config",`model_reasoning_effort="${t.modelReasoningEffort}"`),t.networkAccessEnabled!==void 0&&e.push("--config",`sandbox_workspace_write.network_access=${t.networkAccessEnabled}`),t.webSearchMode?e.push("--config",`web_search="${t.webSearchMode}"`):t.webSearchEnabled===!0?e.push("--config",'web_search="live"'):t.webSearchEnabled===!1&&e.push("--config",'web_search="disabled"'),t.approvalPolicy&&e.push("--config",`approval_policy="${t.approvalPolicy}"`),t.threadId&&e.push("resume",t.threadId),t.images?.length)for(let u of t.images)e.push("--image",u);let r={};if(this.envOverride)Object.assign(r,this.envOverride);else for(let[u,l]of Object.entries(process.env))l!==void 0&&(r[u]=l);r[WZ]||(r[WZ]=hie),t.apiKey&&(r.CODEX_API_KEY=t.apiKey);let i=pie(this.executablePath,e,{env:r,signal:t.signal}),n=null;if(i.once("error",u=>n=u),!i.stdin)throw i.kill(),new Error("Child process has no stdin");if(i.stdin.write(t.input),i.stdin.end(),!i.stdout)throw i.kill(),new Error("Child process has no stdout");let o=[];i.stderr&&i.stderr.on("data",u=>{o.push(u)});let s=new Promise(u=>{i.once("exit",(l,c)=>{u({code:l,signal:c})})}),a=mie.createInterface({input:i.stdout,crlfDelay:1/0});try{for await(let c of a)yield c;if(n)throw n;let{code:u,signal:l}=await s;if(u!==0||l){let c=Buffer.concat(o),d=l?`signal ${l}`:`code ${u??1}`;throw new Error(`Codex Exec exited with ${d}: ${c.toString("utf8")}`)}}finally{a.close(),i.removeAllListeners();try{i.killed||i.kill()}catch{}}}};bie=/^[A-Za-z0-9_-]+$/;kie=class{exec;options;constructor(t={}){let{codexPathOverride:e,env:r,config:i}=t;this.exec=new vie(e,r,i),this.options=t}startThread(t={}){return new GI(this.exec,this.options,t)}resumeThread(t,e={}){return new GI(this.exec,this.options,e,t)}}});import{execSync as xie}from"node:child_process";var Yu,YZ=N(()=>{_s();Ro();Un();vs();To();Xi();Yu=class extends Vr{constructor(){super("codex","Codex (OpenAI)",75)}canHandle(e){if(!!!(process.env.OPENAI_API_KEY||process.env.CODEX_API_KEY))return U.debug("CodexAgentStrategy: OPENAI_API_KEY or CODEX_API_KEY not set"),!1;try{return xie("codex --version",{encoding:"utf-8",timeout:5e3,stdio:"pipe"}),!0}catch{return U.warn("[Codex] codex CLI not found. Install: npm install -g @openai/codex"),!1}}async invoke(e,r={}){let{model:i,workspace:n=process.cwd(),schema:o=null,skills:s=null,sessionPath:a=null,nodeName:u=null,timeout:l,config:c={}}=r,{Codex:d}=await Promise.resolve().then(()=>(JZ(),HZ)),p=i;(!p||p==="auto")&&(U.debug(`Model is '${p||"undefined"}', using default: ${Tr.CODEX}`),p=Tr.CODEX);let f=p_[p]||p;p_[p]&&p!==f&&U.debug(`Mapped model: ${p} \u2192 ${f}`),U.debug(`Invoking Codex SDK with model: ${f}, skills: ${JSON.stringify(s)}`);let m=process.env.CODEX_API_KEY||process.env.OPENAI_API_KEY;m&&!process.env.CODEX_API_KEY&&(process.env.CODEX_API_KEY=m);let g=m?` | key: ***${m.slice(-4)}`:" | key: not set";console.log(`
211
- \u25C6 Model: ${f}${g}
212
- `);let v=(await import("chalk")).default;console.log(`
213
- ${v.bold("Prompt sent to LLM:")}`),console.log(v.dim("\u2500".repeat(60))),console.log(v.dim(e)),console.log(v.dim("\u2500".repeat(60)));let h=this._resolveSkillsToMcp(s,{sessionPath:a,workspace:n,nodeName:u}),y={};Object.keys(h).length>0&&(y.mcp_servers=h,U.debug(`[Codex] MCP servers: ${Object.keys(h).join(", ")}`));let b=new d({...Object.keys(y).length>0&&{config:y}}).startThread({workingDirectory:n,skipGitRepoCheck:!0,approvalPolicy:"never",sandboxMode:"danger-full-access",networkAccessEnabled:!0}),w=o&&typeof o.parse=="function",S={};if(o)try{let k=w?Gr(o,{target:"openAi"}):o;S.outputSchema=k,U.debug("Structured output via SDK outputSchema")}catch(k){U.warn(`[Codex] Schema conversion failed, will extract from text: ${k.message}`)}try{let{events:k}=await b.runStreamed(e,S),$=0,P="";for await(let j of k){let I=j.type;if(I==="item.completed"){let R=j.item,q=R?.type;if(q==="mcp_tool_call"){$++;let O=`${R.server}/${R.tool}`;if(Mt.stepTool(`Tool: ${O}`),R.arguments){let Q=JSON.stringify(R.arguments),K=Q.length>100?`${Q.substring(0,100)}...`:Q;console.log(` Input: ${K}`)}}else if(q==="tool_call"||q==="function_call"||q==="command_execution"){$++;let O=R.name||R.tool||R.command||"unknown";Mt.stepTool(`Tool: ${O}`)}else q==="agent_message"&&(P=R.text||"",P.length<500?console.log(P):console.log(`${P.substring(0,200)}... (${P.length} chars)`))}else I==="turn.completed"?U.debug(`[Codex] Turn completed. Usage: ${JSON.stringify(j.usage||{})}`):U.debug(`[Codex] Event: ${I} ${JSON.stringify(j).slice(0,300)}`)}if(U.debug(`[Codex] Last agent message (${P.length} chars): ${P.slice(0,500)}`),o){if(!P)throw new Error("Codex agent returned no response");let j=JSON.parse(P),I=w?o.parse(j):j;return U.debug("\u2705 [Codex] Structured output validated"),{raw:P,structured:I}}return P||""}catch(k){let $=k.message||String(k);throw U.error(`\u274C [Codex] SDK call failed: ${$}`),$.includes("exited with code")&&(U.error("\u{1F4A1} [Codex] Verify: codex --version && echo $OPENAI_API_KEY"),U.error("\u{1F4A1} [Codex] If codex is missing: npm install -g @openai/codex")),k}}_resolveSkillsToMcp(e,r={}){if(!Array.isArray(e)||e.length===0)return{};let i={};for(let n of e){let o=Or(n);if(!o){U.warn(`[Codex] Unknown skill "${n}" \u2014 skipping`);continue}if(typeof o.resolve!="function")continue;let s=o.resolve(r);if(!s)continue;let a=o.serverName||n,u={command:s.command};s.args?.length&&(u.args=s.args),s.env&&Object.keys(s.env).length>0&&(u.env=s.env),i[a]=u,U.debug(`[Codex] MCP: ${a} \u2192 ${s.command} ${(s.args||[]).join(" ")}`)}return i}}});import{execSync as $ie,spawn as Iie}from"node:child_process";import{existsSync as QZ,mkdirSync as XZ,readFileSync as eL,rmSync as Eie,writeFileSync as tL}from"node:fs";import{join as aa}from"node:path";function Pie(t){if(!t)return null;let e=String(t),r=e.match(/```(?:json)?\s*([\s\S]*?)```/i);if(r?.[1])try{return JSON.parse(r[1].trim())}catch{}let i=e.indexOf("{");if(i<0)return null;let n=0,o=!1,s=!1,a=-1;for(let u=i;u<e.length;u++){let l=e[u];if(o){s?s=!1:l==="\\"?s=!0:l==='"'&&(o=!1);continue}if(l==='"'){o=!0;continue}if(l==="{"){n===0&&(a=u),n+=1;continue}if(l==="}"){if(n===0)continue;if(n-=1,n===0&&a>=0){let c=e.slice(a,u+1);try{return JSON.parse(c)}catch{a=-1}}}}return null}function Tie(t){let e=String(t||"").trim();if(!e)return null;try{return JSON.parse(e)}catch{return Pie(e)}}function Oie(t){try{let e=JSON.parse(t);if(typeof e=="string")return e;if(typeof e?.response=="string")return e.response;if(typeof e?.text=="string")return e.text;if(typeof e?.output=="string")return e.output;if(Array.isArray(e?.candidates)&&e.candidates.length>0){let r=e.candidates[0];if(typeof r?.content=="string")return r.content;if(Array.isArray(r?.content?.parts)){let i=r.content.parts.map(n=>typeof n?.text=="string"?n.text:"").join("");if(i.trim())return i}}}catch{}return t}var Qu,rL=N(()=>{_s();Ro();Un();To();Xi();Pb();ic();Qu=class extends Vr{constructor(){super("gemini","Gemini (Google)",70)}canHandle(e){if(!!!(process.env.GEMINI_API_KEY||process.env.GOOGLE_API_KEY))return U.debug("GeminiAgentStrategy: GEMINI_API_KEY or GOOGLE_API_KEY not set"),!1;try{return $ie("gemini --version",{encoding:"utf-8",timeout:5e3,stdio:"pipe"}),!0}catch{return U.warn("[Gemini] gemini CLI not found. Install: npm install -g @google/gemini-cli"),!1}}async invoke(e,r={}){let{model:i,workspace:n=process.cwd(),schema:o=null,skills:s=null,sessionPath:a=null,nodeName:u=null,timeout:l=600*1e3}=r,c=i;(!c||c==="auto")&&(c=Tr.GEMINI);let d=uN[c]||c,p=String(process.env.GEMINI_API_KEY||"").trim(),f=String(process.env.GOOGLE_API_KEY||"").trim(),m=this._resolveSkillsToMcp(s,{sessionPath:a,workspace:n,nodeName:u}),g=Object.keys(m).length>0,v=e,h=o&&typeof o.parse=="function",y=null;if(o){let R;try{let q=h?Gr(o,{target:"openAi"}):o;R=JSON.stringify(q,null,2)}catch{R="{}"}if(g){v+=`
85
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc`))})})}}});import{query as wo}from"@anthropic-ai/claude-agent-sdk";import{zodToJsonSchema as _o}from"zod-to-json-schema";var Ee,ys=M(()=>{ue();V();le();oe();se();Ee=class extends K{constructor(){super("claude","Claude (Anthropic API)",50)}canHandle(e){let t=!!process.env.ANTHROPIC_API_KEY;return t||h.debug("ClaudeAgentStrategy: ANTHROPIC_API_KEY not set"),t}async invoke(e,t={}){let{model:r,workspace:s=process.cwd(),schema:n=null,images:o=[],skills:c=null,sessionPath:l=null,nodeName:a=null,timeout:u,config:p={}}=t,d=r;(!d||d==="auto")&&(h.debug(`Model is '${d||"undefined"}', using default: ${G.CLAUDE}`),d=G.CLAUDE);let f=Ht[d]||d;Ht[d]&&d!==f&&h.debug(`Mapped model: ${d} \u2192 ${f}`),h.debug(`Invoking Claude Agent SDK with model: ${f}, skills: ${JSON.stringify(c)}`);let m=process.env.ANTHROPIC_API_KEY,S=m?` | key: ***${m.slice(-4)}`:" | key: not set";console.log(`
86
+ \u25C6 Model: ${f}${S}
87
+ `);let g=(await import("chalk")).default;console.log(`
88
+ ${g.bold("Prompt sent to LLM:")}`),console.log(g.dim("\u2500".repeat(60))),console.log(g.dim(e)),console.log(g.dim("\u2500".repeat(60)));let{allowedTools:w,mcpServers:y}=this._resolveSkills(c,{sessionPath:l,workspace:s,nodeName:a});try{let E={cwd:s,allowedTools:w,permissionMode:"bypassPermissions",model:f,...Object.keys(y).length>0&&{mcpServers:y}};if(n){let A=typeof n.parse=="function"?_o(n,{target:"openApi3"}):n;E.outputFormat={type:"json_schema",schema:A},h.debug("Structured output enforced via SDK outputFormat")}h.debug(`Agent SDK options: ${JSON.stringify({cwd:E.cwd,toolCount:w.length,permissionMode:E.permissionMode,model:E.model,hasOutputFormat:!!E.outputFormat})}`);let x="",v=0,$=[];h.debug("Starting Claude Agent SDK query stream");let T;try{T=wo({prompt:e,options:E})}catch(b){throw h.error(`Failed to initialize Claude Agent SDK: ${b.message}`),b}let I=null,P=0,N=3;try{for await(let b of T){if($.push(b),b.type==="error"||b.error){let O=b.error?.message||b.error||b.message||"Unknown API error";throw new Error(typeof O=="string"?O:JSON.stringify(O))}let A=JSON.stringify(b.message?.content||b.text||"").slice(0,200);if(A===I){if(P++,P>=N){let O=(b.message?.content?.[0]?.text||b.text||"unknown").slice(0,100);throw new Error(`API stuck in loop (${P}x repeated): ${O}`)}}else I=A,P=1;if(b.type==="assistant"||b.constructor?.name==="AssistantMessage"){let O=b.message?.content||b.content||[];for(let _ of O)if(_.type==="thinking"&&_.thinking)console.log(`${_.thinking.substring(0,200)}${_.thinking.length>200?"...":""}`);else if(_.type==="text"&&_.text)x+=_.text,_.text.length<500?console.log(`${_.text}`):console.log(`${_.text.substring(0,200)}... (${_.text.length} chars)`);else if(_.type==="tool_use"){v++,_.name.includes("memory")?D.stepMemory(`Tool: ${_.name}`):D.stepTool(`Tool: ${_.name}`);let R=JSON.stringify(_.input).substring(0,100);console.log(` Input: ${R}${JSON.stringify(_.input).length>100?"...":""}`)}}else if(!(b.type==="user"&&b.tool_use_result)){if(b.type==="result"||b.constructor?.name==="ResultMessage"){let O=b.result||b.text||b.content||x;if(n){if(b.structured_output){h.debug("Using SDK native structured_output");let C=typeof n.parse=="function"?n.parse(b.structured_output):b.structured_output;return{raw:O,structured:C}}if(O){let _=this._extractJson(O,n);if(_)return{raw:O,structured:_}}h.warn(`Could not extract structured output \u2014 returning raw text (${(O||"").length} chars)`)}return O||""}}}if(h.warn(`Agent SDK ended without result. Collected ${$.length} messages`),x.length>0)return h.debug("Returning accumulated text from messages"),x;throw new Error("Claude Agent SDK query ended without result")}catch(b){throw h.error(`Error during query stream: ${b.message}`),b}}catch(E){throw h.error("Claude Agent SDK call failed",{error:E.message}),E}}_resolveSkills(e,t){if(e===null)return h.debug("No skills \u2014 pure LLM mode"),{allowedTools:[],mcpServers:{}};if(!Array.isArray(e)||e.length===0)return h.debug("Default IDE skills for code generation"),{allowedTools:["Read","Write","Bash","Grep","Glob"],mcpServers:{}};let r=[],s={};for(let n of e){let o=z(n);if(!o){h.warn(`Unknown skill "${n}" \u2014 skipping`);continue}if(o.allowedTools&&r.push(...o.allowedTools),typeof o.resolve=="function"){let c=o.resolve(t);c&&(s[o.serverName]=c,h.debug(`MCP: ${o.serverName} \u2192 ${c.command} ${c.args[0]}`))}}return{allowedTools:r,mcpServers:s}}_extractJson(e,t){let r=[()=>{if(e.includes("===JSON_START===")){let s=e.indexOf("===JSON_START===")+16,n=e.indexOf("===JSON_END===");return e.substring(s,n).trim()}},()=>e.match(/```json\s*\n([\s\S]*?)\n```/)?.[1]?.trim(),()=>{if(!e.startsWith("{"))return e.match(/```\s*\n([\s\S]*?)\n```/)?.[1]?.trim()},()=>e.trim(),()=>{let s=e.indexOf("{"),n=e.lastIndexOf("}");if(s!==-1&&n>s)return e.substring(s,n+1)}];for(let s of r)try{let n=s();if(!n)continue;let o=JSON.parse(n);if(typeof o!="object"||o===null)continue;return typeof t.parse=="function"?t.parse(o):o}catch{}return null}}});import{execSync as bo}from"node:child_process";import{zodToJsonSchema as xo}from"zod-to-json-schema";var Te,Ss=M(()=>{ue();V();le();oe();se();Te=class extends K{constructor(){super("codex","Codex (OpenAI)",75)}canHandle(e){if(!!!(process.env.OPENAI_API_KEY||process.env.CODEX_API_KEY))return h.debug("CodexAgentStrategy: OPENAI_API_KEY or CODEX_API_KEY not set"),!1;try{return bo("codex --version",{encoding:"utf-8",timeout:5e3,stdio:"pipe"}),!0}catch{return h.warn("[Codex] codex CLI not found. Install: npm install -g @openai/codex"),!1}}async invoke(e,t={}){let{model:r,workspace:s=process.cwd(),schema:n=null,skills:o=null,sessionPath:c=null,nodeName:l=null,timeout:a,config:u={}}=t,{Codex:p}=await import("@openai/codex-sdk"),d=r;(!d||d==="auto")&&(h.debug(`Model is '${d||"undefined"}', using default: ${G.CODEX}`),d=G.CODEX);let f=Vt[d]||d;Vt[d]&&d!==f&&h.debug(`Mapped model: ${d} \u2192 ${f}`),h.debug(`Invoking Codex SDK with model: ${f}, skills: ${JSON.stringify(o)}`);let m=process.env.CODEX_API_KEY||process.env.OPENAI_API_KEY;m&&!process.env.CODEX_API_KEY&&(process.env.CODEX_API_KEY=m);let S=m?` | key: ***${m.slice(-4)}`:" | key: not set";console.log(`
89
+ \u25C6 Model: ${f}${S}
90
+ `);let g=(await import("chalk")).default;console.log(`
91
+ ${g.bold("Prompt sent to LLM:")}`),console.log(g.dim("\u2500".repeat(60))),console.log(g.dim(e)),console.log(g.dim("\u2500".repeat(60)));let w=this._resolveSkillsToMcp(o,{sessionPath:c,workspace:s,nodeName:l}),y={};Object.keys(w).length>0&&(y.mcp_servers=w,h.debug(`[Codex] MCP servers: ${Object.keys(w).join(", ")}`));let x=new p({...Object.keys(y).length>0&&{config:y}}).startThread({workingDirectory:s,skipGitRepoCheck:!0,approvalPolicy:"never",sandboxMode:"danger-full-access",networkAccessEnabled:!0}),v=n&&typeof n.parse=="function",$={};if(n)try{let T=v?xo(n,{target:"openAi"}):n;$.outputSchema=T,h.debug("Structured output via SDK outputSchema")}catch(T){h.warn(`[Codex] Schema conversion failed, will extract from text: ${T.message}`)}try{let{events:T}=await x.runStreamed(e,$),I=0,P="";for await(let N of T){let b=N.type;if(b==="item.completed"){let A=N.item,O=A?.type;if(O==="mcp_tool_call"){I++;let _=`${A.server}/${A.tool}`;if(D.stepTool(`Tool: ${_}`),A.arguments){let C=JSON.stringify(A.arguments),R=C.length>100?`${C.substring(0,100)}...`:C;console.log(` Input: ${R}`)}}else if(O==="tool_call"||O==="function_call"||O==="command_execution"){I++;let _=A.name||A.tool||A.command||"unknown";D.stepTool(`Tool: ${_}`)}else O==="agent_message"&&(P=A.text||"",P.length<500?console.log(P):console.log(`${P.substring(0,200)}... (${P.length} chars)`))}else b==="turn.completed"?h.debug(`[Codex] Turn completed. Usage: ${JSON.stringify(N.usage||{})}`):h.debug(`[Codex] Event: ${b} ${JSON.stringify(N).slice(0,300)}`)}if(h.debug(`[Codex] Last agent message (${P.length} chars): ${P.slice(0,500)}`),n){if(!P)throw new Error("Codex agent returned no response");let N=JSON.parse(P),b=v?n.parse(N):N;return h.debug("\u2705 [Codex] Structured output validated"),{raw:P,structured:b}}return P||""}catch(T){let I=T.message||String(T);throw h.error(`\u274C [Codex] SDK call failed: ${I}`),I.includes("exited with code")&&(h.error("\u{1F4A1} [Codex] Verify: codex --version && echo $OPENAI_API_KEY"),h.error("\u{1F4A1} [Codex] If codex is missing: npm install -g @openai/codex")),T}}_resolveSkillsToMcp(e,t={}){if(!Array.isArray(e)||e.length===0)return{};let r={};for(let s of e){let n=z(s);if(!n){h.warn(`[Codex] Unknown skill "${s}" \u2014 skipping`);continue}if(typeof n.resolve!="function")continue;let o=n.resolve(t);if(!o)continue;let c=n.serverName||s,l={command:o.command};o.args?.length&&(l.args=o.args),o.env&&Object.keys(o.env).length>0&&(l.env=o.env),r[c]=l,h.debug(`[Codex] MCP: ${c} \u2192 ${o.command} ${(o.args||[]).join(" ")}`)}return r}}});import{execSync as Eo,spawn as To}from"node:child_process";import{zodToJsonSchema as vo}from"zod-to-json-schema";import{existsSync as ws,mkdirSync as _s,readFileSync as bs,rmSync as $o,writeFileSync as xs}from"node:fs";import{join as fe}from"node:path";function Io(i){if(!i)return null;let e=String(i),t=e.match(/```(?:json)?\s*([\s\S]*?)```/i);if(t?.[1])try{return JSON.parse(t[1].trim())}catch{}let r=e.indexOf("{");if(r<0)return null;let s=0,n=!1,o=!1,c=-1;for(let l=r;l<e.length;l++){let a=e[l];if(n){o?o=!1:a==="\\"?o=!0:a==='"'&&(n=!1);continue}if(a==='"'){n=!0;continue}if(a==="{"){s===0&&(c=l),s+=1;continue}if(a==="}"){if(s===0)continue;if(s-=1,s===0&&c>=0){let u=e.slice(c,l+1);try{return JSON.parse(u)}catch{c=-1}}}}return null}function Ao(i){let e=String(i||"").trim();if(!e)return null;try{return JSON.parse(e)}catch{return Io(e)}}function Oo(i){try{let e=JSON.parse(i);if(typeof e=="string")return e;if(typeof e?.response=="string")return e.response;if(typeof e?.text=="string")return e.text;if(typeof e?.output=="string")return e.output;if(Array.isArray(e?.candidates)&&e.candidates.length>0){let t=e.candidates[0];if(typeof t?.content=="string")return t.content;if(Array.isArray(t?.content?.parts)){let r=t.content.parts.map(s=>typeof s?.text=="string"?s.text:"").join("");if(r.trim())return r}}}catch{}return i}var ve,Es=M(()=>{ue();V();oe();se();Xt();Je();ve=class extends K{constructor(){super("gemini","Gemini (Google)",70)}canHandle(e){if(!!!(process.env.GEMINI_API_KEY||process.env.GOOGLE_API_KEY))return h.debug("GeminiAgentStrategy: GEMINI_API_KEY or GOOGLE_API_KEY not set"),!1;try{return Eo("gemini --version",{encoding:"utf-8",timeout:5e3,stdio:"pipe"}),!0}catch{return h.warn("[Gemini] gemini CLI not found. Install: npm install -g @google/gemini-cli"),!1}}async invoke(e,t={}){let{model:r,workspace:s=process.cwd(),schema:n=null,skills:o=null,sessionPath:c=null,nodeName:l=null,timeout:a=600*1e3}=t,u=r;(!u||u==="auto")&&(u=G.GEMINI);let p=es[u]||u,d=String(process.env.GEMINI_API_KEY||"").trim(),f=String(process.env.GOOGLE_API_KEY||"").trim(),m=this._resolveSkillsToMcp(o,{sessionPath:c,workspace:s,nodeName:l}),S=Object.keys(m).length>0,g=e,w=n&&typeof n.parse=="function",y=null;if(n){let A;try{let O=w?vo(n,{target:"openAi"}):n;A=JSON.stringify(O,null,2)}catch{A="{}"}if(S){g+=`
214
92
 
215
93
  Write valid JSON that matches this schema:
216
- ${R}`;let q=`zibby-result-${Date.now()}.json`,O=aa(n,".zibby","tmp");y=aa(O,q),XZ(O,{recursive:!0}),v+=Ka.generateFileOutputInstructions(o,y)}else v+=`
94
+ ${A}`;let O=`zibby-result-${Date.now()}.json`,_=fe(s,".zibby","tmp");y=fe(_,O),_s(_,{recursive:!0}),g+=_e.generateFileOutputInstructions(n,y)}else g+=`
217
95
 
218
96
  Return ONLY valid JSON (no markdown, no commentary) that matches this schema:
219
- ${R}`}let _=this._createGeminiConfigDir(n,m),b=["--output-format","json"];d&&d!=="auto"&&b.push("--model",d);let w=Object.keys(m);if(w.length>0){b.push("--approval-mode","yolo");for(let R of w)b.push("--allowed-mcp-server-names",R);U.info(`[Gemini] Enabling MCP servers: ${w.join(", ")}`)}else s&&s.length>0&&U.warn(`[Gemini] Skills requested but no MCP servers configured: ${s.join(", ")}`);b.push("-p",v);let S={...process.env,GEMINI_CLI_HOME:_};p?(S.GEMINI_API_KEY=p,delete S.GOOGLE_API_KEY):f&&(S.GOOGLE_API_KEY=f,delete S.GEMINI_API_KEY),U.debug(`[Gemini] Command: gemini ${b.slice(0,8).join(" ")}... (${b.length} total args)`),U.debug(`[Gemini] Config home: ${_}`),U.debug(`[Gemini] GEMINI_CLI_HOME env: ${S.GEMINI_CLI_HOME}`);let k="",$=null;try{k=await new Promise((q,O)=>{let Q=Iie("gemini",b,{cwd:n,env:S,stdio:["ignore","pipe","pipe"]}),K="",Oe="",st=setTimeout(()=>{try{Q.kill("SIGTERM")}catch{}},l);Q.stdout.on("data",pe=>{K+=pe.toString()}),Q.stderr.on("data",pe=>{Oe+=pe.toString()}),Q.on("error",pe=>{clearTimeout(st),O(pe)}),Q.on("close",pe=>{if(clearTimeout(st),pe===0)return q(K.trim());O(new Error(`gemini failed with code ${pe}: ${(Oe||K).trim()}`))})})}catch(R){$=R}finally{try{Eie(_,{recursive:!0,force:!0})}catch{}}let P=Oie(k).trim();if(!o){if($)throw $;return P}if(y){let R=QZ(y);if(U.info(`[Gemini] Result file: ${R?"present":"missing"} at ${y}`),R)try{let q=eL(y,"utf-8").trim(),O=JSON.parse(q),Q=h?o.parse(O):O;return U.info("[Gemini] Structured output recovered from result file"),{raw:P,structured:Q}}catch(q){U.warn(`[Gemini] Result file parse/validation failed: ${q.message}`)}else $||U.warn("[Gemini] Result file missing; falling back to stream-parsed JSON")}let j=null;if(o){let R=new Ri;R.zodSchema=o,R.processChunk(P),R.flush(),j=R.getResult()}if(U.info(`[Gemini] Raw stdout length: ${k.length} chars`),U.info(`[Gemini] Extracted text length: ${P.length} chars`),U.info(`[Gemini] StreamParser result: ${j?"extracted":"null"}`),j||(P.length<2e3?U.info(`[Gemini] Raw text preview:
220
- ${P}`):U.info(`[Gemini] Raw text preview (first 1000 chars):
221
- ${P.slice(0,1e3)}`),j=Tie(P)),!j)throw $||(U.error("[Gemini] Failed to extract valid JSON from output"),U.error("\u{1F4A1} Tip: Set strictMode=true in .zibby.config.js for OpenAI proxy fallback"),new Error("Gemini did not return valid JSON for structured output. Enable strictMode for proxy fallback."));let I=h?o.parse(j):j;return{raw:P,structured:I}}_resolveSkillsToMcp(e,r={}){if(!Array.isArray(e)||e.length===0)return{};let i={};for(let n of e){let o=Or(n);if(!o||typeof o.resolve!="function")continue;let s=o.resolve(r);if(!s)continue;let a=o.cursorKey||o.serverName||n,u={command:s.command};s.args?.length&&(u.args=s.args),s.env&&Object.keys(s.env).length>0&&(u.env=s.env),s.cwd&&(u.cwd=s.cwd),i[a]=u}return i}_createGeminiConfigDir(e,r){let i=`${Date.now()}-${Math.random().toString(16).slice(2,10)}`,n=aa(e||process.cwd(),".zibby","tmp",`gemini-home-${i}`),o=aa(n,".gemini");XZ(o,{recursive:!0});let s=aa(o,"settings.json"),a={},u=aa(process.env.HOME||"",".gemini","settings.json");if(QZ(u))try{a=JSON.parse(eL(u,"utf-8"))}catch{a={}}let l={...a,mcpServers:{...a.mcpServers&&typeof a.mcpServers=="object"?a.mcpServers:{},...r||{}}};tL(s,`${JSON.stringify(l,null,2)}
222
- `,"utf-8");let c=aa(e||process.cwd(),".zibby","tmp","gemini-settings-debug.json");try{tL(c,`${JSON.stringify(l,null,2)}
223
- `,"utf-8")}catch{}return U.debug(`[Gemini] Created isolated config with ${Object.keys(l.mcpServers||{}).length} MCP servers`),U.debug(`[Gemini] MCP servers: ${JSON.stringify(Object.keys(l.mcpServers||{}),null,2)}`),n}}});var Xu,KI=N(()=>{Xu=class{formatTools(e){throw new Error("formatTools() must be implemented")}hasToolCalls(e){throw new Error("hasToolCalls() must be implemented")}parseToolCalls(e){throw new Error("parseToolCalls() must be implemented")}getTextContent(e){throw new Error("getTextContent() must be implemented")}buildAssistantMessage(e){throw new Error("buildAssistantMessage() must be implemented")}buildToolResultMessage(e,r){throw new Error("buildToolResultMessage() must be implemented")}injectToolsIntoBody(e,r){throw new Error("injectToolsIntoBody() must be implemented")}}});var ua,nL=N(()=>{KI();ua=class extends Xu{formatTools(e){return e.map(r=>({type:"function",function:{name:r.name,description:r.description,parameters:r.parameters||r.input_schema||{type:"object",properties:{}}}}))}hasToolCalls(e){let r=e.choices?.[0]?.message;return!!(r?.tool_calls&&r.tool_calls.length>0)}parseToolCalls(e){return(e.choices?.[0]?.message?.tool_calls||[]).map(i=>({id:i.id,name:i.function.name,args:JSON.parse(i.function.arguments||"{}")}))}getTextContent(e){return e.choices?.[0]?.message?.content||""}buildAssistantMessage(e){return e.choices?.[0]?.message}buildToolResultMessage(e,r){return{role:"tool",tool_call_id:e,content:typeof r=="string"?r:JSON.stringify(r)}}injectToolsIntoBody(e,r){return r.length>0&&(e.tools=r),e}}});var cf,HI=N(()=>{cf=class{async fetchCompletion(e,r,i={}){throw new Error("fetchCompletion() must be implemented")}async fetchStreamingCompletion(e,r,i={}){throw new Error("fetchStreamingCompletion() must be implemented")}}});function Xg(t){return Buffer.byteLength(JSON.stringify(t),"utf8")}function ey(t,e){let r=String(t||"");if(r.length<=e)return r;let i=Math.max(0,e-28);return`${r.slice(0,i)}
224
-
225
- [truncated for size budget]`}function JI(t,e=0){if(!t||typeof t!="object"||e>8)return t;if(Array.isArray(t))return t.map(i=>JI(i,e+1));let r={};for(let[i,n]of Object.entries(t))i==="description"||i==="title"||i==="examples"||i==="default"||(r[i]=JI(n,e+1));return r}function zie(t=[]){return t.map(e=>({...e,function:{...e.function,description:ey(e.function?.description||"",180),parameters:JI(e.function?.parameters||{type:"object",properties:{}})}}))}function iL(t){let e=new Set;for(let n of t)if(n.role==="assistant"&&Array.isArray(n.tool_calls))for(let o of n.tool_calls)e.add(o.id);let r=t.filter(n=>n.role==="tool"?e.has(n.tool_call_id):!0),i=new Set;for(let n of r)n.role==="tool"&&i.add(n.tool_call_id);return r.map(n=>{if(n.role!=="assistant"||!Array.isArray(n.tool_calls)||n.tool_calls.every(u=>i.has(u.id)))return n;let{tool_calls:s,...a}=n;return{...a,content:a.content||""}})}function YI(t,e={}){let r=e.maxBytes||49e3,i=e.systemMaxChars||12e3,n={...t,messages:Array.isArray(t.messages)?[...t.messages]:[],tools:Array.isArray(t.tools)?zie(t.tools):t.tools};n.messages.length>0&&n.messages[0]?.role==="system"&&(n.messages[0]={...n.messages[0],content:ey(n.messages[0].content,i)});let o=!1;for(;Xg(n)>r&&n.messages.length>2;)n.messages.splice(1,1),o=!0;if(o&&(n.messages=iL(n.messages)),Xg(n)>r&&n.messages.length>0&&(n.messages[0]={...n.messages[0],content:ey(n.messages[0].content,6e3)},o=!0),Xg(n)>r){let s=n.messages.find(u=>u.role==="system")||n.messages[0],a=n.messages.slice(-2);n.messages=iL([s,...a].filter(Boolean).map((u,l)=>({...u,content:ey(u.content,l===0?4e3:8e3)}))),o=!0}return{body:n,meta:{bytes:Xg(n),trimmed:o,maxBytes:r,messageCount:n.messages.length}}}var oL=N(()=>{});var sL,el,aL=N(()=>{HI();oL();sL=t=>Buffer.byteLength(JSON.stringify(t),"utf8"),el=class extends cf{async fetchCompletion(e,r,i={}){let n=sL(e),{body:o,meta:s}=YI(e,i.payloadCompaction);i.onBudget?.({streaming:!1,beforeBytes:n,meta:s});let a=this.#e(i),u=`${r.baseUrl}${i.chatCompletionsPath||"/v1/chat/completions"}`,l=await fetch(u,{method:"POST",headers:r.headers,body:JSON.stringify(o),signal:a});if(!l.ok){let c=await l.text();throw l.status===401||l.status===403?new Error("Session expired. Run `zibby login` to re-authenticate."):new Error(`Proxy error ${l.status}: ${c}`)}return l.json()}async fetchStreamingCompletion(e,r,i={}){let n={...e,stream:!0},o=sL(n),{body:s,meta:a}=YI(n,i.payloadCompaction);i.onBudget?.({streaming:!0,beforeBytes:o,meta:a});let u=this.#e(i),l=`${r.baseUrl}${i.chatCompletionsPath||"/v1/chat/completions"}`,c=await fetch(l,{method:"POST",headers:r.headers,body:JSON.stringify(s),signal:u});if(!c.ok){let v=await c.text();throw c.status===401||c.status===403?new Error("Session expired. Run `zibby login` to re-authenticate."):new Error(`Proxy error ${c.status}: ${v}`)}let d=c.body.getReader(),p=new TextDecoder,f="",m="",g=new Map;for(;;){let{done:v,value:h}=await d.read();if(v)break;f+=p.decode(h,{stream:!0});let y=f.split(`
226
- `);f=y.pop();for(let _ of y){if(!_.startsWith("data: "))continue;let b=_.slice(6).trim();if(b==="[DONE]")continue;let w;try{w=JSON.parse(b)}catch{continue}let S=w.choices?.[0]?.delta;if(S&&(S.content&&(m+=S.content,i.onToken&&i.onToken(S.content)),S.tool_calls))for(let k of S.tool_calls){let $=k.index??0;g.has($)||g.set($,{id:"",name:"",args:""});let P=g.get($);k.id&&(P.id=k.id),k.function?.name&&(P.name=k.function.name),k.function?.arguments!=null&&(P.args+=k.function.arguments)}}}if(g.size>0){let v=[...g.entries()].sort(([h],[y])=>h-y).map(([,h])=>({id:h.id,type:"function",function:{name:h.name,arguments:h.args}}));return{choices:[{message:{role:"assistant",content:m||null,tool_calls:v}}]}}return{choices:[{message:{role:"assistant",content:m}}]}}#e(e={}){let r=[e.signal,e.timeout?AbortSignal.timeout(e.timeout):null].filter(Boolean);return r.length>1?AbortSignal.any(r):r[0]||void 0}}});var QI=N(()=>{KI();nL();HI();aL()});var XI=N(()=>{rr()});var ty=N(()=>{rr();_e();XI()});var lL=N(()=>{rr()});var eE=N(()=>{rr();ty()});var cL=N(()=>{rr();ty()});var tE=N(()=>{rr();XI();ty();lL();rr();uu();km();eE();eE();cL()});var rE=N(()=>{tE();tE()});function tl(t){return!!t._zod}function ki(t,e){return tl(t)?Xa(t,e):t.safeParse(e)}function ry(t){if(!t)return;let e;if(tl(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function fL(t){if(tl(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let i=t.value;if(i!==void 0)return i}var ny=N(()=>{Ga();rE()});var nE=N(()=>{od();od()});var pL=N(()=>{nE();nE()});var oE,mL,Qo,oy,hr,hL,gL,IOe,Die,Uie,sE,Rn,df,yL,kr,Xn,ei,xr,sy,vL,aE,_L,bL,uE,ff,Ce,lE,wL,SL,EOe,la,Mie,ay,Zie,pf,rl,kL,Lie,qie,Fie,Vie,Wie,Gie,Bie,Kie,cE,Hie,uy,Jie,Yie,ly,Qie,mf,hf,Xie,gf,ca,eoe,yf,cy,dy,fy,POe,py,my,hy,xL,$L,IL,dE,EL,vf,nl,PL,toe,roe,fE,noe,pE,mE,ioe,ooe,hE,gE,soe,aoe,uoe,loe,coe,doe,foe,poe,moe,yE,hoe,goe,vE,_E,bE,yoe,voe,_oe,wE,boe,SE,kE,woe,Soe,TL,koe,xE,il,TOe,xoe,$oe,$E,OL,zL,Ioe,Eoe,Poe,Toe,Ooe,zoe,Noe,joe,Coe,iy,Roe,Aoe,IE,EE,PE,Doe,Uoe,Moe,Zoe,Loe,qoe,Foe,Voe,Woe,Goe,Boe,Koe,Hoe,Joe,Yoe,TE,Qoe,Xoe,OE,ese,tse,rse,nse,zE,ise,ose,sse,ase,OOe,zOe,NOe,jOe,COe,ROe,xe,iE,_f=N(()=>{pL();oE="2025-11-25",mL=[oE,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Qo="io.modelcontextprotocol/related-task",oy="2.0",hr=Uk(t=>t!==null&&(typeof t=="object"||typeof t=="function")),hL=Ct([F(),kt().int()]),gL=F(),IOe=Nr({ttl:kt().optional(),pollInterval:kt().optional()}),Die=le({ttl:kt().optional()}),Uie=le({taskId:F()}),sE=Nr({progressToken:hL.optional(),[Qo]:Uie.optional()}),Rn=le({_meta:sE.optional()}),df=Rn.extend({task:Die.optional()}),yL=t=>df.safeParse(t).success,kr=le({method:F(),params:Rn.loose().optional()}),Xn=le({_meta:sE.optional()}),ei=le({method:F(),params:Xn.loose().optional()}),xr=Nr({_meta:sE.optional()}),sy=Ct([F(),kt().int()]),vL=le({jsonrpc:be(oy),id:sy,...kr.shape}).strict(),aE=t=>vL.safeParse(t).success,_L=le({jsonrpc:be(oy),...ei.shape}).strict(),bL=t=>_L.safeParse(t).success,uE=le({jsonrpc:be(oy),id:sy,result:xr}).strict(),ff=t=>uE.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Ce||(Ce={}));lE=le({jsonrpc:be(oy),id:sy.optional(),error:le({code:kt().int(),message:F(),data:jt().optional()})}).strict(),wL=t=>lE.safeParse(t).success,SL=Ct([vL,_L,uE,lE]),EOe=Ct([uE,lE]),la=xr.strict(),Mie=Xn.extend({requestId:sy.optional(),reason:F().optional()}),ay=ei.extend({method:be("notifications/cancelled"),params:Mie}),Zie=le({src:F(),mimeType:F().optional(),sizes:tt(F()).optional(),theme:jr(["light","dark"]).optional()}),pf=le({icons:tt(Zie).optional()}),rl=le({name:F(),title:F().optional()}),kL=rl.extend({...rl.shape,...pf.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),Lie=id(le({applyDefaults:ar().optional()}),Pt(F(),jt())),qie=lh(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,id(le({form:Lie.optional(),url:hr.optional()}),Pt(F(),jt()).optional())),Fie=Nr({list:hr.optional(),cancel:hr.optional(),requests:Nr({sampling:Nr({createMessage:hr.optional()}).optional(),elicitation:Nr({create:hr.optional()}).optional()}).optional()}),Vie=Nr({list:hr.optional(),cancel:hr.optional(),requests:Nr({tools:Nr({call:hr.optional()}).optional()}).optional()}),Wie=le({experimental:Pt(F(),hr).optional(),sampling:le({context:hr.optional(),tools:hr.optional()}).optional(),elicitation:qie.optional(),roots:le({listChanged:ar().optional()}).optional(),tasks:Fie.optional(),extensions:Pt(F(),hr).optional()}),Gie=Rn.extend({protocolVersion:F(),capabilities:Wie,clientInfo:kL}),Bie=kr.extend({method:be("initialize"),params:Gie}),Kie=le({experimental:Pt(F(),hr).optional(),logging:hr.optional(),completions:hr.optional(),prompts:le({listChanged:ar().optional()}).optional(),resources:le({subscribe:ar().optional(),listChanged:ar().optional()}).optional(),tools:le({listChanged:ar().optional()}).optional(),tasks:Vie.optional(),extensions:Pt(F(),hr).optional()}),cE=xr.extend({protocolVersion:F(),capabilities:Kie,serverInfo:kL,instructions:F().optional()}),Hie=ei.extend({method:be("notifications/initialized"),params:Xn.optional()}),uy=kr.extend({method:be("ping"),params:Rn.optional()}),Jie=le({progress:kt(),total:Zt(kt()),message:Zt(F())}),Yie=le({...Xn.shape,...Jie.shape,progressToken:hL}),ly=ei.extend({method:be("notifications/progress"),params:Yie}),Qie=Rn.extend({cursor:gL.optional()}),mf=kr.extend({params:Qie.optional()}),hf=xr.extend({nextCursor:gL.optional()}),Xie=jr(["working","input_required","completed","failed","cancelled"]),gf=le({taskId:F(),status:Xie,ttl:Ct([kt(),nh()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:Zt(kt()),statusMessage:Zt(F())}),ca=xr.extend({task:gf}),eoe=Xn.merge(gf),yf=ei.extend({method:be("notifications/tasks/status"),params:eoe}),cy=kr.extend({method:be("tasks/get"),params:Rn.extend({taskId:F()})}),dy=xr.merge(gf),fy=kr.extend({method:be("tasks/result"),params:Rn.extend({taskId:F()})}),POe=xr.loose(),py=mf.extend({method:be("tasks/list")}),my=hf.extend({tasks:tt(gf)}),hy=kr.extend({method:be("tasks/cancel"),params:Rn.extend({taskId:F()})}),xL=xr.merge(gf),$L=le({uri:F(),mimeType:Zt(F()),_meta:Pt(F(),jt()).optional()}),IL=$L.extend({text:F()}),dE=F().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),EL=$L.extend({blob:dE}),vf=jr(["user","assistant"]),nl=le({audience:tt(vf).optional(),priority:kt().min(0).max(1).optional(),lastModified:qs.datetime({offset:!0}).optional()}),PL=le({...rl.shape,...pf.shape,uri:F(),description:Zt(F()),mimeType:Zt(F()),size:Zt(kt()),annotations:nl.optional(),_meta:Zt(Nr({}))}),toe=le({...rl.shape,...pf.shape,uriTemplate:F(),description:Zt(F()),mimeType:Zt(F()),annotations:nl.optional(),_meta:Zt(Nr({}))}),roe=mf.extend({method:be("resources/list")}),fE=hf.extend({resources:tt(PL)}),noe=mf.extend({method:be("resources/templates/list")}),pE=hf.extend({resourceTemplates:tt(toe)}),mE=Rn.extend({uri:F()}),ioe=mE,ooe=kr.extend({method:be("resources/read"),params:ioe}),hE=xr.extend({contents:tt(Ct([IL,EL]))}),gE=ei.extend({method:be("notifications/resources/list_changed"),params:Xn.optional()}),soe=mE,aoe=kr.extend({method:be("resources/subscribe"),params:soe}),uoe=mE,loe=kr.extend({method:be("resources/unsubscribe"),params:uoe}),coe=Xn.extend({uri:F()}),doe=ei.extend({method:be("notifications/resources/updated"),params:coe}),foe=le({name:F(),description:Zt(F()),required:Zt(ar())}),poe=le({...rl.shape,...pf.shape,description:Zt(F()),arguments:Zt(tt(foe)),_meta:Zt(Nr({}))}),moe=mf.extend({method:be("prompts/list")}),yE=hf.extend({prompts:tt(poe)}),hoe=Rn.extend({name:F(),arguments:Pt(F(),F()).optional()}),goe=kr.extend({method:be("prompts/get"),params:hoe}),vE=le({type:be("text"),text:F(),annotations:nl.optional(),_meta:Pt(F(),jt()).optional()}),_E=le({type:be("image"),data:dE,mimeType:F(),annotations:nl.optional(),_meta:Pt(F(),jt()).optional()}),bE=le({type:be("audio"),data:dE,mimeType:F(),annotations:nl.optional(),_meta:Pt(F(),jt()).optional()}),yoe=le({type:be("tool_use"),name:F(),id:F(),input:Pt(F(),jt()),_meta:Pt(F(),jt()).optional()}),voe=le({type:be("resource"),resource:Ct([IL,EL]),annotations:nl.optional(),_meta:Pt(F(),jt()).optional()}),_oe=PL.extend({type:be("resource_link")}),wE=Ct([vE,_E,bE,_oe,voe]),boe=le({role:vf,content:wE}),SE=xr.extend({description:F().optional(),messages:tt(boe)}),kE=ei.extend({method:be("notifications/prompts/list_changed"),params:Xn.optional()}),woe=le({title:F().optional(),readOnlyHint:ar().optional(),destructiveHint:ar().optional(),idempotentHint:ar().optional(),openWorldHint:ar().optional()}),Soe=le({taskSupport:jr(["required","optional","forbidden"]).optional()}),TL=le({...rl.shape,...pf.shape,description:F().optional(),inputSchema:le({type:be("object"),properties:Pt(F(),hr).optional(),required:tt(F()).optional()}).catchall(jt()),outputSchema:le({type:be("object"),properties:Pt(F(),hr).optional(),required:tt(F()).optional()}).catchall(jt()).optional(),annotations:woe.optional(),execution:Soe.optional(),_meta:Pt(F(),jt()).optional()}),koe=mf.extend({method:be("tools/list")}),xE=hf.extend({tools:tt(TL)}),il=xr.extend({content:tt(wE).default([]),structuredContent:Pt(F(),jt()).optional(),isError:ar().optional()}),TOe=il.or(xr.extend({toolResult:jt()})),xoe=df.extend({name:F(),arguments:Pt(F(),jt()).optional()}),$oe=kr.extend({method:be("tools/call"),params:xoe}),$E=ei.extend({method:be("notifications/tools/list_changed"),params:Xn.optional()}),OL=le({autoRefresh:ar().default(!0),debounceMs:kt().int().nonnegative().default(300)}),zL=jr(["debug","info","notice","warning","error","critical","alert","emergency"]),Ioe=Rn.extend({level:zL}),Eoe=kr.extend({method:be("logging/setLevel"),params:Ioe}),Poe=Xn.extend({level:zL,logger:F().optional(),data:jt()}),Toe=ei.extend({method:be("notifications/message"),params:Poe}),Ooe=le({name:F().optional()}),zoe=le({hints:tt(Ooe).optional(),costPriority:kt().min(0).max(1).optional(),speedPriority:kt().min(0).max(1).optional(),intelligencePriority:kt().min(0).max(1).optional()}),Noe=le({mode:jr(["auto","required","none"]).optional()}),joe=le({type:be("tool_result"),toolUseId:F().describe("The unique identifier for the corresponding tool call."),content:tt(wE).default([]),structuredContent:le({}).loose().optional(),isError:ar().optional(),_meta:Pt(F(),jt()).optional()}),Coe=sh("type",[vE,_E,bE]),iy=sh("type",[vE,_E,bE,yoe,joe]),Roe=le({role:vf,content:Ct([iy,tt(iy)]),_meta:Pt(F(),jt()).optional()}),Aoe=df.extend({messages:tt(Roe),modelPreferences:zoe.optional(),systemPrompt:F().optional(),includeContext:jr(["none","thisServer","allServers"]).optional(),temperature:kt().optional(),maxTokens:kt().int(),stopSequences:tt(F()).optional(),metadata:hr.optional(),tools:tt(TL).optional(),toolChoice:Noe.optional()}),IE=kr.extend({method:be("sampling/createMessage"),params:Aoe}),EE=xr.extend({model:F(),stopReason:Zt(jr(["endTurn","stopSequence","maxTokens"]).or(F())),role:vf,content:Coe}),PE=xr.extend({model:F(),stopReason:Zt(jr(["endTurn","stopSequence","maxTokens","toolUse"]).or(F())),role:vf,content:Ct([iy,tt(iy)])}),Doe=le({type:be("boolean"),title:F().optional(),description:F().optional(),default:ar().optional()}),Uoe=le({type:be("string"),title:F().optional(),description:F().optional(),minLength:kt().optional(),maxLength:kt().optional(),format:jr(["email","uri","date","date-time"]).optional(),default:F().optional()}),Moe=le({type:jr(["number","integer"]),title:F().optional(),description:F().optional(),minimum:kt().optional(),maximum:kt().optional(),default:kt().optional()}),Zoe=le({type:be("string"),title:F().optional(),description:F().optional(),enum:tt(F()),default:F().optional()}),Loe=le({type:be("string"),title:F().optional(),description:F().optional(),oneOf:tt(le({const:F(),title:F()})),default:F().optional()}),qoe=le({type:be("string"),title:F().optional(),description:F().optional(),enum:tt(F()),enumNames:tt(F()).optional(),default:F().optional()}),Foe=Ct([Zoe,Loe]),Voe=le({type:be("array"),title:F().optional(),description:F().optional(),minItems:kt().optional(),maxItems:kt().optional(),items:le({type:be("string"),enum:tt(F())}),default:tt(F()).optional()}),Woe=le({type:be("array"),title:F().optional(),description:F().optional(),minItems:kt().optional(),maxItems:kt().optional(),items:le({anyOf:tt(le({const:F(),title:F()}))}),default:tt(F()).optional()}),Goe=Ct([Voe,Woe]),Boe=Ct([qoe,Foe,Goe]),Koe=Ct([Boe,Doe,Uoe,Moe]),Hoe=df.extend({mode:be("form").optional(),message:F(),requestedSchema:le({type:be("object"),properties:Pt(F(),Koe),required:tt(F()).optional()})}),Joe=df.extend({mode:be("url"),message:F(),elicitationId:F(),url:F().url()}),Yoe=Ct([Hoe,Joe]),TE=kr.extend({method:be("elicitation/create"),params:Yoe}),Qoe=Xn.extend({elicitationId:F()}),Xoe=ei.extend({method:be("notifications/elicitation/complete"),params:Qoe}),OE=xr.extend({action:jr(["accept","decline","cancel"]),content:lh(t=>t===null?void 0:t,Pt(F(),Ct([F(),kt(),ar(),tt(F())])).optional())}),ese=le({type:be("ref/resource"),uri:F()}),tse=le({type:be("ref/prompt"),name:F()}),rse=Rn.extend({ref:Ct([tse,ese]),argument:le({name:F(),value:F()}),context:le({arguments:Pt(F(),F()).optional()}).optional()}),nse=kr.extend({method:be("completion/complete"),params:rse}),zE=xr.extend({completion:Nr({values:tt(F()).max(100),total:Zt(kt().int()),hasMore:Zt(ar())})}),ise=le({uri:F().startsWith("file://"),name:F().optional(),_meta:Pt(F(),jt()).optional()}),ose=kr.extend({method:be("roots/list"),params:Rn.optional()}),sse=xr.extend({roots:tt(ise)}),ase=ei.extend({method:be("notifications/roots/list_changed"),params:Xn.optional()}),OOe=Ct([uy,Bie,nse,Eoe,goe,moe,roe,noe,ooe,aoe,loe,$oe,koe,cy,fy,py,hy]),zOe=Ct([ay,ly,Hie,ase,yf]),NOe=Ct([la,EE,PE,OE,sse,dy,my,ca]),jOe=Ct([uy,IE,TE,ose,cy,fy,py,hy]),COe=Ct([ay,ly,Toe,doe,gE,$E,kE,yf,Xoe]),ROe=Ct([la,cE,zE,SE,yE,fE,pE,hE,il,xE,dy,my,ca]),xe=class t extends Error{constructor(e,r,i){super(`MCP error ${e}: ${r}`),this.code=e,this.data=i,this.name="McpError"}static fromError(e,r,i){if(e===Ce.UrlElicitationRequired&&i){let n=i;if(n.elicitations)return new iE(n.elicitations,r)}return new t(e,r,i)}},iE=class extends xe{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(Ce.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}});function Xo(t){return t==="completed"||t==="failed"||t==="cancelled"}var NL=N(()=>{});function NE(t){let r=ry(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let i=fL(r);if(typeof i!="string")throw new Error("Schema method literal must be a string");return i}function jE(t,e){let r=ki(t,e);if(!r.success)throw r.error;return r.data}var jL=N(()=>{rE();ny();Ro()});function CL(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function RL(t,e){let r={...t};for(let i in e){let n=i,o=e[n];if(o===void 0)continue;let s=r[n];CL(s)&&CL(o)?r[n]={...s,...o}:r[n]=o}return r}var use,gy,AL=N(()=>{ny();_f();NL();jL();use=6e4,gy=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(ay,r=>{this._oncancel(r)}),this.setNotificationHandler(ly,r=>{this._onprogress(r)}),this.setRequestHandler(uy,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(cy,async(r,i)=>{let n=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!n)throw new xe(Ce.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(fy,async(r,i)=>{let n=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(o,i.sessionId);){if(a.type==="response"||a.type==="error"){let u=a.message,l=u.id,c=this._requestResolvers.get(l);if(c)if(this._requestResolvers.delete(l),a.type==="response")c(u);else{let d=u,p=new xe(d.error.code,d.error.message,d.error.data);c(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${l}`))}continue}await this._transport?.send(a.message,{relatedRequestId:i.requestId})}}let s=await this._taskStore.getTask(o,i.sessionId);if(!s)throw new xe(Ce.InvalidParams,`Task not found: ${o}`);if(!Xo(s.status))return await this._waitForTaskUpdate(o,i.signal),await n();if(Xo(s.status)){let a=await this._taskStore.getTaskResult(o,i.sessionId);return this._clearTaskQueue(o),{...a,_meta:{...a._meta,[Qo]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler(py,async(r,i)=>{try{let{tasks:n,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,i.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new xe(Ce.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(hy,async(r,i)=>{try{let n=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!n)throw new xe(Ce.InvalidParams,`Task not found: ${r.params.taskId}`);if(Xo(n.status))throw new xe(Ce.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",i.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,i.sessionId);if(!o)throw new xe(Ce.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(n){throw n instanceof xe?n:new xe(Ce.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,i,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:i,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let i=Date.now()-r.startTime;if(r.maxTotalTimeout&&i>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),xe.fromError(Ce.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:i});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let i=this.transport?.onerror;this._transport.onerror=o=>{i?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{n?.(o,s),ff(o)||wL(o)?this._onresponse(o):aE(o)?this._onrequest(o,s):bL(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let i of this._timeoutInfo.values())clearTimeout(i.timeoutId);this._timeoutInfo.clear();for(let i of this._requestHandlerAbortControllers.values())i.abort();this._requestHandlerAbortControllers.clear();let r=xe.fromError(Ce.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let i of e.values())i(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,r){let i=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,o=e.params?._meta?.[Qo]?.taskId;if(i===void 0){let c={jsonrpc:"2.0",id:e.id,error:{code:Ce.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:c,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(c).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let a=yL(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,l={signal:s.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async c=>{if(s.signal.aborted)return;let d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(c,d)},sendRequest:async(c,d,p)=>{if(s.signal.aborted)throw new xe(Ce.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};o&&!f.relatedTask&&(f.relatedTask={taskId:o});let m=f.relatedTask?.taskId??o;return m&&u&&await u.updateTaskStatus(m,"input_required"),await this.request(c,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:o,taskStore:u,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>i(e,l)).then(async c=>{if(s.signal.aborted)return;let d={result:c,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async c=>{if(s.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:Ce.InternalError,message:c.message??"Internal error",...c.data!==void 0&&{data:c.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===s&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...i}=e.params,n=Number(r),o=this._progressHandlers.get(n);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(u){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),s(u);return}o(i)}_onresponse(e){let r=Number(e.id),i=this._requestResolvers.get(r);if(i){if(this._requestResolvers.delete(r),ff(e))i(e);else{let s=new xe(e.error.code,e.error.message,e.error.data);i(s)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(ff(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),ff(e))n(e);else{let s=xe.fromError(e.error.code,e.error.message,e.error.data);n(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,i){let{task:n}=i??{};if(!n){try{yield{type:"result",result:await this.request(e,r,i)}}catch(s){yield{type:"error",error:s instanceof xe?s:new xe(Ce.InternalError,String(s))}}return}let o;try{let s=await this.request(e,ca,i);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new xe(Ce.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:o},i);if(yield{type:"taskStatus",task:a},Xo(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,i)}:a.status==="failed"?yield{type:"error",error:new xe(Ce.InternalError,`Task ${o} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new xe(Ce.InternalError,`Task ${o} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,i)};return}let u=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,u)),i?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof xe?s:new xe(Ce.InternalError,String(s))}}}request(e,r,i){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:a,relatedTask:u}=i??{};return new Promise((l,c)=>{let d=y=>{c(y)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(y){d(y);return}i?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};i?.onprogress&&(this._progressHandlers.set(p,i.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),u&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Qo]:u}});let m=y=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(y)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(b=>this._onerror(new Error(`Failed to send cancellation: ${b}`)));let _=y instanceof xe?y:new xe(Ce.RequestTimeout,String(y));c(_)};this._responseHandlers.set(p,y=>{if(!i?.signal?.aborted){if(y instanceof Error)return c(y);try{let _=ki(r,y.result);_.success?l(_.data):c(_.error)}catch(_){c(_)}}}),i?.signal?.addEventListener("abort",()=>{m(i?.signal?.reason)});let g=i?.timeout??use,v=()=>m(xe.fromError(Ce.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(p,g,i?.maxTotalTimeout,v,i?.resetTimeoutOnProgress??!1);let h=u?.taskId;if(h){let y=_=>{let b=this._responseHandlers.get(p);b?b(_):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,y),this._enqueueTaskMessage(h,{type:"request",message:f,timestamp:Date.now()}).catch(_=>{this._cleanupTimeout(p),c(_)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(y=>{this._cleanupTimeout(p),c(y)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},dy,r)}async getTaskResult(e,r,i){return this.request({method:"tasks/result",params:e},r,i)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},my,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},xL,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let i=r?.relatedTask?.taskId;if(i){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Qo]:r.relatedTask}}};await this._enqueueTaskMessage(i,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Qo]:r.relatedTask}}}),this._transport?.send(a,r).catch(u=>this._onerror(u))});return}let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Qo]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(e,r){let i=NE(e);this.assertRequestHandlerCapability(i),this._requestHandlers.set(i,(n,o)=>{let s=jE(e,n);return Promise.resolve(r(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let i=NE(e);this._notificationHandlers.set(i,n=>{let o=jE(e,n);return Promise.resolve(r(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,i){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,i,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let i=await this._taskMessageQueue.dequeueAll(e,r);for(let n of i)if(n.type==="request"&&aE(n.message)){let o=n.message.id,s=this._requestResolvers.get(o);s?(s(new xe(Ce.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let i=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(i=n.pollInterval)}catch{}return new Promise((n,o)=>{if(r.aborted){o(new xe(Ce.InvalidRequest,"Request cancelled"));return}let s=setTimeout(n,i);r.addEventListener("abort",()=>{clearTimeout(s),o(new xe(Ce.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let i=this._taskStore;if(!i)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await i.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let o=await i.getTask(n,r);if(!o)throw new xe(Ce.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(n,o,s)=>{await i.storeTaskResult(n,o,s,r);let a=await i.getTask(n,r);if(a){let u=yf.parse({method:"notifications/tasks/status",params:a});await this.notification(u),Xo(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>i.getTaskResult(n,r),updateTaskStatus:async(n,o,s)=>{let a=await i.getTask(n,r);if(!a)throw new xe(Ce.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(Xo(a.status))throw new xe(Ce.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await i.updateTaskStatus(n,o,s,r);let u=await i.getTask(n,r);if(u){let l=yf.parse({method:"notifications/tasks/status",params:u});await this.notification(l),Xo(u.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>i.listTasks(n,r)}}}});var Sf=L(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.regexpCode=wt.getEsmExportName=wt.getProperty=wt.safeStringify=wt.stringify=wt.strConcat=wt.addCodeArg=wt.str=wt._=wt.nil=wt._Code=wt.Name=wt.IDENTIFIER=wt._CodeOrName=void 0;var bf=class{};wt._CodeOrName=bf;wt.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var da=class extends bf{constructor(e){if(super(),!wt.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};wt.Name=da;var ti=class extends bf{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,i)=>`${r}${i}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,i)=>(i instanceof da&&(r[i.str]=(r[i.str]||0)+1),r),{})}};wt._Code=ti;wt.nil=new ti("");function DL(t,...e){let r=[t[0]],i=0;for(;i<e.length;)RE(r,e[i]),r.push(t[++i]);return new ti(r)}wt._=DL;var CE=new ti("+");function UL(t,...e){let r=[wf(t[0])],i=0;for(;i<e.length;)r.push(CE),RE(r,e[i]),r.push(CE,wf(t[++i]));return lse(r),new ti(r)}wt.str=UL;function RE(t,e){e instanceof ti?t.push(...e._items):e instanceof da?t.push(e):t.push(fse(e))}wt.addCodeArg=RE;function lse(t){let e=1;for(;e<t.length-1;){if(t[e]===CE){let r=cse(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function cse(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof da||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof da))return`"${t}${e.slice(1)}`}function dse(t,e){return e.emptyStr()?t:t.emptyStr()?e:UL`${t}${e}`}wt.strConcat=dse;function fse(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:wf(Array.isArray(t)?t.join(","):t)}function pse(t){return new ti(wf(t))}wt.stringify=pse;function wf(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}wt.safeStringify=wf;function mse(t){return typeof t=="string"&&wt.IDENTIFIER.test(t)?new ti(`.${t}`):DL`[${t}]`}wt.getProperty=mse;function hse(t){if(typeof t=="string"&&wt.IDENTIFIER.test(t))return new ti(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}wt.getEsmExportName=hse;function gse(t){return new ti(t.toString())}wt.regexpCode=gse});var UE=L(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.ValueScope=gn.ValueScopeName=gn.Scope=gn.varKinds=gn.UsedValueState=void 0;var hn=Sf(),AE=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},yy;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(yy||(gn.UsedValueState=yy={}));gn.varKinds={const:new hn.Name("const"),let:new hn.Name("let"),var:new hn.Name("var")};var vy=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof hn.Name?e:this.name(e)}name(e){return new hn.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,i;if(!((i=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||i===void 0)&&i.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};gn.Scope=vy;var _y=class extends hn.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:i}){this.value=e,this.scopePath=(0,hn._)`.${new hn.Name(r)}[${i}]`}};gn.ValueScopeName=_y;var yse=(0,hn._)`\n`,DE=class extends vy{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?yse:hn.nil}}get(){return this._scope}name(e){return new _y(e,this._newName(e))}value(e,r){var i;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:o}=n,s=(i=r.key)!==null&&i!==void 0?i:r.ref,a=this._values[o];if(a){let c=a.get(s);if(c)return c}else a=this._values[o]=new Map;a.set(s,n);let u=this._scope[o]||(this._scope[o]=[]),l=u.length;return u[l]=r.ref,n.setValue(r,{property:o,itemIndex:l}),n}getValue(e,r){let i=this._values[e];if(i)return i.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,hn._)`${e}${i.scopePath}`})}scopeCode(e=this._values,r,i){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,i)}_reduceValues(e,r,i={},n){let o=hn.nil;for(let s in e){let a=e[s];if(!a)continue;let u=i[s]=i[s]||new Map;a.forEach(l=>{if(u.has(l))return;u.set(l,yy.Started);let c=r(l);if(c){let d=this.opts.es5?gn.varKinds.var:gn.varKinds.const;o=(0,hn._)`${o}${d} ${l} = ${c};${this.opts._n}`}else if(c=n?.(l))o=(0,hn._)`${o}${c}${this.opts._n}`;else throw new AE(l);u.set(l,yy.Completed)})}return o}};gn.ValueScope=DE});var rt=L(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.or=Xe.and=Xe.not=Xe.CodeGen=Xe.operators=Xe.varKinds=Xe.ValueScopeName=Xe.ValueScope=Xe.Scope=Xe.Name=Xe.regexpCode=Xe.stringify=Xe.getProperty=Xe.nil=Xe.strConcat=Xe.str=Xe._=void 0;var ft=Sf(),xi=UE(),es=Sf();Object.defineProperty(Xe,"_",{enumerable:!0,get:function(){return es._}});Object.defineProperty(Xe,"str",{enumerable:!0,get:function(){return es.str}});Object.defineProperty(Xe,"strConcat",{enumerable:!0,get:function(){return es.strConcat}});Object.defineProperty(Xe,"nil",{enumerable:!0,get:function(){return es.nil}});Object.defineProperty(Xe,"getProperty",{enumerable:!0,get:function(){return es.getProperty}});Object.defineProperty(Xe,"stringify",{enumerable:!0,get:function(){return es.stringify}});Object.defineProperty(Xe,"regexpCode",{enumerable:!0,get:function(){return es.regexpCode}});Object.defineProperty(Xe,"Name",{enumerable:!0,get:function(){return es.Name}});var ky=UE();Object.defineProperty(Xe,"Scope",{enumerable:!0,get:function(){return ky.Scope}});Object.defineProperty(Xe,"ValueScope",{enumerable:!0,get:function(){return ky.ValueScope}});Object.defineProperty(Xe,"ValueScopeName",{enumerable:!0,get:function(){return ky.ValueScopeName}});Object.defineProperty(Xe,"varKinds",{enumerable:!0,get:function(){return ky.varKinds}});Xe.operators={GT:new ft._Code(">"),GTE:new ft._Code(">="),LT:new ft._Code("<"),LTE:new ft._Code("<="),EQ:new ft._Code("==="),NEQ:new ft._Code("!=="),NOT:new ft._Code("!"),OR:new ft._Code("||"),AND:new ft._Code("&&"),ADD:new ft._Code("+")};var vo=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ME=class extends vo{constructor(e,r,i){super(),this.varKind=e,this.name=r,this.rhs=i}render({es5:e,_n:r}){let i=e?xi.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=sl(this.rhs,e,r)),this}get names(){return this.rhs instanceof ft._CodeOrName?this.rhs.names:{}}},by=class extends vo{constructor(e,r,i){super(),this.lhs=e,this.rhs=r,this.sideEffects=i}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ft.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=sl(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ft.Name?{}:{...this.lhs.names};return Sy(e,this.rhs)}},ZE=class extends by{constructor(e,r,i,n){super(e,i,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},LE=class extends vo{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qE=class extends vo{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},FE=class extends vo{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},VE=class extends vo{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=sl(this.code,e,r),this}get names(){return this.code instanceof ft._CodeOrName?this.code.names:{}}},kf=class extends vo{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,i)=>r+i.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let i=e[r].optimizeNodes();Array.isArray(i)?e.splice(r,1,...i):i?e[r]=i:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:i}=this,n=i.length;for(;n--;){let o=i[n];o.optimizeNames(e,r)||(vse(e,o.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>ma(e,r.names),{})}},_o=class extends kf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},WE=class extends kf{},ol=class extends _o{};ol.kind="else";var fa=class t extends _o{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let i=r.optimizeNodes();r=this.else=Array.isArray(i)?new ol(i):i}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(ML(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var i;if(this.else=(i=this.else)===null||i===void 0?void 0:i.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=sl(this.condition,e,r),this}get names(){let e=super.names;return Sy(e,this.condition),this.else&&ma(e,this.else.names),e}};fa.kind="if";var pa=class extends _o{};pa.kind="for";var GE=class extends pa{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=sl(this.iteration,e,r),this}get names(){return ma(super.names,this.iteration.names)}},BE=class extends pa{constructor(e,r,i,n){super(),this.varKind=e,this.name=r,this.from=i,this.to=n}render(e){let r=e.es5?xi.varKinds.var:this.varKind,{name:i,from:n,to:o}=this;return`for(${r} ${i}=${n}; ${i}<${o}; ${i}++)`+super.render(e)}get names(){let e=Sy(super.names,this.from);return Sy(e,this.to)}},wy=class extends pa{constructor(e,r,i,n){super(),this.loop=e,this.varKind=r,this.name=i,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=sl(this.iterable,e,r),this}get names(){return ma(super.names,this.iterable.names)}},xf=class extends _o{constructor(e,r,i){super(),this.name=e,this.args=r,this.async=i}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};xf.kind="func";var $f=class extends kf{render(e){return"return "+super.render(e)}};$f.kind="return";var KE=class extends _o{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var i,n;return super.optimizeNames(e,r),(i=this.catch)===null||i===void 0||i.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&ma(e,this.catch.names),this.finally&&ma(e,this.finally.names),e}},If=class extends _o{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};If.kind="catch";var Ef=class extends _o{render(e){return"finally"+super.render(e)}};Ef.kind="finally";var HE=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
227
- `:""},this._extScope=e,this._scope=new xi.Scope({parent:e}),this._nodes=[new WE]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let i=this._extScope.value(e,r);return(this._values[i.prefix]||(this._values[i.prefix]=new Set)).add(i),i}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,i,n){let o=this._scope.toName(r);return i!==void 0&&n&&(this._constants[o.str]=i),this._leafNode(new ME(e,o,i)),o}const(e,r,i){return this._def(xi.varKinds.const,e,r,i)}let(e,r,i){return this._def(xi.varKinds.let,e,r,i)}var(e,r,i){return this._def(xi.varKinds.var,e,r,i)}assign(e,r,i){return this._leafNode(new by(e,r,i))}add(e,r){return this._leafNode(new ZE(e,Xe.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ft.nil&&this._leafNode(new VE(e)),this}object(...e){let r=["{"];for(let[i,n]of e)r.length>1&&r.push(","),r.push(i),(i!==n||this.opts.es5)&&(r.push(":"),(0,ft.addCodeArg)(r,n));return r.push("}"),new ft._Code(r)}if(e,r,i){if(this._blockNode(new fa(e)),r&&i)this.code(r).else().code(i).endIf();else if(r)this.code(r).endIf();else if(i)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new fa(e))}else(){return this._elseNode(new ol)}endIf(){return this._endBlockNode(fa,ol)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new GE(e),r)}forRange(e,r,i,n,o=this.opts.es5?xi.varKinds.var:xi.varKinds.let){let s=this._scope.toName(e);return this._for(new BE(o,s,r,i),()=>n(s))}forOf(e,r,i,n=xi.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=r instanceof ft.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ft._)`${s}.length`,a=>{this.var(o,(0,ft._)`${s}[${a}]`),i(o)})}return this._for(new wy("of",n,o,r),()=>i(o))}forIn(e,r,i,n=this.opts.es5?xi.varKinds.var:xi.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ft._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new wy("in",n,o,r),()=>i(o))}endFor(){return this._endBlockNode(pa)}label(e){return this._leafNode(new LE(e))}break(e){return this._leafNode(new qE(e))}return(e){let r=new $f;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode($f)}try(e,r,i){if(!r&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new KE;if(this._blockNode(n),this.code(e),r){let o=this.name("e");this._currNode=n.catch=new If(o),r(o)}return i&&(this._currNode=n.finally=new Ef,this.code(i)),this._endBlockNode(If,Ef)}throw(e){return this._leafNode(new FE(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let i=this._nodes.length-r;if(i<0||e!==void 0&&i!==e)throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ft.nil,i,n){return this._blockNode(new xf(e,r,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(xf)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let i=this._currNode;if(i instanceof e||r&&i instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof fa))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};Xe.CodeGen=HE;function ma(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Sy(t,e){return e instanceof ft._CodeOrName?ma(t,e.names):t}function sl(t,e,r){if(t instanceof ft.Name)return i(t);if(!n(t))return t;return new ft._Code(t._items.reduce((o,s)=>(s instanceof ft.Name&&(s=i(s)),s instanceof ft._Code?o.push(...s._items):o.push(s),o),[]));function i(o){let s=r[o.str];return s===void 0||e[o.str]!==1?o:(delete e[o.str],s)}function n(o){return o instanceof ft._Code&&o._items.some(s=>s instanceof ft.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function vse(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function ML(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ft._)`!${JE(t)}`}Xe.not=ML;var _se=ZL(Xe.operators.AND);function bse(...t){return t.reduce(_se)}Xe.and=bse;var wse=ZL(Xe.operators.OR);function Sse(...t){return t.reduce(wse)}Xe.or=Sse;function ZL(t){return(e,r)=>e===ft.nil?r:r===ft.nil?e:(0,ft._)`${JE(e)} ${t} ${JE(r)}`}function JE(t){return t instanceof ft.Name?t:(0,ft._)`(${t})`}});var mt=L(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.checkStrictMode=nt.getErrorPath=nt.Type=nt.useFunc=nt.setEvaluated=nt.evaluatedPropsToName=nt.mergeEvaluated=nt.eachItem=nt.unescapeJsonPointer=nt.escapeJsonPointer=nt.escapeFragment=nt.unescapeFragment=nt.schemaRefOrVal=nt.schemaHasRulesButRef=nt.schemaHasRules=nt.checkUnknownRules=nt.alwaysValidSchema=nt.toHash=void 0;var Dt=rt(),kse=Sf();function xse(t){let e={};for(let r of t)e[r]=!0;return e}nt.toHash=xse;function $se(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(FL(t,e),!VL(e,t.self.RULES.all))}nt.alwaysValidSchema=$se;function FL(t,e=t.schema){let{opts:r,self:i}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=i.RULES.keywords;for(let o in e)n[o]||BL(t,`unknown keyword: "${o}"`)}nt.checkUnknownRules=FL;function VL(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}nt.schemaHasRules=VL;function Ise(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}nt.schemaHasRulesButRef=Ise;function Ese({topSchemaRef:t,schemaPath:e},r,i,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Dt._)`${r}`}return(0,Dt._)`${t}${e}${(0,Dt.getProperty)(i)}`}nt.schemaRefOrVal=Ese;function Pse(t){return WL(decodeURIComponent(t))}nt.unescapeFragment=Pse;function Tse(t){return encodeURIComponent(QE(t))}nt.escapeFragment=Tse;function QE(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}nt.escapeJsonPointer=QE;function WL(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}nt.unescapeJsonPointer=WL;function Ose(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}nt.eachItem=Ose;function LL({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:i}){return(n,o,s,a)=>{let u=s===void 0?o:s instanceof Dt.Name?(o instanceof Dt.Name?t(n,o,s):e(n,o,s),s):o instanceof Dt.Name?(e(n,s,o),o):r(o,s);return a===Dt.Name&&!(u instanceof Dt.Name)?i(n,u):u}}nt.mergeEvaluated={props:LL({mergeNames:(t,e,r)=>t.if((0,Dt._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Dt._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Dt._)`${r} || {}`).code((0,Dt._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Dt._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Dt._)`${r} || {}`),XE(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:GL}),items:LL({mergeNames:(t,e,r)=>t.if((0,Dt._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Dt._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Dt._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Dt._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function GL(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Dt._)`{}`);return e!==void 0&&XE(t,r,e),r}nt.evaluatedPropsToName=GL;function XE(t,e,r){Object.keys(r).forEach(i=>t.assign((0,Dt._)`${e}${(0,Dt.getProperty)(i)}`,!0))}nt.setEvaluated=XE;var qL={};function zse(t,e){return t.scopeValue("func",{ref:e,code:qL[e.code]||(qL[e.code]=new kse._Code(e.code))})}nt.useFunc=zse;var YE;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(YE||(nt.Type=YE={}));function Nse(t,e,r){if(t instanceof Dt.Name){let i=e===YE.Num;return r?i?(0,Dt._)`"[" + ${t} + "]"`:(0,Dt._)`"['" + ${t} + "']"`:i?(0,Dt._)`"/" + ${t}`:(0,Dt._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Dt.getProperty)(t).toString():"/"+QE(t)}nt.getErrorPath=Nse;function BL(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}nt.checkStrictMode=BL});var bo=L(eP=>{"use strict";Object.defineProperty(eP,"__esModule",{value:!0});var Rr=rt(),jse={data:new Rr.Name("data"),valCxt:new Rr.Name("valCxt"),instancePath:new Rr.Name("instancePath"),parentData:new Rr.Name("parentData"),parentDataProperty:new Rr.Name("parentDataProperty"),rootData:new Rr.Name("rootData"),dynamicAnchors:new Rr.Name("dynamicAnchors"),vErrors:new Rr.Name("vErrors"),errors:new Rr.Name("errors"),this:new Rr.Name("this"),self:new Rr.Name("self"),scope:new Rr.Name("scope"),json:new Rr.Name("json"),jsonPos:new Rr.Name("jsonPos"),jsonLen:new Rr.Name("jsonLen"),jsonPart:new Rr.Name("jsonPart")};eP.default=jse});var Pf=L(Ar=>{"use strict";Object.defineProperty(Ar,"__esModule",{value:!0});Ar.extendErrors=Ar.resetErrorsCount=Ar.reportExtraError=Ar.reportError=Ar.keyword$DataError=Ar.keywordError=void 0;var ht=rt(),xy=mt(),nn=bo();Ar.keywordError={message:({keyword:t})=>(0,ht.str)`must pass "${t}" keyword validation`};Ar.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ht.str)`"${t}" keyword must be ${e} ($data)`:(0,ht.str)`"${t}" keyword is invalid ($data)`};function Cse(t,e=Ar.keywordError,r,i){let{it:n}=t,{gen:o,compositeRule:s,allErrors:a}=n,u=JL(t,e,r);i??(s||a)?KL(o,u):HL(n,(0,ht._)`[${u}]`)}Ar.reportError=Cse;function Rse(t,e=Ar.keywordError,r){let{it:i}=t,{gen:n,compositeRule:o,allErrors:s}=i,a=JL(t,e,r);KL(n,a),o||s||HL(i,nn.default.vErrors)}Ar.reportExtraError=Rse;function Ase(t,e){t.assign(nn.default.errors,e),t.if((0,ht._)`${nn.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ht._)`${nn.default.vErrors}.length`,e),()=>t.assign(nn.default.vErrors,null)))}Ar.resetErrorsCount=Ase;function Dse({gen:t,keyword:e,schemaValue:r,data:i,errsCount:n,it:o}){if(n===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",n,nn.default.errors,a=>{t.const(s,(0,ht._)`${nn.default.vErrors}[${a}]`),t.if((0,ht._)`${s}.instancePath === undefined`,()=>t.assign((0,ht._)`${s}.instancePath`,(0,ht.strConcat)(nn.default.instancePath,o.errorPath))),t.assign((0,ht._)`${s}.schemaPath`,(0,ht.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,ht._)`${s}.schema`,r),t.assign((0,ht._)`${s}.data`,i))})}Ar.extendErrors=Dse;function KL(t,e){let r=t.const("err",e);t.if((0,ht._)`${nn.default.vErrors} === null`,()=>t.assign(nn.default.vErrors,(0,ht._)`[${r}]`),(0,ht._)`${nn.default.vErrors}.push(${r})`),t.code((0,ht._)`${nn.default.errors}++`)}function HL(t,e){let{gen:r,validateName:i,schemaEnv:n}=t;n.$async?r.throw((0,ht._)`new ${t.ValidationError}(${e})`):(r.assign((0,ht._)`${i}.errors`,e),r.return(!1))}var ha={keyword:new ht.Name("keyword"),schemaPath:new ht.Name("schemaPath"),params:new ht.Name("params"),propertyName:new ht.Name("propertyName"),message:new ht.Name("message"),schema:new ht.Name("schema"),parentSchema:new ht.Name("parentSchema")};function JL(t,e,r){let{createErrors:i}=t.it;return i===!1?(0,ht._)`{}`:Use(t,e,r)}function Use(t,e,r={}){let{gen:i,it:n}=t,o=[Mse(n,r),Zse(t,r)];return Lse(t,e,o),i.object(...o)}function Mse({errorPath:t},{instancePath:e}){let r=e?(0,ht.str)`${t}${(0,xy.getErrorPath)(e,xy.Type.Str)}`:t;return[nn.default.instancePath,(0,ht.strConcat)(nn.default.instancePath,r)]}function Zse({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:i}){let n=i?e:(0,ht.str)`${e}/${t}`;return r&&(n=(0,ht.str)`${n}${(0,xy.getErrorPath)(r,xy.Type.Str)}`),[ha.schemaPath,n]}function Lse(t,{params:e,message:r},i){let{keyword:n,data:o,schemaValue:s,it:a}=t,{opts:u,propertyName:l,topSchemaRef:c,schemaPath:d}=a;i.push([ha.keyword,n],[ha.params,typeof e=="function"?e(t):e||(0,ht._)`{}`]),u.messages&&i.push([ha.message,typeof r=="function"?r(t):r]),u.verbose&&i.push([ha.schema,s],[ha.parentSchema,(0,ht._)`${c}${d}`],[nn.default.data,o]),l&&i.push([ha.propertyName,l])}});var QL=L(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.boolOrEmptySchema=al.topBoolOrEmptySchema=void 0;var qse=Pf(),Fse=rt(),Vse=bo(),Wse={message:"boolean schema is false"};function Gse(t){let{gen:e,schema:r,validateName:i}=t;r===!1?YL(t,!1):typeof r=="object"&&r.$async===!0?e.return(Vse.default.data):(e.assign((0,Fse._)`${i}.errors`,null),e.return(!0))}al.topBoolOrEmptySchema=Gse;function Bse(t,e){let{gen:r,schema:i}=t;i===!1?(r.var(e,!1),YL(t)):r.var(e,!0)}al.boolOrEmptySchema=Bse;function YL(t,e){let{gen:r,data:i}=t,n={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,qse.reportError)(n,Wse,void 0,e)}});var tP=L(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.getRules=ul.isJSONType=void 0;var Kse=["string","number","integer","boolean","null","object","array"],Hse=new Set(Kse);function Jse(t){return typeof t=="string"&&Hse.has(t)}ul.isJSONType=Jse;function Yse(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}ul.getRules=Yse});var rP=L(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.shouldUseRule=ts.shouldUseGroup=ts.schemaHasRulesForType=void 0;function Qse({schema:t,self:e},r){let i=e.RULES.types[r];return i&&i!==!0&&XL(t,i)}ts.schemaHasRulesForType=Qse;function XL(t,e){return e.rules.some(r=>e6(t,r))}ts.shouldUseGroup=XL;function e6(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(i=>t[i]!==void 0))}ts.shouldUseRule=e6});var Tf=L(Dr=>{"use strict";Object.defineProperty(Dr,"__esModule",{value:!0});Dr.reportTypeError=Dr.checkDataTypes=Dr.checkDataType=Dr.coerceAndCheckDataType=Dr.getJSONTypes=Dr.getSchemaTypes=Dr.DataType=void 0;var Xse=tP(),eae=rP(),tae=Pf(),We=rt(),t6=mt(),ll;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(ll||(Dr.DataType=ll={}));function rae(t){let e=r6(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Dr.getSchemaTypes=rae;function r6(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(Xse.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Dr.getJSONTypes=r6;function nae(t,e){let{gen:r,data:i,opts:n}=t,o=iae(e,n.coerceTypes),s=e.length>0&&!(o.length===0&&e.length===1&&(0,eae.schemaHasRulesForType)(t,e[0]));if(s){let a=iP(e,i,n.strictNumbers,ll.Wrong);r.if(a,()=>{o.length?oae(t,e,o):oP(t)})}return s}Dr.coerceAndCheckDataType=nae;var n6=new Set(["string","number","integer","boolean","null"]);function iae(t,e){return e?t.filter(r=>n6.has(r)||e==="array"&&r==="array"):[]}function oae(t,e,r){let{gen:i,data:n,opts:o}=t,s=i.let("dataType",(0,We._)`typeof ${n}`),a=i.let("coerced",(0,We._)`undefined`);o.coerceTypes==="array"&&i.if((0,We._)`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,We._)`${n}[0]`).assign(s,(0,We._)`typeof ${n}`).if(iP(e,n,o.strictNumbers),()=>i.assign(a,n))),i.if((0,We._)`${a} !== undefined`);for(let l of r)(n6.has(l)||l==="array"&&o.coerceTypes==="array")&&u(l);i.else(),oP(t),i.endIf(),i.if((0,We._)`${a} !== undefined`,()=>{i.assign(n,a),sae(t,a)});function u(l){switch(l){case"string":i.elseIf((0,We._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,We._)`"" + ${n}`).elseIf((0,We._)`${n} === null`).assign(a,(0,We._)`""`);return;case"number":i.elseIf((0,We._)`${s} == "boolean" || ${n} === null
228
- || (${s} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,We._)`+${n}`);return;case"integer":i.elseIf((0,We._)`${s} === "boolean" || ${n} === null
229
- || (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,We._)`+${n}`);return;case"boolean":i.elseIf((0,We._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,We._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":i.elseIf((0,We._)`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(a,null);return;case"array":i.elseIf((0,We._)`${s} === "string" || ${s} === "number"
230
- || ${s} === "boolean" || ${n} === null`).assign(a,(0,We._)`[${n}]`)}}}function sae({gen:t,parentData:e,parentDataProperty:r},i){t.if((0,We._)`${e} !== undefined`,()=>t.assign((0,We._)`${e}[${r}]`,i))}function nP(t,e,r,i=ll.Correct){let n=i===ll.Correct?We.operators.EQ:We.operators.NEQ,o;switch(t){case"null":return(0,We._)`${e} ${n} null`;case"array":o=(0,We._)`Array.isArray(${e})`;break;case"object":o=(0,We._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=s((0,We._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=s();break;default:return(0,We._)`typeof ${e} ${n} ${t}`}return i===ll.Correct?o:(0,We.not)(o);function s(a=We.nil){return(0,We.and)((0,We._)`typeof ${e} == "number"`,a,r?(0,We._)`isFinite(${e})`:We.nil)}}Dr.checkDataType=nP;function iP(t,e,r,i){if(t.length===1)return nP(t[0],e,r,i);let n,o=(0,t6.toHash)(t);if(o.array&&o.object){let s=(0,We._)`typeof ${e} != "object"`;n=o.null?s:(0,We._)`!${e} || ${s}`,delete o.null,delete o.array,delete o.object}else n=We.nil;o.number&&delete o.integer;for(let s in o)n=(0,We.and)(n,nP(s,e,r,i));return n}Dr.checkDataTypes=iP;var aae={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,We._)`{type: ${t}}`:(0,We._)`{type: ${e}}`};function oP(t){let e=uae(t);(0,tae.reportError)(e,aae)}Dr.reportTypeError=oP;function uae(t){let{gen:e,data:r,schema:i}=t,n=(0,t6.schemaRefOrVal)(t,i,"type");return{gen:e,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:t}}});var o6=L($y=>{"use strict";Object.defineProperty($y,"__esModule",{value:!0});$y.assignDefaults=void 0;var cl=rt(),lae=mt();function cae(t,e){let{properties:r,items:i}=t.schema;if(e==="object"&&r)for(let n in r)i6(t,n,r[n].default);else e==="array"&&Array.isArray(i)&&i.forEach((n,o)=>i6(t,o,n.default))}$y.assignDefaults=cae;function i6(t,e,r){let{gen:i,compositeRule:n,data:o,opts:s}=t;if(r===void 0)return;let a=(0,cl._)`${o}${(0,cl.getProperty)(e)}`;if(n){(0,lae.checkStrictMode)(t,`default is ignored for: ${a}`);return}let u=(0,cl._)`${a} === undefined`;s.useDefaults==="empty"&&(u=(0,cl._)`${u} || ${a} === null || ${a} === ""`),i.if(u,(0,cl._)`${a} = ${(0,cl.stringify)(r)}`)}});var ri=L(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.validateUnion=Tt.validateArray=Tt.usePattern=Tt.callValidateCode=Tt.schemaProperties=Tt.allSchemaProperties=Tt.noPropertyInData=Tt.propertyInData=Tt.isOwnProperty=Tt.hasPropFunc=Tt.reportMissingProp=Tt.checkMissingProp=Tt.checkReportMissingProp=void 0;var Wt=rt(),sP=mt(),rs=bo(),dae=mt();function fae(t,e){let{gen:r,data:i,it:n}=t;r.if(uP(r,i,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Wt._)`${e}`},!0),t.error()})}Tt.checkReportMissingProp=fae;function pae({gen:t,data:e,it:{opts:r}},i,n){return(0,Wt.or)(...i.map(o=>(0,Wt.and)(uP(t,e,o,r.ownProperties),(0,Wt._)`${n} = ${o}`)))}Tt.checkMissingProp=pae;function mae(t,e){t.setParams({missingProperty:e},!0),t.error()}Tt.reportMissingProp=mae;function s6(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Wt._)`Object.prototype.hasOwnProperty`})}Tt.hasPropFunc=s6;function aP(t,e,r){return(0,Wt._)`${s6(t)}.call(${e}, ${r})`}Tt.isOwnProperty=aP;function hae(t,e,r,i){let n=(0,Wt._)`${e}${(0,Wt.getProperty)(r)} !== undefined`;return i?(0,Wt._)`${n} && ${aP(t,e,r)}`:n}Tt.propertyInData=hae;function uP(t,e,r,i){let n=(0,Wt._)`${e}${(0,Wt.getProperty)(r)} === undefined`;return i?(0,Wt.or)(n,(0,Wt.not)(aP(t,e,r))):n}Tt.noPropertyInData=uP;function a6(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Tt.allSchemaProperties=a6;function gae(t,e){return a6(e).filter(r=>!(0,sP.alwaysValidSchema)(t,e[r]))}Tt.schemaProperties=gae;function yae({schemaCode:t,data:e,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},a,u,l){let c=l?(0,Wt._)`${t}, ${e}, ${i}${n}`:e,d=[[rs.default.instancePath,(0,Wt.strConcat)(rs.default.instancePath,o)],[rs.default.parentData,s.parentData],[rs.default.parentDataProperty,s.parentDataProperty],[rs.default.rootData,rs.default.rootData]];s.opts.dynamicRef&&d.push([rs.default.dynamicAnchors,rs.default.dynamicAnchors]);let p=(0,Wt._)`${c}, ${r.object(...d)}`;return u!==Wt.nil?(0,Wt._)`${a}.call(${u}, ${p})`:(0,Wt._)`${a}(${p})`}Tt.callValidateCode=yae;var vae=(0,Wt._)`new RegExp`;function _ae({gen:t,it:{opts:e}},r){let i=e.unicodeRegExp?"u":"",{regExp:n}=e.code,o=n(r,i);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Wt._)`${n.code==="new RegExp"?vae:(0,dae.useFunc)(t,n)}(${r}, ${i})`})}Tt.usePattern=_ae;function bae(t){let{gen:e,data:r,keyword:i,it:n}=t,o=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(o,!0),s(()=>e.break()),o;function s(a){let u=e.const("len",(0,Wt._)`${r}.length`);e.forRange("i",0,u,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:sP.Type.Num},o),e.if((0,Wt.not)(o),a)})}}Tt.validateArray=bae;function wae(t){let{gen:e,schema:r,keyword:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(u=>(0,sP.alwaysValidSchema)(n,u))&&!n.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((u,l)=>{let c=t.subschema({keyword:i,schemaProp:l,compositeRule:!0},a);e.assign(s,(0,Wt._)`${s} || ${a}`),t.mergeValidEvaluated(c,a)||e.if((0,Wt.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}Tt.validateUnion=wae});var c6=L(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.validateKeywordUsage=Fi.validSchemaType=Fi.funcKeywordCode=Fi.macroKeywordCode=void 0;var on=rt(),ga=bo(),Sae=ri(),kae=Pf();function xae(t,e){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=t,a=e.macro.call(s.self,n,o,s),u=l6(r,i,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:on.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:u,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}Fi.macroKeywordCode=xae;function $ae(t,e){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:a,it:u}=t;Eae(u,e);let l=!a&&e.compile?e.compile.call(u.self,o,s,u):e.validate,c=l6(i,n,l),d=i.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)g(),e.modifying&&u6(t),v(()=>t.error());else{let h=e.async?f():m();e.modifying&&u6(t),v(()=>Iae(t,h))}}function f(){let h=i.let("ruleErrs",null);return i.try(()=>g((0,on._)`await `),y=>i.assign(d,!1).if((0,on._)`${y} instanceof ${u.ValidationError}`,()=>i.assign(h,(0,on._)`${y}.errors`),()=>i.throw(y))),h}function m(){let h=(0,on._)`${c}.errors`;return i.assign(h,null),g(on.nil),h}function g(h=e.async?(0,on._)`await `:on.nil){let y=u.opts.passContext?ga.default.this:ga.default.self,_=!("compile"in e&&!a||e.schema===!1);i.assign(d,(0,on._)`${h}${(0,Sae.callValidateCode)(t,c,y,_)}`,e.modifying)}function v(h){var y;i.if((0,on.not)((y=e.valid)!==null&&y!==void 0?y:d),h)}}Fi.funcKeywordCode=$ae;function u6(t){let{gen:e,data:r,it:i}=t;e.if(i.parentData,()=>e.assign(r,(0,on._)`${i.parentData}[${i.parentDataProperty}]`))}function Iae(t,e){let{gen:r}=t;r.if((0,on._)`Array.isArray(${e})`,()=>{r.assign(ga.default.vErrors,(0,on._)`${ga.default.vErrors} === null ? ${e} : ${ga.default.vErrors}.concat(${e})`).assign(ga.default.errors,(0,on._)`${ga.default.vErrors}.length`),(0,kae.extendErrors)(t)},()=>t.error())}function Eae({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function l6(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,on.stringify)(r)})}function Pae(t,e,r=!1){return!e.length||e.some(i=>i==="array"?Array.isArray(t):i==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==i||r&&typeof t>"u")}Fi.validSchemaType=Pae;function Tae({schema:t,opts:e,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");let s=n.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[o])){let u=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(u);else throw new Error(u)}}Fi.validateKeywordUsage=Tae});var f6=L(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.extendSubschemaMode=ns.extendSubschemaData=ns.getSubschema=void 0;var Vi=rt(),d6=mt();function Oae(t,{keyword:e,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(e!==void 0&&i!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Vi._)`${t.schemaPath}${(0,Vi.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Vi._)`${t.schemaPath}${(0,Vi.getProperty)(e)}${(0,Vi.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,d6.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}ns.getSubschema=Oae;function zae(t,e,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:c,opts:d}=e,p=a.let("data",(0,Vi._)`${e.data}${(0,Vi.getProperty)(r)}`,!0);u(p),t.errorPath=(0,Vi.str)`${l}${(0,d6.getErrorPath)(r,i,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Vi._)`${r}`,t.dataPathArr=[...c,t.parentDataProperty]}if(n!==void 0){let l=n instanceof Vi.Name?n:a.let("data",n,!0);u(l),s!==void 0&&(t.propertyName=s)}o&&(t.dataTypes=o);function u(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}ns.extendSubschemaData=zae;function Nae(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){i!==void 0&&(t.compositeRule=i),n!==void 0&&(t.createErrors=n),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}ns.extendSubschemaMode=Nae});var Of=L((sze,p6)=>{"use strict";p6.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var i,n,o;if(Array.isArray(e)){if(i=e.length,i!=r.length)return!1;for(n=i;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),i=o.length,i!==Object.keys(r).length)return!1;for(n=i;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[n]))return!1;for(n=i;n--!==0;){var s=o[n];if(!t(e[s],r[s]))return!1}return!0}return e!==e&&r!==r}});var h6=L((aze,m6)=>{"use strict";var is=m6.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Iy(e,i,n,t,"",t)};is.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};is.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};is.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};is.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Iy(t,e,r,i,n,o,s,a,u,l){if(i&&typeof i=="object"&&!Array.isArray(i)){e(i,n,o,s,a,u,l);for(var c in i){var d=i[c];if(Array.isArray(d)){if(c in is.arrayKeywords)for(var p=0;p<d.length;p++)Iy(t,e,r,d[p],n+"/"+c+"/"+p,o,n,c,i,p)}else if(c in is.propsKeywords){if(d&&typeof d=="object")for(var f in d)Iy(t,e,r,d[f],n+"/"+c+"/"+jae(f),o,n,c,i,f)}else(c in is.keywords||t.allKeys&&!(c in is.skipKeywords))&&Iy(t,e,r,d,n+"/"+c,o,n,c,i)}r(i,n,o,s,a,u,l)}}function jae(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var zf=L(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.getSchemaRefs=yn.resolveUrl=yn.normalizeId=yn._getFullPath=yn.getFullPath=yn.inlineRef=void 0;var Cae=mt(),Rae=Of(),Aae=h6(),Dae=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Uae(t,e=!0){return typeof t=="boolean"?!0:e===!0?!lP(t):e?g6(t)<=e:!1}yn.inlineRef=Uae;var Mae=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function lP(t){for(let e in t){if(Mae.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(lP)||typeof r=="object"&&lP(r))return!0}return!1}function g6(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Dae.has(r)&&(typeof t[r]=="object"&&(0,Cae.eachItem)(t[r],i=>e+=g6(i)),e===1/0))return 1/0}return e}function y6(t,e="",r){r!==!1&&(e=dl(e));let i=t.parse(e);return v6(t,i)}yn.getFullPath=y6;function v6(t,e){return t.serialize(e).split("#")[0]+"#"}yn._getFullPath=v6;var Zae=/#\/?$/;function dl(t){return t?t.replace(Zae,""):""}yn.normalizeId=dl;function Lae(t,e,r){return r=dl(r),t.resolve(e,r)}yn.resolveUrl=Lae;var qae=/^[a-z_][-a-z0-9._]*$/i;function Fae(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=dl(t[r]||e),o={"":n},s=y6(i,n,!1),a={},u=new Set;return Aae(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let g=s+p,v=o[m];typeof d[r]=="string"&&(v=h.call(this,d[r])),y.call(this,d.$anchor),y.call(this,d.$dynamicAnchor),o[p]=v;function h(_){let b=this.opts.uriResolver.resolve;if(_=dl(v?b(v,_):_),u.has(_))throw c(_);u.add(_);let w=this.refs[_];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?l(d,w.schema,_):_!==dl(g)&&(_[0]==="#"?(l(d,a[_],_),a[_]=d):this.refs[_]=g),_}function y(_){if(typeof _=="string"){if(!qae.test(_))throw new Error(`invalid anchor "${_}"`);h.call(this,`#${_}`)}}}),a;function l(d,p,f){if(p!==void 0&&!Rae(d,p))throw c(f)}function c(d){return new Error(`reference "${d}" resolves to more than one schema`)}}yn.getSchemaRefs=Fae});var Cf=L(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.getData=os.KeywordCxt=os.validateFunctionCode=void 0;var k6=QL(),_6=Tf(),dP=rP(),Ey=Tf(),Vae=o6(),jf=c6(),cP=f6(),Se=rt(),Re=bo(),Wae=zf(),wo=mt(),Nf=Pf();function Gae(t){if(I6(t)&&(E6(t),$6(t))){Hae(t);return}x6(t,()=>(0,k6.topBoolOrEmptySchema)(t))}os.validateFunctionCode=Gae;function x6({gen:t,validateName:e,schema:r,schemaEnv:i,opts:n},o){n.code.es5?t.func(e,(0,Se._)`${Re.default.data}, ${Re.default.valCxt}`,i.$async,()=>{t.code((0,Se._)`"use strict"; ${b6(r,n)}`),Kae(t,n),t.code(o)}):t.func(e,(0,Se._)`${Re.default.data}, ${Bae(n)}`,i.$async,()=>t.code(b6(r,n)).code(o))}function Bae(t){return(0,Se._)`{${Re.default.instancePath}="", ${Re.default.parentData}, ${Re.default.parentDataProperty}, ${Re.default.rootData}=${Re.default.data}${t.dynamicRef?(0,Se._)`, ${Re.default.dynamicAnchors}={}`:Se.nil}}={}`}function Kae(t,e){t.if(Re.default.valCxt,()=>{t.var(Re.default.instancePath,(0,Se._)`${Re.default.valCxt}.${Re.default.instancePath}`),t.var(Re.default.parentData,(0,Se._)`${Re.default.valCxt}.${Re.default.parentData}`),t.var(Re.default.parentDataProperty,(0,Se._)`${Re.default.valCxt}.${Re.default.parentDataProperty}`),t.var(Re.default.rootData,(0,Se._)`${Re.default.valCxt}.${Re.default.rootData}`),e.dynamicRef&&t.var(Re.default.dynamicAnchors,(0,Se._)`${Re.default.valCxt}.${Re.default.dynamicAnchors}`)},()=>{t.var(Re.default.instancePath,(0,Se._)`""`),t.var(Re.default.parentData,(0,Se._)`undefined`),t.var(Re.default.parentDataProperty,(0,Se._)`undefined`),t.var(Re.default.rootData,Re.default.data),e.dynamicRef&&t.var(Re.default.dynamicAnchors,(0,Se._)`{}`)})}function Hae(t){let{schema:e,opts:r,gen:i}=t;x6(t,()=>{r.$comment&&e.$comment&&T6(t),eue(t),i.let(Re.default.vErrors,null),i.let(Re.default.errors,0),r.unevaluated&&Jae(t),P6(t),nue(t)})}function Jae(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,Se._)`${r}.evaluated`),e.if((0,Se._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,Se._)`${t.evaluated}.props`,(0,Se._)`undefined`)),e.if((0,Se._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,Se._)`${t.evaluated}.items`,(0,Se._)`undefined`))}function b6(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,Se._)`/*# sourceURL=${r} */`:Se.nil}function Yae(t,e){if(I6(t)&&(E6(t),$6(t))){Qae(t,e);return}(0,k6.boolOrEmptySchema)(t,e)}function $6({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function I6(t){return typeof t.schema!="boolean"}function Qae(t,e){let{schema:r,gen:i,opts:n}=t;n.$comment&&r.$comment&&T6(t),tue(t),rue(t);let o=i.const("_errs",Re.default.errors);P6(t,o),i.var(e,(0,Se._)`${o} === ${Re.default.errors}`)}function E6(t){(0,wo.checkUnknownRules)(t),Xae(t)}function P6(t,e){if(t.opts.jtd)return w6(t,[],!1,e);let r=(0,_6.getSchemaTypes)(t.schema),i=(0,_6.coerceAndCheckDataType)(t,r);w6(t,r,!i,e)}function Xae(t){let{schema:e,errSchemaPath:r,opts:i,self:n}=t;e.$ref&&i.ignoreKeywordsWithRef&&(0,wo.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function eue(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,wo.checkStrictMode)(t,"default is ignored in the schema root")}function tue(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Wae.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function rue(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function T6({gen:t,schemaEnv:e,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)t.code((0,Se._)`${Re.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=(0,Se.str)`${i}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,Se._)`${Re.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function nue(t){let{gen:e,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=t;r.$async?e.if((0,Se._)`${Re.default.errors} === 0`,()=>e.return(Re.default.data),()=>e.throw((0,Se._)`new ${n}(${Re.default.vErrors})`)):(e.assign((0,Se._)`${i}.errors`,Re.default.vErrors),o.unevaluated&&iue(t),e.return((0,Se._)`${Re.default.errors} === 0`))}function iue({gen:t,evaluated:e,props:r,items:i}){r instanceof Se.Name&&t.assign((0,Se._)`${e}.props`,r),i instanceof Se.Name&&t.assign((0,Se._)`${e}.items`,i)}function w6(t,e,r,i){let{gen:n,schema:o,data:s,allErrors:a,opts:u,self:l}=t,{RULES:c}=l;if(o.$ref&&(u.ignoreKeywordsWithRef||!(0,wo.schemaHasRulesButRef)(o,c))){n.block(()=>z6(t,"$ref",c.all.$ref.definition));return}u.jtd||oue(t,e),n.block(()=>{for(let p of c.rules)d(p);d(c.post)});function d(p){(0,dP.shouldUseGroup)(o,p)&&(p.type?(n.if((0,Ey.checkDataType)(p.type,s,u.strictNumbers)),S6(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,Ey.reportTypeError)(t)),n.endIf()):S6(t,p),a||n.if((0,Se._)`${Re.default.errors} === ${i||0}`))}}function S6(t,e){let{gen:r,schema:i,opts:{useDefaults:n}}=t;n&&(0,Vae.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,dP.shouldUseRule)(i,o)&&z6(t,o.keyword,o.definition,e.type)})}function oue(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(sue(t,e),t.opts.allowUnionTypes||aue(t,e),uue(t,t.dataTypes))}function sue(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{O6(t.dataTypes,r)||fP(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),cue(t,e)}}function aue(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&fP(t,"use allowUnionTypes to allow union type keyword")}function uue(t,e){let r=t.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,dP.shouldUseRule)(t.schema,n)){let{type:o}=n.definition;o.length&&!o.some(s=>lue(e,s))&&fP(t,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function lue(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function O6(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function cue(t,e){let r=[];for(let i of t.dataTypes)O6(e,i)?r.push(i):e.includes("integer")&&i==="number"&&r.push("integer");t.dataTypes=r}function fP(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,wo.checkStrictMode)(t,e,t.opts.strictTypes)}var Py=class{constructor(e,r,i){if((0,jf.validateKeywordUsage)(e,r,i),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=i,this.data=e.data,this.schema=e.schema[i],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,wo.schemaRefOrVal)(e,this.schema,i,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",N6(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,jf.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${i} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",Re.default.errors))}result(e,r,i){this.failResult((0,Se.not)(e),r,i)}failResult(e,r,i){this.gen.if(e),i?i():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,Se.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,Se._)`${r} !== undefined && (${(0,Se.or)(this.invalid$data(),e)})`)}error(e,r,i){if(r){this.setParams(r),this._error(e,i),this.setParams({});return}this._error(e,i)}_error(e,r){(e?Nf.reportExtraError:Nf.reportError)(this,this.def.error,r)}$dataError(){(0,Nf.reportError)(this,this.def.$dataError||Nf.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Nf.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,i=Se.nil){this.gen.block(()=>{this.check$data(e,i),r()})}check$data(e=Se.nil,r=Se.nil){if(!this.$data)return;let{gen:i,schemaCode:n,schemaType:o,def:s}=this;i.if((0,Se.or)((0,Se._)`${n} === undefined`,r)),e!==Se.nil&&i.assign(e,!0),(o.length||s.validateSchema)&&(i.elseIf(this.invalid$data()),this.$dataError(),e!==Se.nil&&i.assign(e,!1)),i.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:i,def:n,it:o}=this;return(0,Se.or)(s(),a());function s(){if(i.length){if(!(r instanceof Se.Name))throw new Error("ajv implementation error");let u=Array.isArray(i)?i:[i];return(0,Se._)`${(0,Ey.checkDataTypes)(u,r,o.opts.strictNumbers,Ey.DataType.Wrong)}`}return Se.nil}function a(){if(n.validateSchema){let u=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,Se._)`!${u}(${r})`}return Se.nil}}subschema(e,r){let i=(0,cP.getSubschema)(this.it,e);(0,cP.extendSubschemaData)(i,this.it,e),(0,cP.extendSubschemaMode)(i,e);let n={...this.it,...i,items:void 0,props:void 0};return Yae(n,r),n}mergeEvaluated(e,r){let{it:i,gen:n}=this;i.opts.unevaluated&&(i.props!==!0&&e.props!==void 0&&(i.props=wo.mergeEvaluated.props(n,e.props,i.props,r)),i.items!==!0&&e.items!==void 0&&(i.items=wo.mergeEvaluated.items(n,e.items,i.items,r)))}mergeValidEvaluated(e,r){let{it:i,gen:n}=this;if(i.opts.unevaluated&&(i.props!==!0||i.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,Se.Name)),!0}};os.KeywordCxt=Py;function z6(t,e,r,i){let n=new Py(t,r,e);"code"in r?r.code(n,i):n.$data&&r.validate?(0,jf.funcKeywordCode)(n,r):"macro"in r?(0,jf.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,jf.funcKeywordCode)(n,r)}var due=/^\/(?:[^~]|~0|~1)*$/,fue=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N6(t,{dataLevel:e,dataNames:r,dataPathArr:i}){let n,o;if(t==="")return Re.default.rootData;if(t[0]==="/"){if(!due.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,o=Re.default.rootData}else{let l=fue.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let c=+l[1];if(n=l[2],n==="#"){if(c>=e)throw new Error(u("property/index",c));return i[e-c]}if(c>e)throw new Error(u("data",c));if(o=r[e-c],!n)return o}let s=o,a=n.split("/");for(let l of a)l&&(o=(0,Se._)`${o}${(0,Se.getProperty)((0,wo.unescapeJsonPointer)(l))}`,s=(0,Se._)`${s} && ${o}`);return s;function u(l,c){return`Cannot access ${l} ${c} levels up, current level is ${e}`}}os.getData=N6});var Ty=L(mP=>{"use strict";Object.defineProperty(mP,"__esModule",{value:!0});var pP=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};mP.default=pP});var Rf=L(yP=>{"use strict";Object.defineProperty(yP,"__esModule",{value:!0});var hP=zf(),gP=class extends Error{constructor(e,r,i,n){super(n||`can't resolve reference ${i} from id ${r}`),this.missingRef=(0,hP.resolveUrl)(e,r,i),this.missingSchema=(0,hP.normalizeId)((0,hP.getFullPath)(e,this.missingRef))}};yP.default=gP});var zy=L(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.resolveSchema=ni.getCompilingSchema=ni.resolveRef=ni.compileSchema=ni.SchemaEnv=void 0;var $i=rt(),pue=Ty(),ya=bo(),Ii=zf(),j6=mt(),mue=Cf(),fl=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let i;typeof e.schema=="object"&&(i=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Ii.normalizeId)(i?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=i?.$async,this.refs={}}};ni.SchemaEnv=fl;function _P(t){let e=C6.call(this,t);if(e)return e;let r=(0,Ii.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new $i.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),a;t.$async&&(a=s.scopeValue("Error",{ref:pue.default,code:(0,$i._)`require("ajv/dist/runtime/validation_error").default`}));let u=s.scopeName("validate");t.validateName=u;let l={gen:s,allErrors:this.opts.allErrors,data:ya.default.data,parentData:ya.default.parentData,parentDataProperty:ya.default.parentDataProperty,dataNames:[ya.default.data],dataPathArr:[$i.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,$i.stringify)(t.schema)}:{ref:t.schema}),validateName:u,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:$i.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,$i._)`""`,opts:this.opts,self:this},c;try{this._compilations.add(t),(0,mue.validateFunctionCode)(l),s.optimize(this.opts.code.optimize);let d=s.toString();c=`${s.scopeRefs(ya.default.scope)}return ${d}`,this.opts.code.process&&(c=this.opts.code.process(c,t));let f=new Function(`${ya.default.self}`,`${ya.default.scope}`,c)(this,this.scope.get());if(this.scope.value(u,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:u,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:g}=l;f.evaluated={props:m instanceof $i.Name?void 0:m,items:g instanceof $i.Name?void 0:g,dynamicProps:m instanceof $i.Name,dynamicItems:g instanceof $i.Name},f.source&&(f.source.evaluated=(0,$i.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,c&&this.logger.error("Error compiling schema, function code:",c),d}finally{this._compilations.delete(t)}}ni.compileSchema=_P;function hue(t,e,r){var i;r=(0,Ii.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let o=vue.call(this,t,r);if(o===void 0){let s=(i=t.localRefs)===null||i===void 0?void 0:i[r],{schemaId:a}=this.opts;s&&(o=new fl({schema:s,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=gue.call(this,o)}ni.resolveRef=hue;function gue(t){return(0,Ii.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:_P.call(this,t)}function C6(t){for(let e of this._compilations)if(yue(e,t))return e}ni.getCompilingSchema=C6;function yue(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function vue(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Oy.call(this,t,e)}function Oy(t,e){let r=this.opts.uriResolver.parse(e),i=(0,Ii._getFullPath)(this.opts.uriResolver,r),n=(0,Ii.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&i===n)return vP.call(this,r,t);let o=(0,Ii.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=Oy.call(this,t,s);return typeof a?.schema!="object"?void 0:vP.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||_P.call(this,s),o===(0,Ii.normalizeId)(e)){let{schema:a}=s,{schemaId:u}=this.opts,l=a[u];return l&&(n=(0,Ii.resolveUrl)(this.opts.uriResolver,n,l)),new fl({schema:a,schemaId:u,root:t,baseId:n})}return vP.call(this,r,s)}}ni.resolveSchema=Oy;var _ue=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function vP(t,{baseId:e,schema:r,root:i}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let u=r[(0,j6.unescapeFragment)(a)];if(u===void 0)return;r=u;let l=typeof r=="object"&&r[this.opts.schemaId];!_ue.has(a)&&l&&(e=(0,Ii.resolveUrl)(this.opts.uriResolver,e,l))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,j6.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Ii.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=Oy.call(this,i,a)}let{schemaId:s}=this.opts;if(o=o||new fl({schema:r,schemaId:s,root:i,baseId:e}),o.schema!==o.root.schema)return o}});var R6=L((pze,bue)=>{bue.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var wP=L((mze,M6)=>{"use strict";var wue=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),D6=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function bP(t){let e="",r=0,i=0;for(i=0;i<t.length;i++)if(r=t[i].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[i];break}for(i+=1;i<t.length;i++){if(r=t[i].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[i]}return e}var Sue=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function A6(t){return t.length=0,!0}function kue(t,e,r){if(t.length){let i=bP(t);if(i!=="")e.push(i);else return r.error=!0,!1;t.length=0}return!0}function xue(t){let e=0,r={error:!1,address:"",zone:""},i=[],n=[],o=!1,s=!1,a=kue;for(let u=0;u<t.length;u++){let l=t[u];if(!(l==="["||l==="]"))if(l===":"){if(o===!0&&(s=!0),!a(n,i,r))break;if(++e>7){r.error=!0;break}u>0&&t[u-1]===":"&&(o=!0),i.push(":");continue}else if(l==="%"){if(!a(n,i,r))break;a=A6}else{n.push(l);continue}}return n.length&&(a===A6?r.zone=n.join(""):s?i.push(n.join("")):i.push(bP(n))),r.address=i.join(""),r}function U6(t){if($ue(t,":")<2)return{host:t,isIPV6:!1};let e=xue(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,i=e.address;return e.zone&&(r+="%"+e.zone,i+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:i}}}function $ue(t,e){let r=0;for(let i=0;i<t.length;i++)t[i]===e&&r++;return r}function Iue(t){let e=t,r=[],i=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((i=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,i)),e=e.slice(i)}return r.join("")}function Eue(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function Pue(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!D6(r)){let i=U6(r);i.isIPV6===!0?r=`[${i.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}M6.exports={nonSimpleDomain:Sue,recomposeAuthority:Pue,normalizeComponentEncoding:Eue,removeDotSegments:Iue,isIPv4:D6,isUUID:wue,normalizeIPv6:U6,stringArrayToHexStripped:bP}});var V6=L((hze,F6)=>{"use strict";var{isUUID:Tue}=wP(),Oue=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,zue=["http","https","ws","wss","urn","urn:uuid"];function Nue(t){return zue.indexOf(t)!==-1}function SP(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function Z6(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function L6(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function jue(t){return t.secure=SP(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function Cue(t){if((t.port===(SP(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function Rue(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(Oue);if(r){let i=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${i}:${e.nid||t.nid}`,o=kP(n);t.path=void 0,o&&(t=o.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Aue(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",i=t.nid.toLowerCase(),n=`${r}:${e.nid||i}`,o=kP(n);o&&(t=o.serialize(t,e));let s=t,a=t.nss;return s.path=`${i||e.nid}:${a}`,e.skipEscape=!0,s}function Due(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!Tue(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Uue(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var q6={scheme:"http",domainHost:!0,parse:Z6,serialize:L6},Mue={scheme:"https",domainHost:q6.domainHost,parse:Z6,serialize:L6},Ny={scheme:"ws",domainHost:!0,parse:jue,serialize:Cue},Zue={scheme:"wss",domainHost:Ny.domainHost,parse:Ny.parse,serialize:Ny.serialize},Lue={scheme:"urn",parse:Rue,serialize:Aue,skipNormalize:!0},que={scheme:"urn:uuid",parse:Due,serialize:Uue,skipNormalize:!0},jy={http:q6,https:Mue,ws:Ny,wss:Zue,urn:Lue,"urn:uuid":que};Object.setPrototypeOf(jy,null);function kP(t){return t&&(jy[t]||jy[t.toLowerCase()])||void 0}F6.exports={wsIsSecure:SP,SCHEMES:jy,isValidSchemeName:Nue,getSchemeHandler:kP}});var $P=L((gze,Ry)=>{"use strict";var{normalizeIPv6:Fue,removeDotSegments:Af,recomposeAuthority:Vue,normalizeComponentEncoding:Cy,isIPv4:Wue,nonSimpleDomain:Gue}=wP(),{SCHEMES:Bue,getSchemeHandler:W6}=V6();function Kue(t,e){return typeof t=="string"?t=Wi(So(t,e),e):typeof t=="object"&&(t=So(Wi(t,e),e)),t}function Hue(t,e,r){let i=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=G6(So(t,i),So(e,i),i,!0);return i.skipEscape=!0,Wi(n,i)}function G6(t,e,r,i){let n={};return i||(t=So(Wi(t,r),r),e=So(Wi(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Af(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Af(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=Af(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=Af(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function Jue(t,e,r){return typeof t=="string"?(t=unescape(t),t=Wi(Cy(So(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Wi(Cy(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Wi(Cy(So(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Wi(Cy(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Wi(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},i=Object.assign({},e),n=[],o=W6(i.scheme||r.scheme);o&&o.serialize&&o.serialize(r,i),r.path!==void 0&&(i.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),i.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let s=Vue(r);if(s!==void 0&&(i.reference!=="suffix"&&n.push("//"),n.push(s),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!i.absolutePath&&(!o||!o.absolutePath)&&(a=Af(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var Yue=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function So(t,e){let r=Object.assign({},e),i={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let o=t.match(Yue);if(o){if(i.scheme=o[1],i.userinfo=o[3],i.host=o[4],i.port=parseInt(o[5],10),i.path=o[6]||"",i.query=o[7],i.fragment=o[8],isNaN(i.port)&&(i.port=o[5]),i.host)if(Wue(i.host)===!1){let u=Fue(i.host);i.host=u.host.toLowerCase(),n=u.isIPV6}else n=!0;i.scheme===void 0&&i.userinfo===void 0&&i.host===void 0&&i.port===void 0&&i.query===void 0&&!i.path?i.reference="same-document":i.scheme===void 0?i.reference="relative":i.fragment===void 0?i.reference="absolute":i.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==i.reference&&(i.error=i.error||"URI is not a "+r.reference+" reference.");let s=W6(r.scheme||i.scheme);if(!r.unicodeSupport&&(!s||!s.unicodeSupport)&&i.host&&(r.domainHost||s&&s.domainHost)&&n===!1&&Gue(i.host))try{i.host=URL.domainToASCII(i.host.toLowerCase())}catch(a){i.error=i.error||"Host's domain name can not be converted to ASCII: "+a}(!s||s&&!s.skipNormalize)&&(t.indexOf("%")!==-1&&(i.scheme!==void 0&&(i.scheme=unescape(i.scheme)),i.host!==void 0&&(i.host=unescape(i.host))),i.path&&(i.path=escape(unescape(i.path))),i.fragment&&(i.fragment=encodeURI(decodeURIComponent(i.fragment)))),s&&s.parse&&s.parse(i,r)}else i.error=i.error||"URI can not be parsed.";return i}var xP={SCHEMES:Bue,normalize:Kue,resolve:Hue,resolveComponent:G6,equal:Jue,serialize:Wi,parse:So};Ry.exports=xP;Ry.exports.default=xP;Ry.exports.fastUri=xP});var K6=L(IP=>{"use strict";Object.defineProperty(IP,"__esModule",{value:!0});var B6=$P();B6.code='require("ajv/dist/runtime/uri").default';IP.default=B6});var r2=L($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.CodeGen=$r.Name=$r.nil=$r.stringify=$r.str=$r._=$r.KeywordCxt=void 0;var Que=Cf();Object.defineProperty($r,"KeywordCxt",{enumerable:!0,get:function(){return Que.KeywordCxt}});var pl=rt();Object.defineProperty($r,"_",{enumerable:!0,get:function(){return pl._}});Object.defineProperty($r,"str",{enumerable:!0,get:function(){return pl.str}});Object.defineProperty($r,"stringify",{enumerable:!0,get:function(){return pl.stringify}});Object.defineProperty($r,"nil",{enumerable:!0,get:function(){return pl.nil}});Object.defineProperty($r,"Name",{enumerable:!0,get:function(){return pl.Name}});Object.defineProperty($r,"CodeGen",{enumerable:!0,get:function(){return pl.CodeGen}});var Xue=Ty(),X6=Rf(),ele=tP(),Df=zy(),tle=rt(),Uf=zf(),Ay=Tf(),PP=mt(),H6=R6(),rle=K6(),e2=(t,e)=>new RegExp(t,e);e2.code="new RegExp";var nle=["removeAdditional","useDefaults","coerceTypes"],ile=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),ole={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},sle={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},J6=200;function ale(t){var e,r,i,n,o,s,a,u,l,c,d,p,f,m,g,v,h,y,_,b,w,S,k,$,P;let j=t.strict,I=(e=t.code)===null||e===void 0?void 0:e.optimize,R=I===!0||I===void 0?1:I||0,q=(i=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:e2,O=(n=t.uriResolver)!==null&&n!==void 0?n:rle.default;return{strictSchema:(s=(o=t.strictSchema)!==null&&o!==void 0?o:j)!==null&&s!==void 0?s:!0,strictNumbers:(u=(a=t.strictNumbers)!==null&&a!==void 0?a:j)!==null&&u!==void 0?u:!0,strictTypes:(c=(l=t.strictTypes)!==null&&l!==void 0?l:j)!==null&&c!==void 0?c:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:j)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:j)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:R,regExp:q}:{optimize:R,regExp:q},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:J6,loopEnum:(v=t.loopEnum)!==null&&v!==void 0?v:J6,meta:(h=t.meta)!==null&&h!==void 0?h:!0,messages:(y=t.messages)!==null&&y!==void 0?y:!0,inlineRefs:(_=t.inlineRefs)!==null&&_!==void 0?_:!0,schemaId:(b=t.schemaId)!==null&&b!==void 0?b:"$id",addUsedSchema:(w=t.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(S=t.validateSchema)!==null&&S!==void 0?S:!0,validateFormats:(k=t.validateFormats)!==null&&k!==void 0?k:!0,unicodeRegExp:($=t.unicodeRegExp)!==null&&$!==void 0?$:!0,int32range:(P=t.int32range)!==null&&P!==void 0?P:!0,uriResolver:O}}var Mf=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...ale(e)};let{es5:r,lines:i}=this.opts.code;this.scope=new tle.ValueScope({scope:{},prefixes:ile,es5:r,lines:i}),this.logger=ple(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,ele.getRules)(),Y6.call(this,ole,e,"NOT SUPPORTED"),Y6.call(this,sle,e,"DEPRECATED","warn"),this._metaOpts=dle.call(this),e.formats&&lle.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&cle.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),ule.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:i}=this.opts,n=H6;i==="id"&&(n={...H6},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[i],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let i;if(typeof e=="string"){if(i=this.getSchema(e),!i)throw new Error(`no schema with key or ref "${e}"`)}else i=this.compile(e);let n=i(r);return"$async"in i||(this.errors=i.errors),n}compile(e,r){let i=this._addSchema(e,r);return i.validate||this._compileSchemaEnv(i)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:i}=this.opts;return n.call(this,e,r);async function n(c,d){await o.call(this,c.$schema);let p=this._addSchema(c,d);return p.validate||s.call(this,p)}async function o(c){c&&!this.getSchema(c)&&await n.call(this,{$ref:c},!0)}async function s(c){try{return this._compileSchemaEnv(c)}catch(d){if(!(d instanceof X6.default))throw d;return a.call(this,d),await u.call(this,d.missingSchema),s.call(this,c)}}function a({missingSchema:c,missingRef:d}){if(this.refs[c])throw new Error(`AnySchema ${c} is loaded but ${d} cannot be resolved`)}async function u(c){let d=await l.call(this,c);this.refs[c]||await o.call(this,d.$schema),this.refs[c]||this.addSchema(d,c,r)}async function l(c){let d=this._loading[c];if(d)return d;try{return await(this._loading[c]=i(c))}finally{delete this._loading[c]}}}addSchema(e,r,i,n=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,i,n);return this}let o;if(typeof e=="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,Uf.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,i,r,n,!0),this}addMetaSchema(e,r,i=this.opts.validateSchema){return this.addSchema(e,r,!0,i),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let i;if(i=e.$schema,i!==void 0&&typeof i!="string")throw new Error("$schema must be a string");if(i=i||this.opts.defaultMeta||this.defaultMeta(),!i)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(i,e);if(!n&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return n}getSchema(e){let r;for(;typeof(r=Q6.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:i}=this.opts,n=new Df.SchemaEnv({schema:{},schemaId:i});if(r=Df.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Q6.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let i=e[this.opts.schemaId];return i&&(i=(0,Uf.normalizeId)(i),delete this.schemas[i],delete this.refs[i]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let i;if(typeof e=="string")i=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=i);else if(typeof e=="object"&&r===void 0){if(r=e,i=r.keyword,Array.isArray(i)&&!i.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(hle.call(this,i,r),!r)return(0,PP.eachItem)(i,o=>EP.call(this,o)),this;yle.call(this,r);let n={...r,type:(0,Ay.getJSONTypes)(r.type),schemaType:(0,Ay.getJSONTypes)(r.schemaType)};return(0,PP.eachItem)(i,n.type.length===0?o=>EP.call(this,o,n):o=>n.type.forEach(s=>EP.call(this,o,n,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let i of r.rules){let n=i.rules.findIndex(o=>o.keyword===e);n>=0&&i.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:i="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${i}${n.instancePath} ${n.message}`).reduce((n,o)=>n+r+o)}$dataMetaSchema(e,r){let i=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let o=n.split("/").slice(1),s=e;for(let a of o)s=s[a];for(let a in i){let u=i[a];if(typeof u!="object")continue;let{$data:l}=u.definition,c=s[a];l&&c&&(s[a]=t2(c))}}return e}_removeAllSchemas(e,r){for(let i in e){let n=e[i];(!r||r.test(i))&&(typeof n=="string"?delete e[i]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[i]))}}_addSchema(e,r,i,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let u=this._cache.get(e);if(u!==void 0)return u;i=(0,Uf.normalizeId)(s||i);let l=Uf.getSchemaRefs.call(this,e,i);return u=new Df.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:i,localRefs:l}),this._cache.set(u.schema,u),o&&!i.startsWith("#")&&(i&&this._checkUnique(i),this.refs[i]=u),n&&this.validateSchema(e,!0),u}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Df.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Df.compileSchema.call(this,e)}finally{this.opts=r}}};Mf.ValidationError=Xue.default;Mf.MissingRefError=X6.default;$r.default=Mf;function Y6(t,e,r,i="error"){for(let n in t){let o=n;o in e&&this.logger[i](`${r}: option ${n}. ${t[o]}`)}}function Q6(t){return t=(0,Uf.normalizeId)(t),this.schemas[t]||this.refs[t]}function ule(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function lle(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function cle(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function dle(){let t={...this.opts};for(let e of nle)delete t[e];return t}var fle={log(){},warn(){},error(){}};function ple(t){if(t===!1)return fle;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var mle=/^[a-z_$][a-z0-9_$:-]*$/i;function hle(t,e){let{RULES:r}=this;if((0,PP.eachItem)(t,i=>{if(r.keywords[i])throw new Error(`Keyword ${i} is already defined`);if(!mle.test(i))throw new Error(`Keyword ${i} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function EP(t,e,r){var i;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:u})=>u===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,Ay.getJSONTypes)(e.type),schemaType:(0,Ay.getJSONTypes)(e.schemaType)}};e.before?gle.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,(i=e.implements)===null||i===void 0||i.forEach(u=>this.addKeyword(u))}function gle(t,e,r){let i=t.rules.findIndex(n=>n.keyword===r);i>=0?t.rules.splice(i,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function yle(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=t2(e)),t.validateSchema=this.compile(e,!0))}var vle={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function t2(t){return{anyOf:[t,vle]}}});var n2=L(TP=>{"use strict";Object.defineProperty(TP,"__esModule",{value:!0});var _le={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};TP.default=_le});var a2=L(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});va.callRef=va.getValidate=void 0;var ble=Rf(),i2=ri(),vn=rt(),ml=bo(),o2=zy(),Dy=mt(),wle={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:i}=t,{baseId:n,schemaEnv:o,validateName:s,opts:a,self:u}=i,{root:l}=o;if((r==="#"||r==="#/")&&n===l.baseId)return d();let c=o2.resolveRef.call(u,l,n,r);if(c===void 0)throw new ble.default(i.opts.uriResolver,n,r);if(c instanceof o2.SchemaEnv)return p(c);return f(c);function d(){if(o===l)return Uy(t,s,o,o.$async);let m=e.scopeValue("root",{ref:l});return Uy(t,(0,vn._)`${m}.validate`,l,l.$async)}function p(m){let g=s2(t,m);Uy(t,g,m,m.$async)}function f(m){let g=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,vn.stringify)(m)}:{ref:m}),v=e.name("valid"),h=t.subschema({schema:m,dataTypes:[],schemaPath:vn.nil,topSchemaRef:g,errSchemaPath:r},v);t.mergeEvaluated(h),t.ok(v)}}};function s2(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,vn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}va.getValidate=s2;function Uy(t,e,r,i){let{gen:n,it:o}=t,{allErrors:s,schemaEnv:a,opts:u}=o,l=u.passContext?ml.default.this:vn.nil;i?c():d();function c(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,vn._)`await ${(0,i2.callValidateCode)(t,e,l)}`),f(e),s||n.assign(m,!0)},g=>{n.if((0,vn._)`!(${g} instanceof ${o.ValidationError})`,()=>n.throw(g)),p(g),s||n.assign(m,!1)}),t.ok(m)}function d(){t.result((0,i2.callValidateCode)(t,e,l),()=>f(e),()=>p(e))}function p(m){let g=(0,vn._)`${m}.errors`;n.assign(ml.default.vErrors,(0,vn._)`${ml.default.vErrors} === null ? ${g} : ${ml.default.vErrors}.concat(${g})`),n.assign(ml.default.errors,(0,vn._)`${ml.default.vErrors}.length`)}function f(m){var g;if(!o.opts.unevaluated)return;let v=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(o.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(o.props=Dy.mergeEvaluated.props(n,v.props,o.props));else{let h=n.var("props",(0,vn._)`${m}.evaluated.props`);o.props=Dy.mergeEvaluated.props(n,h,o.props,vn.Name)}if(o.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(o.items=Dy.mergeEvaluated.items(n,v.items,o.items));else{let h=n.var("items",(0,vn._)`${m}.evaluated.items`);o.items=Dy.mergeEvaluated.items(n,h,o.items,vn.Name)}}}va.callRef=Uy;va.default=wle});var u2=L(OP=>{"use strict";Object.defineProperty(OP,"__esModule",{value:!0});var Sle=n2(),kle=a2(),xle=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Sle.default,kle.default];OP.default=xle});var l2=L(zP=>{"use strict";Object.defineProperty(zP,"__esModule",{value:!0});var My=rt(),ss=My.operators,Zy={maximum:{okStr:"<=",ok:ss.LTE,fail:ss.GT},minimum:{okStr:">=",ok:ss.GTE,fail:ss.LT},exclusiveMaximum:{okStr:"<",ok:ss.LT,fail:ss.GTE},exclusiveMinimum:{okStr:">",ok:ss.GT,fail:ss.LTE}},$le={message:({keyword:t,schemaCode:e})=>(0,My.str)`must be ${Zy[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,My._)`{comparison: ${Zy[t].okStr}, limit: ${e}}`},Ile={keyword:Object.keys(Zy),type:"number",schemaType:"number",$data:!0,error:$le,code(t){let{keyword:e,data:r,schemaCode:i}=t;t.fail$data((0,My._)`${r} ${Zy[e].fail} ${i} || isNaN(${r})`)}};zP.default=Ile});var c2=L(NP=>{"use strict";Object.defineProperty(NP,"__esModule",{value:!0});var Zf=rt(),Ele={message:({schemaCode:t})=>(0,Zf.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Zf._)`{multipleOf: ${t}}`},Ple={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Ele,code(t){let{gen:e,data:r,schemaCode:i,it:n}=t,o=n.opts.multipleOfPrecision,s=e.let("res"),a=o?(0,Zf._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,Zf._)`${s} !== parseInt(${s})`;t.fail$data((0,Zf._)`(${i} === 0 || (${s} = ${r}/${i}, ${a}))`)}};NP.default=Ple});var f2=L(jP=>{"use strict";Object.defineProperty(jP,"__esModule",{value:!0});function d2(t){let e=t.length,r=0,i=0,n;for(;i<e;)r++,n=t.charCodeAt(i++),n>=55296&&n<=56319&&i<e&&(n=t.charCodeAt(i),(n&64512)===56320&&i++);return r}jP.default=d2;d2.code='require("ajv/dist/runtime/ucs2length").default'});var p2=L(CP=>{"use strict";Object.defineProperty(CP,"__esModule",{value:!0});var _a=rt(),Tle=mt(),Ole=f2(),zle={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,_a.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,_a._)`{limit: ${t}}`},Nle={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:zle,code(t){let{keyword:e,data:r,schemaCode:i,it:n}=t,o=e==="maxLength"?_a.operators.GT:_a.operators.LT,s=n.opts.unicode===!1?(0,_a._)`${r}.length`:(0,_a._)`${(0,Tle.useFunc)(t.gen,Ole.default)}(${r})`;t.fail$data((0,_a._)`${s} ${o} ${i}`)}};CP.default=Nle});var m2=L(RP=>{"use strict";Object.defineProperty(RP,"__esModule",{value:!0});var jle=ri(),Cle=mt(),hl=rt(),Rle={message:({schemaCode:t})=>(0,hl.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,hl._)`{pattern: ${t}}`},Ale={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Rle,code(t){let{gen:e,data:r,$data:i,schema:n,schemaCode:o,it:s}=t,a=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:u}=s.opts.code,l=u.code==="new RegExp"?(0,hl._)`new RegExp`:(0,Cle.useFunc)(e,u),c=e.let("valid");e.try(()=>e.assign(c,(0,hl._)`${l}(${o}, ${a}).test(${r})`),()=>e.assign(c,!1)),t.fail$data((0,hl._)`!${c}`)}else{let u=(0,jle.usePattern)(t,n);t.fail$data((0,hl._)`!${u}.test(${r})`)}}};RP.default=Ale});var h2=L(AP=>{"use strict";Object.defineProperty(AP,"__esModule",{value:!0});var Lf=rt(),Dle={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Lf.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Lf._)`{limit: ${t}}`},Ule={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Dle,code(t){let{keyword:e,data:r,schemaCode:i}=t,n=e==="maxProperties"?Lf.operators.GT:Lf.operators.LT;t.fail$data((0,Lf._)`Object.keys(${r}).length ${n} ${i}`)}};AP.default=Ule});var g2=L(DP=>{"use strict";Object.defineProperty(DP,"__esModule",{value:!0});var qf=ri(),Ff=rt(),Mle=mt(),Zle={message:({params:{missingProperty:t}})=>(0,Ff.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Ff._)`{missingProperty: ${t}}`},Lle={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Zle,code(t){let{gen:e,schema:r,schemaCode:i,data:n,$data:o,it:s}=t,{opts:a}=s;if(!o&&r.length===0)return;let u=r.length>=a.loopRequired;if(s.allErrors?l():c(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let g of r)if(f?.[g]===void 0&&!m.has(g)){let v=s.schemaEnv.baseId+s.errSchemaPath,h=`required property "${g}" is not defined at "${v}" (strictRequired)`;(0,Mle.checkStrictMode)(s,h,s.opts.strictRequired)}}function l(){if(u||o)t.block$data(Ff.nil,d);else for(let f of r)(0,qf.checkReportMissingProp)(t,f)}function c(){let f=e.let("missing");if(u||o){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,qf.checkMissingProp)(t,r,f)),(0,qf.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",i,f=>{t.setParams({missingProperty:f}),e.if((0,qf.noPropertyInData)(e,n,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,i,()=>{e.assign(m,(0,qf.propertyInData)(e,n,f,a.ownProperties)),e.if((0,Ff.not)(m),()=>{t.error(),e.break()})},Ff.nil)}}};DP.default=Lle});var y2=L(UP=>{"use strict";Object.defineProperty(UP,"__esModule",{value:!0});var Vf=rt(),qle={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Vf.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Vf._)`{limit: ${t}}`},Fle={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:qle,code(t){let{keyword:e,data:r,schemaCode:i}=t,n=e==="maxItems"?Vf.operators.GT:Vf.operators.LT;t.fail$data((0,Vf._)`${r}.length ${n} ${i}`)}};UP.default=Fle});var Ly=L(MP=>{"use strict";Object.defineProperty(MP,"__esModule",{value:!0});var v2=Of();v2.code='require("ajv/dist/runtime/equal").default';MP.default=v2});var _2=L(LP=>{"use strict";Object.defineProperty(LP,"__esModule",{value:!0});var ZP=Tf(),Ir=rt(),Vle=mt(),Wle=Ly(),Gle={message:({params:{i:t,j:e}})=>(0,Ir.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Ir._)`{i: ${t}, j: ${e}}`},Ble={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Gle,code(t){let{gen:e,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:a}=t;if(!i&&!n)return;let u=e.let("valid"),l=o.items?(0,ZP.getSchemaTypes)(o.items):[];t.block$data(u,c,(0,Ir._)`${s} === false`),t.ok(u);function c(){let m=e.let("i",(0,Ir._)`${r}.length`),g=e.let("j");t.setParams({i:m,j:g}),e.assign(u,!0),e.if((0,Ir._)`${m} > 1`,()=>(d()?p:f)(m,g))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function p(m,g){let v=e.name("item"),h=(0,ZP.checkDataTypes)(l,v,a.opts.strictNumbers,ZP.DataType.Wrong),y=e.const("indices",(0,Ir._)`{}`);e.for((0,Ir._)`;${m}--;`,()=>{e.let(v,(0,Ir._)`${r}[${m}]`),e.if(h,(0,Ir._)`continue`),l.length>1&&e.if((0,Ir._)`typeof ${v} == "string"`,(0,Ir._)`${v} += "_"`),e.if((0,Ir._)`typeof ${y}[${v}] == "number"`,()=>{e.assign(g,(0,Ir._)`${y}[${v}]`),t.error(),e.assign(u,!1).break()}).code((0,Ir._)`${y}[${v}] = ${m}`)})}function f(m,g){let v=(0,Vle.useFunc)(e,Wle.default),h=e.name("outer");e.label(h).for((0,Ir._)`;${m}--;`,()=>e.for((0,Ir._)`${g} = ${m}; ${g}--;`,()=>e.if((0,Ir._)`${v}(${r}[${m}], ${r}[${g}])`,()=>{t.error(),e.assign(u,!1).break(h)})))}}};LP.default=Ble});var b2=L(FP=>{"use strict";Object.defineProperty(FP,"__esModule",{value:!0});var qP=rt(),Kle=mt(),Hle=Ly(),Jle={message:"must be equal to constant",params:({schemaCode:t})=>(0,qP._)`{allowedValue: ${t}}`},Yle={keyword:"const",$data:!0,error:Jle,code(t){let{gen:e,data:r,$data:i,schemaCode:n,schema:o}=t;i||o&&typeof o=="object"?t.fail$data((0,qP._)`!${(0,Kle.useFunc)(e,Hle.default)}(${r}, ${n})`):t.fail((0,qP._)`${o} !== ${r}`)}};FP.default=Yle});var w2=L(VP=>{"use strict";Object.defineProperty(VP,"__esModule",{value:!0});var Wf=rt(),Qle=mt(),Xle=Ly(),ece={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Wf._)`{allowedValues: ${t}}`},tce={keyword:"enum",schemaType:"array",$data:!0,error:ece,code(t){let{gen:e,data:r,$data:i,schema:n,schemaCode:o,it:s}=t;if(!i&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,u,l=()=>u??(u=(0,Qle.useFunc)(e,Xle.default)),c;if(a||i)c=e.let("valid"),t.block$data(c,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=e.const("vSchema",o);c=(0,Wf.or)(...n.map((m,g)=>p(f,g)))}t.pass(c);function d(){e.assign(c,!1),e.forOf("v",o,f=>e.if((0,Wf._)`${l()}(${r}, ${f})`,()=>e.assign(c,!0).break()))}function p(f,m){let g=n[m];return typeof g=="object"&&g!==null?(0,Wf._)`${l()}(${r}, ${f}[${m}])`:(0,Wf._)`${r} === ${g}`}}};VP.default=tce});var S2=L(WP=>{"use strict";Object.defineProperty(WP,"__esModule",{value:!0});var rce=l2(),nce=c2(),ice=p2(),oce=m2(),sce=h2(),ace=g2(),uce=y2(),lce=_2(),cce=b2(),dce=w2(),fce=[rce.default,nce.default,ice.default,oce.default,sce.default,ace.default,uce.default,lce.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},cce.default,dce.default];WP.default=fce});var BP=L(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});Gf.validateAdditionalItems=void 0;var ba=rt(),GP=mt(),pce={message:({params:{len:t}})=>(0,ba.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,ba._)`{limit: ${t}}`},mce={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:pce,code(t){let{parentSchema:e,it:r}=t,{items:i}=e;if(!Array.isArray(i)){(0,GP.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}k2(t,i)}};function k2(t,e){let{gen:r,schema:i,data:n,keyword:o,it:s}=t;s.items=!0;let a=r.const("len",(0,ba._)`${n}.length`);if(i===!1)t.setParams({len:e.length}),t.pass((0,ba._)`${a} <= ${e.length}`);else if(typeof i=="object"&&!(0,GP.alwaysValidSchema)(s,i)){let l=r.var("valid",(0,ba._)`${a} <= ${e.length}`);r.if((0,ba.not)(l),()=>u(l)),t.ok(l)}function u(l){r.forRange("i",e.length,a,c=>{t.subschema({keyword:o,dataProp:c,dataPropType:GP.Type.Num},l),s.allErrors||r.if((0,ba.not)(l),()=>r.break())})}}Gf.validateAdditionalItems=k2;Gf.default=mce});var KP=L(Bf=>{"use strict";Object.defineProperty(Bf,"__esModule",{value:!0});Bf.validateTuple=void 0;var x2=rt(),qy=mt(),hce=ri(),gce={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return $2(t,"additionalItems",e);r.items=!0,!(0,qy.alwaysValidSchema)(r,e)&&t.ok((0,hce.validateArray)(t))}};function $2(t,e,r=t.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:a}=t;c(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=qy.mergeEvaluated.items(i,r.length,a.items));let u=i.name("valid"),l=i.const("len",(0,x2._)`${o}.length`);r.forEach((d,p)=>{(0,qy.alwaysValidSchema)(a,d)||(i.if((0,x2._)`${l} > ${p}`,()=>t.subschema({keyword:s,schemaProp:p,dataProp:p},u)),t.ok(u))});function c(d){let{opts:p,errSchemaPath:f}=a,m=r.length,g=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!g){let v=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,qy.checkStrictMode)(a,v,p.strictTuples)}}}Bf.validateTuple=$2;Bf.default=gce});var I2=L(HP=>{"use strict";Object.defineProperty(HP,"__esModule",{value:!0});var yce=KP(),vce={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,yce.validateTuple)(t,"items")};HP.default=vce});var P2=L(JP=>{"use strict";Object.defineProperty(JP,"__esModule",{value:!0});var E2=rt(),_ce=mt(),bce=ri(),wce=BP(),Sce={message:({params:{len:t}})=>(0,E2.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,E2._)`{limit: ${t}}`},kce={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Sce,code(t){let{schema:e,parentSchema:r,it:i}=t,{prefixItems:n}=r;i.items=!0,!(0,_ce.alwaysValidSchema)(i,e)&&(n?(0,wce.validateAdditionalItems)(t,n):t.ok((0,bce.validateArray)(t)))}};JP.default=kce});var T2=L(YP=>{"use strict";Object.defineProperty(YP,"__esModule",{value:!0});var ii=rt(),Fy=mt(),xce={message:({params:{min:t,max:e}})=>e===void 0?(0,ii.str)`must contain at least ${t} valid item(s)`:(0,ii.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,ii._)`{minContains: ${t}}`:(0,ii._)`{minContains: ${t}, maxContains: ${e}}`},$ce={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:xce,code(t){let{gen:e,schema:r,parentSchema:i,data:n,it:o}=t,s,a,{minContains:u,maxContains:l}=i;o.opts.next?(s=u===void 0?1:u,a=l):s=1;let c=e.const("len",(0,ii._)`${n}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,Fy.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,Fy.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Fy.alwaysValidSchema)(o,r)){let g=(0,ii._)`${c} >= ${s}`;a!==void 0&&(g=(0,ii._)`${g} && ${c} <= ${a}`),t.pass(g);return}o.items=!0;let d=e.name("valid");a===void 0&&s===1?f(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,ii._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let g=e.name("_valid"),v=e.let("count",0);f(g,()=>e.if(g,()=>m(v)))}function f(g,v){e.forRange("i",0,c,h=>{t.subschema({keyword:"contains",dataProp:h,dataPropType:Fy.Type.Num,compositeRule:!0},g),v()})}function m(g){e.code((0,ii._)`${g}++`),a===void 0?e.if((0,ii._)`${g} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,ii._)`${g} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,ii._)`${g} >= ${s}`,()=>e.assign(d,!0)))}}};YP.default=$ce});var N2=L(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.validateSchemaDeps=Gi.validatePropertyDeps=Gi.error=void 0;var QP=rt(),Ice=mt(),Kf=ri();Gi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let i=e===1?"property":"properties";return(0,QP.str)`must have ${i} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:i}})=>(0,QP._)`{property: ${t},
231
- missingProperty: ${i},
232
- depsCount: ${e},
233
- deps: ${r}}`};var Ece={keyword:"dependencies",type:"object",schemaType:"object",error:Gi.error,code(t){let[e,r]=Pce(t);O2(t,e),z2(t,r)}};function Pce({schema:t}){let e={},r={};for(let i in t){if(i==="__proto__")continue;let n=Array.isArray(t[i])?e:r;n[i]=t[i]}return[e,r]}function O2(t,e=t.schema){let{gen:r,data:i,it:n}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let u=(0,Kf.propertyInData)(r,i,s,n.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(u,()=>{for(let l of a)(0,Kf.checkReportMissingProp)(t,l)}):(r.if((0,QP._)`${u} && (${(0,Kf.checkMissingProp)(t,a,o)})`),(0,Kf.reportMissingProp)(t,o),r.else())}}Gi.validatePropertyDeps=O2;function z2(t,e=t.schema){let{gen:r,data:i,keyword:n,it:o}=t,s=r.name("valid");for(let a in e)(0,Ice.alwaysValidSchema)(o,e[a])||(r.if((0,Kf.propertyInData)(r,i,a,o.opts.ownProperties),()=>{let u=t.subschema({keyword:n,schemaProp:a},s);t.mergeValidEvaluated(u,s)},()=>r.var(s,!0)),t.ok(s))}Gi.validateSchemaDeps=z2;Gi.default=Ece});var C2=L(XP=>{"use strict";Object.defineProperty(XP,"__esModule",{value:!0});var j2=rt(),Tce=mt(),Oce={message:"property name must be valid",params:({params:t})=>(0,j2._)`{propertyName: ${t.propertyName}}`},zce={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Oce,code(t){let{gen:e,schema:r,data:i,it:n}=t;if((0,Tce.alwaysValidSchema)(n,r))return;let o=e.name("valid");e.forIn("key",i,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),e.if((0,j2.not)(o),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(o)}};XP.default=zce});var tT=L(eT=>{"use strict";Object.defineProperty(eT,"__esModule",{value:!0});var Vy=ri(),Ei=rt(),Nce=bo(),Wy=mt(),jce={message:"must NOT have additional properties",params:({params:t})=>(0,Ei._)`{additionalProperty: ${t.additionalProperty}}`},Cce={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:jce,code(t){let{gen:e,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:u}=s;if(s.props=!0,u.removeAdditional!=="all"&&(0,Wy.alwaysValidSchema)(s,r))return;let l=(0,Vy.allSchemaProperties)(i.properties),c=(0,Vy.allSchemaProperties)(i.patternProperties);d(),t.ok((0,Ei._)`${o} === ${Nce.default.errors}`);function d(){e.forIn("key",n,v=>{!l.length&&!c.length?m(v):e.if(p(v),()=>m(v))})}function p(v){let h;if(l.length>8){let y=(0,Wy.schemaRefOrVal)(s,i.properties,"properties");h=(0,Vy.isOwnProperty)(e,y,v)}else l.length?h=(0,Ei.or)(...l.map(y=>(0,Ei._)`${v} === ${y}`)):h=Ei.nil;return c.length&&(h=(0,Ei.or)(h,...c.map(y=>(0,Ei._)`${(0,Vy.usePattern)(t,y)}.test(${v})`))),(0,Ei.not)(h)}function f(v){e.code((0,Ei._)`delete ${n}[${v}]`)}function m(v){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){f(v);return}if(r===!1){t.setParams({additionalProperty:v}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Wy.alwaysValidSchema)(s,r)){let h=e.name("valid");u.removeAdditional==="failing"?(g(v,h,!1),e.if((0,Ei.not)(h),()=>{t.reset(),f(v)})):(g(v,h),a||e.if((0,Ei.not)(h),()=>e.break()))}}function g(v,h,y){let _={keyword:"additionalProperties",dataProp:v,dataPropType:Wy.Type.Str};y===!1&&Object.assign(_,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(_,h)}}};eT.default=Cce});var D2=L(nT=>{"use strict";Object.defineProperty(nT,"__esModule",{value:!0});var Rce=Cf(),R2=ri(),rT=mt(),A2=tT(),Ace={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:i,data:n,it:o}=t;o.opts.removeAdditional==="all"&&i.additionalProperties===void 0&&A2.default.code(new Rce.KeywordCxt(o,A2.default,"additionalProperties"));let s=(0,R2.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=rT.mergeEvaluated.props(e,(0,rT.toHash)(s),o.props));let a=s.filter(d=>!(0,rT.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let u=e.name("valid");for(let d of a)l(d)?c(d):(e.if((0,R2.propertyInData)(e,n,d,o.opts.ownProperties)),c(d),o.allErrors||e.else().var(u,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(u);function l(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function c(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},u)}}};nT.default=Ace});var L2=L(iT=>{"use strict";Object.defineProperty(iT,"__esModule",{value:!0});var U2=ri(),Gy=rt(),M2=mt(),Z2=mt(),Dce={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:i,parentSchema:n,it:o}=t,{opts:s}=o,a=(0,U2.allSchemaProperties)(r),u=a.filter(g=>(0,M2.alwaysValidSchema)(o,r[g]));if(a.length===0||u.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=s.strictSchema&&!s.allowMatchingProperties&&n.properties,c=e.name("valid");o.props!==!0&&!(o.props instanceof Gy.Name)&&(o.props=(0,Z2.evaluatedPropsToName)(e,o.props));let{props:d}=o;p();function p(){for(let g of a)l&&f(g),o.allErrors?m(g):(e.var(c,!0),m(g),e.if(c))}function f(g){for(let v in l)new RegExp(g).test(v)&&(0,M2.checkStrictMode)(o,`property ${v} matches pattern ${g} (use allowMatchingProperties)`)}function m(g){e.forIn("key",i,v=>{e.if((0,Gy._)`${(0,U2.usePattern)(t,g)}.test(${v})`,()=>{let h=u.includes(g);h||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:v,dataPropType:Z2.Type.Str},c),o.opts.unevaluated&&d!==!0?e.assign((0,Gy._)`${d}[${v}]`,!0):!h&&!o.allErrors&&e.if((0,Gy.not)(c),()=>e.break())})})}}};iT.default=Dce});var q2=L(oT=>{"use strict";Object.defineProperty(oT,"__esModule",{value:!0});var Uce=mt(),Mce={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:i}=t;if((0,Uce.alwaysValidSchema)(i,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};oT.default=Mce});var F2=L(sT=>{"use strict";Object.defineProperty(sT,"__esModule",{value:!0});var Zce=ri(),Lce={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Zce.validateUnion,error:{message:"must match a schema in anyOf"}};sT.default=Lce});var V2=L(aT=>{"use strict";Object.defineProperty(aT,"__esModule",{value:!0});var By=rt(),qce=mt(),Fce={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,By._)`{passingSchemas: ${t.passing}}`},Vce={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Fce,code(t){let{gen:e,schema:r,parentSchema:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=e.let("valid",!1),a=e.let("passing",null),u=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(s,()=>t.reset(),()=>t.error(!0));function l(){o.forEach((c,d)=>{let p;(0,qce.alwaysValidSchema)(n,c)?e.var(u,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},u),d>0&&e.if((0,By._)`${u} && ${s}`).assign(s,!1).assign(a,(0,By._)`[${a}, ${d}]`).else(),e.if(u,()=>{e.assign(s,!0),e.assign(a,d),p&&t.mergeEvaluated(p,By.Name)})})}}};aT.default=Vce});var W2=L(uT=>{"use strict";Object.defineProperty(uT,"__esModule",{value:!0});var Wce=mt(),Gce={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((o,s)=>{if((0,Wce.alwaysValidSchema)(i,o))return;let a=t.subschema({keyword:"allOf",schemaProp:s},n);t.ok(n),t.mergeEvaluated(a)})}};uT.default=Gce});var K2=L(lT=>{"use strict";Object.defineProperty(lT,"__esModule",{value:!0});var Ky=rt(),B2=mt(),Bce={message:({params:t})=>(0,Ky.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ky._)`{failingKeyword: ${t.ifClause}}`},Kce={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Bce,code(t){let{gen:e,parentSchema:r,it:i}=t;r.then===void 0&&r.else===void 0&&(0,B2.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=G2(i,"then"),o=G2(i,"else");if(!n&&!o)return;let s=e.let("valid",!0),a=e.name("_valid");if(u(),t.reset(),n&&o){let c=e.let("ifClause");t.setParams({ifClause:c}),e.if(a,l("then",c),l("else",c))}else n?e.if(a,l("then")):e.if((0,Ky.not)(a),l("else"));t.pass(s,()=>t.error(!0));function u(){let c=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(c)}function l(c,d){return()=>{let p=t.subschema({keyword:c},a);e.assign(s,a),t.mergeValidEvaluated(p,s),d?e.assign(d,(0,Ky._)`${c}`):t.setParams({ifClause:c})}}}};function G2(t,e){let r=t.schema[e];return r!==void 0&&!(0,B2.alwaysValidSchema)(t,r)}lT.default=Kce});var H2=L(cT=>{"use strict";Object.defineProperty(cT,"__esModule",{value:!0});var Hce=mt(),Jce={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Hce.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};cT.default=Jce});var J2=L(dT=>{"use strict";Object.defineProperty(dT,"__esModule",{value:!0});var Yce=BP(),Qce=I2(),Xce=KP(),ede=P2(),tde=T2(),rde=N2(),nde=C2(),ide=tT(),ode=D2(),sde=L2(),ade=q2(),ude=F2(),lde=V2(),cde=W2(),dde=K2(),fde=H2();function pde(t=!1){let e=[ade.default,ude.default,lde.default,cde.default,dde.default,fde.default,nde.default,ide.default,rde.default,ode.default,sde.default];return t?e.push(Qce.default,ede.default):e.push(Yce.default,Xce.default),e.push(tde.default),e}dT.default=pde});var Y2=L(fT=>{"use strict";Object.defineProperty(fT,"__esModule",{value:!0});var ir=rt(),mde={message:({schemaCode:t})=>(0,ir.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ir._)`{format: ${t}}`},hde={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:mde,code(t,e){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:a}=t,{opts:u,errSchemaPath:l,schemaEnv:c,self:d}=a;if(!u.validateFormats)return;n?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:u.code.formats}),g=r.const("fDef",(0,ir._)`${m}[${s}]`),v=r.let("fType"),h=r.let("format");r.if((0,ir._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(v,(0,ir._)`${g}.type || "string"`).assign(h,(0,ir._)`${g}.validate`),()=>r.assign(v,(0,ir._)`"string"`).assign(h,g)),t.fail$data((0,ir.or)(y(),_()));function y(){return u.strictSchema===!1?ir.nil:(0,ir._)`${s} && !${h}`}function _(){let b=c.$async?(0,ir._)`(${g}.async ? await ${h}(${i}) : ${h}(${i}))`:(0,ir._)`${h}(${i})`,w=(0,ir._)`(typeof ${h} == "function" ? ${b} : ${h}.test(${i}))`;return(0,ir._)`${h} && ${h} !== true && ${v} === ${e} && !${w}`}}function f(){let m=d.formats[o];if(!m){y();return}if(m===!0)return;let[g,v,h]=_(m);g===e&&t.pass(b());function y(){if(u.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function _(w){let S=w instanceof RegExp?(0,ir.regexpCode)(w):u.code.formats?(0,ir._)`${u.code.formats}${(0,ir.getProperty)(o)}`:void 0,k=r.scopeValue("formats",{key:o,ref:w,code:S});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,ir._)`${k}.validate`]:["string",w,k]}function b(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!c.$async)throw new Error("async format in sync schema");return(0,ir._)`await ${h}(${i})`}return typeof v=="function"?(0,ir._)`${h}(${i})`:(0,ir._)`${h}.test(${i})`}}}};fT.default=hde});var Q2=L(pT=>{"use strict";Object.defineProperty(pT,"__esModule",{value:!0});var gde=Y2(),yde=[gde.default];pT.default=yde});var X2=L(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.contentVocabulary=gl.metadataVocabulary=void 0;gl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];gl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var tq=L(mT=>{"use strict";Object.defineProperty(mT,"__esModule",{value:!0});var vde=u2(),_de=S2(),bde=J2(),wde=Q2(),eq=X2(),Sde=[vde.default,_de.default,(0,bde.default)(),wde.default,eq.metadataVocabulary,eq.contentVocabulary];mT.default=Sde});var nq=L(Hy=>{"use strict";Object.defineProperty(Hy,"__esModule",{value:!0});Hy.DiscrError=void 0;var rq;(function(t){t.Tag="tag",t.Mapping="mapping"})(rq||(Hy.DiscrError=rq={}))});var oq=L(gT=>{"use strict";Object.defineProperty(gT,"__esModule",{value:!0});var yl=rt(),hT=nq(),iq=zy(),kde=Rf(),xde=mt(),$de={message:({params:{discrError:t,tagName:e}})=>t===hT.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,yl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Ide={keyword:"discriminator",type:"object",schemaType:"object",error:$de,code(t){let{gen:e,data:r,schema:i,parentSchema:n,it:o}=t,{oneOf:s}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=i.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let u=e.let("valid",!1),l=e.const("tag",(0,yl._)`${r}${(0,yl.getProperty)(a)}`);e.if((0,yl._)`typeof ${l} == "string"`,()=>c(),()=>t.error(!1,{discrError:hT.DiscrError.Tag,tag:l,tagName:a})),t.ok(u);function c(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,yl._)`${l} === ${m}`),e.assign(u,d(f[m]));e.else(),t.error(!1,{discrError:hT.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(g,yl.Name),m}function p(){var f;let m={},g=h(n),v=!0;for(let b=0;b<s.length;b++){let w=s[b];if(w?.$ref&&!(0,xde.schemaHasRulesButRef)(w,o.self.RULES)){let k=w.$ref;if(w=iq.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,k),w instanceof iq.SchemaEnv&&(w=w.schema),w===void 0)throw new kde.default(o.opts.uriResolver,o.baseId,k)}let S=(f=w?.properties)===null||f===void 0?void 0:f[a];if(typeof S!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);v=v&&(g||h(w)),y(S,b)}if(!v)throw new Error(`discriminator: "${a}" must be required`);return m;function h({required:b}){return Array.isArray(b)&&b.includes(a)}function y(b,w){if(b.const)_(b.const,w);else if(b.enum)for(let S of b.enum)_(S,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function _(b,w){if(typeof b!="string"||b in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[b]=w}}}};gT.default=Ide});var sq=L((iNe,Ede)=>{Ede.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var uq=L((Gt,yT)=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.MissingRefError=Gt.ValidationError=Gt.CodeGen=Gt.Name=Gt.nil=Gt.stringify=Gt.str=Gt._=Gt.KeywordCxt=Gt.Ajv=void 0;var Pde=r2(),Tde=tq(),Ode=oq(),aq=sq(),zde=["/properties"],Jy="http://json-schema.org/draft-07/schema",vl=class extends Pde.default{_addVocabularies(){super._addVocabularies(),Tde.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Ode.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(aq,zde):aq;this.addMetaSchema(e,Jy,!1),this.refs["http://json-schema.org/schema"]=Jy}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Jy)?Jy:void 0)}};Gt.Ajv=vl;yT.exports=Gt=vl;yT.exports.Ajv=vl;Object.defineProperty(Gt,"__esModule",{value:!0});Gt.default=vl;var Nde=Cf();Object.defineProperty(Gt,"KeywordCxt",{enumerable:!0,get:function(){return Nde.KeywordCxt}});var _l=rt();Object.defineProperty(Gt,"_",{enumerable:!0,get:function(){return _l._}});Object.defineProperty(Gt,"str",{enumerable:!0,get:function(){return _l.str}});Object.defineProperty(Gt,"stringify",{enumerable:!0,get:function(){return _l.stringify}});Object.defineProperty(Gt,"nil",{enumerable:!0,get:function(){return _l.nil}});Object.defineProperty(Gt,"Name",{enumerable:!0,get:function(){return _l.Name}});Object.defineProperty(Gt,"CodeGen",{enumerable:!0,get:function(){return _l.CodeGen}});var jde=Ty();Object.defineProperty(Gt,"ValidationError",{enumerable:!0,get:function(){return jde.default}});var Cde=Rf();Object.defineProperty(Gt,"MissingRefError",{enumerable:!0,get:function(){return Cde.default}})});var gq=L(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});Ki.formatNames=Ki.fastFormats=Ki.fullFormats=void 0;function Bi(t,e){return{validate:t,compare:e}}Ki.fullFormats={date:Bi(fq,wT),time:Bi(_T(!0),ST),"date-time":Bi(lq(!0),mq),"iso-time":Bi(_T(),pq),"iso-date-time":Bi(lq(),hq),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Zde,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:Bde,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:Lde,int32:{type:"number",validate:Vde},int64:{type:"number",validate:Wde},float:{type:"number",validate:dq},double:{type:"number",validate:dq},password:!0,binary:!0};Ki.fastFormats={...Ki.fullFormats,date:Bi(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,wT),time:Bi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ST),"date-time":Bi(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,mq),"iso-time":Bi(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,pq),"iso-date-time":Bi(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,hq),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Ki.formatNames=Object.keys(Ki.fullFormats);function Rde(t){return t%4===0&&(t%100!==0||t%400===0)}var Ade=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Dde=[0,31,28,31,30,31,30,31,31,30,31,30,31];function fq(t){let e=Ade.exec(t);if(!e)return!1;let r=+e[1],i=+e[2],n=+e[3];return i>=1&&i<=12&&n>=1&&n<=(i===2&&Rde(r)?29:Dde[i])}function wT(t,e){if(t&&e)return t>e?1:t<e?-1:0}var vT=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function _T(t){return function(r){let i=vT.exec(r);if(!i)return!1;let n=+i[1],o=+i[2],s=+i[3],a=i[4],u=i[5]==="-"?-1:1,l=+(i[6]||0),c=+(i[7]||0);if(l>23||c>59||t&&!a)return!1;if(n<=23&&o<=59&&s<60)return!0;let d=o-c*u,p=n-l*u-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&s<61}}function ST(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),i=new Date("2020-01-01T"+e).valueOf();if(r&&i)return r-i}function pq(t,e){if(!(t&&e))return;let r=vT.exec(t),i=vT.exec(e);if(r&&i)return t=r[1]+r[2]+r[3],e=i[1]+i[2]+i[3],t>e?1:t<e?-1:0}var bT=/t|\s/i;function lq(t){let e=_T(t);return function(i){let n=i.split(bT);return n.length===2&&fq(n[0])&&e(n[1])}}function mq(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),i=new Date(e).valueOf();if(r&&i)return r-i}function hq(t,e){if(!(t&&e))return;let[r,i]=t.split(bT),[n,o]=e.split(bT),s=wT(r,n);if(s!==void 0)return s||ST(i,o)}var Ude=/\/|:/,Mde=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Zde(t){return Ude.test(t)&&Mde.test(t)}var cq=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Lde(t){return cq.lastIndex=0,cq.test(t)}var qde=-(2**31),Fde=2**31-1;function Vde(t){return Number.isInteger(t)&&t<=Fde&&t>=qde}function Wde(t){return Number.isInteger(t)}function dq(){return!0}var Gde=/[^\\]\\Z/;function Bde(t){if(Gde.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Yf=L(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.regexpCode=St.getEsmExportName=St.getProperty=St.safeStringify=St.stringify=St.strConcat=St.addCodeArg=St.str=St._=St.nil=St._Code=St.Name=St.IDENTIFIER=St._CodeOrName=void 0;var Hf=class{};St._CodeOrName=Hf;St.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var wa=class extends Hf{constructor(e){if(super(),!St.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};St.Name=wa;var oi=class extends Hf{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,i)=>`${r}${i}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,i)=>(i instanceof wa&&(r[i.str]=(r[i.str]||0)+1),r),{})}};St._Code=oi;St.nil=new oi("");function yq(t,...e){let r=[t[0]],i=0;for(;i<e.length;)xT(r,e[i]),r.push(t[++i]);return new oi(r)}St._=yq;var kT=new oi("+");function vq(t,...e){let r=[Jf(t[0])],i=0;for(;i<e.length;)r.push(kT),xT(r,e[i]),r.push(kT,Jf(t[++i]));return Kde(r),new oi(r)}St.str=vq;function xT(t,e){e instanceof oi?t.push(...e._items):e instanceof wa?t.push(e):t.push(Yde(e))}St.addCodeArg=xT;function Kde(t){let e=1;for(;e<t.length-1;){if(t[e]===kT){let r=Hde(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Hde(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof wa||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof wa))return`"${t}${e.slice(1)}`}function Jde(t,e){return e.emptyStr()?t:t.emptyStr()?e:vq`${t}${e}`}St.strConcat=Jde;function Yde(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Jf(Array.isArray(t)?t.join(","):t)}function Qde(t){return new oi(Jf(t))}St.stringify=Qde;function Jf(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}St.safeStringify=Jf;function Xde(t){return typeof t=="string"&&St.IDENTIFIER.test(t)?new oi(`.${t}`):yq`[${t}]`}St.getProperty=Xde;function efe(t){if(typeof t=="string"&&St.IDENTIFIER.test(t))return new oi(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}St.getEsmExportName=efe;function tfe(t){return new oi(t.toString())}St.regexpCode=tfe});var ET=L(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.ValueScope=bn.ValueScopeName=bn.Scope=bn.varKinds=bn.UsedValueState=void 0;var _n=Yf(),$T=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Yy;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Yy||(bn.UsedValueState=Yy={}));bn.varKinds={const:new _n.Name("const"),let:new _n.Name("let"),var:new _n.Name("var")};var Qy=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof _n.Name?e:this.name(e)}name(e){return new _n.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,i;if(!((i=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||i===void 0)&&i.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};bn.Scope=Qy;var Xy=class extends _n.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:i}){this.value=e,this.scopePath=(0,_n._)`.${new _n.Name(r)}[${i}]`}};bn.ValueScopeName=Xy;var rfe=(0,_n._)`\n`,IT=class extends Qy{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?rfe:_n.nil}}get(){return this._scope}name(e){return new Xy(e,this._newName(e))}value(e,r){var i;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:o}=n,s=(i=r.key)!==null&&i!==void 0?i:r.ref,a=this._values[o];if(a){let c=a.get(s);if(c)return c}else a=this._values[o]=new Map;a.set(s,n);let u=this._scope[o]||(this._scope[o]=[]),l=u.length;return u[l]=r.ref,n.setValue(r,{property:o,itemIndex:l}),n}getValue(e,r){let i=this._values[e];if(i)return i.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,i=>{if(i.scopePath===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return(0,_n._)`${e}${i.scopePath}`})}scopeCode(e=this._values,r,i){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,i)}_reduceValues(e,r,i={},n){let o=_n.nil;for(let s in e){let a=e[s];if(!a)continue;let u=i[s]=i[s]||new Map;a.forEach(l=>{if(u.has(l))return;u.set(l,Yy.Started);let c=r(l);if(c){let d=this.opts.es5?bn.varKinds.var:bn.varKinds.const;o=(0,_n._)`${o}${d} ${l} = ${c};${this.opts._n}`}else if(c=n?.(l))o=(0,_n._)`${o}${c}${this.opts._n}`;else throw new $T(l);u.set(l,Yy.Completed)})}return o}};bn.ValueScope=IT});var He=L(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.or=et.and=et.not=et.CodeGen=et.operators=et.varKinds=et.ValueScopeName=et.ValueScope=et.Scope=et.Name=et.regexpCode=et.stringify=et.getProperty=et.nil=et.strConcat=et.str=et._=void 0;var pt=Yf(),Pi=ET(),as=Yf();Object.defineProperty(et,"_",{enumerable:!0,get:function(){return as._}});Object.defineProperty(et,"str",{enumerable:!0,get:function(){return as.str}});Object.defineProperty(et,"strConcat",{enumerable:!0,get:function(){return as.strConcat}});Object.defineProperty(et,"nil",{enumerable:!0,get:function(){return as.nil}});Object.defineProperty(et,"getProperty",{enumerable:!0,get:function(){return as.getProperty}});Object.defineProperty(et,"stringify",{enumerable:!0,get:function(){return as.stringify}});Object.defineProperty(et,"regexpCode",{enumerable:!0,get:function(){return as.regexpCode}});Object.defineProperty(et,"Name",{enumerable:!0,get:function(){return as.Name}});var nv=ET();Object.defineProperty(et,"Scope",{enumerable:!0,get:function(){return nv.Scope}});Object.defineProperty(et,"ValueScope",{enumerable:!0,get:function(){return nv.ValueScope}});Object.defineProperty(et,"ValueScopeName",{enumerable:!0,get:function(){return nv.ValueScopeName}});Object.defineProperty(et,"varKinds",{enumerable:!0,get:function(){return nv.varKinds}});et.operators={GT:new pt._Code(">"),GTE:new pt._Code(">="),LT:new pt._Code("<"),LTE:new pt._Code("<="),EQ:new pt._Code("==="),NEQ:new pt._Code("!=="),NOT:new pt._Code("!"),OR:new pt._Code("||"),AND:new pt._Code("&&"),ADD:new pt._Code("+")};var ko=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},PT=class extends ko{constructor(e,r,i){super(),this.varKind=e,this.name=r,this.rhs=i}render({es5:e,_n:r}){let i=e?Pi.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${i} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=wl(this.rhs,e,r)),this}get names(){return this.rhs instanceof pt._CodeOrName?this.rhs.names:{}}},ev=class extends ko{constructor(e,r,i){super(),this.lhs=e,this.rhs=r,this.sideEffects=i}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof pt.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=wl(this.rhs,e,r),this}get names(){let e=this.lhs instanceof pt.Name?{}:{...this.lhs.names};return rv(e,this.rhs)}},TT=class extends ev{constructor(e,r,i,n){super(e,i,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},OT=class extends ko{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},zT=class extends ko{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},NT=class extends ko{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},jT=class extends ko{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=wl(this.code,e,r),this}get names(){return this.code instanceof pt._CodeOrName?this.code.names:{}}},Qf=class extends ko{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,i)=>r+i.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let i=e[r].optimizeNodes();Array.isArray(i)?e.splice(r,1,...i):i?e[r]=i:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:i}=this,n=i.length;for(;n--;){let o=i[n];o.optimizeNames(e,r)||(nfe(e,o.names),i.splice(n,1))}return i.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>xa(e,r.names),{})}},xo=class extends Qf{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},CT=class extends Qf{},bl=class extends xo{};bl.kind="else";var Sa=class t extends xo{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let i=r.optimizeNodes();r=this.else=Array.isArray(i)?new bl(i):i}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(_q(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var i;if(this.else=(i=this.else)===null||i===void 0?void 0:i.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=wl(this.condition,e,r),this}get names(){let e=super.names;return rv(e,this.condition),this.else&&xa(e,this.else.names),e}};Sa.kind="if";var ka=class extends xo{};ka.kind="for";var RT=class extends ka{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=wl(this.iteration,e,r),this}get names(){return xa(super.names,this.iteration.names)}},AT=class extends ka{constructor(e,r,i,n){super(),this.varKind=e,this.name=r,this.from=i,this.to=n}render(e){let r=e.es5?Pi.varKinds.var:this.varKind,{name:i,from:n,to:o}=this;return`for(${r} ${i}=${n}; ${i}<${o}; ${i}++)`+super.render(e)}get names(){let e=rv(super.names,this.from);return rv(e,this.to)}},tv=class extends ka{constructor(e,r,i,n){super(),this.loop=e,this.varKind=r,this.name=i,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=wl(this.iterable,e,r),this}get names(){return xa(super.names,this.iterable.names)}},Xf=class extends xo{constructor(e,r,i){super(),this.name=e,this.args=r,this.async=i}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Xf.kind="func";var ep=class extends Qf{render(e){return"return "+super.render(e)}};ep.kind="return";var DT=class extends xo{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var i,n;return super.optimizeNames(e,r),(i=this.catch)===null||i===void 0||i.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&xa(e,this.catch.names),this.finally&&xa(e,this.finally.names),e}},tp=class extends xo{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};tp.kind="catch";var rp=class extends xo{render(e){return"finally"+super.render(e)}};rp.kind="finally";var UT=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
234
- `:""},this._extScope=e,this._scope=new Pi.Scope({parent:e}),this._nodes=[new CT]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let i=this._extScope.value(e,r);return(this._values[i.prefix]||(this._values[i.prefix]=new Set)).add(i),i}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,i,n){let o=this._scope.toName(r);return i!==void 0&&n&&(this._constants[o.str]=i),this._leafNode(new PT(e,o,i)),o}const(e,r,i){return this._def(Pi.varKinds.const,e,r,i)}let(e,r,i){return this._def(Pi.varKinds.let,e,r,i)}var(e,r,i){return this._def(Pi.varKinds.var,e,r,i)}assign(e,r,i){return this._leafNode(new ev(e,r,i))}add(e,r){return this._leafNode(new TT(e,et.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==pt.nil&&this._leafNode(new jT(e)),this}object(...e){let r=["{"];for(let[i,n]of e)r.length>1&&r.push(","),r.push(i),(i!==n||this.opts.es5)&&(r.push(":"),(0,pt.addCodeArg)(r,n));return r.push("}"),new pt._Code(r)}if(e,r,i){if(this._blockNode(new Sa(e)),r&&i)this.code(r).else().code(i).endIf();else if(r)this.code(r).endIf();else if(i)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Sa(e))}else(){return this._elseNode(new bl)}endIf(){return this._endBlockNode(Sa,bl)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new RT(e),r)}forRange(e,r,i,n,o=this.opts.es5?Pi.varKinds.var:Pi.varKinds.let){let s=this._scope.toName(e);return this._for(new AT(o,s,r,i),()=>n(s))}forOf(e,r,i,n=Pi.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=r instanceof pt.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,pt._)`${s}.length`,a=>{this.var(o,(0,pt._)`${s}[${a}]`),i(o)})}return this._for(new tv("of",n,o,r),()=>i(o))}forIn(e,r,i,n=this.opts.es5?Pi.varKinds.var:Pi.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,pt._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new tv("in",n,o,r),()=>i(o))}endFor(){return this._endBlockNode(ka)}label(e){return this._leafNode(new OT(e))}break(e){return this._leafNode(new zT(e))}return(e){let r=new ep;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(ep)}try(e,r,i){if(!r&&!i)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new DT;if(this._blockNode(n),this.code(e),r){let o=this.name("e");this._currNode=n.catch=new tp(o),r(o)}return i&&(this._currNode=n.finally=new rp,this.code(i)),this._endBlockNode(tp,rp)}throw(e){return this._leafNode(new NT(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let i=this._nodes.length-r;if(i<0||e!==void 0&&i!==e)throw new Error(`CodeGen: wrong number of nodes: ${i} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=pt.nil,i,n){return this._blockNode(new Xf(e,r,i)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Xf)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let i=this._currNode;if(i instanceof e||r&&i instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Sa))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};et.CodeGen=UT;function xa(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function rv(t,e){return e instanceof pt._CodeOrName?xa(t,e.names):t}function wl(t,e,r){if(t instanceof pt.Name)return i(t);if(!n(t))return t;return new pt._Code(t._items.reduce((o,s)=>(s instanceof pt.Name&&(s=i(s)),s instanceof pt._Code?o.push(...s._items):o.push(s),o),[]));function i(o){let s=r[o.str];return s===void 0||e[o.str]!==1?o:(delete e[o.str],s)}function n(o){return o instanceof pt._Code&&o._items.some(s=>s instanceof pt.Name&&e[s.str]===1&&r[s.str]!==void 0)}}function nfe(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function _q(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,pt._)`!${MT(t)}`}et.not=_q;var ife=bq(et.operators.AND);function ofe(...t){return t.reduce(ife)}et.and=ofe;var sfe=bq(et.operators.OR);function afe(...t){return t.reduce(sfe)}et.or=afe;function bq(t){return(e,r)=>e===pt.nil?r:r===pt.nil?e:(0,pt._)`${MT(e)} ${t} ${MT(r)}`}function MT(t){return t instanceof pt.Name?t:(0,pt._)`(${t})`}});var gt=L(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.checkStrictMode=it.getErrorPath=it.Type=it.useFunc=it.setEvaluated=it.evaluatedPropsToName=it.mergeEvaluated=it.eachItem=it.unescapeJsonPointer=it.escapeJsonPointer=it.escapeFragment=it.unescapeFragment=it.schemaRefOrVal=it.schemaHasRulesButRef=it.schemaHasRules=it.checkUnknownRules=it.alwaysValidSchema=it.toHash=void 0;var Ut=He(),ufe=Yf();function lfe(t){let e={};for(let r of t)e[r]=!0;return e}it.toHash=lfe;function cfe(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(kq(t,e),!xq(e,t.self.RULES.all))}it.alwaysValidSchema=cfe;function kq(t,e=t.schema){let{opts:r,self:i}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=i.RULES.keywords;for(let o in e)n[o]||Eq(t,`unknown keyword: "${o}"`)}it.checkUnknownRules=kq;function xq(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}it.schemaHasRules=xq;function dfe(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}it.schemaHasRulesButRef=dfe;function ffe({topSchemaRef:t,schemaPath:e},r,i,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Ut._)`${r}`}return(0,Ut._)`${t}${e}${(0,Ut.getProperty)(i)}`}it.schemaRefOrVal=ffe;function pfe(t){return $q(decodeURIComponent(t))}it.unescapeFragment=pfe;function mfe(t){return encodeURIComponent(LT(t))}it.escapeFragment=mfe;function LT(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}it.escapeJsonPointer=LT;function $q(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}it.unescapeJsonPointer=$q;function hfe(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}it.eachItem=hfe;function wq({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:i}){return(n,o,s,a)=>{let u=s===void 0?o:s instanceof Ut.Name?(o instanceof Ut.Name?t(n,o,s):e(n,o,s),s):o instanceof Ut.Name?(e(n,s,o),o):r(o,s);return a===Ut.Name&&!(u instanceof Ut.Name)?i(n,u):u}}it.mergeEvaluated={props:wq({mergeNames:(t,e,r)=>t.if((0,Ut._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Ut._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Ut._)`${r} || {}`).code((0,Ut._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Ut._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Ut._)`${r} || {}`),qT(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Iq}),items:wq({mergeNames:(t,e,r)=>t.if((0,Ut._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Ut._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Ut._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Ut._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Iq(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Ut._)`{}`);return e!==void 0&&qT(t,r,e),r}it.evaluatedPropsToName=Iq;function qT(t,e,r){Object.keys(r).forEach(i=>t.assign((0,Ut._)`${e}${(0,Ut.getProperty)(i)}`,!0))}it.setEvaluated=qT;var Sq={};function gfe(t,e){return t.scopeValue("func",{ref:e,code:Sq[e.code]||(Sq[e.code]=new ufe._Code(e.code))})}it.useFunc=gfe;var ZT;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(ZT||(it.Type=ZT={}));function yfe(t,e,r){if(t instanceof Ut.Name){let i=e===ZT.Num;return r?i?(0,Ut._)`"[" + ${t} + "]"`:(0,Ut._)`"['" + ${t} + "']"`:i?(0,Ut._)`"/" + ${t}`:(0,Ut._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ut.getProperty)(t).toString():"/"+LT(t)}it.getErrorPath=yfe;function Eq(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}it.checkStrictMode=Eq});var $o=L(FT=>{"use strict";Object.defineProperty(FT,"__esModule",{value:!0});var Ur=He(),vfe={data:new Ur.Name("data"),valCxt:new Ur.Name("valCxt"),instancePath:new Ur.Name("instancePath"),parentData:new Ur.Name("parentData"),parentDataProperty:new Ur.Name("parentDataProperty"),rootData:new Ur.Name("rootData"),dynamicAnchors:new Ur.Name("dynamicAnchors"),vErrors:new Ur.Name("vErrors"),errors:new Ur.Name("errors"),this:new Ur.Name("this"),self:new Ur.Name("self"),scope:new Ur.Name("scope"),json:new Ur.Name("json"),jsonPos:new Ur.Name("jsonPos"),jsonLen:new Ur.Name("jsonLen"),jsonPart:new Ur.Name("jsonPart")};FT.default=vfe});var np=L(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.extendErrors=Mr.resetErrorsCount=Mr.reportExtraError=Mr.reportError=Mr.keyword$DataError=Mr.keywordError=void 0;var yt=He(),iv=gt(),sn=$o();Mr.keywordError={message:({keyword:t})=>(0,yt.str)`must pass "${t}" keyword validation`};Mr.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,yt.str)`"${t}" keyword must be ${e} ($data)`:(0,yt.str)`"${t}" keyword is invalid ($data)`};function _fe(t,e=Mr.keywordError,r,i){let{it:n}=t,{gen:o,compositeRule:s,allErrors:a}=n,u=Oq(t,e,r);i??(s||a)?Pq(o,u):Tq(n,(0,yt._)`[${u}]`)}Mr.reportError=_fe;function bfe(t,e=Mr.keywordError,r){let{it:i}=t,{gen:n,compositeRule:o,allErrors:s}=i,a=Oq(t,e,r);Pq(n,a),o||s||Tq(i,sn.default.vErrors)}Mr.reportExtraError=bfe;function wfe(t,e){t.assign(sn.default.errors,e),t.if((0,yt._)`${sn.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,yt._)`${sn.default.vErrors}.length`,e),()=>t.assign(sn.default.vErrors,null)))}Mr.resetErrorsCount=wfe;function Sfe({gen:t,keyword:e,schemaValue:r,data:i,errsCount:n,it:o}){if(n===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",n,sn.default.errors,a=>{t.const(s,(0,yt._)`${sn.default.vErrors}[${a}]`),t.if((0,yt._)`${s}.instancePath === undefined`,()=>t.assign((0,yt._)`${s}.instancePath`,(0,yt.strConcat)(sn.default.instancePath,o.errorPath))),t.assign((0,yt._)`${s}.schemaPath`,(0,yt.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,yt._)`${s}.schema`,r),t.assign((0,yt._)`${s}.data`,i))})}Mr.extendErrors=Sfe;function Pq(t,e){let r=t.const("err",e);t.if((0,yt._)`${sn.default.vErrors} === null`,()=>t.assign(sn.default.vErrors,(0,yt._)`[${r}]`),(0,yt._)`${sn.default.vErrors}.push(${r})`),t.code((0,yt._)`${sn.default.errors}++`)}function Tq(t,e){let{gen:r,validateName:i,schemaEnv:n}=t;n.$async?r.throw((0,yt._)`new ${t.ValidationError}(${e})`):(r.assign((0,yt._)`${i}.errors`,e),r.return(!1))}var $a={keyword:new yt.Name("keyword"),schemaPath:new yt.Name("schemaPath"),params:new yt.Name("params"),propertyName:new yt.Name("propertyName"),message:new yt.Name("message"),schema:new yt.Name("schema"),parentSchema:new yt.Name("parentSchema")};function Oq(t,e,r){let{createErrors:i}=t.it;return i===!1?(0,yt._)`{}`:kfe(t,e,r)}function kfe(t,e,r={}){let{gen:i,it:n}=t,o=[xfe(n,r),$fe(t,r)];return Ife(t,e,o),i.object(...o)}function xfe({errorPath:t},{instancePath:e}){let r=e?(0,yt.str)`${t}${(0,iv.getErrorPath)(e,iv.Type.Str)}`:t;return[sn.default.instancePath,(0,yt.strConcat)(sn.default.instancePath,r)]}function $fe({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:i}){let n=i?e:(0,yt.str)`${e}/${t}`;return r&&(n=(0,yt.str)`${n}${(0,iv.getErrorPath)(r,iv.Type.Str)}`),[$a.schemaPath,n]}function Ife(t,{params:e,message:r},i){let{keyword:n,data:o,schemaValue:s,it:a}=t,{opts:u,propertyName:l,topSchemaRef:c,schemaPath:d}=a;i.push([$a.keyword,n],[$a.params,typeof e=="function"?e(t):e||(0,yt._)`{}`]),u.messages&&i.push([$a.message,typeof r=="function"?r(t):r]),u.verbose&&i.push([$a.schema,s],[$a.parentSchema,(0,yt._)`${c}${d}`],[sn.default.data,o]),l&&i.push([$a.propertyName,l])}});var Nq=L(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});Sl.boolOrEmptySchema=Sl.topBoolOrEmptySchema=void 0;var Efe=np(),Pfe=He(),Tfe=$o(),Ofe={message:"boolean schema is false"};function zfe(t){let{gen:e,schema:r,validateName:i}=t;r===!1?zq(t,!1):typeof r=="object"&&r.$async===!0?e.return(Tfe.default.data):(e.assign((0,Pfe._)`${i}.errors`,null),e.return(!0))}Sl.topBoolOrEmptySchema=zfe;function Nfe(t,e){let{gen:r,schema:i}=t;i===!1?(r.var(e,!1),zq(t)):r.var(e,!0)}Sl.boolOrEmptySchema=Nfe;function zq(t,e){let{gen:r,data:i}=t,n={gen:r,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Efe.reportError)(n,Ofe,void 0,e)}});var VT=L(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.getRules=kl.isJSONType=void 0;var jfe=["string","number","integer","boolean","null","object","array"],Cfe=new Set(jfe);function Rfe(t){return typeof t=="string"&&Cfe.has(t)}kl.isJSONType=Rfe;function Afe(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}kl.getRules=Afe});var WT=L(us=>{"use strict";Object.defineProperty(us,"__esModule",{value:!0});us.shouldUseRule=us.shouldUseGroup=us.schemaHasRulesForType=void 0;function Dfe({schema:t,self:e},r){let i=e.RULES.types[r];return i&&i!==!0&&jq(t,i)}us.schemaHasRulesForType=Dfe;function jq(t,e){return e.rules.some(r=>Cq(t,r))}us.shouldUseGroup=jq;function Cq(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(i=>t[i]!==void 0))}us.shouldUseRule=Cq});var ip=L(Zr=>{"use strict";Object.defineProperty(Zr,"__esModule",{value:!0});Zr.reportTypeError=Zr.checkDataTypes=Zr.checkDataType=Zr.coerceAndCheckDataType=Zr.getJSONTypes=Zr.getSchemaTypes=Zr.DataType=void 0;var Ufe=VT(),Mfe=WT(),Zfe=np(),Ge=He(),Rq=gt(),xl;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(xl||(Zr.DataType=xl={}));function Lfe(t){let e=Aq(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Zr.getSchemaTypes=Lfe;function Aq(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(Ufe.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Zr.getJSONTypes=Aq;function qfe(t,e){let{gen:r,data:i,opts:n}=t,o=Ffe(e,n.coerceTypes),s=e.length>0&&!(o.length===0&&e.length===1&&(0,Mfe.schemaHasRulesForType)(t,e[0]));if(s){let a=BT(e,i,n.strictNumbers,xl.Wrong);r.if(a,()=>{o.length?Vfe(t,e,o):KT(t)})}return s}Zr.coerceAndCheckDataType=qfe;var Dq=new Set(["string","number","integer","boolean","null"]);function Ffe(t,e){return e?t.filter(r=>Dq.has(r)||e==="array"&&r==="array"):[]}function Vfe(t,e,r){let{gen:i,data:n,opts:o}=t,s=i.let("dataType",(0,Ge._)`typeof ${n}`),a=i.let("coerced",(0,Ge._)`undefined`);o.coerceTypes==="array"&&i.if((0,Ge._)`${s} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>i.assign(n,(0,Ge._)`${n}[0]`).assign(s,(0,Ge._)`typeof ${n}`).if(BT(e,n,o.strictNumbers),()=>i.assign(a,n))),i.if((0,Ge._)`${a} !== undefined`);for(let l of r)(Dq.has(l)||l==="array"&&o.coerceTypes==="array")&&u(l);i.else(),KT(t),i.endIf(),i.if((0,Ge._)`${a} !== undefined`,()=>{i.assign(n,a),Wfe(t,a)});function u(l){switch(l){case"string":i.elseIf((0,Ge._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,Ge._)`"" + ${n}`).elseIf((0,Ge._)`${n} === null`).assign(a,(0,Ge._)`""`);return;case"number":i.elseIf((0,Ge._)`${s} == "boolean" || ${n} === null
235
- || (${s} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,Ge._)`+${n}`);return;case"integer":i.elseIf((0,Ge._)`${s} === "boolean" || ${n} === null
236
- || (${s} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,Ge._)`+${n}`);return;case"boolean":i.elseIf((0,Ge._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,Ge._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":i.elseIf((0,Ge._)`${n} === "" || ${n} === 0 || ${n} === false`),i.assign(a,null);return;case"array":i.elseIf((0,Ge._)`${s} === "string" || ${s} === "number"
237
- || ${s} === "boolean" || ${n} === null`).assign(a,(0,Ge._)`[${n}]`)}}}function Wfe({gen:t,parentData:e,parentDataProperty:r},i){t.if((0,Ge._)`${e} !== undefined`,()=>t.assign((0,Ge._)`${e}[${r}]`,i))}function GT(t,e,r,i=xl.Correct){let n=i===xl.Correct?Ge.operators.EQ:Ge.operators.NEQ,o;switch(t){case"null":return(0,Ge._)`${e} ${n} null`;case"array":o=(0,Ge._)`Array.isArray(${e})`;break;case"object":o=(0,Ge._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=s((0,Ge._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=s();break;default:return(0,Ge._)`typeof ${e} ${n} ${t}`}return i===xl.Correct?o:(0,Ge.not)(o);function s(a=Ge.nil){return(0,Ge.and)((0,Ge._)`typeof ${e} == "number"`,a,r?(0,Ge._)`isFinite(${e})`:Ge.nil)}}Zr.checkDataType=GT;function BT(t,e,r,i){if(t.length===1)return GT(t[0],e,r,i);let n,o=(0,Rq.toHash)(t);if(o.array&&o.object){let s=(0,Ge._)`typeof ${e} != "object"`;n=o.null?s:(0,Ge._)`!${e} || ${s}`,delete o.null,delete o.array,delete o.object}else n=Ge.nil;o.number&&delete o.integer;for(let s in o)n=(0,Ge.and)(n,GT(s,e,r,i));return n}Zr.checkDataTypes=BT;var Gfe={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Ge._)`{type: ${t}}`:(0,Ge._)`{type: ${e}}`};function KT(t){let e=Bfe(t);(0,Zfe.reportError)(e,Gfe)}Zr.reportTypeError=KT;function Bfe(t){let{gen:e,data:r,schema:i}=t,n=(0,Rq.schemaRefOrVal)(t,i,"type");return{gen:e,keyword:"type",data:r,schema:i.type,schemaCode:n,schemaValue:n,parentSchema:i,params:{},it:t}}});var Mq=L(ov=>{"use strict";Object.defineProperty(ov,"__esModule",{value:!0});ov.assignDefaults=void 0;var $l=He(),Kfe=gt();function Hfe(t,e){let{properties:r,items:i}=t.schema;if(e==="object"&&r)for(let n in r)Uq(t,n,r[n].default);else e==="array"&&Array.isArray(i)&&i.forEach((n,o)=>Uq(t,o,n.default))}ov.assignDefaults=Hfe;function Uq(t,e,r){let{gen:i,compositeRule:n,data:o,opts:s}=t;if(r===void 0)return;let a=(0,$l._)`${o}${(0,$l.getProperty)(e)}`;if(n){(0,Kfe.checkStrictMode)(t,`default is ignored for: ${a}`);return}let u=(0,$l._)`${a} === undefined`;s.useDefaults==="empty"&&(u=(0,$l._)`${u} || ${a} === null || ${a} === ""`),i.if(u,(0,$l._)`${a} = ${(0,$l.stringify)(r)}`)}});var si=L(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.validateUnion=Ot.validateArray=Ot.usePattern=Ot.callValidateCode=Ot.schemaProperties=Ot.allSchemaProperties=Ot.noPropertyInData=Ot.propertyInData=Ot.isOwnProperty=Ot.hasPropFunc=Ot.reportMissingProp=Ot.checkMissingProp=Ot.checkReportMissingProp=void 0;var Bt=He(),HT=gt(),ls=$o(),Jfe=gt();function Yfe(t,e){let{gen:r,data:i,it:n}=t;r.if(YT(r,i,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Bt._)`${e}`},!0),t.error()})}Ot.checkReportMissingProp=Yfe;function Qfe({gen:t,data:e,it:{opts:r}},i,n){return(0,Bt.or)(...i.map(o=>(0,Bt.and)(YT(t,e,o,r.ownProperties),(0,Bt._)`${n} = ${o}`)))}Ot.checkMissingProp=Qfe;function Xfe(t,e){t.setParams({missingProperty:e},!0),t.error()}Ot.reportMissingProp=Xfe;function Zq(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Bt._)`Object.prototype.hasOwnProperty`})}Ot.hasPropFunc=Zq;function JT(t,e,r){return(0,Bt._)`${Zq(t)}.call(${e}, ${r})`}Ot.isOwnProperty=JT;function epe(t,e,r,i){let n=(0,Bt._)`${e}${(0,Bt.getProperty)(r)} !== undefined`;return i?(0,Bt._)`${n} && ${JT(t,e,r)}`:n}Ot.propertyInData=epe;function YT(t,e,r,i){let n=(0,Bt._)`${e}${(0,Bt.getProperty)(r)} === undefined`;return i?(0,Bt.or)(n,(0,Bt.not)(JT(t,e,r))):n}Ot.noPropertyInData=YT;function Lq(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Ot.allSchemaProperties=Lq;function tpe(t,e){return Lq(e).filter(r=>!(0,HT.alwaysValidSchema)(t,e[r]))}Ot.schemaProperties=tpe;function rpe({schemaCode:t,data:e,it:{gen:r,topSchemaRef:i,schemaPath:n,errorPath:o},it:s},a,u,l){let c=l?(0,Bt._)`${t}, ${e}, ${i}${n}`:e,d=[[ls.default.instancePath,(0,Bt.strConcat)(ls.default.instancePath,o)],[ls.default.parentData,s.parentData],[ls.default.parentDataProperty,s.parentDataProperty],[ls.default.rootData,ls.default.rootData]];s.opts.dynamicRef&&d.push([ls.default.dynamicAnchors,ls.default.dynamicAnchors]);let p=(0,Bt._)`${c}, ${r.object(...d)}`;return u!==Bt.nil?(0,Bt._)`${a}.call(${u}, ${p})`:(0,Bt._)`${a}(${p})`}Ot.callValidateCode=rpe;var npe=(0,Bt._)`new RegExp`;function ipe({gen:t,it:{opts:e}},r){let i=e.unicodeRegExp?"u":"",{regExp:n}=e.code,o=n(r,i);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Bt._)`${n.code==="new RegExp"?npe:(0,Jfe.useFunc)(t,n)}(${r}, ${i})`})}Ot.usePattern=ipe;function ope(t){let{gen:e,data:r,keyword:i,it:n}=t,o=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return s(()=>e.assign(a,!1)),a}return e.var(o,!0),s(()=>e.break()),o;function s(a){let u=e.const("len",(0,Bt._)`${r}.length`);e.forRange("i",0,u,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:HT.Type.Num},o),e.if((0,Bt.not)(o),a)})}}Ot.validateArray=ope;function spe(t){let{gen:e,schema:r,keyword:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(u=>(0,HT.alwaysValidSchema)(n,u))&&!n.opts.unevaluated)return;let s=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((u,l)=>{let c=t.subschema({keyword:i,schemaProp:l,compositeRule:!0},a);e.assign(s,(0,Bt._)`${s} || ${a}`),t.mergeValidEvaluated(c,a)||e.if((0,Bt.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}Ot.validateUnion=spe});var Vq=L(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});Hi.validateKeywordUsage=Hi.validSchemaType=Hi.funcKeywordCode=Hi.macroKeywordCode=void 0;var an=He(),Ia=$o(),ape=si(),upe=np();function lpe(t,e){let{gen:r,keyword:i,schema:n,parentSchema:o,it:s}=t,a=e.macro.call(s.self,n,o,s),u=Fq(r,i,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:an.nil,errSchemaPath:`${s.errSchemaPath}/${i}`,topSchemaRef:u,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}Hi.macroKeywordCode=lpe;function cpe(t,e){var r;let{gen:i,keyword:n,schema:o,parentSchema:s,$data:a,it:u}=t;fpe(u,e);let l=!a&&e.compile?e.compile.call(u.self,o,s,u):e.validate,c=Fq(i,n,l),d=i.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)g(),e.modifying&&qq(t),v(()=>t.error());else{let h=e.async?f():m();e.modifying&&qq(t),v(()=>dpe(t,h))}}function f(){let h=i.let("ruleErrs",null);return i.try(()=>g((0,an._)`await `),y=>i.assign(d,!1).if((0,an._)`${y} instanceof ${u.ValidationError}`,()=>i.assign(h,(0,an._)`${y}.errors`),()=>i.throw(y))),h}function m(){let h=(0,an._)`${c}.errors`;return i.assign(h,null),g(an.nil),h}function g(h=e.async?(0,an._)`await `:an.nil){let y=u.opts.passContext?Ia.default.this:Ia.default.self,_=!("compile"in e&&!a||e.schema===!1);i.assign(d,(0,an._)`${h}${(0,ape.callValidateCode)(t,c,y,_)}`,e.modifying)}function v(h){var y;i.if((0,an.not)((y=e.valid)!==null&&y!==void 0?y:d),h)}}Hi.funcKeywordCode=cpe;function qq(t){let{gen:e,data:r,it:i}=t;e.if(i.parentData,()=>e.assign(r,(0,an._)`${i.parentData}[${i.parentDataProperty}]`))}function dpe(t,e){let{gen:r}=t;r.if((0,an._)`Array.isArray(${e})`,()=>{r.assign(Ia.default.vErrors,(0,an._)`${Ia.default.vErrors} === null ? ${e} : ${Ia.default.vErrors}.concat(${e})`).assign(Ia.default.errors,(0,an._)`${Ia.default.vErrors}.length`),(0,upe.extendErrors)(t)},()=>t.error())}function fpe({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Fq(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,an.stringify)(r)})}function ppe(t,e,r=!1){return!e.length||e.some(i=>i==="array"?Array.isArray(t):i==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==i||r&&typeof t>"u")}Hi.validSchemaType=ppe;function mpe({schema:t,opts:e,self:r,errSchemaPath:i},n,o){if(Array.isArray(n.keyword)?!n.keyword.includes(o):n.keyword!==o)throw new Error("ajv implementation error");let s=n.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${s.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[o])){let u=`keyword "${o}" value is invalid at path "${i}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(u);else throw new Error(u)}}Hi.validateKeywordUsage=mpe});var Gq=L(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs.extendSubschemaMode=cs.extendSubschemaData=cs.getSubschema=void 0;var Ji=He(),Wq=gt();function hpe(t,{keyword:e,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:s}){if(e!==void 0&&i!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ji._)`${t.schemaPath}${(0,Ji.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ji._)`${t.schemaPath}${(0,Ji.getProperty)(e)}${(0,Ji.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Wq.escapeFragment)(r)}`}}if(i!==void 0){if(n===void 0||o===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:s,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}cs.getSubschema=hpe;function gpe(t,e,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:s}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:c,opts:d}=e,p=a.let("data",(0,Ji._)`${e.data}${(0,Ji.getProperty)(r)}`,!0);u(p),t.errorPath=(0,Ji.str)`${l}${(0,Wq.getErrorPath)(r,i,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ji._)`${r}`,t.dataPathArr=[...c,t.parentDataProperty]}if(n!==void 0){let l=n instanceof Ji.Name?n:a.let("data",n,!0);u(l),s!==void 0&&(t.propertyName=s)}o&&(t.dataTypes=o);function u(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}cs.extendSubschemaData=gpe;function ype(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:i,createErrors:n,allErrors:o}){i!==void 0&&(t.compositeRule=i),n!==void 0&&(t.createErrors=n),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}cs.extendSubschemaMode=ype});var Kq=L((bNe,Bq)=>{"use strict";var ds=Bq.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var i=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};sv(e,i,n,t,"",t)};ds.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ds.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ds.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ds.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function sv(t,e,r,i,n,o,s,a,u,l){if(i&&typeof i=="object"&&!Array.isArray(i)){e(i,n,o,s,a,u,l);for(var c in i){var d=i[c];if(Array.isArray(d)){if(c in ds.arrayKeywords)for(var p=0;p<d.length;p++)sv(t,e,r,d[p],n+"/"+c+"/"+p,o,n,c,i,p)}else if(c in ds.propsKeywords){if(d&&typeof d=="object")for(var f in d)sv(t,e,r,d[f],n+"/"+c+"/"+vpe(f),o,n,c,i,f)}else(c in ds.keywords||t.allKeys&&!(c in ds.skipKeywords))&&sv(t,e,r,d,n+"/"+c,o,n,c,i)}r(i,n,o,s,a,u,l)}}function vpe(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var op=L(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.getSchemaRefs=wn.resolveUrl=wn.normalizeId=wn._getFullPath=wn.getFullPath=wn.inlineRef=void 0;var _pe=gt(),bpe=Of(),wpe=Kq(),Spe=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function kpe(t,e=!0){return typeof t=="boolean"?!0:e===!0?!QT(t):e?Hq(t)<=e:!1}wn.inlineRef=kpe;var xpe=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function QT(t){for(let e in t){if(xpe.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(QT)||typeof r=="object"&&QT(r))return!0}return!1}function Hq(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Spe.has(r)&&(typeof t[r]=="object"&&(0,_pe.eachItem)(t[r],i=>e+=Hq(i)),e===1/0))return 1/0}return e}function Jq(t,e="",r){r!==!1&&(e=Il(e));let i=t.parse(e);return Yq(t,i)}wn.getFullPath=Jq;function Yq(t,e){return t.serialize(e).split("#")[0]+"#"}wn._getFullPath=Yq;var $pe=/#\/?$/;function Il(t){return t?t.replace($pe,""):""}wn.normalizeId=Il;function Ipe(t,e,r){return r=Il(r),t.resolve(e,r)}wn.resolveUrl=Ipe;var Epe=/^[a-z_][-a-z0-9._]*$/i;function Ppe(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:i}=this.opts,n=Il(t[r]||e),o={"":n},s=Jq(i,n,!1),a={},u=new Set;return wpe(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let g=s+p,v=o[m];typeof d[r]=="string"&&(v=h.call(this,d[r])),y.call(this,d.$anchor),y.call(this,d.$dynamicAnchor),o[p]=v;function h(_){let b=this.opts.uriResolver.resolve;if(_=Il(v?b(v,_):_),u.has(_))throw c(_);u.add(_);let w=this.refs[_];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?l(d,w.schema,_):_!==Il(g)&&(_[0]==="#"?(l(d,a[_],_),a[_]=d):this.refs[_]=g),_}function y(_){if(typeof _=="string"){if(!Epe.test(_))throw new Error(`invalid anchor "${_}"`);h.call(this,`#${_}`)}}}),a;function l(d,p,f){if(p!==void 0&&!bpe(d,p))throw c(f)}function c(d){return new Error(`reference "${d}" resolves to more than one schema`)}}wn.getSchemaRefs=Ppe});var up=L(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});fs.getData=fs.KeywordCxt=fs.validateFunctionCode=void 0;var rF=Nq(),Qq=ip(),eO=WT(),av=ip(),Tpe=Mq(),ap=Vq(),XT=Gq(),ke=He(),Ae=$o(),Ope=op(),Io=gt(),sp=np();function zpe(t){if(oF(t)&&(sF(t),iF(t))){Cpe(t);return}nF(t,()=>(0,rF.topBoolOrEmptySchema)(t))}fs.validateFunctionCode=zpe;function nF({gen:t,validateName:e,schema:r,schemaEnv:i,opts:n},o){n.code.es5?t.func(e,(0,ke._)`${Ae.default.data}, ${Ae.default.valCxt}`,i.$async,()=>{t.code((0,ke._)`"use strict"; ${Xq(r,n)}`),jpe(t,n),t.code(o)}):t.func(e,(0,ke._)`${Ae.default.data}, ${Npe(n)}`,i.$async,()=>t.code(Xq(r,n)).code(o))}function Npe(t){return(0,ke._)`{${Ae.default.instancePath}="", ${Ae.default.parentData}, ${Ae.default.parentDataProperty}, ${Ae.default.rootData}=${Ae.default.data}${t.dynamicRef?(0,ke._)`, ${Ae.default.dynamicAnchors}={}`:ke.nil}}={}`}function jpe(t,e){t.if(Ae.default.valCxt,()=>{t.var(Ae.default.instancePath,(0,ke._)`${Ae.default.valCxt}.${Ae.default.instancePath}`),t.var(Ae.default.parentData,(0,ke._)`${Ae.default.valCxt}.${Ae.default.parentData}`),t.var(Ae.default.parentDataProperty,(0,ke._)`${Ae.default.valCxt}.${Ae.default.parentDataProperty}`),t.var(Ae.default.rootData,(0,ke._)`${Ae.default.valCxt}.${Ae.default.rootData}`),e.dynamicRef&&t.var(Ae.default.dynamicAnchors,(0,ke._)`${Ae.default.valCxt}.${Ae.default.dynamicAnchors}`)},()=>{t.var(Ae.default.instancePath,(0,ke._)`""`),t.var(Ae.default.parentData,(0,ke._)`undefined`),t.var(Ae.default.parentDataProperty,(0,ke._)`undefined`),t.var(Ae.default.rootData,Ae.default.data),e.dynamicRef&&t.var(Ae.default.dynamicAnchors,(0,ke._)`{}`)})}function Cpe(t){let{schema:e,opts:r,gen:i}=t;nF(t,()=>{r.$comment&&e.$comment&&uF(t),Mpe(t),i.let(Ae.default.vErrors,null),i.let(Ae.default.errors,0),r.unevaluated&&Rpe(t),aF(t),qpe(t)})}function Rpe(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,ke._)`${r}.evaluated`),e.if((0,ke._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,ke._)`${t.evaluated}.props`,(0,ke._)`undefined`)),e.if((0,ke._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,ke._)`${t.evaluated}.items`,(0,ke._)`undefined`))}function Xq(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,ke._)`/*# sourceURL=${r} */`:ke.nil}function Ape(t,e){if(oF(t)&&(sF(t),iF(t))){Dpe(t,e);return}(0,rF.boolOrEmptySchema)(t,e)}function iF({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function oF(t){return typeof t.schema!="boolean"}function Dpe(t,e){let{schema:r,gen:i,opts:n}=t;n.$comment&&r.$comment&&uF(t),Zpe(t),Lpe(t);let o=i.const("_errs",Ae.default.errors);aF(t,o),i.var(e,(0,ke._)`${o} === ${Ae.default.errors}`)}function sF(t){(0,Io.checkUnknownRules)(t),Upe(t)}function aF(t,e){if(t.opts.jtd)return eF(t,[],!1,e);let r=(0,Qq.getSchemaTypes)(t.schema),i=(0,Qq.coerceAndCheckDataType)(t,r);eF(t,r,!i,e)}function Upe(t){let{schema:e,errSchemaPath:r,opts:i,self:n}=t;e.$ref&&i.ignoreKeywordsWithRef&&(0,Io.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Mpe(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Io.checkStrictMode)(t,"default is ignored in the schema root")}function Zpe(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Ope.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Lpe(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function uF({gen:t,schemaEnv:e,schema:r,errSchemaPath:i,opts:n}){let o=r.$comment;if(n.$comment===!0)t.code((0,ke._)`${Ae.default.self}.logger.log(${o})`);else if(typeof n.$comment=="function"){let s=(0,ke.str)`${i}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,ke._)`${Ae.default.self}.opts.$comment(${o}, ${s}, ${a}.schema)`)}}function qpe(t){let{gen:e,schemaEnv:r,validateName:i,ValidationError:n,opts:o}=t;r.$async?e.if((0,ke._)`${Ae.default.errors} === 0`,()=>e.return(Ae.default.data),()=>e.throw((0,ke._)`new ${n}(${Ae.default.vErrors})`)):(e.assign((0,ke._)`${i}.errors`,Ae.default.vErrors),o.unevaluated&&Fpe(t),e.return((0,ke._)`${Ae.default.errors} === 0`))}function Fpe({gen:t,evaluated:e,props:r,items:i}){r instanceof ke.Name&&t.assign((0,ke._)`${e}.props`,r),i instanceof ke.Name&&t.assign((0,ke._)`${e}.items`,i)}function eF(t,e,r,i){let{gen:n,schema:o,data:s,allErrors:a,opts:u,self:l}=t,{RULES:c}=l;if(o.$ref&&(u.ignoreKeywordsWithRef||!(0,Io.schemaHasRulesButRef)(o,c))){n.block(()=>cF(t,"$ref",c.all.$ref.definition));return}u.jtd||Vpe(t,e),n.block(()=>{for(let p of c.rules)d(p);d(c.post)});function d(p){(0,eO.shouldUseGroup)(o,p)&&(p.type?(n.if((0,av.checkDataType)(p.type,s,u.strictNumbers)),tF(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,av.reportTypeError)(t)),n.endIf()):tF(t,p),a||n.if((0,ke._)`${Ae.default.errors} === ${i||0}`))}}function tF(t,e){let{gen:r,schema:i,opts:{useDefaults:n}}=t;n&&(0,Tpe.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,eO.shouldUseRule)(i,o)&&cF(t,o.keyword,o.definition,e.type)})}function Vpe(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Wpe(t,e),t.opts.allowUnionTypes||Gpe(t,e),Bpe(t,t.dataTypes))}function Wpe(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{lF(t.dataTypes,r)||tO(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Hpe(t,e)}}function Gpe(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&tO(t,"use allowUnionTypes to allow union type keyword")}function Bpe(t,e){let r=t.self.RULES.all;for(let i in r){let n=r[i];if(typeof n=="object"&&(0,eO.shouldUseRule)(t.schema,n)){let{type:o}=n.definition;o.length&&!o.some(s=>Kpe(e,s))&&tO(t,`missing type "${o.join(",")}" for keyword "${i}"`)}}}function Kpe(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function lF(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Hpe(t,e){let r=[];for(let i of t.dataTypes)lF(e,i)?r.push(i):e.includes("integer")&&i==="number"&&r.push("integer");t.dataTypes=r}function tO(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Io.checkStrictMode)(t,e,t.opts.strictTypes)}var uv=class{constructor(e,r,i){if((0,ap.validateKeywordUsage)(e,r,i),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=i,this.data=e.data,this.schema=e.schema[i],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Io.schemaRefOrVal)(e,this.schema,i,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",dF(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,ap.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${i} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",Ae.default.errors))}result(e,r,i){this.failResult((0,ke.not)(e),r,i)}failResult(e,r,i){this.gen.if(e),i?i():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,ke.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,ke._)`${r} !== undefined && (${(0,ke.or)(this.invalid$data(),e)})`)}error(e,r,i){if(r){this.setParams(r),this._error(e,i),this.setParams({});return}this._error(e,i)}_error(e,r){(e?sp.reportExtraError:sp.reportError)(this,this.def.error,r)}$dataError(){(0,sp.reportError)(this,this.def.$dataError||sp.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,sp.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,i=ke.nil){this.gen.block(()=>{this.check$data(e,i),r()})}check$data(e=ke.nil,r=ke.nil){if(!this.$data)return;let{gen:i,schemaCode:n,schemaType:o,def:s}=this;i.if((0,ke.or)((0,ke._)`${n} === undefined`,r)),e!==ke.nil&&i.assign(e,!0),(o.length||s.validateSchema)&&(i.elseIf(this.invalid$data()),this.$dataError(),e!==ke.nil&&i.assign(e,!1)),i.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:i,def:n,it:o}=this;return(0,ke.or)(s(),a());function s(){if(i.length){if(!(r instanceof ke.Name))throw new Error("ajv implementation error");let u=Array.isArray(i)?i:[i];return(0,ke._)`${(0,av.checkDataTypes)(u,r,o.opts.strictNumbers,av.DataType.Wrong)}`}return ke.nil}function a(){if(n.validateSchema){let u=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,ke._)`!${u}(${r})`}return ke.nil}}subschema(e,r){let i=(0,XT.getSubschema)(this.it,e);(0,XT.extendSubschemaData)(i,this.it,e),(0,XT.extendSubschemaMode)(i,e);let n={...this.it,...i,items:void 0,props:void 0};return Ape(n,r),n}mergeEvaluated(e,r){let{it:i,gen:n}=this;i.opts.unevaluated&&(i.props!==!0&&e.props!==void 0&&(i.props=Io.mergeEvaluated.props(n,e.props,i.props,r)),i.items!==!0&&e.items!==void 0&&(i.items=Io.mergeEvaluated.items(n,e.items,i.items,r)))}mergeValidEvaluated(e,r){let{it:i,gen:n}=this;if(i.opts.unevaluated&&(i.props!==!0||i.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,ke.Name)),!0}};fs.KeywordCxt=uv;function cF(t,e,r,i){let n=new uv(t,r,e);"code"in r?r.code(n,i):n.$data&&r.validate?(0,ap.funcKeywordCode)(n,r):"macro"in r?(0,ap.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,ap.funcKeywordCode)(n,r)}var Jpe=/^\/(?:[^~]|~0|~1)*$/,Ype=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function dF(t,{dataLevel:e,dataNames:r,dataPathArr:i}){let n,o;if(t==="")return Ae.default.rootData;if(t[0]==="/"){if(!Jpe.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,o=Ae.default.rootData}else{let l=Ype.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let c=+l[1];if(n=l[2],n==="#"){if(c>=e)throw new Error(u("property/index",c));return i[e-c]}if(c>e)throw new Error(u("data",c));if(o=r[e-c],!n)return o}let s=o,a=n.split("/");for(let l of a)l&&(o=(0,ke._)`${o}${(0,ke.getProperty)((0,Io.unescapeJsonPointer)(l))}`,s=(0,ke._)`${s} && ${o}`);return s;function u(l,c){return`Cannot access ${l} ${c} levels up, current level is ${e}`}}fs.getData=dF});var lv=L(nO=>{"use strict";Object.defineProperty(nO,"__esModule",{value:!0});var rO=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};nO.default=rO});var lp=L(sO=>{"use strict";Object.defineProperty(sO,"__esModule",{value:!0});var iO=op(),oO=class extends Error{constructor(e,r,i,n){super(n||`can't resolve reference ${i} from id ${r}`),this.missingRef=(0,iO.resolveUrl)(e,r,i),this.missingSchema=(0,iO.normalizeId)((0,iO.getFullPath)(e,this.missingRef))}};sO.default=oO});var dv=L(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.resolveSchema=ai.getCompilingSchema=ai.resolveRef=ai.compileSchema=ai.SchemaEnv=void 0;var Ti=He(),Qpe=lv(),Ea=$o(),Oi=op(),fF=gt(),Xpe=up(),El=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let i;typeof e.schema=="object"&&(i=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Oi.normalizeId)(i?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=i?.$async,this.refs={}}};ai.SchemaEnv=El;function uO(t){let e=pF.call(this,t);if(e)return e;let r=(0,Oi.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:i,lines:n}=this.opts.code,{ownProperties:o}=this.opts,s=new Ti.CodeGen(this.scope,{es5:i,lines:n,ownProperties:o}),a;t.$async&&(a=s.scopeValue("Error",{ref:Qpe.default,code:(0,Ti._)`require("ajv/dist/runtime/validation_error").default`}));let u=s.scopeName("validate");t.validateName=u;let l={gen:s,allErrors:this.opts.allErrors,data:Ea.default.data,parentData:Ea.default.parentData,parentDataProperty:Ea.default.parentDataProperty,dataNames:[Ea.default.data],dataPathArr:[Ti.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Ti.stringify)(t.schema)}:{ref:t.schema}),validateName:u,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Ti.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ti._)`""`,opts:this.opts,self:this},c;try{this._compilations.add(t),(0,Xpe.validateFunctionCode)(l),s.optimize(this.opts.code.optimize);let d=s.toString();c=`${s.scopeRefs(Ea.default.scope)}return ${d}`,this.opts.code.process&&(c=this.opts.code.process(c,t));let f=new Function(`${Ea.default.self}`,`${Ea.default.scope}`,c)(this,this.scope.get());if(this.scope.value(u,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:u,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:g}=l;f.evaluated={props:m instanceof Ti.Name?void 0:m,items:g instanceof Ti.Name?void 0:g,dynamicProps:m instanceof Ti.Name,dynamicItems:g instanceof Ti.Name},f.source&&(f.source.evaluated=(0,Ti.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,c&&this.logger.error("Error compiling schema, function code:",c),d}finally{this._compilations.delete(t)}}ai.compileSchema=uO;function eme(t,e,r){var i;r=(0,Oi.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let o=nme.call(this,t,r);if(o===void 0){let s=(i=t.localRefs)===null||i===void 0?void 0:i[r],{schemaId:a}=this.opts;s&&(o=new El({schema:s,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=tme.call(this,o)}ai.resolveRef=eme;function tme(t){return(0,Oi.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:uO.call(this,t)}function pF(t){for(let e of this._compilations)if(rme(e,t))return e}ai.getCompilingSchema=pF;function rme(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function nme(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||cv.call(this,t,e)}function cv(t,e){let r=this.opts.uriResolver.parse(e),i=(0,Oi._getFullPath)(this.opts.uriResolver,r),n=(0,Oi.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&i===n)return aO.call(this,r,t);let o=(0,Oi.normalizeId)(i),s=this.refs[o]||this.schemas[o];if(typeof s=="string"){let a=cv.call(this,t,s);return typeof a?.schema!="object"?void 0:aO.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||uO.call(this,s),o===(0,Oi.normalizeId)(e)){let{schema:a}=s,{schemaId:u}=this.opts,l=a[u];return l&&(n=(0,Oi.resolveUrl)(this.opts.uriResolver,n,l)),new El({schema:a,schemaId:u,root:t,baseId:n})}return aO.call(this,r,s)}}ai.resolveSchema=cv;var ime=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function aO(t,{baseId:e,schema:r,root:i}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let u=r[(0,fF.unescapeFragment)(a)];if(u===void 0)return;r=u;let l=typeof r=="object"&&r[this.opts.schemaId];!ime.has(a)&&l&&(e=(0,Oi.resolveUrl)(this.opts.uriResolver,e,l))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,fF.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Oi.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=cv.call(this,i,a)}let{schemaId:s}=this.opts;if(o=o||new El({schema:r,schemaId:s,root:i,baseId:e}),o.schema!==o.root.schema)return o}});var mF=L((INe,ome)=>{ome.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var gF=L(lO=>{"use strict";Object.defineProperty(lO,"__esModule",{value:!0});var hF=$P();hF.code='require("ajv/dist/runtime/uri").default';lO.default=hF});var xF=L(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.CodeGen=Er.Name=Er.nil=Er.stringify=Er.str=Er._=Er.KeywordCxt=void 0;var sme=up();Object.defineProperty(Er,"KeywordCxt",{enumerable:!0,get:function(){return sme.KeywordCxt}});var Pl=He();Object.defineProperty(Er,"_",{enumerable:!0,get:function(){return Pl._}});Object.defineProperty(Er,"str",{enumerable:!0,get:function(){return Pl.str}});Object.defineProperty(Er,"stringify",{enumerable:!0,get:function(){return Pl.stringify}});Object.defineProperty(Er,"nil",{enumerable:!0,get:function(){return Pl.nil}});Object.defineProperty(Er,"Name",{enumerable:!0,get:function(){return Pl.Name}});Object.defineProperty(Er,"CodeGen",{enumerable:!0,get:function(){return Pl.CodeGen}});var ame=lv(),wF=lp(),ume=VT(),cp=dv(),lme=He(),dp=op(),fv=ip(),dO=gt(),yF=mF(),cme=gF(),SF=(t,e)=>new RegExp(t,e);SF.code="new RegExp";var dme=["removeAdditional","useDefaults","coerceTypes"],fme=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),pme={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},mme={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},vF=200;function hme(t){var e,r,i,n,o,s,a,u,l,c,d,p,f,m,g,v,h,y,_,b,w,S,k,$,P;let j=t.strict,I=(e=t.code)===null||e===void 0?void 0:e.optimize,R=I===!0||I===void 0?1:I||0,q=(i=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&i!==void 0?i:SF,O=(n=t.uriResolver)!==null&&n!==void 0?n:cme.default;return{strictSchema:(s=(o=t.strictSchema)!==null&&o!==void 0?o:j)!==null&&s!==void 0?s:!0,strictNumbers:(u=(a=t.strictNumbers)!==null&&a!==void 0?a:j)!==null&&u!==void 0?u:!0,strictTypes:(c=(l=t.strictTypes)!==null&&l!==void 0?l:j)!==null&&c!==void 0?c:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:j)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:j)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:R,regExp:q}:{optimize:R,regExp:q},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:vF,loopEnum:(v=t.loopEnum)!==null&&v!==void 0?v:vF,meta:(h=t.meta)!==null&&h!==void 0?h:!0,messages:(y=t.messages)!==null&&y!==void 0?y:!0,inlineRefs:(_=t.inlineRefs)!==null&&_!==void 0?_:!0,schemaId:(b=t.schemaId)!==null&&b!==void 0?b:"$id",addUsedSchema:(w=t.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(S=t.validateSchema)!==null&&S!==void 0?S:!0,validateFormats:(k=t.validateFormats)!==null&&k!==void 0?k:!0,unicodeRegExp:($=t.unicodeRegExp)!==null&&$!==void 0?$:!0,int32range:(P=t.int32range)!==null&&P!==void 0?P:!0,uriResolver:O}}var fp=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...hme(e)};let{es5:r,lines:i}=this.opts.code;this.scope=new lme.ValueScope({scope:{},prefixes:fme,es5:r,lines:i}),this.logger=wme(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,ume.getRules)(),_F.call(this,pme,e,"NOT SUPPORTED"),_F.call(this,mme,e,"DEPRECATED","warn"),this._metaOpts=_me.call(this),e.formats&&yme.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&vme.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),gme.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:i}=this.opts,n=yF;i==="id"&&(n={...yF},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[i],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let i;if(typeof e=="string"){if(i=this.getSchema(e),!i)throw new Error(`no schema with key or ref "${e}"`)}else i=this.compile(e);let n=i(r);return"$async"in i||(this.errors=i.errors),n}compile(e,r){let i=this._addSchema(e,r);return i.validate||this._compileSchemaEnv(i)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:i}=this.opts;return n.call(this,e,r);async function n(c,d){await o.call(this,c.$schema);let p=this._addSchema(c,d);return p.validate||s.call(this,p)}async function o(c){c&&!this.getSchema(c)&&await n.call(this,{$ref:c},!0)}async function s(c){try{return this._compileSchemaEnv(c)}catch(d){if(!(d instanceof wF.default))throw d;return a.call(this,d),await u.call(this,d.missingSchema),s.call(this,c)}}function a({missingSchema:c,missingRef:d}){if(this.refs[c])throw new Error(`AnySchema ${c} is loaded but ${d} cannot be resolved`)}async function u(c){let d=await l.call(this,c);this.refs[c]||await o.call(this,d.$schema),this.refs[c]||this.addSchema(d,c,r)}async function l(c){let d=this._loading[c];if(d)return d;try{return await(this._loading[c]=i(c))}finally{delete this._loading[c]}}}addSchema(e,r,i,n=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,i,n);return this}let o;if(typeof e=="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw new Error(`schema ${s} must be string`)}return r=(0,dp.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,i,r,n,!0),this}addMetaSchema(e,r,i=this.opts.validateSchema){return this.addSchema(e,r,!0,i),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let i;if(i=e.$schema,i!==void 0&&typeof i!="string")throw new Error("$schema must be a string");if(i=i||this.opts.defaultMeta||this.defaultMeta(),!i)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(i,e);if(!n&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return n}getSchema(e){let r;for(;typeof(r=bF.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:i}=this.opts,n=new cp.SchemaEnv({schema:{},schemaId:i});if(r=cp.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=bF.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let i=e[this.opts.schemaId];return i&&(i=(0,dp.normalizeId)(i),delete this.schemas[i],delete this.refs[i]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let i;if(typeof e=="string")i=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=i);else if(typeof e=="object"&&r===void 0){if(r=e,i=r.keyword,Array.isArray(i)&&!i.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(kme.call(this,i,r),!r)return(0,dO.eachItem)(i,o=>cO.call(this,o)),this;$me.call(this,r);let n={...r,type:(0,fv.getJSONTypes)(r.type),schemaType:(0,fv.getJSONTypes)(r.schemaType)};return(0,dO.eachItem)(i,n.type.length===0?o=>cO.call(this,o,n):o=>n.type.forEach(s=>cO.call(this,o,n,s))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let i of r.rules){let n=i.rules.findIndex(o=>o.keyword===e);n>=0&&i.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:i="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${i}${n.instancePath} ${n.message}`).reduce((n,o)=>n+r+o)}$dataMetaSchema(e,r){let i=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let o=n.split("/").slice(1),s=e;for(let a of o)s=s[a];for(let a in i){let u=i[a];if(typeof u!="object")continue;let{$data:l}=u.definition,c=s[a];l&&c&&(s[a]=kF(c))}}return e}_removeAllSchemas(e,r){for(let i in e){let n=e[i];(!r||r.test(i))&&(typeof n=="string"?delete e[i]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[i]))}}_addSchema(e,r,i,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof e=="object")s=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let u=this._cache.get(e);if(u!==void 0)return u;i=(0,dp.normalizeId)(s||i);let l=dp.getSchemaRefs.call(this,e,i);return u=new cp.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:i,localRefs:l}),this._cache.set(u.schema,u),o&&!i.startsWith("#")&&(i&&this._checkUnique(i),this.refs[i]=u),n&&this.validateSchema(e,!0),u}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):cp.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{cp.compileSchema.call(this,e)}finally{this.opts=r}}};fp.ValidationError=ame.default;fp.MissingRefError=wF.default;Er.default=fp;function _F(t,e,r,i="error"){for(let n in t){let o=n;o in e&&this.logger[i](`${r}: option ${n}. ${t[o]}`)}}function bF(t){return t=(0,dp.normalizeId)(t),this.schemas[t]||this.refs[t]}function gme(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function yme(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function vme(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function _me(){let t={...this.opts};for(let e of dme)delete t[e];return t}var bme={log(){},warn(){},error(){}};function wme(t){if(t===!1)return bme;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Sme=/^[a-z_$][a-z0-9_$:-]*$/i;function kme(t,e){let{RULES:r}=this;if((0,dO.eachItem)(t,i=>{if(r.keywords[i])throw new Error(`Keyword ${i} is already defined`);if(!Sme.test(i))throw new Error(`Keyword ${i} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function cO(t,e,r){var i;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,s=n?o.post:o.rules.find(({type:u})=>u===r);if(s||(s={type:r,rules:[]},o.rules.push(s)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,fv.getJSONTypes)(e.type),schemaType:(0,fv.getJSONTypes)(e.schemaType)}};e.before?xme.call(this,s,a,e.before):s.rules.push(a),o.all[t]=a,(i=e.implements)===null||i===void 0||i.forEach(u=>this.addKeyword(u))}function xme(t,e,r){let i=t.rules.findIndex(n=>n.keyword===r);i>=0?t.rules.splice(i,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function $me(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=kF(e)),t.validateSchema=this.compile(e,!0))}var Ime={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function kF(t){return{anyOf:[t,Ime]}}});var $F=L(fO=>{"use strict";Object.defineProperty(fO,"__esModule",{value:!0});var Eme={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};fO.default=Eme});var TF=L(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});Pa.callRef=Pa.getValidate=void 0;var Pme=lp(),IF=si(),Sn=He(),Tl=$o(),EF=dv(),pv=gt(),Tme={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:i}=t,{baseId:n,schemaEnv:o,validateName:s,opts:a,self:u}=i,{root:l}=o;if((r==="#"||r==="#/")&&n===l.baseId)return d();let c=EF.resolveRef.call(u,l,n,r);if(c===void 0)throw new Pme.default(i.opts.uriResolver,n,r);if(c instanceof EF.SchemaEnv)return p(c);return f(c);function d(){if(o===l)return mv(t,s,o,o.$async);let m=e.scopeValue("root",{ref:l});return mv(t,(0,Sn._)`${m}.validate`,l,l.$async)}function p(m){let g=PF(t,m);mv(t,g,m,m.$async)}function f(m){let g=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Sn.stringify)(m)}:{ref:m}),v=e.name("valid"),h=t.subschema({schema:m,dataTypes:[],schemaPath:Sn.nil,topSchemaRef:g,errSchemaPath:r},v);t.mergeEvaluated(h),t.ok(v)}}};function PF(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Sn._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Pa.getValidate=PF;function mv(t,e,r,i){let{gen:n,it:o}=t,{allErrors:s,schemaEnv:a,opts:u}=o,l=u.passContext?Tl.default.this:Sn.nil;i?c():d();function c(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,Sn._)`await ${(0,IF.callValidateCode)(t,e,l)}`),f(e),s||n.assign(m,!0)},g=>{n.if((0,Sn._)`!(${g} instanceof ${o.ValidationError})`,()=>n.throw(g)),p(g),s||n.assign(m,!1)}),t.ok(m)}function d(){t.result((0,IF.callValidateCode)(t,e,l),()=>f(e),()=>p(e))}function p(m){let g=(0,Sn._)`${m}.errors`;n.assign(Tl.default.vErrors,(0,Sn._)`${Tl.default.vErrors} === null ? ${g} : ${Tl.default.vErrors}.concat(${g})`),n.assign(Tl.default.errors,(0,Sn._)`${Tl.default.vErrors}.length`)}function f(m){var g;if(!o.opts.unevaluated)return;let v=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(o.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(o.props=pv.mergeEvaluated.props(n,v.props,o.props));else{let h=n.var("props",(0,Sn._)`${m}.evaluated.props`);o.props=pv.mergeEvaluated.props(n,h,o.props,Sn.Name)}if(o.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(o.items=pv.mergeEvaluated.items(n,v.items,o.items));else{let h=n.var("items",(0,Sn._)`${m}.evaluated.items`);o.items=pv.mergeEvaluated.items(n,h,o.items,Sn.Name)}}}Pa.callRef=mv;Pa.default=Tme});var OF=L(pO=>{"use strict";Object.defineProperty(pO,"__esModule",{value:!0});var Ome=$F(),zme=TF(),Nme=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Ome.default,zme.default];pO.default=Nme});var zF=L(mO=>{"use strict";Object.defineProperty(mO,"__esModule",{value:!0});var hv=He(),ps=hv.operators,gv={maximum:{okStr:"<=",ok:ps.LTE,fail:ps.GT},minimum:{okStr:">=",ok:ps.GTE,fail:ps.LT},exclusiveMaximum:{okStr:"<",ok:ps.LT,fail:ps.GTE},exclusiveMinimum:{okStr:">",ok:ps.GT,fail:ps.LTE}},jme={message:({keyword:t,schemaCode:e})=>(0,hv.str)`must be ${gv[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,hv._)`{comparison: ${gv[t].okStr}, limit: ${e}}`},Cme={keyword:Object.keys(gv),type:"number",schemaType:"number",$data:!0,error:jme,code(t){let{keyword:e,data:r,schemaCode:i}=t;t.fail$data((0,hv._)`${r} ${gv[e].fail} ${i} || isNaN(${r})`)}};mO.default=Cme});var NF=L(hO=>{"use strict";Object.defineProperty(hO,"__esModule",{value:!0});var pp=He(),Rme={message:({schemaCode:t})=>(0,pp.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,pp._)`{multipleOf: ${t}}`},Ame={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Rme,code(t){let{gen:e,data:r,schemaCode:i,it:n}=t,o=n.opts.multipleOfPrecision,s=e.let("res"),a=o?(0,pp._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${o}`:(0,pp._)`${s} !== parseInt(${s})`;t.fail$data((0,pp._)`(${i} === 0 || (${s} = ${r}/${i}, ${a}))`)}};hO.default=Ame});var CF=L(gO=>{"use strict";Object.defineProperty(gO,"__esModule",{value:!0});function jF(t){let e=t.length,r=0,i=0,n;for(;i<e;)r++,n=t.charCodeAt(i++),n>=55296&&n<=56319&&i<e&&(n=t.charCodeAt(i),(n&64512)===56320&&i++);return r}gO.default=jF;jF.code='require("ajv/dist/runtime/ucs2length").default'});var RF=L(yO=>{"use strict";Object.defineProperty(yO,"__esModule",{value:!0});var Ta=He(),Dme=gt(),Ume=CF(),Mme={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Ta.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Ta._)`{limit: ${t}}`},Zme={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Mme,code(t){let{keyword:e,data:r,schemaCode:i,it:n}=t,o=e==="maxLength"?Ta.operators.GT:Ta.operators.LT,s=n.opts.unicode===!1?(0,Ta._)`${r}.length`:(0,Ta._)`${(0,Dme.useFunc)(t.gen,Ume.default)}(${r})`;t.fail$data((0,Ta._)`${s} ${o} ${i}`)}};yO.default=Zme});var AF=L(vO=>{"use strict";Object.defineProperty(vO,"__esModule",{value:!0});var Lme=si(),qme=gt(),Ol=He(),Fme={message:({schemaCode:t})=>(0,Ol.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Ol._)`{pattern: ${t}}`},Vme={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Fme,code(t){let{gen:e,data:r,$data:i,schema:n,schemaCode:o,it:s}=t,a=s.opts.unicodeRegExp?"u":"";if(i){let{regExp:u}=s.opts.code,l=u.code==="new RegExp"?(0,Ol._)`new RegExp`:(0,qme.useFunc)(e,u),c=e.let("valid");e.try(()=>e.assign(c,(0,Ol._)`${l}(${o}, ${a}).test(${r})`),()=>e.assign(c,!1)),t.fail$data((0,Ol._)`!${c}`)}else{let u=(0,Lme.usePattern)(t,n);t.fail$data((0,Ol._)`!${u}.test(${r})`)}}};vO.default=Vme});var DF=L(_O=>{"use strict";Object.defineProperty(_O,"__esModule",{value:!0});var mp=He(),Wme={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,mp.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,mp._)`{limit: ${t}}`},Gme={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Wme,code(t){let{keyword:e,data:r,schemaCode:i}=t,n=e==="maxProperties"?mp.operators.GT:mp.operators.LT;t.fail$data((0,mp._)`Object.keys(${r}).length ${n} ${i}`)}};_O.default=Gme});var UF=L(bO=>{"use strict";Object.defineProperty(bO,"__esModule",{value:!0});var hp=si(),gp=He(),Bme=gt(),Kme={message:({params:{missingProperty:t}})=>(0,gp.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,gp._)`{missingProperty: ${t}}`},Hme={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Kme,code(t){let{gen:e,schema:r,schemaCode:i,data:n,$data:o,it:s}=t,{opts:a}=s;if(!o&&r.length===0)return;let u=r.length>=a.loopRequired;if(s.allErrors?l():c(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let g of r)if(f?.[g]===void 0&&!m.has(g)){let v=s.schemaEnv.baseId+s.errSchemaPath,h=`required property "${g}" is not defined at "${v}" (strictRequired)`;(0,Bme.checkStrictMode)(s,h,s.opts.strictRequired)}}function l(){if(u||o)t.block$data(gp.nil,d);else for(let f of r)(0,hp.checkReportMissingProp)(t,f)}function c(){let f=e.let("missing");if(u||o){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,hp.checkMissingProp)(t,r,f)),(0,hp.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",i,f=>{t.setParams({missingProperty:f}),e.if((0,hp.noPropertyInData)(e,n,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,i,()=>{e.assign(m,(0,hp.propertyInData)(e,n,f,a.ownProperties)),e.if((0,gp.not)(m),()=>{t.error(),e.break()})},gp.nil)}}};bO.default=Hme});var MF=L(wO=>{"use strict";Object.defineProperty(wO,"__esModule",{value:!0});var yp=He(),Jme={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,yp.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,yp._)`{limit: ${t}}`},Yme={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Jme,code(t){let{keyword:e,data:r,schemaCode:i}=t,n=e==="maxItems"?yp.operators.GT:yp.operators.LT;t.fail$data((0,yp._)`${r}.length ${n} ${i}`)}};wO.default=Yme});var yv=L(SO=>{"use strict";Object.defineProperty(SO,"__esModule",{value:!0});var ZF=Of();ZF.code='require("ajv/dist/runtime/equal").default';SO.default=ZF});var LF=L(xO=>{"use strict";Object.defineProperty(xO,"__esModule",{value:!0});var kO=ip(),Pr=He(),Qme=gt(),Xme=yv(),ehe={message:({params:{i:t,j:e}})=>(0,Pr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Pr._)`{i: ${t}, j: ${e}}`},the={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:ehe,code(t){let{gen:e,data:r,$data:i,schema:n,parentSchema:o,schemaCode:s,it:a}=t;if(!i&&!n)return;let u=e.let("valid"),l=o.items?(0,kO.getSchemaTypes)(o.items):[];t.block$data(u,c,(0,Pr._)`${s} === false`),t.ok(u);function c(){let m=e.let("i",(0,Pr._)`${r}.length`),g=e.let("j");t.setParams({i:m,j:g}),e.assign(u,!0),e.if((0,Pr._)`${m} > 1`,()=>(d()?p:f)(m,g))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function p(m,g){let v=e.name("item"),h=(0,kO.checkDataTypes)(l,v,a.opts.strictNumbers,kO.DataType.Wrong),y=e.const("indices",(0,Pr._)`{}`);e.for((0,Pr._)`;${m}--;`,()=>{e.let(v,(0,Pr._)`${r}[${m}]`),e.if(h,(0,Pr._)`continue`),l.length>1&&e.if((0,Pr._)`typeof ${v} == "string"`,(0,Pr._)`${v} += "_"`),e.if((0,Pr._)`typeof ${y}[${v}] == "number"`,()=>{e.assign(g,(0,Pr._)`${y}[${v}]`),t.error(),e.assign(u,!1).break()}).code((0,Pr._)`${y}[${v}] = ${m}`)})}function f(m,g){let v=(0,Qme.useFunc)(e,Xme.default),h=e.name("outer");e.label(h).for((0,Pr._)`;${m}--;`,()=>e.for((0,Pr._)`${g} = ${m}; ${g}--;`,()=>e.if((0,Pr._)`${v}(${r}[${m}], ${r}[${g}])`,()=>{t.error(),e.assign(u,!1).break(h)})))}}};xO.default=the});var qF=L(IO=>{"use strict";Object.defineProperty(IO,"__esModule",{value:!0});var $O=He(),rhe=gt(),nhe=yv(),ihe={message:"must be equal to constant",params:({schemaCode:t})=>(0,$O._)`{allowedValue: ${t}}`},ohe={keyword:"const",$data:!0,error:ihe,code(t){let{gen:e,data:r,$data:i,schemaCode:n,schema:o}=t;i||o&&typeof o=="object"?t.fail$data((0,$O._)`!${(0,rhe.useFunc)(e,nhe.default)}(${r}, ${n})`):t.fail((0,$O._)`${o} !== ${r}`)}};IO.default=ohe});var FF=L(EO=>{"use strict";Object.defineProperty(EO,"__esModule",{value:!0});var vp=He(),she=gt(),ahe=yv(),uhe={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,vp._)`{allowedValues: ${t}}`},lhe={keyword:"enum",schemaType:"array",$data:!0,error:uhe,code(t){let{gen:e,data:r,$data:i,schema:n,schemaCode:o,it:s}=t;if(!i&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=s.opts.loopEnum,u,l=()=>u??(u=(0,she.useFunc)(e,ahe.default)),c;if(a||i)c=e.let("valid"),t.block$data(c,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=e.const("vSchema",o);c=(0,vp.or)(...n.map((m,g)=>p(f,g)))}t.pass(c);function d(){e.assign(c,!1),e.forOf("v",o,f=>e.if((0,vp._)`${l()}(${r}, ${f})`,()=>e.assign(c,!0).break()))}function p(f,m){let g=n[m];return typeof g=="object"&&g!==null?(0,vp._)`${l()}(${r}, ${f}[${m}])`:(0,vp._)`${r} === ${g}`}}};EO.default=lhe});var VF=L(PO=>{"use strict";Object.defineProperty(PO,"__esModule",{value:!0});var che=zF(),dhe=NF(),fhe=RF(),phe=AF(),mhe=DF(),hhe=UF(),ghe=MF(),yhe=LF(),vhe=qF(),_he=FF(),bhe=[che.default,dhe.default,fhe.default,phe.default,mhe.default,hhe.default,ghe.default,yhe.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},vhe.default,_he.default];PO.default=bhe});var OO=L(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});_p.validateAdditionalItems=void 0;var Oa=He(),TO=gt(),whe={message:({params:{len:t}})=>(0,Oa.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Oa._)`{limit: ${t}}`},She={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:whe,code(t){let{parentSchema:e,it:r}=t,{items:i}=e;if(!Array.isArray(i)){(0,TO.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}WF(t,i)}};function WF(t,e){let{gen:r,schema:i,data:n,keyword:o,it:s}=t;s.items=!0;let a=r.const("len",(0,Oa._)`${n}.length`);if(i===!1)t.setParams({len:e.length}),t.pass((0,Oa._)`${a} <= ${e.length}`);else if(typeof i=="object"&&!(0,TO.alwaysValidSchema)(s,i)){let l=r.var("valid",(0,Oa._)`${a} <= ${e.length}`);r.if((0,Oa.not)(l),()=>u(l)),t.ok(l)}function u(l){r.forRange("i",e.length,a,c=>{t.subschema({keyword:o,dataProp:c,dataPropType:TO.Type.Num},l),s.allErrors||r.if((0,Oa.not)(l),()=>r.break())})}}_p.validateAdditionalItems=WF;_p.default=She});var zO=L(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});bp.validateTuple=void 0;var GF=He(),vv=gt(),khe=si(),xhe={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return BF(t,"additionalItems",e);r.items=!0,!(0,vv.alwaysValidSchema)(r,e)&&t.ok((0,khe.validateArray)(t))}};function BF(t,e,r=t.schema){let{gen:i,parentSchema:n,data:o,keyword:s,it:a}=t;c(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=vv.mergeEvaluated.items(i,r.length,a.items));let u=i.name("valid"),l=i.const("len",(0,GF._)`${o}.length`);r.forEach((d,p)=>{(0,vv.alwaysValidSchema)(a,d)||(i.if((0,GF._)`${l} > ${p}`,()=>t.subschema({keyword:s,schemaProp:p,dataProp:p},u)),t.ok(u))});function c(d){let{opts:p,errSchemaPath:f}=a,m=r.length,g=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!g){let v=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,vv.checkStrictMode)(a,v,p.strictTuples)}}}bp.validateTuple=BF;bp.default=xhe});var KF=L(NO=>{"use strict";Object.defineProperty(NO,"__esModule",{value:!0});var $he=zO(),Ihe={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,$he.validateTuple)(t,"items")};NO.default=Ihe});var JF=L(jO=>{"use strict";Object.defineProperty(jO,"__esModule",{value:!0});var HF=He(),Ehe=gt(),Phe=si(),The=OO(),Ohe={message:({params:{len:t}})=>(0,HF.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,HF._)`{limit: ${t}}`},zhe={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Ohe,code(t){let{schema:e,parentSchema:r,it:i}=t,{prefixItems:n}=r;i.items=!0,!(0,Ehe.alwaysValidSchema)(i,e)&&(n?(0,The.validateAdditionalItems)(t,n):t.ok((0,Phe.validateArray)(t)))}};jO.default=zhe});var YF=L(CO=>{"use strict";Object.defineProperty(CO,"__esModule",{value:!0});var ui=He(),_v=gt(),Nhe={message:({params:{min:t,max:e}})=>e===void 0?(0,ui.str)`must contain at least ${t} valid item(s)`:(0,ui.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,ui._)`{minContains: ${t}}`:(0,ui._)`{minContains: ${t}, maxContains: ${e}}`},jhe={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Nhe,code(t){let{gen:e,schema:r,parentSchema:i,data:n,it:o}=t,s,a,{minContains:u,maxContains:l}=i;o.opts.next?(s=u===void 0?1:u,a=l):s=1;let c=e.const("len",(0,ui._)`${n}.length`);if(t.setParams({min:s,max:a}),a===void 0&&s===0){(0,_v.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,_v.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,_v.alwaysValidSchema)(o,r)){let g=(0,ui._)`${c} >= ${s}`;a!==void 0&&(g=(0,ui._)`${g} && ${c} <= ${a}`),t.pass(g);return}o.items=!0;let d=e.name("valid");a===void 0&&s===1?f(d,()=>e.if(d,()=>e.break())):s===0?(e.let(d,!0),a!==void 0&&e.if((0,ui._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let g=e.name("_valid"),v=e.let("count",0);f(g,()=>e.if(g,()=>m(v)))}function f(g,v){e.forRange("i",0,c,h=>{t.subschema({keyword:"contains",dataProp:h,dataPropType:_v.Type.Num,compositeRule:!0},g),v()})}function m(g){e.code((0,ui._)`${g}++`),a===void 0?e.if((0,ui._)`${g} >= ${s}`,()=>e.assign(d,!0).break()):(e.if((0,ui._)`${g} > ${a}`,()=>e.assign(d,!1).break()),s===1?e.assign(d,!0):e.if((0,ui._)`${g} >= ${s}`,()=>e.assign(d,!0)))}}};CO.default=jhe});var e9=L(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});Yi.validateSchemaDeps=Yi.validatePropertyDeps=Yi.error=void 0;var RO=He(),Che=gt(),wp=si();Yi.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let i=e===1?"property":"properties";return(0,RO.str)`must have ${i} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:i}})=>(0,RO._)`{property: ${t},
238
- missingProperty: ${i},
239
- depsCount: ${e},
240
- deps: ${r}}`};var Rhe={keyword:"dependencies",type:"object",schemaType:"object",error:Yi.error,code(t){let[e,r]=Ahe(t);QF(t,e),XF(t,r)}};function Ahe({schema:t}){let e={},r={};for(let i in t){if(i==="__proto__")continue;let n=Array.isArray(t[i])?e:r;n[i]=t[i]}return[e,r]}function QF(t,e=t.schema){let{gen:r,data:i,it:n}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let u=(0,wp.propertyInData)(r,i,s,n.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(u,()=>{for(let l of a)(0,wp.checkReportMissingProp)(t,l)}):(r.if((0,RO._)`${u} && (${(0,wp.checkMissingProp)(t,a,o)})`),(0,wp.reportMissingProp)(t,o),r.else())}}Yi.validatePropertyDeps=QF;function XF(t,e=t.schema){let{gen:r,data:i,keyword:n,it:o}=t,s=r.name("valid");for(let a in e)(0,Che.alwaysValidSchema)(o,e[a])||(r.if((0,wp.propertyInData)(r,i,a,o.opts.ownProperties),()=>{let u=t.subschema({keyword:n,schemaProp:a},s);t.mergeValidEvaluated(u,s)},()=>r.var(s,!0)),t.ok(s))}Yi.validateSchemaDeps=XF;Yi.default=Rhe});var r9=L(AO=>{"use strict";Object.defineProperty(AO,"__esModule",{value:!0});var t9=He(),Dhe=gt(),Uhe={message:"property name must be valid",params:({params:t})=>(0,t9._)`{propertyName: ${t.propertyName}}`},Mhe={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Uhe,code(t){let{gen:e,schema:r,data:i,it:n}=t;if((0,Dhe.alwaysValidSchema)(n,r))return;let o=e.name("valid");e.forIn("key",i,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},o),e.if((0,t9.not)(o),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(o)}};AO.default=Mhe});var UO=L(DO=>{"use strict";Object.defineProperty(DO,"__esModule",{value:!0});var bv=si(),zi=He(),Zhe=$o(),wv=gt(),Lhe={message:"must NOT have additional properties",params:({params:t})=>(0,zi._)`{additionalProperty: ${t.additionalProperty}}`},qhe={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Lhe,code(t){let{gen:e,schema:r,parentSchema:i,data:n,errsCount:o,it:s}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:u}=s;if(s.props=!0,u.removeAdditional!=="all"&&(0,wv.alwaysValidSchema)(s,r))return;let l=(0,bv.allSchemaProperties)(i.properties),c=(0,bv.allSchemaProperties)(i.patternProperties);d(),t.ok((0,zi._)`${o} === ${Zhe.default.errors}`);function d(){e.forIn("key",n,v=>{!l.length&&!c.length?m(v):e.if(p(v),()=>m(v))})}function p(v){let h;if(l.length>8){let y=(0,wv.schemaRefOrVal)(s,i.properties,"properties");h=(0,bv.isOwnProperty)(e,y,v)}else l.length?h=(0,zi.or)(...l.map(y=>(0,zi._)`${v} === ${y}`)):h=zi.nil;return c.length&&(h=(0,zi.or)(h,...c.map(y=>(0,zi._)`${(0,bv.usePattern)(t,y)}.test(${v})`))),(0,zi.not)(h)}function f(v){e.code((0,zi._)`delete ${n}[${v}]`)}function m(v){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){f(v);return}if(r===!1){t.setParams({additionalProperty:v}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,wv.alwaysValidSchema)(s,r)){let h=e.name("valid");u.removeAdditional==="failing"?(g(v,h,!1),e.if((0,zi.not)(h),()=>{t.reset(),f(v)})):(g(v,h),a||e.if((0,zi.not)(h),()=>e.break()))}}function g(v,h,y){let _={keyword:"additionalProperties",dataProp:v,dataPropType:wv.Type.Str};y===!1&&Object.assign(_,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(_,h)}}};DO.default=qhe});var o9=L(ZO=>{"use strict";Object.defineProperty(ZO,"__esModule",{value:!0});var Fhe=up(),n9=si(),MO=gt(),i9=UO(),Vhe={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:i,data:n,it:o}=t;o.opts.removeAdditional==="all"&&i.additionalProperties===void 0&&i9.default.code(new Fhe.KeywordCxt(o,i9.default,"additionalProperties"));let s=(0,n9.allSchemaProperties)(r);for(let d of s)o.definedProperties.add(d);o.opts.unevaluated&&s.length&&o.props!==!0&&(o.props=MO.mergeEvaluated.props(e,(0,MO.toHash)(s),o.props));let a=s.filter(d=>!(0,MO.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let u=e.name("valid");for(let d of a)l(d)?c(d):(e.if((0,n9.propertyInData)(e,n,d,o.opts.ownProperties)),c(d),o.allErrors||e.else().var(u,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(u);function l(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function c(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},u)}}};ZO.default=Vhe});var l9=L(LO=>{"use strict";Object.defineProperty(LO,"__esModule",{value:!0});var s9=si(),Sv=He(),a9=gt(),u9=gt(),Whe={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:i,parentSchema:n,it:o}=t,{opts:s}=o,a=(0,s9.allSchemaProperties)(r),u=a.filter(g=>(0,a9.alwaysValidSchema)(o,r[g]));if(a.length===0||u.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let l=s.strictSchema&&!s.allowMatchingProperties&&n.properties,c=e.name("valid");o.props!==!0&&!(o.props instanceof Sv.Name)&&(o.props=(0,u9.evaluatedPropsToName)(e,o.props));let{props:d}=o;p();function p(){for(let g of a)l&&f(g),o.allErrors?m(g):(e.var(c,!0),m(g),e.if(c))}function f(g){for(let v in l)new RegExp(g).test(v)&&(0,a9.checkStrictMode)(o,`property ${v} matches pattern ${g} (use allowMatchingProperties)`)}function m(g){e.forIn("key",i,v=>{e.if((0,Sv._)`${(0,s9.usePattern)(t,g)}.test(${v})`,()=>{let h=u.includes(g);h||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:v,dataPropType:u9.Type.Str},c),o.opts.unevaluated&&d!==!0?e.assign((0,Sv._)`${d}[${v}]`,!0):!h&&!o.allErrors&&e.if((0,Sv.not)(c),()=>e.break())})})}}};LO.default=Whe});var c9=L(qO=>{"use strict";Object.defineProperty(qO,"__esModule",{value:!0});var Ghe=gt(),Bhe={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:i}=t;if((0,Ghe.alwaysValidSchema)(i,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};qO.default=Bhe});var d9=L(FO=>{"use strict";Object.defineProperty(FO,"__esModule",{value:!0});var Khe=si(),Hhe={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Khe.validateUnion,error:{message:"must match a schema in anyOf"}};FO.default=Hhe});var f9=L(VO=>{"use strict";Object.defineProperty(VO,"__esModule",{value:!0});var kv=He(),Jhe=gt(),Yhe={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,kv._)`{passingSchemas: ${t.passing}}`},Qhe={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Yhe,code(t){let{gen:e,schema:r,parentSchema:i,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=r,s=e.let("valid",!1),a=e.let("passing",null),u=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(s,()=>t.reset(),()=>t.error(!0));function l(){o.forEach((c,d)=>{let p;(0,Jhe.alwaysValidSchema)(n,c)?e.var(u,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},u),d>0&&e.if((0,kv._)`${u} && ${s}`).assign(s,!1).assign(a,(0,kv._)`[${a}, ${d}]`).else(),e.if(u,()=>{e.assign(s,!0),e.assign(a,d),p&&t.mergeEvaluated(p,kv.Name)})})}}};VO.default=Qhe});var p9=L(WO=>{"use strict";Object.defineProperty(WO,"__esModule",{value:!0});var Xhe=gt(),ege={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((o,s)=>{if((0,Xhe.alwaysValidSchema)(i,o))return;let a=t.subschema({keyword:"allOf",schemaProp:s},n);t.ok(n),t.mergeEvaluated(a)})}};WO.default=ege});var g9=L(GO=>{"use strict";Object.defineProperty(GO,"__esModule",{value:!0});var xv=He(),h9=gt(),tge={message:({params:t})=>(0,xv.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,xv._)`{failingKeyword: ${t.ifClause}}`},rge={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:tge,code(t){let{gen:e,parentSchema:r,it:i}=t;r.then===void 0&&r.else===void 0&&(0,h9.checkStrictMode)(i,'"if" without "then" and "else" is ignored');let n=m9(i,"then"),o=m9(i,"else");if(!n&&!o)return;let s=e.let("valid",!0),a=e.name("_valid");if(u(),t.reset(),n&&o){let c=e.let("ifClause");t.setParams({ifClause:c}),e.if(a,l("then",c),l("else",c))}else n?e.if(a,l("then")):e.if((0,xv.not)(a),l("else"));t.pass(s,()=>t.error(!0));function u(){let c=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(c)}function l(c,d){return()=>{let p=t.subschema({keyword:c},a);e.assign(s,a),t.mergeValidEvaluated(p,s),d?e.assign(d,(0,xv._)`${c}`):t.setParams({ifClause:c})}}}};function m9(t,e){let r=t.schema[e];return r!==void 0&&!(0,h9.alwaysValidSchema)(t,r)}GO.default=rge});var y9=L(BO=>{"use strict";Object.defineProperty(BO,"__esModule",{value:!0});var nge=gt(),ige={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,nge.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};BO.default=ige});var v9=L(KO=>{"use strict";Object.defineProperty(KO,"__esModule",{value:!0});var oge=OO(),sge=KF(),age=zO(),uge=JF(),lge=YF(),cge=e9(),dge=r9(),fge=UO(),pge=o9(),mge=l9(),hge=c9(),gge=d9(),yge=f9(),vge=p9(),_ge=g9(),bge=y9();function wge(t=!1){let e=[hge.default,gge.default,yge.default,vge.default,_ge.default,bge.default,dge.default,fge.default,cge.default,pge.default,mge.default];return t?e.push(sge.default,uge.default):e.push(oge.default,age.default),e.push(lge.default),e}KO.default=wge});var _9=L(HO=>{"use strict";Object.defineProperty(HO,"__esModule",{value:!0});var or=He(),Sge={message:({schemaCode:t})=>(0,or.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,or._)`{format: ${t}}`},kge={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Sge,code(t,e){let{gen:r,data:i,$data:n,schema:o,schemaCode:s,it:a}=t,{opts:u,errSchemaPath:l,schemaEnv:c,self:d}=a;if(!u.validateFormats)return;n?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:u.code.formats}),g=r.const("fDef",(0,or._)`${m}[${s}]`),v=r.let("fType"),h=r.let("format");r.if((0,or._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(v,(0,or._)`${g}.type || "string"`).assign(h,(0,or._)`${g}.validate`),()=>r.assign(v,(0,or._)`"string"`).assign(h,g)),t.fail$data((0,or.or)(y(),_()));function y(){return u.strictSchema===!1?or.nil:(0,or._)`${s} && !${h}`}function _(){let b=c.$async?(0,or._)`(${g}.async ? await ${h}(${i}) : ${h}(${i}))`:(0,or._)`${h}(${i})`,w=(0,or._)`(typeof ${h} == "function" ? ${b} : ${h}.test(${i}))`;return(0,or._)`${h} && ${h} !== true && ${v} === ${e} && !${w}`}}function f(){let m=d.formats[o];if(!m){y();return}if(m===!0)return;let[g,v,h]=_(m);g===e&&t.pass(b());function y(){if(u.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${o}" ignored in schema at path "${l}"`}}function _(w){let S=w instanceof RegExp?(0,or.regexpCode)(w):u.code.formats?(0,or._)`${u.code.formats}${(0,or.getProperty)(o)}`:void 0,k=r.scopeValue("formats",{key:o,ref:w,code:S});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,or._)`${k}.validate`]:["string",w,k]}function b(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!c.$async)throw new Error("async format in sync schema");return(0,or._)`await ${h}(${i})`}return typeof v=="function"?(0,or._)`${h}(${i})`:(0,or._)`${h}.test(${i})`}}}};HO.default=kge});var b9=L(JO=>{"use strict";Object.defineProperty(JO,"__esModule",{value:!0});var xge=_9(),$ge=[xge.default];JO.default=$ge});var w9=L(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});zl.contentVocabulary=zl.metadataVocabulary=void 0;zl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];zl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var k9=L(YO=>{"use strict";Object.defineProperty(YO,"__esModule",{value:!0});var Ige=OF(),Ege=VF(),Pge=v9(),Tge=b9(),S9=w9(),Oge=[Ige.default,Ege.default,(0,Pge.default)(),Tge.default,S9.metadataVocabulary,S9.contentVocabulary];YO.default=Oge});var $9=L($v=>{"use strict";Object.defineProperty($v,"__esModule",{value:!0});$v.DiscrError=void 0;var x9;(function(t){t.Tag="tag",t.Mapping="mapping"})(x9||($v.DiscrError=x9={}))});var E9=L(XO=>{"use strict";Object.defineProperty(XO,"__esModule",{value:!0});var Nl=He(),QO=$9(),I9=dv(),zge=lp(),Nge=gt(),jge={message:({params:{discrError:t,tagName:e}})=>t===QO.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Nl._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Cge={keyword:"discriminator",type:"object",schemaType:"object",error:jge,code(t){let{gen:e,data:r,schema:i,parentSchema:n,it:o}=t,{oneOf:s}=n;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=i.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(i.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let u=e.let("valid",!1),l=e.const("tag",(0,Nl._)`${r}${(0,Nl.getProperty)(a)}`);e.if((0,Nl._)`typeof ${l} == "string"`,()=>c(),()=>t.error(!1,{discrError:QO.DiscrError.Tag,tag:l,tagName:a})),t.ok(u);function c(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,Nl._)`${l} === ${m}`),e.assign(u,d(f[m]));e.else(),t.error(!1,{discrError:QO.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(g,Nl.Name),m}function p(){var f;let m={},g=h(n),v=!0;for(let b=0;b<s.length;b++){let w=s[b];if(w?.$ref&&!(0,Nge.schemaHasRulesButRef)(w,o.self.RULES)){let k=w.$ref;if(w=I9.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,k),w instanceof I9.SchemaEnv&&(w=w.schema),w===void 0)throw new zge.default(o.opts.uriResolver,o.baseId,k)}let S=(f=w?.properties)===null||f===void 0?void 0:f[a];if(typeof S!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);v=v&&(g||h(w)),y(S,b)}if(!v)throw new Error(`discriminator: "${a}" must be required`);return m;function h({required:b}){return Array.isArray(b)&&b.includes(a)}function y(b,w){if(b.const)_(b.const,w);else if(b.enum)for(let S of b.enum)_(S,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function _(b,w){if(typeof b!="string"||b in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[b]=w}}}};XO.default=Cge});var P9=L((m1e,Rge)=>{Rge.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var O9=L((Kt,ez)=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.MissingRefError=Kt.ValidationError=Kt.CodeGen=Kt.Name=Kt.nil=Kt.stringify=Kt.str=Kt._=Kt.KeywordCxt=Kt.Ajv=void 0;var Age=xF(),Dge=k9(),Uge=E9(),T9=P9(),Mge=["/properties"],Iv="http://json-schema.org/draft-07/schema",jl=class extends Age.default{_addVocabularies(){super._addVocabularies(),Dge.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Uge.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(T9,Mge):T9;this.addMetaSchema(e,Iv,!1),this.refs["http://json-schema.org/schema"]=Iv}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Iv)?Iv:void 0)}};Kt.Ajv=jl;ez.exports=Kt=jl;ez.exports.Ajv=jl;Object.defineProperty(Kt,"__esModule",{value:!0});Kt.default=jl;var Zge=up();Object.defineProperty(Kt,"KeywordCxt",{enumerable:!0,get:function(){return Zge.KeywordCxt}});var Cl=He();Object.defineProperty(Kt,"_",{enumerable:!0,get:function(){return Cl._}});Object.defineProperty(Kt,"str",{enumerable:!0,get:function(){return Cl.str}});Object.defineProperty(Kt,"stringify",{enumerable:!0,get:function(){return Cl.stringify}});Object.defineProperty(Kt,"nil",{enumerable:!0,get:function(){return Cl.nil}});Object.defineProperty(Kt,"Name",{enumerable:!0,get:function(){return Cl.Name}});Object.defineProperty(Kt,"CodeGen",{enumerable:!0,get:function(){return Cl.CodeGen}});var Lge=lv();Object.defineProperty(Kt,"ValidationError",{enumerable:!0,get:function(){return Lge.default}});var qge=lp();Object.defineProperty(Kt,"MissingRefError",{enumerable:!0,get:function(){return qge.default}})});var z9=L(Rl=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});Rl.formatLimitDefinition=void 0;var Fge=O9(),Ni=He(),ms=Ni.operators,Ev={formatMaximum:{okStr:"<=",ok:ms.LTE,fail:ms.GT},formatMinimum:{okStr:">=",ok:ms.GTE,fail:ms.LT},formatExclusiveMaximum:{okStr:"<",ok:ms.LT,fail:ms.GTE},formatExclusiveMinimum:{okStr:">",ok:ms.GT,fail:ms.LTE}},Vge={message:({keyword:t,schemaCode:e})=>(0,Ni.str)`should be ${Ev[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ni._)`{comparison: ${Ev[t].okStr}, limit: ${e}}`};Rl.formatLimitDefinition={keyword:Object.keys(Ev),type:"string",schemaType:"string",$data:!0,error:Vge,code(t){let{gen:e,data:r,schemaCode:i,keyword:n,it:o}=t,{opts:s,self:a}=o;if(!s.validateFormats)return;let u=new Fge.KeywordCxt(o,a.RULES.all.format.definition,"format");u.$data?l():c();function l(){let p=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),f=e.const("fmt",(0,Ni._)`${p}[${u.schemaCode}]`);t.fail$data((0,Ni.or)((0,Ni._)`typeof ${f} != "object"`,(0,Ni._)`${f} instanceof RegExp`,(0,Ni._)`typeof ${f}.compare != "function"`,d(f)))}function c(){let p=u.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let m=e.scopeValue("formats",{key:p,ref:f,code:s.code.formats?(0,Ni._)`${s.code.formats}${(0,Ni.getProperty)(p)}`:void 0});t.fail$data(d(m))}function d(p){return(0,Ni._)`${p}.compare(${r}, ${i}) ${Ev[n].fail} 0`}},dependencies:["format"]};var Wge=t=>(t.addKeyword(Rl.formatLimitDefinition),t);Rl.default=Wge});var R9=L((Sp,C9)=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});var Al=gq(),Gge=z9(),tz=He(),N9=new tz.Name("fullFormats"),Bge=new tz.Name("fastFormats"),rz=(t,e={keywords:!0})=>{if(Array.isArray(e))return j9(t,e,Al.fullFormats,N9),t;let[r,i]=e.mode==="fast"?[Al.fastFormats,Bge]:[Al.fullFormats,N9],n=e.formats||Al.formatNames;return j9(t,n,r,i),e.keywords&&(0,Gge.default)(t),t};rz.get=(t,e="full")=>{let i=(e==="fast"?Al.fastFormats:Al.fullFormats)[t];if(!i)throw new Error(`Unknown format "${t}"`);return i};function j9(t,e,r,i){var n,o;(n=(o=t.opts.code).formats)!==null&&n!==void 0||(o.formats=(0,tz._)`require("ajv-formats/dist/formats").${i}`);for(let s of e)t.addFormat(s,r[s])}C9.exports=Sp=rz;Object.defineProperty(Sp,"__esModule",{value:!0});Sp.default=rz});function Kge(){let t=new A9.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,D9.default)(t),t}var A9,D9,Pv,U9=N(()=>{A9=Hv(uq(),1),D9=Hv(R9(),1);Pv=class{constructor(e){this._ajv=e??Kge()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return i=>r(i)?{valid:!0,data:i,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}}});var Tv,M9=N(()=>{_f();Tv=class{constructor(e){this._client=e}async*callToolStream(e,r=il,i){let n=this._client,o={...i,task:i?.task??(n.isToolTask(e.name)?{}:void 0)},s=n.requestStream({method:"tools/call",params:e},r,o),a=n.getToolOutputValidator(e.name);for await(let u of s){if(u.type==="result"&&a){let l=u.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new xe(Ce.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let c=a(l.structuredContent);if(!c.valid){yield{type:"error",error:new xe(Ce.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)};return}}catch(c){if(c instanceof xe){yield{type:"error",error:c};return}yield{type:"error",error:new xe(Ce.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)};return}}yield u}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,i){return this._client.getTaskResult({taskId:e},r,i)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,i){return this._client.requestStream(e,r,i)}}});function Z9(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function L9(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var q9=N(()=>{});function Ov(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,i=t.properties;for(let n of Object.keys(i)){let o=i[n];r[n]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(r[n]=o.default),r[n]!==void 0&&Ov(o,r[n])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)typeof r!="boolean"&&Ov(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)typeof r!="boolean"&&Ov(r,e)}}function Hge(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var zv,F9=N(()=>{AL();_f();U9();ny();M9();q9();zv=class extends gy{constructor(e,r){super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new Pv,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",$E,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",kE,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",gE,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Tv(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=RL(this._capabilities,e)}setRequestHandler(e,r){let n=ry(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let o;if(tl(n)){let a=n;o=a._zod?.def?.value??a.value}else{let a=n;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");let s=o;if(s==="elicitation/create"){let a=async(u,l)=>{let c=ki(TE,u);if(!c.success){let y=c.error instanceof Error?c.error.message:String(c.error);throw new xe(Ce.InvalidParams,`Invalid elicitation request: ${y}`)}let{params:d}=c.data;d.mode=d.mode??"form";let{supportsFormMode:p,supportsUrlMode:f}=Hge(this._capabilities.elicitation);if(d.mode==="form"&&!p)throw new xe(Ce.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new xe(Ce.InvalidParams,"Client does not support URL-mode elicitation requests");let m=await Promise.resolve(r(u,l));if(d.task){let y=ki(ca,m);if(!y.success){let _=y.error instanceof Error?y.error.message:String(y.error);throw new xe(Ce.InvalidParams,`Invalid task creation result: ${_}`)}return y.data}let g=ki(OE,m);if(!g.success){let y=g.error instanceof Error?g.error.message:String(g.error);throw new xe(Ce.InvalidParams,`Invalid elicitation result: ${y}`)}let v=g.data,h=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&v.action==="accept"&&v.content&&h&&this._capabilities.elicitation?.form?.applyDefaults)try{Ov(h,v.content)}catch{}return v};return super.setRequestHandler(e,a)}if(s==="sampling/createMessage"){let a=async(u,l)=>{let c=ki(IE,u);if(!c.success){let v=c.error instanceof Error?c.error.message:String(c.error);throw new xe(Ce.InvalidParams,`Invalid sampling request: ${v}`)}let{params:d}=c.data,p=await Promise.resolve(r(u,l));if(d.task){let v=ki(ca,p);if(!v.success){let h=v.error instanceof Error?v.error.message:String(v.error);throw new xe(Ce.InvalidParams,`Invalid task creation result: ${h}`)}return v.data}let m=d.tools||d.toolChoice?PE:EE,g=ki(m,p);if(!g.success){let v=g.error instanceof Error?g.error.message:String(g.error);throw new xe(Ce.InvalidParams,`Invalid sampling result: ${v}`)}return g.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapability(e,r){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let i=await this.request({method:"initialize",params:{protocolVersion:oE,capabilities:this._capabilities,clientInfo:this._clientInfo}},cE,r);if(i===void 0)throw new Error(`Server sent invalid initialize result: ${i}`);if(!mL.includes(i.protocolVersion))throw new Error(`Server's protocol version is not supported: ${i.protocolVersion}`);this._serverCapabilities=i.capabilities,this._serverVersion=i.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(i.protocolVersion),this._instructions=i.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(i){throw this.close(),i}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){Z9(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&L9(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},la,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},zE,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},la,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},SE,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},yE,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},fE,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},pE,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},hE,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},la,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},la,r)}async callTool(e,r=il,i){if(this.isToolTaskRequired(e.name))throw new xe(Ce.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let n=await this.request({method:"tools/call",params:e},r,i),o=this.getToolOutputValidator(e.name);if(o){if(!n.structuredContent&&!n.isError)throw new xe(Ce.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{let s=o(n.structuredContent);if(!s.valid)throw new xe(Ce.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){throw s instanceof xe?s:new xe(Ce.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return n}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of e){if(r.outputSchema){let n=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}let i=r.execution?.taskSupport;(i==="required"||i==="optional")&&this._cachedKnownTaskTools.add(r.name),i==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let i=await this.request({method:"tools/list",params:e},xE,r);return this.cacheToolMetadata(i.tools),i}_setupListChangedHandler(e,r,i,n){let o=OL.safeParse(i);if(!o.success)throw new Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof i.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:a}=o.data,{onChanged:u}=i,l=async()=>{if(!s){u(null,null);return}try{let d=await n();u(null,d)}catch(d){let p=d instanceof Error?d:new Error(String(d));u(p,null)}},c=()=>{if(a){let d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);let p=setTimeout(l,a);this._listChangedDebounceTimers.set(e,p)}else l()};this.setNotificationHandler(r,c)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}});var K9=L((E1e,B9)=>{B9.exports=G9;G9.sync=Yge;var V9=Qi("fs");function Jge(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var i=0;i<r.length;i++){var n=r[i].toLowerCase();if(n&&t.substr(-n.length).toLowerCase()===n)return!0}return!1}function W9(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Jge(e,r)}function G9(t,e,r){V9.stat(t,function(i,n){r(i,i?!1:W9(n,t,e))})}function Yge(t,e){return W9(V9.statSync(t),t,e)}});var X9=L((P1e,Q9)=>{Q9.exports=J9;J9.sync=Qge;var H9=Qi("fs");function J9(t,e,r){H9.stat(t,function(i,n){r(i,i?!1:Y9(n,e))})}function Qge(t,e){return Y9(H9.statSync(t),e)}function Y9(t,e){return t.isFile()&&Xge(t,e)}function Xge(t,e){var r=t.mode,i=t.uid,n=t.gid,o=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),s=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),l=parseInt("001",8),c=a|u,d=r&l||r&u&&n===s||r&a&&i===o||r&c&&o===0;return d}});var tV=L((O1e,eV)=>{var T1e=Qi("fs"),Nv;process.platform==="win32"||global.TESTING_WINDOWS?Nv=K9():Nv=X9();eV.exports=nz;nz.sync=eye;function nz(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){nz(t,e||{},function(o,s){o?n(o):i(s)})})}Nv(t,e||{},function(i,n){i&&(i.code==="EACCES"||e&&e.ignoreErrors)&&(i=null,n=!1),r(i,n)})}function eye(t,e){try{return Nv.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var uV=L((z1e,aV)=>{var Dl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",rV=Qi("path"),tye=Dl?";":":",nV=tV(),iV=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),oV=(t,e)=>{let r=e.colon||tye,i=t.match(/\//)||Dl&&t.match(/\\/)?[""]:[...Dl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],n=Dl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Dl?n.split(r):[""];return Dl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:i,pathExt:o,pathExtExe:n}},sV=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:i,pathExt:n,pathExtExe:o}=oV(t,e),s=[],a=l=>new Promise((c,d)=>{if(l===i.length)return e.all&&s.length?c(s):d(iV(t));let p=i[l],f=/^".*"$/.test(p)?p.slice(1,-1):p,m=rV.join(f,t),g=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;c(u(g,l,0))}),u=(l,c,d)=>new Promise((p,f)=>{if(d===n.length)return p(a(c+1));let m=n[d];nV(l+m,{pathExt:o},(g,v)=>{if(!g&&v)if(e.all)s.push(l+m);else return p(l+m);return p(u(l,c,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},rye=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:i,pathExtExe:n}=oV(t,e),o=[];for(let s=0;s<r.length;s++){let a=r[s],u=/^".*"$/.test(a)?a.slice(1,-1):a,l=rV.join(u,t),c=!u&&/^\.[\\\/]/.test(t)?t.slice(0,2)+l:l;for(let d=0;d<i.length;d++){let p=c+i[d];try{if(nV.sync(p,{pathExt:n}))if(e.all)o.push(p);else return p}catch{}}}if(e.all&&o.length)return o;if(e.nothrow)return null;throw iV(t)};aV.exports=sV;sV.sync=rye});var cV=L((N1e,iz)=>{"use strict";var lV=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};iz.exports=lV;iz.exports.default=lV});var mV=L((j1e,pV)=>{"use strict";var dV=Qi("path"),nye=uV(),iye=cV();function fV(t,e){let r=t.options.env||process.env,i=process.cwd(),n=t.options.cwd!=null,o=n&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(t.options.cwd)}catch{}let s;try{s=nye.sync(t.command,{path:r[iye({env:r})],pathExt:e?dV.delimiter:void 0})}catch{}finally{o&&process.chdir(i)}return s&&(s=dV.resolve(n?t.options.cwd:"",s)),s}function oye(t){return fV(t)||fV(t,!0)}pV.exports=oye});var hV=L((C1e,sz)=>{"use strict";var oz=/([()\][%!^"`<>&|;, *?])/g;function sye(t){return t=t.replace(oz,"^$1"),t}function aye(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(oz,"^$1"),e&&(t=t.replace(oz,"^$1")),t}sz.exports.command=sye;sz.exports.argument=aye});var yV=L((R1e,gV)=>{"use strict";gV.exports=/^#!(.*)/});var _V=L((A1e,vV)=>{"use strict";var uye=yV();vV.exports=(t="")=>{let e=t.match(uye);if(!e)return null;let[r,i]=e[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var wV=L((D1e,bV)=>{"use strict";var az=Qi("fs"),lye=_V();function cye(t){let r=Buffer.alloc(150),i;try{i=az.openSync(t,"r"),az.readSync(i,r,0,150,0),az.closeSync(i)}catch{}return lye(r.toString())}bV.exports=cye});var $V=L((U1e,xV)=>{"use strict";var dye=Qi("path"),SV=mV(),kV=hV(),fye=wV(),pye=process.platform==="win32",mye=/\.(?:com|exe)$/i,hye=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function gye(t){t.file=SV(t);let e=t.file&&fye(t.file);return e?(t.args.unshift(t.file),t.command=e,SV(t)):t.file}function yye(t){if(!pye)return t;let e=gye(t),r=!mye.test(e);if(t.options.forceShell||r){let i=hye.test(e);t.command=dye.normalize(t.command),t.command=kV.command(t.command),t.args=t.args.map(o=>kV.argument(o,i));let n=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${n}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function vye(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let i={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?i:yye(i)}xV.exports=vye});var PV=L((M1e,EV)=>{"use strict";var uz=process.platform==="win32";function lz(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function _ye(t,e){if(!uz)return;let r=t.emit;t.emit=function(i,n){if(i==="exit"){let o=IV(n,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function IV(t,e){return uz&&t===1&&!e.file?lz(e.original,"spawn"):null}function bye(t,e){return uz&&t===1&&!e.file?lz(e.original,"spawnSync"):null}EV.exports={hookChildProcess:_ye,verifyENOENT:IV,verifyENOENTSync:bye,notFoundError:lz}});var zV=L((Z1e,Ul)=>{"use strict";var TV=Qi("child_process"),cz=$V(),dz=PV();function OV(t,e,r){let i=cz(t,e,r),n=TV.spawn(i.command,i.args,i.options);return dz.hookChildProcess(n,i),n}function wye(t,e,r){let i=cz(t,e,r),n=TV.spawnSync(i.command,i.args,i.options);return n.error=n.error||dz.verifyENOENTSync(n.status,i),n}Ul.exports=OV;Ul.exports.spawn=OV;Ul.exports.sync=wye;Ul.exports._parse=cz;Ul.exports._enoent=dz});function Sye(t){return SL.parse(JSON.parse(t))}function NV(t){return JSON.stringify(t)+`
241
- `}var jv,jV=N(()=>{_f();jv=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
242
- `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Sye(r)}clear(){this._buffer=void 0}}});import fz from"node:process";import{PassThrough as kye}from"node:stream";function $ye(){let t={};for(let e of xye){let r=fz.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}var CV,xye,Cv,RV=N(()=>{CV=Hv(zV(),1);jV();xye=fz.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];Cv=class{constructor(e){this._readBuffer=new jv,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new kye)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{this._process=(0,CV.default)(this._serverParams.command,this._serverParams.args??[],{env:{...$ye(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:fz.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",i=>{r(i),this.onerror?.(i)}),this._process.on("spawn",()=>{e()}),this._process.on("close",i=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",i=>{this.onerror?.(i)}),this._process.stdout?.on("data",i=>{this._readBuffer.append(i),this.processReadBuffer()}),this._process.stdout?.on("error",i=>{this.onerror?.(i)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let r=new Promise(i=>{e.once("close",()=>{i()})});try{e.stdin?.end()}catch{}if(await Promise.race([r,new Promise(i=>setTimeout(i,2e3).unref())]),e.exitCode===null){try{e.kill("SIGTERM")}catch{}await Promise.race([r,new Promise(i=>setTimeout(i,2e3).unref())])}if(e.exitCode===null)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(r=>{if(!this._process?.stdin)throw new Error("Not connected");let i=NV(e);this._process.stdin.write(i)?r():this._process.stdin.once("drain",r)})}}});var kp,pz=N(()=>{F9();RV();Un();kp=class{#e=new Map;async ensureServer(e,r){if(this.#e.has(e))return this.#e.get(e);let{command:i,args:n=[],env:o={}}=r;U.debug(`[MCP] Starting ${e}: ${i} ${n.join(" ")}`);let s=new Cv({command:i,args:n,env:{...process.env,...o}}),a=new zv({name:`zibby-chat-${e}`,version:"1.0.0"},{capabilities:{}});await a.connect(s);let u={client:a,transport:s,serverConfig:r};return this.#e.set(e,u),u}async callTool(e,r,i={}){let n=this.#e.get(e);if(!n)throw new Error(`MCP server "${e}" not running`);U.debug(`[MCP] ${e}.${r}(${JSON.stringify(i).slice(0,200)})`);let o=await n.client.callTool({name:r,arguments:i});return{text:o.content?.filter(a=>a.type==="text").map(a=>a.text).join(`
243
- `)||"",isError:o.isError||!1}}isRunning(e){return this.#e.has(e)}async stopServer(e){let r=this.#e.get(e);if(r){try{await r.client.close()}catch(i){U.debug(`[MCP] Error closing ${e}: ${i.message}`)}this.#e.delete(e)}}async stopAll(){let e=[...this.#e.keys()];await Promise.allSettled(e.map(r=>this.stopServer(r)))}}});import{existsSync as Iye,readFileSync as Eye}from"node:fs";import{join as Pye}from"node:path";import{homedir as Tye}from"node:os";function Oye(){try{let t=Pye(Tye(),".zibby","config.json");return Iye(t)?JSON.parse(Eye(t,"utf-8")):{}}catch{return{}}}function Rv(t){return String(t||"").replace(/\/v1\/?$/,"")}function zye(t,e){let r=process.env.OPENAI_PROXY_URL;if(r)return Rv(r);if(t==="session")return e.proxyUrl?Rv(e.proxyUrl):`${(process.env.ZIBBY_API_URL||"https://api-prod.zibby.app").replace(/\/$/,"")}/openai-proxy`;if(t==="byok"){let i=process.env.OPENAI_BASE_URL;return Rv(i||"https://api.openai.com")}return Rv(r||"")}function mz(){let t=Oye(),e=process.env.ZIBBY_USER_TOKEN||t.sessionToken||null,r=process.env.OPENAI_API_KEY||null,i=(process.env.ASSISTANT_AUTH_MODE||"").trim().toLowerCase(),n=process.env.OPENAI_PROXY_NO_AUTH==="true",o=process.env.OPENAI_PROXY_URL,s="session";i==="byok"||i==="local"||i==="session"?s=i:e?s="session":r?s="byok":o&&n&&(s="local");let a=zye(s,t),u={"Content-Type":"application/json"};if(s==="session"){if(!e)return{ok:!1,mode:s,reason:"missing_session_token"};u.Authorization=`Bearer ${e}`}else if(s==="byok"){if(!r)return{ok:!1,mode:s,reason:"missing_openai_api_key"};u.Authorization=`Bearer ${r}`}else if(s==="local"){if(!a)return{ok:!1,mode:s,reason:"missing_openai_proxy_url"};!n&&r&&(u.Authorization=`Bearer ${r}`)}return a?{ok:!0,mode:s,baseUrl:a,headers:u,tokenPreview:u.Authorization?`***${u.Authorization.slice(-4)}`:"none"}:{ok:!1,mode:s,reason:"missing_base_url"}}var AV=N(()=>{});function Av(t,e){let r=String(t??"");return r.length<=e?r:`${r.slice(0,Math.max(0,e-30))}
244
-
245
- [tool result truncated for size]`}function Nye(t,e){if(typeof t=="string")return Av(t,e);try{return Av(JSON.stringify(t),e)}catch{return Av(String(t),e)}}function DV(t){let e=new Set;for(let n of t)if(n.role==="assistant"&&Array.isArray(n.tool_calls))for(let o of n.tool_calls)e.add(o.id);let r=t.filter(n=>n.role==="tool"?e.has(n.tool_call_id):!0),i=new Set;for(let n of r)n.role==="tool"&&i.add(n.tool_call_id);return r.map(n=>{if(n.role!=="assistant"||!Array.isArray(n.tool_calls)||n.tool_calls.every(u=>i.has(u.id)))return n;let{tool_calls:s,...a}=n;return{...a,content:a.content||""}})}function jye(t){let e=Array.isArray(t?.messages)?t.messages:[],r=e.find(o=>o.role==="system"),i=e.slice(-4).map(o=>({...o,content:Av(o.content,o.role==="tool"?1200:2500)}));i=DV(i);let n={...t,messages:[r,...i].filter(Boolean)};return delete n.tools,n}async function Cye({body:t,streaming:e,auth:r,options:i,fetchCompletion:n,fetchStreamingCompletion:o,onFallbackLog:s}){try{return e?await o(t,r,i):await n(t,r,i)}catch(a){let u=String(a?.message||a||"");if(!/proxy error 413|payload too large/i.test(u))throw a;let l=jye(t);return typeof s=="function"&&s(t,l),{data:e?await o(l,r,i):await n(l,r,i),fallback:l}}}async function UV({body:t,auth:e,options:r,streaming:i,toolContext:n,activeSkills:o,round:s,verbose:a,dependencies:u,config:l={}}){let c=l.maxToolResultChars||3e3,{fetchCompletion:d,fetchStreamingCompletion:p,onFallbackLog:f,hasToolCalls:m,getTextContent:g,parseToolCalls:v,buildAssistantMessage:h,buildToolResultMessage:y,executeTool:_,onToolCallLog:b,injectTools:w}=u;Array.isArray(t?.messages)&&(t.messages=DV(t.messages));let S=await Cye({body:t,streaming:i,auth:e,options:r,fetchCompletion:d,fetchStreamingCompletion:p,onFallbackLog:f}),k=S?.data||S;if(!m(k))return{done:!0,text:g(k),body:S?.fallback||t};let $=v(k),P=S?.fallback||t;P.messages.push(h(k)),a&&typeof b=="function"&&b($);let j=await Promise.all($.map((I,R)=>(typeof r.onToolCall=="function"&&r.onToolCall(I.name,I.args,{round:s,index:R,total:$.length}),_(I,n))));for(let I=0;I<$.length;I++){let q=$[I].name==="get_skill_context"?typeof j[I]=="string"?j[I]:JSON.stringify(j[I]):Nye(j[I],c);P.messages.push(y($[I].id,q))}return typeof r.onToolCall=="function"&&r.onToolCall(null),w(P,o),{done:!1,body:P}}var MV=N(()=>{});function Zl(t){!t||typeof t!="object"||(t.type==="object"&&t.properties&&(t.required=Object.keys(t.properties),t.additionalProperties=!1,Object.values(t.properties).forEach(Zl)),t.type==="array"&&t.items&&Zl(t.items),t.anyOf&&t.anyOf.forEach(Zl),t.oneOf&&t.oneOf.forEach(Zl),t.allOf&&t.allOf.forEach(Zl))}function Dv(t){return Array.isArray(t)?new Set(t.map(e=>String(e||"").trim()).filter(Boolean)):new Set}function Uye(t){return Array.isArray(t)?t.map(e=>String(e||"").trim()).filter(Boolean):[]}var Rye,Aye,hz,ZV,Ml,Dye,Ll,LV=N(()=>{_s();Un();To();QI();pz();Xi();AV();MV();Rye=Tr.ASSISTANT,Aye=15,hz="get_skill_context";ZV={maxBytes:49e3,systemMaxChars:12e3},Ml=()=>process.env.ZIBBY_VERBOSE==="true"||process.env.ZIBBY_DEBUG==="true",Dye=t=>Buffer.byteLength(JSON.stringify(t),"utf8");Ll=class extends Vr{#e;#t;#r=new kp;constructor(e=null){super("assistant","Zibby Assistant",200),e&&typeof e=="object"&&(e.toolProvider||e.completionProvider)?(this.#e=e.toolProvider||new ua,this.#t=e.completionProvider||new el):(this.#e=e||new ua,this.#t=new el)}canHandle(e){return mz().ok}async invoke(e,r={}){let i=r.model&&r.model!=="auto"?r.model:Rye,n=mz();if(!n.ok)throw n.reason==="missing_session_token"?new Error("Login required. Run `zibby login` to authenticate."):n.reason==="missing_openai_api_key"?new Error("Missing OPENAI_API_KEY for BYOK mode."):n.reason==="missing_openai_proxy_url"?new Error("Missing OPENAI_PROXY_URL for local mode."):new Error(`Assistant auth unavailable (${n.reason}).`);let o=r.messages||[{role:"user",content:e}],s=n.baseUrl,a=Ml();if(a?await this.#m(o,i,s,n.tokenPreview||"none"):U.debug(`[Assistant] ${s} | model: ${i} | messages: ${o.length}`),r.schema)return this.#l(i,o,n,r);let u=r.activeSkills||[],l=this.#d(r),c=this.#f(u,l),d=this.#p(c),p=this.#c(r),f={...r,payloadCompaction:p},m={activeSkills:c,options:f,executionRegistry:d,capabilityPolicy:l},g=!!r.stream,v={model:i,messages:[...o],stream:!1};this.#i(v,c,l);for(let h=0;h<Aye;h++){if(r.signal?.aborted)throw new Error("Aborted");let y=await UV({body:v,auth:n,options:f,streaming:g,toolContext:m,activeSkills:c,round:h,verbose:a,dependencies:{fetchCompletion:this.#o.bind(this),fetchStreamingCompletion:this.#u.bind(this),onFallbackLog:(_,b)=>{Ml()&&console.log(`413 fallback: messages ${_.messages.length} -> ${b.messages.length}, bytes=${Dye(b)}`)},hasToolCalls:_=>this.#e.hasToolCalls(_),getTextContent:_=>this.#e.getTextContent(_),parseToolCalls:_=>this.#e.parseToolCalls(_),buildAssistantMessage:_=>this.#e.buildAssistantMessage(_),buildToolResultMessage:(_,b)=>this.#e.buildToolResultMessage(_,b),executeTool:(_,b)=>this.#a(_,b),onToolCallLog:async _=>{let b=(await import("chalk")).default;console.log(b.dim(` ${_.map(w=>`${w.name}(${JSON.stringify(w.args).slice(0,80)})`).join(", ")}`))},injectTools:(_,b)=>this.#i(_,b,l)},config:{maxToolResultChars:r.maxToolResultChars||3e3}});if(y.done)return y.text;v.messages=y.body.messages,y.body.tools?v.tools=y.body.tools:delete v.tools}return"I hit my tool-calling limit for this turn. Please try again."}async cleanup(){await this.#r.stopAll()}#i(e,r,i=null){let n=this.#s(r,i),o=this.#e.formatTools(n);this.#e.injectToolsIntoBody(e,o)}#s(e,r=null){let i=[],n=new Set;for(let o of e){let s=Or(o);if(s?.tools?.length)for(let a of s.tools)this.#n(a.name,r)&&(n.has(a.name)||(n.add(a.name),i.push({name:a.name,description:a.description,parameters:a.parameters||a.input_schema||{type:"object",properties:{}}})))}return!r?.disableSkillContextTool&&this.#n(hz,r)&&i.push({name:hz,description:"Fetch full prompt guidance/instructions for one installed skill on demand. Use this before making complex tool decisions if guidance is needed.",parameters:{type:"object",properties:{skillId:{type:"string",description:"Installed skill id to inspect (e.g. jira, github, runner, chat-memory)"}},required:["skillId"]}}),i}async#a(e,r){let{activeSkills:i,options:n,executionRegistry:o,capabilityPolicy:s}=r;if(!this.#n(e.name,s))return`Tool "${e.name}" blocked by policy`;if(e.name===hz){let l=String(e.args?.skillId||"").trim();if(!l)return JSON.stringify({error:"skillId is required"});if(!i.includes(l))return JSON.stringify({error:`Skill "${l}" is not active`,activeSkills:i});let c=Or(l);if(!c)return JSON.stringify({error:`Skill "${l}" not found`});let d=typeof c.promptFragment=="function"?c.promptFragment():c.promptFragment||"",p=(c.tools||[]).map(m=>m.name),f=JSON.stringify({skillId:l,description:c.description||"",toolNames:p,promptFragment:d||""});return Ml()&&(console.log(`
246
- \u{1F4D6} get_skill_context("${l}") \u2192 ${f.length} chars (fragment: ${d.length} chars)`),console.log(` tools: [${p.join(", ")}]`),console.log(` fragment preview: ${d.slice(0,200).replace(/\n/g,"\\n")}\u2026
247
- `)),f}let a=o?.get(e.name)||null;if(!a)return`Unknown tool: ${e.name}`;let u=Or(a.skillId);if(!u)return`Skill "${a.skillId}" not found for tool "${e.name}"`;if(a.mode==="handler")try{return u.handleToolCall(e.name,e.args,r)}catch(l){return`Error in ${e.name}: ${l.message}`}if(a.mode==="mcp")try{if(!this.#r.isRunning(u.serverName)){let c=u.resolve(n);if(!c)return`Skill "${a.skillId}" is not available (cannot start server)`;await this.#r.ensureServer(u.serverName,c)}let l=await this.#r.callTool(u.serverName,e.name,e.args);return l.text||(l.isError?"Tool call failed":"Done")}catch(l){return`MCP error (${u.serverName}): ${l.message}`}return`Skill "${a.skillId}" owns tool "${e.name}" but has no execution mode`}async#u(e,r,i){return this.#t.fetchStreamingCompletion(e,r,{...i,onBudget:({beforeBytes:n,meta:o})=>{Ml()&&console.log(`payload bytes (stream) before=${n} after=${o.bytes} trimmed=${o.trimmed} messages=${o.messageCount}`)}})}async#o(e,r,i){return this.#t.fetchCompletion(e,r,{...i,onBudget:({beforeBytes:n,meta:o})=>{Ml()&&console.log(`payload bytes before=${n} after=${o.bytes} trimmed=${o.trimmed} messages=${o.messageCount}`)}})}async#l(e,r,i,n){let{zodToJsonSchema:o}=await Promise.resolve().then(()=>(Ro(),ON)),s=typeof n.schema?.parse=="function",a=s?o(n.schema):n.schema;delete a.$schema,Zl(a);let u={model:e,messages:r,stream:!1,response_format:{type:"json_schema",json_schema:{name:"extract",schema:a,strict:!0}}},l=await this.#o(u,i,n),c=this.#e.getTextContent(l),d=JSON.parse(c),p=s?n.schema.parse(d):d;return{raw:c,structured:p}}#c(e={}){let r=e?.config?.agent?.assistant?.payloadCompaction||{};return{maxBytes:Number(r.maxBytes||e.maxPayloadBytes||ZV.maxBytes),systemMaxChars:Number(r.systemMaxChars||ZV.systemMaxChars)}}#d(e={}){let r=e?.config?.agent?.assistant?.toolPolicy||{};return{allowTools:Dv(r.allowTools||e.allowTools),denyTools:Dv(r.denyTools||e.denyTools),denyPrefixes:Uye(r.denyPrefixes||e.denyToolPrefixes),includeSkills:Dv(r.includeSkills||e.includeSkills),excludeSkills:Dv(r.excludeSkills||e.excludeSkills),disableSkillContextTool:!!(r.disableSkillContextTool||e.disableSkillContextTool)}}#f(e,r){let i=r?.includeSkills||new Set,n=r?.excludeSkills||new Set;return i.size===0&&n.size===0?e:e.filter(o=>!(i.size>0&&!i.has(o)||n.has(o)))}#n(e,r){let i=String(e||"").trim();if(!i)return!1;let n=r?.allowTools;if(n&&n.size>0&&!n.has(i))return!1;let o=r?.denyTools;return!(o&&o.has(i)||(r?.denyPrefixes||[]).some(a=>i.startsWith(a)))}#p(e){let r=new Map,i=[];for(let n of e){let o=Or(n);if(!o?.tools?.length)continue;let s=typeof o.handleToolCall=="function"?"handler":o.serverName&&typeof o.resolve=="function"?"mcp":null;if(s)for(let a of o.tools){let u=String(a?.name||"").trim();if(u){if(r.has(u)){i.push({tool:u,winner:r.get(u).skillId,skipped:n});continue}r.set(u,{skillId:n,mode:s})}}}if(i.length>0&&Ml()){let n=i.slice(0,5).map(o=>`${o.tool}:${o.winner}>${o.skipped}`).join(", ");console.log(`tool registry collisions: ${n}${i.length>5?" ...":""}`)}return r}async#m(e,r,i,n){console.log(`
248
- \u25C6 Model: ${r} | proxy: ${i} | token: ${n||"none"}
249
- `);let o=(await import("chalk")).default;console.log(o.bold("Prompt sent to LLM:")),console.log(o.dim("\u2500".repeat(60)));let s=!1;for(let a of e)if(a.role==="system")console.log(o.dim(`[System] ${a.content||""}`));else{s||(console.log(o.dim("\u2500\u2500\u2500 chat history \u2500\u2500\u2500")),s=!0);let u=a.role==="user"?"Human":"AI",l=a.content?.length>200?`${a.content.slice(0,200)}...`:a.content||"";console.log(o.dim(`[${u}] ${l}`))}console.log(o.dim("\u2500".repeat(60)))}}});var yz={};An(yz,{AgentStrategy:()=>Vr,AssistantStrategy:()=>Ll,ClaudeAgentStrategy:()=>Ju,CodexAgentStrategy:()=>Yu,CursorAgentStrategy:()=>du,GeminiAgentStrategy:()=>Qu,getAgentStrategy:()=>gz,invokeAgent:()=>FV});function gz(t={}){let{state:e={},preferredAgent:r=null}=t,i=r||e.agentType||process.env.AGENT_TYPE;if(!i)throw new Error("No agent specified. Set agent.claude, agent.cursor, agent.codex, or agent.gemini in .zibby.config.js");U.debug(`Agent selection: requested=${i}`);let n=qV.find(o=>o.getName()===i);if(!n)throw new Error(`Unknown agent '${i}'. Available: ${qV.map(o=>o.getName()).join(", ")}`);if(U.debug(`Checking if ${i} can handle this environment...`),!n.canHandle(t)){let s={assistant:"Run `zibby login` to authenticate",claude:"Set ANTHROPIC_API_KEY in .env",cursor:"Install cursor-agent CLI or set CURSOR_API_KEY",codex:"Install codex CLI (npm i -g @openai/codex) and set OPENAI_API_KEY in .env",gemini:"Install gemini CLI (npm i -g @google/gemini-cli) and set GEMINI_API_KEY in .env"}[i]||"Check your environment configuration";throw new Error(`Agent '${i}' is not available. ${s}`)}return U.debug(`Using agent: ${n.getName()}`),n}async function FV(t,e={},r={}){try{await import("@zibby/skills")}catch{}let i=gz(e),n=e.state?.config||r.config||{},o=n.models||{},s=r.nodeName&&o[r.nodeName]||null,a=o.default||null,u=i.name,l=n.agent?.[u]?.model||null,c=s||a||l||r.model||null,d={...r,model:c,workspace:e.state?.workspace||r.workspace,schema:r.schema||e.schema,images:r.images||e.images||[],skills:r.skills||e.skills||[],config:n},p=d.skills||[];if(p.length>0&&!r.skipPromptFragments){let{getSkill:m}=await Promise.resolve().then(()=>(Xi(),m_)),g=p.map(v=>{let h=m(v)?.promptFragment;return typeof h=="function"?h():h}).filter(Boolean);g.length>0&&(t+=`
250
-
251
- ${g.join(`
252
-
253
- `)}`)}let f=e.state?._currentNodeConfig?.extraPromptInstructions?.trim();return f&&(t+=`
97
+ ${A}`}let E=this._createGeminiConfigDir(s,m),x=["--output-format","json"];p&&p!=="auto"&&x.push("--model",p);let v=Object.keys(m);if(v.length>0){x.push("--approval-mode","yolo");for(let A of v)x.push("--allowed-mcp-server-names",A);h.info(`[Gemini] Enabling MCP servers: ${v.join(", ")}`)}else o&&o.length>0&&h.warn(`[Gemini] Skills requested but no MCP servers configured: ${o.join(", ")}`);x.push("-p",g);let $={...process.env,GEMINI_CLI_HOME:E};d?($.GEMINI_API_KEY=d,delete $.GOOGLE_API_KEY):f&&($.GOOGLE_API_KEY=f,delete $.GEMINI_API_KEY),h.debug(`[Gemini] Command: gemini ${x.slice(0,8).join(" ")}... (${x.length} total args)`),h.debug(`[Gemini] Config home: ${E}`),h.debug(`[Gemini] GEMINI_CLI_HOME env: ${$.GEMINI_CLI_HOME}`);let T="",I=null;try{T=await new Promise((O,_)=>{let C=To("gemini",x,{cwd:s,env:$,stdio:["ignore","pipe","pipe"]}),R="",L="",U=setTimeout(()=>{try{C.kill("SIGTERM")}catch{}},a);C.stdout.on("data",k=>{R+=k.toString()}),C.stderr.on("data",k=>{L+=k.toString()}),C.on("error",k=>{clearTimeout(U),_(k)}),C.on("close",k=>{if(clearTimeout(U),k===0)return O(R.trim());_(new Error(`gemini failed with code ${k}: ${(L||R).trim()}`))})})}catch(A){I=A}finally{try{$o(E,{recursive:!0,force:!0})}catch{}}let P=Oo(T).trim();if(!n){if(I)throw I;return P}if(y){let A=ws(y);if(h.info(`[Gemini] Result file: ${A?"present":"missing"} at ${y}`),A)try{let O=bs(y,"utf-8").trim(),_=JSON.parse(O),C=w?n.parse(_):_;return h.info("[Gemini] Structured output recovered from result file"),{raw:P,structured:C}}catch(O){h.warn(`[Gemini] Result file parse/validation failed: ${O.message}`)}else I||h.warn("[Gemini] Result file missing; falling back to stream-parsed JSON")}let N=null;if(n){let A=new te;A.zodSchema=n,A.processChunk(P),A.flush(),N=A.getResult()}if(h.info(`[Gemini] Raw stdout length: ${T.length} chars`),h.info(`[Gemini] Extracted text length: ${P.length} chars`),h.info(`[Gemini] StreamParser result: ${N?"extracted":"null"}`),N||(P.length<2e3?h.info(`[Gemini] Raw text preview:
98
+ ${P}`):h.info(`[Gemini] Raw text preview (first 1000 chars):
99
+ ${P.slice(0,1e3)}`),N=Ao(P)),!N)throw I||(h.error("[Gemini] Failed to extract valid JSON from output"),h.error("\u{1F4A1} Tip: Set strictMode=true in .zibby.config.js for OpenAI proxy fallback"),new Error("Gemini did not return valid JSON for structured output. Enable strictMode for proxy fallback."));let b=w?n.parse(N):N;return{raw:P,structured:b}}_resolveSkillsToMcp(e,t={}){if(!Array.isArray(e)||e.length===0)return{};let r={};for(let s of e){let n=z(s);if(!n||typeof n.resolve!="function")continue;let o=n.resolve(t);if(!o)continue;let c=n.cursorKey||n.serverName||s,l={command:o.command};o.args?.length&&(l.args=o.args),o.env&&Object.keys(o.env).length>0&&(l.env=o.env),o.cwd&&(l.cwd=o.cwd),r[c]=l}return r}_createGeminiConfigDir(e,t){let r=`${Date.now()}-${Math.random().toString(16).slice(2,10)}`,s=fe(e||process.cwd(),".zibby","tmp",`gemini-home-${r}`),n=fe(s,".gemini");_s(n,{recursive:!0});let o=fe(n,"settings.json"),c={},l=fe(process.env.HOME||"",".gemini","settings.json");if(ws(l))try{c=JSON.parse(bs(l,"utf-8"))}catch{c={}}let a={...c,mcpServers:{...c.mcpServers&&typeof c.mcpServers=="object"?c.mcpServers:{},...t||{}}};xs(o,`${JSON.stringify(a,null,2)}
100
+ `,"utf-8");let u=fe(e||process.cwd(),".zibby","tmp","gemini-settings-debug.json");try{xs(u,`${JSON.stringify(a,null,2)}
101
+ `,"utf-8")}catch{}return h.debug(`[Gemini] Created isolated config with ${Object.keys(a.mcpServers||{}).length} MCP servers`),h.debug(`[Gemini] MCP servers: ${JSON.stringify(Object.keys(a.mcpServers||{}),null,2)}`),s}}});var $e,er=M(()=>{$e=class{formatTools(e){throw new Error("formatTools() must be implemented")}hasToolCalls(e){throw new Error("hasToolCalls() must be implemented")}parseToolCalls(e){throw new Error("parseToolCalls() must be implemented")}getTextContent(e){throw new Error("getTextContent() must be implemented")}buildAssistantMessage(e){throw new Error("buildAssistantMessage() must be implemented")}buildToolResultMessage(e,t){throw new Error("buildToolResultMessage() must be implemented")}injectToolsIntoBody(e,t){throw new Error("injectToolsIntoBody() must be implemented")}}});var de,Ts=M(()=>{er();de=class extends $e{formatTools(e){return e.map(t=>({type:"function",function:{name:t.name,description:t.description,parameters:t.parameters||t.input_schema||{type:"object",properties:{}}}}))}hasToolCalls(e){let t=e.choices?.[0]?.message;return!!(t?.tool_calls&&t.tool_calls.length>0)}parseToolCalls(e){return(e.choices?.[0]?.message?.tool_calls||[]).map(r=>({id:r.id,name:r.function.name,args:JSON.parse(r.function.arguments||"{}")}))}getTextContent(e){return e.choices?.[0]?.message?.content||""}buildAssistantMessage(e){return e.choices?.[0]?.message}buildToolResultMessage(e,t){return{role:"tool",tool_call_id:e,content:typeof t=="string"?t:JSON.stringify(t)}}injectToolsIntoBody(e,t){return t.length>0&&(e.tools=t),e}}});var qe,tr=M(()=>{qe=class{async fetchCompletion(e,t,r={}){throw new Error("fetchCompletion() must be implemented")}async fetchStreamingCompletion(e,t,r={}){throw new Error("fetchStreamingCompletion() must be implemented")}}});function wt(i){return Buffer.byteLength(JSON.stringify(i),"utf8")}function _t(i,e){let t=String(i||"");if(t.length<=e)return t;let r=Math.max(0,e-28);return`${t.slice(0,r)}
102
+
103
+ [truncated for size budget]`}function rr(i,e=0){if(!i||typeof i!="object"||e>8)return i;if(Array.isArray(i))return i.map(r=>rr(r,e+1));let t={};for(let[r,s]of Object.entries(i))r==="description"||r==="title"||r==="examples"||r==="default"||(t[r]=rr(s,e+1));return t}function Po(i=[]){return i.map(e=>({...e,function:{...e.function,description:_t(e.function?.description||"",180),parameters:rr(e.function?.parameters||{type:"object",properties:{}})}}))}function vs(i){let e=new Set;for(let s of i)if(s.role==="assistant"&&Array.isArray(s.tool_calls))for(let n of s.tool_calls)e.add(n.id);let t=i.filter(s=>s.role==="tool"?e.has(s.tool_call_id):!0),r=new Set;for(let s of t)s.role==="tool"&&r.add(s.tool_call_id);return t.map(s=>{if(s.role!=="assistant"||!Array.isArray(s.tool_calls)||s.tool_calls.every(l=>r.has(l.id)))return s;let{tool_calls:o,...c}=s;return{...c,content:c.content||""}})}function sr(i,e={}){let t=e.maxBytes||49e3,r=e.systemMaxChars||12e3,s={...i,messages:Array.isArray(i.messages)?[...i.messages]:[],tools:Array.isArray(i.tools)?Po(i.tools):i.tools};s.messages.length>0&&s.messages[0]?.role==="system"&&(s.messages[0]={...s.messages[0],content:_t(s.messages[0].content,r)});let n=!1;for(;wt(s)>t&&s.messages.length>2;)s.messages.splice(1,1),n=!0;if(n&&(s.messages=vs(s.messages)),wt(s)>t&&s.messages.length>0&&(s.messages[0]={...s.messages[0],content:_t(s.messages[0].content,6e3)},n=!0),wt(s)>t){let o=s.messages.find(l=>l.role==="system")||s.messages[0],c=s.messages.slice(-2);s.messages=vs([o,...c].filter(Boolean).map((l,a)=>({...l,content:_t(l.content,a===0?4e3:8e3)}))),n=!0}return{body:s,meta:{bytes:wt(s),trimmed:n,maxBytes:t,messageCount:s.messages.length}}}var $s=M(()=>{});var Is,Ie,As=M(()=>{tr();$s();Is=i=>Buffer.byteLength(JSON.stringify(i),"utf8"),Ie=class extends qe{async fetchCompletion(e,t,r={}){let s=Is(e),{body:n,meta:o}=sr(e,r.payloadCompaction);r.onBudget?.({streaming:!1,beforeBytes:s,meta:o});let c=this.#e(r),l=`${t.baseUrl}${r.chatCompletionsPath||"/v1/chat/completions"}`,a=await fetch(l,{method:"POST",headers:t.headers,body:JSON.stringify(n),signal:c});if(!a.ok){let u=await a.text();throw a.status===401||a.status===403?new Error("Session expired. Run `zibby login` to re-authenticate."):new Error(`Proxy error ${a.status}: ${u}`)}return a.json()}async fetchStreamingCompletion(e,t,r={}){let s={...e,stream:!0},n=Is(s),{body:o,meta:c}=sr(s,r.payloadCompaction);r.onBudget?.({streaming:!0,beforeBytes:n,meta:c});let l=this.#e(r),a=`${t.baseUrl}${r.chatCompletionsPath||"/v1/chat/completions"}`,u=await fetch(a,{method:"POST",headers:t.headers,body:JSON.stringify(o),signal:l});if(!u.ok){let g=await u.text();throw u.status===401||u.status===403?new Error("Session expired. Run `zibby login` to re-authenticate."):new Error(`Proxy error ${u.status}: ${g}`)}let p=u.body.getReader(),d=new TextDecoder,f="",m="",S=new Map;for(;;){let{done:g,value:w}=await p.read();if(g)break;f+=d.decode(w,{stream:!0});let y=f.split(`
104
+ `);f=y.pop();for(let E of y){if(!E.startsWith("data: "))continue;let x=E.slice(6).trim();if(x==="[DONE]")continue;let v;try{v=JSON.parse(x)}catch{continue}let $=v.choices?.[0]?.delta;if($&&($.content&&(m+=$.content,r.onToken&&r.onToken($.content)),$.tool_calls))for(let T of $.tool_calls){let I=T.index??0;S.has(I)||S.set(I,{id:"",name:"",args:""});let P=S.get(I);T.id&&(P.id=T.id),T.function?.name&&(P.name=T.function.name),T.function?.arguments!=null&&(P.args+=T.function.arguments)}}}if(S.size>0){let g=[...S.entries()].sort(([w],[y])=>w-y).map(([,w])=>({id:w.id,type:"function",function:{name:w.name,arguments:w.args}}));return{choices:[{message:{role:"assistant",content:m||null,tool_calls:g}}]}}return{choices:[{message:{role:"assistant",content:m}}]}}#e(e={}){let t=[e.signal,e.timeout?AbortSignal.timeout(e.timeout):null].filter(Boolean);return t.length>1?AbortSignal.any(t):t[0]||void 0}}});var nr=M(()=>{er();Ts();tr();As()});import{Client as Co}from"@modelcontextprotocol/sdk/client/index.js";import{StdioClientTransport as No}from"@modelcontextprotocol/sdk/client/stdio.js";var Xe,or=M(()=>{V();Xe=class{#e=new Map;async ensureServer(e,t){if(this.#e.has(e))return this.#e.get(e);let{command:r,args:s=[],env:n={}}=t;h.debug(`[MCP] Starting ${e}: ${r} ${s.join(" ")}`);let o=new No({command:r,args:s,env:{...process.env,...n}}),c=new Co({name:`zibby-chat-${e}`,version:"1.0.0"},{capabilities:{}});await c.connect(o);let l={client:c,transport:o,serverConfig:t};return this.#e.set(e,l),l}async callTool(e,t,r={}){let s=this.#e.get(e);if(!s)throw new Error(`MCP server "${e}" not running`);h.debug(`[MCP] ${e}.${t}(${JSON.stringify(r).slice(0,200)})`);let n=await s.client.callTool({name:t,arguments:r});return{text:n.content?.filter(c=>c.type==="text").map(c=>c.text).join(`
105
+ `)||"",isError:n.isError||!1}}isRunning(e){return this.#e.has(e)}async stopServer(e){let t=this.#e.get(e);if(t){try{await t.client.close()}catch(r){h.debug(`[MCP] Error closing ${e}: ${r.message}`)}this.#e.delete(e)}}async stopAll(){let e=[...this.#e.keys()];await Promise.allSettled(e.map(t=>this.stopServer(t)))}}});import{existsSync as Ro,readFileSync as ko}from"node:fs";import{join as Mo}from"node:path";import{homedir as Lo}from"node:os";function Do(){try{let i=Mo(Lo(),".zibby","config.json");return Ro(i)?JSON.parse(ko(i,"utf-8")):{}}catch{return{}}}function bt(i){return String(i||"").replace(/\/v1\/?$/,"")}function Bo(i,e){let t=process.env.OPENAI_PROXY_URL;if(t)return bt(t);if(i==="session")return e.proxyUrl?bt(e.proxyUrl):`${(process.env.ZIBBY_API_URL||"https://api-prod.zibby.app").replace(/\/$/,"")}/openai-proxy`;if(i==="byok"){let r=process.env.OPENAI_BASE_URL;return bt(r||"https://api.openai.com")}return bt(t||"")}function ir(){let i=Do(),e=process.env.ZIBBY_USER_TOKEN||i.sessionToken||null,t=process.env.OPENAI_API_KEY||null,r=(process.env.ASSISTANT_AUTH_MODE||"").trim().toLowerCase(),s=process.env.OPENAI_PROXY_NO_AUTH==="true",n=process.env.OPENAI_PROXY_URL,o="session";r==="byok"||r==="local"||r==="session"?o=r:e?o="session":t?o="byok":n&&s&&(o="local");let c=Bo(o,i),l={"Content-Type":"application/json"};if(o==="session"){if(!e)return{ok:!1,mode:o,reason:"missing_session_token"};l.Authorization=`Bearer ${e}`}else if(o==="byok"){if(!t)return{ok:!1,mode:o,reason:"missing_openai_api_key"};l.Authorization=`Bearer ${t}`}else if(o==="local"){if(!c)return{ok:!1,mode:o,reason:"missing_openai_proxy_url"};!s&&t&&(l.Authorization=`Bearer ${t}`)}return c?{ok:!0,mode:o,baseUrl:c,headers:l,tokenPreview:l.Authorization?`***${l.Authorization.slice(-4)}`:"none"}:{ok:!1,mode:o,reason:"missing_base_url"}}var Os=M(()=>{});function xt(i,e){let t=String(i??"");return t.length<=e?t:`${t.slice(0,Math.max(0,e-30))}
106
+
107
+ [tool result truncated for size]`}function Fo(i,e){if(typeof i=="string")return xt(i,e);try{return xt(JSON.stringify(i),e)}catch{return xt(String(i),e)}}function Ps(i){let e=new Set;for(let s of i)if(s.role==="assistant"&&Array.isArray(s.tool_calls))for(let n of s.tool_calls)e.add(n.id);let t=i.filter(s=>s.role==="tool"?e.has(s.tool_call_id):!0),r=new Set;for(let s of t)s.role==="tool"&&r.add(s.tool_call_id);return t.map(s=>{if(s.role!=="assistant"||!Array.isArray(s.tool_calls)||s.tool_calls.every(l=>r.has(l.id)))return s;let{tool_calls:o,...c}=s;return{...c,content:c.content||""}})}function Uo(i){let e=Array.isArray(i?.messages)?i.messages:[],t=e.find(n=>n.role==="system"),r=e.slice(-4).map(n=>({...n,content:xt(n.content,n.role==="tool"?1200:2500)}));r=Ps(r);let s={...i,messages:[t,...r].filter(Boolean)};return delete s.tools,s}async function jo({body:i,streaming:e,auth:t,options:r,fetchCompletion:s,fetchStreamingCompletion:n,onFallbackLog:o}){try{return e?await n(i,t,r):await s(i,t,r)}catch(c){let l=String(c?.message||c||"");if(!/proxy error 413|payload too large/i.test(l))throw c;let a=Uo(i);return typeof o=="function"&&o(i,a),{data:e?await n(a,t,r):await s(a,t,r),fallback:a}}}async function Cs({body:i,auth:e,options:t,streaming:r,toolContext:s,activeSkills:n,round:o,verbose:c,dependencies:l,config:a={}}){let u=a.maxToolResultChars||3e3,{fetchCompletion:p,fetchStreamingCompletion:d,onFallbackLog:f,hasToolCalls:m,getTextContent:S,parseToolCalls:g,buildAssistantMessage:w,buildToolResultMessage:y,executeTool:E,onToolCallLog:x,injectTools:v}=l;Array.isArray(i?.messages)&&(i.messages=Ps(i.messages));let $=await jo({body:i,streaming:r,auth:e,options:t,fetchCompletion:p,fetchStreamingCompletion:d,onFallbackLog:f}),T=$?.data||$;if(!m(T))return{done:!0,text:S(T),body:$?.fallback||i};let I=g(T),P=$?.fallback||i;P.messages.push(w(T)),c&&typeof x=="function"&&x(I);let N=await Promise.all(I.map((b,A)=>(typeof t.onToolCall=="function"&&t.onToolCall(b.name,b.args,{round:o,index:A,total:I.length}),E(b,s))));for(let b=0;b<I.length;b++){let O=I[b].name==="get_skill_context"?typeof N[b]=="string"?N[b]:JSON.stringify(N[b]):Fo(N[b],u);P.messages.push(y(I[b].id,O))}return typeof t.onToolCall=="function"&&t.onToolCall(null),v(P,n),{done:!1,body:P}}var Ns=M(()=>{});function Oe(i){!i||typeof i!="object"||(i.type==="object"&&i.properties&&(i.required=Object.keys(i.properties),i.additionalProperties=!1,Object.values(i.properties).forEach(Oe)),i.type==="array"&&i.items&&Oe(i.items),i.anyOf&&i.anyOf.forEach(Oe),i.oneOf&&i.oneOf.forEach(Oe),i.allOf&&i.allOf.forEach(Oe))}function Et(i){return Array.isArray(i)?new Set(i.map(e=>String(e||"").trim()).filter(Boolean)):new Set}function Wo(i){return Array.isArray(i)?i.map(e=>String(e||"").trim()).filter(Boolean):[]}var Go,zo,ar,Rs,Ae,Jo,Pe,ks=M(()=>{ue();V();oe();nr();or();se();Os();Ns();Go=G.ASSISTANT,zo=15,ar="get_skill_context";Rs={maxBytes:49e3,systemMaxChars:12e3},Ae=()=>process.env.ZIBBY_VERBOSE==="true"||process.env.ZIBBY_DEBUG==="true",Jo=i=>Buffer.byteLength(JSON.stringify(i),"utf8");Pe=class extends K{#e;#t;#r=new Xe;constructor(e=null){super("assistant","Zibby Assistant",200),e&&typeof e=="object"&&(e.toolProvider||e.completionProvider)?(this.#e=e.toolProvider||new de,this.#t=e.completionProvider||new Ie):(this.#e=e||new de,this.#t=new Ie)}canHandle(e){return ir().ok}async invoke(e,t={}){let r=t.model&&t.model!=="auto"?t.model:Go,s=ir();if(!s.ok)throw s.reason==="missing_session_token"?new Error("Login required. Run `zibby login` to authenticate."):s.reason==="missing_openai_api_key"?new Error("Missing OPENAI_API_KEY for BYOK mode."):s.reason==="missing_openai_proxy_url"?new Error("Missing OPENAI_PROXY_URL for local mode."):new Error(`Assistant auth unavailable (${s.reason}).`);let n=t.messages||[{role:"user",content:e}],o=s.baseUrl,c=Ae();if(c?await this.#m(n,r,o,s.tokenPreview||"none"):h.debug(`[Assistant] ${o} | model: ${r} | messages: ${n.length}`),t.schema)return this.#l(r,n,s,t);let l=t.activeSkills||[],a=this.#p(t),u=this.#f(l,a),p=this.#d(u),d=this.#u(t),f={...t,payloadCompaction:d},m={activeSkills:u,options:f,executionRegistry:p,capabilityPolicy:a},S=!!t.stream,g={model:r,messages:[...n],stream:!1};this.#n(g,u,a);for(let w=0;w<zo;w++){if(t.signal?.aborted)throw new Error("Aborted");let y=await Cs({body:g,auth:s,options:f,streaming:S,toolContext:m,activeSkills:u,round:w,verbose:c,dependencies:{fetchCompletion:this.#o.bind(this),fetchStreamingCompletion:this.#c.bind(this),onFallbackLog:(E,x)=>{Ae()&&console.log(`413 fallback: messages ${E.messages.length} -> ${x.messages.length}, bytes=${Jo(x)}`)},hasToolCalls:E=>this.#e.hasToolCalls(E),getTextContent:E=>this.#e.getTextContent(E),parseToolCalls:E=>this.#e.parseToolCalls(E),buildAssistantMessage:E=>this.#e.buildAssistantMessage(E),buildToolResultMessage:(E,x)=>this.#e.buildToolResultMessage(E,x),executeTool:(E,x)=>this.#a(E,x),onToolCallLog:async E=>{let x=(await import("chalk")).default;console.log(x.dim(` ${E.map(v=>`${v.name}(${JSON.stringify(v.args).slice(0,80)})`).join(", ")}`))},injectTools:(E,x)=>this.#n(E,x,a)},config:{maxToolResultChars:t.maxToolResultChars||3e3}});if(y.done)return y.text;g.messages=y.body.messages,y.body.tools?g.tools=y.body.tools:delete g.tools}return"I hit my tool-calling limit for this turn. Please try again."}async cleanup(){await this.#r.stopAll()}#n(e,t,r=null){let s=this.#i(t,r),n=this.#e.formatTools(s);this.#e.injectToolsIntoBody(e,n)}#i(e,t=null){let r=[],s=new Set;for(let n of e){let o=z(n);if(o?.tools?.length)for(let c of o.tools)this.#s(c.name,t)&&(s.has(c.name)||(s.add(c.name),r.push({name:c.name,description:c.description,parameters:c.parameters||c.input_schema||{type:"object",properties:{}}})))}return!t?.disableSkillContextTool&&this.#s(ar,t)&&r.push({name:ar,description:"Fetch full prompt guidance/instructions for one installed skill on demand. Use this before making complex tool decisions if guidance is needed.",parameters:{type:"object",properties:{skillId:{type:"string",description:"Installed skill id to inspect (e.g. jira, github, runner, chat-memory)"}},required:["skillId"]}}),r}async#a(e,t){let{activeSkills:r,options:s,executionRegistry:n,capabilityPolicy:o}=t;if(!this.#s(e.name,o))return`Tool "${e.name}" blocked by policy`;if(e.name===ar){let a=String(e.args?.skillId||"").trim();if(!a)return JSON.stringify({error:"skillId is required"});if(!r.includes(a))return JSON.stringify({error:`Skill "${a}" is not active`,activeSkills:r});let u=z(a);if(!u)return JSON.stringify({error:`Skill "${a}" not found`});let p=typeof u.promptFragment=="function"?u.promptFragment():u.promptFragment||"",d=(u.tools||[]).map(m=>m.name),f=JSON.stringify({skillId:a,description:u.description||"",toolNames:d,promptFragment:p||""});return Ae()&&(console.log(`
108
+ \u{1F4D6} get_skill_context("${a}") \u2192 ${f.length} chars (fragment: ${p.length} chars)`),console.log(` tools: [${d.join(", ")}]`),console.log(` fragment preview: ${p.slice(0,200).replace(/\n/g,"\\n")}\u2026
109
+ `)),f}let c=n?.get(e.name)||null;if(!c)return`Unknown tool: ${e.name}`;let l=z(c.skillId);if(!l)return`Skill "${c.skillId}" not found for tool "${e.name}"`;if(c.mode==="handler")try{return l.handleToolCall(e.name,e.args,t)}catch(a){return`Error in ${e.name}: ${a.message}`}if(c.mode==="mcp")try{if(!this.#r.isRunning(l.serverName)){let u=l.resolve(s);if(!u)return`Skill "${c.skillId}" is not available (cannot start server)`;await this.#r.ensureServer(l.serverName,u)}let a=await this.#r.callTool(l.serverName,e.name,e.args);return a.text||(a.isError?"Tool call failed":"Done")}catch(a){return`MCP error (${l.serverName}): ${a.message}`}return`Skill "${c.skillId}" owns tool "${e.name}" but has no execution mode`}async#c(e,t,r){return this.#t.fetchStreamingCompletion(e,t,{...r,onBudget:({beforeBytes:s,meta:n})=>{Ae()&&console.log(`payload bytes (stream) before=${s} after=${n.bytes} trimmed=${n.trimmed} messages=${n.messageCount}`)}})}async#o(e,t,r){return this.#t.fetchCompletion(e,t,{...r,onBudget:({beforeBytes:s,meta:n})=>{Ae()&&console.log(`payload bytes before=${s} after=${n.bytes} trimmed=${n.trimmed} messages=${n.messageCount}`)}})}async#l(e,t,r,s){let{zodToJsonSchema:n}=await import("zod-to-json-schema"),o=typeof s.schema?.parse=="function",c=o?n(s.schema):s.schema;delete c.$schema,Oe(c);let l={model:e,messages:t,stream:!1,response_format:{type:"json_schema",json_schema:{name:"extract",schema:c,strict:!0}}},a=await this.#o(l,r,s),u=this.#e.getTextContent(a),p=JSON.parse(u),d=o?s.schema.parse(p):p;return{raw:u,structured:d}}#u(e={}){let t=e?.config?.agent?.assistant?.payloadCompaction||{};return{maxBytes:Number(t.maxBytes||e.maxPayloadBytes||Rs.maxBytes),systemMaxChars:Number(t.systemMaxChars||Rs.systemMaxChars)}}#p(e={}){let t=e?.config?.agent?.assistant?.toolPolicy||{};return{allowTools:Et(t.allowTools||e.allowTools),denyTools:Et(t.denyTools||e.denyTools),denyPrefixes:Wo(t.denyPrefixes||e.denyToolPrefixes),includeSkills:Et(t.includeSkills||e.includeSkills),excludeSkills:Et(t.excludeSkills||e.excludeSkills),disableSkillContextTool:!!(t.disableSkillContextTool||e.disableSkillContextTool)}}#f(e,t){let r=t?.includeSkills||new Set,s=t?.excludeSkills||new Set;return r.size===0&&s.size===0?e:e.filter(n=>!(r.size>0&&!r.has(n)||s.has(n)))}#s(e,t){let r=String(e||"").trim();if(!r)return!1;let s=t?.allowTools;if(s&&s.size>0&&!s.has(r))return!1;let n=t?.denyTools;return!(n&&n.has(r)||(t?.denyPrefixes||[]).some(c=>r.startsWith(c)))}#d(e){let t=new Map,r=[];for(let s of e){let n=z(s);if(!n?.tools?.length)continue;let o=typeof n.handleToolCall=="function"?"handler":n.serverName&&typeof n.resolve=="function"?"mcp":null;if(o)for(let c of n.tools){let l=String(c?.name||"").trim();if(l){if(t.has(l)){r.push({tool:l,winner:t.get(l).skillId,skipped:s});continue}t.set(l,{skillId:s,mode:o})}}}if(r.length>0&&Ae()){let s=r.slice(0,5).map(n=>`${n.tool}:${n.winner}>${n.skipped}`).join(", ");console.log(`tool registry collisions: ${s}${r.length>5?" ...":""}`)}return t}async#m(e,t,r,s){console.log(`
110
+ \u25C6 Model: ${t} | proxy: ${r} | token: ${s||"none"}
111
+ `);let n=(await import("chalk")).default;console.log(n.bold("Prompt sent to LLM:")),console.log(n.dim("\u2500".repeat(60)));let o=!1;for(let c of e)if(c.role==="system")console.log(n.dim(`[System] ${c.content||""}`));else{o||(console.log(n.dim("\u2500\u2500\u2500 chat history \u2500\u2500\u2500")),o=!0);let l=c.role==="user"?"Human":"AI",a=c.content?.length>200?`${c.content.slice(0,200)}...`:c.content||"";console.log(n.dim(`[${l}] ${a}`))}console.log(n.dim("\u2500".repeat(60)))}}});var lr={};lt(lr,{AgentStrategy:()=>K,AssistantStrategy:()=>Pe,ClaudeAgentStrategy:()=>Ee,CodexAgentStrategy:()=>Te,CursorAgentStrategy:()=>xe,GeminiAgentStrategy:()=>ve,getAgentStrategy:()=>cr,invokeAgent:()=>Ls});function cr(i={}){let{state:e={},preferredAgent:t=null}=i,r=t||e.agentType||process.env.AGENT_TYPE;if(!r)throw new Error("No agent specified. Set agent.claude, agent.cursor, agent.codex, or agent.gemini in .zibby.config.js");h.debug(`Agent selection: requested=${r}`);let s=Ms.find(n=>n.getName()===r);if(!s)throw new Error(`Unknown agent '${r}'. Available: ${Ms.map(n=>n.getName()).join(", ")}`);if(h.debug(`Checking if ${r} can handle this environment...`),!s.canHandle(i)){let o={assistant:"Run `zibby login` to authenticate",claude:"Set ANTHROPIC_API_KEY in .env",cursor:"Install cursor-agent CLI or set CURSOR_API_KEY",codex:"Install codex CLI (npm i -g @openai/codex) and set OPENAI_API_KEY in .env",gemini:"Install gemini CLI (npm i -g @google/gemini-cli) and set GEMINI_API_KEY in .env"}[r]||"Check your environment configuration";throw new Error(`Agent '${r}' is not available. ${o}`)}return h.debug(`Using agent: ${s.getName()}`),s}async function Ls(i,e={},t={}){try{await import("@zibby/skills")}catch{}let r=cr(e),s=e.state?.config||t.config||{},n=s.models||{},o=t.nodeName&&n[t.nodeName]||null,c=n.default||null,l=r.name,a=s.agent?.[l]?.model||null,u=o||c||a||t.model||null,p={...t,model:u,workspace:e.state?.workspace||t.workspace,schema:t.schema||e.schema,images:t.images||e.images||[],skills:t.skills||e.skills||[],config:s},d=p.skills||[];if(d.length>0&&!t.skipPromptFragments){let{getSkill:m}=await Promise.resolve().then(()=>(se(),qt)),S=d.map(g=>{let w=m(g)?.promptFragment;return typeof w=="function"?w():w}).filter(Boolean);S.length>0&&(i+=`
112
+
113
+ ${S.join(`
114
+
115
+ `)}`)}let f=e.state?._currentNodeConfig?.extraPromptInstructions?.trim();return f&&(i+=`
254
116
 
255
117
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
256
118
  \u26A0\uFE0F PRIORITY OVERRIDE \u2014 THE FOLLOWING INSTRUCTIONS TAKE PRECEDENCE OVER ALL PREVIOUS CONTENT
257
119
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
258
120
 
259
121
  ${f}
260
- `),U.debug(`Prompt length: ${t.length} chars`),process.env.STAGE!=="prod"&&U.debug(`Full prompt:
261
- ${t}`),i.invoke(t,d)}var qV,Uv=N(()=>{XC();FZ();YZ();rL();LV();Un();_s();qV=[new Ll,new du,new Ju,new Yu,new Qu]});var GV={};An(GV,{ConditionalNode:()=>xp,Node:()=>za});import{writeFileSync as vz,readFileSync as VV,existsSync as WV,mkdirSync as Mye}from"node:fs";import{join as _z,dirname as Zye}from"node:path";import Mv from"chalk";var za,xp,bz=N(()=>{eN();Un();vs();Ci();za=class{constructor(e){if(this.config=e,this.name=e.name,this.prompt=e.prompt,this.outputSchema=e.outputSchema,!this.outputSchema&&!e._isCustomCode)throw new Error(`Node '${this.name}' must define outputSchema (Zod schema). This defines the contract for what the node returns to state.`);this.isZodSchema=this.outputSchema&&typeof this.outputSchema._def<"u",this.parser=e.outputSchema&&!this.isZodSchema?new Up(e.outputSchema):null,this.retries=e.retries||0,this.onComplete=e.onComplete,this.customExecute=e.execute}async execute(e,r){let i=()=>r&&typeof r.getAll=="function"?r.getAll():e,n=d=>r&&typeof r.get=="function"?r.get(d):e?.[d];if(typeof this.customExecute=="function"){U.info("\u26A1 Using custom execute method (skipping LLM)");try{let d=await this.customExecute(e);return typeof d=="object"&&d!==null&&d.success===!1?{success:!1,error:d.error||"Node execution failed",raw:d.raw||null}:this.isZodSchema?(U.debug("Validating return value against outputSchema..."),{success:!0,output:this.outputSchema.parse(d),raw:null}):{success:!0,output:d,raw:null}}catch(d){return U.error(`\u274C Node '${this.name}' execution failed: ${d.message}`),d.name==="ZodError"&&U.error(`Schema validation errors: ${JSON.stringify(d.errors,null,2)}`),{success:!1,error:d.message,raw:null}}}let o=typeof this.prompt=="function"?this.prompt(i()):this.prompt,s=n("_skillHints");s&&(o=`${s}
122
+ `),h.debug(`Prompt length: ${i.length} chars`),process.env.STAGE!=="prod"&&h.debug(`Full prompt:
123
+ ${i}`),r.invoke(i,p)}var Ms,Tt=M(()=>{gs();ys();Ss();Es();ks();V();ue();Ms=[new Pe,new xe,new Ee,new Te,new ve]});var Fs={};lt(Fs,{ConditionalNode:()=>Qe,Node:()=>me});import{writeFileSync as ur,readFileSync as Ds,existsSync as Bs,mkdirSync as Yo}from"node:fs";import{join as pr,dirname as Ko}from"node:path";import vt from"chalk";var me,Qe,fr=M(()=>{Yr();V();le();ee();me=class{constructor(e){if(this.config=e,this.name=e.name,this.prompt=e.prompt,this.outputSchema=e.outputSchema,!this.outputSchema&&!e._isCustomCode)throw new Error(`Node '${this.name}' must define outputSchema (Zod schema). This defines the contract for what the node returns to state.`);this.isZodSchema=this.outputSchema&&typeof this.outputSchema._def<"u",this.parser=e.outputSchema&&!this.isZodSchema?new ht(e.outputSchema):null,this.retries=e.retries||0,this.onComplete=e.onComplete,this.customExecute=e.execute}async execute(e,t){let r=()=>t&&typeof t.getAll=="function"?t.getAll():e,s=p=>t&&typeof t.get=="function"?t.get(p):e?.[p];if(typeof this.customExecute=="function"){h.info("\u26A1 Using custom execute method (skipping LLM)");try{let p=await this.customExecute(e);return typeof p=="object"&&p!==null&&p.success===!1?{success:!1,error:p.error||"Node execution failed",raw:p.raw||null}:this.isZodSchema?(h.debug("Validating return value against outputSchema..."),{success:!0,output:this.outputSchema.parse(p),raw:null}):{success:!0,output:p,raw:null}}catch(p){return h.error(`\u274C Node '${this.name}' execution failed: ${p.message}`),p.name==="ZodError"&&h.error(`Schema validation errors: ${JSON.stringify(p.errors,null,2)}`),{success:!1,error:p.message,raw:null}}}let n=typeof this.prompt=="function"?this.prompt(r()):this.prompt,o=s("_skillHints");o&&(n=`${o}
262
124
 
263
- ${o}`);let a=i(),u=a.cwd||process.cwd(),l=a.sessionPath;try{if(l){let d=_z(l,ci);if(WV(d)){let f=JSON.parse(VV(d,"utf-8"));f.currentNode=this.name,vz(d,JSON.stringify(f,null,2),"utf-8")}let p=_z(l,"..",ci);if(WV(p))try{let f=JSON.parse(VV(p,"utf-8"));f.currentNode=this.name,vz(p,JSON.stringify(f,null,2),"utf-8")}catch{}}}catch(d){U.debug(`Could not update session info: ${d.message}`)}let c=null;for(let d=0;d<=this.retries;d++)try{U.debug(`Node.execute attempt ${d} for '${this.name}'`);let p=i(),f=p.config||{},m={state:p},g={workspace:u,schema:this.isZodSchema?this.outputSchema:null,skills:this.config.skills||[],sessionPath:l,config:f,nodeName:this.name,timeout:this.config?.timeout||3e5},v=e?._coreInvokeAgent;v||(v=(await Promise.resolve().then(()=>(Uv(),yz))).invokeAgent);let h=await v(o,m,g),y,_;if(typeof h=="string"?(y=h,_=null):h.structured?(y=h.raw||JSON.stringify(h.structured,null,2),_=h.structured):(y=h.raw||JSON.stringify(h,null,2),_=h.extracted||null),l)try{let b=_z(l,this.name,"raw_stream_output.txt");Mye(Zye(b),{recursive:!0}),vz(b,typeof y=="string"?y:JSON.stringify(y),"utf-8")}catch(b){U.debug(`Could not save raw output: ${b.message}`)}if(this.isZodSchema&&_){console.log(`
264
- \u{1F50D} ${Mv.cyan("Validated output:")} ${Mv.white(JSON.stringify(_,null,2))}`);let b=_;if(typeof this.onComplete=="function")try{b=await this.onComplete(i(),_)}catch(w){U.warn(`onComplete hook failed: ${w.message}`)}return{success:!0,output:b,raw:y}}if(typeof this.onComplete=="function")try{return{success:!0,output:await this.onComplete(i(),{raw:y}),raw:y}}catch(b){throw new Error(`onComplete failed: ${b.message}`,{cause:b})}if(this.parser){let b=this.parser.parse(y);return console.log(`
265
- \u{1F50D} ${Mv.cyan("Parsed output:")} ${Mv.white(JSON.stringify(b,null,2))}`),Mt.step("Output parsed"),{success:!0,output:b,raw:y}}return{success:!0,output:y,raw:y}}catch(p){c=p,d<this.retries&&U.info(`Node '${this.name}' failed, retrying (${d+1}/${this.retries})...`)}return{success:!1,error:c.message,raw:null}}},xp=class extends za{constructor(e){super({...e,_isCustomCode:!0}),this.condition=e.condition}async execute(e,r){let i=r&&typeof r.getAll=="function"?r.getAll():e;return{success:!0,output:{nextNode:this.condition(i)},raw:null}}}});Ci();import{readFileSync as vW,existsSync as _W}from"node:fs";import{join as Jl,resolve as bW,isAbsolute as n_e}from"node:path";import{existsSync as nc,readdirSync as Vz,statSync as FW}from"fs";import{join as Fr,relative as e_,sep as rc,resolve as ys}from"path";Ci();import{appendFileSync as jW,readFileSync as CW,existsSync as Az,mkdirSync as RW}from"node:fs";import{join as Cp}from"node:path";var Dz="run-index.jsonl";function Uz(t,e=Yt){let r=Cp(t,e);return Cp(r,Dz)}function Rp(t){if(!t||!t.sessionId)return;let e=t.cwd||process.cwd(),r=t.outputBase||Yt,i=Cp(e,r);Az(i)||RW(i,{recursive:!0});let n=Cp(i,Dz),o=`${JSON.stringify(t)}
266
- `;jW(n,o,"utf8")}function Mz(t){if(!t||!Az(t))return[];let e;try{e=CW(t,"utf8")}catch{return[]}let r=[];for(let i of e.split(`
267
- `)){let n=i.trim();if(n)try{r.push(JSON.parse(n))}catch{}}return r}import{existsSync as AW,mkdirSync as DW,readFileSync as UW,readdirSync as h_e,statSync as g_e,writeFileSync as MW}from"node:fs";import{join as ZW}from"node:path";var LW="zibby-run-state.json";function Zz(t){return ZW(t,LW)}function Qv(t){if(!t||typeof t!="string")return null;let e=Zz(t);if(!AW(e))return null;try{let r=UW(e,"utf8"),i=JSON.parse(r);return i&&typeof i=="object"?i:null}catch{return null}}function Ap(t,e){if(!t||typeof t!="string")return;try{DW(t,{recursive:!0})}catch{return}let i={...Qv(t)||{v:1},...e,v:1,updatedAt:Date.now()};try{MW(Zz(t),`${JSON.stringify(i)}
268
- `,"utf8")}catch(n){console.warn(`[zibby run-state] ${n.message}`)}}function qW(t){return t?.recordKind==="progress"}function Lz(t){let e=Number(t)||0;return e<=0?0:e<1e12?e*1e3:e}function qz(t,e={}){let r=e.maxProgressAgeMs!=null&&Number.isFinite(e.maxProgressAgeMs)?Math.max(0,e.maxProgressAgeMs):21e5,i=typeof e.now=="number"?e.now:Date.now(),{summary:n,progress:o}=t||{};if(!o)return!1;let s=Lz(o.ts);if(r>0&&s>0&&i-s>r)return!1;if(!n)return s>0;let a=Lz(n.ts);return s>a}function Fz(t){let e=new Map;for(let r of t||[]){if(!r?.sessionId)continue;let i=e.get(r.sessionId);i||(i={summary:null,progress:null});let n=Number(r.ts)||0;qW(r)?(!i.progress||n>=(Number(i.progress.ts)||0))&&(i.progress=r):(!i.summary||n>=(Number(i.summary.ts)||0))&&(i.summary=r),e.set(r.sessionId,i)}return e}Ci();var Xv=Object.freeze(["preflight","execute_live","generate_script"]);function t_(t){let e=process.env.ZIBBY_STUDIO_TEST_CASE_ID;return e!=null&&String(e).trim()!==""?String(e).trim():t!=null?String(t):""}var VW=[Fr("generate_script","generated-test.spec.js"),Fr("generate_script","generated-test.spec.ts"),Fr("generate_script","playwright.spec.ts"),Fr("generate_script","test.spec.ts")];function WW(t){let e=[Fr(t,"execute_live","videos"),Fr(t,"execute_live"),t];for(let r of e){if(!nc(r))continue;let i;try{i=Vz(r)}catch{continue}let n=i.find(o=>o.endsWith(".webm"));if(n)return Fr(r,n)}return null}function GW(t){let e=[Fr(t,"execute_live","events.json"),Fr(t,"events.json")];for(let r of e)if(nc(r))return r;return null}function BW(t){for(let e of VW){let r=Fr(t,e);if(nc(r))return r}return null}function KW(t){return!t||!nc(t)?{videoPathAbs:null,eventsPathAbs:null,scriptPathAbs:null}:{videoPathAbs:WW(t),eventsPathAbs:GW(t),scriptPathAbs:BW(t)}}function Wz(t){let e=t.cwd||process.cwd(),r=t.outputBase||Yt,o=((t.result||{}).state||{}).sessionPath;if(!o||typeof o!="string")return null;let s=o.split(/[/\\]/).filter(Boolean).pop();if(!s)return null;let{videoPathAbs:a,eventsPathAbs:u,scriptPathAbs:l}=KW(o),c=p=>{if(!p)return null;try{return e_(e,p).split(rc).join("/")}catch{return null}},d=null;if(t.specPath)try{let p=ys(e,t.specPath);d=e_(e,p).split(rc).join("/")}catch{d=String(t.specPath).split(rc).join("/")}return{v:1,recordKind:"summary",ts:Date.now(),sessionId:s,status:t.status??(t.success?"completed":"failed"),cwd:e,outputBase:r,sessionPathAbs:o,sessionDirRel:c(o),videoPathAbs:a||null,eventsPathAbs:u||null,scriptPathAbs:l||null,videoRel:c(a),eventsRel:c(u),scriptRel:c(l),specRel:d,source:process.env.ZIBBY_RUN_SOURCE||"cli",studioTestCaseId:t_(s)||null,errorMessage:t.errorMessage||null}}function Gz({cwd:t,config:e,result:r,success:i,specPath:n,errorMessage:o}){try{let s=Wz({cwd:t||process.cwd(),result:r,success:i,outputBase:e?.paths?.output||Yt,specPath:n,errorMessage:o});s&&(Rp(s),s.sessionPathAbs&&Ap(s.sessionPathAbs,{sessionId:s.sessionId,studioTestCaseId:s.studioTestCaseId||s.sessionId,status:s.status,activeNode:null,activeStageIndex:null,errorMessage:s.errorMessage||null,runSource:s.source||"cli",cwd:s.cwd,outputBase:s.outputBase,sessionPathAbs:s.sessionPathAbs}))}catch(s){console.warn(`[zibby browser-test run-index] ${s.message}`)}}function HW({sessionPath:t,sessionId:e,cwd:r,outputBase:i=Yt}={}){let n=r||process.cwd(),o=i||Yt,s=e!=null&&String(e).trim()!==""?String(e).trim():null,a=process.env.ZIBBY_RUN_SOURCE==="studio",u=process.env.ZIBBY_SESSION_PATH&&String(process.env.ZIBBY_SESSION_PATH).trim();if(a&&u)return ys(u);let l=t&&String(t).trim();if(l)return ys(l);let c=process.env.ZIBBY_SESSIONS_ROOT&&String(process.env.ZIBBY_SESSIONS_ROOT).trim();return c&&s?ys(Fr(c,s)):process.env.ZIBBY_SESSION_PATH&&String(process.env.ZIBBY_SESSION_PATH).trim()?ys(String(process.env.ZIBBY_SESSION_PATH).trim()):ys(Fr(n,o,Dn,s||"invalid"))}function JW(t){try{let e=t?.currentNode;if(!e||!Xv.includes(e))return;let r=t.sessionPath,i=t.sessionId||r&&String(r).split(/[/\\]/).filter(Boolean).pop()||null;if(!i)return;let n=t.cwd||process.cwd(),o=t.outputBase||Yt,s=Xv.indexOf(e),a=t?.specPath!=null?String(t.specPath).trim():"",u=t?.taskDescription!=null?String(t.taskDescription):"",l=null;if(a)try{let d=ys(n,a);l=e_(n,d).split(rc).join("/")}catch{l=a.split(rc).join("/")}let c=HW({sessionPath:r,sessionId:i,cwd:n,outputBase:o});Rp({v:1,recordKind:"progress",ts:Date.now(),sessionId:i,cwd:n,outputBase:o,sessionPathAbs:c,activeNode:e,activeStageIndex:s,specRel:l,taskDescription:u||null,studioTestCaseId:t_(i)||null,source:process.env.ZIBBY_RUN_SOURCE||"cli"}),Ap(c,{sessionId:i,studioTestCaseId:t_(i)||i,status:"running",activeNode:e,activeStageIndex:s,sessionPathAbs:c,cwd:n,outputBase:o,specPath:l||null,task:u||null,taskDescription:u||null,runSource:process.env.ZIBBY_RUN_SOURCE||"cli",pid:typeof process.pid=="number"?process.pid:null})}catch(e){console.warn(`[zibby browser-test run-index progress] ${e.message}`)}}function Bz({cwd:t,config:e}={}){let r=t||process.cwd(),i=e?.paths?.output||Yt;return n=>{JW({cwd:n?.cwd||r,outputBase:n?.outputBase||i,sessionPath:n?.sessionPath,sessionId:n?.sessionId,currentNode:n?.currentNode,specPath:n?.specPath,taskDescription:n?.taskDescription})}}function Kz(t={}){try{let e=t.cwd||process.cwd(),r=t.config?.paths?.output||t.outputBase||Yt,i=Uz(e,r),n=Mz(i),o=Fz(n),s=new Set,a=t.errorMessage||"Run stopped (SIGINT/SIGTERM) before a normal summary was written.",u=(d,p)=>{if(!d||!p||s.has(d))return;s.add(d);let f=Wz({cwd:e,outputBase:r,result:{state:{sessionPath:p}},success:!1,specPath:null,status:"interrupted",errorMessage:a});f&&(Rp(f),Ap(p,{sessionId:d,studioTestCaseId:f.studioTestCaseId||d,status:"interrupted",activeNode:null,activeStageIndex:null,errorMessage:f.errorMessage||null,runSource:f.source||"cli",cwd:e,outputBase:r,sessionPathAbs:p}))};for(let[d,p]of o){if(!qz(p))continue;let f=p.progress;if(!f)continue;let m=String(d),g=f.sessionPathAbs&&String(f.sessionPathAbs)||Fr(e,r,Dn,m);u(m,g)}let l=Fr(e,r,Dn);if(!nc(l))return;let c;try{c=Vz(l)}catch{return}for(let d of c){let p=Fr(l,d),f;try{f=FW(p)}catch{continue}if(!f.isDirectory())continue;let m=Qv(p);!m||m.status!=="running"||u(String(d),p)}}catch(e){console.warn(`[zibby browser-test run-index interrupt] ${e.message}`)}}function Dp(t){Gz(t)}function r_(t){Kz(t)}function Hz(t){return Bz(t)}import{spawn as Wye}from"node:child_process";import{mkdirSync as XV,existsSync as Gye,writeFileSync as Bye}from"node:fs";import{join as Sz}from"node:path";import{existsSync as Jz,readFileSync as YW}from"node:fs";import{join as n_,dirname as Yz}from"node:path";var Da=class{static async loadContext(e,r,i={}){let n={},o=i.filenames||["CONTEXT.md","AGENTS.md"];if(e){let a=Yz(n_(r,e));for(let u of o){let l=await this.findAndMergeContextFiles(u,a,r);if(l){let c=u.replace(/\.[^.]+$/,"").toLowerCase();n[c]=l}}}let s=i.discovery||{};for(let[a,u]of Object.entries(s))try{let l=n_(r,u);if(Jz(l)){let c=await this.loadFile(l);n[a]=c}}catch(l){console.warn(`\u26A0\uFE0F Could not load context '${a}' from '${u}': ${l.message}`)}return n}static async findAndMergeContextFiles(e,r,i){let n=[],o=r;for(;o.startsWith(i);){let s=n_(o,e);if(Jz(s))try{let u=await this.loadFile(s);n.unshift(u)}catch(u){console.warn(`\u26A0\uFE0F Could not load ${e} from ${s}: ${u.message}`)}let a=Yz(o);if(a===o)break;o=a}return n.length===0?null:n.every(s=>typeof s=="string")?n.join(`
125
+ ${n}`);let c=r(),l=c.cwd||process.cwd(),a=c.sessionPath;try{if(a){let p=pr(a,q);if(Bs(p)){let f=JSON.parse(Ds(p,"utf-8"));f.currentNode=this.name,ur(p,JSON.stringify(f,null,2),"utf-8")}let d=pr(a,"..",q);if(Bs(d))try{let f=JSON.parse(Ds(d,"utf-8"));f.currentNode=this.name,ur(d,JSON.stringify(f,null,2),"utf-8")}catch{}}}catch(p){h.debug(`Could not update session info: ${p.message}`)}let u=null;for(let p=0;p<=this.retries;p++)try{h.debug(`Node.execute attempt ${p} for '${this.name}'`);let d=r(),f=d.config||{},m={state:d},S={workspace:l,schema:this.isZodSchema?this.outputSchema:null,skills:this.config.skills||[],sessionPath:a,config:f,nodeName:this.name,timeout:this.config?.timeout||3e5},g=e?._coreInvokeAgent;g||(g=(await Promise.resolve().then(()=>(Tt(),lr))).invokeAgent);let w=await g(n,m,S),y,E;if(typeof w=="string"?(y=w,E=null):w.structured?(y=w.raw||JSON.stringify(w.structured,null,2),E=w.structured):(y=w.raw||JSON.stringify(w,null,2),E=w.extracted||null),a)try{let x=pr(a,this.name,"raw_stream_output.txt");Yo(Ko(x),{recursive:!0}),ur(x,typeof y=="string"?y:JSON.stringify(y),"utf-8")}catch(x){h.debug(`Could not save raw output: ${x.message}`)}if(this.isZodSchema&&E){console.log(`
126
+ \u{1F50D} ${vt.cyan("Validated output:")} ${vt.white(JSON.stringify(E,null,2))}`);let x=E;if(typeof this.onComplete=="function")try{x=await this.onComplete(r(),E)}catch(v){h.warn(`onComplete hook failed: ${v.message}`)}return{success:!0,output:x,raw:y}}if(typeof this.onComplete=="function")try{return{success:!0,output:await this.onComplete(r(),{raw:y}),raw:y}}catch(x){throw new Error(`onComplete failed: ${x.message}`,{cause:x})}if(this.parser){let x=this.parser.parse(y);return console.log(`
127
+ \u{1F50D} ${vt.cyan("Parsed output:")} ${vt.white(JSON.stringify(x,null,2))}`),D.step("Output parsed"),{success:!0,output:x,raw:y}}return{success:!0,output:y,raw:y}}catch(d){u=d,p<this.retries&&h.info(`Node '${this.name}' failed, retrying (${p+1}/${this.retries})...`)}return{success:!1,error:u.message,raw:null}}},Qe=class extends me{constructor(e){super({...e,_isCustomCode:!0}),this.condition=e.condition}async execute(e,t){let r=t&&typeof t.getAll=="function"?t.getAll():e;return{success:!0,output:{nextNode:this.condition(r)},raw:null}}}});ee();import{readFileSync as dn,existsSync as mn}from"node:fs";import{join as Fe,resolve as hn,isAbsolute as ua}from"node:path";import{existsSync as ze,readdirSync as Lr,statSync as Rn}from"fs";import{join as Y,relative as Dt,sep as Ge,resolve as ce}from"path";ee();import{appendFileSync as En,readFileSync as Tn,existsSync as Ar,mkdirSync as vn}from"node:fs";import{join as pt}from"node:path";var Or="run-index.jsonl";function Pr(i,e=B){let t=pt(i,e);return pt(t,Or)}function ft(i){if(!i||!i.sessionId)return;let e=i.cwd||process.cwd(),t=i.outputBase||B,r=pt(e,t);Ar(r)||vn(r,{recursive:!0});let s=pt(r,Or),n=`${JSON.stringify(i)}
128
+ `;En(s,n,"utf8")}function Cr(i){if(!i||!Ar(i))return[];let e;try{e=Tn(i,"utf8")}catch{return[]}let t=[];for(let r of e.split(`
129
+ `)){let s=r.trim();if(s)try{t.push(JSON.parse(s))}catch{}}return t}import{existsSync as $n,mkdirSync as In,readFileSync as An,readdirSync as xa,statSync as Ea,writeFileSync as On}from"node:fs";import{join as Pn}from"node:path";var Cn="zibby-run-state.json";function Nr(i){return Pn(i,Cn)}function Mt(i){if(!i||typeof i!="string")return null;let e=Nr(i);if(!$n(e))return null;try{let t=An(e,"utf8"),r=JSON.parse(t);return r&&typeof r=="object"?r:null}catch{return null}}function dt(i,e){if(!i||typeof i!="string")return;try{In(i,{recursive:!0})}catch{return}let r={...Mt(i)||{v:1},...e,v:1,updatedAt:Date.now()};try{On(Nr(i),`${JSON.stringify(r)}
130
+ `,"utf8")}catch(s){console.warn(`[zibby run-state] ${s.message}`)}}function Nn(i){return i?.recordKind==="progress"}function Rr(i){let e=Number(i)||0;return e<=0?0:e<1e12?e*1e3:e}function kr(i,e={}){let t=e.maxProgressAgeMs!=null&&Number.isFinite(e.maxProgressAgeMs)?Math.max(0,e.maxProgressAgeMs):21e5,r=typeof e.now=="number"?e.now:Date.now(),{summary:s,progress:n}=i||{};if(!n)return!1;let o=Rr(n.ts);if(t>0&&o>0&&r-o>t)return!1;if(!s)return o>0;let c=Rr(s.ts);return o>c}function Mr(i){let e=new Map;for(let t of i||[]){if(!t?.sessionId)continue;let r=e.get(t.sessionId);r||(r={summary:null,progress:null});let s=Number(t.ts)||0;Nn(t)?(!r.progress||s>=(Number(r.progress.ts)||0))&&(r.progress=t):(!r.summary||s>=(Number(r.summary.ts)||0))&&(r.summary=t),e.set(t.sessionId,r)}return e}ee();var Lt=Object.freeze(["preflight","execute_live","generate_script"]);function Bt(i){let e=process.env.ZIBBY_STUDIO_TEST_CASE_ID;return e!=null&&String(e).trim()!==""?String(e).trim():i!=null?String(i):""}var kn=[Y("generate_script","generated-test.spec.js"),Y("generate_script","generated-test.spec.ts"),Y("generate_script","playwright.spec.ts"),Y("generate_script","test.spec.ts")];function Mn(i){let e=[Y(i,"execute_live","videos"),Y(i,"execute_live"),i];for(let t of e){if(!ze(t))continue;let r;try{r=Lr(t)}catch{continue}let s=r.find(n=>n.endsWith(".webm"));if(s)return Y(t,s)}return null}function Ln(i){let e=[Y(i,"execute_live","events.json"),Y(i,"events.json")];for(let t of e)if(ze(t))return t;return null}function Dn(i){for(let e of kn){let t=Y(i,e);if(ze(t))return t}return null}function Bn(i){return!i||!ze(i)?{videoPathAbs:null,eventsPathAbs:null,scriptPathAbs:null}:{videoPathAbs:Mn(i),eventsPathAbs:Ln(i),scriptPathAbs:Dn(i)}}function Dr(i){let e=i.cwd||process.cwd(),t=i.outputBase||B,n=((i.result||{}).state||{}).sessionPath;if(!n||typeof n!="string")return null;let o=n.split(/[/\\]/).filter(Boolean).pop();if(!o)return null;let{videoPathAbs:c,eventsPathAbs:l,scriptPathAbs:a}=Bn(n),u=d=>{if(!d)return null;try{return Dt(e,d).split(Ge).join("/")}catch{return null}},p=null;if(i.specPath)try{let d=ce(e,i.specPath);p=Dt(e,d).split(Ge).join("/")}catch{p=String(i.specPath).split(Ge).join("/")}return{v:1,recordKind:"summary",ts:Date.now(),sessionId:o,status:i.status??(i.success?"completed":"failed"),cwd:e,outputBase:t,sessionPathAbs:n,sessionDirRel:u(n),videoPathAbs:c||null,eventsPathAbs:l||null,scriptPathAbs:a||null,videoRel:u(c),eventsRel:u(l),scriptRel:u(a),specRel:p,source:process.env.ZIBBY_RUN_SOURCE||"cli",studioTestCaseId:Bt(o)||null,errorMessage:i.errorMessage||null}}function Br({cwd:i,config:e,result:t,success:r,specPath:s,errorMessage:n}){try{let o=Dr({cwd:i||process.cwd(),result:t,success:r,outputBase:e?.paths?.output||B,specPath:s,errorMessage:n});o&&(ft(o),o.sessionPathAbs&&dt(o.sessionPathAbs,{sessionId:o.sessionId,studioTestCaseId:o.studioTestCaseId||o.sessionId,status:o.status,activeNode:null,activeStageIndex:null,errorMessage:o.errorMessage||null,runSource:o.source||"cli",cwd:o.cwd,outputBase:o.outputBase,sessionPathAbs:o.sessionPathAbs}))}catch(o){console.warn(`[zibby browser-test run-index] ${o.message}`)}}function Fn({sessionPath:i,sessionId:e,cwd:t,outputBase:r=B}={}){let s=t||process.cwd(),n=r||B,o=e!=null&&String(e).trim()!==""?String(e).trim():null,c=process.env.ZIBBY_RUN_SOURCE==="studio",l=process.env.ZIBBY_SESSION_PATH&&String(process.env.ZIBBY_SESSION_PATH).trim();if(c&&l)return ce(l);let a=i&&String(i).trim();if(a)return ce(a);let u=process.env.ZIBBY_SESSIONS_ROOT&&String(process.env.ZIBBY_SESSIONS_ROOT).trim();return u&&o?ce(Y(u,o)):process.env.ZIBBY_SESSION_PATH&&String(process.env.ZIBBY_SESSION_PATH).trim()?ce(String(process.env.ZIBBY_SESSION_PATH).trim()):ce(Y(s,n,H,o||"invalid"))}function Un(i){try{let e=i?.currentNode;if(!e||!Lt.includes(e))return;let t=i.sessionPath,r=i.sessionId||t&&String(t).split(/[/\\]/).filter(Boolean).pop()||null;if(!r)return;let s=i.cwd||process.cwd(),n=i.outputBase||B,o=Lt.indexOf(e),c=i?.specPath!=null?String(i.specPath).trim():"",l=i?.taskDescription!=null?String(i.taskDescription):"",a=null;if(c)try{let p=ce(s,c);a=Dt(s,p).split(Ge).join("/")}catch{a=c.split(Ge).join("/")}let u=Fn({sessionPath:t,sessionId:r,cwd:s,outputBase:n});ft({v:1,recordKind:"progress",ts:Date.now(),sessionId:r,cwd:s,outputBase:n,sessionPathAbs:u,activeNode:e,activeStageIndex:o,specRel:a,taskDescription:l||null,studioTestCaseId:Bt(r)||null,source:process.env.ZIBBY_RUN_SOURCE||"cli"}),dt(u,{sessionId:r,studioTestCaseId:Bt(r)||r,status:"running",activeNode:e,activeStageIndex:o,sessionPathAbs:u,cwd:s,outputBase:n,specPath:a||null,task:l||null,taskDescription:l||null,runSource:process.env.ZIBBY_RUN_SOURCE||"cli",pid:typeof process.pid=="number"?process.pid:null})}catch(e){console.warn(`[zibby browser-test run-index progress] ${e.message}`)}}function Fr({cwd:i,config:e}={}){let t=i||process.cwd(),r=e?.paths?.output||B;return s=>{Un({cwd:s?.cwd||t,outputBase:s?.outputBase||r,sessionPath:s?.sessionPath,sessionId:s?.sessionId,currentNode:s?.currentNode,specPath:s?.specPath,taskDescription:s?.taskDescription})}}function Ur(i={}){try{let e=i.cwd||process.cwd(),t=i.config?.paths?.output||i.outputBase||B,r=Pr(e,t),s=Cr(r),n=Mr(s),o=new Set,c=i.errorMessage||"Run stopped (SIGINT/SIGTERM) before a normal summary was written.",l=(p,d)=>{if(!p||!d||o.has(p))return;o.add(p);let f=Dr({cwd:e,outputBase:t,result:{state:{sessionPath:d}},success:!1,specPath:null,status:"interrupted",errorMessage:c});f&&(ft(f),dt(d,{sessionId:p,studioTestCaseId:f.studioTestCaseId||p,status:"interrupted",activeNode:null,activeStageIndex:null,errorMessage:f.errorMessage||null,runSource:f.source||"cli",cwd:e,outputBase:t,sessionPathAbs:d}))};for(let[p,d]of n){if(!kr(d))continue;let f=d.progress;if(!f)continue;let m=String(p),S=f.sessionPathAbs&&String(f.sessionPathAbs)||Y(e,t,H,m);l(m,S)}let a=Y(e,t,H);if(!ze(a))return;let u;try{u=Lr(a)}catch{return}for(let p of u){let d=Y(a,p),f;try{f=Rn(d)}catch{continue}if(!f.isDirectory())continue;let m=Mt(d);!m||m.status!=="running"||l(String(p),d)}}catch(e){console.warn(`[zibby browser-test run-index interrupt] ${e.message}`)}}function mt(i){Br(i)}function Ft(i){Ur(i)}function jr(i){return Fr(i)}import{spawn as Xo}from"node:child_process";import{mkdirSync as Ks,existsSync as Qo,writeFileSync as ei}from"node:fs";import{join as mr}from"node:path";import{existsSync as Gr,readFileSync as jn}from"node:fs";import{join as Ut,dirname as zr}from"node:path";var we=class{static async loadContext(e,t,r={}){let s={},n=r.filenames||["CONTEXT.md","AGENTS.md"];if(e){let c=zr(Ut(t,e));for(let l of n){let a=await this.findAndMergeContextFiles(l,c,t);if(a){let u=l.replace(/\.[^.]+$/,"").toLowerCase();s[u]=a}}}let o=r.discovery||{};for(let[c,l]of Object.entries(o))try{let a=Ut(t,l);if(Gr(a)){let u=await this.loadFile(a);s[c]=u}}catch(a){console.warn(`\u26A0\uFE0F Could not load context '${c}' from '${l}': ${a.message}`)}return s}static async findAndMergeContextFiles(e,t,r){let s=[],n=t;for(;n.startsWith(r);){let o=Ut(n,e);if(Gr(o))try{let l=await this.loadFile(o);s.unshift(l)}catch(l){console.warn(`\u26A0\uFE0F Could not load ${e} from ${o}: ${l.message}`)}let c=zr(n);if(c===n)break;n=c}return s.length===0?null:s.every(o=>typeof o=="string")?s.join(`
269
131
 
270
132
  ---
271
133
 
272
- `):n.every(s=>typeof s=="object")?Object.assign({},...n):n[n.length-1]}static async loadFile(e){let r=YW(e,"utf-8");if(e.endsWith(".json"))return JSON.parse(r);if(e.endsWith(".js")||e.endsWith(".mjs")){let{pathToFileURL:i}=await import("url"),n=await import(i(e).href);return n.default||n}return r}};ic();import{exec as QW}from"node:child_process";import{promisify as XW}from"node:util";import{existsSync as eG}from"node:fs";import{join as i_}from"node:path";import{homedir as o_}from"node:os";var Qz=XW(QW);async function s_(){try{return await Qz("cursor-agent --version"),"cursor-agent"}catch{let e=[i_(o_(),".local","bin","cursor-agent"),i_(o_(),".cursor","bin","cursor-agent"),i_(o_(),".cursor-agent","bin","cursor-agent")];for(let r of e)if(eG(r))try{return await Qz(`"${r}" --version`),r}catch{}return null}}async function tG(){return await s_()!==null}function rG(){return`
134
+ `):s.every(o=>typeof o=="object")?Object.assign({},...s):s[s.length-1]}static async loadFile(e){let t=jn(e,"utf-8");if(e.endsWith(".json"))return JSON.parse(t);if(e.endsWith(".js")||e.endsWith(".mjs")){let{pathToFileURL:r}=await import("url"),s=await import(r(e).href);return s.default||s}return t}};Je();import{exec as Gn}from"node:child_process";import{promisify as zn}from"node:util";import{existsSync as Jn}from"node:fs";import{join as jt}from"node:path";import{homedir as Gt}from"node:os";var Jr=zn(Gn);async function zt(){try{return await Jr("cursor-agent --version"),"cursor-agent"}catch{let e=[jt(Gt(),".local","bin","cursor-agent"),jt(Gt(),".cursor","bin","cursor-agent"),jt(Gt(),".cursor-agent","bin","cursor-agent")];for(let t of e)if(Jn(t))try{return await Jr(`"${t}" --version`),t}catch{}return null}}async function Wn(){return await zt()!==null}function Yn(){return`
273
135
  \u274C cursor-agent CLI not found!
274
136
 
275
137
  To use the Cursor agent, install it from:
@@ -286,33 +148,33 @@ After installation:
286
148
  2. Or restart your terminal/shell
287
149
 
288
150
  Then retry your command.
289
- `}Ci();u_();bz();Ro();Ci();vs();import{mkdirSync as KV,existsSync as wz,writeFileSync as BV,unlinkSync as Lye}from"node:fs";import{join as Na,resolve as HV}from"node:path";import{config as qye}from"dotenv";import Fye from"handlebars";function Vye({traceFrom:t,sessionId:e,sessionPath:r,idSource:i,mkdirFresh:n}){if(process.env.ZIBBY_SESSION_LOG==="0"||process.env.ZIBBY_SESSION_LOG==="false")return;let o=typeof process.ppid=="number"?process.ppid:"n/a",s=`[zibby:session] from=${t} pid=${process.pid} ppid=${o} sessionId=${e} source=${i} mkdir=${n?"yes":"no"} path=${r}`;if(console.log(s),(process.env.ZIBBY_TRACE_SESSION==="1"||process.env.ZIBBY_TRACE_SESSION==="true")&&process.env.ZIBBY_SESSION_LOG!=="0"&&process.env.ZIBBY_SESSION_LOG!=="false"){let l=(new Error("session trace").stack||"").split(`
151
+ `}ee();Wt();fr();ee();le();import{mkdirSync as Gs,existsSync as dr,writeFileSync as Us,unlinkSync as Zo}from"node:fs";import{join as he,resolve as zs}from"node:path";import{config as Ho}from"dotenv";import{zodToJsonSchema as js}from"zod-to-json-schema";import Vo from"handlebars";function qo({traceFrom:i,sessionId:e,sessionPath:t,idSource:r,mkdirFresh:s}){if(process.env.ZIBBY_SESSION_LOG==="0"||process.env.ZIBBY_SESSION_LOG==="false")return;let n=typeof process.ppid=="number"?process.ppid:"n/a",o=`[zibby:session] from=${i} pid=${process.pid} ppid=${n} sessionId=${e} source=${r} mkdir=${s?"yes":"no"} path=${t}`;if(console.log(o),(process.env.ZIBBY_TRACE_SESSION==="1"||process.env.ZIBBY_TRACE_SESSION==="true")&&process.env.ZIBBY_SESSION_LOG!=="0"&&process.env.ZIBBY_SESSION_LOG!=="false"){let a=(new Error("session trace").stack||"").split(`
290
152
  `).slice(2,14).join(`
291
- `);console.log(`[zibby:session] stack (${t}):
292
- ${l}`)}}function JV(){return process.env.ZIBBY_RUN_SOURCE==="studio"||process.env.ZIBBY_KEEP_SESSION_ENV==="1"||process.env.ZIBBY_KEEP_SESSION_ENV==="true"}function Zv(){if(process.env.ZIBBY_RUN_SOURCE!=="studio")return;let t=process.env.ZIBBY_SESSION_PATH;if(!(t==null||String(t).trim()===""))try{return HV(String(t).trim())}catch{return String(t).trim()}}function Lv(){JV()||(delete process.env.ZIBBY_SESSION_PATH,delete process.env.ZIBBY_SESSION_ID)}function YV({sessionPath:t,sessionId:e}){t&&typeof t=="string"&&(process.env.ZIBBY_SESSION_PATH=t),e!=null&&String(e).trim()!==""&&(process.env.ZIBBY_SESSION_ID=String(e).trim())}function QV(t={}){let e=Yv.map(o=>process.env[o]).find(Boolean),r=Math.random().toString(36).slice(2,6),i=e||`${Date.now()}_${r}`,n=t.paths?.sessionPrefix;return n?`${n}_${i}`:i}function qv({cwd:t=process.cwd(),config:e={},initialState:r={},traceFrom:i="resolveWorkflowSession"}={}){let n=r.sessionPath,o=r.sessionTimestamp,s="initialState.sessionPath";if(!n&&process.env.ZIBBY_SESSION_PATH)try{let l=HV(String(process.env.ZIBBY_SESSION_PATH));l&&(n=l,s="ZIBBY_SESSION_PATH")}catch{}let a;if(n)a=String(n).split(/[/\\]/).filter(Boolean).pop(),o==null&&(o=Date.now());else{let l=process.env.ZIBBY_SESSION_ID&&String(process.env.ZIBBY_SESSION_ID).trim();if(l)a=l,s="ZIBBY_SESSION_ID";else{let d=e.sessionId!=null?String(e.sessionId).trim():"";d&&d!=="last"?(a=d,s="config.sessionId"):(a=QV(e),s="generated")}o=o??Date.now();let c=e.paths?.output||Yt;n=Na(t,c,Dn,a)}let u=!wz(n);return u&&KV(n,{recursive:!0}),Vye({traceFrom:i,sessionId:a,sessionPath:n,idSource:s,mkdirFresh:u}),YV({sessionPath:n,sessionId:a}),{sessionPath:n,sessionId:a,sessionTimestamp:o}}var $p=class{constructor(e={}){this.nodes=new Map,this.edges=new Map,this.entryPoint=null,this.middleware=Array.isArray(e.middleware)?[...e.middleware]:[],e.nodeMiddleware&&this.middleware.push(e.nodeMiddleware),this.nodeTypeMap=new Map,this.conditionalCodeMap=new Map,this.stateSchema=e.stateSchema||null,this.nodePrompts=new Map,this.nodeOptions=new Map,this._invokeAgent=e.invokeAgent||null}setStateSchema(e){return this.stateSchema=e,this}getStateSchema(){return this.stateSchema}addNode(e,r,i={}){let n=r instanceof za?r:new za(r);return n.name=e,this.nodes.set(e,n),i.prompt&&this.nodePrompts.set(e,i.prompt),Object.keys(i).length>0&&this.nodeOptions.set(e,i),this}addConditionalNode(e,r){let i=new xp({...r,name:e});return this.nodes.set(e,i),this}addEdge(e,r){return this.edges.set(e,r),this}setNodeType(e,r){return this.nodeTypeMap.set(e,r),this}addConditionalEdges(e,r,{labels:i}={}){return this.edges.set(e,{conditional:!0,routes:r,labels:i}),typeof r=="function"&&this.conditionalCodeMap.set(e,r.toString()),this}setEntryPoint(e){return this.entryPoint=e,this}use(e){return typeof e=="function"&&this.middleware.push(e),this}_composeMiddleware(e,r,i,n,o){let s=i;for(let a=e.length-1;a>=0;a--){let u=e[a],l=s;s=()=>u(r,l,n,o)}return s()}serialize(){let e=[],r={};for(let[o,s]of this.nodes){let a=this.nodeTypeMap.get(o)||o;e.push({id:o,type:a,data:{nodeType:a,label:o}});let u=s._isCustomCode||!1,l={};u&&typeof s.execute=="function"&&(l.customCode=s.execute.toString());let c=this.nodePrompts.get(o);if(c&&(l.prompt=c),typeof s.customExecute=="function"&&(l.executeCode=s.customExecute.toString()),s.outputSchema)try{if(typeof s.outputSchema._def<"u"){let f=Gr(s.outputSchema,{target:"openApi3"}),m=this._flattenJsonSchemaToVariables(f);l.outputSchema={jsonSchema:f,variables:m}}else l.outputSchema={schema:s.outputSchema}}catch(p){console.warn(`Failed to convert schema for ${o}:`,p.message)}let d=(this.resolvedToolsMap||{})[o];d?.toolIds&&(l.tools=d.toolIds),Object.keys(l).length>0&&(r[o]=l)}let i=[];for(let[o,s]of this.edges)if(typeof s=="string")i.push({source:o,target:s});else if(s.conditional){let a=this.conditionalCodeMap.get(o)||s.routes.toString(),u=this._inferConditionalTargets(s.routes),l=s.labels||{};for(let c of u){let d={source:o,target:c,data:{conditionalCode:a}};l[c]&&(d.label=l[c]),i.push(d)}}let n=null;if(this.stateSchema)try{n=Gr(this.stateSchema,{target:"openApi3"})}catch{n=this.stateSchema}return{nodes:e,edges:i,nodeConfigs:r,stateSchema:n}}_inferConditionalTargets(e){let r=e.toString(),i=new Set,n=/return\s+['"]([^'"]+)['"]/g,o;for(;(o=n.exec(r))!==null;)i.add(o[1]);return[...i]}_flattenJsonSchemaToVariables(e,r=""){let i=e;if(e.$ref&&e.definitions){let n=e.$ref.replace("#/definitions/","");i=e.definitions[n]||e}return this._flattenSchema(i,r)}_flattenSchema(e,r=""){if(!e||typeof e!="object")return[];let i=[],n=e.properties||{},o=e.required||[];for(let[s,a]of Object.entries(n)){let u=r?`${r}.${s}`:s,l=!o.includes(s);if(i.push({path:u,type:a.type||"unknown",label:a.description||this._formatLabel(s),optional:l}),a.type==="object"&&a.properties){let c=this._flattenSchema(a,u);i.push(...c)}if(a.type==="array"&&a.items?.type==="object"&&a.items.properties){let c=this._flattenSchema(a.items,`${u}[]`);i.push(...c)}}return i}_formatLabel(e){return e.replace(/([A-Z])/g," $1").replace(/^./,r=>r.toUpperCase()).trim()}_summarizeNodeOutput(e,r){if(!r||typeof r!="object")return[];let i=[];r.success!==void 0&&i.push(`Result: ${r.success?"passed":"failed"}`);for(let[n,o]of Object.entries(r))if(!(n==="success"||n==="raw"||n==="nextNode")){if(typeof o=="string"&&o.length<=80)i.push(`${n}: ${o}`);else if(Array.isArray(o)){let s=o.length,a=o.filter(l=>l?.passed===!0).length;if(o.some(l=>l?.passed!==void 0)){let l=s-a;i.push(`${n}: ${a}/${s} passed${l?`, ${l} failed`:""}`)}else i.push(`${n}: ${s} items`)}if(i.length>=4)break}return i}async run(e,r={}){if(!this.entryPoint)throw new Error("No entry point set for graph");let i=r.cwd||process.cwd();qye({path:Na(i,".env")});let n=r.config||{};if(!n||Object.keys(n).length===0)try{let w=Na(i,".zibby.config.js");wz(w)&&(n=(await import(w)).default||{})}catch{}process.env.EXECUTION_ID&&!n.agent?.strictMode&&(n.agent={...n.agent,strictMode:!0});let o=r.agentType;if(!o){let w=n?.agent;w?.provider?o=w.provider:w?.gemini?o="gemini":w?.claude?o="claude":w?.cursor?o="cursor":w?.codex?o="codex":o=process.env.AGENT_TYPE||"cursor"}let s=r.contextConfig||e?.config?.contextConfig||e?.config?.context||n?.context||{};if(this.stateSchema){let w=this.stateSchema.safeParse(r);if(!w.success){let S=w.error.issues.map(k=>`${k.path.join(".")}: ${k.message}`);throw console.error("\u274C Initial state validation failed:"),S.forEach(k=>console.error(` - ${k}`)),new Error(`State validation failed: ${S.join(", ")}`)}Mt.step("State validated against schema")}let a=Zv(),u=r.sessionPath||a;u||Lv();let{sessionPath:l,sessionTimestamp:c,sessionId:d}=qv({cwd:i,config:n,traceFrom:"WorkflowGraph.run",initialState:{sessionPath:u,sessionTimestamp:r.sessionTimestamp}});Mt.step(`Session ${d}`);let p=await Da.loadContext(r.specPath||"",i,s);Object.keys(p).length>0&&Mt.step(`Context loaded: ${Object.keys(p).join(", ")}`);let f=r.outputPath;!f&&r.specPath&&(e?.calculateOutputPath?f=e.calculateOutputPath(r.specPath):console.warn(`\u26A0\uFE0F outputPath not resolved (specPath=${r.specPath})`));let m=new oc({...r,config:n,agentType:o,outputPath:f,sessionPath:l,sessionTimestamp:c,context:p,resolvedTools:this.resolvedToolsMap||{}}),g=new Map;try{await import("@zibby/skills")}catch{}let{getSkill:v}=await Promise.resolve().then(()=>(Xi(),m_)),h=new Set;for(let[,w]of this.nodes)for(let S of w.config?.skills||[])h.add(S);for(let w of h){let S=v(w);if(typeof S?.middleware=="function")try{let k=await S.middleware();typeof k=="function"&&g.set(w,k)}catch{}}let y=this.entryPoint,_=[];for(;y&&y!=="END";){let w=Na(l,jp);if(wz(w)){console.warn(`
293
- \u{1F6D1} Studio stop requested \u2014 ending workflow.`);try{Lye(w)}catch{}if(e&&typeof e.cleanup=="function")try{await e.cleanup()}catch{}return Mt.step("Workflow stopped by Studio"),{success:!0,state:m.getAll(),executionLog:_,stoppedByStudio:!0}}let S=this.nodes.get(y);if(!S)throw new Error(`Node '${y}' not found in graph`);let k=JSON.stringify({sessionPath:l,sessionTimestamp:c,currentNode:y,createdAt:new Date().toISOString(),config:m.get("config")}),$=Na(l,ci);BV($,k,"utf-8");let P=m.get("config")?.paths?.output||Yt,j=Na(i,P,ci);KV(Na(i,P),{recursive:!0});try{BV(j,k,"utf-8")}catch{}let I=r.onPipelineProgress;if(typeof I=="function")try{I({cwd:i,sessionPath:l,sessionId:d,outputBase:m.get("config")?.paths?.output||Yt,currentNode:y})}catch{}let R=(this.resolvedToolsMap||{})[y]||null;m.set("_currentNodeTools",R);let q=m.get("nodeConfigs")||{};m.set("_currentNodeConfig",q[y]||{}),Mt.nodeStart(y);let O=Date.now(),Q=this.nodePrompts.get(y);if(!this._invokeAgent){let pe=await Promise.resolve().then(()=>(Uv(),yz));this._invokeAgent=pe.invokeAgent}let K=this._invokeAgent,st={state:m,invokeAgent:async(pe={},J={})=>{let T=J.prompt||"";if(Q)try{T=Fye.compile(Q,{noEscape:!0})(pe)}catch(x){throw console.error(`\u274C Template rendering failed for node '${y}':`,x.message),new Error(`Template rendering failed: ${x.message}`,{cause:x})}else if(!T)throw new Error(`No prompt template configured for node '${y}' and no prompt provided in options`);let G={state:m.getAll(),images:J.images||[]},C={model:J.model||m.get("model"),workspace:m.get("workspace"),schema:J.schema,...J};return K(T,G,C)},_coreInvokeAgent:K,agent:e,nodeId:y,promptTemplate:Q,getPromptTemplate:()=>Q,...m.getAll()};try{let pe=(S.config?.skills||[]).map(E=>g.get(E)).filter(Boolean),J=[...this.middleware,...pe],T;J.length>0?T=await this._composeMiddleware(J,y,async()=>S.execute(st,m),m.getAll(),m):T=await S.execute(st,m);let G=Date.now()-O;if(_.push({node:y,success:T.success,duration:G,timestamp:new Date().toISOString()}),!T.success){if(String(T.error||"").includes("Stopped from Zibby Studio")){if(Mt.step("Workflow stopped by Studio"),m.set("stoppedByStudio",!0),e&&typeof e.cleanup=="function")try{await e.cleanup()}catch{}return{success:!0,state:m.getAll(),executionLog:_,stoppedByStudio:!0}}m.append("errors",{node:y,error:T.error});let W=S.config?.retries||0,he=`${y}_retries`,me=m.getAll()[he]||0;if(me<W){Mt.stepInfo(`Retrying (attempt ${me+1}/${W})`),m.update({[he]:me+1,[`${y}_raw`]:T.raw});continue}throw Mt.nodeFailed(y,T.error,{duration:G}),new Error(`Node '${y}' failed after ${me} attempts: ${T.error}`)}m.update({[y]:T.output});let C=this._summarizeNodeOutput(y,T.output);Mt.nodeComplete(y,{duration:G,details:C});let x=this.edges.get(y);if(!x)y="END";else if(x.conditional){let E=m.getAll(),W=x.routes(E);Mt.route(y,W),y=W}else y=x}catch(pe){throw Mt.isInsideNode&&Mt.nodeFailed(y,pe.message,{duration:Date.now()-O}),m.set("failed",!0),m.set("failedAt",y),pe}}Mt.graphComplete();let b={success:!0,state:m.getAll(),executionLog:_};return e&&typeof e.onComplete=="function"&&await e.onComplete(b),b}};var ql=class t{constructor(e={}){this.config=e,this.adapter=null,this.paths=e.paths||{specs:"test-specs",generated:"tests"},this.agentCommand=e.agentCommand||"cursor-agent",this.buildArgs=e.buildArgs||((r,i=!0)=>{let n=["-p",r,"--approve-mcps","--force"];return i&&(n.push("--output-format","stream-json"),n.push("--stream-partial-output")),n})}static extractJsonFromStream(e){return Ri.extractResult(e)}async initialize(e){this.adapter=e,e&&!e.isConnected()&&await e.connect()}buildGraph(){throw new Error("buildGraph() must be implemented by subclass")}async onComplete(e){}async run(e,r={}){let i=this.buildGraph(),n=typeof e=="object"&&!Array.isArray(e)?{input:e,...e,...r}:{input:e,...r};return await i.run(this,n)}async executeNode(e,r){let{prompt:i,outputSchema:n,model:o}=e,s=typeof i=="function"?i(r):i;console.log(`
153
+ `);console.log(`[zibby:session] stack (${i}):
154
+ ${a}`)}}function Js(){return process.env.ZIBBY_RUN_SOURCE==="studio"||process.env.ZIBBY_KEEP_SESSION_ENV==="1"||process.env.ZIBBY_KEEP_SESSION_ENV==="true"}function $t(){if(process.env.ZIBBY_RUN_SOURCE!=="studio")return;let i=process.env.ZIBBY_SESSION_PATH;if(!(i==null||String(i).trim()===""))try{return zs(String(i).trim())}catch{return String(i).trim()}}function It(){Js()||(delete process.env.ZIBBY_SESSION_PATH,delete process.env.ZIBBY_SESSION_ID)}function Ws({sessionPath:i,sessionId:e}){i&&typeof i=="string"&&(process.env.ZIBBY_SESSION_PATH=i),e!=null&&String(e).trim()!==""&&(process.env.ZIBBY_SESSION_ID=String(e).trim())}function Ys(i={}){let e=kt.map(n=>process.env[n]).find(Boolean),t=Math.random().toString(36).slice(2,6),r=e||`${Date.now()}_${t}`,s=i.paths?.sessionPrefix;return s?`${s}_${r}`:r}function At({cwd:i=process.cwd(),config:e={},initialState:t={},traceFrom:r="resolveWorkflowSession"}={}){let s=t.sessionPath,n=t.sessionTimestamp,o="initialState.sessionPath";if(!s&&process.env.ZIBBY_SESSION_PATH)try{let a=zs(String(process.env.ZIBBY_SESSION_PATH));a&&(s=a,o="ZIBBY_SESSION_PATH")}catch{}let c;if(s)c=String(s).split(/[/\\]/).filter(Boolean).pop(),n==null&&(n=Date.now());else{let a=process.env.ZIBBY_SESSION_ID&&String(process.env.ZIBBY_SESSION_ID).trim();if(a)c=a,o="ZIBBY_SESSION_ID";else{let p=e.sessionId!=null?String(e.sessionId).trim():"";p&&p!=="last"?(c=p,o="config.sessionId"):(c=Ys(e),o="generated")}n=n??Date.now();let u=e.paths?.output||B;s=he(i,u,H,c)}let l=!dr(s);return l&&Gs(s,{recursive:!0}),qo({traceFrom:r,sessionId:c,sessionPath:s,idSource:o,mkdirFresh:l}),Ws({sessionPath:s,sessionId:c}),{sessionPath:s,sessionId:c,sessionTimestamp:n}}var et=class{constructor(e={}){this.nodes=new Map,this.edges=new Map,this.entryPoint=null,this.middleware=Array.isArray(e.middleware)?[...e.middleware]:[],e.nodeMiddleware&&this.middleware.push(e.nodeMiddleware),this.nodeTypeMap=new Map,this.conditionalCodeMap=new Map,this.stateSchema=e.stateSchema||null,this.nodePrompts=new Map,this.nodeOptions=new Map,this._invokeAgent=e.invokeAgent||null}setStateSchema(e){return this.stateSchema=e,this}getStateSchema(){return this.stateSchema}addNode(e,t,r={}){let s=t instanceof me?t:new me(t);return s.name=e,this.nodes.set(e,s),r.prompt&&this.nodePrompts.set(e,r.prompt),Object.keys(r).length>0&&this.nodeOptions.set(e,r),this}addConditionalNode(e,t){let r=new Qe({...t,name:e});return this.nodes.set(e,r),this}addEdge(e,t){return this.edges.set(e,t),this}setNodeType(e,t){return this.nodeTypeMap.set(e,t),this}addConditionalEdges(e,t,{labels:r}={}){return this.edges.set(e,{conditional:!0,routes:t,labels:r}),typeof t=="function"&&this.conditionalCodeMap.set(e,t.toString()),this}setEntryPoint(e){return this.entryPoint=e,this}use(e){return typeof e=="function"&&this.middleware.push(e),this}_composeMiddleware(e,t,r,s,n){let o=r;for(let c=e.length-1;c>=0;c--){let l=e[c],a=o;o=()=>l(t,a,s,n)}return o()}serialize(){let e=[],t={};for(let[n,o]of this.nodes){let c=this.nodeTypeMap.get(n)||n;e.push({id:n,type:c,data:{nodeType:c,label:n}});let l=o._isCustomCode||!1,a={};l&&typeof o.execute=="function"&&(a.customCode=o.execute.toString());let u=this.nodePrompts.get(n);if(u&&(a.prompt=u),typeof o.customExecute=="function"&&(a.executeCode=o.customExecute.toString()),o.outputSchema)try{if(typeof o.outputSchema._def<"u"){let f=js(o.outputSchema,{target:"openApi3"}),m=this._flattenJsonSchemaToVariables(f);a.outputSchema={jsonSchema:f,variables:m}}else a.outputSchema={schema:o.outputSchema}}catch(d){console.warn(`Failed to convert schema for ${n}:`,d.message)}let p=(this.resolvedToolsMap||{})[n];p?.toolIds&&(a.tools=p.toolIds),Object.keys(a).length>0&&(t[n]=a)}let r=[];for(let[n,o]of this.edges)if(typeof o=="string")r.push({source:n,target:o});else if(o.conditional){let c=this.conditionalCodeMap.get(n)||o.routes.toString(),l=this._inferConditionalTargets(o.routes),a=o.labels||{};for(let u of l){let p={source:n,target:u,data:{conditionalCode:c}};a[u]&&(p.label=a[u]),r.push(p)}}let s=null;if(this.stateSchema)try{s=js(this.stateSchema,{target:"openApi3"})}catch{s=this.stateSchema}return{nodes:e,edges:r,nodeConfigs:t,stateSchema:s}}_inferConditionalTargets(e){let t=e.toString(),r=new Set,s=/return\s+['"]([^'"]+)['"]/g,n;for(;(n=s.exec(t))!==null;)r.add(n[1]);return[...r]}_flattenJsonSchemaToVariables(e,t=""){let r=e;if(e.$ref&&e.definitions){let s=e.$ref.replace("#/definitions/","");r=e.definitions[s]||e}return this._flattenSchema(r,t)}_flattenSchema(e,t=""){if(!e||typeof e!="object")return[];let r=[],s=e.properties||{},n=e.required||[];for(let[o,c]of Object.entries(s)){let l=t?`${t}.${o}`:o,a=!n.includes(o);if(r.push({path:l,type:c.type||"unknown",label:c.description||this._formatLabel(o),optional:a}),c.type==="object"&&c.properties){let u=this._flattenSchema(c,l);r.push(...u)}if(c.type==="array"&&c.items?.type==="object"&&c.items.properties){let u=this._flattenSchema(c.items,`${l}[]`);r.push(...u)}}return r}_formatLabel(e){return e.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase()).trim()}_summarizeNodeOutput(e,t){if(!t||typeof t!="object")return[];let r=[];t.success!==void 0&&r.push(`Result: ${t.success?"passed":"failed"}`);for(let[s,n]of Object.entries(t))if(!(s==="success"||s==="raw"||s==="nextNode")){if(typeof n=="string"&&n.length<=80)r.push(`${s}: ${n}`);else if(Array.isArray(n)){let o=n.length,c=n.filter(a=>a?.passed===!0).length;if(n.some(a=>a?.passed!==void 0)){let a=o-c;r.push(`${s}: ${c}/${o} passed${a?`, ${a} failed`:""}`)}else r.push(`${s}: ${o} items`)}if(r.length>=4)break}return r}async run(e,t={}){if(!this.entryPoint)throw new Error("No entry point set for graph");let r=t.cwd||process.cwd();Ho({path:he(r,".env")});let s=t.config||{};if(!s||Object.keys(s).length===0)try{let v=he(r,".zibby.config.js");dr(v)&&(s=(await import(v)).default||{})}catch{}process.env.EXECUTION_ID&&!s.agent?.strictMode&&(s.agent={...s.agent,strictMode:!0});let n=t.agentType;if(!n){let v=s?.agent;v?.provider?n=v.provider:v?.gemini?n="gemini":v?.claude?n="claude":v?.cursor?n="cursor":v?.codex?n="codex":n=process.env.AGENT_TYPE||"cursor"}let o=t.contextConfig||e?.config?.contextConfig||e?.config?.context||s?.context||{};if(this.stateSchema){let v=this.stateSchema.safeParse(t);if(!v.success){let $=v.error.issues.map(T=>`${T.path.join(".")}: ${T.message}`);throw console.error("\u274C Initial state validation failed:"),$.forEach(T=>console.error(` - ${T}`)),new Error(`State validation failed: ${$.join(", ")}`)}D.step("State validated against schema")}let c=$t(),l=t.sessionPath||c;l||It();let{sessionPath:a,sessionTimestamp:u,sessionId:p}=At({cwd:r,config:s,traceFrom:"WorkflowGraph.run",initialState:{sessionPath:l,sessionTimestamp:t.sessionTimestamp}});D.step(`Session ${p}`);let d=await we.loadContext(t.specPath||"",r,o);Object.keys(d).length>0&&D.step(`Context loaded: ${Object.keys(d).join(", ")}`);let f=t.outputPath;!f&&t.specPath&&(e?.calculateOutputPath?f=e.calculateOutputPath(t.specPath):console.warn(`\u26A0\uFE0F outputPath not resolved (specPath=${t.specPath})`));let m=new We({...t,config:s,agentType:n,outputPath:f,sessionPath:a,sessionTimestamp:u,context:d,resolvedTools:this.resolvedToolsMap||{}}),S=new Map;try{await import("@zibby/skills")}catch{}let{getSkill:g}=await Promise.resolve().then(()=>(se(),qt)),w=new Set;for(let[,v]of this.nodes)for(let $ of v.config?.skills||[])w.add($);for(let v of w){let $=g(v);if(typeof $?.middleware=="function")try{let T=await $.middleware();typeof T=="function"&&S.set(v,T)}catch{}}let y=this.entryPoint,E=[];for(;y&&y!=="END";){let v=he(a,ut);if(dr(v)){console.warn(`
155
+ \u{1F6D1} Studio stop requested \u2014 ending workflow.`);try{Zo(v)}catch{}if(e&&typeof e.cleanup=="function")try{await e.cleanup()}catch{}return D.step("Workflow stopped by Studio"),{success:!0,state:m.getAll(),executionLog:E,stoppedByStudio:!0}}let $=this.nodes.get(y);if(!$)throw new Error(`Node '${y}' not found in graph`);let T=JSON.stringify({sessionPath:a,sessionTimestamp:u,currentNode:y,createdAt:new Date().toISOString(),config:m.get("config")}),I=he(a,q);Us(I,T,"utf-8");let P=m.get("config")?.paths?.output||B,N=he(r,P,q);Gs(he(r,P),{recursive:!0});try{Us(N,T,"utf-8")}catch{}let b=t.onPipelineProgress;if(typeof b=="function")try{b({cwd:r,sessionPath:a,sessionId:p,outputBase:m.get("config")?.paths?.output||B,currentNode:y})}catch{}let A=(this.resolvedToolsMap||{})[y]||null;m.set("_currentNodeTools",A);let O=m.get("nodeConfigs")||{};m.set("_currentNodeConfig",O[y]||{}),D.nodeStart(y);let _=Date.now(),C=this.nodePrompts.get(y);if(!this._invokeAgent){let k=await Promise.resolve().then(()=>(Tt(),lr));this._invokeAgent=k.invokeAgent}let R=this._invokeAgent,U={state:m,invokeAgent:async(k={},W={})=>{let F=W.prompt||"";if(C)try{F=Vo.compile(C,{noEscape:!0})(k)}catch(re){throw console.error(`\u274C Template rendering failed for node '${y}':`,re.message),new Error(`Template rendering failed: ${re.message}`,{cause:re})}else if(!F)throw new Error(`No prompt template configured for node '${y}' and no prompt provided in options`);let Z={state:m.getAll(),images:W.images||[]},Ue={model:W.model||m.get("model"),workspace:m.get("workspace"),schema:W.schema,...W};return R(F,Z,Ue)},_coreInvokeAgent:R,agent:e,nodeId:y,promptTemplate:C,getPromptTemplate:()=>C,...m.getAll()};try{let k=($.config?.skills||[]).map(at=>S.get(at)).filter(Boolean),W=[...this.middleware,...k],F;W.length>0?F=await this._composeMiddleware(W,y,async()=>$.execute(U,m),m.getAll(),m):F=await $.execute(U,m);let Z=Date.now()-_;if(E.push({node:y,success:F.success,duration:Z,timestamp:new Date().toISOString()}),!F.success){if(String(F.error||"").includes("Stopped from Zibby Studio")){if(D.step("Workflow stopped by Studio"),m.set("stoppedByStudio",!0),e&&typeof e.cleanup=="function")try{await e.cleanup()}catch{}return{success:!0,state:m.getAll(),executionLog:E,stoppedByStudio:!0}}m.append("errors",{node:y,error:F.error});let je=$.config?.retries||0,Ir=`${y}_retries`,ct=m.getAll()[Ir]||0;if(ct<je){D.stepInfo(`Retrying (attempt ${ct+1}/${je})`),m.update({[Ir]:ct+1,[`${y}_raw`]:F.raw});continue}throw D.nodeFailed(y,F.error,{duration:Z}),new Error(`Node '${y}' failed after ${ct} attempts: ${F.error}`)}m.update({[y]:F.output});let Ue=this._summarizeNodeOutput(y,F.output);D.nodeComplete(y,{duration:Z,details:Ue});let re=this.edges.get(y);if(!re)y="END";else if(re.conditional){let at=m.getAll(),je=re.routes(at);D.route(y,je),y=je}else y=re}catch(k){throw D.isInsideNode&&D.nodeFailed(y,k.message,{duration:Date.now()-_}),m.set("failed",!0),m.set("failedAt",y),k}}D.graphComplete();let x={success:!0,state:m.getAll(),executionLog:E};return e&&typeof e.onComplete=="function"&&await e.onComplete(x),x}};var Ce=class i{constructor(e={}){this.config=e,this.adapter=null,this.paths=e.paths||{specs:"test-specs",generated:"tests"},this.agentCommand=e.agentCommand||"cursor-agent",this.buildArgs=e.buildArgs||((t,r=!0)=>{let s=["-p",t,"--approve-mcps","--force"];return r&&(s.push("--output-format","stream-json"),s.push("--stream-partial-output")),s})}static extractJsonFromStream(e){return te.extractResult(e)}async initialize(e){this.adapter=e,e&&!e.isConnected()&&await e.connect()}buildGraph(){throw new Error("buildGraph() must be implemented by subclass")}async onComplete(e){}async run(e,t={}){let r=this.buildGraph(),s=typeof e=="object"&&!Array.isArray(e)?{input:e,...e,...t}:{input:e,...t};return await r.run(this,s)}async executeNode(e,t){let{prompt:r,outputSchema:s,model:n}=e,o=typeof r=="function"?r(t):r;console.log(`
294
156
  \u{1F4DD} Prompt:
295
- ${s}
296
- `);let a=await this.executePrompt(s,r.cwd,3e5,o);console.log(`
157
+ ${o}
158
+ `);let c=await this.executePrompt(o,t.cwd,3e5,n);console.log(`
297
159
  \u{1F4E4} Raw Output:
298
- ${a}
299
- `);let u=null;if(n)try{if(u=t.extractJsonFromStream(a),!u)throw new Error("No valid result JSON found in output");console.log(`
160
+ ${c}
161
+ `);let l=null;if(s)try{if(l=i.extractJsonFromStream(c),!l)throw new Error("No valid result JSON found in output");console.log(`
300
162
  \u2705 Parsed Output:
301
- ${JSON.stringify(u,null,2)}
302
- `)}catch(l){console.warn(`\u26A0\uFE0F Failed to parse output as JSON: ${l.message}`)}return{success:!0,output:u,raw:a}}async cleanup(){this.adapter&&this.adapter.isConnected()&&await this.adapter.disconnect()}async executePrompt(e,r=process.cwd(),i=3e5,n=null,o=!0){let s=this.agentCommand;if(s==="cursor-agent"){let a=await s_();a&&(s=a)}return new Promise((a,u)=>{let l="",c=this.buildArgs(e,o);n&&c.push("--model",n);let d={...process.env},p=Wye(s,c,{cwd:r,env:d,stdio:["inherit","pipe","inherit"],shell:!1,detached:!1}),f=setTimeout(()=>{console.log(`
303
- \u23F1\uFE0F Timeout reached (${i/1e3}s) - killing agent...`),p.kill("SIGTERM"),setTimeout(()=>{p.killed||(console.log("\u26A0\uFE0F Forcing kill (SIGKILL)..."),p.kill("SIGKILL"))},2e3),u(new Error(`Agent timed out after ${i/1e3}s. The agent may be stuck or waiting for user input.`))},i),m=0,g=Date.now(),v=setInterval(()=>{if(l.length>m)m=l.length,g=Date.now();else{let b=Date.now()-g;b>1e4&&console.log(`\u23F3 AI agent is thinking... (${Math.floor(b/1e3)}s, ${l.length} bytes so far)`)}},1e4),h=()=>{clearTimeout(f),clearInterval(v),p&&!p.killed&&(p.kill("SIGTERM"),setTimeout(()=>{p.killed||p.kill("SIGKILL")},2e3))},y=()=>{console.log(`
163
+ ${JSON.stringify(l,null,2)}
164
+ `)}catch(a){console.warn(`\u26A0\uFE0F Failed to parse output as JSON: ${a.message}`)}return{success:!0,output:l,raw:c}}async cleanup(){this.adapter&&this.adapter.isConnected()&&await this.adapter.disconnect()}async executePrompt(e,t=process.cwd(),r=3e5,s=null,n=!0){let o=this.agentCommand;if(o==="cursor-agent"){let c=await zt();c&&(o=c)}return new Promise((c,l)=>{let a="",u=this.buildArgs(e,n);s&&u.push("--model",s);let p={...process.env},d=Xo(o,u,{cwd:t,env:p,stdio:["inherit","pipe","inherit"],shell:!1,detached:!1}),f=setTimeout(()=>{console.log(`
165
+ \u23F1\uFE0F Timeout reached (${r/1e3}s) - killing agent...`),d.kill("SIGTERM"),setTimeout(()=>{d.killed||(console.log("\u26A0\uFE0F Forcing kill (SIGKILL)..."),d.kill("SIGKILL"))},2e3),l(new Error(`Agent timed out after ${r/1e3}s. The agent may be stuck or waiting for user input.`))},r),m=0,S=Date.now(),g=setInterval(()=>{if(a.length>m)m=a.length,S=Date.now();else{let x=Date.now()-S;x>1e4&&console.log(`\u23F3 AI agent is thinking... (${Math.floor(x/1e3)}s, ${a.length} bytes so far)`)}},1e4),w=()=>{clearTimeout(f),clearInterval(g),d&&!d.killed&&(d.kill("SIGTERM"),setTimeout(()=>{d.killed||d.kill("SIGKILL")},2e3))},y=()=>{console.log(`
304
166
 
305
- \u{1F6D1} Interrupted by user (Ctrl+C)`),h(),u(new Error("Interrupted by user"))};process.on("SIGINT",y);let _=new Ri;p.stdout.on("data",b=>{let w=b.toString();l+=w;let S=_.processChunk(w);S&&(process.stdout.write(S,"utf8",()=>{process.stdout.isTTY&&process.stdout._flush&&process.stdout._flush()}),g=Date.now(),m+=S.length)}),p.on("close",b=>{process.off("SIGINT",y),clearTimeout(f),clearInterval(v);let w=_.flush();w&&process.stdout.write(w),l=_.getRawText();let S=_.getResult();b===0?a({raw:l,extracted:S}):u(new Error(`Agent exited with code ${b}`))}),p.on("error",b=>{process.off("SIGINT",y),clearTimeout(f),clearInterval(v),u(new Error(`Failed to spawn agent: ${b.message}`))})})}async runSingleNode(e,r,i){let n=r[e];if(!n)throw new Error(`Unknown node: ${e}. Available nodes: ${Object.keys(r).join(", ")}`);let{cwd:o}=i;if(!o)throw new Error("cwd is required for single node execution");let s=i.sessionPath,a=i.sessionTimestamp,u=i.config||{};if(!s){let y=process.env.CI_JOB_ID||process.env.GITHUB_RUN_ID||process.env.CIRCLE_WORKFLOW_ID||process.env.BUILD_ID||Date.now().toString(),_=u.paths?.sessionPrefix,b=_?`${_}_${y}`:y;a=a||Date.now();let w=u.paths?.output||Yt;s=Sz(o,w,Dn,b),Gye(s)||XV(s,{recursive:!0})}let l=u.paths?.output||Yt,c=Sz(o,l,ci);XV(Sz(o,l),{recursive:!0}),Bye(c,JSON.stringify({sessionPath:s,sessionTimestamp:a||s.split("/").pop(),currentNode:e,createdAt:new Date().toISOString()}),"utf-8"),console.log(`
306
- ${"=".repeat(80)}`),console.log(`\u{1F3AF} SINGLE NODE EXECUTION: ${e}`),console.log(`\u{1F4C1} Session: ${s.split("/").pop()}${i.sessionPath?" (reusing)":""}`),console.log(`${"=".repeat(80)}
307
- `);let d=await Da.loadContext(i.specPath||"",o,i.contextConfig||{}),{Node:p}=await Promise.resolve().then(()=>(bz(),GV)),{WorkflowState:f}=await Promise.resolve().then(()=>(u_(),Xz)),m=new f({...i,sessionPath:s,sessionTimestamp:a,context:d}),v=await new p(n).execute(this,m);return console.log(`
167
+ \u{1F6D1} Interrupted by user (Ctrl+C)`),w(),l(new Error("Interrupted by user"))};process.on("SIGINT",y);let E=new te;d.stdout.on("data",x=>{let v=x.toString();a+=v;let $=E.processChunk(v);$&&(process.stdout.write($,"utf8",()=>{process.stdout.isTTY&&process.stdout._flush&&process.stdout._flush()}),S=Date.now(),m+=$.length)}),d.on("close",x=>{process.off("SIGINT",y),clearTimeout(f),clearInterval(g);let v=E.flush();v&&process.stdout.write(v),a=E.getRawText();let $=E.getResult();x===0?c({raw:a,extracted:$}):l(new Error(`Agent exited with code ${x}`))}),d.on("error",x=>{process.off("SIGINT",y),clearTimeout(f),clearInterval(g),l(new Error(`Failed to spawn agent: ${x.message}`))})})}async runSingleNode(e,t,r){let s=t[e];if(!s)throw new Error(`Unknown node: ${e}. Available nodes: ${Object.keys(t).join(", ")}`);let{cwd:n}=r;if(!n)throw new Error("cwd is required for single node execution");let o=r.sessionPath,c=r.sessionTimestamp,l=r.config||{};if(!o){let y=process.env.CI_JOB_ID||process.env.GITHUB_RUN_ID||process.env.CIRCLE_WORKFLOW_ID||process.env.BUILD_ID||Date.now().toString(),E=l.paths?.sessionPrefix,x=E?`${E}_${y}`:y;c=c||Date.now();let v=l.paths?.output||B;o=mr(n,v,H,x),Qo(o)||Ks(o,{recursive:!0})}let a=l.paths?.output||B,u=mr(n,a,q);Ks(mr(n,a),{recursive:!0}),ei(u,JSON.stringify({sessionPath:o,sessionTimestamp:c||o.split("/").pop(),currentNode:e,createdAt:new Date().toISOString()}),"utf-8"),console.log(`
168
+ ${"=".repeat(80)}`),console.log(`\u{1F3AF} SINGLE NODE EXECUTION: ${e}`),console.log(`\u{1F4C1} Session: ${o.split("/").pop()}${r.sessionPath?" (reusing)":""}`),console.log(`${"=".repeat(80)}
169
+ `);let p=await we.loadContext(r.specPath||"",n,r.contextConfig||{}),{Node:d}=await Promise.resolve().then(()=>(fr(),Fs)),{WorkflowState:f}=await Promise.resolve().then(()=>(Wt(),Wr)),m=new f({...r,sessionPath:o,sessionTimestamp:c,context:p}),g=await new d(s).execute(this,m);return console.log(`
308
170
  ${"=".repeat(80)}`),console.log(`\u2705 Node ${e} completed`),console.log(`${"=".repeat(80)}
309
- `),{success:!0,output:v.output,outputPath:i.outputPath,state:v}}calculateOutputPath(e){let{specs:r,generated:i}=this.paths;if(!e)return`${i}/generated-test.spec.js`;let n=e.replace(new RegExp(`^${r}/`),"").replace(/\.[^.]+$/,".spec.js");return`${i}/${n}`.replace(/\/+/g,"/")}};function Kye(t,e={}){let r=new ql(e);return r.buildGraph=function(){let i=new $p;return t(i),i},e.onComplete&&(r.onComplete=e.onComplete),r}Un();import{writeFileSync as eW,existsSync as Hye,mkdirSync as Jye}from"node:fs";import{join as kz}from"node:path";var xz=class t{static saveTitle(e,r){let i=e.state.sessionPath;if(!i)return;let n=t._findInState(e.state,"title")||t._findInState(e.state,"result");if(!(!n||typeof n!="string"))try{let o=kz(i,"title.txt");eW(o,n,"utf-8"),U.info(`Saved title to session: "${n}"`)}catch(o){console.warn("\u26A0\uFE0F Could not save title file:",o.message)}}static _findInState(e,r){for(let[,i]of Object.entries(e))if(i&&typeof i=="object"&&i[r]!==void 0)return i[r]}static async saveExecutionData(e){let r=e.state.sessionPath;if(r)for(let[i,n]of Object.entries(e.state)){if(!n||typeof n!="object")continue;let o=Array.isArray(n.actions)&&n.actions.length>0,s=typeof n.scriptPath=="string"&&n.scriptPath.trim().length>0;if(!(!o&&!s))try{let a=kz(r,i);Hye(a)||Jye(a,{recursive:!0});let u=kz(a,"result.json");eW(u,JSON.stringify(n,null,2),"utf-8"),U.info(`Saved execution data to ${i} folder`),await this.onNodeSaved(a,n)}catch(a){console.warn(`\u26A0\uFE0F Could not save execution data for ${i}:`,a.message)}}}static async onNodeSaved(e,r){}static logResult(e,r){let i=Object.entries(e.state).filter(([,s])=>s&&typeof s=="object"&&s.success!==void 0),n=i.length>0&&i.every(([,s])=>s.success),o=i.some(([,s])=>s.success===!1);if(n)U.info("Workflow completed successfully."),r&&U.info(`Output: ${r}`);else if(o){let s=i.filter(([,a])=>!a.success).map(([a])=>a);U.info(`Workflow completed with failures in: ${s.join(", ")}`),r&&U.info(`Output: ${r}`)}return n}static handle(e,r,i){return this.saveTitle(e,r),this.saveExecutionData(e),this.logResult(e,i)}};Ga();Uv();QI();pz();Ci();Xi();var Yye={READ_FILE:"read_file",WRITE_FILE:"write_file",LIST_DIRECTORY:"list_directory",RUN_COMMAND:"run_command",OPEN_URL:"open_url",WAIT:"wait"},Qye={LIST_PROJECTS:"jira_list_projects",SEARCH:"jira_search",GET_ISSUE:"jira_get_issue",CREATE_ISSUE:"jira_create_issue",LIST_SPRINTS:"jira_list_sprints",GET_SPRINT_ISSUES:"jira_get_sprint_issues",GET_COMMENTS:"jira_get_comments",ADD_COMMENT:"jira_add_comment",EDIT_ISSUE:"jira_edit_issue",TRANSITION_ISSUE:"jira_transition_issue"},Xye={GET_USER:"github_get_user",LIST_ORGS:"github_list_orgs",LIST_REPOS:"github_list_repos",CLONE:"github_clone",SEARCH_REPOS:"github_search_repos",SEARCH_ISSUES:"github_search_issues",SEARCH_CODE:"github_search_code",GET_PR:"github_get_pr",GET_PR_DIFF:"github_get_pr_diff",LIST_PR_FILES:"github_list_pr_files",LIST_PR_COMMENTS:"github_list_pr_comments",LIST_COMMITS:"github_list_commits",GET_COMMIT:"github_get_commit",GET_FILE:"github_get_file",CREATE_ISSUE:"github_create_issue"},eve={LIST_CHANNELS:"slack_list_channels",POST_MESSAGE:"slack_post_message",REPLY_TO_THREAD:"slack_reply_to_thread",ADD_REACTION:"slack_add_reaction",GET_CHANNEL_HISTORY:"slack_get_channel_history",GET_THREAD_REPLIES:"slack_get_thread_replies",GET_USERS:"slack_get_users",GET_USER_PROFILE:"slack_get_user_profile"},tve={GENERATE:"run_generate",TEST:"run_test",STATUS:"run_status",CANCEL:"run_cancel",WAIT:"run_wait",ARTIFACTS:"run_artifacts",LIST_SPECS:"list_specs"},rve={GET_TEST_HISTORY:"memory_get_test_history",GET_SELECTORS:"memory_get_selectors",GET_PAGE_MODEL:"memory_get_page_model",GET_NAVIGATION:"memory_get_navigation",SAVE_INSIGHT:"memory_save_insight"},nve={STORE:"memory_store",RECALL:"memory_recall",BRIEF:"memory_brief",END_SESSION:"memory_end_session",TASK_LOG:"task_log",TASK_HISTORY:"task_history"},ive={INSTALL:"install_skill",UNINSTALL:"uninstall_skill",LIST_AVAILABLE:"list_available_skills"},Hje={...Yye,...Qye,...Xye,...eve,...tve,...rve,...nve,...ive};import{existsSync as ove,readFileSync as sve}from"node:fs";import{homedir as ave}from"node:os";import{join as uve}from"node:path";var Fv=new Map;function lve(){if(process.env.ZIBBY_USER_TOKEN)return process.env.ZIBBY_USER_TOKEN;try{let t=uve(ave(),".zibby","config.json");return ove(t)&&JSON.parse(sve(t,"utf-8")).sessionToken||null}catch{return null}}function cve(){return process.env.ZIBBY_ACCOUNT_API_URL?process.env.ZIBBY_ACCOUNT_API_URL.replace(/\/$/,""):(process.env.ZIBBY_ENV||"prod")==="local"?"http://localhost:3001":process.env.ZIBBY_PROD_ACCOUNT_API_URL||"https://account-api-prod.zibby.app"}async function dve(t){let e=Date.now(),r=Fv.get(t);if(r&&r.expiresAt>e)return r.data;let i=lve();if(!i)throw new Error("No session token. Run `zibby login` first.");let n=`${cve()}/integrations/token/${t}`,o=await fetch(n,{method:"GET",headers:{Authorization:`Bearer ${i}`}});if(!o.ok){let u=await o.text().catch(()=>"");throw o.status===404?new Error(`${t} is not connected. Connect it at https://studio.zibby.app/integrations`):o.status===401||o.status===403?new Error("Session expired. Run `zibby login` to re-authenticate."):new Error(`Failed to resolve ${t} token (${o.status}): ${u}`)}let s=await o.json();if(!s||typeof s!="object")throw new Error(`Invalid response from ${t} token endpoint: expected object, got ${typeof s}`);if(t==="jira"){if(!s.token||typeof s.token!="string")throw new Error(`Invalid jira token response: token is ${typeof s.token}, expected string`);if(!s.cloudId)throw new Error("Invalid jira token response: missing cloudId")}else if(t==="github"&&(!s.token||typeof s.token!="string"))throw new Error(`Invalid github token response: token is ${typeof s.token}, expected string`);let a=((s.expiresInSec||3e3)-120)*1e3;return Fv.set(t,{data:s,expiresAt:e+a}),s}function fve(t){t?Fv.delete(t):Fv.clear()}import{readdir as pve,access as tW,copyFile as mve,constants as rW}from"fs/promises";import{join as Vv,relative as hve}from"node:path";async function gve(t={}){let{testResultsDir:e="test-results",testsDir:r="tests",projectRoot:i=process.cwd(),verbose:n=!0}=t;n&&console.log(`\u{1F3A5} Organizing test videos...
310
- `);let o=Vv(i,e),s=Vv(i,r);try{let a=await pve(o),u=0;for(let l of a){if(l.startsWith("."))continue;let c=Vv(o,l,"video.webm");try{await tW(c,rW.F_OK)}catch{continue}let d=l.replace(/-chromium$/,"").replace(/-firefox$/,"").replace(/-webkit$/,""),p=await yve(s,d);if(p){let f=p.replace(/\.spec\.(js|ts)$/,".spec.webm");await mve(c,f),n&&console.log(`\u2705 ${hve(i,f)}`),u++}else n&&console.log(`\u26A0\uFE0F Could not find test file for: ${l}`)}return n&&(console.log(`
311
- \u{1F3AC} Organized ${u} video(s)`),console.log(`\u{1F4C2} Videos are now next to their test files in ${r}/`)),{movedCount:u,success:!0}}catch(a){return n&&console.error("\u274C Error organizing videos:",a.message),{movedCount:0,success:!1,error:a.message}}}async function yve(t,e){let r=e.split("-");for(let i=r.length;i>0;i--){let o=r.slice(0,i).join("/");for(let s of["js","ts"]){let a=Vv(t,`${o}.spec.${s}`);try{return await tW(a,rW.F_OK),a}catch{}}}return null}var Ip=class{constructor(e,r={}){this.apiKey=e,this.baseUrl=r.baseUrl||process.env.ZIBBY_API_URL||"https://api-prod.zibby.app",this.enabled=!!e}isEnabled(){return this.enabled}};function nW(){let t=process.env.ZIBBY_API_KEY;return new Ip(t)}import{execSync as vve}from"node:child_process";import{existsSync as _ve,mkdirSync as bve}from"node:fs";import{join as wve}from"node:path";async function Sve(t={}){let{baseDir:e="/workspace/repos",repos:r=null,depth:i=1,branch:n=null}=t,o=process.env.REPOS;if(!o)throw new Error("REPOS environment variable not set. Are you running in a Zibby workflow container?");let s;try{s=JSON.parse(o)}catch(l){throw new Error(`Failed to parse REPOS env var: ${l.message}`,{cause:l})}if(!Array.isArray(s)||s.length===0)throw new Error("No repositories configured for this project");let a=r?s.filter(l=>r.includes(l.name)):s;if(a.length===0)throw new Error(`No matching repositories found. Available: ${s.map(l=>l.name).join(", ")}`);_ve(e)||bve(e,{recursive:!0});let u={};return await Promise.all(a.map(async l=>{let c=l.provider||"github",d=c==="gitlab"?process.env.GITLAB_TOKEN:process.env.GITHUB_TOKEN;if(!d){console.error(`${c.toUpperCase()}_TOKEN not set, skipping ${l.name}`),u[l.name]=null;return}let p=l.name.replace(/\//g,"-"),f=wve(e,p),m=l.cloneUrl||l.url;if(!m){console.error(`Repository "${l.name}" has no clone URL`),u[l.name]=null;return}let g;c==="gitlab"?g=m.replace(/^https:\/\//,`https://oauth2:${d}@`):g=m.replace(/^https:\/\//,`https://x-access-token:${d}@`);let v=["clone"];i>0&&v.push("--depth",i.toString()),n&&v.push("--branch",n),v.push(g,f);let h=`git ${v.join(" ")}`;console.log(`Cloning ${l.name} (${c}) to ${f}...`);try{vve(h,{stdio:"pipe",env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),console.log(`Repository ${l.name} cloned successfully`),u[l.name]=f}catch(y){let _=y.message.replace(d,"***").replace(g,m);console.error(`Failed to clone ${l.name}: ${_}`),u[l.name]=null}})),u}import{spawn as iW}from"node:child_process";import{readFileSync as kve,writeFileSync as xve,existsSync as Wv}from"node:fs";import{homedir as oW}from"node:os";import{join as Fl}from"node:path";async function $ve(){let t=Fl(oW(),".local/share/cursor-agent/versions");if(!Wv(t))throw new Error(`cursor-agent not found at ${t}. Please install cursor-agent first.`);return console.log(`\u{1F527} Patching cursor-agent for CI/CD...
312
- `),new Promise((e,r)=>{let i=Fl(__dirname,"../../scripts/patch-cursor-mcp.py");if(!Wv(i)){r(new Error("Patch script not found"));return}let n=iW("python3",[i],{stdio:"inherit"});n.on("close",o=>{o===0?e({success:!0}):r(new Error(`Patch failed with code ${o}`))}),n.on("error",o=>{r(o)})})}function Ive(){let t=Fl(oW(),".local/share/cursor-agent/versions");if(!Wv(t))return{patched:!1,installed:!1};try{let e=Qi("fs").readdirSync(t);if(e.length===0)return{patched:!1,installed:!1};let r=e.sort().reverse()[0],i=Fl(t,r,"index.js");return Wv(i)?{patched:kve(i,"utf-8").includes("AUTO-APPROVE MCP TOOLS FOR CI/CD"),installed:!0,path:i}:{patched:!1,installed:!1}}catch(e){return{patched:!1,installed:!1,error:e.message}}}async function Eve(t){return console.log(`\u{1F511} Getting MCP approval keys...
313
- `),new Promise((e,r)=>{let i=iW("cursor-agent",["mcp","list"],{cwd:t,stdio:"pipe"}),n="";i.stdout.on("data",o=>{n+=o.toString(),process.stdout.write(o)}),i.stderr.on("data",o=>{process.stderr.write(o)}),i.on("close",o=>{if(o===0){let s=Pve(n);e({success:!0,keys:s,output:n})}else r(new Error(`Failed to get approval keys (exit code ${o})`))}),i.on("error",o=>{r(o)})})}function Pve(t){let e={},r=/🔑 APPROVAL KEY:\s+(\S+)\s+=>\s+(\S+)/g,i;for(;(i=r.exec(t))!==null;)e[i[1]]=i[2];return e}function Tve(t,e){let r=Fl(t,".cursor/projects"),i=Fl(r,"mcp-approvals.json");xve(i,JSON.stringify(e,null,2)),console.log(`
314
- \u2705 Saved approval keys to: ${i}
315
- `)}To();Ci();var sW=`
171
+ `),{success:!0,output:g.output,outputPath:r.outputPath,state:g}}calculateOutputPath(e){let{specs:t,generated:r}=this.paths;if(!e)return`${r}/generated-test.spec.js`;let s=e.replace(new RegExp(`^${t}/`),"").replace(/\.[^.]+$/,".spec.js");return`${r}/${s}`.replace(/\/+/g,"/")}};function ti(i,e={}){let t=new Ce(e);return t.buildGraph=function(){let r=new et;return i(r),r},e.onComplete&&(t.onComplete=e.onComplete),t}V();import{writeFileSync as Zs,existsSync as ri,mkdirSync as si}from"node:fs";import{join as hr}from"node:path";var gr=class i{static saveTitle(e,t){let r=e.state.sessionPath;if(!r)return;let s=i._findInState(e.state,"title")||i._findInState(e.state,"result");if(!(!s||typeof s!="string"))try{let n=hr(r,"title.txt");Zs(n,s,"utf-8"),h.info(`Saved title to session: "${s}"`)}catch(n){console.warn("\u26A0\uFE0F Could not save title file:",n.message)}}static _findInState(e,t){for(let[,r]of Object.entries(e))if(r&&typeof r=="object"&&r[t]!==void 0)return r[t]}static async saveExecutionData(e){let t=e.state.sessionPath;if(t)for(let[r,s]of Object.entries(e.state)){if(!s||typeof s!="object")continue;let n=Array.isArray(s.actions)&&s.actions.length>0,o=typeof s.scriptPath=="string"&&s.scriptPath.trim().length>0;if(!(!n&&!o))try{let c=hr(t,r);ri(c)||si(c,{recursive:!0});let l=hr(c,"result.json");Zs(l,JSON.stringify(s,null,2),"utf-8"),h.info(`Saved execution data to ${r} folder`),await this.onNodeSaved(c,s)}catch(c){console.warn(`\u26A0\uFE0F Could not save execution data for ${r}:`,c.message)}}}static async onNodeSaved(e,t){}static logResult(e,t){let r=Object.entries(e.state).filter(([,o])=>o&&typeof o=="object"&&o.success!==void 0),s=r.length>0&&r.every(([,o])=>o.success),n=r.some(([,o])=>o.success===!1);if(s)h.info("Workflow completed successfully."),t&&h.info(`Output: ${t}`);else if(n){let o=r.filter(([,c])=>!c.success).map(([c])=>c);h.info(`Workflow completed with failures in: ${o.join(", ")}`),t&&h.info(`Output: ${t}`)}return s}static handle(e,t,r){return this.saveTitle(e,t),this.saveExecutionData(e),this.logResult(e,r)}};Tt();nr();or();ee();se();import{z as vf}from"zod/v3";var ni={READ_FILE:"read_file",WRITE_FILE:"write_file",LIST_DIRECTORY:"list_directory",RUN_COMMAND:"run_command",OPEN_URL:"open_url",WAIT:"wait"},oi={LIST_PROJECTS:"jira_list_projects",SEARCH:"jira_search",GET_ISSUE:"jira_get_issue",CREATE_ISSUE:"jira_create_issue",LIST_SPRINTS:"jira_list_sprints",GET_SPRINT_ISSUES:"jira_get_sprint_issues",GET_COMMENTS:"jira_get_comments",ADD_COMMENT:"jira_add_comment",EDIT_ISSUE:"jira_edit_issue",TRANSITION_ISSUE:"jira_transition_issue"},ii={GET_USER:"github_get_user",LIST_ORGS:"github_list_orgs",LIST_REPOS:"github_list_repos",CLONE:"github_clone",SEARCH_REPOS:"github_search_repos",SEARCH_ISSUES:"github_search_issues",SEARCH_CODE:"github_search_code",GET_PR:"github_get_pr",GET_PR_DIFF:"github_get_pr_diff",LIST_PR_FILES:"github_list_pr_files",LIST_PR_COMMENTS:"github_list_pr_comments",LIST_COMMITS:"github_list_commits",GET_COMMIT:"github_get_commit",GET_FILE:"github_get_file",CREATE_ISSUE:"github_create_issue"},ai={LIST_CHANNELS:"slack_list_channels",POST_MESSAGE:"slack_post_message",REPLY_TO_THREAD:"slack_reply_to_thread",ADD_REACTION:"slack_add_reaction",GET_CHANNEL_HISTORY:"slack_get_channel_history",GET_THREAD_REPLIES:"slack_get_thread_replies",GET_USERS:"slack_get_users",GET_USER_PROFILE:"slack_get_user_profile"},ci={GENERATE:"run_generate",TEST:"run_test",STATUS:"run_status",CANCEL:"run_cancel",WAIT:"run_wait",ARTIFACTS:"run_artifacts",LIST_SPECS:"list_specs"},li={GET_TEST_HISTORY:"memory_get_test_history",GET_SELECTORS:"memory_get_selectors",GET_PAGE_MODEL:"memory_get_page_model",GET_NAVIGATION:"memory_get_navigation",SAVE_INSIGHT:"memory_save_insight"},ui={STORE:"memory_store",RECALL:"memory_recall",BRIEF:"memory_brief",END_SESSION:"memory_end_session",TASK_LOG:"task_log",TASK_HISTORY:"task_history"},pi={INSTALL:"install_skill",UNINSTALL:"uninstall_skill",LIST_AVAILABLE:"list_available_skills"},wu={...ni,...oi,...ii,...ai,...ci,...li,...ui,...pi};import{existsSync as fi,readFileSync as di}from"node:fs";import{homedir as mi}from"node:os";import{join as hi}from"node:path";var Ot=new Map;function gi(){if(process.env.ZIBBY_USER_TOKEN)return process.env.ZIBBY_USER_TOKEN;try{let i=hi(mi(),".zibby","config.json");return fi(i)&&JSON.parse(di(i,"utf-8")).sessionToken||null}catch{return null}}function yi(){return process.env.ZIBBY_ACCOUNT_API_URL?process.env.ZIBBY_ACCOUNT_API_URL.replace(/\/$/,""):(process.env.ZIBBY_ENV||"prod")==="local"?"http://localhost:3001":process.env.ZIBBY_PROD_ACCOUNT_API_URL||"https://account-api-prod.zibby.app"}async function Si(i){let e=Date.now(),t=Ot.get(i);if(t&&t.expiresAt>e)return t.data;let r=gi();if(!r)throw new Error("No session token. Run `zibby login` first.");let s=`${yi()}/integrations/token/${i}`,n=await fetch(s,{method:"GET",headers:{Authorization:`Bearer ${r}`}});if(!n.ok){let l=await n.text().catch(()=>"");throw n.status===404?new Error(`${i} is not connected. Connect it at https://studio.zibby.app/integrations`):n.status===401||n.status===403?new Error("Session expired. Run `zibby login` to re-authenticate."):new Error(`Failed to resolve ${i} token (${n.status}): ${l}`)}let o=await n.json();if(!o||typeof o!="object")throw new Error(`Invalid response from ${i} token endpoint: expected object, got ${typeof o}`);if(i==="jira"){if(!o.token||typeof o.token!="string")throw new Error(`Invalid jira token response: token is ${typeof o.token}, expected string`);if(!o.cloudId)throw new Error("Invalid jira token response: missing cloudId")}else if(i==="github"&&(!o.token||typeof o.token!="string"))throw new Error(`Invalid github token response: token is ${typeof o.token}, expected string`);let c=((o.expiresInSec||3e3)-120)*1e3;return Ot.set(i,{data:o,expiresAt:e+c}),o}function wi(i){i?Ot.delete(i):Ot.clear()}import{readdir as _i,access as Hs,copyFile as bi,constants as Vs}from"fs/promises";import{join as Pt,relative as xi}from"node:path";async function Ei(i={}){let{testResultsDir:e="test-results",testsDir:t="tests",projectRoot:r=process.cwd(),verbose:s=!0}=i;s&&console.log(`\u{1F3A5} Organizing test videos...
172
+ `);let n=Pt(r,e),o=Pt(r,t);try{let c=await _i(n),l=0;for(let a of c){if(a.startsWith("."))continue;let u=Pt(n,a,"video.webm");try{await Hs(u,Vs.F_OK)}catch{continue}let p=a.replace(/-chromium$/,"").replace(/-firefox$/,"").replace(/-webkit$/,""),d=await Ti(o,p);if(d){let f=d.replace(/\.spec\.(js|ts)$/,".spec.webm");await bi(u,f),s&&console.log(`\u2705 ${xi(r,f)}`),l++}else s&&console.log(`\u26A0\uFE0F Could not find test file for: ${a}`)}return s&&(console.log(`
173
+ \u{1F3AC} Organized ${l} video(s)`),console.log(`\u{1F4C2} Videos are now next to their test files in ${t}/`)),{movedCount:l,success:!0}}catch(c){return s&&console.error("\u274C Error organizing videos:",c.message),{movedCount:0,success:!1,error:c.message}}}async function Ti(i,e){let t=e.split("-");for(let r=t.length;r>0;r--){let n=t.slice(0,r).join("/");for(let o of["js","ts"]){let c=Pt(i,`${n}.spec.${o}`);try{return await Hs(c,Vs.F_OK),c}catch{}}}return null}var tt=class{constructor(e,t={}){this.apiKey=e,this.baseUrl=t.baseUrl||process.env.ZIBBY_API_URL||"https://api-prod.zibby.app",this.enabled=!!e}isEnabled(){return this.enabled}};function qs(){let i=process.env.ZIBBY_API_KEY;return new tt(i)}import{execSync as vi}from"node:child_process";import{existsSync as $i,mkdirSync as Ii}from"node:fs";import{join as Ai}from"node:path";async function Oi(i={}){let{baseDir:e="/workspace/repos",repos:t=null,depth:r=1,branch:s=null}=i,n=process.env.REPOS;if(!n)throw new Error("REPOS environment variable not set. Are you running in a Zibby workflow container?");let o;try{o=JSON.parse(n)}catch(a){throw new Error(`Failed to parse REPOS env var: ${a.message}`,{cause:a})}if(!Array.isArray(o)||o.length===0)throw new Error("No repositories configured for this project");let c=t?o.filter(a=>t.includes(a.name)):o;if(c.length===0)throw new Error(`No matching repositories found. Available: ${o.map(a=>a.name).join(", ")}`);$i(e)||Ii(e,{recursive:!0});let l={};return await Promise.all(c.map(async a=>{let u=a.provider||"github",p=u==="gitlab"?process.env.GITLAB_TOKEN:process.env.GITHUB_TOKEN;if(!p){console.error(`${u.toUpperCase()}_TOKEN not set, skipping ${a.name}`),l[a.name]=null;return}let d=a.name.replace(/\//g,"-"),f=Ai(e,d),m=a.cloneUrl||a.url;if(!m){console.error(`Repository "${a.name}" has no clone URL`),l[a.name]=null;return}let S;u==="gitlab"?S=m.replace(/^https:\/\//,`https://oauth2:${p}@`):S=m.replace(/^https:\/\//,`https://x-access-token:${p}@`);let g=["clone"];r>0&&g.push("--depth",r.toString()),s&&g.push("--branch",s),g.push(S,f);let w=`git ${g.join(" ")}`;console.log(`Cloning ${a.name} (${u}) to ${f}...`);try{vi(w,{stdio:"pipe",env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),console.log(`Repository ${a.name} cloned successfully`),l[a.name]=f}catch(y){let E=y.message.replace(p,"***").replace(S,m);console.error(`Failed to clone ${a.name}: ${E}`),l[a.name]=null}})),l}import{spawn as Xs}from"node:child_process";import{readFileSync as Pi,writeFileSync as Ci,existsSync as Ct}from"node:fs";import{homedir as Qs}from"node:os";import{join as Ne}from"node:path";async function Ni(){let i=Ne(Qs(),".local/share/cursor-agent/versions");if(!Ct(i))throw new Error(`cursor-agent not found at ${i}. Please install cursor-agent first.`);return console.log(`\u{1F527} Patching cursor-agent for CI/CD...
174
+ `),new Promise((e,t)=>{let r=Ne(__dirname,"../../scripts/patch-cursor-mcp.py");if(!Ct(r)){t(new Error("Patch script not found"));return}let s=Xs("python3",[r],{stdio:"inherit"});s.on("close",n=>{n===0?e({success:!0}):t(new Error(`Patch failed with code ${n}`))}),s.on("error",n=>{t(n)})})}function Ri(){let i=Ne(Qs(),".local/share/cursor-agent/versions");if(!Ct(i))return{patched:!1,installed:!1};try{let e=wn("fs").readdirSync(i);if(e.length===0)return{patched:!1,installed:!1};let t=e.sort().reverse()[0],r=Ne(i,t,"index.js");return Ct(r)?{patched:Pi(r,"utf-8").includes("AUTO-APPROVE MCP TOOLS FOR CI/CD"),installed:!0,path:r}:{patched:!1,installed:!1}}catch(e){return{patched:!1,installed:!1,error:e.message}}}async function ki(i){return console.log(`\u{1F511} Getting MCP approval keys...
175
+ `),new Promise((e,t)=>{let r=Xs("cursor-agent",["mcp","list"],{cwd:i,stdio:"pipe"}),s="";r.stdout.on("data",n=>{s+=n.toString(),process.stdout.write(n)}),r.stderr.on("data",n=>{process.stderr.write(n)}),r.on("close",n=>{if(n===0){let o=Mi(s);e({success:!0,keys:o,output:s})}else t(new Error(`Failed to get approval keys (exit code ${n})`))}),r.on("error",n=>{t(n)})})}function Mi(i){let e={},t=/🔑 APPROVAL KEY:\s+(\S+)\s+=>\s+(\S+)/g,r;for(;(r=t.exec(i))!==null;)e[r[1]]=r[2];return e}function Li(i,e){let t=Ne(i,".cursor/projects"),r=Ne(t,"mcp-approvals.json");Ci(r,JSON.stringify(e,null,2)),console.log(`
176
+ \u2705 Saved approval keys to: ${r}
177
+ `)}oe();ee();var en=`
316
178
  const style = document.createElement('style');
317
179
  style.textContent = \`
318
180
  @keyframes zibby-ripple {
@@ -373,7 +235,7 @@ ${"=".repeat(80)}`),console.log(`\u2705 Node ${e} completed`),console.log(`${"="
373
235
  setTimeout(() => ripple.remove(), 600);
374
236
  }
375
237
  };
376
- `;function Ove(t){return t.addInitScript(sW)}function zve(){return`
238
+ `;function Di(i){return i.addInitScript(en)}function Bi(){return`
377
239
  async function showRipple(page, locator) {
378
240
  const box = await locator.boundingBox().catch(() => null);
379
241
  if (box) {
@@ -386,97 +248,97 @@ async function showRipple(page, locator) {
386
248
  }, { x, y }).catch(() => {});
387
249
  }
388
250
  }
389
- `.trim()}var Ep=class{static generate(e,r="element"){let{selectors:i}=e;if(!i||typeof i!="object")return this.generateFallbackSelector(e,r);let n=[];return i.role&&n.push(this.generateRoleSelector(i.role)),i.attributes&&n.push(this.generateAttributeSelector(i.attributes)),i.partialMatch&&n.push(this.generatePartialMatchSelector(i.partialMatch)),i.structure&&n.push(this.generateStructuralSelector(i.structure)),n.length===0?this.generateFallbackSelector(e,r):n.length===1?`const ${r} = ${n[0]};`:`const ${r} = ${n[0]}
390
- ${n.slice(1).map(s=>` .or(${s})`).join(`
391
- `)};`}static generateRoleSelector(e){let{role:r,name:i}=e;if(!r)return null;if(i){let n=this.escapeRegex(i);return`page.getByRole('${r}', { name: /${n}/i })`}return`page.getByRole('${r}')`}static generateAttributeSelector(e){if(!e||typeof e!="object")return null;let r=Object.entries(e).filter(([n,o])=>o!=null).map(([n,o])=>n==="placeholder"||n==="aria-label"?n==="placeholder"?`page.getByPlaceholder('${this.escapeString(o)}')`:`page.locator('[${n}="${this.escapeString(o)}"]')`:`[${n}="${this.escapeString(o)}"]`);if(e.placeholder)return`page.getByPlaceholder('${this.escapeString(e.placeholder)}')`;let i=r.filter(n=>!n.startsWith("page.")).join("");return i?`page.locator('${i}')`:null}static generatePartialMatchSelector(e){if(!e||typeof e!="object")return null;let r=Object.entries(e).filter(([i,n])=>n!==void 0).map(([i,n])=>{let o=n.replace(/^\^/,"");return`[${i}^="${this.escapeString(o)}"]`});return r.length>0?`page.locator('${r.join("")}')`:null}static generateStructuralSelector(e){return!e||typeof e!="string"?null:`page.locator('${this.escapeString(e)}')`}static generateFallbackSelector(e,r){let{description:i,type:n}=e;if(n==="fill"||n==="type")return`const ${r} = page.locator('input').first();`;if(n==="click"){if(i.toLowerCase().includes("button"))return`const ${r} = page.locator('button').first();`;if(i.toLowerCase().includes("link"))return`const ${r} = page.locator('a').first();`}return`const ${r} = page.locator('body');`}static escapeString(e){return typeof e!="string"?String(e):e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}static escapeRegex(e){return typeof e!="string"?String(e):e.replace(/[.*+?^${}()[\]\\]/g,"\\$&")}static generateActionCode(e,r){let{type:i,value:n,description:o,selectors:s}=e,a=`element${r}`,u=this.generate(e,a),l=this.generateActionMethod(i,a,n);return`${u}
392
- ${l}`}static generateActionMethod(e,r,i){switch(e){case"fill":case"type":return`await ${r}.fill('${this.escapeString(i||"")}');`;case"click":return`await ${r}.click();`;case"navigate":return`await page.goto('${this.escapeString(i||"")}');`;case"wait":return`await page.waitForTimeout(${parseInt(i)||2e3});`;default:return`// Unknown action type: ${e}`}}static generateAssertionCode(e,r){let{description:i,expected:n,actual:o,passed:s}=e;return i.toLowerCase().includes("url")?`await expect(page).toHaveURL(/${this.escapeRegex(o)}/);`:i.toLowerCase().includes("visible")?"await expect(page.locator('body')).toBeVisible();":`// ${i}`}};import Pp from"fs/promises";var $z=class{static async generateFromEvents(e,r,i,n){try{console.log("[TestPostProcessor] \u{1F3AF} Generating test from events.json (100% accurate)");let{readFileSync:o}=await import("fs"),s=JSON.parse(o(r,"utf-8")),a=s.filter(f=>["navigate","type","fill","click","select_option"].includes(f.type)),u=a.filter(f=>f.type!=="navigate");console.log(`[TestPostProcessor] Found ${a.length} action events, ${i.length} trace actions`);let l=`import { ZibbyRuntime } from '@zibby/core';
251
+ `.trim()}var rt=class{static generate(e,t="element"){let{selectors:r}=e;if(!r||typeof r!="object")return this.generateFallbackSelector(e,t);let s=[];return r.role&&s.push(this.generateRoleSelector(r.role)),r.attributes&&s.push(this.generateAttributeSelector(r.attributes)),r.partialMatch&&s.push(this.generatePartialMatchSelector(r.partialMatch)),r.structure&&s.push(this.generateStructuralSelector(r.structure)),s.length===0?this.generateFallbackSelector(e,t):s.length===1?`const ${t} = ${s[0]};`:`const ${t} = ${s[0]}
252
+ ${s.slice(1).map(o=>` .or(${o})`).join(`
253
+ `)};`}static generateRoleSelector(e){let{role:t,name:r}=e;if(!t)return null;if(r){let s=this.escapeRegex(r);return`page.getByRole('${t}', { name: /${s}/i })`}return`page.getByRole('${t}')`}static generateAttributeSelector(e){if(!e||typeof e!="object")return null;let t=Object.entries(e).filter(([s,n])=>n!=null).map(([s,n])=>s==="placeholder"||s==="aria-label"?s==="placeholder"?`page.getByPlaceholder('${this.escapeString(n)}')`:`page.locator('[${s}="${this.escapeString(n)}"]')`:`[${s}="${this.escapeString(n)}"]`);if(e.placeholder)return`page.getByPlaceholder('${this.escapeString(e.placeholder)}')`;let r=t.filter(s=>!s.startsWith("page.")).join("");return r?`page.locator('${r}')`:null}static generatePartialMatchSelector(e){if(!e||typeof e!="object")return null;let t=Object.entries(e).filter(([r,s])=>s!==void 0).map(([r,s])=>{let n=s.replace(/^\^/,"");return`[${r}^="${this.escapeString(n)}"]`});return t.length>0?`page.locator('${t.join("")}')`:null}static generateStructuralSelector(e){return!e||typeof e!="string"?null:`page.locator('${this.escapeString(e)}')`}static generateFallbackSelector(e,t){let{description:r,type:s}=e;if(s==="fill"||s==="type")return`const ${t} = page.locator('input').first();`;if(s==="click"){if(r.toLowerCase().includes("button"))return`const ${t} = page.locator('button').first();`;if(r.toLowerCase().includes("link"))return`const ${t} = page.locator('a').first();`}return`const ${t} = page.locator('body');`}static escapeString(e){return typeof e!="string"?String(e):e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}static escapeRegex(e){return typeof e!="string"?String(e):e.replace(/[.*+?^${}()[\]\\]/g,"\\$&")}static generateActionCode(e,t){let{type:r,value:s,description:n,selectors:o}=e,c=`element${t}`,l=this.generate(e,c),a=this.generateActionMethod(r,c,s);return`${l}
254
+ ${a}`}static generateActionMethod(e,t,r){switch(e){case"fill":case"type":return`await ${t}.fill('${this.escapeString(r||"")}');`;case"click":return`await ${t}.click();`;case"navigate":return`await page.goto('${this.escapeString(r||"")}');`;case"wait":return`await page.waitForTimeout(${parseInt(r)||2e3});`;default:return`// Unknown action type: ${e}`}}static generateAssertionCode(e,t){let{description:r,expected:s,actual:n,passed:o}=e;return r.toLowerCase().includes("url")?`await expect(page).toHaveURL(/${this.escapeRegex(n)}/);`:r.toLowerCase().includes("visible")?"await expect(page.locator('body')).toBeVisible();":`// ${r}`}};import st from"fs/promises";var yr=class{static async generateFromEvents(e,t,r,s){try{console.log("[TestPostProcessor] \u{1F3AF} Generating test from events.json (100% accurate)");let{readFileSync:n}=await import("fs"),o=JSON.parse(n(t,"utf-8")),c=o.filter(f=>["navigate","type","fill","click","select_option"].includes(f.type)),l=c.filter(f=>f.type!=="navigate");console.log(`[TestPostProcessor] Found ${c.length} action events, ${r.length} trace actions`);let a=`import { ZibbyRuntime } from '@zibby/core';
393
255
  import { test, expect } from '@playwright/test';
394
256
 
395
- `;l+=`test('${n}', async ({ page }) => {
396
- `,l+=` const timestamp = Date.now();
397
-
398
- `;let c=0;for(let f of a)if(f.type==="navigate")l+=` await page.goto('${f.data.params.url}');
399
-
400
- `;else if(f.type==="type"||f.type==="fill"){let{element:m,text:g}=f.data.params,v=i[c]?.strategies||[];l+=` await ZibbyRuntime.step(page, ${JSON.stringify({name:m,action:"fill",value:g,strategies:v},null,2)});
401
-
402
- `,c++}else if(f.type==="click"){let{element:m}=f.data.params,g=i[c]?.strategies||[];l+=` await ZibbyRuntime.step(page, ${JSON.stringify({name:m,action:"click",value:"",strategies:g},null,2)});
403
-
404
- `,c++}else if(f.type==="select_option"){let{element:m,values:g}=f.data.params,v=i[c]?.strategies||[],h={name:m,action:"selectOption",value:Array.isArray(g)?g[0]:g,strategies:v};l+=` await ZibbyRuntime.step(page, ${JSON.stringify(h,null,2)});
405
-
406
- `,c++}l+=`});
407
- `;let{dirname:d}=await import("path"),{mkdirSync:p}=await import("fs");return p(d(e),{recursive:!0}),await Pp.writeFile(e,l,"utf-8"),console.log(`[TestPostProcessor] \u2705 Generated test with ${s.filter(f=>["type","fill","click","select_option"].includes(f.type)).length} actions`),!0}catch(o){return console.warn("[TestPostProcessor] Failed to generate from events:",o.message),!1}}static async enhanceSelectorsWithTrace(e,r,i){try{console.log("[TestPostProcessor] \u{1F6E1}\uFE0F Applying Zibby Safe Action Wrappers...");let n=await Pp.readFile(e,"utf-8");n.includes("ZibbyRuntime")||(n=`import { ZibbyRuntime } from '@zibby/core';
408
- ${n}`);for(let o=0;o<r.length;o++){let s=r[o],a=`element${o}`,u=new RegExp(`const ${a}\\b\\s*=\\s*page\\.[^;]+;(\\s*await ${a}\\.waitFor\\([^)]*\\);)?\\s*await ${a}\\.(click|fill|type|selectOption|pressSequentially)\\(([^)]*)\\);`,"s"),l=n.match(u);if(!l)continue;let c={name:s.name||`Action ${o}`,action:s.method==="type"?"fill":s.method,value:l[3].trim().replace(/^['"]|['"]$/g,""),strategies:s.strategies||[]},d=`await ZibbyRuntime.step(page, ${JSON.stringify(c,null,2)});`;n=n.replace(l[0],d)}return await Pp.writeFile(e,n,"utf-8"),console.log("[TestPostProcessor] \u2705 Successfully converted test to Resilient Zibby format"),!0}catch(n){return console.warn("[TestPostProcessor] Failed to apply safe wrappers:",n.message),!1}}static async enhanceSelectors(e,r){try{let{actions:i=[]}=r;if(!i.length)return!1;let n=await Pp.readFile(e,"utf-8"),o=this.buildSelectorMap(i);return n=this.replaceSimpleSelectors(n,o),await Pp.writeFile(e,n,"utf-8"),!0}catch(i){return console.warn("Failed to enhance selectors:",i),!1}}static buildSelectorMap(e){let r=new Map;for(let i=0;i<e.length;i++){let n=e[i];if(!n.selectors||n.type==="navigate")continue;let o=`element${i}`,a=Ep.generate(n,o).match(/= (.+);/s);if(a){let u=a[1].trim(),l=`${n.type}:${this.normalizeDescription(n.description)}`;r.set(l,u),n.selectors.role&&r.set(`role:${n.selectors.role.name}`,u),n.selectors.attributes?.placeholder&&r.set(`placeholder:${n.selectors.attributes.placeholder}`,u)}}return r}static replaceSimpleSelectors(e,r){let i=e,n=[/await page\.(getByRole|getByPlaceholder|getByText|getByLabel|locator)\([^)]+\)\.(fill|click|type)\([^)]*\)/g];for(let o of n)i=i.replace(o,s=>{for(let[a,u]of r.entries())if(s.includes(a.split(":")[1])){let l=s.match(/\.(fill|click|type)\(([^)]*)\)/);if(l){let[,c,d]=l,p="element";return`const ${p} = ${u};
409
- await ${p}.${c}(${d})`}}return s});return i}static normalizeDescription(e){return e?e.toLowerCase().replace(/[^a-z0-9]+/g," ").trim():""}};import{readFileSync as Nve,existsSync as aW,readdirSync as uW}from"node:fs";import{join as Iz}from"node:path";import{execSync as jve}from"node:child_process";import{tmpdir as Cve}from"node:os";var Tp=class{static async parseTraceZip(e){let r;if(e.endsWith(".zip")&&aW(e)){let i=Iz(Cve(),`trace-${Date.now()}`);jve(`unzip -q "${e}" -d "${i}"`,{stdio:"pipe"});let o=uW(i).find(s=>s.endsWith(".trace"));if(!o)throw new Error("No .trace file found in zip");r=Iz(i,o)}else if(aW(e)){let n=uW(e).find(o=>o.endsWith(".trace"));if(!n)throw new Error("No .trace file found");r=Iz(e,n)}else throw new Error(`Trace not found at ${e}`);try{let n=Nve(r,"utf-8").trim().split(`
410
- `),o=[],s=new Map,a=new Map;for(let u of n)try{let l=JSON.parse(u);if(l.type==="snapshot"&&l.snapshot&&l.snapshot.accessibility){let c=new Map;for(let d of l.snapshot.accessibility)d.ref&&c.set(d.ref,d);s.set(l.snapshotName,c)}if(l.type==="frame-snapshot"&&l.snapshot){let c=Buffer.from(l.snapshot.html||"","base64").toString("utf-8");c&&c.length>100&&a.set(l.pageId||"default",c)}}catch{}for(let u of n)try{let l=JSON.parse(u);if(l.type==="before"&&l.params&&l.params.selector){let c=l.method;if(["click","fill","type","selectOption"].includes(c)){let d=l.params.selector,p=l.params.text||l.params.value||"",f=[],m=null,g=null,v=null,h=d.match(/aria-ref=([a-z0-9]+)/i);if(h&&l.snapshotName){let I=h[1],R=s.get(l.snapshotName);if(R&&R.has(I)){let q=R.get(I);m=q.name||null,g=q.role||null,v=q.label||null,console.log(`[TraceParser] \u2705 Found ACTUAL element data: text="${m}", role="${g}"`)}}let y=d.match(/internal:text="([^"]+)"/i),_=d.match(/internal:label="([^"]+)"/i),b=d.match(/internal:placeholder="([^"]+)"/i),w=d.match(/internal:role=([^ ]+)/i),S=d.match(/internal:describe="([^"]+)"/i),k=d.match(/name="([^"]+)"/i);if(y){f.push({type:"text",text:y[1]});let I=y[1].split(" ");I.length>1&&(f.push({type:"text",text:I[0],fuzzy:!0}),f.push({type:"text",text:I[I.length-1],fuzzy:!0}))}if(_&&f.push({type:"label",label:_[1]}),b&&f.push({type:"placeholder",placeholder:b[1]}),m){f.unshift({type:"text",text:m,source:"accessibility-tree"});let I=m.split(" ");I.length>1&&f.push({type:"text",text:I[0],fuzzy:!0,source:"accessibility-tree"})}if(g||w){let I=g||w[1],R=m||(k?k[1]:y?y[1]:null);f.unshift({type:"role",role:I,name:R,source:m?"accessibility-tree":"selector"})}if(v&&f.unshift({type:"label",label:v,source:"accessibility-tree"}),S){let I=S[1],R=["link","button","textbox","menuitem","submenu","combobox","checkbox","radio","tab","treeitem","menu item"],q=null,O=I;for(let Q of R)if(I.toLowerCase().endsWith(` ${Q}`)){q=Q.replace(" ",""),O=I.substring(0,I.length-Q.length-1);break}if(q){f.push({type:"role",role:q,name:O});let Q=O.replace(/\s*\([^)]+\)\s*$/,"");f.push({type:"text",text:Q}),f.push({type:"text",text:O});let K=O.split(" ");K.length>1&&(f.push({type:"text",text:K[0],fuzzy:!0}),f.push({type:"text",text:K.slice(0,2).join(" "),fuzzy:!0}))}else{let Q=I.replace(/\s*\([^)]+\)\s*$/,"");f.push({type:"text",text:Q}),f.push({type:"text",text:I})}}let $=this.extractDOMStrategies(d,a,y?.[1]||S?.[1],l.pageId);f.push(...$);let P=this.extractStructuralContext(d);(P.parent||P.sibling)&&f.forEach(I=>{["role","text","label","testid"].includes(I.type)&&(P.parent&&(I.parent=P.parent),P.sibling&&(I.sibling=P.sibling))}),f.push({type:"css",value:d});let j=m||y?y[1]:S?S[1].replace(/\s*\([^)]+\)\s*$/,""):`Action ${o.length}`;o.push({method:c,name:j,action:c==="type"?"fill":c,value:p,strategies:f,timestamp:l.startTime,actualText:m,actualRole:g,actualAriaLabel:v})}}}catch{}return o}catch(i){throw new Error(`Failed to parse trace: ${i.message}`,{cause:i})}}static extractDOMStrategies(e,r,i,n){let o=[];if(!r||r.size===0||!i)return o;try{let s=r.get(n);if(!s)return o;let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),u=new RegExp(`data-testid=["']([^"']+)["'][^>]*>[^<]*${a}`,"i"),l=s.match(u);l&&o.push({type:"testid",value:l[1],priority:"high"});let c=new RegExp(`class=["']([^"']+)["'][^>]*>[^<]*${a}`,"gi"),d=s.matchAll(c);for(let m of d){let g=m[1].split(/\s+/).filter(v=>v&&!v.match(/^(css|jss|makeStyles|MuiBox|MuiStack)-\w+/)&&v.length>2);g.length>0&&(o.push({type:"class",value:g.join("."),priority:"medium"}),g.length===1&&o.push({type:"class",value:g[0],priority:"medium"}))}let p=new RegExp(`id=["']([^"']+)["'][^>]*>[^<]*${a}`,"i"),f=s.match(p);f&&!f[1].match(/^(root|app|\d+|[a-f0-9-]{20,})$/i)&&o.push({type:"id",value:f[1],priority:"high"})}catch(s){console.warn(`[TraceParser] DOM extraction failed: ${s.message}`)}return o}static extractStructuralContext(e){let r={parent:null,sibling:null},i=e.split(">>").map(s=>s.trim());if(i.length>1){let a=i[i.length-2].replace(/internal:text="[^"]+"\s*/gi,"").replace(/internal:role=\S+\s*/gi,"").replace(/internal:label="[^"]+"\s*/gi,"").trim();a&&(a.match(/^(form|section|nav|header|aside|main|article)\b/)||a.includes("[")||a.match(/[#.]\w/))&&(r.parent=a)}let o=i[i.length-1].match(/([^+~]+)\s*[+~]\s*(.+)/);return o&&(r.sibling=o[1].trim()),r}};ic();var Ez=class{static async step(e,r){let{name:i,action:n,value:o,strategies:s,options:a={timeout:1e4},enrichedData:u}=r;console.log(`[Zibby] \u26A1 Executing step: ${i}`),await this.waitForPageStability(e,a.timeout);let l=await this.findBestMatch(e,s,i);if(!l)throw new Error(`[Zibby] \u274C Failed to find "${i}" using ${s.length} strategies`);u?.position&&await this.verifyPosition(l,u.position),await this.performActionWithRetry(e,l,n,o,3),console.log(`[Zibby] \u2728 Step "${i}" completed.`)}static async waitForPageStability(e,r=1e4){try{await e.waitForLoadState("networkidle",{timeout:3e3}).catch(()=>{}),await e.evaluate(()=>new Promise(i=>{let n,o=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(()=>{o.disconnect(),i()},500)});o.observe(document.body,{childList:!0,subtree:!0,attributes:!0}),n=setTimeout(()=>{o.disconnect(),i()},500)})).catch(()=>{})}catch{}}static async verifyPosition(e,r){try{let i=await e.boundingBox();if(!i)return;let n=Math.abs(i.x-r.x),o=Math.abs(i.y-r.y);(n>50||o>50)&&(console.log(`[Zibby] \u26A0\uFE0F Element moved: expected (${r.x}, ${r.y}), got (${i.x}, ${i.y})`),await new Promise(s=>setTimeout(s,500)))}catch{}}static async performActionWithRetry(e,r,i,n,o=3){for(let s=1;s<=o;s++)try{i==="click"?await r.click():i==="fill"?await r.fill(n||""):i==="type"?await r.pressSequentially(n||""):i==="selectOption"&&await r.selectOption(n||"");return}catch(a){if(s===o)throw a;console.log(`[Zibby] \u26A0\uFE0F Action failed (attempt ${s}/${o}), retrying...`),await new Promise(u=>setTimeout(u,1e3*s))}}static async findBestMatch(e,r,i){let o=Date.now(),s=r.map(async(l,c)=>{try{let p=await this.getLocator(e,l).all();return p.length===0?[]:(await Promise.all(p.map(async(m,g)=>{try{if(!await m.isVisible({timeout:100}))return null;let h=await this.scoreCandidate(m,l,e);return{element:m,strategy:l,score:h,strategyIdx:c,elIdx:g}}catch{return null}}))).filter(m=>m!==null)}catch{return[]}}),a=(await Promise.all(s)).flat();if(a.length===0)return console.log(`[Zibby] \u274C No visible candidates found for "${i}"`),null;a.sort((l,c)=>c.score-l.score);let u=a[0];return console.log(`[Zibby] \u2705 Found element using ${u.strategy.type} (score: ${u.score.toFixed(2)}, ${a.length} candidates)`),u.element}static async scoreCandidate(e,r,i){let n=0;if(n+={testid:120,id:110,role:100,label:90,class:85,placeholder:85,text:80,css:50}[r.type]||50,r.priority==="high"&&(n+=20),r.priority==="medium"&&(n+=10),r.fuzzy&&(n-=15),r.parent)try{await e.locator("xpath=ancestor::*").first().evaluate((u,l)=>u.matches(l),r.parent)&&(n+=30)}catch{}if(r.sibling)try{await e.evaluate((a,u)=>a.parentElement?.querySelector(u)!==null,r.sibling)&&(n+=20)}catch{}try{let s=await e.boundingBox();s&&s.y<1e3&&(n+=10)}catch{}try{let s=await e.evaluate(a=>{let u=0,l=a;for(;l;)l.tagName==="IFRAME"&&u++,l=l.parentElement;return u});n-=s*5}catch{}return n}static getLocator(e,r){let i;switch(r.type){case"testid":i=e.getByTestId(r.value);break;case"id":i=e.locator(`#${r.value}`);break;case"class":i=e.locator(`.${r.value.replace(/\./g,".")}`);break;case"text":r.fuzzy?i=e.getByText(new RegExp(r.text,"i")):i=e.getByText(r.text,{exact:!1});break;case"role":i=e.getByRole(r.role,{name:r.name,exact:!1});break;case"label":i=e.getByLabel(r.label,{exact:!1});break;case"placeholder":i=e.getByPlaceholder(r.placeholder);break;default:{let n=r.value?.replace(/aria-ref=e\d+ >> /g,"")||r.css;i=e.locator(n);break}}return r.parent&&(i=i.filter({has:e.locator(r.parent)})),i}};var Pz=class{static async beforeEach(e){await this.injectStableIds(e),e.on("load",async()=>{await this.injectStableIds(e)})}static async afterNavigation(e){await e.waitForLoadState("domcontentloaded").catch(()=>{}),await this.injectStableIds(e)}static async clickWithRetry(e,r,i={}){let n=i.timeout||1e4,o=`[data-zibby-id="${r}"]`,s=Date.now();for(;Date.now()-s<n;){await this.injectStableIds(e);let a=e.locator(o);if(await a.count()>0)try{await a.click({timeout:2e3});return}catch(u){if(u.message.includes("intercepts pointer")){await a.click({force:!0});return}}await e.waitForTimeout(200)}throw new Error(`Element ${o} not found after ${n}ms`)}static async fillWithRetry(e,r,i,n=1e4){let o=`[data-zibby-id="${r}"]`,s=Date.now();for(;Date.now()-s<n;){await this.injectStableIds(e);let a=e.locator(o);if(await a.count()>0){await a.fill(i);return}await e.waitForTimeout(200)}throw new Error(`Element ${o} not found after ${n}ms`)}static async selectWithRetry(e,r,i,n=1e4){let o=`[data-zibby-id="${r}"]`,s=Date.now();for(;Date.now()-s<n;){await this.injectStableIds(e);let a=e.locator(o);if(await a.count()>0){await a.selectOption(i);return}await e.waitForTimeout(200)}throw new Error(`Element ${o} not found after ${n}ms`)}static async injectStableIds(e){try{await e.evaluate(()=>{function r(u){if(u.getAttribute("aria-label"))return u.getAttribute("aria-label").trim();let l=u.getAttribute("aria-labelledby");if(l){let p=document.getElementById(l);if(p)return p.textContent.trim()}if(u.id){let p=document.querySelector(`label[for="${u.id}"]`);if(p)return p.textContent.trim()}let c=u.closest("label");if(c){let p=c.cloneNode(!0);p.querySelectorAll("input, select, textarea").forEach(m=>m.remove());let f=p.textContent.trim();if(f)return f}if(u.placeholder)return u.placeholder;let d=u.tagName.toLowerCase();return d==="button"||d==="a"||u.getAttribute("role")==="button"?(u.textContent||"").trim().slice(0,50):u.title?u.title:d==="input"&&(u.type==="submit"||u.type==="button")&&u.value||""}function i(u){let l=[],c=u.closest("form");if(c)if(c.id)l.push(`form#${c.id}`);else if(c.name)l.push(`form[name=${c.name}]`);else if(c.action)try{let g=new URL(c.action,window.location.origin).pathname;l.push(`form[action=${g}]`)}catch{l.push(`form[action=${c.getAttribute("action")}]`)}else{let g=document.querySelectorAll("form"),v=Array.from(g).indexOf(c);l.push(`form:nth(${v})`)}let d=u.closest('header, nav, main, footer, aside, [role="banner"], [role="navigation"], [role="main"], [role="contentinfo"]');if(d){let g=d.tagName.toLowerCase(),v=d.getAttribute("role");l.push(v||g)}let p=u.closest('section, article, [role="region"]');if(p){let g=p.querySelector("h1, h2, h3, h4, h5, h6");g&&l.push(`section:${g.textContent.trim().slice(0,30)}`)}let f=u.closest("fieldset");if(f){let g=f.querySelector("legend");g&&l.push(`fieldset:${g.textContent.trim()}`)}let m=u.closest('dialog, [role="dialog"], [role="alertdialog"]');if(m){let g=m.querySelector('[role="heading"], h1, h2, h3');g?l.push(`dialog:${g.textContent.trim().slice(0,30)}`):l.push("dialog")}return l.join("/")}function n(u){let l=u.tagName.toLowerCase(),c=u.id||"",d=u.name||"",p=u.type||"",f=u.getAttribute("role")||"",m="";if(u.href)try{m=new URL(u.href,window.location.origin).pathname.slice(0,50)}catch{m=u.getAttribute("href")?.slice(0,50)||""}let g=r(u).slice(0,50).replace(/\s+/g," "),v=i(u),h=[l,c,d,p,f,m,g,v].join("|"),y=5381;for(let _=0;_<h.length;_++)y=(y<<5)+y^h.charCodeAt(_);return`zibby-${(y>>>0).toString(36)}`}let o=["button","a","input","select","textarea","label[for]",'[role="button"]','[role="link"]','[role="textbox"]','[role="checkbox"]','[role="radio"]','[role="combobox"]','[role="menuitem"]','[role="tab"]','[role="option"]','[role="switch"]','[role="slider"]',"[onclick]","[data-action]"].join(", "),s=new Map,a=0;document.querySelectorAll(o).forEach(u=>{let l=window.getComputedStyle(u);if(l.display==="none"||l.visibility==="hidden")return;let c=n(u),d=c,p=s.get(d)||0;p>0&&(c=`${d}-${p}`),s.set(d,p+1),u.setAttribute("data-zibby-id",c),a++}),console.log(`[Zibby] Injected ${a} stable IDs`)})}catch{}}};Un();vs();var Rve=8,Ave=1,Dve=64;function Uve(t){if(!t||typeof t!="object")return 8;let e=t.parallel;if(!e||typeof e!="object")return 8;let r=e.maxConcurrentRuns??e.maxConcurrent,i=Number(r);if(!Number.isFinite(i))return 8;let n=Math.floor(i);return n<1?8:Math.min(64,n)}import{readFileSync as Zve,writeFileSync as cW,existsSync as Lve}from"node:fs";import{join as dW}from"node:path";var Lr=class{constructor(e={}){this.config=e,this.enabled=e.enabled!==!1,this.priority=e.priority||50}getName(){throw new Error("EventEnricher.getName() must be implemented")}canEnrich(e){return this.enabled}async enrich(e,r){throw new Error("EventEnricher.enrich() must be implemented")}handleError(e,r){return console.warn(`[${this.getName()}] Enrichment failed for event ${r.type}:`,e.message),null}};import{existsSync as Mve}from"node:fs";import{join as lW}from"node:path";var ja=class extends Lr{constructor(e={}){super(e),this.priority=190,this.traceData=null}getName(){return"TraceText"}getPriority(){return this.priority}async loadTrace(e){if(this.traceData)return;let r=lW(e,"traces"),i=lW(e,"trace.zip");if(Mve(i))try{this.traceData=await Tp.parseTraceZip(i),console.log(`[TraceTextEnricher] \u2705 Loaded trace with ${this.traceData.length} actions`)}catch(n){console.log(`[TraceTextEnricher] \u26A0\uFE0F Failed to parse trace: ${n.message}`)}}async enrich(e,r){let i=e.data?.params?.ref,n=e.id;if(i===void 0&&n===void 0||(!this.traceData&&r.sessionPath&&await this.loadTrace(r.sessionPath),!this.traceData))return null;let o=this.traceData[n];if(!o)return console.log(`[TraceTextEnricher] \u26A0\uFE0F No trace action for event ${n}`),null;let s=o.actualText||this._extractTextFromSelector(o.selector),a=o.actualRole,u=o.actualAriaLabel;return s||a||u?(console.log(`[TraceTextEnricher] \u2705 Event ${n}: text="${s}", role="${a}", label="${u}"`),{traceActualText:s,traceActualRole:a,traceActualAriaLabel:u,traceSelector:o.selector,traceStrategies:o.strategies}):null}_extractTextFromSelector(e){if(!e)return null;let r=e.match(/internal:label="([^"]+)"/);if(r)return r[1];let i=e.match(/internal:text="([^"]+)"/);if(i)return i[1];let n=e.match(/getByText\(['"]([^'"]+)['"]\)/);if(n)return n[1];let o=e.match(/name:\s*['"]([^'"]+)['"]/);return o?o[1]:null}};async function qve(t){let e=dW(t,"events.json"),r=dW(t,"events-enriched.json");if(!Lve(e))return console.log("[PostProcess] No events.json found"),{enriched:0,failed:0};try{let i=JSON.parse(Zve(e,"utf-8")),n=new ja,o=0,s=0;for(let a of i)try{let u=await n.enrich(a,{sessionPath:t});u&&(a.enrichedData={...a.enrichedData||{},...u},o++)}catch(u){console.log(`[PostProcess] Failed to enrich event ${a.id}: ${u.message}`),s++}return o>0&&(cW(r,JSON.stringify(i,null,2)),cW(e,JSON.stringify(i,null,2)),console.log(`[PostProcess] \u2705 Enriched ${o} events (${s} failed)`)),{enriched:o,failed:s}}catch(i){return console.log(`[PostProcess] \u274C Failed to post-process events: ${i.message}`),{enriched:0,failed:0}}}import{spawn as Fve}from"node:child_process";import{existsSync as Vve}from"node:fs";import{dirname as Wve,resolve as fW,relative as Gve}from"node:path";var Gv=new Map,Op=8,pW={name:"run_playwright_test",description:`Run a Playwright test file and return results. Use this after writing a test to verify it works. If it fails, fix the issues and run again. Maximum ${Op} attempts per session.`,inputSchema:{type:"object",properties:{scriptPath:{type:"string",description:"Path to the Playwright test file (e.g., tests/login.spec.js)"}},required:["scriptPath"]},async execute({scriptPath:t},e){let i=`${e?.sessionId||"default"}:${t}`,n=(Gv.get(i)||0)+1;if(Gv.set(i,n),n>Op)return{success:!1,executionCount:n,maxReached:!0,error:`Maximum ${Op} executions reached. Stop retrying and return your best result.`};let o=e?.projectRoot||process.cwd(),s=fW(o,t),a=Gve(o,s);return a.startsWith("..")||fW(s)!==s&&a.includes("..")?{success:!1,executionCount:n,error:"Path traversal detected: scriptPath must be within the project root."}:Vve(s)?new Promise(u=>{let l=Wve(s),c=Fve("npx",["playwright","test",s,"--reporter=line"],{cwd:o,env:{...process.env,FORCE_COLOR:"0"}}),d="",p="";c.stdout.on("data",m=>{d+=m.toString()}),c.stderr.on("data",m=>{p+=m.toString()});let f=setTimeout(()=>{c.kill("SIGTERM"),u({success:!1,executionCount:n,error:"Test timed out after 60 seconds",stdout:d.slice(-2e3),stderr:p.slice(-1e3)})},6e4);c.on("close",m=>{clearTimeout(f);let v=`${d}
411
- ${p}`.split(`
412
- `),h="",y=null;for(let _=0;_<v.length;_++){let b=v[_];if(b.includes("Error:")||b.includes("error:")||b.includes("\u2718")){h+=`${b}
413
- `;for(let w=_+1;w<Math.min(_+5,v.length);w++)h+=`${v[w]}
414
- `}if(b.includes("at ")&&b.includes(".spec.")){let w=b.match(/:(\d+):\d+/);w&&(y=parseInt(w[1]))}}u(m===0?{success:!0,executionCount:n,message:"All tests passed!",output:d.slice(-500)}:{success:!1,executionCount:n,remainingAttempts:Op-n,error:h.slice(0,1500)||"Test failed (see output)",failedAtLine:y,stdout:d.slice(-1500),stderr:p.slice(-500),hint:n<Op?"Fix the error and run again.":"Last attempt - make your best fix."})}),c.on("error",m=>{clearTimeout(f),u({success:!1,executionCount:n,error:`Failed to run test: ${m.message}`})})}):{success:!1,executionCount:n,error:`Test file not found: ${s}. Make sure you wrote the file first using the write tool.`}},resetCount(t){for(let e of Gv.keys())e.startsWith(`${t}:`)&&Gv.delete(e)}};function Bve(t){pW.resetCount(t)}var hs=class{async generate(e){throw new Error("TestGenerationStrategy.generate() must be implemented")}canGenerate(e){throw new Error("TestGenerationStrategy.canGenerate() must be implemented")}getName(){throw new Error("TestGenerationStrategy.getName() must be implemented")}getPriority(){return 0}};import{readFileSync as mW,writeFileSync as Kve}from"node:fs";var Vl=class extends hs{constructor(){super("mcp-ref","MCP Reference Replay (Exact 1:1)",200)}canGenerate(e){let r=e.eventsPath||`${e.sessionPath}/execute_live/events.json`;try{return JSON.parse(mW(r,"utf-8")).some(o=>o.data?.params?.element)?(console.log("[MCPRefStrategy] \u2705 MCP element descriptions available"),!0):(console.log("[MCPRefStrategy] \u274C No MCP element descriptions found in events"),!1)}catch(i){return console.log("[MCPRefStrategy] \u274C Failed to read events:",i.message),!1}}getName(){return"MCP Reference Replay (Exact 1:1)"}getPriority(){return 200}async generate(e){let{testFilePath:r,sessionPath:i,state:n}=e,o=`${i}/execute_live/events.json`,s=n?.title||"Generated Test";console.log("[MCPRefStrategy] \u{1F3AF} Generating test using MCP element descriptions (1:1 replay)"),console.log(`[MCPRefStrategy] events: ${o}`),console.log(`[MCPRefStrategy] output: ${r}`);let u=JSON.parse(mW(o,"utf-8")).filter(c=>["navigate","type","fill","click","select_option"].includes(c.type)),l=`import { test, expect } from '@playwright/test';
415
- `;l+=`import { ZibbyRuntime } from '@zibby/core';
416
-
417
- `,l+=`test('${s}', async ({ page }) => {
418
- `,l+=` const timestamp = Date.now();
419
-
420
- `;for(let c of u){let d=c.data?.params?.element||"element",p=c.data?.params?.ref,f=c.enrichedData?.traceActualText,m=c.enrichedData?.traceActualRole,g=c.enrichedData?.traceActualAriaLabel,v=c.enrichedData?.actualText,h=f||v,y=m||c.enrichedData?.actualRole,_=h||d,b=h||this._extractName(d),w=y||this._extractRole(d),S=f?" [accessibility-tree]":v?" [live]":" [AI]";if(c.type==="navigate")l+=` await page.goto('${c.data.params.url}');
421
-
422
- `;else if(c.type==="click")l+=` // ${d}${h?` (actual: "${h}")${S}`:""}
423
- `,l+=` await ZibbyRuntime.step(page, {
424
- `,l+=` name: '${this._escapeString(d)}',
425
- `,l+=` action: 'click',
426
- `,l+=` strategies: [
427
- `,l+=` { type: 'role', role: '${w}', name: '${this._escapeString(b)}' },
428
- `,l+=` { type: 'text', text: '${this._escapeString(b)}' }
429
- `,l+=` ]
430
- `,l+=` });
431
-
432
- `;else if(c.type==="fill"||c.type==="type"){let k=c.data.params.text;l+=` // ${d}${h?` (actual: "${h}")${S}`:""}
433
- `,l+=` await ZibbyRuntime.step(page, {
434
- `,l+=` name: '${this._escapeString(d)}',
435
- `,l+=` action: 'fill',
436
- `,l+=` value: '${this._escapeString(k)}',
437
- `,l+=` strategies: [
438
- `,l+=` { type: 'role', role: '${w}', name: '${this._escapeString(b)}' },
439
- `,l+=` { type: 'attributes', placeholder: '${this._escapeString(b)}' }
440
- `,l+=` ]
441
- `,l+=` });
442
-
443
- `}else if(c.type==="select_option"){let k=c.data.params.values,$=Array.isArray(k)?k[0]:k;l+=` // ${d}${h?` (actual: "${h}")${S}`:""}
444
- `,l+=` await ZibbyRuntime.step(page, {
445
- `,l+=` name: '${this._escapeString(d)}',
446
- `,l+=` action: 'select',
447
- `,l+=` value: '${this._escapeString($)}',
448
- `,l+=` strategies: [
449
- `,l+=` { type: 'role', role: 'combobox', name: '${this._escapeString(b)}' }
450
- `,l+=` ]
451
- `,l+=` });
452
-
453
- `}}return l+=`});
454
- `,Kve(r,l),console.log(`[MCPRefStrategy] \u2705 Generated test with ${u.length} actions using MCP descriptions`),{success:!0,testPath:r,method:"MCP Reference Replay (1:1)",actionsGenerated:u.length}}_extractRole(e){let r=e.toLowerCase();return r.includes("button")?"button":r.includes("textbox")?"textbox":r.includes("link")?"link":r.includes("checkbox")?"checkbox":r.includes("radio")?"radio":r.includes("combobox")?"combobox":r.includes("heading")?"heading":"button"}_extractName(e){return e.replace(/\s+(button|textbox|link|checkbox|radio|combobox)$/i,"").trim()}_escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}_escapeString(e){return e.replace(/'/g,"\\'").replace(/\n/g,"\\n")}};import{readFileSync as hW,writeFileSync as Hve}from"node:fs";var Wl=class extends hs{constructor(){super("stable-id","Stable ID Injection (Experimental)",300)}canGenerate(e){let r=e.eventsPath||`${e.sessionPath}/execute_live/events.json`;try{return JSON.parse(hW(r,"utf-8")).some(o=>o.stableId||o.data?.stableId)?(console.log("[StableIdStrategy] \u2705 Stable IDs available"),!0):(console.log("[StableIdStrategy] \u274C No stable IDs found in events"),!1)}catch(i){return console.log("[StableIdStrategy] \u274C Failed to read events:",i.message),!1}}getName(){return"Stable ID Injection (Experimental)"}getPriority(){return 300}async generate(e){let{testFilePath:r,sessionPath:i,state:n}=e,o=`${i}/execute_live/events.json`,s=n?.title||"Generated Test";console.log("[StableIdStrategy] \u{1F3AF} Generating test using stable IDs"),console.log(`[StableIdStrategy] events: ${o}`),console.log(`[StableIdStrategy] output: ${r}`);let u=JSON.parse(hW(o,"utf-8")).filter(p=>["navigate","type","fill","click","select_option","select"].includes(p.type)),l=`import { test, expect } from '@playwright/test';
455
- `;l+=`import { StableIdRuntime } from '@zibby/core';
456
-
457
- `,l+=`test('${s}', async ({ page }) => {
458
- `;let c=!1,d=null;for(let p=0;p<u.length;p++){let f=u[p],m=f.stableId||f.data?.stableId,g=f.data?.element||f.data?.params?.element||"element";if(f.type==="click"&&m&&m===d){console.log(`[StableIdStrategy] Skipping duplicate click on ${m}`);continue}if(f.type==="navigate"){let v=f.data?.url||f.data?.params?.url;v&&!c&&(l+=` await page.goto('${v}');
459
- `,l+=` await StableIdRuntime.injectStableIds(page);
460
-
461
- `)}else if(f.type==="click")if(c=!0,d=m,m)l+=` await StableIdRuntime.clickWithRetry(page, '${m}');
462
- `;else{let v=this._generateSemanticSelector(g);l+=` await ${v}.click();
463
- `,l+=` await StableIdRuntime.afterNavigation(page);
464
- `}else if(f.type==="fill"||f.type==="type"){c=!1;let v=f.data?.text||f.data?.params?.text||"";m?l+=` await StableIdRuntime.fillWithRetry(page, '${m}', '${this._escapeString(v)}');
465
- `:l+=` await page.getByPlaceholder('${this._escapeString(g)}').fill('${this._escapeString(v)}');
466
- `}else if(f.type==="select_option"||f.type==="select"){c=!1;let v=f.data?.values||f.data?.params?.values,h=Array.isArray(v)?v[0]:v||"";m?l+=` await StableIdRuntime.selectWithRetry(page, '${m}', '${this._escapeString(h)}');
467
- `:l+=` await page.locator('select').selectOption('${this._escapeString(h)}');
468
- `}}return l+=`});
469
- `,Hve(r,l),console.log(`[StableIdStrategy] \u2705 Generated test with ${u.length} actions using stable IDs`),{success:!0,testPath:r,method:"Stable ID Injection (Experimental)",actionsGenerated:u.length}}_escapeString(e){return e.replace(/'/g,"\\'").replace(/\n/g,"\\n")}_generateSemanticSelector(e){let r=e.toLowerCase(),i="locator",n=e;return r.includes("button")?(i="button",n=e.replace(/\s*button\s*/gi,"").trim()):r.includes("link")?(i="link",n=e.replace(/\s*link\s*/gi,"").trim()):r.includes("textbox")?(i="textbox",n=e.replace(/\s*textbox\s*/gi,"").trim()):r.includes("checkbox")?(i="checkbox",n=e.replace(/\s*checkbox\s*/gi,"").trim()):(r.includes("combobox")||r.includes("dropdown")||r.includes("select"))&&(i="combobox",n=e.replace(/\s*(combobox|dropdown|select)\s*/gi,"").trim()),i!=="locator"&&n?`page.getByRole('${i}', { name: '${this._escapeString(n)}' })`:`page.getByText('${this._escapeString(e)}')`}};var Tz=class{constructor(){this.strategies=[new Wl,new Vl],this.strategies.sort((e,r)=>r.getPriority()-e.getPriority())}registerStrategy(e){this.strategies.push(e),this.strategies.sort((r,i)=>i.getPriority()-r.getPriority())}async generate(e){console.log(`
470
- \u{1F4CB} Available generation strategies (${this.strategies.length}):`),this.strategies.forEach(r=>{let i=r.canGenerate(e);console.log(` ${i?"\u2713":"\u2717"} ${r.getName()} (priority: ${r.getPriority()})`)});for(let r of this.strategies)if(r.canGenerate(e))return console.log(`
471
- \u{1F3AF} Selected: ${r.getName()}`),r.generate(e);throw new Error("No generation strategy available for this context")}getStrategy(e){return this.strategies.find(r=>r.getName().includes(e))||null}},Jve=new Tz;var Gl=class{async verify(e){throw new Error("TestVerificationStrategy.verify() must be implemented")}canVerify(e){throw new Error("TestVerificationStrategy.canVerify() must be implemented")}getName(){throw new Error("TestVerificationStrategy.getName() must be implemented")}getPriority(){return 0}};import{execSync as Yve}from"node:child_process";import{existsSync as Qve}from"node:fs";var Bl=class extends Gl{getName(){return"Playwright JSON Reporter"}getPriority(){return 100}canVerify(e){let{testFilePath:r}=e;return Qve(r)}async verify(e){let{testFilePath:r,cwd:i,timeout:n=3e4}=e;try{console.log(`\u{1F9EA} Running test: ${r}`);let o=`npx playwright test ${r} --reporter=json --timeout=${n}`,s=Yve(o,{cwd:i,encoding:"utf-8",stdio:["pipe","pipe","pipe"],timeout:n+1e4}),u=JSON.parse(s).stats||{};return{success:u.unexpected===0,passed:u.expected||0,failed:u.unexpected||0,error:null,errorDetails:null}}catch(o){let s=o.stdout||o.stderr||o.message;try{let a=JSON.parse(s),u=a.stats||{},l="Test execution failed";if(a.suites&&a.suites.length>0){let d=a.suites[0];if(d.specs&&d.specs.length>0){let p=d.specs[0];if(p.tests&&p.tests.length>0){let f=p.tests[0];if(f.results&&f.results.length>0){let m=f.results[0];m.error&&(l=m.error.message||l)}}}}let c=l.includes("Executable doesn't exist")||l.includes("browserType.launch")||l.includes("Please run the following command")||l.includes("npx playwright install")||s.includes("Executable doesn't exist")||s.includes("npx playwright install");return{success:!1,passed:u.expected||0,failed:u.unexpected||0,error:l,errorDetails:l,isEnvironmentError:c}}catch{let u=s.match(/Error: (.+)/),l=u?u[1]:"Test execution failed",c=l.includes("Executable doesn't exist")||l.includes("browserType.launch")||l.includes("Please run the following command")||l.includes("npx playwright install")||s.includes("Executable doesn't exist")||s.includes("npx playwright install");return{success:!1,passed:0,failed:1,error:l,errorDetails:l,isEnvironmentError:c}}}}};var Oz=class{constructor(){this.strategies=[new Bl],this.strategies.sort((e,r)=>r.getPriority()-e.getPriority())}registerStrategy(e){this.strategies.push(e),this.strategies.sort((r,i)=>i.getPriority()-r.getPriority())}async verify(e){console.log(`
472
- \u{1F4CB} Available verification strategies (${this.strategies.length}):`),this.strategies.forEach(r=>{let i=r.canVerify(e);console.log(` ${i?"\u2713":"\u2717"} ${r.getName()} (priority: ${r.getPriority()})`)});for(let r of this.strategies)if(r.canVerify(e))return console.log(`
473
- \u{1F3AF} Selected: ${r.getName()}`),r.verify(e);throw new Error("No verification strategy available for this context")}getStrategy(e){return this.strategies.find(r=>r.getName().includes(e))||null}},Xve=new Oz;var gs=class{constructor(e={}){this.enrichers=[],this.config=e,this.stats={totalEvents:0,enrichedEvents:0,skippedEvents:0,errors:{}}}register(e){return this.enrichers.push(e),this.enrichers.sort((r,i)=>i.getPriority()-r.getPriority()),this}unregister(e){return this.enrichers=this.enrichers.filter(r=>r.getName()!==e),this}get(e){return this.enrichers.find(r=>r.getName()===e)}setEnabled(e,r){let i=this.get(e);return i&&(i.enabled=r),this}async enrich(e,r){this.stats.totalEvents++;let i={...e},n=[],o=[],s=[];for(let a of this.enrichers)try{if(!a.canEnrich(r)){o.push(a.getName());continue}let u=Date.now(),l=await a.enrich(e,r),c=Date.now()-u;l?(Object.assign(i,l),n.push({name:a.getName(),duration:c})):o.push(a.getName())}catch(u){console.warn(`[EnrichmentPipeline] ${a.getName()} failed:`,u.message),s.push(a.getName()),this.stats.errors[a.getName()]=(this.stats.errors[a.getName()]||0)+1}return i._enrichment={version:"1.0",timestamp:new Date().toISOString(),enrichers:{run:n,skipped:o,failed:s}},n.length>0?this.stats.enrichedEvents++:this.stats.skippedEvents++,i}async enrichBatch(e,r){let i=[];for(let n of e){let o=await this.enrich(n,r);i.push(o)}return i}getStats(){return{...this.stats,enrichers:this.enrichers.map(e=>({name:e.getName(),enabled:e.enabled,priority:e.getPriority(),errors:this.stats.errors[e.getName()]||0}))}}resetStats(){this.stats={totalEvents:0,enrichedEvents:0,skippedEvents:0,errors:{}}}logStatus(){console.log(`
257
+ `;a+=`test('${s}', async ({ page }) => {
258
+ `,a+=` const timestamp = Date.now();
259
+
260
+ `;let u=0;for(let f of c)if(f.type==="navigate")a+=` await page.goto('${f.data.params.url}');
261
+
262
+ `;else if(f.type==="type"||f.type==="fill"){let{element:m,text:S}=f.data.params,g=r[u]?.strategies||[];a+=` await ZibbyRuntime.step(page, ${JSON.stringify({name:m,action:"fill",value:S,strategies:g},null,2)});
263
+
264
+ `,u++}else if(f.type==="click"){let{element:m}=f.data.params,S=r[u]?.strategies||[];a+=` await ZibbyRuntime.step(page, ${JSON.stringify({name:m,action:"click",value:"",strategies:S},null,2)});
265
+
266
+ `,u++}else if(f.type==="select_option"){let{element:m,values:S}=f.data.params,g=r[u]?.strategies||[],w={name:m,action:"selectOption",value:Array.isArray(S)?S[0]:S,strategies:g};a+=` await ZibbyRuntime.step(page, ${JSON.stringify(w,null,2)});
267
+
268
+ `,u++}a+=`});
269
+ `;let{dirname:p}=await import("path"),{mkdirSync:d}=await import("fs");return d(p(e),{recursive:!0}),await st.writeFile(e,a,"utf-8"),console.log(`[TestPostProcessor] \u2705 Generated test with ${o.filter(f=>["type","fill","click","select_option"].includes(f.type)).length} actions`),!0}catch(n){return console.warn("[TestPostProcessor] Failed to generate from events:",n.message),!1}}static async enhanceSelectorsWithTrace(e,t,r){try{console.log("[TestPostProcessor] \u{1F6E1}\uFE0F Applying Zibby Safe Action Wrappers...");let s=await st.readFile(e,"utf-8");s.includes("ZibbyRuntime")||(s=`import { ZibbyRuntime } from '@zibby/core';
270
+ ${s}`);for(let n=0;n<t.length;n++){let o=t[n],c=`element${n}`,l=new RegExp(`const ${c}\\b\\s*=\\s*page\\.[^;]+;(\\s*await ${c}\\.waitFor\\([^)]*\\);)?\\s*await ${c}\\.(click|fill|type|selectOption|pressSequentially)\\(([^)]*)\\);`,"s"),a=s.match(l);if(!a)continue;let u={name:o.name||`Action ${n}`,action:o.method==="type"?"fill":o.method,value:a[3].trim().replace(/^['"]|['"]$/g,""),strategies:o.strategies||[]},p=`await ZibbyRuntime.step(page, ${JSON.stringify(u,null,2)});`;s=s.replace(a[0],p)}return await st.writeFile(e,s,"utf-8"),console.log("[TestPostProcessor] \u2705 Successfully converted test to Resilient Zibby format"),!0}catch(s){return console.warn("[TestPostProcessor] Failed to apply safe wrappers:",s.message),!1}}static async enhanceSelectors(e,t){try{let{actions:r=[]}=t;if(!r.length)return!1;let s=await st.readFile(e,"utf-8"),n=this.buildSelectorMap(r);return s=this.replaceSimpleSelectors(s,n),await st.writeFile(e,s,"utf-8"),!0}catch(r){return console.warn("Failed to enhance selectors:",r),!1}}static buildSelectorMap(e){let t=new Map;for(let r=0;r<e.length;r++){let s=e[r];if(!s.selectors||s.type==="navigate")continue;let n=`element${r}`,c=rt.generate(s,n).match(/= (.+);/s);if(c){let l=c[1].trim(),a=`${s.type}:${this.normalizeDescription(s.description)}`;t.set(a,l),s.selectors.role&&t.set(`role:${s.selectors.role.name}`,l),s.selectors.attributes?.placeholder&&t.set(`placeholder:${s.selectors.attributes.placeholder}`,l)}}return t}static replaceSimpleSelectors(e,t){let r=e,s=[/await page\.(getByRole|getByPlaceholder|getByText|getByLabel|locator)\([^)]+\)\.(fill|click|type)\([^)]*\)/g];for(let n of s)r=r.replace(n,o=>{for(let[c,l]of t.entries())if(o.includes(c.split(":")[1])){let a=o.match(/\.(fill|click|type)\(([^)]*)\)/);if(a){let[,u,p]=a,d="element";return`const ${d} = ${l};
271
+ await ${d}.${u}(${p})`}}return o});return r}static normalizeDescription(e){return e?e.toLowerCase().replace(/[^a-z0-9]+/g," ").trim():""}};import{readFileSync as Fi,existsSync as tn,readdirSync as rn}from"node:fs";import{join as Sr}from"node:path";import{execSync as Ui}from"node:child_process";import{tmpdir as ji}from"node:os";var nt=class{static async parseTraceZip(e){let t;if(e.endsWith(".zip")&&tn(e)){let r=Sr(ji(),`trace-${Date.now()}`);Ui(`unzip -q "${e}" -d "${r}"`,{stdio:"pipe"});let n=rn(r).find(o=>o.endsWith(".trace"));if(!n)throw new Error("No .trace file found in zip");t=Sr(r,n)}else if(tn(e)){let s=rn(e).find(n=>n.endsWith(".trace"));if(!s)throw new Error("No .trace file found");t=Sr(e,s)}else throw new Error(`Trace not found at ${e}`);try{let s=Fi(t,"utf-8").trim().split(`
272
+ `),n=[],o=new Map,c=new Map;for(let l of s)try{let a=JSON.parse(l);if(a.type==="snapshot"&&a.snapshot&&a.snapshot.accessibility){let u=new Map;for(let p of a.snapshot.accessibility)p.ref&&u.set(p.ref,p);o.set(a.snapshotName,u)}if(a.type==="frame-snapshot"&&a.snapshot){let u=Buffer.from(a.snapshot.html||"","base64").toString("utf-8");u&&u.length>100&&c.set(a.pageId||"default",u)}}catch{}for(let l of s)try{let a=JSON.parse(l);if(a.type==="before"&&a.params&&a.params.selector){let u=a.method;if(["click","fill","type","selectOption"].includes(u)){let p=a.params.selector,d=a.params.text||a.params.value||"",f=[],m=null,S=null,g=null,w=p.match(/aria-ref=([a-z0-9]+)/i);if(w&&a.snapshotName){let b=w[1],A=o.get(a.snapshotName);if(A&&A.has(b)){let O=A.get(b);m=O.name||null,S=O.role||null,g=O.label||null,console.log(`[TraceParser] \u2705 Found ACTUAL element data: text="${m}", role="${S}"`)}}let y=p.match(/internal:text="([^"]+)"/i),E=p.match(/internal:label="([^"]+)"/i),x=p.match(/internal:placeholder="([^"]+)"/i),v=p.match(/internal:role=([^ ]+)/i),$=p.match(/internal:describe="([^"]+)"/i),T=p.match(/name="([^"]+)"/i);if(y){f.push({type:"text",text:y[1]});let b=y[1].split(" ");b.length>1&&(f.push({type:"text",text:b[0],fuzzy:!0}),f.push({type:"text",text:b[b.length-1],fuzzy:!0}))}if(E&&f.push({type:"label",label:E[1]}),x&&f.push({type:"placeholder",placeholder:x[1]}),m){f.unshift({type:"text",text:m,source:"accessibility-tree"});let b=m.split(" ");b.length>1&&f.push({type:"text",text:b[0],fuzzy:!0,source:"accessibility-tree"})}if(S||v){let b=S||v[1],A=m||(T?T[1]:y?y[1]:null);f.unshift({type:"role",role:b,name:A,source:m?"accessibility-tree":"selector"})}if(g&&f.unshift({type:"label",label:g,source:"accessibility-tree"}),$){let b=$[1],A=["link","button","textbox","menuitem","submenu","combobox","checkbox","radio","tab","treeitem","menu item"],O=null,_=b;for(let C of A)if(b.toLowerCase().endsWith(` ${C}`)){O=C.replace(" ",""),_=b.substring(0,b.length-C.length-1);break}if(O){f.push({type:"role",role:O,name:_});let C=_.replace(/\s*\([^)]+\)\s*$/,"");f.push({type:"text",text:C}),f.push({type:"text",text:_});let R=_.split(" ");R.length>1&&(f.push({type:"text",text:R[0],fuzzy:!0}),f.push({type:"text",text:R.slice(0,2).join(" "),fuzzy:!0}))}else{let C=b.replace(/\s*\([^)]+\)\s*$/,"");f.push({type:"text",text:C}),f.push({type:"text",text:b})}}let I=this.extractDOMStrategies(p,c,y?.[1]||$?.[1],a.pageId);f.push(...I);let P=this.extractStructuralContext(p);(P.parent||P.sibling)&&f.forEach(b=>{["role","text","label","testid"].includes(b.type)&&(P.parent&&(b.parent=P.parent),P.sibling&&(b.sibling=P.sibling))}),f.push({type:"css",value:p});let N=m||y?y[1]:$?$[1].replace(/\s*\([^)]+\)\s*$/,""):`Action ${n.length}`;n.push({method:u,name:N,action:u==="type"?"fill":u,value:d,strategies:f,timestamp:a.startTime,actualText:m,actualRole:S,actualAriaLabel:g})}}}catch{}return n}catch(r){throw new Error(`Failed to parse trace: ${r.message}`,{cause:r})}}static extractDOMStrategies(e,t,r,s){let n=[];if(!t||t.size===0||!r)return n;try{let o=t.get(s);if(!o)return n;let c=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=new RegExp(`data-testid=["']([^"']+)["'][^>]*>[^<]*${c}`,"i"),a=o.match(l);a&&n.push({type:"testid",value:a[1],priority:"high"});let u=new RegExp(`class=["']([^"']+)["'][^>]*>[^<]*${c}`,"gi"),p=o.matchAll(u);for(let m of p){let S=m[1].split(/\s+/).filter(g=>g&&!g.match(/^(css|jss|makeStyles|MuiBox|MuiStack)-\w+/)&&g.length>2);S.length>0&&(n.push({type:"class",value:S.join("."),priority:"medium"}),S.length===1&&n.push({type:"class",value:S[0],priority:"medium"}))}let d=new RegExp(`id=["']([^"']+)["'][^>]*>[^<]*${c}`,"i"),f=o.match(d);f&&!f[1].match(/^(root|app|\d+|[a-f0-9-]{20,})$/i)&&n.push({type:"id",value:f[1],priority:"high"})}catch(o){console.warn(`[TraceParser] DOM extraction failed: ${o.message}`)}return n}static extractStructuralContext(e){let t={parent:null,sibling:null},r=e.split(">>").map(o=>o.trim());if(r.length>1){let c=r[r.length-2].replace(/internal:text="[^"]+"\s*/gi,"").replace(/internal:role=\S+\s*/gi,"").replace(/internal:label="[^"]+"\s*/gi,"").trim();c&&(c.match(/^(form|section|nav|header|aside|main|article)\b/)||c.includes("[")||c.match(/[#.]\w/))&&(t.parent=c)}let n=r[r.length-1].match(/([^+~]+)\s*[+~]\s*(.+)/);return n&&(t.sibling=n[1].trim()),t}};Je();var wr=class{static async step(e,t){let{name:r,action:s,value:n,strategies:o,options:c={timeout:1e4},enrichedData:l}=t;console.log(`[Zibby] \u26A1 Executing step: ${r}`),await this.waitForPageStability(e,c.timeout);let a=await this.findBestMatch(e,o,r);if(!a)throw new Error(`[Zibby] \u274C Failed to find "${r}" using ${o.length} strategies`);l?.position&&await this.verifyPosition(a,l.position),await this.performActionWithRetry(e,a,s,n,3),console.log(`[Zibby] \u2728 Step "${r}" completed.`)}static async waitForPageStability(e,t=1e4){try{await e.waitForLoadState("networkidle",{timeout:3e3}).catch(()=>{}),await e.evaluate(()=>new Promise(r=>{let s,n=new MutationObserver(()=>{clearTimeout(s),s=setTimeout(()=>{n.disconnect(),r()},500)});n.observe(document.body,{childList:!0,subtree:!0,attributes:!0}),s=setTimeout(()=>{n.disconnect(),r()},500)})).catch(()=>{})}catch{}}static async verifyPosition(e,t){try{let r=await e.boundingBox();if(!r)return;let s=Math.abs(r.x-t.x),n=Math.abs(r.y-t.y);(s>50||n>50)&&(console.log(`[Zibby] \u26A0\uFE0F Element moved: expected (${t.x}, ${t.y}), got (${r.x}, ${r.y})`),await new Promise(o=>setTimeout(o,500)))}catch{}}static async performActionWithRetry(e,t,r,s,n=3){for(let o=1;o<=n;o++)try{r==="click"?await t.click():r==="fill"?await t.fill(s||""):r==="type"?await t.pressSequentially(s||""):r==="selectOption"&&await t.selectOption(s||"");return}catch(c){if(o===n)throw c;console.log(`[Zibby] \u26A0\uFE0F Action failed (attempt ${o}/${n}), retrying...`),await new Promise(l=>setTimeout(l,1e3*o))}}static async findBestMatch(e,t,r){let n=Date.now(),o=t.map(async(a,u)=>{try{let d=await this.getLocator(e,a).all();return d.length===0?[]:(await Promise.all(d.map(async(m,S)=>{try{if(!await m.isVisible({timeout:100}))return null;let w=await this.scoreCandidate(m,a,e);return{element:m,strategy:a,score:w,strategyIdx:u,elIdx:S}}catch{return null}}))).filter(m=>m!==null)}catch{return[]}}),c=(await Promise.all(o)).flat();if(c.length===0)return console.log(`[Zibby] \u274C No visible candidates found for "${r}"`),null;c.sort((a,u)=>u.score-a.score);let l=c[0];return console.log(`[Zibby] \u2705 Found element using ${l.strategy.type} (score: ${l.score.toFixed(2)}, ${c.length} candidates)`),l.element}static async scoreCandidate(e,t,r){let s=0;if(s+={testid:120,id:110,role:100,label:90,class:85,placeholder:85,text:80,css:50}[t.type]||50,t.priority==="high"&&(s+=20),t.priority==="medium"&&(s+=10),t.fuzzy&&(s-=15),t.parent)try{await e.locator("xpath=ancestor::*").first().evaluate((l,a)=>l.matches(a),t.parent)&&(s+=30)}catch{}if(t.sibling)try{await e.evaluate((c,l)=>c.parentElement?.querySelector(l)!==null,t.sibling)&&(s+=20)}catch{}try{let o=await e.boundingBox();o&&o.y<1e3&&(s+=10)}catch{}try{let o=await e.evaluate(c=>{let l=0,a=c;for(;a;)a.tagName==="IFRAME"&&l++,a=a.parentElement;return l});s-=o*5}catch{}return s}static getLocator(e,t){let r;switch(t.type){case"testid":r=e.getByTestId(t.value);break;case"id":r=e.locator(`#${t.value}`);break;case"class":r=e.locator(`.${t.value.replace(/\./g,".")}`);break;case"text":t.fuzzy?r=e.getByText(new RegExp(t.text,"i")):r=e.getByText(t.text,{exact:!1});break;case"role":r=e.getByRole(t.role,{name:t.name,exact:!1});break;case"label":r=e.getByLabel(t.label,{exact:!1});break;case"placeholder":r=e.getByPlaceholder(t.placeholder);break;default:{let s=t.value?.replace(/aria-ref=e\d+ >> /g,"")||t.css;r=e.locator(s);break}}return t.parent&&(r=r.filter({has:e.locator(t.parent)})),r}};var _r=class{static async beforeEach(e){await this.injectStableIds(e),e.on("load",async()=>{await this.injectStableIds(e)})}static async afterNavigation(e){await e.waitForLoadState("domcontentloaded").catch(()=>{}),await this.injectStableIds(e)}static async clickWithRetry(e,t,r={}){let s=r.timeout||1e4,n=`[data-zibby-id="${t}"]`,o=Date.now();for(;Date.now()-o<s;){await this.injectStableIds(e);let c=e.locator(n);if(await c.count()>0)try{await c.click({timeout:2e3});return}catch(l){if(l.message.includes("intercepts pointer")){await c.click({force:!0});return}}await e.waitForTimeout(200)}throw new Error(`Element ${n} not found after ${s}ms`)}static async fillWithRetry(e,t,r,s=1e4){let n=`[data-zibby-id="${t}"]`,o=Date.now();for(;Date.now()-o<s;){await this.injectStableIds(e);let c=e.locator(n);if(await c.count()>0){await c.fill(r);return}await e.waitForTimeout(200)}throw new Error(`Element ${n} not found after ${s}ms`)}static async selectWithRetry(e,t,r,s=1e4){let n=`[data-zibby-id="${t}"]`,o=Date.now();for(;Date.now()-o<s;){await this.injectStableIds(e);let c=e.locator(n);if(await c.count()>0){await c.selectOption(r);return}await e.waitForTimeout(200)}throw new Error(`Element ${n} not found after ${s}ms`)}static async injectStableIds(e){try{await e.evaluate(()=>{function t(l){if(l.getAttribute("aria-label"))return l.getAttribute("aria-label").trim();let a=l.getAttribute("aria-labelledby");if(a){let d=document.getElementById(a);if(d)return d.textContent.trim()}if(l.id){let d=document.querySelector(`label[for="${l.id}"]`);if(d)return d.textContent.trim()}let u=l.closest("label");if(u){let d=u.cloneNode(!0);d.querySelectorAll("input, select, textarea").forEach(m=>m.remove());let f=d.textContent.trim();if(f)return f}if(l.placeholder)return l.placeholder;let p=l.tagName.toLowerCase();return p==="button"||p==="a"||l.getAttribute("role")==="button"?(l.textContent||"").trim().slice(0,50):l.title?l.title:p==="input"&&(l.type==="submit"||l.type==="button")&&l.value||""}function r(l){let a=[],u=l.closest("form");if(u)if(u.id)a.push(`form#${u.id}`);else if(u.name)a.push(`form[name=${u.name}]`);else if(u.action)try{let S=new URL(u.action,window.location.origin).pathname;a.push(`form[action=${S}]`)}catch{a.push(`form[action=${u.getAttribute("action")}]`)}else{let S=document.querySelectorAll("form"),g=Array.from(S).indexOf(u);a.push(`form:nth(${g})`)}let p=l.closest('header, nav, main, footer, aside, [role="banner"], [role="navigation"], [role="main"], [role="contentinfo"]');if(p){let S=p.tagName.toLowerCase(),g=p.getAttribute("role");a.push(g||S)}let d=l.closest('section, article, [role="region"]');if(d){let S=d.querySelector("h1, h2, h3, h4, h5, h6");S&&a.push(`section:${S.textContent.trim().slice(0,30)}`)}let f=l.closest("fieldset");if(f){let S=f.querySelector("legend");S&&a.push(`fieldset:${S.textContent.trim()}`)}let m=l.closest('dialog, [role="dialog"], [role="alertdialog"]');if(m){let S=m.querySelector('[role="heading"], h1, h2, h3');S?a.push(`dialog:${S.textContent.trim().slice(0,30)}`):a.push("dialog")}return a.join("/")}function s(l){let a=l.tagName.toLowerCase(),u=l.id||"",p=l.name||"",d=l.type||"",f=l.getAttribute("role")||"",m="";if(l.href)try{m=new URL(l.href,window.location.origin).pathname.slice(0,50)}catch{m=l.getAttribute("href")?.slice(0,50)||""}let S=t(l).slice(0,50).replace(/\s+/g," "),g=r(l),w=[a,u,p,d,f,m,S,g].join("|"),y=5381;for(let E=0;E<w.length;E++)y=(y<<5)+y^w.charCodeAt(E);return`zibby-${(y>>>0).toString(36)}`}let n=["button","a","input","select","textarea","label[for]",'[role="button"]','[role="link"]','[role="textbox"]','[role="checkbox"]','[role="radio"]','[role="combobox"]','[role="menuitem"]','[role="tab"]','[role="option"]','[role="switch"]','[role="slider"]',"[onclick]","[data-action]"].join(", "),o=new Map,c=0;document.querySelectorAll(n).forEach(l=>{let a=window.getComputedStyle(l);if(a.display==="none"||a.visibility==="hidden")return;let u=s(l),p=u,d=o.get(p)||0;d>0&&(u=`${p}-${d}`),o.set(p,d+1),l.setAttribute("data-zibby-id",u),c++}),console.log(`[Zibby] Injected ${c} stable IDs`)})}catch{}}};V();le();var Gi=8,zi=1,Ji=64;function Wi(i){if(!i||typeof i!="object")return 8;let e=i.parallel;if(!e||typeof e!="object")return 8;let t=e.maxConcurrentRuns??e.maxConcurrent,r=Number(t);if(!Number.isFinite(r))return 8;let s=Math.floor(r);return s<1?8:Math.min(64,s)}import{readFileSync as Ki,writeFileSync as nn,existsSync as Zi}from"node:fs";import{join as on}from"node:path";var J=class{constructor(e={}){this.config=e,this.enabled=e.enabled!==!1,this.priority=e.priority||50}getName(){throw new Error("EventEnricher.getName() must be implemented")}canEnrich(e){return this.enabled}async enrich(e,t){throw new Error("EventEnricher.enrich() must be implemented")}handleError(e,t){return console.warn(`[${this.getName()}] Enrichment failed for event ${t.type}:`,e.message),null}};import{existsSync as Yi}from"node:fs";import{join as sn}from"node:path";var ge=class extends J{constructor(e={}){super(e),this.priority=190,this.traceData=null}getName(){return"TraceText"}getPriority(){return this.priority}async loadTrace(e){if(this.traceData)return;let t=sn(e,"traces"),r=sn(e,"trace.zip");if(Yi(r))try{this.traceData=await nt.parseTraceZip(r),console.log(`[TraceTextEnricher] \u2705 Loaded trace with ${this.traceData.length} actions`)}catch(s){console.log(`[TraceTextEnricher] \u26A0\uFE0F Failed to parse trace: ${s.message}`)}}async enrich(e,t){let r=e.data?.params?.ref,s=e.id;if(r===void 0&&s===void 0||(!this.traceData&&t.sessionPath&&await this.loadTrace(t.sessionPath),!this.traceData))return null;let n=this.traceData[s];if(!n)return console.log(`[TraceTextEnricher] \u26A0\uFE0F No trace action for event ${s}`),null;let o=n.actualText||this._extractTextFromSelector(n.selector),c=n.actualRole,l=n.actualAriaLabel;return o||c||l?(console.log(`[TraceTextEnricher] \u2705 Event ${s}: text="${o}", role="${c}", label="${l}"`),{traceActualText:o,traceActualRole:c,traceActualAriaLabel:l,traceSelector:n.selector,traceStrategies:n.strategies}):null}_extractTextFromSelector(e){if(!e)return null;let t=e.match(/internal:label="([^"]+)"/);if(t)return t[1];let r=e.match(/internal:text="([^"]+)"/);if(r)return r[1];let s=e.match(/getByText\(['"]([^'"]+)['"]\)/);if(s)return s[1];let n=e.match(/name:\s*['"]([^'"]+)['"]/);return n?n[1]:null}};async function Hi(i){let e=on(i,"events.json"),t=on(i,"events-enriched.json");if(!Zi(e))return console.log("[PostProcess] No events.json found"),{enriched:0,failed:0};try{let r=JSON.parse(Ki(e,"utf-8")),s=new ge,n=0,o=0;for(let c of r)try{let l=await s.enrich(c,{sessionPath:i});l&&(c.enrichedData={...c.enrichedData||{},...l},n++)}catch(l){console.log(`[PostProcess] Failed to enrich event ${c.id}: ${l.message}`),o++}return n>0&&(nn(t,JSON.stringify(r,null,2)),nn(e,JSON.stringify(r,null,2)),console.log(`[PostProcess] \u2705 Enriched ${n} events (${o} failed)`)),{enriched:n,failed:o}}catch(r){return console.log(`[PostProcess] \u274C Failed to post-process events: ${r.message}`),{enriched:0,failed:0}}}import{spawn as Vi}from"node:child_process";import{existsSync as qi}from"node:fs";import{dirname as Xi,resolve as an,relative as Qi}from"node:path";var Nt=new Map,ot=8,cn={name:"run_playwright_test",description:`Run a Playwright test file and return results. Use this after writing a test to verify it works. If it fails, fix the issues and run again. Maximum ${ot} attempts per session.`,inputSchema:{type:"object",properties:{scriptPath:{type:"string",description:"Path to the Playwright test file (e.g., tests/login.spec.js)"}},required:["scriptPath"]},async execute({scriptPath:i},e){let r=`${e?.sessionId||"default"}:${i}`,s=(Nt.get(r)||0)+1;if(Nt.set(r,s),s>ot)return{success:!1,executionCount:s,maxReached:!0,error:`Maximum ${ot} executions reached. Stop retrying and return your best result.`};let n=e?.projectRoot||process.cwd(),o=an(n,i),c=Qi(n,o);return c.startsWith("..")||an(o)!==o&&c.includes("..")?{success:!1,executionCount:s,error:"Path traversal detected: scriptPath must be within the project root."}:qi(o)?new Promise(l=>{let a=Xi(o),u=Vi("npx",["playwright","test",o,"--reporter=line"],{cwd:n,env:{...process.env,FORCE_COLOR:"0"}}),p="",d="";u.stdout.on("data",m=>{p+=m.toString()}),u.stderr.on("data",m=>{d+=m.toString()});let f=setTimeout(()=>{u.kill("SIGTERM"),l({success:!1,executionCount:s,error:"Test timed out after 60 seconds",stdout:p.slice(-2e3),stderr:d.slice(-1e3)})},6e4);u.on("close",m=>{clearTimeout(f);let g=`${p}
273
+ ${d}`.split(`
274
+ `),w="",y=null;for(let E=0;E<g.length;E++){let x=g[E];if(x.includes("Error:")||x.includes("error:")||x.includes("\u2718")){w+=`${x}
275
+ `;for(let v=E+1;v<Math.min(E+5,g.length);v++)w+=`${g[v]}
276
+ `}if(x.includes("at ")&&x.includes(".spec.")){let v=x.match(/:(\d+):\d+/);v&&(y=parseInt(v[1]))}}l(m===0?{success:!0,executionCount:s,message:"All tests passed!",output:p.slice(-500)}:{success:!1,executionCount:s,remainingAttempts:ot-s,error:w.slice(0,1500)||"Test failed (see output)",failedAtLine:y,stdout:p.slice(-1500),stderr:d.slice(-500),hint:s<ot?"Fix the error and run again.":"Last attempt - make your best fix."})}),u.on("error",m=>{clearTimeout(f),l({success:!1,executionCount:s,error:`Failed to run test: ${m.message}`})})}):{success:!1,executionCount:s,error:`Test file not found: ${o}. Make sure you wrote the file first using the write tool.`}},resetCount(i){for(let e of Nt.keys())e.startsWith(`${i}:`)&&Nt.delete(e)}};function ea(i){cn.resetCount(i)}var ie=class{async generate(e){throw new Error("TestGenerationStrategy.generate() must be implemented")}canGenerate(e){throw new Error("TestGenerationStrategy.canGenerate() must be implemented")}getName(){throw new Error("TestGenerationStrategy.getName() must be implemented")}getPriority(){return 0}};import{readFileSync as ln,writeFileSync as ta}from"node:fs";var Re=class extends ie{constructor(){super("mcp-ref","MCP Reference Replay (Exact 1:1)",200)}canGenerate(e){let t=e.eventsPath||`${e.sessionPath}/execute_live/events.json`;try{return JSON.parse(ln(t,"utf-8")).some(n=>n.data?.params?.element)?(console.log("[MCPRefStrategy] \u2705 MCP element descriptions available"),!0):(console.log("[MCPRefStrategy] \u274C No MCP element descriptions found in events"),!1)}catch(r){return console.log("[MCPRefStrategy] \u274C Failed to read events:",r.message),!1}}getName(){return"MCP Reference Replay (Exact 1:1)"}getPriority(){return 200}async generate(e){let{testFilePath:t,sessionPath:r,state:s}=e,n=`${r}/execute_live/events.json`,o=s?.title||"Generated Test";console.log("[MCPRefStrategy] \u{1F3AF} Generating test using MCP element descriptions (1:1 replay)"),console.log(`[MCPRefStrategy] events: ${n}`),console.log(`[MCPRefStrategy] output: ${t}`);let l=JSON.parse(ln(n,"utf-8")).filter(u=>["navigate","type","fill","click","select_option"].includes(u.type)),a=`import { test, expect } from '@playwright/test';
277
+ `;a+=`import { ZibbyRuntime } from '@zibby/core';
278
+
279
+ `,a+=`test('${o}', async ({ page }) => {
280
+ `,a+=` const timestamp = Date.now();
281
+
282
+ `;for(let u of l){let p=u.data?.params?.element||"element",d=u.data?.params?.ref,f=u.enrichedData?.traceActualText,m=u.enrichedData?.traceActualRole,S=u.enrichedData?.traceActualAriaLabel,g=u.enrichedData?.actualText,w=f||g,y=m||u.enrichedData?.actualRole,E=w||p,x=w||this._extractName(p),v=y||this._extractRole(p),$=f?" [accessibility-tree]":g?" [live]":" [AI]";if(u.type==="navigate")a+=` await page.goto('${u.data.params.url}');
283
+
284
+ `;else if(u.type==="click")a+=` // ${p}${w?` (actual: "${w}")${$}`:""}
285
+ `,a+=` await ZibbyRuntime.step(page, {
286
+ `,a+=` name: '${this._escapeString(p)}',
287
+ `,a+=` action: 'click',
288
+ `,a+=` strategies: [
289
+ `,a+=` { type: 'role', role: '${v}', name: '${this._escapeString(x)}' },
290
+ `,a+=` { type: 'text', text: '${this._escapeString(x)}' }
291
+ `,a+=` ]
292
+ `,a+=` });
293
+
294
+ `;else if(u.type==="fill"||u.type==="type"){let T=u.data.params.text;a+=` // ${p}${w?` (actual: "${w}")${$}`:""}
295
+ `,a+=` await ZibbyRuntime.step(page, {
296
+ `,a+=` name: '${this._escapeString(p)}',
297
+ `,a+=` action: 'fill',
298
+ `,a+=` value: '${this._escapeString(T)}',
299
+ `,a+=` strategies: [
300
+ `,a+=` { type: 'role', role: '${v}', name: '${this._escapeString(x)}' },
301
+ `,a+=` { type: 'attributes', placeholder: '${this._escapeString(x)}' }
302
+ `,a+=` ]
303
+ `,a+=` });
304
+
305
+ `}else if(u.type==="select_option"){let T=u.data.params.values,I=Array.isArray(T)?T[0]:T;a+=` // ${p}${w?` (actual: "${w}")${$}`:""}
306
+ `,a+=` await ZibbyRuntime.step(page, {
307
+ `,a+=` name: '${this._escapeString(p)}',
308
+ `,a+=` action: 'select',
309
+ `,a+=` value: '${this._escapeString(I)}',
310
+ `,a+=` strategies: [
311
+ `,a+=` { type: 'role', role: 'combobox', name: '${this._escapeString(x)}' }
312
+ `,a+=` ]
313
+ `,a+=` });
314
+
315
+ `}}return a+=`});
316
+ `,ta(t,a),console.log(`[MCPRefStrategy] \u2705 Generated test with ${l.length} actions using MCP descriptions`),{success:!0,testPath:t,method:"MCP Reference Replay (1:1)",actionsGenerated:l.length}}_extractRole(e){let t=e.toLowerCase();return t.includes("button")?"button":t.includes("textbox")?"textbox":t.includes("link")?"link":t.includes("checkbox")?"checkbox":t.includes("radio")?"radio":t.includes("combobox")?"combobox":t.includes("heading")?"heading":"button"}_extractName(e){return e.replace(/\s+(button|textbox|link|checkbox|radio|combobox)$/i,"").trim()}_escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}_escapeString(e){return e.replace(/'/g,"\\'").replace(/\n/g,"\\n")}};import{readFileSync as un,writeFileSync as ra}from"node:fs";var ke=class extends ie{constructor(){super("stable-id","Stable ID Injection (Experimental)",300)}canGenerate(e){let t=e.eventsPath||`${e.sessionPath}/execute_live/events.json`;try{return JSON.parse(un(t,"utf-8")).some(n=>n.stableId||n.data?.stableId)?(console.log("[StableIdStrategy] \u2705 Stable IDs available"),!0):(console.log("[StableIdStrategy] \u274C No stable IDs found in events"),!1)}catch(r){return console.log("[StableIdStrategy] \u274C Failed to read events:",r.message),!1}}getName(){return"Stable ID Injection (Experimental)"}getPriority(){return 300}async generate(e){let{testFilePath:t,sessionPath:r,state:s}=e,n=`${r}/execute_live/events.json`,o=s?.title||"Generated Test";console.log("[StableIdStrategy] \u{1F3AF} Generating test using stable IDs"),console.log(`[StableIdStrategy] events: ${n}`),console.log(`[StableIdStrategy] output: ${t}`);let l=JSON.parse(un(n,"utf-8")).filter(d=>["navigate","type","fill","click","select_option","select"].includes(d.type)),a=`import { test, expect } from '@playwright/test';
317
+ `;a+=`import { StableIdRuntime } from '@zibby/core';
318
+
319
+ `,a+=`test('${o}', async ({ page }) => {
320
+ `;let u=!1,p=null;for(let d=0;d<l.length;d++){let f=l[d],m=f.stableId||f.data?.stableId,S=f.data?.element||f.data?.params?.element||"element";if(f.type==="click"&&m&&m===p){console.log(`[StableIdStrategy] Skipping duplicate click on ${m}`);continue}if(f.type==="navigate"){let g=f.data?.url||f.data?.params?.url;g&&!u&&(a+=` await page.goto('${g}');
321
+ `,a+=` await StableIdRuntime.injectStableIds(page);
322
+
323
+ `)}else if(f.type==="click")if(u=!0,p=m,m)a+=` await StableIdRuntime.clickWithRetry(page, '${m}');
324
+ `;else{let g=this._generateSemanticSelector(S);a+=` await ${g}.click();
325
+ `,a+=` await StableIdRuntime.afterNavigation(page);
326
+ `}else if(f.type==="fill"||f.type==="type"){u=!1;let g=f.data?.text||f.data?.params?.text||"";m?a+=` await StableIdRuntime.fillWithRetry(page, '${m}', '${this._escapeString(g)}');
327
+ `:a+=` await page.getByPlaceholder('${this._escapeString(S)}').fill('${this._escapeString(g)}');
328
+ `}else if(f.type==="select_option"||f.type==="select"){u=!1;let g=f.data?.values||f.data?.params?.values,w=Array.isArray(g)?g[0]:g||"";m?a+=` await StableIdRuntime.selectWithRetry(page, '${m}', '${this._escapeString(w)}');
329
+ `:a+=` await page.locator('select').selectOption('${this._escapeString(w)}');
330
+ `}}return a+=`});
331
+ `,ra(t,a),console.log(`[StableIdStrategy] \u2705 Generated test with ${l.length} actions using stable IDs`),{success:!0,testPath:t,method:"Stable ID Injection (Experimental)",actionsGenerated:l.length}}_escapeString(e){return e.replace(/'/g,"\\'").replace(/\n/g,"\\n")}_generateSemanticSelector(e){let t=e.toLowerCase(),r="locator",s=e;return t.includes("button")?(r="button",s=e.replace(/\s*button\s*/gi,"").trim()):t.includes("link")?(r="link",s=e.replace(/\s*link\s*/gi,"").trim()):t.includes("textbox")?(r="textbox",s=e.replace(/\s*textbox\s*/gi,"").trim()):t.includes("checkbox")?(r="checkbox",s=e.replace(/\s*checkbox\s*/gi,"").trim()):(t.includes("combobox")||t.includes("dropdown")||t.includes("select"))&&(r="combobox",s=e.replace(/\s*(combobox|dropdown|select)\s*/gi,"").trim()),r!=="locator"&&s?`page.getByRole('${r}', { name: '${this._escapeString(s)}' })`:`page.getByText('${this._escapeString(e)}')`}};var br=class{constructor(){this.strategies=[new ke,new Re],this.strategies.sort((e,t)=>t.getPriority()-e.getPriority())}registerStrategy(e){this.strategies.push(e),this.strategies.sort((t,r)=>r.getPriority()-t.getPriority())}async generate(e){console.log(`
332
+ \u{1F4CB} Available generation strategies (${this.strategies.length}):`),this.strategies.forEach(t=>{let r=t.canGenerate(e);console.log(` ${r?"\u2713":"\u2717"} ${t.getName()} (priority: ${t.getPriority()})`)});for(let t of this.strategies)if(t.canGenerate(e))return console.log(`
333
+ \u{1F3AF} Selected: ${t.getName()}`),t.generate(e);throw new Error("No generation strategy available for this context")}getStrategy(e){return this.strategies.find(t=>t.getName().includes(e))||null}},sa=new br;var Me=class{async verify(e){throw new Error("TestVerificationStrategy.verify() must be implemented")}canVerify(e){throw new Error("TestVerificationStrategy.canVerify() must be implemented")}getName(){throw new Error("TestVerificationStrategy.getName() must be implemented")}getPriority(){return 0}};import{execSync as na}from"node:child_process";import{existsSync as oa}from"node:fs";var Le=class extends Me{getName(){return"Playwright JSON Reporter"}getPriority(){return 100}canVerify(e){let{testFilePath:t}=e;return oa(t)}async verify(e){let{testFilePath:t,cwd:r,timeout:s=3e4}=e;try{console.log(`\u{1F9EA} Running test: ${t}`);let n=`npx playwright test ${t} --reporter=json --timeout=${s}`,o=na(n,{cwd:r,encoding:"utf-8",stdio:["pipe","pipe","pipe"],timeout:s+1e4}),l=JSON.parse(o).stats||{};return{success:l.unexpected===0,passed:l.expected||0,failed:l.unexpected||0,error:null,errorDetails:null}}catch(n){let o=n.stdout||n.stderr||n.message;try{let c=JSON.parse(o),l=c.stats||{},a="Test execution failed";if(c.suites&&c.suites.length>0){let p=c.suites[0];if(p.specs&&p.specs.length>0){let d=p.specs[0];if(d.tests&&d.tests.length>0){let f=d.tests[0];if(f.results&&f.results.length>0){let m=f.results[0];m.error&&(a=m.error.message||a)}}}}let u=a.includes("Executable doesn't exist")||a.includes("browserType.launch")||a.includes("Please run the following command")||a.includes("npx playwright install")||o.includes("Executable doesn't exist")||o.includes("npx playwright install");return{success:!1,passed:l.expected||0,failed:l.unexpected||0,error:a,errorDetails:a,isEnvironmentError:u}}catch{let l=o.match(/Error: (.+)/),a=l?l[1]:"Test execution failed",u=a.includes("Executable doesn't exist")||a.includes("browserType.launch")||a.includes("Please run the following command")||a.includes("npx playwright install")||o.includes("Executable doesn't exist")||o.includes("npx playwright install");return{success:!1,passed:0,failed:1,error:a,errorDetails:a,isEnvironmentError:u}}}}};var xr=class{constructor(){this.strategies=[new Le],this.strategies.sort((e,t)=>t.getPriority()-e.getPriority())}registerStrategy(e){this.strategies.push(e),this.strategies.sort((t,r)=>r.getPriority()-t.getPriority())}async verify(e){console.log(`
334
+ \u{1F4CB} Available verification strategies (${this.strategies.length}):`),this.strategies.forEach(t=>{let r=t.canVerify(e);console.log(` ${r?"\u2713":"\u2717"} ${t.getName()} (priority: ${t.getPriority()})`)});for(let t of this.strategies)if(t.canVerify(e))return console.log(`
335
+ \u{1F3AF} Selected: ${t.getName()}`),t.verify(e);throw new Error("No verification strategy available for this context")}getStrategy(e){return this.strategies.find(t=>t.getName().includes(e))||null}},ia=new xr;var ae=class{constructor(e={}){this.enrichers=[],this.config=e,this.stats={totalEvents:0,enrichedEvents:0,skippedEvents:0,errors:{}}}register(e){return this.enrichers.push(e),this.enrichers.sort((t,r)=>r.getPriority()-t.getPriority()),this}unregister(e){return this.enrichers=this.enrichers.filter(t=>t.getName()!==e),this}get(e){return this.enrichers.find(t=>t.getName()===e)}setEnabled(e,t){let r=this.get(e);return r&&(r.enabled=t),this}async enrich(e,t){this.stats.totalEvents++;let r={...e},s=[],n=[],o=[];for(let c of this.enrichers)try{if(!c.canEnrich(t)){n.push(c.getName());continue}let l=Date.now(),a=await c.enrich(e,t),u=Date.now()-l;a?(Object.assign(r,a),s.push({name:c.getName(),duration:u})):n.push(c.getName())}catch(l){console.warn(`[EnrichmentPipeline] ${c.getName()} failed:`,l.message),o.push(c.getName()),this.stats.errors[c.getName()]=(this.stats.errors[c.getName()]||0)+1}return r._enrichment={version:"1.0",timestamp:new Date().toISOString(),enrichers:{run:s,skipped:n,failed:o}},s.length>0?this.stats.enrichedEvents++:this.stats.skippedEvents++,r}async enrichBatch(e,t){let r=[];for(let s of e){let n=await this.enrich(s,t);r.push(n)}return r}getStats(){return{...this.stats,enrichers:this.enrichers.map(e=>({name:e.getName(),enabled:e.enabled,priority:e.getPriority(),errors:this.stats.errors[e.getName()]||0}))}}resetStats(){this.stats={totalEvents:0,enrichedEvents:0,skippedEvents:0,errors:{}}}logStatus(){console.log(`
474
336
  \u{1F4CA} Enrichment Pipeline Status:`),console.log(` Total events: ${this.stats.totalEvents}`),console.log(` Enriched: ${this.stats.enrichedEvents}`),console.log(` Skipped: ${this.stats.skippedEvents}`),console.log(`
475
- Registered enrichers (${this.enrichers.length}):`);for(let e of this.enrichers){let r=e.enabled?"\u2713":"\u2717",i=this.stats.errors[e.getName()]||0,n=i>0?` (${i} errors)`:"";console.log(` ${r} ${e.getName()} (priority: ${e.getPriority()})${n}`)}console.log()}};var Kl=class extends Lr{getName(){return"PositionEnricher"}getPriority(){return 90}canEnrich(e){return!this.enabled||!e.element||!e.event?!1:["click","fill","type","selectOption","hover"].includes(e.event.type)}async enrich(e,r){try{let{page:i,element:n}=r,o=await n.boundingBox();if(!o)return null;let s=await i.evaluate(()=>({scrollX:window.scrollX,scrollY:window.scrollY,width:window.innerWidth,height:window.innerHeight})),a=o.y>=s.scrollY&&o.y+o.height<=s.scrollY+s.height&&o.x>=0&&o.x+o.width<=s.width;return{position:{boundingBox:o,viewport:s,inViewport:a,centerPoint:{x:Math.round(o.x+o.width/2),y:Math.round(o.y+o.height/2)}}}}catch(i){return this.handleError(i,e)}}};import gW from"node:crypto";var Ca=class extends Lr{getName(){return"AccessibilityEnricher"}getPriority(){return 100}canEnrich(e){return!this.enabled||!e.element||!e.event?!1:["click","fill","type","selectOption","hover"].includes(e.event.type)}async enrich(e,r){try{let{page:i,element:n}=r,o=await i.accessibility.snapshot(),s=await this.findAxNode(n,o);if(!s)return null;let a=await this.getAxContext(s,o),u=this.hashAxSubtree(s),l=this.hashAxPath(a.path);return{accessibility:{role:s.role,name:s.name||"",level:a.level,parent:a.parent,siblings:a.siblings,axTreeHash:u,axPathHash:l}}}catch(i){return this.handleError(i,e)}}async findAxNode(e,r){let i=await e.evaluate(n=>({role:n.getAttribute("role")||n.tagName.toLowerCase(),name:n.getAttribute("aria-label")||n.textContent?.trim()||"",tagName:n.tagName.toLowerCase()}));return this.searchAxTree(r,i)}searchAxTree(e,r){if(!e)return null;if(e.role===r.role&&(e.name||"").includes(r.name.substring(0,20)))return e;if(e.children)for(let i of e.children){let n=this.searchAxTree(i,r);if(n)return n}return null}getAxContext(e,r){let i={level:0,parent:null,siblings:[],path:[]},n=this.findParent(e,r);return n&&(i.parent={role:n.role,name:n.name},i.siblings=(n.children||[]).filter(o=>o!==e).map(o=>({role:o.role,name:o.name})).slice(0,3)),i.level=this.calculateLevel(e,r),i.path=this.buildPath(e,r),i}findParent(e,r,i=r){if(!i||!i.children)return null;if(i.children.includes(e))return i;for(let n of i.children){let o=this.findParent(e,r,n);if(o)return o}return null}calculateLevel(e,r,i=r,n=0){if(i===e)return n;if(i.children)for(let o of i.children){let s=this.calculateLevel(e,r,o,n+1);if(s>=0)return s}return-1}buildPath(e,r,i=r,n=[]){if(i===e)return[...n,{role:i.role,name:i.name}];if(i.children)for(let o of i.children){let s=this.buildPath(e,r,o,[...n,{role:i.role,name:i.name}]);if(s)return s}return null}hashAxSubtree(e){let r=JSON.stringify({role:e.role,name:e.name,children:(e.children||[]).map(i=>({role:i.role,name:i.name}))});return gW.createHash("md5").update(r).digest("hex").substring(0,12)}hashAxPath(e){let r=e.map(i=>`${i.role}:${i.name}`).join("/");return gW.createHash("md5").update(r).digest("hex").substring(0,12)}};var Ra=class extends Lr{constructor(e={}){super(e),this.pendingRequests=new Set,this.setupNetworkTracking=!1}getName(){return"PageStateEnricher"}getPriority(){return 95}canEnrich(e){return this.enabled&&e.page}async setupTracking(e){this.setupNetworkTracking||(e.on("request",r=>{["document","xhr","fetch"].includes(r.resourceType())&&this.pendingRequests.add(r.url())}),e.on("requestfinished",r=>{this.pendingRequests.delete(r.url())}),e.on("requestfailed",r=>{this.pendingRequests.delete(r.url())}),this.setupNetworkTracking=!0)}async enrich(e,r){try{let{page:i}=r;await this.setupTracking(i);let n=await i.evaluate(()=>({readyState:document.readyState,domContentLoaded:document.readyState!=="loading",loadComplete:document.readyState==="complete",url:document.location.href})),o=await this.checkDOMStability(i);return{page:{networkIdle:this.pendingRequests.size===0,pendingRequests:this.pendingRequests.size,domStable:o,...n}}}catch(i){return this.handleError(i,e)}}async checkDOMStability(e,r=500){try{return await e.evaluate(n=>new Promise(o=>{let s,a=0,u=new MutationObserver(()=>{a++,clearTimeout(s),s=setTimeout(()=>{u.disconnect(),o(a===0)},n)});u.observe(document.body,{childList:!0,subtree:!0,attributes:!0}),s=setTimeout(()=>{u.disconnect(),o(!0)},n)}),r)}catch{return!1}}reset(){this.pendingRequests.clear(),this.setupNetworkTracking=!1}};var Hl=class extends Lr{getName(){return"DOMEnricher"}getPriority(){return 85}canEnrich(e){return!this.enabled||!e.element||!e.event?!1:["click","fill","type","selectOption","hover"].includes(e.event.type)}async enrich(e,r){try{let{element:i}=r,n=await i.evaluate(o=>{let s=f=>{let m=[],g=f;for(;g&&g!==document.body;){let v=g.tagName.toLowerCase(),h=g.parentElement;if(h){let y=Array.from(h.children).filter(_=>_.tagName===g.tagName);if(y.length>1){let _=y.indexOf(g)+1;v+=`:nth-child(${_})`}}m.unshift(v),g=g.parentElement}return`body > ${m.join(" > ")}`},a=f=>{let m=[],g=f;for(;g&&g!==document.body;){let v=1,h=g.previousSibling;for(;h;)h.nodeType===1&&h.tagName===g.tagName&&v++,h=h.previousSibling;let y=g.tagName.toLowerCase();m.unshift(`${y}[${v}]`),g=g.parentElement}return`/html/body/${m.join("/")}`},u={};for(let f of o.attributes)u[f.name]=f.value;let l=window.getComputedStyle(o),c={display:l.display,visibility:l.visibility,opacity:l.opacity,pointerEvents:l.pointerEvents},d=0,p=o.parentElement;for(;p;)d++,p=p.parentElement;return{path:s(o),xpath:a(o),depth:d,parent:o.parentElement?o.parentElement.tagName.toLowerCase():null,tagName:o.tagName.toLowerCase(),attributes:u,state:{visible:l.display!=="none"&&l.visibility!=="hidden",enabled:!o.disabled,focused:document.activeElement===o,...c}}});return{dom:{path:n.path,xpath:n.xpath,depth:n.depth,parent:n.parent,selector:this.buildSmartSelector(n)},attributes:n.attributes,state:n.state}}catch(i){return this.handleError(i,e)}}buildSmartSelector(e){let r=e.tagName;if(e.attributes.id)return`#${e.attributes.id}`;if(e.attributes["data-test-id"])return`[data-test-id="${e.attributes["data-test-id"]}"]`;if(e.attributes.class){let i=e.attributes.class.split(" ").filter(n=>n&&!n.match(/^(active|focus|hover|disabled)/));i.length>0&&(r+=`.${i.slice(0,2).join(".")}`)}return e.parent&&(r=`${e.parent} > ${r}`),r}};var zp=class extends Lr{constructor(e={}){super(e),this.priority=200}getName(){return"MCPRef"}getPriority(){return this.priority}async enrich(e,r){let i=e.data?.params?.ref,n=e.data?.params?.element;if(!i&&!n)return null;let o=null,s=null,a=null;if(r?.element)try{let u=await r.element.evaluate(l=>({text:l.textContent?.trim()||"",innerText:l.innerText?.trim()||"",value:l.value||"",label:l.getAttribute("aria-label")||l.getAttribute("label")||"",role:l.getAttribute("role")||l.tagName.toLowerCase(),placeholder:l.getAttribute("placeholder")||"",title:l.getAttribute("title")||""}));o=u.text||u.innerText||u.value||u.placeholder,s=u.role,a=u.label||u.title,console.log(`[MCPRefEnricher] \u2705 Captured actual text: "${o}" (AI said: "${n}")`)}catch(u){console.log(`[MCPRefEnricher] \u26A0\uFE0F Could not extract actual text: ${u.message}`)}return{mcpRef:i,mcpElement:n,actualText:o,actualRole:s,actualLabel:a,recordedSelector:o||n}}};function zz(t={}){let e=new gs(t);return t.enableMCPRef!==!1&&e.register(new zp(t)),t.enableTraceText!==!1&&e.register(new ja(t)),t.enableAccessibility!==!1&&e.register(new Ca(t)),t.enablePageState!==!1&&e.register(new Ra(t)),t.enablePosition!==!1&&e.register(new Kl(t)),t.enableDOM!==!1&&e.register(new Hl(t)),e}function Nz(t={}){let e=new gs(t);return e.register(new Ca(t)),e.register(new Ra(t)),e}function e_e(t,e={}){let r=new gs(e);for(let i of t)r.register(i);return r}import{readFileSync as t_e,writeFileSync as jz}from"node:fs";import{join as yW}from"node:path";async function r_e(t,e={}){let r=yW(t,"events.json"),i=yW(t,"trace.zip");try{let n=JSON.parse(t_e(r,"utf-8")),o=n.map(a=>({...a,_enrichmentNote:"Full enrichment requires live Playwright access. Use EnrichmentPipeline during test execution."})),s=`${r}.backup`;return jz(s,JSON.stringify(n,null,2)),jz(r,JSON.stringify(o,null,2)),{enrichedCount:o.length,skippedCount:0,errors:[]}}catch(n){return console.error("[EnrichmentIntegration] Failed to enrich events:",n.message),{enrichedCount:0,skippedCount:0,errors:[n.message]}}}var Cz=class{constructor(e={}){this.pipeline=e.minimal?Nz(e):zz(e),this.events=[],this.config=e}async recordEvent(e,r,i){let n={id:this.events.length,type:e,timestamp:new Date().toISOString(),data:r},o=await this.pipeline.enrich(n,{...i,event:n});return this.events.push(o),o}saveEvents(e){jz(e,JSON.stringify(this.events,null,2)),console.log(`[LiveEnrichment] Saved ${this.events.length} enriched events to ${e}`),this.pipeline.logStatus()}getStats(){return this.pipeline.getStats()}};var wW=t=>{t?.message?.includes("Connection closed")||t?.message?.includes("MCP error -32000")||t?.code===-32e3||console.error("Unhandled rejection:",t)};process.listeners("unhandledRejection").includes(wW)||process.on("unhandledRejection",wW);async function i_e(t,e={}){let{agent:r,mcp:i,headless:n,cwd:o=process.cwd(),specPath:s,sessionPath:a,sessionTimestamp:u,...l}=e,c=vW(t,"utf-8"),d=null,{agent:p,error:f}=await a_e(o,l),m=p;if(!m&&e.fallbackAgentModule){let h=e.fallbackAgentModule,y=h.BrowserTestAutomationAgent||h.default;y&&(m=new y(l))}if(!m&&f&&console.warn(`\u26A0\uFE0F Failed to load local agent: ${f}`),!m)throw new Error(`No agent found. Please run:
337
+ Registered enrichers (${this.enrichers.length}):`);for(let e of this.enrichers){let t=e.enabled?"\u2713":"\u2717",r=this.stats.errors[e.getName()]||0,s=r>0?` (${r} errors)`:"";console.log(` ${t} ${e.getName()} (priority: ${e.getPriority()})${s}`)}console.log()}};var De=class extends J{getName(){return"PositionEnricher"}getPriority(){return 90}canEnrich(e){return!this.enabled||!e.element||!e.event?!1:["click","fill","type","selectOption","hover"].includes(e.event.type)}async enrich(e,t){try{let{page:r,element:s}=t,n=await s.boundingBox();if(!n)return null;let o=await r.evaluate(()=>({scrollX:window.scrollX,scrollY:window.scrollY,width:window.innerWidth,height:window.innerHeight})),c=n.y>=o.scrollY&&n.y+n.height<=o.scrollY+o.height&&n.x>=0&&n.x+n.width<=o.width;return{position:{boundingBox:n,viewport:o,inViewport:c,centerPoint:{x:Math.round(n.x+n.width/2),y:Math.round(n.y+n.height/2)}}}}catch(r){return this.handleError(r,e)}}};import pn from"node:crypto";var ye=class extends J{getName(){return"AccessibilityEnricher"}getPriority(){return 100}canEnrich(e){return!this.enabled||!e.element||!e.event?!1:["click","fill","type","selectOption","hover"].includes(e.event.type)}async enrich(e,t){try{let{page:r,element:s}=t,n=await r.accessibility.snapshot(),o=await this.findAxNode(s,n);if(!o)return null;let c=await this.getAxContext(o,n),l=this.hashAxSubtree(o),a=this.hashAxPath(c.path);return{accessibility:{role:o.role,name:o.name||"",level:c.level,parent:c.parent,siblings:c.siblings,axTreeHash:l,axPathHash:a}}}catch(r){return this.handleError(r,e)}}async findAxNode(e,t){let r=await e.evaluate(s=>({role:s.getAttribute("role")||s.tagName.toLowerCase(),name:s.getAttribute("aria-label")||s.textContent?.trim()||"",tagName:s.tagName.toLowerCase()}));return this.searchAxTree(t,r)}searchAxTree(e,t){if(!e)return null;if(e.role===t.role&&(e.name||"").includes(t.name.substring(0,20)))return e;if(e.children)for(let r of e.children){let s=this.searchAxTree(r,t);if(s)return s}return null}getAxContext(e,t){let r={level:0,parent:null,siblings:[],path:[]},s=this.findParent(e,t);return s&&(r.parent={role:s.role,name:s.name},r.siblings=(s.children||[]).filter(n=>n!==e).map(n=>({role:n.role,name:n.name})).slice(0,3)),r.level=this.calculateLevel(e,t),r.path=this.buildPath(e,t),r}findParent(e,t,r=t){if(!r||!r.children)return null;if(r.children.includes(e))return r;for(let s of r.children){let n=this.findParent(e,t,s);if(n)return n}return null}calculateLevel(e,t,r=t,s=0){if(r===e)return s;if(r.children)for(let n of r.children){let o=this.calculateLevel(e,t,n,s+1);if(o>=0)return o}return-1}buildPath(e,t,r=t,s=[]){if(r===e)return[...s,{role:r.role,name:r.name}];if(r.children)for(let n of r.children){let o=this.buildPath(e,t,n,[...s,{role:r.role,name:r.name}]);if(o)return o}return null}hashAxSubtree(e){let t=JSON.stringify({role:e.role,name:e.name,children:(e.children||[]).map(r=>({role:r.role,name:r.name}))});return pn.createHash("md5").update(t).digest("hex").substring(0,12)}hashAxPath(e){let t=e.map(r=>`${r.role}:${r.name}`).join("/");return pn.createHash("md5").update(t).digest("hex").substring(0,12)}};var Se=class extends J{constructor(e={}){super(e),this.pendingRequests=new Set,this.setupNetworkTracking=!1}getName(){return"PageStateEnricher"}getPriority(){return 95}canEnrich(e){return this.enabled&&e.page}async setupTracking(e){this.setupNetworkTracking||(e.on("request",t=>{["document","xhr","fetch"].includes(t.resourceType())&&this.pendingRequests.add(t.url())}),e.on("requestfinished",t=>{this.pendingRequests.delete(t.url())}),e.on("requestfailed",t=>{this.pendingRequests.delete(t.url())}),this.setupNetworkTracking=!0)}async enrich(e,t){try{let{page:r}=t;await this.setupTracking(r);let s=await r.evaluate(()=>({readyState:document.readyState,domContentLoaded:document.readyState!=="loading",loadComplete:document.readyState==="complete",url:document.location.href})),n=await this.checkDOMStability(r);return{page:{networkIdle:this.pendingRequests.size===0,pendingRequests:this.pendingRequests.size,domStable:n,...s}}}catch(r){return this.handleError(r,e)}}async checkDOMStability(e,t=500){try{return await e.evaluate(s=>new Promise(n=>{let o,c=0,l=new MutationObserver(()=>{c++,clearTimeout(o),o=setTimeout(()=>{l.disconnect(),n(c===0)},s)});l.observe(document.body,{childList:!0,subtree:!0,attributes:!0}),o=setTimeout(()=>{l.disconnect(),n(!0)},s)}),t)}catch{return!1}}reset(){this.pendingRequests.clear(),this.setupNetworkTracking=!1}};var Be=class extends J{getName(){return"DOMEnricher"}getPriority(){return 85}canEnrich(e){return!this.enabled||!e.element||!e.event?!1:["click","fill","type","selectOption","hover"].includes(e.event.type)}async enrich(e,t){try{let{element:r}=t,s=await r.evaluate(n=>{let o=f=>{let m=[],S=f;for(;S&&S!==document.body;){let g=S.tagName.toLowerCase(),w=S.parentElement;if(w){let y=Array.from(w.children).filter(E=>E.tagName===S.tagName);if(y.length>1){let E=y.indexOf(S)+1;g+=`:nth-child(${E})`}}m.unshift(g),S=S.parentElement}return`body > ${m.join(" > ")}`},c=f=>{let m=[],S=f;for(;S&&S!==document.body;){let g=1,w=S.previousSibling;for(;w;)w.nodeType===1&&w.tagName===S.tagName&&g++,w=w.previousSibling;let y=S.tagName.toLowerCase();m.unshift(`${y}[${g}]`),S=S.parentElement}return`/html/body/${m.join("/")}`},l={};for(let f of n.attributes)l[f.name]=f.value;let a=window.getComputedStyle(n),u={display:a.display,visibility:a.visibility,opacity:a.opacity,pointerEvents:a.pointerEvents},p=0,d=n.parentElement;for(;d;)p++,d=d.parentElement;return{path:o(n),xpath:c(n),depth:p,parent:n.parentElement?n.parentElement.tagName.toLowerCase():null,tagName:n.tagName.toLowerCase(),attributes:l,state:{visible:a.display!=="none"&&a.visibility!=="hidden",enabled:!n.disabled,focused:document.activeElement===n,...u}}});return{dom:{path:s.path,xpath:s.xpath,depth:s.depth,parent:s.parent,selector:this.buildSmartSelector(s)},attributes:s.attributes,state:s.state}}catch(r){return this.handleError(r,e)}}buildSmartSelector(e){let t=e.tagName;if(e.attributes.id)return`#${e.attributes.id}`;if(e.attributes["data-test-id"])return`[data-test-id="${e.attributes["data-test-id"]}"]`;if(e.attributes.class){let r=e.attributes.class.split(" ").filter(s=>s&&!s.match(/^(active|focus|hover|disabled)/));r.length>0&&(t+=`.${r.slice(0,2).join(".")}`)}return e.parent&&(t=`${e.parent} > ${t}`),t}};var it=class extends J{constructor(e={}){super(e),this.priority=200}getName(){return"MCPRef"}getPriority(){return this.priority}async enrich(e,t){let r=e.data?.params?.ref,s=e.data?.params?.element;if(!r&&!s)return null;let n=null,o=null,c=null;if(t?.element)try{let l=await t.element.evaluate(a=>({text:a.textContent?.trim()||"",innerText:a.innerText?.trim()||"",value:a.value||"",label:a.getAttribute("aria-label")||a.getAttribute("label")||"",role:a.getAttribute("role")||a.tagName.toLowerCase(),placeholder:a.getAttribute("placeholder")||"",title:a.getAttribute("title")||""}));n=l.text||l.innerText||l.value||l.placeholder,o=l.role,c=l.label||l.title,console.log(`[MCPRefEnricher] \u2705 Captured actual text: "${n}" (AI said: "${s}")`)}catch(l){console.log(`[MCPRefEnricher] \u26A0\uFE0F Could not extract actual text: ${l.message}`)}return{mcpRef:r,mcpElement:s,actualText:n,actualRole:o,actualLabel:c,recordedSelector:n||s}}};function Er(i={}){let e=new ae(i);return i.enableMCPRef!==!1&&e.register(new it(i)),i.enableTraceText!==!1&&e.register(new ge(i)),i.enableAccessibility!==!1&&e.register(new ye(i)),i.enablePageState!==!1&&e.register(new Se(i)),i.enablePosition!==!1&&e.register(new De(i)),i.enableDOM!==!1&&e.register(new Be(i)),e}function Tr(i={}){let e=new ae(i);return e.register(new ye(i)),e.register(new Se(i)),e}function aa(i,e={}){let t=new ae(e);for(let r of i)t.register(r);return t}import{readFileSync as ca,writeFileSync as vr}from"node:fs";import{join as fn}from"node:path";async function la(i,e={}){let t=fn(i,"events.json"),r=fn(i,"trace.zip");try{let s=JSON.parse(ca(t,"utf-8")),n=s.map(c=>({...c,_enrichmentNote:"Full enrichment requires live Playwright access. Use EnrichmentPipeline during test execution."})),o=`${t}.backup`;return vr(o,JSON.stringify(s,null,2)),vr(t,JSON.stringify(n,null,2)),{enrichedCount:n.length,skippedCount:0,errors:[]}}catch(s){return console.error("[EnrichmentIntegration] Failed to enrich events:",s.message),{enrichedCount:0,skippedCount:0,errors:[s.message]}}}var $r=class{constructor(e={}){this.pipeline=e.minimal?Tr(e):Er(e),this.events=[],this.config=e}async recordEvent(e,t,r){let s={id:this.events.length,type:e,timestamp:new Date().toISOString(),data:t},n=await this.pipeline.enrich(s,{...r,event:s});return this.events.push(n),n}saveEvents(e){vr(e,JSON.stringify(this.events,null,2)),console.log(`[LiveEnrichment] Saved ${this.events.length} enriched events to ${e}`),this.pipeline.logStatus()}getStats(){return this.pipeline.getStats()}};var gn=i=>{i?.message?.includes("Connection closed")||i?.message?.includes("MCP error -32000")||i?.code===-32e3||console.error("Unhandled rejection:",i)};process.listeners("unhandledRejection").includes(gn)||process.on("unhandledRejection",gn);async function pa(i,e={}){let{agent:t,mcp:r,headless:s,cwd:n=process.cwd(),specPath:o,sessionPath:c,sessionTimestamp:l,...a}=e,u=dn(i,"utf-8"),p=null,{agent:d,error:f}=await ma(n,a),m=d;if(!m&&e.fallbackAgentModule){let w=e.fallbackAgentModule,y=w.BrowserTestAutomationAgent||w.default;y&&(m=new y(a))}if(!m&&f&&console.warn(`\u26A0\uFE0F Failed to load local agent: ${f}`),!m)throw new Error(`No agent found. Please run:
476
338
  zibby init
477
339
 
478
- This will create .zibby/graph.mjs with your workflow definition.`);await m.initialize(d);let g=!1,v=()=>{if(!g)try{r_({cwd:o||process.cwd(),config:e}),g=!0}catch(h){console.warn("[zibby] run-index interrupt row:",h?.message||h)}};process.on("SIGINT",v),process.on("SIGTERM",v);try{if(e.singleNode){console.log(`
340
+ This will create .zibby/graph.mjs with your workflow definition.`);await m.initialize(p);let S=!1,g=()=>{if(!S)try{Ft({cwd:n||process.cwd(),config:e}),S=!0}catch(w){console.warn("[zibby] run-index interrupt row:",w?.message||w)}};process.on("SIGINT",g),process.on("SIGTERM",g);try{if(e.singleNode){console.log(`
479
341
  \u{1F3AF} Running Single Node: ${e.singleNode} (Framework Mode)
480
- `);let $=m.calculateOutputPath(s||t),P=m.buildGraph(),j={};for(let[q,O]of P.nodes.entries())j[q]=O.config||O;let I={};if(e.sessionId){let q=e.sessionId,O=e.paths?.output||Yt;if(q==="last"){let st=Jl(o,O,Dn);if(_W(st)){let{readdirSync:pe,statSync:J}=await import("fs"),T=pe(st).filter(G=>J(Jl(st,G)).isDirectory()).map(G=>({name:G,time:J(Jl(st,G)).mtimeMs})).sort((G,C)=>C.time-G.time);T.length>0?(q=T[0].name,console.log(`\u{1F4C2} Using latest session: ${q}`)):console.log(`\u26A0\uFE0F No sessions found in ${st}`)}}let Q=Jl(o,O,Dn,q),K=Jl(Q,"execute_live"),Oe=Jl(K,Jv);_W(Oe)?(console.log(`\u{1F4C2} Loading session: ${q}`),I={sessionPath:Q,execute_live_output:JSON.parse(vW(Oe,"utf-8"))}):console.log(`\u26A0\uFE0F Session not found: ${Q}`)}let R=await m.runSingleNode(e.singleNode,j,{testSpec:c,outputPath:$,cwd:o||process.cwd(),contextConfig:e.contextConfig,specPath:s||t,config:e,...I});return typeof m.onComplete=="function"&&await m.onComplete(R),Dp({cwd:o,config:e,result:R,success:!0,specPath:s||t}),R}let h;typeof e.onPipelineProgress=="function"?h=e.onPipelineProgress:e.runIndex?.pipelineProgress!==!1&&(h=Hz({cwd:o||process.cwd(),config:e}));let y=o||process.cwd(),_=a!=null&&String(a).trim()!==""?(()=>{let $=String(a).trim();try{return n_e($)?bW($):bW(y,$)}catch{return $}})():void 0,b=Zv(),w=_??b;Lv();let S=qv({cwd:y,config:e,traceFrom:"runTest",initialState:{sessionPath:w,sessionTimestamp:u}}),k;try{k=await m.run(c,{testSpec:c,specPath:s||t,cwd:y,config:e,sessionPath:S.sessionPath,sessionTimestamp:S.sessionTimestamp,...h?{onPipelineProgress:h}:{}})}catch($){throw typeof $?.message=="string"&&$.message.includes("Interrupted by user")&&r_({cwd:o||process.cwd(),config:e}),g||Dp({cwd:o,config:e,result:$?.partialResult||{},success:!1,specPath:s||t,errorMessage:$?.message}),$}return Dp({cwd:o,config:e,result:k,success:!0,specPath:s||t}),k}finally{process.off("SIGINT",v),process.off("SIGTERM",v),await m.cleanup()}}function o_e(t){return t.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")}function s_e(t,e){if(t[e])return t[e];let r=o_e(e);if(t[r])return t[r];let i=`${r}Workflow`;return t[i]?t[i]:null}async function HRe(t=process.cwd()){try{let{join:e}=await import("path"),{existsSync:r}=await import("fs"),{pathToFileURL:i}=await import("url"),n=e(t,".zibby/graph.mjs");if(!r(n))return{available:[],default:null,error:"No .zibby/graph.mjs found"};let o=await import(i(n).href),s=Object.keys(o).filter(u=>u!=="default"&&typeof o[u]=="function"&&o[u].prototype instanceof ql),a=o.BrowserTestAutomationAgent?"BrowserTestAutomationAgent":o.CursorAgent?"CursorAgent":o.default?"default":s[0]||null;return{available:s,default:a,error:null}}catch(e){return{available:[],default:null,error:e.message}}}async function a_e(t,e){try{let{join:r}=await import("path"),{existsSync:i}=await import("fs"),{pathToFileURL:n}=await import("url"),o=r(t,".zibby/graph.mjs");if(!i(o))return{agent:null,error:null};let s=await import(n(o).href),a=e.workflow,u;if(a){if(u=s_e(s,a),!u){let c=Object.keys(s).filter(d=>d!=="default"&&typeof s[d]=="function");throw new Error(`Workflow "${a}" not found.
481
- Available workflows: ${c.join(", ")}
482
- Supported formats: QuickSmokeWorkflow, QuickSmoke, quick-smoke`)}let l=Object.keys(s).find(c=>s[c]===u);console.log(`\u2713 Using workflow: ${l} (from --workflow ${a})`)}else{if(u=s.BrowserTestAutomationAgent||s.CursorAgent||s.default,!u){let l=Object.keys(s).filter(c=>c!=="default"&&typeof s[c]=="function"&&s[c].prototype instanceof ql);l.length>0&&(u=s[l[0]],console.log(`\u2713 Using workflow: ${l[0]} (auto-detected)`))}if(!u)return{agent:null,error:"Could not find any WorkflowAgent export in local graph.js"};u.name?.includes("auto-detected")||console.log("\u2713 Using local agent from .zibby/graph.mjs")}return{agent:new u(e),error:null}}catch(r){return{agent:null,error:r.message}}}var SW=class{constructor(e={}){this.config=e}async run(e){return i_e(e.spec||e.specPath,{...this.config,...e})}};export{sG as AGENT_TYPES,Hje as ALL_TOOLS,Ca as AccessibilityEnricher,Vr as AgentStrategy,Ll as AssistantStrategy,nve as CHAT_MEMORY_TOOLS,Yv as CI_ENV_VARS,aG as CORE_LOG_LEVELS,Yye as CORE_TOOLS,Ju as ClaudeAgentStrategy,Yu as CodexAgentStrategy,du as CursorAgentStrategy,Rve as DEFAULT_MAX_CONCURRENT_RUNS,Tr as DEFAULT_MODELS,Yt as DEFAULT_OUTPUT_BASE,Hl as DOMEnricher,zW as EVENTS_FILE,gs as EnrichmentPipeline,Lr as EventEnricher,Xye as GITHUB_TOOLS,Qu as GeminiAgentStrategy,Qye as JIRA_TOOLS,di as LOG_LEVELS,Cz as LiveEnrichmentRecorder,Mp as Logger,Dve as MAX_MAX_CONCURRENT_RUNS,Vl as MCPRefStrategy,rve as MEMORY_TOOLS,Ave as MIN_MAX_CONCURRENT_RUNS,kp as McpClientManager,ua as OpenAIToolProvider,Ra as PageStateEnricher,Bl as PlaywrightJsonVerificationStrategy,Kl as PositionEnricher,OW as RAW_OUTPUT_FILE,Jv as RESULT_FILE,sW as RIPPLE_EFFECT_SCRIPT,tve as RUNNER_TOOLS,xz as ResultHandler,Dn as SESSIONS_DIR,ci as SESSION_INFO_FILE,NW as SKILLS,ive as SKILL_TOOLS,eve as SLACK_TOOLS,Ep as SelectorGenerator,Pz as StableIdRuntime,Wl as StableIdStrategy,Ri as StreamingParser,SW as TestAutomation,hs as TestGenerationStrategy,$z as TestPostProcessor,Gl as TestVerificationStrategy,Xu as ToolCallProvider,Tp as TraceParser,ql as WorkflowAgent,$p as WorkflowGraph,Ez as ZibbyRuntime,Ip as ZibbyUploader,tG as checkCursorAgentInstalled,Ive as checkCursorAgentPatched,Lv as clearInheritedSessionEnvForFreshRun,fve as clearTokenCache,Sve as cloneRepo,e_e as createCustomPipeline,zz as createDefaultPipeline,Nz as createMinimalPipeline,nW as createUploader,r_e as enrichRecordedEvents,zve as generateRippleHelperCode,QV as generateWorkflowSessionId,gz as getAgentStrategy,Lp as getAllSkills,Eve as getApprovalKeys,rG as getCursorAgentInstallInstructions,Or as getSkill,cN as hasSkill,Ove as injectRippleEffect,FV as invokeAgent,dN as listSkillIds,HRe as listWorkflows,U as logger,gve as organizeVideos,$ve as patchCursorAgentForCI,qve as postProcessEvents,Zv as readStudioPinnedSessionPathFromEnv,lN as registerSkill,Bve as resetExecutionCount,dve as resolveIntegrationToken,Uve as resolveMaxParallelRuns,qv as resolveWorkflowSession,pW as runPlaywrightTestTool,i_e as runTest,Tve as saveApprovalKeys,JV as shouldTrustInheritedSessionEnv,YV as syncProcessEnvToSession,Jve as testGenerationManager,Xve as testVerificationManager,Mt as timeline,Kye as workflow,$_ as z};
342
+ `);let I=m.calculateOutputPath(o||i),P=m.buildGraph(),N={};for(let[O,_]of P.nodes.entries())N[O]=_.config||_;let b={};if(e.sessionId){let O=e.sessionId,_=e.paths?.output||B;if(O==="last"){let U=Fe(n,_,H);if(mn(U)){let{readdirSync:k,statSync:W}=await import("fs"),F=k(U).filter(Z=>W(Fe(U,Z)).isDirectory()).map(Z=>({name:Z,time:W(Fe(U,Z)).mtimeMs})).sort((Z,Ue)=>Ue.time-Z.time);F.length>0?(O=F[0].name,console.log(`\u{1F4C2} Using latest session: ${O}`)):console.log(`\u26A0\uFE0F No sessions found in ${U}`)}}let C=Fe(n,_,H,O),R=Fe(C,"execute_live"),L=Fe(R,Rt);mn(L)?(console.log(`\u{1F4C2} Loading session: ${O}`),b={sessionPath:C,execute_live_output:JSON.parse(dn(L,"utf-8"))}):console.log(`\u26A0\uFE0F Session not found: ${C}`)}let A=await m.runSingleNode(e.singleNode,N,{testSpec:u,outputPath:I,cwd:n||process.cwd(),contextConfig:e.contextConfig,specPath:o||i,config:e,...b});return typeof m.onComplete=="function"&&await m.onComplete(A),mt({cwd:n,config:e,result:A,success:!0,specPath:o||i}),A}let w;typeof e.onPipelineProgress=="function"?w=e.onPipelineProgress:e.runIndex?.pipelineProgress!==!1&&(w=jr({cwd:n||process.cwd(),config:e}));let y=n||process.cwd(),E=c!=null&&String(c).trim()!==""?(()=>{let I=String(c).trim();try{return ua(I)?hn(I):hn(y,I)}catch{return I}})():void 0,x=$t(),v=E??x;It();let $=At({cwd:y,config:e,traceFrom:"runTest",initialState:{sessionPath:v,sessionTimestamp:l}}),T;try{T=await m.run(u,{testSpec:u,specPath:o||i,cwd:y,config:e,sessionPath:$.sessionPath,sessionTimestamp:$.sessionTimestamp,...w?{onPipelineProgress:w}:{}})}catch(I){throw typeof I?.message=="string"&&I.message.includes("Interrupted by user")&&Ft({cwd:n||process.cwd(),config:e}),S||mt({cwd:n,config:e,result:I?.partialResult||{},success:!1,specPath:o||i,errorMessage:I?.message}),I}return mt({cwd:n,config:e,result:T,success:!0,specPath:o||i}),T}finally{process.off("SIGINT",g),process.off("SIGTERM",g),await m.cleanup()}}function fa(i){return i.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")}function da(i,e){if(i[e])return i[e];let t=fa(e);if(i[t])return i[t];let r=`${t}Workflow`;return i[r]?i[r]:null}async function _f(i=process.cwd()){try{let{join:e}=await import("path"),{existsSync:t}=await import("fs"),{pathToFileURL:r}=await import("url"),s=e(i,".zibby/graph.mjs");if(!t(s))return{available:[],default:null,error:"No .zibby/graph.mjs found"};let n=await import(r(s).href),o=Object.keys(n).filter(l=>l!=="default"&&typeof n[l]=="function"&&n[l].prototype instanceof Ce),c=n.BrowserTestAutomationAgent?"BrowserTestAutomationAgent":n.CursorAgent?"CursorAgent":n.default?"default":o[0]||null;return{available:o,default:c,error:null}}catch(e){return{available:[],default:null,error:e.message}}}async function ma(i,e){try{let{join:t}=await import("path"),{existsSync:r}=await import("fs"),{pathToFileURL:s}=await import("url"),n=t(i,".zibby/graph.mjs");if(!r(n))return{agent:null,error:null};let o=await import(s(n).href),c=e.workflow,l;if(c){if(l=da(o,c),!l){let u=Object.keys(o).filter(p=>p!=="default"&&typeof o[p]=="function");throw new Error(`Workflow "${c}" not found.
343
+ Available workflows: ${u.join(", ")}
344
+ Supported formats: QuickSmokeWorkflow, QuickSmoke, quick-smoke`)}let a=Object.keys(o).find(u=>o[u]===l);console.log(`\u2713 Using workflow: ${a} (from --workflow ${c})`)}else{if(l=o.BrowserTestAutomationAgent||o.CursorAgent||o.default,!l){let a=Object.keys(o).filter(u=>u!=="default"&&typeof o[u]=="function"&&o[u].prototype instanceof Ce);a.length>0&&(l=o[a[0]],console.log(`\u2713 Using workflow: ${a[0]} (auto-detected)`))}if(!l)return{agent:null,error:"Could not find any WorkflowAgent export in local graph.js"};l.name?.includes("auto-detected")||console.log("\u2713 Using local agent from .zibby/graph.mjs")}return{agent:new l(e),error:null}}catch(t){return{agent:null,error:t.message}}}var yn=class{constructor(e={}){this.config=e}async run(e){return pa(e.spec||e.specPath,{...this.config,...e})}};export{Vn as AGENT_TYPES,wu as ALL_TOOLS,ye as AccessibilityEnricher,K as AgentStrategy,Pe as AssistantStrategy,ui as CHAT_MEMORY_TOOLS,kt as CI_ENV_VARS,qn as CORE_LOG_LEVELS,ni as CORE_TOOLS,Ee as ClaudeAgentStrategy,Te as CodexAgentStrategy,xe as CursorAgentStrategy,Gi as DEFAULT_MAX_CONCURRENT_RUNS,G as DEFAULT_MODELS,B as DEFAULT_OUTPUT_BASE,Be as DOMEnricher,bn as EVENTS_FILE,ae as EnrichmentPipeline,J as EventEnricher,ii as GITHUB_TOOLS,ve as GeminiAgentStrategy,oi as JIRA_TOOLS,X as LOG_LEVELS,$r as LiveEnrichmentRecorder,gt as Logger,Ji as MAX_MAX_CONCURRENT_RUNS,Re as MCPRefStrategy,li as MEMORY_TOOLS,zi as MIN_MAX_CONCURRENT_RUNS,Xe as McpClientManager,de as OpenAIToolProvider,Se as PageStateEnricher,Le as PlaywrightJsonVerificationStrategy,De as PositionEnricher,_n as RAW_OUTPUT_FILE,Rt as RESULT_FILE,en as RIPPLE_EFFECT_SCRIPT,ci as RUNNER_TOOLS,gr as ResultHandler,H as SESSIONS_DIR,q as SESSION_INFO_FILE,xn as SKILLS,pi as SKILL_TOOLS,ai as SLACK_TOOLS,rt as SelectorGenerator,_r as StableIdRuntime,ke as StableIdStrategy,te as StreamingParser,yn as TestAutomation,ie as TestGenerationStrategy,yr as TestPostProcessor,Me as TestVerificationStrategy,$e as ToolCallProvider,nt as TraceParser,Ce as WorkflowAgent,et as WorkflowGraph,wr as ZibbyRuntime,tt as ZibbyUploader,Wn as checkCursorAgentInstalled,Ri as checkCursorAgentPatched,It as clearInheritedSessionEnvForFreshRun,wi as clearTokenCache,Oi as cloneRepo,aa as createCustomPipeline,Er as createDefaultPipeline,Tr as createMinimalPipeline,qs as createUploader,la as enrichRecordedEvents,Bi as generateRippleHelperCode,Ys as generateWorkflowSessionId,cr as getAgentStrategy,St as getAllSkills,ki as getApprovalKeys,Yn as getCursorAgentInstallInstructions,z as getSkill,rs as hasSkill,Di as injectRippleEffect,Ls as invokeAgent,ss as listSkillIds,_f as listWorkflows,h as logger,Ei as organizeVideos,Ni as patchCursorAgentForCI,Hi as postProcessEvents,$t as readStudioPinnedSessionPathFromEnv,ts as registerSkill,ea as resetExecutionCount,Si as resolveIntegrationToken,Wi as resolveMaxParallelRuns,At as resolveWorkflowSession,cn as runPlaywrightTestTool,pa as runTest,Li as saveApprovalKeys,Js as shouldTrustInheritedSessionEnv,Ws as syncProcessEnvToSession,sa as testGenerationManager,ia as testVerificationManager,D as timeline,ti as workflow,vf as z};