superclawd 0.1.5 → 0.1.6
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.
- package/dist/index.js +1 -1
- package/dist/mcp-server.mjs +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -238,7 +238,7 @@ ${C}[?7l${C}[?25l`),i(!0),t.setRawMode(!0),t.resume();let a=!1,l=()=>{if(!a){a=!
|
|
|
238
238
|
`;let U=`v${t}`;m+=`${y}[${Math.max(1,P-1)};${Math.max(1,S-U.length-1)}H${W}${U}${R}`,T(m)},A=(u,S,P)=>{let h=process.stdout.columns||80,m="Select your workspace \u2191/\u2193 \xB7 enter launches \xB7 d sets default \xB7 esc cancels",I=Math.max(0,Math.floor((h-m.length)/2)),U=D=>` ${D.name} ${D.slug} \xB7 ${D.role}`,O=Math.max(...u.map(D=>U(D).length)),M=Math.max(0,Math.floor((h-O)/2)),N=[`${B(I)}${H}${m}${R}`,""];for(let D=0;D<u.length;D++){let K=u[D],Q=D===S,Z=Q?`${W}\u276F `:" ",we=Q?`${W}${K.name}${R}`:K.name,Se=K.slug===P?` ${W}\u2605 default${R}`:"";N.push(`${B(M)}${Z}${we} ${H}${K.slug} \xB7 ${K.role}${R}${Se}`)}d(N)};return{phase:(u,S)=>f(u-1,S,jr),ready:u=>f(e,u,Fr),message(u){let S=process.stdout.columns||80,P=Math.max(0,Math.floor((S-u.length)/2));d([`${B(P)}${H}${u}${R}`]),r=Date.now()},selectWorkspace(u,S){return new Promise(P=>{let h=S?.currentSlug?u.findIndex(O=>O.slug===S.currentSlug):-1,m=h>=0?h:0,I=S?.defaultSlug;s&&process.stdin.off("data",i),A(u,m,I);let U=O=>{let M=O.toString();M===""||M===y?(process.stdin.off("data",U),P(null)):M==="\r"||M===`
|
|
239
239
|
`?(process.stdin.off("data",U),process.stdin.on("data",i),P(u[m].slug)):M==="d"||M==="D"?(I=u[m].slug,S?.onSetDefault?.(I),A(u,m,I)):M===`${y}[A`||M==="k"?(m=(m-1+u.length)%u.length,A(u,m,I)):(M===`${y}[B`||M==="j")&&(m=(m+1)%u.length,A(u,m,I))};process.stdin.on("data",U)})},fail(u){o&&c(),o=!1,w(),process.stderr.write(`${ge}\u2717 ${u}${R}
|
|
240
240
|
`)},note(){},handoff(){s&&(process.stdin.off("data",i),process.stdin.pause(),s=!1),T(We+Ue),process.off("SIGINT",g),process.off("SIGTERM",g)},finish(){o&&c(),o=!1,w()}}}function qr(){return process.platform!=="win32"?!0:!!(process.env.WT_SESSION||process.env.TERM_PROGRAM||process.env.TERM)}function Jr(){return{async phase(){},message(){},async selectWorkspace(e,t){return t?.currentSlug??e[0]?.slug??null},async ready(){},fail(e){process.stderr.write(`${ge}\u2717 ${e}${R}
|
|
241
|
-
`)},note(){},handoff(){},finish(){}}}function ln(e){if(e.quiet)return Jr();let t=process.stdout.isTTY===!0,n=e.version??"";return e.plain||!t||!qr()?Br(e.total,n):Hr(e.total,n)}var Vr=["low","medium","high","xhigh","max"];function un(e){let t=!1,n="",r=null,o=!1,s=!1,i=null,a=!1,l=!1,c="board",g=null,E=null,w=null;for(let p=0;p<e.length;p++){let f=e[p],d=e[p+1];f==="-p"||f==="--print"?(t=!0,d&&!d.startsWith("-")&&(n=d,p++)):f==="--workspace"||f==="-w"?d&&!d.startsWith("-")&&(r=d,p++):f==="--no-capture"?o=!0:f==="--resume"||f==="-r"?(s=!0,d&&!d.startsWith("-")&&(i=d,p++)):f==="--pipelines"?a=!0:f==="--pipelines-tools"?l=!0:f.startsWith("--pipelines-tools=")?(l=!0,c=f.slice(18)==="restricted"?"restricted":"board"):f==="--session-id"?d&&!d.startsWith("-")&&(g=d,p++):f==="--model"?d&&!d.startsWith("-")&&(E=d,p++):f==="--effort"&&d&&Vr.includes(d)&&(w=d,p++)}return{printMode:t,printPrompt:n,workspace:r,noCapture:o,resume:s,resumeSessionId:i,pipelines:a,pipelinesTools:l,pipelinesToolsMode:c,sessionId:g,model:E,effort:w}}var pn={name:"superclawd",version:"0.1.
|
|
241
|
+
`)},note(){},handoff(){},finish(){}}}function ln(e){if(e.quiet)return Jr();let t=process.stdout.isTTY===!0,n=e.version??"";return e.plain||!t||!qr()?Br(e.total,n):Hr(e.total,n)}var Vr=["low","medium","high","xhigh","max"];function un(e){let t=!1,n="",r=null,o=!1,s=!1,i=null,a=!1,l=!1,c="board",g=null,E=null,w=null;for(let p=0;p<e.length;p++){let f=e[p],d=e[p+1];f==="-p"||f==="--print"?(t=!0,d&&!d.startsWith("-")&&(n=d,p++)):f==="--workspace"||f==="-w"?d&&!d.startsWith("-")&&(r=d,p++):f==="--no-capture"?o=!0:f==="--resume"||f==="-r"?(s=!0,d&&!d.startsWith("-")&&(i=d,p++)):f==="--pipelines"?a=!0:f==="--pipelines-tools"?l=!0:f.startsWith("--pipelines-tools=")?(l=!0,c=f.slice(18)==="restricted"?"restricted":"board"):f==="--session-id"?d&&!d.startsWith("-")&&(g=d,p++):f==="--model"?d&&!d.startsWith("-")&&(E=d,p++):f==="--effort"&&d&&Vr.includes(d)&&(w=d,p++)}return{printMode:t,printPrompt:n,workspace:r,noCapture:o,resume:s,resumeSessionId:i,pipelines:a,pipelinesTools:l,pipelinesToolsMode:c,sessionId:g,model:E,effort:w}}var pn={name:"superclawd",version:"0.1.6",description:"Claude Code, supercharged \u2014 your team's standards, every session. The superclawd CLI loads your workspace's skills, agents, commands, workflows, and live directives into Claude Code as a plugin.",author:"SuperClawd <support@superclawd.com>",license:"SEE LICENSE IN LICENSE",homepage:"https://superclawd.com",repository:{type:"git",url:"https://github.com/superclawd-ai/superclawd"},bugs:{url:"https://github.com/superclawd-ai/superclawd/issues"},keywords:["superclawd","claude-code","claude","plugin","skills","agents","mcp","ai-assistant","coding-standards","model-context-protocol"],engines:{node:">=20"},type:"module",main:"dist/index.js",bin:{superclawd:"dist/index.js"},files:["dist","README.md","LICENSE"],scripts:{build:"node build.mjs",dev:"node build.mjs && tsx src/index.ts",typecheck:"tsc --noEmit",lint:"eslint 'src/**/*.{ts,tsx}'","lint:fix":"eslint 'src/**/*.{ts,tsx}' --fix",format:"prettier --check 'src/**/*.{ts,tsx}'","format:fix":"prettier --write 'src/**/*.{ts,tsx}'",selftest:"tsx test/mcp-selftest.ts","test:guardrails":"tsx test/guardrails-eval.test.ts",test:"node build.mjs && tsx test/mcp-selftest.ts && tsx test/pipelines-tools.test.ts && tsx test/guardrails-eval.test.ts && tsx test/hooks-capture.test.ts && tsx test/translator-teams.test.ts && tsx test/run-args.test.ts && tsx test/pipelines.test.ts && tsx test/update-check.test.ts && tsx test/retrieve.test.ts && tsx test/config-private-memory.test.ts && tsx test/config-choose-workspace.test.ts && tsx test/config.test.ts && tsx test/translator-basics.test.ts && tsx test/hook-helper-guardrails.test.ts && tsx test/capture-prompts.test.ts && tsx test/mcp-backend-real.test.ts && tsx test/catalog.test.ts",prepublishOnly:"npm run build","publish:npm":"npm publish","version:bump":"npm version patch --no-git-tag-version"},dependencies:{"@modelcontextprotocol/sdk":"^1.7.0",zod:"^3.24.2"},devDependencies:{"@eslint/js":"^9.39.1","@types/node":"^22.10.0","@typescript-eslint/eslint-plugin":"^8.44.1","@typescript-eslint/parser":"^8.44.1",esbuild:"^0.24.0",eslint:"^9.36.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4",prettier:"^3.6.2",tsx:"^4.19.0",typescript:"^5.7.0"}};var Ne=pn.version,he=process.env.SUPERCLAWD_DRY_RUN==="1"||process.argv.includes("--dry-run");function no(){try{let e=Qr("git remote get-url origin",{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(e)return e.replace(/\.git$/,"").toLowerCase()}catch{}return`dir:${Zr(process.cwd())}`}function ro(){if(process.env.SUPERCLAWD_MCP_SERVER_PATH)return process.env.SUPERCLAWD_MCP_SERVER_PATH;let e=dn(new URL("./mcp-server.mjs",import.meta.url));return mn(e)?e:dn(new URL("../dist/mcp-server.mjs",import.meta.url))}function oo(){return`superclawd \u2014 Claude Code, supercharged with your SuperClawd workspace.
|
|
242
242
|
|
|
243
243
|
Usage:
|
|
244
244
|
superclawd Launch Claude with your skills/agents/directives loaded
|
package/dist/mcp-server.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'module'; const require = __cr(import.meta.url);
|
|
2
2
|
var ey=Object.create;var di=Object.defineProperty;var ty=Object.getOwnPropertyDescriptor;var ry=Object.getOwnPropertyNames;var ny=Object.getPrototypeOf,oy=Object.prototype.hasOwnProperty;var _o=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),vo=(t,e)=>{for(var r in e)di(t,r,{get:e[r],enumerable:!0})},sy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ry(e))!oy.call(t,o)&&o!==r&&di(t,o,{get:()=>e[o],enumerable:!(n=ty(e,o))||n.enumerable});return t};var Il=(t,e,r)=>(r=t!=null?ey(ny(t)):{},sy(e||!t||!t.__esModule?di(r,"default",{value:t,enumerable:!0}):r,t));var qn=S(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.regexpCode=X.getEsmExportName=X.getProperty=X.safeStringify=X.stringify=X.strConcat=X.addCodeArg=X.str=X._=X.nil=X._Code=X.Name=X.IDENTIFIER=X._CodeOrName=void 0;var Dn=class{};X._CodeOrName=Dn;X.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var $r=class extends Dn{constructor(e){if(super(),!X.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}}};X.Name=$r;var Ye=class extends Dn{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,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof $r&&(r[n.str]=(r[n.str]||0)+1),r),{})}};X._Code=Ye;X.nil=new Ye("");function Of(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Nc(r,e[n]),r.push(t[++n]);return new Ye(r)}X._=Of;var Oc=new Ye("+");function Nf(t,...e){let r=[Ln(t[0])],n=0;for(;n<e.length;)r.push(Oc),Nc(r,e[n]),r.push(Oc,Ln(t[++n]));return o0(r),new Ye(r)}X.str=Nf;function Nc(t,e){e instanceof Ye?t.push(...e._items):e instanceof $r?t.push(e):t.push(a0(e))}X.addCodeArg=Nc;function o0(t){let e=1;for(;e<t.length-1;){if(t[e]===Oc){let r=s0(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function s0(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof $r||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 $r))return`"${t}${e.slice(1)}`}function i0(t,e){return e.emptyStr()?t:t.emptyStr()?e:Nf`${t}${e}`}X.strConcat=i0;function a0(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ln(Array.isArray(t)?t.join(","):t)}function c0(t){return new Ye(Ln(t))}X.stringify=c0;function Ln(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}X.safeStringify=Ln;function u0(t){return typeof t=="string"&&X.IDENTIFIER.test(t)?new Ye(`.${t}`):Of`[${t}]`}X.getProperty=u0;function l0(t){if(typeof t=="string"&&X.IDENTIFIER.test(t))return new Ye(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}X.getEsmExportName=l0;function d0(t){return new Ye(t.toString())}X.regexpCode=d0});var Zc=S(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.ValueScope=De.ValueScopeName=De.Scope=De.varKinds=De.UsedValueState=void 0;var je=qn(),Cc=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},gs;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(gs||(De.UsedValueState=gs={}));De.varKinds={const:new je.Name("const"),let:new je.Name("let"),var:new je.Name("var")};var ys=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof je.Name?e:this.name(e)}name(e){return new je.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.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}}};De.Scope=ys;var _s=class extends je.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,je._)`.${new je.Name(r)}[${n}]`}};De.ValueScopeName=_s;var p0=(0,je._)`\n`,Ac=class extends ys{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?p0:je.nil}}get(){return this._scope}name(e){return new _s(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,je._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=je.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,gs.Started);let l=r(u);if(l){let d=this.opts.es5?De.varKinds.var:De.varKinds.const;s=(0,je._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,je._)`${s}${l}${this.opts._n}`;else throw new Cc(u);c.set(u,gs.Completed)})}return s}};De.ValueScope=Ac});var U=S(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.or=F.and=F.not=F.CodeGen=F.operators=F.varKinds=F.ValueScopeName=F.ValueScope=F.Scope=F.Name=F.regexpCode=F.stringify=F.getProperty=F.nil=F.strConcat=F.str=F._=void 0;var J=qn(),ut=Zc(),Bt=qn();Object.defineProperty(F,"_",{enumerable:!0,get:function(){return Bt._}});Object.defineProperty(F,"str",{enumerable:!0,get:function(){return Bt.str}});Object.defineProperty(F,"strConcat",{enumerable:!0,get:function(){return Bt.strConcat}});Object.defineProperty(F,"nil",{enumerable:!0,get:function(){return Bt.nil}});Object.defineProperty(F,"getProperty",{enumerable:!0,get:function(){return Bt.getProperty}});Object.defineProperty(F,"stringify",{enumerable:!0,get:function(){return Bt.stringify}});Object.defineProperty(F,"regexpCode",{enumerable:!0,get:function(){return Bt.regexpCode}});Object.defineProperty(F,"Name",{enumerable:!0,get:function(){return Bt.Name}});var ws=Zc();Object.defineProperty(F,"Scope",{enumerable:!0,get:function(){return ws.Scope}});Object.defineProperty(F,"ValueScope",{enumerable:!0,get:function(){return ws.ValueScope}});Object.defineProperty(F,"ValueScopeName",{enumerable:!0,get:function(){return ws.ValueScopeName}});Object.defineProperty(F,"varKinds",{enumerable:!0,get:function(){return ws.varKinds}});F.operators={GT:new J._Code(">"),GTE:new J._Code(">="),LT:new J._Code("<"),LTE:new J._Code("<="),EQ:new J._Code("==="),NEQ:new J._Code("!=="),NOT:new J._Code("!"),OR:new J._Code("||"),AND:new J._Code("&&"),ADD:new J._Code("+")};var Nt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Mc=class extends Nt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ut.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=tn(this.rhs,e,r)),this}get names(){return this.rhs instanceof J._CodeOrName?this.rhs.names:{}}},vs=class extends Nt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof J.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=tn(this.rhs,e,r),this}get names(){let e=this.lhs instanceof J.Name?{}:{...this.lhs.names};return xs(e,this.rhs)}},jc=class extends vs{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Dc=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Lc=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},qc=class extends Nt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Uc=class extends Nt{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=tn(this.code,e,r),this}get names(){return this.code instanceof J._CodeOrName?this.code.names:{}}},Un=class extends Nt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(f0(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>zr(e,r.names),{})}},Ct=class extends Un{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Vc=class extends Un{},en=class extends Ct{};en.kind="else";var kr=class t extends Ct{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 n=r.optimizeNodes();r=this.else=Array.isArray(n)?new en(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Cf(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=tn(this.condition,e,r),this}get names(){let e=super.names;return xs(e,this.condition),this.else&&zr(e,this.else.names),e}};kr.kind="if";var Sr=class extends Ct{};Sr.kind="for";var Fc=class extends Sr{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=tn(this.iteration,e,r),this}get names(){return zr(super.names,this.iteration.names)}},Hc=class extends Sr{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?ut.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=xs(super.names,this.from);return xs(e,this.to)}},bs=class extends Sr{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}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=tn(this.iterable,e,r),this}get names(){return zr(super.names,this.iterable.names)}},Vn=class extends Ct{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Vn.kind="func";var Fn=class extends Un{render(e){return"return "+super.render(e)}};Fn.kind="return";var Wc=class extends Ct{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 n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&zr(e,this.catch.names),this.finally&&zr(e,this.finally.names),e}},Hn=class extends Ct{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Hn.kind="catch";var Wn=class extends Ct{render(e){return"finally"+super.render(e)}};Wn.kind="finally";var Bc=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
-
`:""},this._extScope=e,this._scope=new ut.Scope({parent:e}),this._nodes=[new Vc]}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 n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Mc(e,s,n)),s}const(e,r,n){return this._def(ut.varKinds.const,e,r,n)}let(e,r,n){return this._def(ut.varKinds.let,e,r,n)}var(e,r,n){return this._def(ut.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new vs(e,r,n))}add(e,r){return this._leafNode(new jc(e,F.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==J.nil&&this._leafNode(new Uc(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,J.addCodeArg)(r,o));return r.push("}"),new J._Code(r)}if(e,r,n){if(this._blockNode(new kr(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new kr(e))}else(){return this._elseNode(new en)}endIf(){return this._endBlockNode(kr,en)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Fc(e),r)}forRange(e,r,n,o,s=this.opts.es5?ut.varKinds.var:ut.varKinds.let){let i=this._scope.toName(e);return this._for(new Hc(s,i,r,n),()=>o(i))}forOf(e,r,n,o=ut.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof J.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,J._)`${i}.length`,a=>{this.var(s,(0,J._)`${i}[${a}]`),n(s)})}return this._for(new bs("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?ut.varKinds.var:ut.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,J._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new bs("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(Sr)}label(e){return this._leafNode(new Dc(e))}break(e){return this._leafNode(new Lc(e))}return(e){let r=new Fn;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Fn)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Wc;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new Hn(s),r(s)}return n&&(this._currNode=o.finally=new Wn,this.code(n)),this._endBlockNode(Hn,Wn)}throw(e){return this._leafNode(new qc(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 n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=J.nil,n,o){return this._blockNode(new Vn(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Vn)}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 n=this._currNode;if(n instanceof e||r&&n 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 kr))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}};F.CodeGen=Bc;function zr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function xs(t,e){return e instanceof J._CodeOrName?zr(t,e.names):t}function tn(t,e,r){if(t instanceof J.Name)return n(t);if(!o(t))return t;return new J._Code(t._items.reduce((s,i)=>(i instanceof J.Name&&(i=n(i)),i instanceof J._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof J._Code&&s._items.some(i=>i instanceof J.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function f0(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Cf(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,J._)`!${Kc(t)}`}F.not=Cf;var m0=Af(F.operators.AND);function h0(...t){return t.reduce(m0)}F.and=h0;var g0=Af(F.operators.OR);function y0(...t){return t.reduce(g0)}F.or=y0;function Af(t){return(e,r)=>e===J.nil?r:r===J.nil?e:(0,J._)`${Kc(e)} ${t} ${Kc(r)}`}function Kc(t){return t instanceof J.Name?t:(0,J._)`(${t})`}});var Q=S(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.checkStrictMode=H.getErrorPath=H.Type=H.useFunc=H.setEvaluated=H.evaluatedPropsToName=H.mergeEvaluated=H.eachItem=H.unescapeJsonPointer=H.escapeJsonPointer=H.escapeFragment=H.unescapeFragment=H.schemaRefOrVal=H.schemaHasRulesButRef=H.schemaHasRules=H.checkUnknownRules=H.alwaysValidSchema=H.toHash=void 0;var oe=U(),_0=qn();function v0(t){let e={};for(let r of t)e[r]=!0;return e}H.toHash=v0;function b0(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(jf(t,e),!Df(e,t.self.RULES.all))}H.alwaysValidSchema=b0;function jf(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||Uf(t,`unknown keyword: "${s}"`)}H.checkUnknownRules=jf;function Df(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}H.schemaHasRules=Df;function x0(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}H.schemaHasRulesButRef=x0;function w0({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,oe._)`${r}`}return(0,oe._)`${t}${e}${(0,oe.getProperty)(n)}`}H.schemaRefOrVal=w0;function $0(t){return Lf(decodeURIComponent(t))}H.unescapeFragment=$0;function k0(t){return encodeURIComponent(Gc(t))}H.escapeFragment=k0;function Gc(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}H.escapeJsonPointer=Gc;function Lf(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}H.unescapeJsonPointer=Lf;function S0(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}H.eachItem=S0;function Zf({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof oe.Name?(s instanceof oe.Name?t(o,s,i):e(o,s,i),i):s instanceof oe.Name?(e(o,i,s),s):r(s,i);return a===oe.Name&&!(c instanceof oe.Name)?n(o,c):c}}H.mergeEvaluated={props:Zf({mergeNames:(t,e,r)=>t.if((0,oe._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,oe._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,oe._)`${r} || {}`).code((0,oe._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,oe._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,oe._)`${r} || {}`),Yc(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:qf}),items:Zf({mergeNames:(t,e,r)=>t.if((0,oe._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,oe._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,oe._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,oe._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function qf(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,oe._)`{}`);return e!==void 0&&Yc(t,r,e),r}H.evaluatedPropsToName=qf;function Yc(t,e,r){Object.keys(r).forEach(n=>t.assign((0,oe._)`${e}${(0,oe.getProperty)(n)}`,!0))}H.setEvaluated=Yc;var Mf={};function z0(t,e){return t.scopeValue("func",{ref:e,code:Mf[e.code]||(Mf[e.code]=new _0._Code(e.code))})}H.useFunc=z0;var Jc;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Jc||(H.Type=Jc={}));function E0(t,e,r){if(t instanceof oe.Name){let n=e===Jc.Num;return r?n?(0,oe._)`"[" + ${t} + "]"`:(0,oe._)`"['" + ${t} + "']"`:n?(0,oe._)`"/" + ${t}`:(0,oe._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,oe.getProperty)(t).toString():"/"+Gc(t)}H.getErrorPath=E0;function Uf(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}H.checkStrictMode=Uf});var At=S(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});var Pe=U(),P0={data:new Pe.Name("data"),valCxt:new Pe.Name("valCxt"),instancePath:new Pe.Name("instancePath"),parentData:new Pe.Name("parentData"),parentDataProperty:new Pe.Name("parentDataProperty"),rootData:new Pe.Name("rootData"),dynamicAnchors:new Pe.Name("dynamicAnchors"),vErrors:new Pe.Name("vErrors"),errors:new Pe.Name("errors"),this:new Pe.Name("this"),self:new Pe.Name("self"),scope:new Pe.Name("scope"),json:new Pe.Name("json"),jsonPos:new Pe.Name("jsonPos"),jsonLen:new Pe.Name("jsonLen"),jsonPart:new Pe.Name("jsonPart")};Xc.default=P0});var Bn=S(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.extendErrors=Te.resetErrorsCount=Te.reportExtraError=Te.reportError=Te.keyword$DataError=Te.keywordError=void 0;var G=U(),$s=Q(),Oe=At();Te.keywordError={message:({keyword:t})=>(0,G.str)`must pass "${t}" keyword validation`};Te.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,G.str)`"${t}" keyword must be ${e} ($data)`:(0,G.str)`"${t}" keyword is invalid ($data)`};function T0(t,e=Te.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=Hf(t,e,r);n??(i||a)?Vf(s,c):Ff(o,(0,G._)`[${c}]`)}Te.reportError=T0;function R0(t,e=Te.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=Hf(t,e,r);Vf(o,a),s||i||Ff(n,Oe.default.vErrors)}Te.reportExtraError=R0;function I0(t,e){t.assign(Oe.default.errors,e),t.if((0,G._)`${Oe.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,G._)`${Oe.default.vErrors}.length`,e),()=>t.assign(Oe.default.vErrors,null)))}Te.resetErrorsCount=I0;function O0({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,Oe.default.errors,a=>{t.const(i,(0,G._)`${Oe.default.vErrors}[${a}]`),t.if((0,G._)`${i}.instancePath === undefined`,()=>t.assign((0,G._)`${i}.instancePath`,(0,G.strConcat)(Oe.default.instancePath,s.errorPath))),t.assign((0,G._)`${i}.schemaPath`,(0,G.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,G._)`${i}.schema`,r),t.assign((0,G._)`${i}.data`,n))})}Te.extendErrors=O0;function Vf(t,e){let r=t.const("err",e);t.if((0,G._)`${Oe.default.vErrors} === null`,()=>t.assign(Oe.default.vErrors,(0,G._)`[${r}]`),(0,G._)`${Oe.default.vErrors}.push(${r})`),t.code((0,G._)`${Oe.default.errors}++`)}function Ff(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,G._)`new ${t.ValidationError}(${e})`):(r.assign((0,G._)`${n}.errors`,e),r.return(!1))}var Er={keyword:new G.Name("keyword"),schemaPath:new G.Name("schemaPath"),params:new G.Name("params"),propertyName:new G.Name("propertyName"),message:new G.Name("message"),schema:new G.Name("schema"),parentSchema:new G.Name("parentSchema")};function Hf(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,G._)`{}`:N0(t,e,r)}function N0(t,e,r={}){let{gen:n,it:o}=t,s=[C0(o,r),A0(t,r)];return Z0(t,e,s),n.object(...s)}function C0({errorPath:t},{instancePath:e}){let r=e?(0,G.str)`${t}${(0,$s.getErrorPath)(e,$s.Type.Str)}`:t;return[Oe.default.instancePath,(0,G.strConcat)(Oe.default.instancePath,r)]}function A0({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,G.str)`${e}/${t}`;return r&&(o=(0,G.str)`${o}${(0,$s.getErrorPath)(r,$s.Type.Str)}`),[Er.schemaPath,o]}function Z0(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Er.keyword,o],[Er.params,typeof e=="function"?e(t):e||(0,G._)`{}`]),c.messages&&n.push([Er.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Er.schema,i],[Er.parentSchema,(0,G._)`${l}${d}`],[Oe.default.data,s]),u&&n.push([Er.propertyName,u])}});var Bf=S(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.boolOrEmptySchema=rn.topBoolOrEmptySchema=void 0;var M0=Bn(),j0=U(),D0=At(),L0={message:"boolean schema is false"};function q0(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Wf(t,!1):typeof r=="object"&&r.$async===!0?e.return(D0.default.data):(e.assign((0,j0._)`${n}.errors`,null),e.return(!0))}rn.topBoolOrEmptySchema=q0;function U0(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Wf(t)):r.var(e,!0)}rn.boolOrEmptySchema=U0;function Wf(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,M0.reportError)(o,L0,void 0,e)}});var Qc=S(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.getRules=nn.isJSONType=void 0;var V0=["string","number","integer","boolean","null","object","array"],F0=new Set(V0);function H0(t){return typeof t=="string"&&F0.has(t)}nn.isJSONType=H0;function W0(){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:{}}}nn.getRules=W0});var eu=S(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.shouldUseRule=Kt.shouldUseGroup=Kt.schemaHasRulesForType=void 0;function B0({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Kf(t,n)}Kt.schemaHasRulesForType=B0;function Kf(t,e){return e.rules.some(r=>Jf(t,r))}Kt.shouldUseGroup=Kf;function Jf(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Kt.shouldUseRule=Jf});var Kn=S(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var K0=Qc(),J0=eu(),G0=Bn(),L=U(),Gf=Q(),on;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(on||(Re.DataType=on={}));function Y0(t){let e=Yf(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}Re.getSchemaTypes=Y0;function Yf(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(K0.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Re.getJSONTypes=Yf;function X0(t,e){let{gen:r,data:n,opts:o}=t,s=Q0(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,J0.schemaHasRulesForType)(t,e[0]));if(i){let a=ru(e,n,o.strictNumbers,on.Wrong);r.if(a,()=>{s.length?ew(t,e,s):nu(t)})}return i}Re.coerceAndCheckDataType=X0;var Xf=new Set(["string","number","integer","boolean","null"]);function Q0(t,e){return e?t.filter(r=>Xf.has(r)||e==="array"&&r==="array"):[]}function ew(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,L._)`typeof ${o}`),a=n.let("coerced",(0,L._)`undefined`);s.coerceTypes==="array"&&n.if((0,L._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,L._)`${o}[0]`).assign(i,(0,L._)`typeof ${o}`).if(ru(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,L._)`${a} !== undefined`);for(let u of r)(Xf.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),nu(t),n.endIf(),n.if((0,L._)`${a} !== undefined`,()=>{n.assign(o,a),tw(t,a)});function c(u){switch(u){case"string":n.elseIf((0,L._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,L._)`"" + ${o}`).elseIf((0,L._)`${o} === null`).assign(a,(0,L._)`""`);return;case"number":n.elseIf((0,L._)`${i} == "boolean" || ${o} === null
|
|
3
|
+
`:""},this._extScope=e,this._scope=new ut.Scope({parent:e}),this._nodes=[new Vc]}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 n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Mc(e,s,n)),s}const(e,r,n){return this._def(ut.varKinds.const,e,r,n)}let(e,r,n){return this._def(ut.varKinds.let,e,r,n)}var(e,r,n){return this._def(ut.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new vs(e,r,n))}add(e,r){return this._leafNode(new jc(e,F.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==J.nil&&this._leafNode(new Uc(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,J.addCodeArg)(r,o));return r.push("}"),new J._Code(r)}if(e,r,n){if(this._blockNode(new kr(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new kr(e))}else(){return this._elseNode(new en)}endIf(){return this._endBlockNode(kr,en)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Fc(e),r)}forRange(e,r,n,o,s=this.opts.es5?ut.varKinds.var:ut.varKinds.let){let i=this._scope.toName(e);return this._for(new Hc(s,i,r,n),()=>o(i))}forOf(e,r,n,o=ut.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof J.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,J._)`${i}.length`,a=>{this.var(s,(0,J._)`${i}[${a}]`),n(s)})}return this._for(new bs("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?ut.varKinds.var:ut.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,J._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new bs("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(Sr)}label(e){return this._leafNode(new Dc(e))}break(e){return this._leafNode(new Lc(e))}return(e){let r=new Fn;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Fn)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Wc;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new Hn(s),r(s)}return n&&(this._currNode=o.finally=new Wn,this.code(n)),this._endBlockNode(Hn,Wn)}throw(e){return this._leafNode(new qc(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 n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=J.nil,n,o){return this._blockNode(new Vn(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Vn)}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 n=this._currNode;if(n instanceof e||r&&n 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 kr))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}};F.CodeGen=Bc;function zr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function xs(t,e){return e instanceof J._CodeOrName?zr(t,e.names):t}function tn(t,e,r){if(t instanceof J.Name)return n(t);if(!o(t))return t;return new J._Code(t._items.reduce((s,i)=>(i instanceof J.Name&&(i=n(i)),i instanceof J._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof J._Code&&s._items.some(i=>i instanceof J.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function f0(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Cf(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,J._)`!${Kc(t)}`}F.not=Cf;var m0=Af(F.operators.AND);function h0(...t){return t.reduce(m0)}F.and=h0;var g0=Af(F.operators.OR);function y0(...t){return t.reduce(g0)}F.or=y0;function Af(t){return(e,r)=>e===J.nil?r:r===J.nil?e:(0,J._)`${Kc(e)} ${t} ${Kc(r)}`}function Kc(t){return t instanceof J.Name?t:(0,J._)`(${t})`}});var Q=S(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.checkStrictMode=H.getErrorPath=H.Type=H.useFunc=H.setEvaluated=H.evaluatedPropsToName=H.mergeEvaluated=H.eachItem=H.unescapeJsonPointer=H.escapeJsonPointer=H.escapeFragment=H.unescapeFragment=H.schemaRefOrVal=H.schemaHasRulesButRef=H.schemaHasRules=H.checkUnknownRules=H.alwaysValidSchema=H.toHash=void 0;var se=U(),_0=qn();function v0(t){let e={};for(let r of t)e[r]=!0;return e}H.toHash=v0;function b0(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(jf(t,e),!Df(e,t.self.RULES.all))}H.alwaysValidSchema=b0;function jf(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||Uf(t,`unknown keyword: "${s}"`)}H.checkUnknownRules=jf;function Df(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}H.schemaHasRules=Df;function x0(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}H.schemaHasRulesButRef=x0;function w0({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,se._)`${r}`}return(0,se._)`${t}${e}${(0,se.getProperty)(n)}`}H.schemaRefOrVal=w0;function $0(t){return Lf(decodeURIComponent(t))}H.unescapeFragment=$0;function k0(t){return encodeURIComponent(Gc(t))}H.escapeFragment=k0;function Gc(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}H.escapeJsonPointer=Gc;function Lf(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}H.unescapeJsonPointer=Lf;function S0(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}H.eachItem=S0;function Zf({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof se.Name?(s instanceof se.Name?t(o,s,i):e(o,s,i),i):s instanceof se.Name?(e(o,i,s),s):r(s,i);return a===se.Name&&!(c instanceof se.Name)?n(o,c):c}}H.mergeEvaluated={props:Zf({mergeNames:(t,e,r)=>t.if((0,se._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,se._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,se._)`${r} || {}`).code((0,se._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,se._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,se._)`${r} || {}`),Yc(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:qf}),items:Zf({mergeNames:(t,e,r)=>t.if((0,se._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,se._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,se._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,se._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function qf(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,se._)`{}`);return e!==void 0&&Yc(t,r,e),r}H.evaluatedPropsToName=qf;function Yc(t,e,r){Object.keys(r).forEach(n=>t.assign((0,se._)`${e}${(0,se.getProperty)(n)}`,!0))}H.setEvaluated=Yc;var Mf={};function z0(t,e){return t.scopeValue("func",{ref:e,code:Mf[e.code]||(Mf[e.code]=new _0._Code(e.code))})}H.useFunc=z0;var Jc;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Jc||(H.Type=Jc={}));function E0(t,e,r){if(t instanceof se.Name){let n=e===Jc.Num;return r?n?(0,se._)`"[" + ${t} + "]"`:(0,se._)`"['" + ${t} + "']"`:n?(0,se._)`"/" + ${t}`:(0,se._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,se.getProperty)(t).toString():"/"+Gc(t)}H.getErrorPath=E0;function Uf(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}H.checkStrictMode=Uf});var At=S(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});var Pe=U(),P0={data:new Pe.Name("data"),valCxt:new Pe.Name("valCxt"),instancePath:new Pe.Name("instancePath"),parentData:new Pe.Name("parentData"),parentDataProperty:new Pe.Name("parentDataProperty"),rootData:new Pe.Name("rootData"),dynamicAnchors:new Pe.Name("dynamicAnchors"),vErrors:new Pe.Name("vErrors"),errors:new Pe.Name("errors"),this:new Pe.Name("this"),self:new Pe.Name("self"),scope:new Pe.Name("scope"),json:new Pe.Name("json"),jsonPos:new Pe.Name("jsonPos"),jsonLen:new Pe.Name("jsonLen"),jsonPart:new Pe.Name("jsonPart")};Xc.default=P0});var Bn=S(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.extendErrors=Te.resetErrorsCount=Te.reportExtraError=Te.reportError=Te.keyword$DataError=Te.keywordError=void 0;var G=U(),$s=Q(),Oe=At();Te.keywordError={message:({keyword:t})=>(0,G.str)`must pass "${t}" keyword validation`};Te.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,G.str)`"${t}" keyword must be ${e} ($data)`:(0,G.str)`"${t}" keyword is invalid ($data)`};function T0(t,e=Te.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=Hf(t,e,r);n??(i||a)?Vf(s,c):Ff(o,(0,G._)`[${c}]`)}Te.reportError=T0;function R0(t,e=Te.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=Hf(t,e,r);Vf(o,a),s||i||Ff(n,Oe.default.vErrors)}Te.reportExtraError=R0;function I0(t,e){t.assign(Oe.default.errors,e),t.if((0,G._)`${Oe.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,G._)`${Oe.default.vErrors}.length`,e),()=>t.assign(Oe.default.vErrors,null)))}Te.resetErrorsCount=I0;function O0({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,Oe.default.errors,a=>{t.const(i,(0,G._)`${Oe.default.vErrors}[${a}]`),t.if((0,G._)`${i}.instancePath === undefined`,()=>t.assign((0,G._)`${i}.instancePath`,(0,G.strConcat)(Oe.default.instancePath,s.errorPath))),t.assign((0,G._)`${i}.schemaPath`,(0,G.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,G._)`${i}.schema`,r),t.assign((0,G._)`${i}.data`,n))})}Te.extendErrors=O0;function Vf(t,e){let r=t.const("err",e);t.if((0,G._)`${Oe.default.vErrors} === null`,()=>t.assign(Oe.default.vErrors,(0,G._)`[${r}]`),(0,G._)`${Oe.default.vErrors}.push(${r})`),t.code((0,G._)`${Oe.default.errors}++`)}function Ff(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,G._)`new ${t.ValidationError}(${e})`):(r.assign((0,G._)`${n}.errors`,e),r.return(!1))}var Er={keyword:new G.Name("keyword"),schemaPath:new G.Name("schemaPath"),params:new G.Name("params"),propertyName:new G.Name("propertyName"),message:new G.Name("message"),schema:new G.Name("schema"),parentSchema:new G.Name("parentSchema")};function Hf(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,G._)`{}`:N0(t,e,r)}function N0(t,e,r={}){let{gen:n,it:o}=t,s=[C0(o,r),A0(t,r)];return Z0(t,e,s),n.object(...s)}function C0({errorPath:t},{instancePath:e}){let r=e?(0,G.str)`${t}${(0,$s.getErrorPath)(e,$s.Type.Str)}`:t;return[Oe.default.instancePath,(0,G.strConcat)(Oe.default.instancePath,r)]}function A0({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,G.str)`${e}/${t}`;return r&&(o=(0,G.str)`${o}${(0,$s.getErrorPath)(r,$s.Type.Str)}`),[Er.schemaPath,o]}function Z0(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Er.keyword,o],[Er.params,typeof e=="function"?e(t):e||(0,G._)`{}`]),c.messages&&n.push([Er.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Er.schema,i],[Er.parentSchema,(0,G._)`${l}${d}`],[Oe.default.data,s]),u&&n.push([Er.propertyName,u])}});var Bf=S(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.boolOrEmptySchema=rn.topBoolOrEmptySchema=void 0;var M0=Bn(),j0=U(),D0=At(),L0={message:"boolean schema is false"};function q0(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Wf(t,!1):typeof r=="object"&&r.$async===!0?e.return(D0.default.data):(e.assign((0,j0._)`${n}.errors`,null),e.return(!0))}rn.topBoolOrEmptySchema=q0;function U0(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Wf(t)):r.var(e,!0)}rn.boolOrEmptySchema=U0;function Wf(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,M0.reportError)(o,L0,void 0,e)}});var Qc=S(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.getRules=nn.isJSONType=void 0;var V0=["string","number","integer","boolean","null","object","array"],F0=new Set(V0);function H0(t){return typeof t=="string"&&F0.has(t)}nn.isJSONType=H0;function W0(){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:{}}}nn.getRules=W0});var eu=S(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.shouldUseRule=Kt.shouldUseGroup=Kt.schemaHasRulesForType=void 0;function B0({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Kf(t,n)}Kt.schemaHasRulesForType=B0;function Kf(t,e){return e.rules.some(r=>Jf(t,r))}Kt.shouldUseGroup=Kf;function Jf(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Kt.shouldUseRule=Jf});var Kn=S(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var K0=Qc(),J0=eu(),G0=Bn(),L=U(),Gf=Q(),on;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(on||(Re.DataType=on={}));function Y0(t){let e=Yf(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}Re.getSchemaTypes=Y0;function Yf(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(K0.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Re.getJSONTypes=Yf;function X0(t,e){let{gen:r,data:n,opts:o}=t,s=Q0(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,J0.schemaHasRulesForType)(t,e[0]));if(i){let a=ru(e,n,o.strictNumbers,on.Wrong);r.if(a,()=>{s.length?ew(t,e,s):nu(t)})}return i}Re.coerceAndCheckDataType=X0;var Xf=new Set(["string","number","integer","boolean","null"]);function Q0(t,e){return e?t.filter(r=>Xf.has(r)||e==="array"&&r==="array"):[]}function ew(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,L._)`typeof ${o}`),a=n.let("coerced",(0,L._)`undefined`);s.coerceTypes==="array"&&n.if((0,L._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,L._)`${o}[0]`).assign(i,(0,L._)`typeof ${o}`).if(ru(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,L._)`${a} !== undefined`);for(let u of r)(Xf.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),nu(t),n.endIf(),n.if((0,L._)`${a} !== undefined`,()=>{n.assign(o,a),tw(t,a)});function c(u){switch(u){case"string":n.elseIf((0,L._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,L._)`"" + ${o}`).elseIf((0,L._)`${o} === null`).assign(a,(0,L._)`""`);return;case"number":n.elseIf((0,L._)`${i} == "boolean" || ${o} === null
|
|
4
4
|
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,L._)`+${o}`);return;case"integer":n.elseIf((0,L._)`${i} === "boolean" || ${o} === null
|
|
5
5
|
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,L._)`+${o}`);return;case"boolean":n.elseIf((0,L._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,L._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,L._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,L._)`${i} === "string" || ${i} === "number"
|
|
6
6
|
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,L._)`[${o}]`)}}}function tw({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,L._)`${e} !== undefined`,()=>t.assign((0,L._)`${e}[${r}]`,n))}function tu(t,e,r,n=on.Correct){let o=n===on.Correct?L.operators.EQ:L.operators.NEQ,s;switch(t){case"null":return(0,L._)`${e} ${o} null`;case"array":s=(0,L._)`Array.isArray(${e})`;break;case"object":s=(0,L._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,L._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,L._)`typeof ${e} ${o} ${t}`}return n===on.Correct?s:(0,L.not)(s);function i(a=L.nil){return(0,L.and)((0,L._)`typeof ${e} == "number"`,a,r?(0,L._)`isFinite(${e})`:L.nil)}}Re.checkDataType=tu;function ru(t,e,r,n){if(t.length===1)return tu(t[0],e,r,n);let o,s=(0,Gf.toHash)(t);if(s.array&&s.object){let i=(0,L._)`typeof ${e} != "object"`;o=s.null?i:(0,L._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else o=L.nil;s.number&&delete s.integer;for(let i in s)o=(0,L.and)(o,tu(i,e,r,n));return o}Re.checkDataTypes=ru;var rw={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,L._)`{type: ${t}}`:(0,L._)`{type: ${e}}`};function nu(t){let e=nw(t);(0,G0.reportError)(e,rw)}Re.reportTypeError=nu;function nw(t){let{gen:e,data:r,schema:n}=t,o=(0,Gf.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var em=S(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.assignDefaults=void 0;var sn=U(),ow=Q();function sw(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)Qf(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Qf(t,s,o.default))}ks.assignDefaults=sw;function Qf(t,e,r){let{gen:n,compositeRule:o,data:s,opts:i}=t;if(r===void 0)return;let a=(0,sn._)`${s}${(0,sn.getProperty)(e)}`;if(o){(0,ow.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,sn._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,sn._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,sn._)`${a} = ${(0,sn.stringify)(r)}`)}});var Xe=S(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.validateUnion=re.validateArray=re.usePattern=re.callValidateCode=re.schemaProperties=re.allSchemaProperties=re.noPropertyInData=re.propertyInData=re.isOwnProperty=re.hasPropFunc=re.reportMissingProp=re.checkMissingProp=re.checkReportMissingProp=void 0;var ce=U(),ou=Q(),Jt=At(),iw=Q();function aw(t,e){let{gen:r,data:n,it:o}=t;r.if(iu(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ce._)`${e}`},!0),t.error()})}re.checkReportMissingProp=aw;function cw({gen:t,data:e,it:{opts:r}},n,o){return(0,ce.or)(...n.map(s=>(0,ce.and)(iu(t,e,s,r.ownProperties),(0,ce._)`${o} = ${s}`)))}re.checkMissingProp=cw;function uw(t,e){t.setParams({missingProperty:e},!0),t.error()}re.reportMissingProp=uw;function tm(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ce._)`Object.prototype.hasOwnProperty`})}re.hasPropFunc=tm;function su(t,e,r){return(0,ce._)`${tm(t)}.call(${e}, ${r})`}re.isOwnProperty=su;function lw(t,e,r,n){let o=(0,ce._)`${e}${(0,ce.getProperty)(r)} !== undefined`;return n?(0,ce._)`${o} && ${su(t,e,r)}`:o}re.propertyInData=lw;function iu(t,e,r,n){let o=(0,ce._)`${e}${(0,ce.getProperty)(r)} === undefined`;return n?(0,ce.or)(o,(0,ce.not)(su(t,e,r))):o}re.noPropertyInData=iu;function rm(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}re.allSchemaProperties=rm;function dw(t,e){return rm(e).filter(r=>!(0,ou.alwaysValidSchema)(t,e[r]))}re.schemaProperties=dw;function pw({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,ce._)`${t}, ${e}, ${n}${o}`:e,d=[[Jt.default.instancePath,(0,ce.strConcat)(Jt.default.instancePath,s)],[Jt.default.parentData,i.parentData],[Jt.default.parentDataProperty,i.parentDataProperty],[Jt.default.rootData,Jt.default.rootData]];i.opts.dynamicRef&&d.push([Jt.default.dynamicAnchors,Jt.default.dynamicAnchors]);let h=(0,ce._)`${l}, ${r.object(...d)}`;return c!==ce.nil?(0,ce._)`${a}.call(${c}, ${h})`:(0,ce._)`${a}(${h})`}re.callValidateCode=pw;var fw=(0,ce._)`new RegExp`;function mw({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,ce._)`${o.code==="new RegExp"?fw:(0,iw.useFunc)(t,o)}(${r}, ${n})`})}re.usePattern=mw;function hw(t){let{gen:e,data:r,keyword:n,it:o}=t,s=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,ce._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:ou.Type.Num},s),e.if((0,ce.not)(s),a)})}}re.validateArray=hw;function gw(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ou.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,ce._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,ce.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}re.validateUnion=gw});var sm=S(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.validateKeywordUsage=bt.validSchemaType=bt.funcKeywordCode=bt.macroKeywordCode=void 0;var Ne=U(),Pr=At(),yw=Xe(),_w=Bn();function vw(t,e){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=t,a=e.macro.call(i.self,o,s,i),c=om(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Ne.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}bt.macroKeywordCode=vw;function bw(t,e){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=t;ww(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=om(n,o,u),d=n.let("valid");t.block$data(d,h),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function h(){if(e.errors===!1)f(),e.modifying&&nm(t),g(()=>t.error());else{let v=e.async?m():p();e.modifying&&nm(t),g(()=>xw(t,v))}}function m(){let v=n.let("ruleErrs",null);return n.try(()=>f((0,Ne._)`await `),w=>n.assign(d,!1).if((0,Ne._)`${w} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,Ne._)`${w}.errors`),()=>n.throw(w))),v}function p(){let v=(0,Ne._)`${l}.errors`;return n.assign(v,null),f(Ne.nil),v}function f(v=e.async?(0,Ne._)`await `:Ne.nil){let w=c.opts.passContext?Pr.default.this:Pr.default.self,$=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Ne._)`${v}${(0,yw.callValidateCode)(t,l,w,$)}`,e.modifying)}function g(v){var w;n.if((0,Ne.not)((w=e.valid)!==null&&w!==void 0?w:d),v)}}bt.funcKeywordCode=bw;function nm(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Ne._)`${n.parentData}[${n.parentDataProperty}]`))}function xw(t,e){let{gen:r}=t;r.if((0,Ne._)`Array.isArray(${e})`,()=>{r.assign(Pr.default.vErrors,(0,Ne._)`${Pr.default.vErrors} === null ? ${e} : ${Pr.default.vErrors}.concat(${e})`).assign(Pr.default.errors,(0,Ne._)`${Pr.default.vErrors}.length`),(0,_w.extendErrors)(t)},()=>t.error())}function ww({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function om(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,Ne.stringify)(r)})}function $w(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}bt.validSchemaType=$w;function kw({schema:t,opts:e,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}bt.validateKeywordUsage=kw});var am=S(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.extendSubschemaMode=Gt.extendSubschemaData=Gt.getSubschema=void 0;var xt=U(),im=Q();function Sw(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&n!==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,xt._)`${t.schemaPath}${(0,xt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,xt._)`${t.schemaPath}${(0,xt.getProperty)(e)}${(0,xt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,im.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Gt.getSubschema=Sw;function zw(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==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:u,dataPathArr:l,opts:d}=e,h=a.let("data",(0,xt._)`${e.data}${(0,xt.getProperty)(r)}`,!0);c(h),t.errorPath=(0,xt.str)`${u}${(0,im.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,xt._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof xt.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}Gt.extendSubschemaData=zw;function Ew(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}Gt.extendSubschemaMode=Ew});var au=S((BO,cm)=>{"use strict";cm.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 n,o,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))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(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var lm=S((KO,um)=>{"use strict";var Yt=um.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Ss(e,n,o,t,"",t)};Yt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Yt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Yt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Yt.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 Ss(t,e,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Yt.arrayKeywords)for(var h=0;h<d.length;h++)Ss(t,e,r,d[h],o+"/"+l+"/"+h,s,o,l,n,h)}else if(l in Yt.propsKeywords){if(d&&typeof d=="object")for(var m in d)Ss(t,e,r,d[m],o+"/"+l+"/"+Pw(m),s,o,l,n,m)}else(l in Yt.keywords||t.allKeys&&!(l in Yt.skipKeywords))&&Ss(t,e,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function Pw(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Jn=S(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.getSchemaRefs=Le.resolveUrl=Le.normalizeId=Le._getFullPath=Le.getFullPath=Le.inlineRef=void 0;var Tw=Q(),Rw=au(),Iw=lm(),Ow=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Nw(t,e=!0){return typeof t=="boolean"?!0:e===!0?!cu(t):e?dm(t)<=e:!1}Le.inlineRef=Nw;var Cw=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function cu(t){for(let e in t){if(Cw.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(cu)||typeof r=="object"&&cu(r))return!0}return!1}function dm(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Ow.has(r)&&(typeof t[r]=="object"&&(0,Tw.eachItem)(t[r],n=>e+=dm(n)),e===1/0))return 1/0}return e}function pm(t,e="",r){r!==!1&&(e=an(e));let n=t.parse(e);return fm(t,n)}Le.getFullPath=pm;function fm(t,e){return t.serialize(e).split("#")[0]+"#"}Le._getFullPath=fm;var Aw=/#\/?$/;function an(t){return t?t.replace(Aw,""):""}Le.normalizeId=an;function Zw(t,e,r){return r=an(r),t.resolve(e,r)}Le.resolveUrl=Zw;var Mw=/^[a-z_][-a-z0-9._]*$/i;function jw(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=an(t[r]||e),s={"":o},i=pm(n,o,!1),a={},c=new Set;return Iw(t,{allKeys:!0},(d,h,m,p)=>{if(p===void 0)return;let f=i+h,g=s[p];typeof d[r]=="string"&&(g=v.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),s[h]=g;function v($){let E=this.opts.uriResolver.resolve;if($=an(g?E(g,$):$),c.has($))throw l($);c.add($);let R=this.refs[$];return typeof R=="string"&&(R=this.refs[R]),typeof R=="object"?u(d,R.schema,$):$!==an(f)&&($[0]==="#"?(u(d,a[$],$),a[$]=d):this.refs[$]=f),$}function w($){if(typeof $=="string"){if(!Mw.test($))throw new Error(`invalid anchor "${$}"`);v.call(this,`#${$}`)}}}),a;function u(d,h,m){if(h!==void 0&&!Rw(d,h))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Le.getSchemaRefs=jw});var Xn=S(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.getData=Xt.KeywordCxt=Xt.validateFunctionCode=void 0;var _m=Bf(),mm=Kn(),lu=eu(),zs=Kn(),Dw=em(),Yn=sm(),uu=am(),I=U(),j=At(),Lw=Jn(),Zt=Q(),Gn=Bn();function qw(t){if(xm(t)&&(wm(t),bm(t))){Fw(t);return}vm(t,()=>(0,_m.topBoolOrEmptySchema)(t))}Xt.validateFunctionCode=qw;function vm({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},s){o.code.es5?t.func(e,(0,I._)`${j.default.data}, ${j.default.valCxt}`,n.$async,()=>{t.code((0,I._)`"use strict"; ${hm(r,o)}`),Vw(t,o),t.code(s)}):t.func(e,(0,I._)`${j.default.data}, ${Uw(o)}`,n.$async,()=>t.code(hm(r,o)).code(s))}function Uw(t){return(0,I._)`{${j.default.instancePath}="", ${j.default.parentData}, ${j.default.parentDataProperty}, ${j.default.rootData}=${j.default.data}${t.dynamicRef?(0,I._)`, ${j.default.dynamicAnchors}={}`:I.nil}}={}`}function Vw(t,e){t.if(j.default.valCxt,()=>{t.var(j.default.instancePath,(0,I._)`${j.default.valCxt}.${j.default.instancePath}`),t.var(j.default.parentData,(0,I._)`${j.default.valCxt}.${j.default.parentData}`),t.var(j.default.parentDataProperty,(0,I._)`${j.default.valCxt}.${j.default.parentDataProperty}`),t.var(j.default.rootData,(0,I._)`${j.default.valCxt}.${j.default.rootData}`),e.dynamicRef&&t.var(j.default.dynamicAnchors,(0,I._)`${j.default.valCxt}.${j.default.dynamicAnchors}`)},()=>{t.var(j.default.instancePath,(0,I._)`""`),t.var(j.default.parentData,(0,I._)`undefined`),t.var(j.default.parentDataProperty,(0,I._)`undefined`),t.var(j.default.rootData,j.default.data),e.dynamicRef&&t.var(j.default.dynamicAnchors,(0,I._)`{}`)})}function Fw(t){let{schema:e,opts:r,gen:n}=t;vm(t,()=>{r.$comment&&e.$comment&&km(t),Jw(t),n.let(j.default.vErrors,null),n.let(j.default.errors,0),r.unevaluated&&Hw(t),$m(t),Xw(t)})}function Hw(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,I._)`${r}.evaluated`),e.if((0,I._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,I._)`${t.evaluated}.props`,(0,I._)`undefined`)),e.if((0,I._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,I._)`${t.evaluated}.items`,(0,I._)`undefined`))}function hm(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,I._)`/*# sourceURL=${r} */`:I.nil}function Ww(t,e){if(xm(t)&&(wm(t),bm(t))){Bw(t,e);return}(0,_m.boolOrEmptySchema)(t,e)}function bm({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 xm(t){return typeof t.schema!="boolean"}function Bw(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&km(t),Gw(t),Yw(t);let s=n.const("_errs",j.default.errors);$m(t,s),n.var(e,(0,I._)`${s} === ${j.default.errors}`)}function wm(t){(0,Zt.checkUnknownRules)(t),Kw(t)}function $m(t,e){if(t.opts.jtd)return gm(t,[],!1,e);let r=(0,mm.getSchemaTypes)(t.schema),n=(0,mm.coerceAndCheckDataType)(t,r);gm(t,r,!n,e)}function Kw(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Zt.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Jw(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Zt.checkStrictMode)(t,"default is ignored in the schema root")}function Gw(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Lw.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Yw(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function km({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)t.code((0,I._)`${j.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,I.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,I._)`${j.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Xw(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=t;r.$async?e.if((0,I._)`${j.default.errors} === 0`,()=>e.return(j.default.data),()=>e.throw((0,I._)`new ${o}(${j.default.vErrors})`)):(e.assign((0,I._)`${n}.errors`,j.default.vErrors),s.unevaluated&&Qw(t),e.return((0,I._)`${j.default.errors} === 0`))}function Qw({gen:t,evaluated:e,props:r,items:n}){r instanceof I.Name&&t.assign((0,I._)`${e}.props`,r),n instanceof I.Name&&t.assign((0,I._)`${e}.items`,n)}function gm(t,e,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Zt.schemaHasRulesButRef)(s,l))){o.block(()=>zm(t,"$ref",l.all.$ref.definition));return}c.jtd||e$(t,e),o.block(()=>{for(let h of l.rules)d(h);d(l.post)});function d(h){(0,lu.shouldUseGroup)(s,h)&&(h.type?(o.if((0,zs.checkDataType)(h.type,i,c.strictNumbers)),ym(t,h),e.length===1&&e[0]===h.type&&r&&(o.else(),(0,zs.reportTypeError)(t)),o.endIf()):ym(t,h),a||o.if((0,I._)`${j.default.errors} === ${n||0}`))}}function ym(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,Dw.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,lu.shouldUseRule)(n,s)&&zm(t,s.keyword,s.definition,e.type)})}function e$(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(t$(t,e),t.opts.allowUnionTypes||r$(t,e),n$(t,t.dataTypes))}function t$(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Sm(t.dataTypes,r)||du(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),s$(t,e)}}function r$(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&du(t,"use allowUnionTypes to allow union type keyword")}function n$(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,lu.shouldUseRule)(t.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>o$(e,i))&&du(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function o$(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Sm(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function s$(t,e){let r=[];for(let n of t.dataTypes)Sm(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function du(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Zt.checkStrictMode)(t,e,t.opts.strictTypes)}var Es=class{constructor(e,r,n){if((0,Yn.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Zt.schemaRefOrVal)(e,this.schema,n,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",Em(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Yn.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",j.default.errors))}result(e,r,n){this.failResult((0,I.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():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,I.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,I._)`${r} !== undefined && (${(0,I.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Gn.reportExtraError:Gn.reportError)(this,this.def.error,r)}$dataError(){(0,Gn.reportError)(this,this.def.$dataError||Gn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Gn.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,n=I.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=I.nil,r=I.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,I.or)((0,I._)`${o} === undefined`,r)),e!==I.nil&&n.assign(e,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==I.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,I.or)(i(),a());function i(){if(n.length){if(!(r instanceof I.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,I._)`${(0,zs.checkDataTypes)(c,r,s.opts.strictNumbers,zs.DataType.Wrong)}`}return I.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,I._)`!${c}(${r})`}return I.nil}}subschema(e,r){let n=(0,uu.getSubschema)(this.it,e);(0,uu.extendSubschemaData)(n,this.it,e),(0,uu.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return Ww(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Zt.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Zt.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,I.Name)),!0}};Xt.KeywordCxt=Es;function zm(t,e,r,n){let o=new Es(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Yn.funcKeywordCode)(o,r):"macro"in r?(0,Yn.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Yn.funcKeywordCode)(o,r)}var i$=/^\/(?:[^~]|~0|~1)*$/,a$=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Em(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,s;if(t==="")return j.default.rootData;if(t[0]==="/"){if(!i$.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,s=j.default.rootData}else{let u=a$.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,I._)`${s}${(0,I.getProperty)((0,Zt.unescapeJsonPointer)(u))}`,i=(0,I._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Xt.getData=Em});var Ps=S(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});var pu=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};fu.default=pu});var Qn=S(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});var mu=Jn(),hu=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,mu.resolveUrl)(e,r,n),this.missingSchema=(0,mu.normalizeId)((0,mu.getFullPath)(e,this.missingRef))}};gu.default=hu});var Rs=S(Qe=>{"use strict";Object.defineProperty(Qe,"__esModule",{value:!0});Qe.resolveSchema=Qe.getCompilingSchema=Qe.resolveRef=Qe.compileSchema=Qe.SchemaEnv=void 0;var lt=U(),c$=Ps(),Tr=At(),dt=Jn(),Pm=Q(),u$=Xn(),cn=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=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,dt.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Qe.SchemaEnv=cn;function _u(t){let e=Tm.call(this,t);if(e)return e;let r=(0,dt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new lt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:c$.default,code:(0,lt._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Tr.default.data,parentData:Tr.default.parentData,parentDataProperty:Tr.default.parentDataProperty,dataNames:[Tr.default.data],dataPathArr:[lt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,lt.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:lt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,lt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,u$.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Tr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let m=new Function(`${Tr.default.self}`,`${Tr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=t.schema,m.schemaEnv=t,t.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:p,items:f}=u;m.evaluated={props:p instanceof lt.Name?void 0:p,items:f instanceof lt.Name?void 0:f,dynamicProps:p instanceof lt.Name,dynamicItems:f instanceof lt.Name},m.source&&(m.source.evaluated=(0,lt.stringify)(m.evaluated))}return t.validate=m,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}Qe.compileSchema=_u;function l$(t,e,r){var n;r=(0,dt.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let s=f$.call(this,t,r);if(s===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new cn({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=d$.call(this,s)}Qe.resolveRef=l$;function d$(t){return(0,dt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:_u.call(this,t)}function Tm(t){for(let e of this._compilations)if(p$(e,t))return e}Qe.getCompilingSchema=Tm;function p$(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function f$(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Ts.call(this,t,e)}function Ts(t,e){let r=this.opts.uriResolver.parse(e),n=(0,dt._getFullPath)(this.opts.uriResolver,r),o=(0,dt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return yu.call(this,r,t);let s=(0,dt.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Ts.call(this,t,i);return typeof a?.schema!="object"?void 0:yu.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||_u.call(this,i),s===(0,dt.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,dt.resolveUrl)(this.opts.uriResolver,o,u)),new cn({schema:a,schemaId:c,root:t,baseId:o})}return yu.call(this,r,i)}}Qe.resolveSchema=Ts;var m$=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function yu(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Pm.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!m$.has(a)&&u&&(e=(0,dt.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Pm.schemaHasRulesButRef)(r,this.RULES)){let a=(0,dt.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=Ts.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new cn({schema:r,schemaId:i,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var Rm=S((eN,h$)=>{h$.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 bu=S((tN,Cm)=>{"use strict";var g$=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Om=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 vu(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var y$=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Im(t){return t.length=0,!0}function _$(t,e,r){if(t.length){let n=vu(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function v$(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],s=!1,i=!1,a=_$;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=Im}else{o.push(u);continue}}return o.length&&(a===Im?r.zone=o.join(""):i?n.push(o.join("")):n.push(vu(o))),r.address=n.join(""),r}function Nm(t){if(b$(t,":")<2)return{host:t,isIPV6:!1};let e=v$(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function b$(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function x$(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===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(o===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((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function w$(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 $$(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!Om(r)){let n=Nm(r);n.isIPV6===!0?r=`[${n.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}Cm.exports={nonSimpleDomain:y$,recomposeAuthority:$$,normalizeComponentEncoding:w$,removeDotSegments:x$,isIPv4:Om,isUUID:g$,normalizeIPv6:Nm,stringArrayToHexStripped:vu}});var Dm=S((rN,jm)=>{"use strict";var{isUUID:k$}=bu(),S$=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,z$=["http","https","ws","wss","urn","urn:uuid"];function E$(t){return z$.indexOf(t)!==-1}function xu(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 Am(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Zm(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 P$(t){return t.secure=xu(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function T$(t){if((t.port===(xu(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 R$(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(S$);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,s=wu(o);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function I$(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,s=wu(o);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function O$(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!k$(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function N$(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Mm={scheme:"http",domainHost:!0,parse:Am,serialize:Zm},C$={scheme:"https",domainHost:Mm.domainHost,parse:Am,serialize:Zm},Is={scheme:"ws",domainHost:!0,parse:P$,serialize:T$},A$={scheme:"wss",domainHost:Is.domainHost,parse:Is.parse,serialize:Is.serialize},Z$={scheme:"urn",parse:R$,serialize:I$,skipNormalize:!0},M$={scheme:"urn:uuid",parse:O$,serialize:N$,skipNormalize:!0},Os={http:Mm,https:C$,ws:Is,wss:A$,urn:Z$,"urn:uuid":M$};Object.setPrototypeOf(Os,null);function wu(t){return t&&(Os[t]||Os[t.toLowerCase()])||void 0}jm.exports={wsIsSecure:xu,SCHEMES:Os,isValidSchemeName:E$,getSchemeHandler:wu}});var Um=S((nN,Cs)=>{"use strict";var{normalizeIPv6:j$,removeDotSegments:eo,recomposeAuthority:D$,normalizeComponentEncoding:Ns,isIPv4:L$,nonSimpleDomain:q$}=bu(),{SCHEMES:U$,getSchemeHandler:Lm}=Dm();function V$(t,e){return typeof t=="string"?t=wt(Mt(t,e),e):typeof t=="object"&&(t=Mt(wt(t,e),e)),t}function F$(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=qm(Mt(t,n),Mt(e,n),n,!0);return n.skipEscape=!0,wt(o,n)}function qm(t,e,r,n){let o={};return n||(t=Mt(wt(t,r),r),e=Mt(wt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=eo(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=eo(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=eo(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=eo(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function H$(t,e,r){return typeof t=="string"?(t=unescape(t),t=wt(Ns(Mt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=wt(Ns(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=wt(Ns(Mt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=wt(Ns(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function wt(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:""},n=Object.assign({},e),o=[],s=Lm(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let i=D$(r);if(i!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(i),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=eo(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var W$=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Mt(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let s=t.match(W$);if(s){if(n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5]),n.host)if(L$(n.host)===!1){let c=j$(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let i=Lm(r.scheme||n.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&n.host&&(r.domainHost||i&&i.domainHost)&&o===!1&&q$(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!i||i&&!i.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),i&&i.parse&&i.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var $u={SCHEMES:U$,normalize:V$,resolve:F$,resolveComponent:qm,equal:H$,serialize:wt,parse:Mt};Cs.exports=$u;Cs.exports.default=$u;Cs.exports.fastUri=$u});var Fm=S(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});var Vm=Um();Vm.code='require("ajv/dist/runtime/uri").default';ku.default=Vm});var Xm=S(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.CodeGen=Se.Name=Se.nil=Se.stringify=Se.str=Se._=Se.KeywordCxt=void 0;var B$=Xn();Object.defineProperty(Se,"KeywordCxt",{enumerable:!0,get:function(){return B$.KeywordCxt}});var un=U();Object.defineProperty(Se,"_",{enumerable:!0,get:function(){return un._}});Object.defineProperty(Se,"str",{enumerable:!0,get:function(){return un.str}});Object.defineProperty(Se,"stringify",{enumerable:!0,get:function(){return un.stringify}});Object.defineProperty(Se,"nil",{enumerable:!0,get:function(){return un.nil}});Object.defineProperty(Se,"Name",{enumerable:!0,get:function(){return un.Name}});Object.defineProperty(Se,"CodeGen",{enumerable:!0,get:function(){return un.CodeGen}});var K$=Ps(),Jm=Qn(),J$=Qc(),to=Rs(),G$=U(),ro=Jn(),As=Kn(),zu=Q(),Hm=Rm(),Y$=Fm(),Gm=(t,e)=>new RegExp(t,e);Gm.code="new RegExp";var X$=["removeAdditional","useDefaults","coerceTypes"],Q$=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),ek={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."},tk={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Wm=200;function rk(t){var e,r,n,o,s,i,a,c,u,l,d,h,m,p,f,g,v,w,$,E,R,pe,He,Zr,ui;let vn=t.strict,li=(e=t.code)===null||e===void 0?void 0:e.optimize,Tl=li===!0||li===void 0?1:li||0,Rl=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Gm,Qg=(o=t.uriResolver)!==null&&o!==void 0?o:Y$.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:vn)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:vn)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:vn)!==null&&l!==void 0?l:"log",strictTuples:(h=(d=t.strictTuples)!==null&&d!==void 0?d:vn)!==null&&h!==void 0?h:"log",strictRequired:(p=(m=t.strictRequired)!==null&&m!==void 0?m:vn)!==null&&p!==void 0?p:!1,code:t.code?{...t.code,optimize:Tl,regExp:Rl}:{optimize:Tl,regExp:Rl},loopRequired:(f=t.loopRequired)!==null&&f!==void 0?f:Wm,loopEnum:(g=t.loopEnum)!==null&&g!==void 0?g:Wm,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:($=t.inlineRefs)!==null&&$!==void 0?$:!0,schemaId:(E=t.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(R=t.addUsedSchema)!==null&&R!==void 0?R:!0,validateSchema:(pe=t.validateSchema)!==null&&pe!==void 0?pe:!0,validateFormats:(He=t.validateFormats)!==null&&He!==void 0?He:!0,unicodeRegExp:(Zr=t.unicodeRegExp)!==null&&Zr!==void 0?Zr:!0,int32range:(ui=t.int32range)!==null&&ui!==void 0?ui:!0,uriResolver:Qg}}var no=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...rk(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new G$.ValueScope({scope:{},prefixes:Q$,es5:r,lines:n}),this.logger=ck(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,J$.getRules)(),Bm.call(this,ek,e,"NOT SUPPORTED"),Bm.call(this,tk,e,"DEPRECATED","warn"),this._metaOpts=ik.call(this),e.formats&&ok.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&sk.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),nk.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=Hm;n==="id"&&(o={...Hm},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!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 n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await s.call(this,l.$schema);let h=this._addSchema(l,d);return h.validate||i.call(this,h)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Jm.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,o);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,ro.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(e){let r;for(;typeof(r=Km.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new to.SchemaEnv({schema:{},schemaId:n});if(r=to.resolveSchema.call(this,o,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=Km.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 n=e[this.opts.schemaId];return n&&(n=(0,ro.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),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 n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(lk.call(this,n,r),!r)return(0,zu.eachItem)(n,s=>Su.call(this,s)),this;pk.call(this,r);let o={...r,type:(0,As.getJSONTypes)(r.type),schemaType:(0,As.getJSONTypes)(r.schemaType)};return(0,zu.eachItem)(n,o.type.length===0?s=>Su.call(this,s,o):s=>o.type.forEach(i=>Su.call(this,s,o,i))),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 n of r.rules){let o=n.rules.findIndex(s=>s.keyword===e);o>=0&&n.rules.splice(o,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:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let s=o.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=Ym(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=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 c=this._cache.get(e);if(c!==void 0)return c;n=(0,ro.normalizeId)(i||n);let u=ro.getSchemaRefs.call(this,e,n);return c=new to.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_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):to.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{to.compileSchema.call(this,e)}finally{this.opts=r}}};no.ValidationError=K$.default;no.MissingRefError=Jm.default;Se.default=no;function Bm(t,e,r,n="error"){for(let o in t){let s=o;s in e&&this.logger[n](`${r}: option ${o}. ${t[s]}`)}}function Km(t){return t=(0,ro.normalizeId)(t),this.schemas[t]||this.refs[t]}function nk(){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 ok(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function sk(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 ik(){let t={...this.opts};for(let e of X$)delete t[e];return t}var ak={log(){},warn(){},error(){}};function ck(t){if(t===!1)return ak;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 uk=/^[a-z_$][a-z0-9_$:-]*$/i;function lk(t,e){let{RULES:r}=this;if((0,zu.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!uk.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Su(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,As.getJSONTypes)(e.type),schemaType:(0,As.getJSONTypes)(e.schemaType)}};e.before?dk.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function dk(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function pk(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Ym(e)),t.validateSchema=this.compile(e,!0))}var fk={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ym(t){return{anyOf:[t,fk]}}});var Qm=S(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});var mk={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Eu.default=mk});var nh=S(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.callRef=Rr.getValidate=void 0;var hk=Qn(),eh=Xe(),qe=U(),ln=At(),th=Rs(),Zs=Q(),gk={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=th.resolveRef.call(c,u,o,r);if(l===void 0)throw new hk.default(n.opts.uriResolver,o,r);if(l instanceof th.SchemaEnv)return h(l);return m(l);function d(){if(s===u)return Ms(t,i,s,s.$async);let p=e.scopeValue("root",{ref:u});return Ms(t,(0,qe._)`${p}.validate`,u,u.$async)}function h(p){let f=rh(t,p);Ms(t,f,p,p.$async)}function m(p){let f=e.scopeValue("schema",a.code.source===!0?{ref:p,code:(0,qe.stringify)(p)}:{ref:p}),g=e.name("valid"),v=t.subschema({schema:p,dataTypes:[],schemaPath:qe.nil,topSchemaRef:f,errSchemaPath:r},g);t.mergeEvaluated(v),t.ok(g)}}};function rh(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,qe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Rr.getValidate=rh;function Ms(t,e,r,n){let{gen:o,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?ln.default.this:qe.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let p=o.let("valid");o.try(()=>{o.code((0,qe._)`await ${(0,eh.callValidateCode)(t,e,u)}`),m(e),i||o.assign(p,!0)},f=>{o.if((0,qe._)`!(${f} instanceof ${s.ValidationError})`,()=>o.throw(f)),h(f),i||o.assign(p,!1)}),t.ok(p)}function d(){t.result((0,eh.callValidateCode)(t,e,u),()=>m(e),()=>h(e))}function h(p){let f=(0,qe._)`${p}.errors`;o.assign(ln.default.vErrors,(0,qe._)`${ln.default.vErrors} === null ? ${f} : ${ln.default.vErrors}.concat(${f})`),o.assign(ln.default.errors,(0,qe._)`${ln.default.vErrors}.length`)}function m(p){var f;if(!s.opts.unevaluated)return;let g=(f=r?.validate)===null||f===void 0?void 0:f.evaluated;if(s.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(s.props=Zs.mergeEvaluated.props(o,g.props,s.props));else{let v=o.var("props",(0,qe._)`${p}.evaluated.props`);s.props=Zs.mergeEvaluated.props(o,v,s.props,qe.Name)}if(s.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(s.items=Zs.mergeEvaluated.items(o,g.items,s.items));else{let v=o.var("items",(0,qe._)`${p}.evaluated.items`);s.items=Zs.mergeEvaluated.items(o,v,s.items,qe.Name)}}}Rr.callRef=Ms;Rr.default=gk});var oh=S(Pu=>{"use strict";Object.defineProperty(Pu,"__esModule",{value:!0});var yk=Qm(),_k=nh(),vk=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",yk.default,_k.default];Pu.default=vk});var sh=S(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});var js=U(),Qt=js.operators,Ds={maximum:{okStr:"<=",ok:Qt.LTE,fail:Qt.GT},minimum:{okStr:">=",ok:Qt.GTE,fail:Qt.LT},exclusiveMaximum:{okStr:"<",ok:Qt.LT,fail:Qt.GTE},exclusiveMinimum:{okStr:">",ok:Qt.GT,fail:Qt.LTE}},bk={message:({keyword:t,schemaCode:e})=>(0,js.str)`must be ${Ds[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,js._)`{comparison: ${Ds[t].okStr}, limit: ${e}}`},xk={keyword:Object.keys(Ds),type:"number",schemaType:"number",$data:!0,error:bk,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,js._)`${r} ${Ds[e].fail} ${n} || isNaN(${r})`)}};Tu.default=xk});var ih=S(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});var oo=U(),wk={message:({schemaCode:t})=>(0,oo.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,oo._)`{multipleOf: ${t}}`},$k={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:wk,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,oo._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,oo._)`${i} !== parseInt(${i})`;t.fail$data((0,oo._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Ru.default=$k});var ch=S(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});function ah(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}Iu.default=ah;ah.code='require("ajv/dist/runtime/ucs2length").default'});var uh=S(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});var Ir=U(),kk=Q(),Sk=ch(),zk={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Ir.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Ir._)`{limit: ${t}}`},Ek={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:zk,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,s=e==="maxLength"?Ir.operators.GT:Ir.operators.LT,i=o.opts.unicode===!1?(0,Ir._)`${r}.length`:(0,Ir._)`${(0,kk.useFunc)(t.gen,Sk.default)}(${r})`;t.fail$data((0,Ir._)`${i} ${s} ${n}`)}};Ou.default=Ek});var lh=S(Nu=>{"use strict";Object.defineProperty(Nu,"__esModule",{value:!0});var Pk=Xe(),Ls=U(),Tk={message:({schemaCode:t})=>(0,Ls.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Ls._)`{pattern: ${t}}`},Rk={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Tk,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:s}=t,i=s.opts.unicodeRegExp?"u":"",a=r?(0,Ls._)`(new RegExp(${o}, ${i}))`:(0,Pk.usePattern)(t,n);t.fail$data((0,Ls._)`!${a}.test(${e})`)}};Nu.default=Rk});var dh=S(Cu=>{"use strict";Object.defineProperty(Cu,"__esModule",{value:!0});var so=U(),Ik={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,so.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,so._)`{limit: ${t}}`},Ok={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Ik,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?so.operators.GT:so.operators.LT;t.fail$data((0,so._)`Object.keys(${r}).length ${o} ${n}`)}};Cu.default=Ok});var ph=S(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});var io=Xe(),ao=U(),Nk=Q(),Ck={message:({params:{missingProperty:t}})=>(0,ao.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,ao._)`{missingProperty: ${t}}`},Ak={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Ck,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let m=t.parentSchema.properties,{definedProperties:p}=t.it;for(let f of r)if(m?.[f]===void 0&&!p.has(f)){let g=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${f}" is not defined at "${g}" (strictRequired)`;(0,Nk.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(ao.nil,d);else for(let m of r)(0,io.checkReportMissingProp)(t,m)}function l(){let m=e.let("missing");if(c||s){let p=e.let("valid",!0);t.block$data(p,()=>h(m,p)),t.ok(p)}else e.if((0,io.checkMissingProp)(t,r,m)),(0,io.reportMissingProp)(t,m),e.else()}function d(){e.forOf("prop",n,m=>{t.setParams({missingProperty:m}),e.if((0,io.noPropertyInData)(e,o,m,a.ownProperties),()=>t.error())})}function h(m,p){t.setParams({missingProperty:m}),e.forOf(m,n,()=>{e.assign(p,(0,io.propertyInData)(e,o,m,a.ownProperties)),e.if((0,ao.not)(p),()=>{t.error(),e.break()})},ao.nil)}}};Au.default=Ak});var fh=S(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});var co=U(),Zk={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,co.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,co._)`{limit: ${t}}`},Mk={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Zk,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?co.operators.GT:co.operators.LT;t.fail$data((0,co._)`${r}.length ${o} ${n}`)}};Zu.default=Mk});var qs=S(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});var mh=au();mh.code='require("ajv/dist/runtime/equal").default';Mu.default=mh});var hh=S(Du=>{"use strict";Object.defineProperty(Du,"__esModule",{value:!0});var ju=Kn(),ze=U(),jk=Q(),Dk=qs(),Lk={message:({params:{i:t,j:e}})=>(0,ze.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ze._)`{i: ${t}, j: ${e}}`},qk={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Lk,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=s.items?(0,ju.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,ze._)`${i} === false`),t.ok(c);function l(){let p=e.let("i",(0,ze._)`${r}.length`),f=e.let("j");t.setParams({i:p,j:f}),e.assign(c,!0),e.if((0,ze._)`${p} > 1`,()=>(d()?h:m)(p,f))}function d(){return u.length>0&&!u.some(p=>p==="object"||p==="array")}function h(p,f){let g=e.name("item"),v=(0,ju.checkDataTypes)(u,g,a.opts.strictNumbers,ju.DataType.Wrong),w=e.const("indices",(0,ze._)`{}`);e.for((0,ze._)`;${p}--;`,()=>{e.let(g,(0,ze._)`${r}[${p}]`),e.if(v,(0,ze._)`continue`),u.length>1&&e.if((0,ze._)`typeof ${g} == "string"`,(0,ze._)`${g} += "_"`),e.if((0,ze._)`typeof ${w}[${g}] == "number"`,()=>{e.assign(f,(0,ze._)`${w}[${g}]`),t.error(),e.assign(c,!1).break()}).code((0,ze._)`${w}[${g}] = ${p}`)})}function m(p,f){let g=(0,jk.useFunc)(e,Dk.default),v=e.name("outer");e.label(v).for((0,ze._)`;${p}--;`,()=>e.for((0,ze._)`${f} = ${p}; ${f}--;`,()=>e.if((0,ze._)`${g}(${r}[${p}], ${r}[${f}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Du.default=qk});var gh=S(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});var Lu=U(),Uk=Q(),Vk=qs(),Fk={message:"must be equal to constant",params:({schemaCode:t})=>(0,Lu._)`{allowedValue: ${t}}`},Hk={keyword:"const",$data:!0,error:Fk,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,Lu._)`!${(0,Uk.useFunc)(e,Vk.default)}(${r}, ${o})`):t.fail((0,Lu._)`${s} !== ${r}`)}};qu.default=Hk});var yh=S(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});var uo=U(),Wk=Q(),Bk=qs(),Kk={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,uo._)`{allowedValues: ${t}}`},Jk={keyword:"enum",schemaType:"array",$data:!0,error:Kk,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,Wk.useFunc)(e,Bk.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let m=e.const("vSchema",s);l=(0,uo.or)(...o.map((p,f)=>h(m,f)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,m=>e.if((0,uo._)`${u()}(${r}, ${m})`,()=>e.assign(l,!0).break()))}function h(m,p){let f=o[p];return typeof f=="object"&&f!==null?(0,uo._)`${u()}(${r}, ${m}[${p}])`:(0,uo._)`${r} === ${f}`}}};Uu.default=Jk});var _h=S(Vu=>{"use strict";Object.defineProperty(Vu,"__esModule",{value:!0});var Gk=sh(),Yk=ih(),Xk=uh(),Qk=lh(),eS=dh(),tS=ph(),rS=fh(),nS=hh(),oS=gh(),sS=yh(),iS=[Gk.default,Yk.default,Xk.default,Qk.default,eS.default,tS.default,rS.default,nS.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},oS.default,sS.default];Vu.default=iS});var Hu=S(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.validateAdditionalItems=void 0;var Or=U(),Fu=Q(),aS={message:({params:{len:t}})=>(0,Or.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Or._)`{limit: ${t}}`},cS={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:aS,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Fu.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}vh(t,n)}};function vh(t,e){let{gen:r,schema:n,data:o,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Or._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Or._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Fu.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Or._)`${a} <= ${e.length}`);r.if((0,Or.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:Fu.Type.Num},u),i.allErrors||r.if((0,Or.not)(u),()=>r.break())})}}lo.validateAdditionalItems=vh;lo.default=cS});var Wu=S(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.validateTuple=void 0;var bh=U(),Us=Q(),uS=Xe(),lS={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return xh(t,"additionalItems",e);r.items=!0,!(0,Us.alwaysValidSchema)(r,e)&&t.ok((0,uS.validateArray)(t))}};function xh(t,e,r=t.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Us.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,bh._)`${s}.length`);r.forEach((d,h)=>{(0,Us.alwaysValidSchema)(a,d)||(n.if((0,bh._)`${u} > ${h}`,()=>t.subschema({keyword:i,schemaProp:h,dataProp:h},c)),t.ok(c))});function l(d){let{opts:h,errSchemaPath:m}=a,p=r.length,f=p===d.minItems&&(p===d.maxItems||d[e]===!1);if(h.strictTuples&&!f){let g=`"${i}" is ${p}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,Us.checkStrictMode)(a,g,h.strictTuples)}}}po.validateTuple=xh;po.default=lS});var wh=S(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});var dS=Wu(),pS={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,dS.validateTuple)(t,"items")};Bu.default=pS});var kh=S(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});var $h=U(),fS=Q(),mS=Xe(),hS=Hu(),gS={message:({params:{len:t}})=>(0,$h.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,$h._)`{limit: ${t}}`},yS={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:gS,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,fS.alwaysValidSchema)(n,e)&&(o?(0,hS.validateAdditionalItems)(t,o):t.ok((0,mS.validateArray)(t)))}};Ku.default=yS});var Sh=S(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});var et=U(),Vs=Q(),_S={message:({params:{min:t,max:e}})=>e===void 0?(0,et.str)`must contain at least ${t} valid item(s)`:(0,et.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,et._)`{minContains: ${t}}`:(0,et._)`{minContains: ${t}, maxContains: ${e}}`},vS={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:_S,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,et._)`${o}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,Vs.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Vs.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Vs.alwaysValidSchema)(s,r)){let f=(0,et._)`${l} >= ${i}`;a!==void 0&&(f=(0,et._)`${f} && ${l} <= ${a}`),t.pass(f);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?m(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,et._)`${o}.length > 0`,h)):(e.let(d,!1),h()),t.result(d,()=>t.reset());function h(){let f=e.name("_valid"),g=e.let("count",0);m(f,()=>e.if(f,()=>p(g)))}function m(f,g){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:Vs.Type.Num,compositeRule:!0},f),g()})}function p(f){e.code((0,et._)`${f}++`),a===void 0?e.if((0,et._)`${f} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,et._)`${f} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,et._)`${f} >= ${i}`,()=>e.assign(d,!0)))}}};Ju.default=vS});var Ph=S($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.validateSchemaDeps=$t.validatePropertyDeps=$t.error=void 0;var Gu=U(),bS=Q(),fo=Xe();$t.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Gu.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Gu._)`{property: ${t},
|
|
@@ -40,7 +40,7 @@ ${e}
|
|
|
40
40
|
|
|
41
41
|
`);let r=e.resource??e.command;if(r&&typeof r.content=="string")return r.content;let{_meta:n,...o}=e;return JSON.stringify(o)}function _n(t,e){let r=t??{};return r.error?.message||r.message||`error ${e}`}async function si(t,e){try{let r=await fetch(e,{headers:mt()}),n=await r.json().catch(()=>({}));if(!r.ok)return Z({tool:t,status:r.status}),{ok:!1,status:r.status,message:Ar(n)||`error ${r.status}`};let o=n._meta?.credits;return Z({tool:t,status:r.status,charged:o?.charged,balanceAfter:o?.balanceAfter}),{ok:!0,status:r.status,text:Ar(n),charged:o?.charged,balanceAfter:o?.balanceAfter??null}}catch(r){return Z({tool:t,error:String(r)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(r)}`}}}var Ue,gE,yE,_E,Cr,ii,vE,jg=_o(()=>{"use strict";ni();Ue=process.env.SUPERCLAWD_MCP_API_URL||"https://mcp-api.superclawd.com",gE=process.env.SUPERCLAWD_MCP_KEY||"",yE=process.env.SUPERCLAWD_MCP_SECRET||"",_E=process.env.SUPERCLAWD_MCP_WORKSPACE||"";Cr=process.env.SUPERCLAWD_SESSION_ID||null,ii=!1;vE={async getDirectives(t){let e=t.map(r=>r.skillId).join(",");try{let r=await Ag(),n=await fetch(`${Ue}/api/prompt/directives`,{method:"POST",headers:mt(r),body:JSON.stringify({assignments:t.map(i=>({action:i.action??"code",skill_id:i.skillId}))})}),o=await n.json().catch(()=>({}));if(!n.ok)return n.status===404&&(ii=!1),Z({tool:"get_directives",skillIds:e,status:n.status}),{ok:!1,status:n.status,message:Ar(o)||`error ${n.status}`};let s=o._meta?.credits;return Z({tool:"get_directives",skillIds:e,status:n.status,charged:s?.charged,balanceAfter:s?.balanceAfter}),{ok:!0,status:n.status,text:Ar(o),instructionCount:s?.instructionCount,charged:s?.charged,balanceAfter:s?.balanceAfter??null}}catch(r){return Z({tool:"get_directives",skillIds:e,error:String(r)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(r)}`}}},getCommand:t=>si("get_command",`${Ue}/api/prompt/commands/${encodeURIComponent(t)}`),getResource:t=>si("get_resource",`${Ue}/api/prompt/resources/${encodeURIComponent(t)}`),async getWorkflow(t){try{let e=await Ag(),r=await fetch(`${Ue}/api/prompt/workflow`,{method:"POST",headers:mt(e),body:JSON.stringify({workflow_id:t})}),n=await r.json().catch(()=>({}));if(!r.ok)return r.status===404&&(ii=!1),Z({tool:"get_workflow",workflowId:t,status:r.status}),{ok:!1,status:r.status,message:Ar(n)||`error ${r.status}`};let o=n._meta?.credits;return Z({tool:"get_workflow",workflowId:t,status:r.status,charged:o?.charged,balanceAfter:o?.balanceAfter}),{ok:!0,status:r.status,text:Ar(n),charged:o?.charged,balanceAfter:o?.balanceAfter??null}}catch(e){return Z({tool:"get_workflow",workflowId:t,error:String(e)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(e)}`}}},workspaceInfo:()=>si("workspace_info",`${Ue}/api/prompt/workspace-info`),serviceStatus:()=>si("service_status",`${Ue}/api/prompt/status`),async checkBalance(){let t=await fetch(`${Ue}/api/prompt/balance`,{headers:mt()}),e=await t.json().catch(()=>({})),r=Ar(e),n=r.match(/<current_balance>([\d.]+)<\/current_balance>/),o=n?Number(n[1]):0,s=r.match(/<tier>(free|paid)<\/tier>/),i=s?s[1]:"free";return Z({tool:"check_balance",status:t.status,balance:o,tier:i}),{tier:i,balance:o}},async recordMemory(t){try{let e=await fetch(`${Ue}/api/prompt/memories`,{method:"POST",headers:mt(),body:JSON.stringify({scope:t.scope,...t.scopeKey!==void 0?{scopeKey:t.scopeKey}:{},content:t.content,...t.title&&t.title.trim()?{title:t.title.trim()}:{},learnedAgainst:t.learnedAgainst??[]})}),r=await e.json().catch(()=>({}));return e.ok?(Z({tool:"record_memory",status:e.status,id:r.id}),{ok:!0,status:e.status,id:r.id}):(Z({tool:"record_memory",status:e.status}),{ok:!1,status:e.status,message:_n(r,e.status)})}catch(e){return Z({tool:"record_memory",error:String(e)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(e)}`}}},async updateMemory(t){try{let e=await fetch(`${Ue}/api/prompt/memories/${encodeURIComponent(t.id)}`,{method:"PUT",headers:mt(),body:JSON.stringify({content:t.content,learnedAgainst:t.learnedAgainst})}),r=await e.json().catch(()=>({}));return e.ok?(Z({tool:"update_memory",status:e.status,id:t.id}),{ok:!0,status:e.status,id:r.id??t.id}):(Z({tool:"update_memory",status:e.status}),{ok:!1,status:e.status,message:_n(r,e.status)})}catch(e){return Z({tool:"update_memory",error:String(e)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(e)}`}}},async removeMemory(t){try{let e=await fetch(`${Ue}/api/prompt/memories/${encodeURIComponent(t)}`,{method:"DELETE",headers:mt()});if(!e.ok){let r=await e.json().catch(()=>({}));return Z({tool:"remove_memory",status:e.status}),{ok:!1,status:e.status,message:_n(r,e.status)}}return Z({tool:"remove_memory",status:e.status,id:t}),{ok:!0,status:e.status,id:t}}catch(e){return Z({tool:"remove_memory",error:String(e)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(e)}`}}},async listMemories(t,e){try{let r=`${Ue}/api/prompt/memories?scope=${encodeURIComponent(t)}&scopeKey=${encodeURIComponent(e)}`,n=await fetch(r,{headers:mt()}),o=await n.json().catch(()=>({}));return n.ok?(Z({tool:"list_memories",status:n.status,count:o.memories?.length??0}),{ok:!0,status:n.status,memories:o.memories??[]}):(Z({tool:"list_memories",status:n.status}),{ok:!1,status:n.status,message:_n(o,n.status)})}catch(r){return Z({tool:"list_memories",error:String(r)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(r)}`}}},async searchMemories(t,e){try{let r=new URLSearchParams({query:t});e&&r.set("scope",e);let n=process.env.SUPERCLAWD_REPO_FINGERPRINT;n&&r.set("repoFingerprint",n);let o=await fetch(`${Ue}/api/prompt/memories/search?${r.toString()}`,{headers:mt()}),s=await o.json().catch(()=>({}));return o.ok?(Z({tool:"search_memories",status:o.status,count:s.memories?.length??0}),{ok:!0,status:o.status,memories:s.memories??[]}):(Z({tool:"search_memories",status:o.status}),{ok:!1,status:o.status,message:_n(s,o.status)})}catch(r){return Z({tool:"search_memories",error:String(r)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(r)}`}}},async getMemories(t){try{let e=await fetch(`${Ue}/api/prompt/memories/get`,{method:"POST",headers:mt(),body:JSON.stringify({ids:t})}),r=await e.json().catch(()=>({}));return e.ok?(Z({tool:"get_memories",status:e.status,count:r.memories?.length??0}),{ok:!0,status:e.status,memories:r.memories??[]}):(Z({tool:"get_memories",status:e.status}),{ok:!1,status:e.status,message:_n(r,e.status)})}catch(e){return Z({tool:"get_memories",error:String(e)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(e)}`}}}}});var O={};vo(O,{BRAND:()=>Iy,DIRTY:()=>rr,EMPTY_PATH:()=>uy,INVALID:()=>C,NEVER:()=>m_,OK:()=>Ee,ParseStatus:()=>we,Schema:()=>q,ZodAny:()=>Vt,ZodArray:()=>Rt,ZodBigInt:()=>or,ZodBoolean:()=>sr,ZodBranded:()=>xn,ZodCatch:()=>gr,ZodDate:()=>ir,ZodDefault:()=>hr,ZodDiscriminatedUnion:()=>wo,ZodEffects:()=>Ke,ZodEnum:()=>fr,ZodError:()=>Ae,ZodFirstPartyTypeKind:()=>x,ZodFunction:()=>ko,ZodIntersection:()=>lr,ZodIssueCode:()=>b,ZodLazy:()=>dr,ZodLiteral:()=>pr,ZodMap:()=>Ur,ZodNaN:()=>Fr,ZodNativeEnum:()=>mr,ZodNever:()=>tt,ZodNull:()=>cr,ZodNullable:()=>yt,ZodNumber:()=>nr,ZodObject:()=>Ze,ZodOptional:()=>We,ZodParsedType:()=>z,ZodPipeline:()=>wn,ZodPromise:()=>Ft,ZodReadonly:()=>yr,ZodRecord:()=>$o,ZodSchema:()=>q,ZodSet:()=>Vr,ZodString:()=>Ut,ZodSymbol:()=>Lr,ZodTransformer:()=>Ke,ZodTuple:()=>gt,ZodType:()=>q,ZodUndefined:()=>ar,ZodUnion:()=>ur,ZodUnknown:()=>Tt,ZodVoid:()=>qr,addIssueToContext:()=>k,any:()=>Ly,array:()=>Fy,bigint:()=>Ay,boolean:()=>Ul,coerce:()=>f_,custom:()=>Dl,date:()=>Zy,datetimeRegex:()=>Ml,defaultErrorMap:()=>Et,discriminatedUnion:()=>By,effect:()=>s_,enum:()=>r_,function:()=>Qy,getErrorMap:()=>Mr,getParsedType:()=>ht,instanceof:()=>Ny,intersection:()=>Ky,isAborted:()=>bo,isAsync:()=>jr,isDirty:()=>xo,isValid:()=>qt,late:()=>Oy,lazy:()=>e_,literal:()=>t_,makeIssue:()=>bn,map:()=>Yy,nan:()=>Cy,nativeEnum:()=>n_,never:()=>Uy,null:()=>Dy,nullable:()=>a_,number:()=>ql,object:()=>hi,objectUtil:()=>pi,oboolean:()=>p_,onumber:()=>d_,optional:()=>i_,ostring:()=>l_,pipeline:()=>u_,preprocess:()=>c_,promise:()=>o_,quotelessJson:()=>iy,record:()=>Gy,set:()=>Xy,setErrorMap:()=>cy,strictObject:()=>Hy,string:()=>Ll,symbol:()=>My,transformer:()=>s_,tuple:()=>Jy,undefined:()=>jy,union:()=>Wy,unknown:()=>qy,util:()=>W,void:()=>Vy});var W;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(W||(W={}));var pi;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(pi||(pi={}));var z=W.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ht=t=>{switch(typeof t){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(t)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(t)?z.array:t===null?z.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?z.promise:typeof Map<"u"&&t instanceof Map?z.map:typeof Set<"u"&&t instanceof Set?z.set:typeof Date<"u"&&t instanceof Date?z.date:z.object;default:return z.unknown}};var b=W.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"]),iy=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Ae=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(this),n}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,W.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ae.create=t=>new Ae(t);var ay=(t,e)=>{let r;switch(t.code){case b.invalid_type:t.received===z.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case b.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,W.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:r=`Unrecognized key(s) in object: ${W.joinValues(t.keys,", ")}`;break;case b.invalid_union:r="Invalid input";break;case b.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${W.joinValues(t.options)}`;break;case b.invalid_enum_value:r=`Invalid enum value. Expected ${W.joinValues(t.options)}, received '${t.received}'`;break;case b.invalid_arguments:r="Invalid function arguments";break;case b.invalid_return_type:r="Invalid function return type";break;case b.invalid_date:r="Invalid date";break;case b.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}"`:W.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case b.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 b.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 b.custom:r="Invalid input";break;case b.invalid_intersection_types:r="Intersection results could not be merged";break;case b.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case b.not_finite:r="Number must be finite";break;default:r=e.defaultError,W.assertNever(t)}return{message:r}},Et=ay;var Ol=Et;function cy(t){Ol=t}function Mr(){return Ol}var bn=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},uy=[];function k(t,e){let r=Mr(),n=bn({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Et?void 0:Et].filter(o=>!!o)});t.common.issues.push(n)}var we=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 n=[];for(let o of r){if(o.status==="aborted")return C;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,i=await o.value;n.push({key:s,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return C;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}},C=Object.freeze({status:"aborted"}),rr=t=>({status:"dirty",value:t}),Ee=t=>({status:"valid",value:t}),bo=t=>t.status==="aborted",xo=t=>t.status==="dirty",qt=t=>t.status==="valid",jr=t=>typeof Promise<"u"&&t instanceof Promise;var T;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(T||(T={}));var Be=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}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}},Nl=(t,e)=>{if(qt(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 Ae(t.common.issues);return this._error=r,this._error}}};function D(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var q=class{get description(){return this._def.description}_getType(e){return ht(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new we,ctx:{common:e.parent.common,data:e.data,parsedType:ht(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(jr(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 n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ht(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Nl(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ht(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return qt(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>qt(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ht(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(jr(o)?o:Promise.resolve(o));return Nl(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:b.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Ke({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 We.create(this,this._def)}nullable(){return yt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rt.create(this)}promise(){return Ft.create(this,this._def)}or(e){return ur.create([this,e],this._def)}and(e){return lr.create(this,e,this._def)}transform(e){return new Ke({...D(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new hr({...D(this._def),innerType:this,defaultValue:r,typeName:x.ZodDefault})}brand(){return new xn({typeName:x.ZodBranded,type:this,...D(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new gr({...D(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 wn.create(this,e)}readonly(){return yr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},ly=/^c[^\s-]{8,}$/i,dy=/^[0-9a-z]+$/,py=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fy=/^[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,my=/^[a-z0-9_-]{21}$/i,hy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gy=/^[-+]?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)?)??$/,yy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_y="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",fi,vy=/^(?:(?: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])$/,by=/^(?:(?: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])$/,xy=/^(([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]))$/,wy=/^(([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])$/,$y=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ky=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Al="((\\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])))",Sy=new RegExp(`^${Al}$`);function Zl(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 zy(t){return new RegExp(`^${Zl(t)}$`)}function Ml(t){let e=`${Al}T${Zl(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 Ey(t,e){return!!((e==="v4"||!e)&&vy.test(t)||(e==="v6"||!e)&&xy.test(t))}function Py(t,e){if(!hy.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Ty(t,e){return!!((e==="v4"||!e)&&by.test(t)||(e==="v6"||!e)&&wy.test(t))}var Ut=class t extends q{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:z.string,received:s.parsedType}),C}let n=new we,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),k(o,{code:b.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),k(o,{code:b.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?k(o,{code:b.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&k(o,{code:b.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")yy.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"email",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")fi||(fi=new RegExp(_y,"u")),fi.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"emoji",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")fy.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"uuid",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")my.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"nanoid",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")ly.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"cuid",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")dy.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"cuid2",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")py.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"ulid",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),k(o,{validation:"url",code:b.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"regex",code:b.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Ml(s).test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Sy.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?zy(s).test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?gy.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"duration",code:b.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Ey(e.data,s.version)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"ip",code:b.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Py(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"jwt",code:b.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Ty(e.data,s.version)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"cidr",code:b.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?$y.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"base64",code:b.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?ky.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"base64url",code:b.invalid_string,message:s.message}),n.dirty()):W.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:b.invalid_string,...T.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...T.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...T.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...T.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,...T.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,...T.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...T.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...T.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...T.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...T.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...T.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...T.errToObj(r)})}nonempty(e){return this.min(1,T.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}};Ut.create=t=>new Ut({checks:[],typeName:x.ZodString,coerce:t?.coerce??!1,...D(t)});function Ry(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var nr=class t extends q{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)!==z.number){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:z.number,received:s.parsedType}),C}let n,o=new we;for(let s of this._def.checks)s.kind==="int"?W.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?Ry(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:b.not_finite,message:s.message}),o.dirty()):W.assertNever(s);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,T.toString(r))}gt(e,r){return this.setLimit("min",e,!1,T.toString(r))}lte(e,r){return this.setLimit("max",e,!0,T.toString(r))}lt(e,r){return this.setLimit("max",e,!1,T.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.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"&&W.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};nr.create=t=>new nr({checks:[],typeName:x.ZodNumber,coerce:t?.coerce||!1,...D(t)});var or=class t extends q{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)!==z.bigint)return this._getInvalidInput(e);let n,o=new we;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):W.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:z.bigint,received:r.parsedType}),C}gte(e,r){return this.setLimit("min",e,!0,T.toString(r))}gt(e,r){return this.setLimit("min",e,!1,T.toString(r))}lte(e,r){return this.setLimit("max",e,!0,T.toString(r))}lt(e,r){return this.setLimit("max",e,!1,T.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:T.toString(o)}]})}_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:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:T.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}};or.create=t=>new or({checks:[],typeName:x.ZodBigInt,coerce:t?.coerce??!1,...D(t)});var sr=class extends q{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.boolean,received:n.parsedType}),C}return Ee(e.data)}};sr.create=t=>new sr({typeName:x.ZodBoolean,coerce:t?.coerce||!1,...D(t)});var ir=class t extends q{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:z.date,received:s.parsedType}),C}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_date}),C}let n=new we,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),k(o,{code:b.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),k(o,{code:b.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):W.assertNever(s);return{status:n.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:T.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:T.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}};ir.create=t=>new ir({checks:[],coerce:t?.coerce||!1,typeName:x.ZodDate,...D(t)});var Lr=class extends q{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.symbol,received:n.parsedType}),C}return Ee(e.data)}};Lr.create=t=>new Lr({typeName:x.ZodSymbol,...D(t)});var ar=class extends q{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.undefined,received:n.parsedType}),C}return Ee(e.data)}};ar.create=t=>new ar({typeName:x.ZodUndefined,...D(t)});var cr=class extends q{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.null,received:n.parsedType}),C}return Ee(e.data)}};cr.create=t=>new cr({typeName:x.ZodNull,...D(t)});var Vt=class extends q{constructor(){super(...arguments),this._any=!0}_parse(e){return Ee(e.data)}};Vt.create=t=>new Vt({typeName:x.ZodAny,...D(t)});var Tt=class extends q{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ee(e.data)}};Tt.create=t=>new Tt({typeName:x.ZodUnknown,...D(t)});var tt=class extends q{_parse(e){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:z.never,received:r.parsedType}),C}};tt.create=t=>new tt({typeName:x.ZodNever,...D(t)});var qr=class extends q{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.void,received:n.parsedType}),C}return Ee(e.data)}};qr.create=t=>new qr({typeName:x.ZodVoid,...D(t)});var Rt=class t extends q{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==z.array)return k(r,{code:b.invalid_type,expected:z.array,received:r.parsedType}),C;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(i||a)&&(k(r,{code:i?b.too_big:b.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(k(r,{code:b.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(k(r,{code:b.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>o.type._parseAsync(new Be(r,i,r.path,a)))).then(i=>we.mergeArray(n,i));let s=[...r.data].map((i,a)=>o.type._parseSync(new Be(r,i,r.path,a)));return we.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:T.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:T.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:T.toString(r)}})}nonempty(e){return this.min(1,e)}};Rt.create=(t,e)=>new Rt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...D(e)});function Dr(t){if(t instanceof Ze){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=We.create(Dr(n))}return new Ze({...t._def,shape:()=>e})}else return t instanceof Rt?new Rt({...t._def,type:Dr(t.element)}):t instanceof We?We.create(Dr(t.unwrap())):t instanceof yt?yt.create(Dr(t.unwrap())):t instanceof gt?gt.create(t.items.map(e=>Dr(e))):t}var Ze=class t extends q{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=W.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==z.object){let u=this._getOrReturnCtx(e);return k(u,{code:b.invalid_type,expected:z.object,received:u.parsedType}),C}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof tt&&this._def.unknownKeys==="strip"))for(let u in o.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=s[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Be(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof tt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(k(o,{code:b.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Be(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,h=await l.value;u.push({key:d,value:h,alwaysSet:l.alwaysSet})}return u}).then(u=>we.mergeObjectSync(n,u)):we.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:T.errToObj(e).message??o}:{message:o}}}:{}})}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 n of W.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of W.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Dr(this)}partial(e){let r={};for(let n of W.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of W.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof We;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return jl(W.objectKeys(this.shape))}};Ze.create=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strip",catchall:tt.create(),typeName:x.ZodObject,...D(e)});Ze.strictCreate=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strict",catchall:tt.create(),typeName:x.ZodObject,...D(e)});Ze.lazycreate=(t,e)=>new Ze({shape:t,unknownKeys:"strip",catchall:tt.create(),typeName:x.ZodObject,...D(e)});var ur=class extends q{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Ae(a.ctx.common.issues));return k(r,{code:b.invalid_union,unionErrors:i}),C}if(r.common.async)return Promise.all(n.map(async s=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new Ae(c));return k(r,{code:b.invalid_union,unionErrors:a}),C}}get options(){return this._def.options}};ur.create=(t,e)=>new ur({options:t,typeName:x.ZodUnion,...D(e)});var Pt=t=>t instanceof dr?Pt(t.schema):t instanceof Ke?Pt(t.innerType()):t instanceof pr?[t.value]:t instanceof fr?t.options:t instanceof mr?W.objectValues(t.enum):t instanceof hr?Pt(t._def.innerType):t instanceof ar?[void 0]:t instanceof cr?[null]:t instanceof We?[void 0,...Pt(t.unwrap())]:t instanceof yt?[null,...Pt(t.unwrap())]:t instanceof xn||t instanceof yr?Pt(t.unwrap()):t instanceof gr?Pt(t._def.innerType):[],wo=class t extends q{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.object)return k(r,{code:b.invalid_type,expected:z.object,received:r.parsedType}),C;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(k(r,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),C)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let i=Pt(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...D(n)})}};function mi(t,e){let r=ht(t),n=ht(e);if(t===e)return{valid:!0,data:t};if(r===z.object&&n===z.object){let o=W.objectKeys(e),s=W.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=mi(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===z.array&&n===z.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=mi(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===z.date&&n===z.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var lr=class extends q{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,i)=>{if(bo(s)||bo(i))return C;let a=mi(s.value,i.value);return a.valid?((xo(s)||xo(i))&&r.dirty(),{status:r.value,value:a.data}):(k(n,{code:b.invalid_intersection_types}),C)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};lr.create=(t,e,r)=>new lr({left:t,right:e,typeName:x.ZodIntersection,...D(r)});var gt=class t extends q{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return k(n,{code:b.invalid_type,expected:z.array,received:n.parsedType}),C;if(n.data.length<this._def.items.length)return k(n,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),C;!this._def.rest&&n.data.length>this._def.items.length&&(k(n,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Be(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>we.mergeArray(r,i)):we.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};gt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new gt({items:t,typeName:x.ZodTuple,rest:null,...D(e)})};var $o=class t extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.object)return k(n,{code:b.invalid_type,expected:z.object,received:n.parsedType}),C;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in n.data)o.push({key:s._parse(new Be(n,a,n.path,a)),value:i._parse(new Be(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?we.mergeObjectAsync(r,o):we.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof q?new t({keyType:e,valueType:r,typeName:x.ZodRecord,...D(n)}):new t({keyType:Ut.create(),valueType:e,typeName:x.ZodRecord,...D(r)})}},Ur=class extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.map)return k(n,{code:b.invalid_type,expected:z.map,received:n.parsedType}),C;let o=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new Be(n,a,n.path,[u,"key"])),value:s._parse(new Be(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return C;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return C;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};Ur.create=(t,e,r)=>new Ur({valueType:e,keyType:t,typeName:x.ZodMap,...D(r)});var Vr=class t extends q{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return k(n,{code:b.invalid_type,expected:z.set,received:n.parsedType}),C;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(k(n,{code:b.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(k(n,{code:b.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return C;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>s._parse(new Be(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:T.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:T.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Vr.create=(t,e)=>new Vr({valueType:t,minSize:null,maxSize:null,typeName:x.ZodSet,...D(e)});var ko=class t extends q{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.function)return k(r,{code:b.invalid_type,expected:z.function,received:r.parsedType}),C;function n(a,c){return bn({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Mr(),Et].filter(u=>!!u),issueData:{code:b.invalid_arguments,argumentsError:c}})}function o(a,c){return bn({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Mr(),Et].filter(u=>!!u),issueData:{code:b.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof Ft){let a=this;return Ee(async function(...c){let u=new Ae([]),l=await a._def.args.parseAsync(c,s).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,s).catch(m=>{throw u.addIssue(o(d,m)),u})})}else{let a=this;return Ee(function(...c){let u=a._def.args.safeParse(c,s);if(!u.success)throw new Ae([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,s);if(!d.success)throw new Ae([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:gt.create(e).rest(Tt.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,n){return new t({args:e||gt.create([]).rest(Tt.create()),returns:r||Tt.create(),typeName:x.ZodFunction,...D(n)})}},dr=class extends q{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})}};dr.create=(t,e)=>new dr({getter:t,typeName:x.ZodLazy,...D(e)});var pr=class extends q{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return k(r,{received:r.data,code:b.invalid_literal,expected:this._def.value}),C}return{status:"valid",value:e.data}}get value(){return this._def.value}};pr.create=(t,e)=>new pr({value:t,typeName:x.ZodLiteral,...D(e)});function jl(t,e){return new fr({values:t,typeName:x.ZodEnum,...D(e)})}var fr=class t extends q{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return k(r,{expected:W.joinValues(n),received:r.parsedType,code:b.invalid_type}),C}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return k(r,{received:r.data,code:b.invalid_enum_value,options:n}),C}return Ee(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(n=>!e.includes(n)),{...this._def,...r})}};fr.create=jl;var mr=class extends q{_parse(e){let r=W.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==z.string&&n.parsedType!==z.number){let o=W.objectValues(r);return k(n,{expected:W.joinValues(o),received:n.parsedType,code:b.invalid_type}),C}if(this._cache||(this._cache=new Set(W.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=W.objectValues(r);return k(n,{received:n.data,code:b.invalid_enum_value,options:o}),C}return Ee(e.data)}get enum(){return this._def.values}};mr.create=(t,e)=>new mr({values:t,typeName:x.ZodNativeEnum,...D(e)});var Ft=class extends q{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.promise&&r.common.async===!1)return k(r,{code:b.invalid_type,expected:z.promise,received:r.parsedType}),C;let n=r.parsedType===z.promise?r.data:Promise.resolve(r.data);return Ee(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ft.create=(t,e)=>new Ft({type:t,typeName:x.ZodPromise,...D(e)});var Ke=class extends q{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:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{k(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return C;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?C:c.status==="dirty"?rr(c.value):r.value==="dirty"?rr(c.value):c});{if(r.value==="aborted")return C;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?C:a.status==="dirty"?rr(a.value):r.value==="dirty"?rr(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?C:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?C:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!qt(i))return C;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>qt(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:r.value,value:a})):C);W.assertNever(o)}};Ke.create=(t,e,r)=>new Ke({schema:t,typeName:x.ZodEffects,effect:e,...D(r)});Ke.createWithPreprocess=(t,e,r)=>new Ke({schema:e,effect:{type:"preprocess",transform:t},typeName:x.ZodEffects,...D(r)});var We=class extends q{_parse(e){return this._getType(e)===z.undefined?Ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};We.create=(t,e)=>new We({innerType:t,typeName:x.ZodOptional,...D(e)});var yt=class extends q{_parse(e){return this._getType(e)===z.null?Ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yt.create=(t,e)=>new yt({innerType:t,typeName:x.ZodNullable,...D(e)});var hr=class extends q{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};hr.create=(t,e)=>new hr({innerType:t,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...D(e)});var gr=class extends q{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return jr(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ae(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ae(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};gr.create=(t,e)=>new gr({innerType:t,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...D(e)});var Fr=class extends q{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.nan,received:n.parsedType}),C}return{status:"valid",value:e.data}}};Fr.create=t=>new Fr({typeName:x.ZodNaN,...D(t)});var Iy=Symbol("zod_brand"),xn=class extends q{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},wn=class t extends q{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?C:s.status==="dirty"?(r.dirty(),rr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?C:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:x.ZodPipeline})}},yr=class extends q{_parse(e){let r=this._def.innerType._parse(e),n=o=>(qt(o)&&(o.value=Object.freeze(o.value)),o);return jr(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};yr.create=(t,e)=>new yr({innerType:t,typeName:x.ZodReadonly,...D(e)});function Cl(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Dl(t,e={},r){return t?Vt.create().superRefine((n,o)=>{let s=t(n);if(s instanceof Promise)return s.then(i=>{if(!i){let a=Cl(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=Cl(e,n),a=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:a})}}):Vt.create()}var Oy={object:Ze.lazycreate},x;(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={}));var Ny=(t,e={message:`Input not instance of ${t.name}`})=>Dl(r=>r instanceof t,e),Ll=Ut.create,ql=nr.create,Cy=Fr.create,Ay=or.create,Ul=sr.create,Zy=ir.create,My=Lr.create,jy=ar.create,Dy=cr.create,Ly=Vt.create,qy=Tt.create,Uy=tt.create,Vy=qr.create,Fy=Rt.create,hi=Ze.create,Hy=Ze.strictCreate,Wy=ur.create,By=wo.create,Ky=lr.create,Jy=gt.create,Gy=$o.create,Yy=Ur.create,Xy=Vr.create,Qy=ko.create,e_=dr.create,t_=pr.create,r_=fr.create,n_=mr.create,o_=Ft.create,s_=Ke.create,i_=We.create,a_=yt.create,c_=Ke.createWithPreprocess,u_=wn.create,l_=()=>Ll().optional(),d_=()=>ql().optional(),p_=()=>Ul().optional(),f_={string:t=>Ut.create({...t,coerce:!0}),number:t=>nr.create({...t,coerce:!0}),boolean:t=>sr.create({...t,coerce:!0}),bigint:t=>or.create({...t,coerce:!0}),date:t=>ir.create({...t,coerce:!0})};var m_=C;var h_=Object.freeze({status:"aborted"});function y(t,e,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(t),e(a,c);for(let l in i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var g_=Symbol("zod_brand"),It=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},So={};function rt(t){return t&&Object.assign(So,t),So}var B={};vo(B,{BIGINT_FORMAT_RANGES:()=>Hl,Class:()=>yi,NUMBER_FORMAT_RANGES:()=>ki,aborted:()=>vr,allowsEval:()=>xi,assert:()=>x_,assertEqual:()=>y_,assertIs:()=>v_,assertNever:()=>b_,assertNotEqual:()=>__,assignProp:()=>bi,cached:()=>Sn,captureStackTrace:()=>zo,cleanEnum:()=>A_,cleanRegex:()=>En,clone:()=>Fe,createTransparentProxy:()=>P_,defineLazy:()=>ie,esc:()=>_r,escapeRegex:()=>Ht,extend:()=>I_,finalizeIssue:()=>nt,floatSafeRemainder:()=>vi,getElementAtPath:()=>$_,getEnumValues:()=>kn,getLengthableOrigin:()=>Pn,getParsedType:()=>E_,getSizableOrigin:()=>Wl,isObject:()=>Hr,isPlainObject:()=>Wr,issue:()=>Si,joinValues:()=>w_,jsonStringifyReplacer:()=>_i,merge:()=>O_,normalizeParams:()=>A,nullish:()=>zn,numKeys:()=>z_,omit:()=>R_,optionalKeys:()=>$i,partial:()=>N_,pick:()=>T_,prefixIssues:()=>_t,primitiveTypes:()=>Vl,promiseAllObject:()=>k_,propertyKeyTypes:()=>wi,randomString:()=>S_,required:()=>C_,stringifyPrimitive:()=>Fl,unwrapMessage:()=>$n});function y_(t){return t}function __(t){return t}function v_(t){}function b_(t){throw new Error}function x_(t){}function kn(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function w_(t,e="|"){return t.map(r=>Fl(r)).join(e)}function _i(t,e){return typeof e=="bigint"?e.toString():e}function Sn(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function zn(t){return t==null}function En(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function vi(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}function ie(t,e,r){Object.defineProperty(t,e,{get(){{let o=r();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function bi(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function $_(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function k_(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function S_(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function _r(t){return JSON.stringify(t)}var zo=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function Hr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var xi=Sn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Wr(t){if(Hr(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(Hr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function z_(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var E_=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}`)}},wi=new Set(["string","number","symbol"]),Vl=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ht(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Fe(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function A(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 P_(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function Fl(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function $i(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var ki={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]},Hl={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function T_(t,e){let r={},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(r[o]=n.shape[o])}return Fe(t,{...t._zod.def,shape:r,checks:[]})}function R_(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete r[o]}return Fe(t,{...t._zod.def,shape:r,checks:[]})}function I_(t,e){if(!Wr(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return bi(this,"shape",n),n},checks:[]};return Fe(t,r)}function O_(t,e){return Fe(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return bi(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function N_(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)o[s]=t?new t({type:"optional",innerType:n[s]}):n[s];return Fe(e,{...e._zod.def,shape:o,checks:[]})}function C_(t,e,r){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 Fe(e,{...e._zod.def,shape:o,checks:[]})}function vr(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function _t(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function $n(t){return typeof t=="string"?t:t?.message}function nt(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=$n(t.inst?._zod.def?.error?.(t))??$n(e?.error?.(t))??$n(r.customError?.(t))??$n(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function Wl(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Pn(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Si(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function A_(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var yi=class{constructor(...e){}};var Bl=(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,_i,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Eo=y("$ZodError",Bl),Tn=y("$ZodError",Bl,{Parent:Error});function zi(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function Ei(t,e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(t),n}var Pi=t=>(e,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new It;if(i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>nt(c,s,rt())));throw zo(a,o?.callee),a}return i.value},Ti=Pi(Tn),Ri=t=>async(e,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>nt(c,s,rt())));throw zo(a,o?.callee),a}return i.value},Ii=Ri(Tn),Oi=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new It;return s.issues.length?{success:!1,error:new(t??Eo)(s.issues.map(i=>nt(i,o,rt())))}:{success:!0,data:s.value}},br=Oi(Tn),Ni=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>nt(i,o,rt())))}:{success:!0,data:s.value}},xr=Ni(Tn);var Kl=/^[cC][^\s-]{8,}$/,Jl=/^[0-9a-z]+$/,Gl=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Yl=/^[0-9a-vA-V]{20}$/,Xl=/^[A-Za-z0-9]{27}$/,Ql=/^[a-zA-Z0-9_-]{21}$/,ed=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var td=/^([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})$/,Ci=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)$/;var rd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var M_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function nd(){return new RegExp(M_,"u")}var od=/^(?:(?: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])$/,sd=/^(([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})$/,id=/^((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])$/,ad=/^(([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])$/,cd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ai=/^[A-Za-z0-9_-]*$/,ud=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var ld=/^\+(?:[0-9]){6,14}[0-9]$/,dd="(?:(?:\\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])))",pd=new RegExp(`^${dd}$`);function fd(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 md(t){return new RegExp(`^${fd(t)}$`)}function hd(t){let e=fd({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${dd}T(?:${n})$`)}var gd=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var yd=/^\d+$/,_d=/^-?\d+(?:\.\d+)?/i,vd=/true|false/i;var bd=/^[^A-Z]*$/,xd=/^[^a-z]*$/;var $e=y("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),wd={number:"number",bigint:"bigint",object:"date"},Zi=y("$ZodCheckLessThan",(t,e)=>{$e.init(t,e);let r=wd[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Mi=y("$ZodCheckGreaterThan",(t,e)=>{$e.init(t,e);let r=wd[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),$d=y("$ZodCheckMultipleOf",(t,e)=>{$e.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.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):vi(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})}}),kd=y("$ZodCheckNumberFormat",(t,e)=>{$e.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,s]=ki[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=o,a.maximum=s,r&&(a.pattern=yd)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:t})}});var Sd=y("$ZodCheckMaxLength",(t,e)=>{var r;$e.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!zn(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let i=Pn(o);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),zd=y("$ZodCheckMinLength",(t,e)=>{var r;$e.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!zn(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let i=Pn(o);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Ed=y("$ZodCheckLengthEquals",(t,e)=>{var r;$e.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!zn(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,s=o.length;if(s===e.length)return;let i=Pn(o),a=s>e.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Rn=y("$ZodCheckStringFormat",(t,e)=>{var r,n;$e.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Pd=y("$ZodCheckRegex",(t,e)=>{Rn.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})}}),Td=y("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=bd),Rn.init(t,e)}),Rd=y("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=xd),Rn.init(t,e)}),Id=y("$ZodCheckIncludes",(t,e)=>{$e.init(t,e);let r=Ht(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),Od=y("$ZodCheckStartsWith",(t,e)=>{$e.init(t,e);let r=new RegExp(`^${Ht(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Nd=y("$ZodCheckEndsWith",(t,e)=>{$e.init(t,e);let r=new RegExp(`.*${Ht(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var Cd=y("$ZodCheckOverwrite",(t,e)=>{$e.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var To=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 n=e.split(`
|
|
42
42
|
`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,o.join(`
|
|
43
|
-
`))}};var Zd={major:4,minor:0,patch:0};var
|
|
43
|
+
`))}};var Zd={major:4,minor:0,patch:0};var oe=y("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Zd;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let s of o._zod.onattach)s(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(s,i,a)=>{let c=vr(s),u;for(let l of i){if(l._zod.def.when){if(!l._zod.def.when(s))continue}else if(c)continue;let d=s.issues.length,h=l._zod.check(s);if(h instanceof Promise&&a?.async===!1)throw new It;if(u||h instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await h,s.issues.length!==d&&(c||(c=vr(s,d)))});else{if(s.issues.length===d)continue;c||(c=vr(s,d))}}return u?u.then(()=>s):s};t._zod.run=(s,i)=>{let a=t._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new It;return a.then(c=>o(c,n,i))}return o(a,n,i)}}t["~standard"]={validate:o=>{try{let s=br(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return xr(t,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),In=y("$ZodString",(t,e)=>{oe.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??gd(t._zod.bag),t._zod.parse=(r,n)=>{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}}),ae=y("$ZodStringFormat",(t,e)=>{Rn.init(t,e),In.init(t,e)}),Di=y("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=td),ae.init(t,e)}),Li=y("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Ci(n))}else e.pattern??(e.pattern=Ci());ae.init(t,e)}),qi=y("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=rd),ae.init(t,e)}),Ui=y("$ZodURL",(t,e)=>{ae.init(t,e),t._zod.check=r=>{try{let n=r.value,o=new URL(n),s=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ud.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!n.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Vi=y("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=nd()),ae.init(t,e)}),Fi=y("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Ql),ae.init(t,e)}),Hi=y("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Kl),ae.init(t,e)}),Wi=y("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Jl),ae.init(t,e)}),Bi=y("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Gl),ae.init(t,e)}),Ki=y("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Yl),ae.init(t,e)}),Ji=y("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Xl),ae.init(t,e)}),Wd=y("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=hd(e)),ae.init(t,e)}),Bd=y("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=pd),ae.init(t,e)}),Kd=y("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=md(e)),ae.init(t,e)}),Jd=y("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=ed),ae.init(t,e)}),Gi=y("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=od),ae.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),Yi=y("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=sd),ae.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.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})}}}),Xi=y("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=id),ae.init(t,e)}),Qi=y("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=ad),ae.init(t,e),t._zod.check=r=>{let[n,o]=r.value.split("/");try{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})}}});function Gd(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var ea=y("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=cd),ae.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{Gd(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function j_(t){if(!Ai.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Gd(r)}var ta=y("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ai),ae.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{j_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),ra=y("$ZodE164",(t,e)=>{e.pattern??(e.pattern=ld),ae.init(t,e)});function D_(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var na=y("$ZodJWT",(t,e)=>{ae.init(t,e),t._zod.check=r=>{D_(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var Io=y("$ZodNumber",(t,e)=>{oe.init(t,e),t._zod.pattern=t._zod.bag.pattern??_d,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...s?{received:s}:{}}),r}}),oa=y("$ZodNumber",(t,e)=>{kd.init(t,e),Io.init(t,e)}),sa=y("$ZodBoolean",(t,e)=>{oe.init(t,e),t._zod.pattern=vd,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}});var ia=y("$ZodUnknown",(t,e)=>{oe.init(t,e),t._zod.parse=r=>r}),aa=y("$ZodNever",(t,e)=>{oe.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Md(t,e,r){t.issues.length&&e.issues.push(..._t(r,t.issues)),e.value[r]=t.value}var ca=y("$ZodArray",(t,e)=>{oe.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=e.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>Md(u,r,i))):Md(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Ro(t,e,r){t.issues.length&&e.issues.push(..._t(r,t.issues)),e.value[r]=t.value}function jd(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(..._t(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}var Oo=y("$ZodObject",(t,e)=>{oe.init(t,e);let r=Sn(()=>{let d=Object.keys(e.shape);for(let m of d)if(!(e.shape[m]instanceof oe))throw new Error(`Invalid element at key "${m}": expected a Zod schema`);let h=$i(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(h)}});ie(t._zod,"propValues",()=>{let d=e.shape,h={};for(let m in d){let p=d[m]._zod;if(p.values){h[m]??(h[m]=new Set);for(let f of p.values)h[m].add(f)}}return h});let n=d=>{let h=new To(["shape","payload","ctx"]),m=r.value,p=w=>{let $=_r(w);return`shape[${$}]._zod.run({ value: input[${$}], issues: [] }, ctx)`};h.write("const input = payload.value;");let f=Object.create(null),g=0;for(let w of m.keys)f[w]=`key_${g++}`;h.write("const newResult = {}");for(let w of m.keys)if(m.optionalKeys.has(w)){let $=f[w];h.write(`const ${$} = ${p(w)};`);let E=_r(w);h.write(`
|
|
44
44
|
if (${$}.issues.length) {
|
|
45
45
|
if (input[${E}] === undefined) {
|
|
46
46
|
if (${E} in input) {
|
|
@@ -63,9 +63,9 @@ ${e}
|
|
|
63
63
|
if (${$}.issues.length) payload.issues = payload.issues.concat(${$}.issues.map(iss => ({
|
|
64
64
|
...iss,
|
|
65
65
|
path: iss.path ? [${_r(w)}, ...iss.path] : [${_r(w)}]
|
|
66
|
-
})));`),h.write(`newResult[${_r(w)}] = ${$}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");let v=h.compile();return(w,$)=>v(d,w,$)},o,s=Hr,i=!So.jitless,c=i&&xi.value,u=e.catchall,l;t._zod.parse=(d,h)=>{l??(l=r.value);let m=d.value;if(!s(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),d;let p=[];if(i&&c&&h?.async===!1&&h.jitless!==!0)o||(o=n(e.shape)),d=o(d,h);else{d.value={};let $=l.shape;for(let E of l.keys){let R=$[E],pe=R._zod.run({value:m[E],issues:[]},h),He=R._zod.optin==="optional"&&R._zod.optout==="optional";pe instanceof Promise?p.push(pe.then(Zr=>He?jd(Zr,d,E,m):Ro(Zr,d,E))):He?jd(pe,d,E,m):Ro(pe,d,E)}}if(!u)return p.length?Promise.all(p).then(()=>d):d;let f=[],g=l.keySet,v=u._zod,w=v.def.type;for(let $ of Object.keys(m)){if(g.has($))continue;if(w==="never"){f.push($);continue}let E=v.run({value:m[$],issues:[]},h);E instanceof Promise?p.push(E.then(R=>Ro(R,d,$))):Ro(E,d,$)}return f.length&&d.issues.push({code:"unrecognized_keys",keys:f,input:m,inst:t}),p.length?Promise.all(p).then(()=>d):d}});function Dd(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>nt(s,n,rt())))}),e}var No=y("$ZodUnion",(t,e)=>{ne.init(t,e),ie(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ie(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ie(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),ie(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>En(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let o=!1,s=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>Dd(i,r,t,n)):Dd(s,r,t,n)}}),ua=y("$ZodDiscriminatedUnion",(t,e)=>{No.init(t,e);let r=t._zod.parse;ie(t._zod,"propValues",()=>{let o={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=Sn(()=>{let o=e.options,s=new Map;for(let i of o){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(o,s)=>{let i=o.value;if(!Hr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),o;let a=n.value.get(i?.[e.discriminator]);return a?a._zod.run(o,s):e.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),o)}}),la=y("$ZodIntersection",(t,e)=>{ne.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,s=e.left._zod.run({value:o,issues:[]},n),i=e.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Ld(r,c,u)):Ld(r,s,i)}});function ji(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(Wr(t)&&Wr(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let i=ji(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],s=e[n],i=ji(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ld(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),vr(t))return t;let n=ji(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var da=y("$ZodRecord",(t,e)=>{ne.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Wr(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let s=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=e.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(..._t(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(..._t(c,u.issues)),r.value[c]=u.value)}let a;for(let c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(o)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new 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(u=>nt(u,n,rt())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(..._t(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(..._t(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var pa=y("$ZodEnum",(t,e)=>{ne.init(t,e);let r=kn(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>wi.has(typeof n)).map(n=>typeof n=="string"?Ht(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let s=n.value;return t._zod.values.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:t}),n}}),fa=y("$ZodLiteral",(t,e)=>{ne.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Ht(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),r}});var ma=y("$ZodTransform",(t,e)=>{ne.init(t,e),t._zod.parse=(r,n)=>{let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new It;return r.value=o,r}}),ha=y("$ZodOptional",(t,e)=>{ne.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ie(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ie(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${En(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),ga=y("$ZodNullable",(t,e)=>{ne.init(t,e),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),ie(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${En(r.source)}|null)$`):void 0}),ie(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),ya=y("$ZodDefault",(t,e)=>{ne.init(t,e),t._zod.optin="optional",ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>qd(s,e)):qd(o,e)}});function qd(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var _a=y("$ZodPrefault",(t,e)=>{ne.init(t,e),t._zod.optin="optional",ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),va=y("$ZodNonOptional",(t,e)=>{ne.init(t,e),ie(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Ud(s,t)):Ud(o,t)}});function Ud(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var ba=y("$ZodCatch",(t,e)=>{ne.init(t,e),t._zod.optin="optional",ie(t._zod,"optout",()=>e.innerType._zod.optout),ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>nt(i,n,rt()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>nt(s,n,rt()))},input:r.value}),r.issues=[]),r)}});var xa=y("$ZodPipe",(t,e)=>{ne.init(t,e),ie(t._zod,"values",()=>e.in._zod.values),ie(t._zod,"optin",()=>e.in._zod.optin),ie(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Vd(s,e,n)):Vd(o,e,n)}});function Vd(t,e,r){return vr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}var wa=y("$ZodReadonly",(t,e)=>{ne.init(t,e),ie(t._zod,"propValues",()=>e.innerType._zod.propValues),ie(t._zod,"values",()=>e.innerType._zod.values),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(Fd):Fd(o)}});function Fd(t){return t.value=Object.freeze(t.value),t}var $a=y("$ZodCustom",(t,e)=>{$e.init(t,e),ne.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(s=>Hd(s,r,n,t));Hd(o,r,n,t)}});function Hd(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(Si(o))}}var L_=Symbol("ZodOutput"),q_=Symbol("ZodInput"),On=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,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 n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Yd(){return new On}var Wt=Yd();function ka(t,e){return new t({type:"string",...A(e)})}function Sa(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...A(e)})}function Co(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...A(e)})}function za(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...A(e)})}function Ea(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(e)})}function Pa(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(e)})}function Ta(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(e)})}function Ra(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...A(e)})}function Ia(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...A(e)})}function Oa(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(e)})}function Na(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...A(e)})}function Ca(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(e)})}function Aa(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...A(e)})}function Za(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...A(e)})}function Ma(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(e)})}function ja(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(e)})}function Da(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(e)})}function La(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(e)})}function qa(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(e)})}function Ua(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...A(e)})}function Va(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...A(e)})}function Fa(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...A(e)})}function Ha(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...A(e)})}function Xd(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(e)})}function Qd(t,e){return new t({type:"string",format:"date",check:"string_format",...A(e)})}function ep(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...A(e)})}function tp(t,e){return new t({type:"string",format:"duration",check:"string_format",...A(e)})}function Wa(t,e){return new t({type:"number",checks:[],...A(e)})}function Ba(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...A(e)})}function Ka(t,e){return new t({type:"boolean",...A(e)})}function Ja(t){return new t({type:"unknown"})}function Ga(t,e){return new t({type:"never",...A(e)})}function Ao(t,e){return new Zi({check:"less_than",...A(e),value:t,inclusive:!1})}function Nn(t,e){return new Zi({check:"less_than",...A(e),value:t,inclusive:!0})}function Zo(t,e){return new Mi({check:"greater_than",...A(e),value:t,inclusive:!1})}function Cn(t,e){return new Mi({check:"greater_than",...A(e),value:t,inclusive:!0})}function Mo(t,e){return new $d({check:"multiple_of",...A(e),value:t})}function jo(t,e){return new Sd({check:"max_length",...A(e),maximum:t})}function Br(t,e){return new zd({check:"min_length",...A(e),minimum:t})}function Do(t,e){return new Ed({check:"length_equals",...A(e),length:t})}function Ya(t,e){return new Pd({check:"string_format",format:"regex",...A(e),pattern:t})}function Xa(t){return new Td({check:"string_format",format:"lowercase",...A(t)})}function Qa(t){return new Rd({check:"string_format",format:"uppercase",...A(t)})}function ec(t,e){return new Id({check:"string_format",format:"includes",...A(e),includes:t})}function tc(t,e){return new Od({check:"string_format",format:"starts_with",...A(e),prefix:t})}function rc(t,e){return new Nd({check:"string_format",format:"ends_with",...A(e),suffix:t})}function wr(t){return new Cd({check:"overwrite",tx:t})}function nc(t){return wr(e=>e.normalize(t))}function oc(){return wr(t=>t.trim())}function sc(){return wr(t=>t.toLowerCase())}function ic(){return wr(t=>t.toUpperCase())}function rp(t,e,r){return new t({type:"array",element:e,...A(r)})}function ac(t,e,r){let n=A(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function cc(t,e,r){return new t({type:"custom",check:"custom",fn:e,...A(r)})}var Lo=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Wt,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 n;let o=e._zod.def,s={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},h=e._zod.parent;if(h)a.ref=h,this.process(h,d),this.seen.get(h).isParent=!0;else{let m=a.schema;switch(o.type){case"string":{let p=m;p.type="string";let{minimum:f,maximum:g,format:v,patterns:w,contentEncoding:$}=e._zod.bag;if(typeof f=="number"&&(p.minLength=f),typeof g=="number"&&(p.maxLength=g),v&&(p.format=s[v]??v,p.format===""&&delete p.format),$&&(p.contentEncoding=$),w&&w.size>0){let E=[...w];E.length===1?p.pattern=E[0].source:E.length>1&&(a.schema.allOf=[...E.map(R=>({...this.target==="draft-7"?{type:"string"}:{},pattern:R.source}))])}break}case"number":{let p=m,{minimum:f,maximum:g,format:v,multipleOf:w,exclusiveMaximum:$,exclusiveMinimum:E}=e._zod.bag;typeof v=="string"&&v.includes("int")?p.type="integer":p.type="number",typeof E=="number"&&(p.exclusiveMinimum=E),typeof f=="number"&&(p.minimum=f,typeof E=="number"&&(E>=f?delete p.minimum:delete p.exclusiveMinimum)),typeof $=="number"&&(p.exclusiveMaximum=$),typeof g=="number"&&(p.maximum=g,typeof $=="number"&&($<=g?delete p.maximum:delete p.exclusiveMaximum)),typeof w=="number"&&(p.multipleOf=w);break}case"boolean":{let p=m;p.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{m.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{m.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let p=m,{minimum:f,maximum:g}=e._zod.bag;typeof f=="number"&&(p.minItems=f),typeof g=="number"&&(p.maxItems=g),p.type="array",p.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let p=m;p.type="object",p.properties={};let f=o.shape;for(let w in f)p.properties[w]=this.process(f[w],{...d,path:[...d.path,"properties",w]});let g=new Set(Object.keys(f)),v=new Set([...g].filter(w=>{let $=o.shape[w]._zod;return this.io==="input"?$.optin===void 0:$.optout===void 0}));v.size>0&&(p.required=Array.from(v)),o.catchall?._zod.def.type==="never"?p.additionalProperties=!1:o.catchall?o.catchall&&(p.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(p.additionalProperties=!1);break}case"union":{let p=m;p.anyOf=o.options.map((f,g)=>this.process(f,{...d,path:[...d.path,"anyOf",g]}));break}case"intersection":{let p=m,f=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),g=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),v=$=>"allOf"in $&&Object.keys($).length===1,w=[...v(f)?f.allOf:[f],...v(g)?g.allOf:[g]];p.allOf=w;break}case"tuple":{let p=m;p.type="array";let f=o.items.map((w,$)=>this.process(w,{...d,path:[...d.path,"prefixItems",$]}));if(this.target==="draft-2020-12"?p.prefixItems=f:p.items=f,o.rest){let w=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?p.items=w:p.additionalItems=w}o.rest&&(p.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:g,maximum:v}=e._zod.bag;typeof g=="number"&&(p.minItems=g),typeof v=="number"&&(p.maxItems=v);break}case"record":{let p=m;p.type="object",p.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),p.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let p=m,f=kn(o.entries);f.every(g=>typeof g=="number")&&(p.type="number"),f.every(g=>typeof g=="string")&&(p.type="string"),p.enum=f;break}case"literal":{let p=m,f=[];for(let g of o.values)if(g===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");f.push(Number(g))}else f.push(g);if(f.length!==0)if(f.length===1){let g=f[0];p.type=g===null?"null":typeof g,p.const=g}else f.every(g=>typeof g=="number")&&(p.type="number"),f.every(g=>typeof g=="string")&&(p.type="string"),f.every(g=>typeof g=="boolean")&&(p.type="string"),f.every(g=>g===null)&&(p.type="null"),p.enum=f;break}case"file":{let p=m,f={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:v,mime:w}=e._zod.bag;g!==void 0&&(f.minLength=g),v!==void 0&&(f.maxLength=v),w?w.length===1?(f.contentMediaType=w[0],Object.assign(p,f)):p.anyOf=w.map($=>({...f,contentMediaType:$})):Object.assign(p,f);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let p=this.process(o.innerType,d);m.anyOf=[p,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let p=m;p.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,m.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(m._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.ref=o.innerType;let p;try{p=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}m.default=p;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let p=m,f=e._zod.pattern;if(!f)throw new Error("Pattern not found in template literal");p.type="string",p.pattern=f.source;break}case"pipe":{let p=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(p,d),a.ref=p;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,m.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let p=e._zod.innerType;this.process(p,d),a.ref=p;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&ve(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let s=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let f=n.external.registry.get(l[0])?.id,g=n.external.uri??(w=>w);if(f)return{ref:g(f)};let v=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=v,{defId:v,ref:`${g("__shared")}#/${d}/${v}`}}if(l[1]===o)return{ref:"#"};let m=`#/${d}/`,p=l[1].schema.id??`__schema${this.counter++}`;return{defId:p,ref:m+p}},i=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:h,defId:m}=s(l);d.def={...d.schema},m&&(d.defId=m);let p=d.schema;for(let f in p)delete p[f];p.$ref=h};if(n.cycles==="throw")for(let l of this.seen.entries()){let d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
|
|
66
|
+
})));`),h.write(`newResult[${_r(w)}] = ${$}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");let v=h.compile();return(w,$)=>v(d,w,$)},o,s=Hr,i=!So.jitless,c=i&&xi.value,u=e.catchall,l;t._zod.parse=(d,h)=>{l??(l=r.value);let m=d.value;if(!s(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),d;let p=[];if(i&&c&&h?.async===!1&&h.jitless!==!0)o||(o=n(e.shape)),d=o(d,h);else{d.value={};let $=l.shape;for(let E of l.keys){let R=$[E],pe=R._zod.run({value:m[E],issues:[]},h),He=R._zod.optin==="optional"&&R._zod.optout==="optional";pe instanceof Promise?p.push(pe.then(Zr=>He?jd(Zr,d,E,m):Ro(Zr,d,E))):He?jd(pe,d,E,m):Ro(pe,d,E)}}if(!u)return p.length?Promise.all(p).then(()=>d):d;let f=[],g=l.keySet,v=u._zod,w=v.def.type;for(let $ of Object.keys(m)){if(g.has($))continue;if(w==="never"){f.push($);continue}let E=v.run({value:m[$],issues:[]},h);E instanceof Promise?p.push(E.then(R=>Ro(R,d,$))):Ro(E,d,$)}return f.length&&d.issues.push({code:"unrecognized_keys",keys:f,input:m,inst:t}),p.length?Promise.all(p).then(()=>d):d}});function Dd(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>nt(s,n,rt())))}),e}var No=y("$ZodUnion",(t,e)=>{oe.init(t,e),ie(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ie(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ie(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),ie(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>En(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let o=!1,s=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>Dd(i,r,t,n)):Dd(s,r,t,n)}}),ua=y("$ZodDiscriminatedUnion",(t,e)=>{No.init(t,e);let r=t._zod.parse;ie(t._zod,"propValues",()=>{let o={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=Sn(()=>{let o=e.options,s=new Map;for(let i of o){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(o,s)=>{let i=o.value;if(!Hr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),o;let a=n.value.get(i?.[e.discriminator]);return a?a._zod.run(o,s):e.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),o)}}),la=y("$ZodIntersection",(t,e)=>{oe.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,s=e.left._zod.run({value:o,issues:[]},n),i=e.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Ld(r,c,u)):Ld(r,s,i)}});function ji(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(Wr(t)&&Wr(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let i=ji(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],s=e[n],i=ji(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ld(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),vr(t))return t;let n=ji(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var da=y("$ZodRecord",(t,e)=>{oe.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Wr(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let s=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=e.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(..._t(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(..._t(c,u.issues)),r.value[c]=u.value)}let a;for(let c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(o)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new 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(u=>nt(u,n,rt())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(..._t(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(..._t(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var pa=y("$ZodEnum",(t,e)=>{oe.init(t,e);let r=kn(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>wi.has(typeof n)).map(n=>typeof n=="string"?Ht(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let s=n.value;return t._zod.values.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:t}),n}}),fa=y("$ZodLiteral",(t,e)=>{oe.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Ht(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),r}});var ma=y("$ZodTransform",(t,e)=>{oe.init(t,e),t._zod.parse=(r,n)=>{let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new It;return r.value=o,r}}),ha=y("$ZodOptional",(t,e)=>{oe.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ie(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ie(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${En(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),ga=y("$ZodNullable",(t,e)=>{oe.init(t,e),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),ie(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${En(r.source)}|null)$`):void 0}),ie(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),ya=y("$ZodDefault",(t,e)=>{oe.init(t,e),t._zod.optin="optional",ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>qd(s,e)):qd(o,e)}});function qd(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var _a=y("$ZodPrefault",(t,e)=>{oe.init(t,e),t._zod.optin="optional",ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),va=y("$ZodNonOptional",(t,e)=>{oe.init(t,e),ie(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Ud(s,t)):Ud(o,t)}});function Ud(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var ba=y("$ZodCatch",(t,e)=>{oe.init(t,e),t._zod.optin="optional",ie(t._zod,"optout",()=>e.innerType._zod.optout),ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>nt(i,n,rt()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>nt(s,n,rt()))},input:r.value}),r.issues=[]),r)}});var xa=y("$ZodPipe",(t,e)=>{oe.init(t,e),ie(t._zod,"values",()=>e.in._zod.values),ie(t._zod,"optin",()=>e.in._zod.optin),ie(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Vd(s,e,n)):Vd(o,e,n)}});function Vd(t,e,r){return vr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}var wa=y("$ZodReadonly",(t,e)=>{oe.init(t,e),ie(t._zod,"propValues",()=>e.innerType._zod.propValues),ie(t._zod,"values",()=>e.innerType._zod.values),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(Fd):Fd(o)}});function Fd(t){return t.value=Object.freeze(t.value),t}var $a=y("$ZodCustom",(t,e)=>{$e.init(t,e),oe.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(s=>Hd(s,r,n,t));Hd(o,r,n,t)}});function Hd(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(Si(o))}}var L_=Symbol("ZodOutput"),q_=Symbol("ZodInput"),On=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,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 n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Yd(){return new On}var Wt=Yd();function ka(t,e){return new t({type:"string",...A(e)})}function Sa(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...A(e)})}function Co(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...A(e)})}function za(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...A(e)})}function Ea(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(e)})}function Pa(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(e)})}function Ta(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(e)})}function Ra(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...A(e)})}function Ia(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...A(e)})}function Oa(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(e)})}function Na(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...A(e)})}function Ca(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(e)})}function Aa(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...A(e)})}function Za(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...A(e)})}function Ma(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(e)})}function ja(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(e)})}function Da(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(e)})}function La(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(e)})}function qa(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(e)})}function Ua(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...A(e)})}function Va(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...A(e)})}function Fa(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...A(e)})}function Ha(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...A(e)})}function Xd(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(e)})}function Qd(t,e){return new t({type:"string",format:"date",check:"string_format",...A(e)})}function ep(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...A(e)})}function tp(t,e){return new t({type:"string",format:"duration",check:"string_format",...A(e)})}function Wa(t,e){return new t({type:"number",checks:[],...A(e)})}function Ba(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...A(e)})}function Ka(t,e){return new t({type:"boolean",...A(e)})}function Ja(t){return new t({type:"unknown"})}function Ga(t,e){return new t({type:"never",...A(e)})}function Ao(t,e){return new Zi({check:"less_than",...A(e),value:t,inclusive:!1})}function Nn(t,e){return new Zi({check:"less_than",...A(e),value:t,inclusive:!0})}function Zo(t,e){return new Mi({check:"greater_than",...A(e),value:t,inclusive:!1})}function Cn(t,e){return new Mi({check:"greater_than",...A(e),value:t,inclusive:!0})}function Mo(t,e){return new $d({check:"multiple_of",...A(e),value:t})}function jo(t,e){return new Sd({check:"max_length",...A(e),maximum:t})}function Br(t,e){return new zd({check:"min_length",...A(e),minimum:t})}function Do(t,e){return new Ed({check:"length_equals",...A(e),length:t})}function Ya(t,e){return new Pd({check:"string_format",format:"regex",...A(e),pattern:t})}function Xa(t){return new Td({check:"string_format",format:"lowercase",...A(t)})}function Qa(t){return new Rd({check:"string_format",format:"uppercase",...A(t)})}function ec(t,e){return new Id({check:"string_format",format:"includes",...A(e),includes:t})}function tc(t,e){return new Od({check:"string_format",format:"starts_with",...A(e),prefix:t})}function rc(t,e){return new Nd({check:"string_format",format:"ends_with",...A(e),suffix:t})}function wr(t){return new Cd({check:"overwrite",tx:t})}function nc(t){return wr(e=>e.normalize(t))}function oc(){return wr(t=>t.trim())}function sc(){return wr(t=>t.toLowerCase())}function ic(){return wr(t=>t.toUpperCase())}function rp(t,e,r){return new t({type:"array",element:e,...A(r)})}function ac(t,e,r){let n=A(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function cc(t,e,r){return new t({type:"custom",check:"custom",fn:e,...A(r)})}var Lo=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Wt,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 n;let o=e._zod.def,s={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},h=e._zod.parent;if(h)a.ref=h,this.process(h,d),this.seen.get(h).isParent=!0;else{let m=a.schema;switch(o.type){case"string":{let p=m;p.type="string";let{minimum:f,maximum:g,format:v,patterns:w,contentEncoding:$}=e._zod.bag;if(typeof f=="number"&&(p.minLength=f),typeof g=="number"&&(p.maxLength=g),v&&(p.format=s[v]??v,p.format===""&&delete p.format),$&&(p.contentEncoding=$),w&&w.size>0){let E=[...w];E.length===1?p.pattern=E[0].source:E.length>1&&(a.schema.allOf=[...E.map(R=>({...this.target==="draft-7"?{type:"string"}:{},pattern:R.source}))])}break}case"number":{let p=m,{minimum:f,maximum:g,format:v,multipleOf:w,exclusiveMaximum:$,exclusiveMinimum:E}=e._zod.bag;typeof v=="string"&&v.includes("int")?p.type="integer":p.type="number",typeof E=="number"&&(p.exclusiveMinimum=E),typeof f=="number"&&(p.minimum=f,typeof E=="number"&&(E>=f?delete p.minimum:delete p.exclusiveMinimum)),typeof $=="number"&&(p.exclusiveMaximum=$),typeof g=="number"&&(p.maximum=g,typeof $=="number"&&($<=g?delete p.maximum:delete p.exclusiveMaximum)),typeof w=="number"&&(p.multipleOf=w);break}case"boolean":{let p=m;p.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{m.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{m.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let p=m,{minimum:f,maximum:g}=e._zod.bag;typeof f=="number"&&(p.minItems=f),typeof g=="number"&&(p.maxItems=g),p.type="array",p.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let p=m;p.type="object",p.properties={};let f=o.shape;for(let w in f)p.properties[w]=this.process(f[w],{...d,path:[...d.path,"properties",w]});let g=new Set(Object.keys(f)),v=new Set([...g].filter(w=>{let $=o.shape[w]._zod;return this.io==="input"?$.optin===void 0:$.optout===void 0}));v.size>0&&(p.required=Array.from(v)),o.catchall?._zod.def.type==="never"?p.additionalProperties=!1:o.catchall?o.catchall&&(p.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(p.additionalProperties=!1);break}case"union":{let p=m;p.anyOf=o.options.map((f,g)=>this.process(f,{...d,path:[...d.path,"anyOf",g]}));break}case"intersection":{let p=m,f=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),g=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),v=$=>"allOf"in $&&Object.keys($).length===1,w=[...v(f)?f.allOf:[f],...v(g)?g.allOf:[g]];p.allOf=w;break}case"tuple":{let p=m;p.type="array";let f=o.items.map((w,$)=>this.process(w,{...d,path:[...d.path,"prefixItems",$]}));if(this.target==="draft-2020-12"?p.prefixItems=f:p.items=f,o.rest){let w=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?p.items=w:p.additionalItems=w}o.rest&&(p.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:g,maximum:v}=e._zod.bag;typeof g=="number"&&(p.minItems=g),typeof v=="number"&&(p.maxItems=v);break}case"record":{let p=m;p.type="object",p.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),p.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let p=m,f=kn(o.entries);f.every(g=>typeof g=="number")&&(p.type="number"),f.every(g=>typeof g=="string")&&(p.type="string"),p.enum=f;break}case"literal":{let p=m,f=[];for(let g of o.values)if(g===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");f.push(Number(g))}else f.push(g);if(f.length!==0)if(f.length===1){let g=f[0];p.type=g===null?"null":typeof g,p.const=g}else f.every(g=>typeof g=="number")&&(p.type="number"),f.every(g=>typeof g=="string")&&(p.type="string"),f.every(g=>typeof g=="boolean")&&(p.type="string"),f.every(g=>g===null)&&(p.type="null"),p.enum=f;break}case"file":{let p=m,f={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:v,mime:w}=e._zod.bag;g!==void 0&&(f.minLength=g),v!==void 0&&(f.maxLength=v),w?w.length===1?(f.contentMediaType=w[0],Object.assign(p,f)):p.anyOf=w.map($=>({...f,contentMediaType:$})):Object.assign(p,f);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let p=this.process(o.innerType,d);m.anyOf=[p,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let p=m;p.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,m.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(m._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.ref=o.innerType;let p;try{p=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}m.default=p;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let p=m,f=e._zod.pattern;if(!f)throw new Error("Pattern not found in template literal");p.type="string",p.pattern=f.source;break}case"pipe":{let p=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(p,d),a.ref=p;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,m.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let p=e._zod.innerType;this.process(p,d),a.ref=p;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&ve(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let s=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let f=n.external.registry.get(l[0])?.id,g=n.external.uri??(w=>w);if(f)return{ref:g(f)};let v=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=v,{defId:v,ref:`${g("__shared")}#/${d}/${v}`}}if(l[1]===o)return{ref:"#"};let m=`#/${d}/`,p=l[1].schema.id??`__schema${this.counter++}`;return{defId:p,ref:m+p}},i=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:h,defId:m}=s(l);d.def={...d.schema},m&&(d.defId=m);let p=d.schema;for(let f in p)delete p[f];p.$ref=h};if(n.cycles==="throw")for(let l of this.seen.entries()){let d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
|
|
67
67
|
|
|
68
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){i(l);continue}if(n.external){let m=n.external.registry.get(l[0])?.id;if(e!==l[0]&&m){i(l);continue}}if(this.metadataRegistry.get(l[0])?.id){i(l);continue}if(d.cycle){i(l);continue}if(d.count>1&&n.reused==="ref"){i(l);continue}}let a=(l,d)=>{let h=this.seen.get(l),m=h.def??h.schema,p={...m};if(h.ref===null)return;let f=h.ref;if(h.ref=null,f){a(f,d);let g=this.seen.get(f).schema;g.$ref&&d.target==="draft-7"?(m.allOf=m.allOf??[],m.allOf.push(g)):(Object.assign(m,g),Object.assign(m,p))}h.isParent||this.override({zodSchema:l,jsonSchema:m,path:h.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function uc(t,e){if(t instanceof On){let n=new Lo(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let s={},i={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;s[c]=n.emit(u,{...e,external:i})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:o}}return{schemas:s}}let r=new Lo(e);return r.process(t),r.emit(t,e)}function ve(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;switch(o.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 ve(o.element,r);case"object":{for(let s in o.shape)if(ve(o.shape[s],r))return!0;return!1}case"union":{for(let s of o.options)if(ve(s,r))return!0;return!1}case"intersection":return ve(o.left,r)||ve(o.right,r);case"tuple":{for(let s of o.items)if(ve(s,r))return!0;return!!(o.rest&&ve(o.rest,r))}case"record":return ve(o.keyType,r)||ve(o.valueType,r);case"map":return ve(o.keyType,r)||ve(o.valueType,r);case"set":return ve(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return ve(o.innerType,r);case"lazy":return ve(o.getter(),r);case"default":return ve(o.innerType,r);case"prefault":return ve(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return ve(o.in,r)||ve(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var Sv=y("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");ne.init(t,e),t.def=e,t.parse=(r,n)=>Ti(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>br(t,r,n),t.parseAsync=async(r,n)=>Ii(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>xr(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Fe(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t)});var zv=y("ZodMiniObject",(t,e)=>{Oo.init(t,e),Sv.init(t,e),B.defineLazy(t,"shape",()=>e.shape)});function lc(t,e){let r={type:"object",get shape(){return B.assignProp(this,"shape",{...t}),this.shape},...B.normalizeParams(e)};return new zv(r)}function ot(t){return!!t._zod}function Jr(t){let e=Object.values(t);if(e.length===0)return lc({});let r=e.every(ot),n=e.every(o=>!ot(o));if(r)return lc(t);if(n)return hi(t);throw new Error("Mixed Zod versions detected in object shape.")}function qo(t,e){return ot(t)?br(t,e):t.safeParse(e)}async function Uo(t,e){return ot(t)?await xr(t,e):await t.safeParseAsync(e)}function Gr(t){var e,r;if(!t)return;let n;if(ot(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Yr(t){var e;if(t){if(typeof t=="object"){let r=t,n=t;if(!r._def&&!n._zod){let o=Object.values(t);if(o.length>0&&o.every(s=>typeof s=="object"&&s!==null&&(s._def!==void 0||s._zod!==void 0||typeof s.parse=="function")))return Jr(t)}}if(ot(t)){let n=(e=t._zod)===null||e===void 0?void 0:e.def;if(n&&(n.typeName==="object"||n.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function Vo(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function np(t){var e,r,n,o;if(ot(t))return(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.description;let s=t;return(n=t.description)!==null&&n!==void 0?n:(o=s._def)===null||o===void 0?void 0:o.description}function op(t){var e,r,n;if(ot(t))return((r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.typeName)==="ZodOptional";let o=t;return typeof t.isOptional=="function"?t.isOptional():((n=o._def)===null||n===void 0?void 0:n.typeName)==="ZodOptional"}function Fo(t){var e;if(ot(t)){let i=(e=t._zod)===null||e===void 0?void 0:e.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let o=t.value;if(o!==void 0)return o}var Nv=y("ZodISODateTime",(t,e)=>{Wd.init(t,e),le.init(t,e)});function sp(t){return Xd(Nv,t)}var Cv=y("ZodISODate",(t,e)=>{Bd.init(t,e),le.init(t,e)});function ip(t){return Qd(Cv,t)}var Av=y("ZodISOTime",(t,e)=>{Kd.init(t,e),le.init(t,e)});function ap(t){return ep(Av,t)}var Zv=y("ZodISODuration",(t,e)=>{Jd.init(t,e),le.init(t,e)});function cp(t){return tp(Zv,t)}var up=(t,e)=>{Eo.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Ei(t,r)},flatten:{value:r=>zi(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},wT=y("ZodError",up),An=y("ZodError",up,{Parent:Error});var lp=Pi(An),dp=Ri(An),pp=Oi(An),fp=Ni(An);var he=y("ZodType",(t,e)=>(ne.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Fe(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>lp(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>pp(t,r,n),t.parseAsync=async(r,n)=>dp(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>fp(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(Eb(r,n)),t.superRefine=r=>t.check(Pb(r)),t.overwrite=r=>t.check(wr(r)),t.optional=()=>V(t),t.nullable=()=>gp(t),t.nullish=()=>V(gp(t)),t.nonoptional=r=>bb(t,r),t.array=()=>Y(t),t.or=r=>fe([t,r]),t.and=r=>Wo(t,r),t.transform=r=>pc(t,wp(r)),t.default=r=>yb(t,r),t.prefault=r=>vb(t,r),t.catch=r=>wb(t,r),t.pipe=r=>pc(t,r),t.readonly=()=>Sb(t),t.describe=r=>{let n=t.clone();return Wt.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Wt.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Wt.get(t);let n=t.clone();return Wt.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),yp=y("_ZodString",(t,e)=>{In.init(t,e),he.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=(...n)=>t.check(Ya(...n)),t.includes=(...n)=>t.check(ec(...n)),t.startsWith=(...n)=>t.check(tc(...n)),t.endsWith=(...n)=>t.check(rc(...n)),t.min=(...n)=>t.check(Br(...n)),t.max=(...n)=>t.check(jo(...n)),t.length=(...n)=>t.check(Do(...n)),t.nonempty=(...n)=>t.check(Br(1,...n)),t.lowercase=n=>t.check(Xa(n)),t.uppercase=n=>t.check(Qa(n)),t.trim=()=>t.check(oc()),t.normalize=(...n)=>t.check(nc(...n)),t.toLowerCase=()=>t.check(sc()),t.toUpperCase=()=>t.check(ic())}),Lv=y("ZodString",(t,e)=>{In.init(t,e),yp.init(t,e),t.email=r=>t.check(Sa(qv,r)),t.url=r=>t.check(Ra(Uv,r)),t.jwt=r=>t.check(Ha(nb,r)),t.emoji=r=>t.check(Ia(Vv,r)),t.guid=r=>t.check(Co(mp,r)),t.uuid=r=>t.check(za(Ho,r)),t.uuidv4=r=>t.check(Ea(Ho,r)),t.uuidv6=r=>t.check(Pa(Ho,r)),t.uuidv7=r=>t.check(Ta(Ho,r)),t.nanoid=r=>t.check(Oa(Fv,r)),t.guid=r=>t.check(Co(mp,r)),t.cuid=r=>t.check(Na(Hv,r)),t.cuid2=r=>t.check(Ca(Wv,r)),t.ulid=r=>t.check(Aa(Bv,r)),t.base64=r=>t.check(Ua(eb,r)),t.base64url=r=>t.check(Va(tb,r)),t.xid=r=>t.check(Za(Kv,r)),t.ksuid=r=>t.check(Ma(Jv,r)),t.ipv4=r=>t.check(ja(Gv,r)),t.ipv6=r=>t.check(Da(Yv,r)),t.cidrv4=r=>t.check(La(Xv,r)),t.cidrv6=r=>t.check(qa(Qv,r)),t.e164=r=>t.check(Fa(rb,r)),t.datetime=r=>t.check(sp(r)),t.date=r=>t.check(ip(r)),t.time=r=>t.check(ap(r)),t.duration=r=>t.check(cp(r))});function _(t){return ka(Lv,t)}var le=y("ZodStringFormat",(t,e)=>{ae.init(t,e),yp.init(t,e)}),qv=y("ZodEmail",(t,e)=>{qi.init(t,e),le.init(t,e)});var mp=y("ZodGUID",(t,e)=>{Di.init(t,e),le.init(t,e)});var Ho=y("ZodUUID",(t,e)=>{Li.init(t,e),le.init(t,e)});var Uv=y("ZodURL",(t,e)=>{Ui.init(t,e),le.init(t,e)});var Vv=y("ZodEmoji",(t,e)=>{Vi.init(t,e),le.init(t,e)});var Fv=y("ZodNanoID",(t,e)=>{Fi.init(t,e),le.init(t,e)});var Hv=y("ZodCUID",(t,e)=>{Hi.init(t,e),le.init(t,e)});var Wv=y("ZodCUID2",(t,e)=>{Wi.init(t,e),le.init(t,e)});var Bv=y("ZodULID",(t,e)=>{Bi.init(t,e),le.init(t,e)});var Kv=y("ZodXID",(t,e)=>{Ki.init(t,e),le.init(t,e)});var Jv=y("ZodKSUID",(t,e)=>{Ji.init(t,e),le.init(t,e)});var Gv=y("ZodIPv4",(t,e)=>{Gi.init(t,e),le.init(t,e)});var Yv=y("ZodIPv6",(t,e)=>{Yi.init(t,e),le.init(t,e)});var Xv=y("ZodCIDRv4",(t,e)=>{Xi.init(t,e),le.init(t,e)});var Qv=y("ZodCIDRv6",(t,e)=>{Qi.init(t,e),le.init(t,e)});var eb=y("ZodBase64",(t,e)=>{ea.init(t,e),le.init(t,e)});var tb=y("ZodBase64URL",(t,e)=>{ta.init(t,e),le.init(t,e)});var rb=y("ZodE164",(t,e)=>{ra.init(t,e),le.init(t,e)});var nb=y("ZodJWT",(t,e)=>{na.init(t,e),le.init(t,e)});var _p=y("ZodNumber",(t,e)=>{Io.init(t,e),he.init(t,e),t.gt=(n,o)=>t.check(Zo(n,o)),t.gte=(n,o)=>t.check(Cn(n,o)),t.min=(n,o)=>t.check(Cn(n,o)),t.lt=(n,o)=>t.check(Ao(n,o)),t.lte=(n,o)=>t.check(Nn(n,o)),t.max=(n,o)=>t.check(Nn(n,o)),t.int=n=>t.check(hp(n)),t.safe=n=>t.check(hp(n)),t.positive=n=>t.check(Zo(0,n)),t.nonnegative=n=>t.check(Cn(0,n)),t.negative=n=>t.check(Ao(0,n)),t.nonpositive=n=>t.check(Nn(0,n)),t.multipleOf=(n,o)=>t.check(Mo(n,o)),t.step=(n,o)=>t.check(Mo(n,o)),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});function ge(t){return Wa(_p,t)}var ob=y("ZodNumberFormat",(t,e)=>{oa.init(t,e),_p.init(t,e)});function hp(t){return Ba(ob,t)}var sb=y("ZodBoolean",(t,e)=>{sa.init(t,e),he.init(t,e)});function ke(t){return Ka(sb,t)}var ib=y("ZodUnknown",(t,e)=>{ia.init(t,e),he.init(t,e)});function me(){return Ja(ib)}var ab=y("ZodNever",(t,e)=>{aa.init(t,e),he.init(t,e)});function cb(t){return Ga(ab,t)}var ub=y("ZodArray",(t,e)=>{ca.init(t,e),he.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Br(r,n)),t.nonempty=r=>t.check(Br(1,r)),t.max=(r,n)=>t.check(jo(r,n)),t.length=(r,n)=>t.check(Do(r,n)),t.unwrap=()=>t.element});function Y(t,e){return rp(ub,t,e)}var vp=y("ZodObject",(t,e)=>{Oo.init(t,e),he.init(t,e),B.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Je(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:me()}),t.loose=()=>t.clone({...t._zod.def,catchall:me()}),t.strict=()=>t.clone({...t._zod.def,catchall:cb()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>B.extend(t,r),t.merge=r=>B.merge(t,r),t.pick=r=>B.pick(t,r),t.omit=r=>B.omit(t,r),t.partial=(...r)=>B.partial($p,t,r[0]),t.required=(...r)=>B.required(kp,t,r[0])});function P(t,e){let r={type:"object",get shape(){return B.assignProp(this,"shape",{...t}),this.shape},...B.normalizeParams(e)};return new vp(r)}function Ot(t,e){return new vp({type:"object",get shape(){return B.assignProp(this,"shape",{...t}),this.shape},catchall:me(),...B.normalizeParams(e)})}var bp=y("ZodUnion",(t,e)=>{No.init(t,e),he.init(t,e),t.options=e.options});function fe(t,e){return new bp({type:"union",options:t,...B.normalizeParams(e)})}var lb=y("ZodDiscriminatedUnion",(t,e)=>{bp.init(t,e),ua.init(t,e)});function xp(t,e,r){return new lb({type:"union",options:e,discriminator:t,...B.normalizeParams(r)})}var db=y("ZodIntersection",(t,e)=>{la.init(t,e),he.init(t,e)});function Wo(t,e){return new db({type:"intersection",left:t,right:e})}var pb=y("ZodRecord",(t,e)=>{da.init(t,e),he.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function ye(t,e,r){return new pb({type:"record",keyType:t,valueType:e,...B.normalizeParams(r)})}var dc=y("ZodEnum",(t,e)=>{pa.init(t,e),he.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new dc({...e,checks:[],...B.normalizeParams(o),entries:s})},t.exclude=(n,o)=>{let s={...e.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new dc({...e,checks:[],...B.normalizeParams(o),entries:s})}});function Je(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new dc({type:"enum",entries:r,...B.normalizeParams(e)})}var fb=y("ZodLiteral",(t,e)=>{fa.init(t,e),he.init(t,e),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]}})});function N(t,e){return new fb({type:"literal",values:Array.isArray(t)?t:[t],...B.normalizeParams(e)})}var mb=y("ZodTransform",(t,e)=>{ma.init(t,e),he.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(B.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(B.issue(i))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function wp(t){return new mb({type:"transform",transform:t})}var $p=y("ZodOptional",(t,e)=>{ha.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function V(t){return new $p({type:"optional",innerType:t})}var hb=y("ZodNullable",(t,e)=>{ga.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function gp(t){return new hb({type:"nullable",innerType:t})}var gb=y("ZodDefault",(t,e)=>{ya.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function yb(t,e){return new gb({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var _b=y("ZodPrefault",(t,e)=>{_a.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function vb(t,e){return new _b({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var kp=y("ZodNonOptional",(t,e)=>{va.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function bb(t,e){return new kp({type:"nonoptional",innerType:t,...B.normalizeParams(e)})}var xb=y("ZodCatch",(t,e)=>{ba.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function wb(t,e){return new xb({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var $b=y("ZodPipe",(t,e)=>{xa.init(t,e),he.init(t,e),t.in=e.in,t.out=e.out});function pc(t,e){return new $b({type:"pipe",in:t,out:e})}var kb=y("ZodReadonly",(t,e)=>{wa.init(t,e),he.init(t,e)});function Sb(t){return new kb({type:"readonly",innerType:t})}var Sp=y("ZodCustom",(t,e)=>{$a.init(t,e),he.init(t,e)});function zb(t){let e=new $e({check:"custom"});return e._zod.check=t,e}function zp(t,e){return ac(Sp,t??(()=>!0),e)}function Eb(t,e={}){return cc(Sp,t,e)}function Pb(t){let e=zb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(B.issue(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(B.issue(o))}},t(r.value,r)));return e}function Ep(t,e){return pc(wp(t),e)}var mc="2025-06-18";var Pp=[mc,"2025-03-26","2024-11-05","2024-10-07"],Ko="2.0",vt=zp(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Tp=fe([_(),ge().int()]),Rp=_(),Tb=Ot({progressToken:Tp.optional()}),st=Ot({_meta:Tb.optional()}),Me=P({method:_(),params:st.optional()}),Qr=Ot({_meta:ye(_(),me()).optional()}),it=P({method:_(),params:Qr.optional()}),Ge=Ot({_meta:ye(_(),me()).optional()}),Jo=fe([_(),ge().int()]),Ip=P({jsonrpc:N(Ko),id:Jo,...Me.shape}).strict(),Op=t=>Ip.safeParse(t).success,Np=P({jsonrpc:N(Ko),...it.shape}).strict(),Cp=t=>Np.safeParse(t).success,Ap=P({jsonrpc:N(Ko),id:Jo,result:Ge}).strict(),hc=t=>Ap.safeParse(t).success,ee;(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"})(ee||(ee={}));var Zp=P({jsonrpc:N(Ko),id:Jo,error:P({code:ge().int(),message:_(),data:V(me())})}).strict(),Mp=t=>Zp.safeParse(t).success,jp=fe([Ip,Np,Ap,Zp]),Go=Ge.strict(),Rb=Qr.extend({requestId:Jo,reason:_().optional()}),Yo=it.extend({method:N("notifications/cancelled"),params:Rb}),Ib=P({src:_(),mimeType:_().optional(),sizes:Y(_()).optional()}),Zn=P({icons:Y(Ib).optional()}),Xr=P({name:_(),title:_().optional()}),Dp=Xr.extend({...Xr.shape,...Zn.shape,version:_(),websiteUrl:_().optional()}),Ob=Wo(P({applyDefaults:ke().optional()}),ye(_(),me())),Nb=Ep(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Wo(P({form:Ob.optional(),url:vt.optional()}),ye(_(),me()).optional())),Cb=P({experimental:ye(_(),vt).optional(),sampling:P({context:vt.optional(),tools:vt.optional()}).optional(),elicitation:Nb.optional(),roots:P({listChanged:ke().optional()}).optional()}),Ab=st.extend({protocolVersion:_(),capabilities:Cb,clientInfo:Dp}),gc=Me.extend({method:N("initialize"),params:Ab});var Zb=P({experimental:ye(_(),vt).optional(),logging:vt.optional(),completions:vt.optional(),prompts:V(P({listChanged:V(ke())})),resources:P({subscribe:ke().optional(),listChanged:ke().optional()}).optional(),tools:P({listChanged:ke().optional()}).optional()}),Mb=Ge.extend({protocolVersion:_(),capabilities:Zb,serverInfo:Dp,instructions:_().optional()}),yc=it.extend({method:N("notifications/initialized")});var Xo=Me.extend({method:N("ping")}),jb=P({progress:ge(),total:V(ge()),message:V(_())}),Db=P({...Qr.shape,...jb.shape,progressToken:Tp}),Qo=it.extend({method:N("notifications/progress"),params:Db}),Lb=st.extend({cursor:Rp.optional()}),es=Me.extend({params:Lb.optional()}),ts=Ge.extend({nextCursor:V(Rp)}),Lp=P({uri:_(),mimeType:V(_()),_meta:ye(_(),me()).optional()}),qp=Lp.extend({text:_()}),_c=_().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Up=Lp.extend({blob:_c}),Vp=P({...Xr.shape,...Zn.shape,uri:_(),description:V(_()),mimeType:V(_()),_meta:V(Ot({}))}),qb=P({...Xr.shape,...Zn.shape,uriTemplate:_(),description:V(_()),mimeType:V(_()),_meta:V(Ot({}))}),rs=es.extend({method:N("resources/list")}),Ub=ts.extend({resources:Y(Vp)}),ns=es.extend({method:N("resources/templates/list")}),Vb=ts.extend({resourceTemplates:Y(qb)}),vc=st.extend({uri:_()}),Fb=vc,os=Me.extend({method:N("resources/read"),params:Fb}),Hb=Ge.extend({contents:Y(fe([qp,Up]))}),Wb=it.extend({method:N("notifications/resources/list_changed")}),Bb=vc,Kb=Me.extend({method:N("resources/subscribe"),params:Bb}),Jb=vc,Gb=Me.extend({method:N("resources/unsubscribe"),params:Jb}),Yb=Qr.extend({uri:_()}),Xb=it.extend({method:N("notifications/resources/updated"),params:Yb}),Qb=P({name:_(),description:V(_()),required:V(ke())}),ex=P({...Xr.shape,...Zn.shape,description:V(_()),arguments:V(Y(Qb)),_meta:V(Ot({}))}),ss=es.extend({method:N("prompts/list")}),tx=ts.extend({prompts:Y(ex)}),rx=st.extend({name:_(),arguments:ye(_(),_()).optional()}),is=Me.extend({method:N("prompts/get"),params:rx}),Fp=P({type:N("text"),text:_(),_meta:ye(_(),me()).optional()}),Hp=P({type:N("image"),data:_c,mimeType:_(),_meta:ye(_(),me()).optional()}),Wp=P({type:N("audio"),data:_c,mimeType:_(),_meta:ye(_(),me()).optional()}),nx=P({type:N("tool_use"),name:_(),id:_(),input:P({}).passthrough(),_meta:V(P({}).passthrough())}).passthrough(),ox=P({type:N("resource"),resource:fe([qp,Up]),_meta:ye(_(),me()).optional()}),sx=Vp.extend({type:N("resource_link")}),bc=fe([Fp,Hp,Wp,sx,ox]),ix=P({role:Je(["user","assistant"]),content:bc}),ax=Ge.extend({description:V(_()),messages:Y(ix)}),cx=it.extend({method:N("notifications/prompts/list_changed")}),ux=P({title:_().optional(),readOnlyHint:ke().optional(),destructiveHint:ke().optional(),idempotentHint:ke().optional(),openWorldHint:ke().optional()}),Bp=P({...Xr.shape,...Zn.shape,description:_().optional(),inputSchema:P({type:N("object"),properties:ye(_(),vt).optional(),required:Y(_()).optional()}).catchall(me()),outputSchema:P({type:N("object"),properties:ye(_(),vt).optional(),required:Y(_()).optional()}).catchall(me()).optional(),annotations:V(ux),_meta:ye(_(),me()).optional()}),as=es.extend({method:N("tools/list")}),lx=ts.extend({tools:Y(Bp)}),Kp=Ge.extend({content:Y(bc).default([]),structuredContent:ye(_(),me()).optional(),isError:V(ke())}),ET=Kp.or(Ge.extend({toolResult:me()})),dx=st.extend({name:_(),arguments:V(ye(_(),me()))}),cs=Me.extend({method:N("tools/call"),params:dx}),px=it.extend({method:N("notifications/tools/list_changed")}),Mn=Je(["debug","info","notice","warning","error","critical","alert","emergency"]),fx=st.extend({level:Mn}),xc=Me.extend({method:N("logging/setLevel"),params:fx}),mx=Qr.extend({level:Mn,logger:_().optional(),data:me()}),hx=it.extend({method:N("notifications/message"),params:mx}),gx=P({name:_().optional()}),yx=P({hints:V(Y(gx)),costPriority:V(ge().min(0).max(1)),speedPriority:V(ge().min(0).max(1)),intelligencePriority:V(ge().min(0).max(1))}),_x=P({mode:V(Je(["auto","required","none"]))}),vx=P({type:N("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:Y(bc).default([]),structuredContent:P({}).passthrough().optional(),isError:V(ke()),_meta:V(P({}).passthrough())}).passthrough(),Bo=xp("type",[Fp,Hp,Wp,nx,vx]),bx=P({role:Je(["user","assistant"]),content:fe([Bo,Y(Bo)]),_meta:V(P({}).passthrough())}).passthrough(),xx=st.extend({messages:Y(bx),modelPreferences:yx.optional(),systemPrompt:_().optional(),includeContext:Je(["none","thisServer","allServers"]).optional(),temperature:ge().optional(),maxTokens:ge().int(),stopSequences:Y(_()).optional(),metadata:vt.optional(),tools:V(Y(Bp)),toolChoice:V(_x)}),wx=Me.extend({method:N("sampling/createMessage"),params:xx}),wc=Ge.extend({model:_(),stopReason:V(Je(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:Je(["user","assistant"]),content:fe([Bo,Y(Bo)])}),$x=P({type:N("boolean"),title:_().optional(),description:_().optional(),default:ke().optional()}),kx=P({type:N("string"),title:_().optional(),description:_().optional(),minLength:ge().optional(),maxLength:ge().optional(),format:Je(["email","uri","date","date-time"]).optional(),default:_().optional()}),Sx=P({type:Je(["number","integer"]),title:_().optional(),description:_().optional(),minimum:ge().optional(),maximum:ge().optional(),default:ge().optional()}),zx=P({type:N("string"),title:_().optional(),description:_().optional(),enum:Y(_()),default:_().optional()}),Ex=P({type:N("string"),title:_().optional(),description:_().optional(),oneOf:Y(P({const:_(),title:_()})),default:_().optional()}),Px=P({type:N("string"),title:_().optional(),description:_().optional(),enum:Y(_()),enumNames:Y(_()).optional(),default:_().optional()}),Tx=fe([zx,Ex]),Rx=P({type:N("array"),title:_().optional(),description:_().optional(),minItems:ge().optional(),maxItems:ge().optional(),items:P({type:N("string"),enum:Y(_())}),default:Y(_()).optional()}),Ix=P({type:N("array"),title:_().optional(),description:_().optional(),minItems:ge().optional(),maxItems:ge().optional(),items:P({anyOf:Y(P({const:_(),title:_()}))}),default:Y(_()).optional()}),Ox=fe([Rx,Ix]),Nx=fe([Px,Tx,Ox]),Cx=fe([Nx,$x,kx,Sx]),Ax=st.extend({mode:N("form").optional(),message:_(),requestedSchema:P({type:N("object"),properties:ye(_(),Cx),required:Y(_()).optional()})}),Zx=st.extend({mode:N("url"),message:_(),elicitationId:_(),url:_().url()}),Mx=fe([Ax,Zx]),jx=Me.extend({method:N("elicitation/create"),params:Mx}),Dx=Qr.extend({elicitationId:_()}),Lx=it.extend({method:N("notifications/elicitation/complete"),params:Dx}),us=Ge.extend({action:Je(["accept","decline","cancel"]),content:ye(_(),fe([_(),ge(),ke(),Y(_())])).optional()}),qx=P({type:N("ref/resource"),uri:_()});var Ux=P({type:N("ref/prompt"),name:_()}),Vx=st.extend({ref:fe([Ux,qx]),argument:P({name:_(),value:_()}),context:P({arguments:ye(_(),_()).optional()}).optional()}),ls=Me.extend({method:N("completion/complete"),params:Vx});function Jp(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function Gp(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var Fx=Ge.extend({completion:Ot({values:Y(_()).max(100),total:V(ge().int()),hasMore:V(ke())})}),Hx=P({uri:_().startsWith("file://"),name:_().optional(),_meta:ye(_(),me()).optional()}),Wx=Me.extend({method:N("roots/list")}),$c=Ge.extend({roots:Y(Hx)}),Bx=it.extend({method:N("notifications/roots/list_changed")}),PT=fe([Xo,gc,ls,xc,is,ss,rs,ns,os,Kb,Gb,cs,as]),TT=fe([Yo,Qo,yc,Bx]),RT=fe([Go,wc,us,$c]),IT=fe([Xo,wx,jx,Wx]),OT=fe([Yo,Qo,hx,Xb,Wb,px,cx,Lx]),NT=fe([Go,Mb,Fx,ax,tx,Ub,Vb,Hb,Kp,lx]),te=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===ee.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new fc(o.elicitations,r)}return new t(e,r,n)}},fc=class extends te{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(ee.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};var Xp=Symbol("Let zodToJsonSchema decide on which parser to use");var Yp={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"},Qp=t=>typeof t=="string"?{...Yp,name:t}:{...Yp,...t};var ef=t=>{let e=Qp(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(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function kc(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function K(t,e,r,n,o){t[e]=r,kc(t,e,n,o)}var ds=(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("/")};function de(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?ds(e,t.currentPath):e.join("/")}}function tf(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==x.ZodAny&&(r.items=M(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&K(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&K(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(K(r,"minItems",t.exactLength.value,t.exactLength.message,e),K(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function rf(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?K(r,"minimum",n.value,n.message,e):K(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),K(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?K(r,"maximum",n.value,n.message,e):K(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),K(r,"maximum",n.value,n.message,e));break;case"multipleOf":K(r,"multipleOf",n.value,n.message,e);break}return r}function nf(){return{type:"boolean"}}function ps(t,e){return M(t.type._def,e)}var of=(t,e)=>M(t.innerType._def,e);function Sc(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Sc(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Kx(t,e)}}var Kx=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":K(r,"minimum",n.value,n.message,e);break;case"max":K(r,"maximum",n.value,n.message,e);break}return r};function sf(t,e){return{...M(t.innerType._def,e),default:t.defaultValue()}}function af(t,e){return e.effectStrategy==="input"?M(t.schema._def,e):de(e)}function cf(t){return{type:"string",enum:Array.from(t.values)}}var Jx=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function uf(t,e){let r=[M(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),M(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(s=>{if(Jx(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function lf(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 zc,at={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:()=>(zc===void 0&&(zc=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),zc),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function fs(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":K(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":K(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":ct(r,"email",n.message,e);break;case"format:idn-email":ct(r,"idn-email",n.message,e);break;case"pattern:zod":Ie(r,at.email,n.message,e);break}break;case"url":ct(r,"uri",n.message,e);break;case"uuid":ct(r,"uuid",n.message,e);break;case"regex":Ie(r,n.regex,n.message,e);break;case"cuid":Ie(r,at.cuid,n.message,e);break;case"cuid2":Ie(r,at.cuid2,n.message,e);break;case"startsWith":Ie(r,RegExp(`^${Ec(n.value,e)}`),n.message,e);break;case"endsWith":Ie(r,RegExp(`${Ec(n.value,e)}$`),n.message,e);break;case"datetime":ct(r,"date-time",n.message,e);break;case"date":ct(r,"date",n.message,e);break;case"time":ct(r,"time",n.message,e);break;case"duration":ct(r,"duration",n.message,e);break;case"length":K(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),K(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Ie(r,RegExp(Ec(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&ct(r,"ipv4",n.message,e),n.version!=="v4"&&ct(r,"ipv6",n.message,e);break}case"base64url":Ie(r,at.base64url,n.message,e);break;case"jwt":Ie(r,at.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Ie(r,at.ipv4Cidr,n.message,e),n.version!=="v4"&&Ie(r,at.ipv6Cidr,n.message,e);break}case"emoji":Ie(r,at.emoji(),n.message,e);break;case"ulid":{Ie(r,at.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ct(r,"binary",n.message,e);break}case"contentEncoding:base64":{K(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Ie(r,at.base64,n.message,e);break}}break}case"nanoid":Ie(r,at.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Ec(t,e){return e.patternStrategy==="escape"?Yx(t):t}var Gx=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Yx(t){let e="";for(let r=0;r<t.length;r++)Gx.has(t[r])||(e+="\\"),e+=t[r];return e}function ct(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.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&&n.errorMessages&&{errorMessage:{format:r}}})):K(t,"format",e,r,n)}function Ie(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.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:df(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):K(t,"pattern",df(e,n),r,n)}function df(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")},n=r.i?t.source.toLowerCase():t.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){a?(o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(o+=n[c],a=!0):o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
|
|
68
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){i(l);continue}if(n.external){let m=n.external.registry.get(l[0])?.id;if(e!==l[0]&&m){i(l);continue}}if(this.metadataRegistry.get(l[0])?.id){i(l);continue}if(d.cycle){i(l);continue}if(d.count>1&&n.reused==="ref"){i(l);continue}}let a=(l,d)=>{let h=this.seen.get(l),m=h.def??h.schema,p={...m};if(h.ref===null)return;let f=h.ref;if(h.ref=null,f){a(f,d);let g=this.seen.get(f).schema;g.$ref&&d.target==="draft-7"?(m.allOf=m.allOf??[],m.allOf.push(g)):(Object.assign(m,g),Object.assign(m,p))}h.isParent||this.override({zodSchema:l,jsonSchema:m,path:h.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function uc(t,e){if(t instanceof On){let n=new Lo(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let s={},i={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;s[c]=n.emit(u,{...e,external:i})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:o}}return{schemas:s}}let r=new Lo(e);return r.process(t),r.emit(t,e)}function ve(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;switch(o.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 ve(o.element,r);case"object":{for(let s in o.shape)if(ve(o.shape[s],r))return!0;return!1}case"union":{for(let s of o.options)if(ve(s,r))return!0;return!1}case"intersection":return ve(o.left,r)||ve(o.right,r);case"tuple":{for(let s of o.items)if(ve(s,r))return!0;return!!(o.rest&&ve(o.rest,r))}case"record":return ve(o.keyType,r)||ve(o.valueType,r);case"map":return ve(o.keyType,r)||ve(o.valueType,r);case"set":return ve(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return ve(o.innerType,r);case"lazy":return ve(o.getter(),r);case"default":return ve(o.innerType,r);case"prefault":return ve(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return ve(o.in,r)||ve(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var Sv=y("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");oe.init(t,e),t.def=e,t.parse=(r,n)=>Ti(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>br(t,r,n),t.parseAsync=async(r,n)=>Ii(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>xr(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Fe(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t)});var zv=y("ZodMiniObject",(t,e)=>{Oo.init(t,e),Sv.init(t,e),B.defineLazy(t,"shape",()=>e.shape)});function lc(t,e){let r={type:"object",get shape(){return B.assignProp(this,"shape",{...t}),this.shape},...B.normalizeParams(e)};return new zv(r)}function ot(t){return!!t._zod}function Jr(t){let e=Object.values(t);if(e.length===0)return lc({});let r=e.every(ot),n=e.every(o=>!ot(o));if(r)return lc(t);if(n)return hi(t);throw new Error("Mixed Zod versions detected in object shape.")}function qo(t,e){return ot(t)?br(t,e):t.safeParse(e)}async function Uo(t,e){return ot(t)?await xr(t,e):await t.safeParseAsync(e)}function Gr(t){var e,r;if(!t)return;let n;if(ot(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Yr(t){var e;if(t){if(typeof t=="object"){let r=t,n=t;if(!r._def&&!n._zod){let o=Object.values(t);if(o.length>0&&o.every(s=>typeof s=="object"&&s!==null&&(s._def!==void 0||s._zod!==void 0||typeof s.parse=="function")))return Jr(t)}}if(ot(t)){let n=(e=t._zod)===null||e===void 0?void 0:e.def;if(n&&(n.typeName==="object"||n.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function Vo(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function np(t){var e,r,n,o;if(ot(t))return(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.description;let s=t;return(n=t.description)!==null&&n!==void 0?n:(o=s._def)===null||o===void 0?void 0:o.description}function op(t){var e,r,n;if(ot(t))return((r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.typeName)==="ZodOptional";let o=t;return typeof t.isOptional=="function"?t.isOptional():((n=o._def)===null||n===void 0?void 0:n.typeName)==="ZodOptional"}function Fo(t){var e;if(ot(t)){let i=(e=t._zod)===null||e===void 0?void 0:e.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let o=t.value;if(o!==void 0)return o}var Nv=y("ZodISODateTime",(t,e)=>{Wd.init(t,e),le.init(t,e)});function sp(t){return Xd(Nv,t)}var Cv=y("ZodISODate",(t,e)=>{Bd.init(t,e),le.init(t,e)});function ip(t){return Qd(Cv,t)}var Av=y("ZodISOTime",(t,e)=>{Kd.init(t,e),le.init(t,e)});function ap(t){return ep(Av,t)}var Zv=y("ZodISODuration",(t,e)=>{Jd.init(t,e),le.init(t,e)});function cp(t){return tp(Zv,t)}var up=(t,e)=>{Eo.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Ei(t,r)},flatten:{value:r=>zi(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},wT=y("ZodError",up),An=y("ZodError",up,{Parent:Error});var lp=Pi(An),dp=Ri(An),pp=Oi(An),fp=Ni(An);var he=y("ZodType",(t,e)=>(oe.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Fe(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>lp(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>pp(t,r,n),t.parseAsync=async(r,n)=>dp(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>fp(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(Eb(r,n)),t.superRefine=r=>t.check(Pb(r)),t.overwrite=r=>t.check(wr(r)),t.optional=()=>V(t),t.nullable=()=>gp(t),t.nullish=()=>V(gp(t)),t.nonoptional=r=>bb(t,r),t.array=()=>Y(t),t.or=r=>fe([t,r]),t.and=r=>Wo(t,r),t.transform=r=>pc(t,wp(r)),t.default=r=>yb(t,r),t.prefault=r=>vb(t,r),t.catch=r=>wb(t,r),t.pipe=r=>pc(t,r),t.readonly=()=>Sb(t),t.describe=r=>{let n=t.clone();return Wt.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Wt.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Wt.get(t);let n=t.clone();return Wt.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),yp=y("_ZodString",(t,e)=>{In.init(t,e),he.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=(...n)=>t.check(Ya(...n)),t.includes=(...n)=>t.check(ec(...n)),t.startsWith=(...n)=>t.check(tc(...n)),t.endsWith=(...n)=>t.check(rc(...n)),t.min=(...n)=>t.check(Br(...n)),t.max=(...n)=>t.check(jo(...n)),t.length=(...n)=>t.check(Do(...n)),t.nonempty=(...n)=>t.check(Br(1,...n)),t.lowercase=n=>t.check(Xa(n)),t.uppercase=n=>t.check(Qa(n)),t.trim=()=>t.check(oc()),t.normalize=(...n)=>t.check(nc(...n)),t.toLowerCase=()=>t.check(sc()),t.toUpperCase=()=>t.check(ic())}),Lv=y("ZodString",(t,e)=>{In.init(t,e),yp.init(t,e),t.email=r=>t.check(Sa(qv,r)),t.url=r=>t.check(Ra(Uv,r)),t.jwt=r=>t.check(Ha(nb,r)),t.emoji=r=>t.check(Ia(Vv,r)),t.guid=r=>t.check(Co(mp,r)),t.uuid=r=>t.check(za(Ho,r)),t.uuidv4=r=>t.check(Ea(Ho,r)),t.uuidv6=r=>t.check(Pa(Ho,r)),t.uuidv7=r=>t.check(Ta(Ho,r)),t.nanoid=r=>t.check(Oa(Fv,r)),t.guid=r=>t.check(Co(mp,r)),t.cuid=r=>t.check(Na(Hv,r)),t.cuid2=r=>t.check(Ca(Wv,r)),t.ulid=r=>t.check(Aa(Bv,r)),t.base64=r=>t.check(Ua(eb,r)),t.base64url=r=>t.check(Va(tb,r)),t.xid=r=>t.check(Za(Kv,r)),t.ksuid=r=>t.check(Ma(Jv,r)),t.ipv4=r=>t.check(ja(Gv,r)),t.ipv6=r=>t.check(Da(Yv,r)),t.cidrv4=r=>t.check(La(Xv,r)),t.cidrv6=r=>t.check(qa(Qv,r)),t.e164=r=>t.check(Fa(rb,r)),t.datetime=r=>t.check(sp(r)),t.date=r=>t.check(ip(r)),t.time=r=>t.check(ap(r)),t.duration=r=>t.check(cp(r))});function _(t){return ka(Lv,t)}var le=y("ZodStringFormat",(t,e)=>{ae.init(t,e),yp.init(t,e)}),qv=y("ZodEmail",(t,e)=>{qi.init(t,e),le.init(t,e)});var mp=y("ZodGUID",(t,e)=>{Di.init(t,e),le.init(t,e)});var Ho=y("ZodUUID",(t,e)=>{Li.init(t,e),le.init(t,e)});var Uv=y("ZodURL",(t,e)=>{Ui.init(t,e),le.init(t,e)});var Vv=y("ZodEmoji",(t,e)=>{Vi.init(t,e),le.init(t,e)});var Fv=y("ZodNanoID",(t,e)=>{Fi.init(t,e),le.init(t,e)});var Hv=y("ZodCUID",(t,e)=>{Hi.init(t,e),le.init(t,e)});var Wv=y("ZodCUID2",(t,e)=>{Wi.init(t,e),le.init(t,e)});var Bv=y("ZodULID",(t,e)=>{Bi.init(t,e),le.init(t,e)});var Kv=y("ZodXID",(t,e)=>{Ki.init(t,e),le.init(t,e)});var Jv=y("ZodKSUID",(t,e)=>{Ji.init(t,e),le.init(t,e)});var Gv=y("ZodIPv4",(t,e)=>{Gi.init(t,e),le.init(t,e)});var Yv=y("ZodIPv6",(t,e)=>{Yi.init(t,e),le.init(t,e)});var Xv=y("ZodCIDRv4",(t,e)=>{Xi.init(t,e),le.init(t,e)});var Qv=y("ZodCIDRv6",(t,e)=>{Qi.init(t,e),le.init(t,e)});var eb=y("ZodBase64",(t,e)=>{ea.init(t,e),le.init(t,e)});var tb=y("ZodBase64URL",(t,e)=>{ta.init(t,e),le.init(t,e)});var rb=y("ZodE164",(t,e)=>{ra.init(t,e),le.init(t,e)});var nb=y("ZodJWT",(t,e)=>{na.init(t,e),le.init(t,e)});var _p=y("ZodNumber",(t,e)=>{Io.init(t,e),he.init(t,e),t.gt=(n,o)=>t.check(Zo(n,o)),t.gte=(n,o)=>t.check(Cn(n,o)),t.min=(n,o)=>t.check(Cn(n,o)),t.lt=(n,o)=>t.check(Ao(n,o)),t.lte=(n,o)=>t.check(Nn(n,o)),t.max=(n,o)=>t.check(Nn(n,o)),t.int=n=>t.check(hp(n)),t.safe=n=>t.check(hp(n)),t.positive=n=>t.check(Zo(0,n)),t.nonnegative=n=>t.check(Cn(0,n)),t.negative=n=>t.check(Ao(0,n)),t.nonpositive=n=>t.check(Nn(0,n)),t.multipleOf=(n,o)=>t.check(Mo(n,o)),t.step=(n,o)=>t.check(Mo(n,o)),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});function ge(t){return Wa(_p,t)}var ob=y("ZodNumberFormat",(t,e)=>{oa.init(t,e),_p.init(t,e)});function hp(t){return Ba(ob,t)}var sb=y("ZodBoolean",(t,e)=>{sa.init(t,e),he.init(t,e)});function ke(t){return Ka(sb,t)}var ib=y("ZodUnknown",(t,e)=>{ia.init(t,e),he.init(t,e)});function me(){return Ja(ib)}var ab=y("ZodNever",(t,e)=>{aa.init(t,e),he.init(t,e)});function cb(t){return Ga(ab,t)}var ub=y("ZodArray",(t,e)=>{ca.init(t,e),he.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Br(r,n)),t.nonempty=r=>t.check(Br(1,r)),t.max=(r,n)=>t.check(jo(r,n)),t.length=(r,n)=>t.check(Do(r,n)),t.unwrap=()=>t.element});function Y(t,e){return rp(ub,t,e)}var vp=y("ZodObject",(t,e)=>{Oo.init(t,e),he.init(t,e),B.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Je(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:me()}),t.loose=()=>t.clone({...t._zod.def,catchall:me()}),t.strict=()=>t.clone({...t._zod.def,catchall:cb()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>B.extend(t,r),t.merge=r=>B.merge(t,r),t.pick=r=>B.pick(t,r),t.omit=r=>B.omit(t,r),t.partial=(...r)=>B.partial($p,t,r[0]),t.required=(...r)=>B.required(kp,t,r[0])});function P(t,e){let r={type:"object",get shape(){return B.assignProp(this,"shape",{...t}),this.shape},...B.normalizeParams(e)};return new vp(r)}function Ot(t,e){return new vp({type:"object",get shape(){return B.assignProp(this,"shape",{...t}),this.shape},catchall:me(),...B.normalizeParams(e)})}var bp=y("ZodUnion",(t,e)=>{No.init(t,e),he.init(t,e),t.options=e.options});function fe(t,e){return new bp({type:"union",options:t,...B.normalizeParams(e)})}var lb=y("ZodDiscriminatedUnion",(t,e)=>{bp.init(t,e),ua.init(t,e)});function xp(t,e,r){return new lb({type:"union",options:e,discriminator:t,...B.normalizeParams(r)})}var db=y("ZodIntersection",(t,e)=>{la.init(t,e),he.init(t,e)});function Wo(t,e){return new db({type:"intersection",left:t,right:e})}var pb=y("ZodRecord",(t,e)=>{da.init(t,e),he.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function ye(t,e,r){return new pb({type:"record",keyType:t,valueType:e,...B.normalizeParams(r)})}var dc=y("ZodEnum",(t,e)=>{pa.init(t,e),he.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new dc({...e,checks:[],...B.normalizeParams(o),entries:s})},t.exclude=(n,o)=>{let s={...e.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new dc({...e,checks:[],...B.normalizeParams(o),entries:s})}});function Je(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new dc({type:"enum",entries:r,...B.normalizeParams(e)})}var fb=y("ZodLiteral",(t,e)=>{fa.init(t,e),he.init(t,e),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]}})});function N(t,e){return new fb({type:"literal",values:Array.isArray(t)?t:[t],...B.normalizeParams(e)})}var mb=y("ZodTransform",(t,e)=>{ma.init(t,e),he.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(B.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(B.issue(i))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function wp(t){return new mb({type:"transform",transform:t})}var $p=y("ZodOptional",(t,e)=>{ha.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function V(t){return new $p({type:"optional",innerType:t})}var hb=y("ZodNullable",(t,e)=>{ga.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function gp(t){return new hb({type:"nullable",innerType:t})}var gb=y("ZodDefault",(t,e)=>{ya.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function yb(t,e){return new gb({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var _b=y("ZodPrefault",(t,e)=>{_a.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function vb(t,e){return new _b({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var kp=y("ZodNonOptional",(t,e)=>{va.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function bb(t,e){return new kp({type:"nonoptional",innerType:t,...B.normalizeParams(e)})}var xb=y("ZodCatch",(t,e)=>{ba.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function wb(t,e){return new xb({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var $b=y("ZodPipe",(t,e)=>{xa.init(t,e),he.init(t,e),t.in=e.in,t.out=e.out});function pc(t,e){return new $b({type:"pipe",in:t,out:e})}var kb=y("ZodReadonly",(t,e)=>{wa.init(t,e),he.init(t,e)});function Sb(t){return new kb({type:"readonly",innerType:t})}var Sp=y("ZodCustom",(t,e)=>{$a.init(t,e),he.init(t,e)});function zb(t){let e=new $e({check:"custom"});return e._zod.check=t,e}function zp(t,e){return ac(Sp,t??(()=>!0),e)}function Eb(t,e={}){return cc(Sp,t,e)}function Pb(t){let e=zb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(B.issue(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(B.issue(o))}},t(r.value,r)));return e}function Ep(t,e){return pc(wp(t),e)}var mc="2025-06-18";var Pp=[mc,"2025-03-26","2024-11-05","2024-10-07"],Ko="2.0",vt=zp(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Tp=fe([_(),ge().int()]),Rp=_(),Tb=Ot({progressToken:Tp.optional()}),st=Ot({_meta:Tb.optional()}),Me=P({method:_(),params:st.optional()}),Qr=Ot({_meta:ye(_(),me()).optional()}),it=P({method:_(),params:Qr.optional()}),Ge=Ot({_meta:ye(_(),me()).optional()}),Jo=fe([_(),ge().int()]),Ip=P({jsonrpc:N(Ko),id:Jo,...Me.shape}).strict(),Op=t=>Ip.safeParse(t).success,Np=P({jsonrpc:N(Ko),...it.shape}).strict(),Cp=t=>Np.safeParse(t).success,Ap=P({jsonrpc:N(Ko),id:Jo,result:Ge}).strict(),hc=t=>Ap.safeParse(t).success,ee;(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"})(ee||(ee={}));var Zp=P({jsonrpc:N(Ko),id:Jo,error:P({code:ge().int(),message:_(),data:V(me())})}).strict(),Mp=t=>Zp.safeParse(t).success,jp=fe([Ip,Np,Ap,Zp]),Go=Ge.strict(),Rb=Qr.extend({requestId:Jo,reason:_().optional()}),Yo=it.extend({method:N("notifications/cancelled"),params:Rb}),Ib=P({src:_(),mimeType:_().optional(),sizes:Y(_()).optional()}),Zn=P({icons:Y(Ib).optional()}),Xr=P({name:_(),title:_().optional()}),Dp=Xr.extend({...Xr.shape,...Zn.shape,version:_(),websiteUrl:_().optional()}),Ob=Wo(P({applyDefaults:ke().optional()}),ye(_(),me())),Nb=Ep(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Wo(P({form:Ob.optional(),url:vt.optional()}),ye(_(),me()).optional())),Cb=P({experimental:ye(_(),vt).optional(),sampling:P({context:vt.optional(),tools:vt.optional()}).optional(),elicitation:Nb.optional(),roots:P({listChanged:ke().optional()}).optional()}),Ab=st.extend({protocolVersion:_(),capabilities:Cb,clientInfo:Dp}),gc=Me.extend({method:N("initialize"),params:Ab});var Zb=P({experimental:ye(_(),vt).optional(),logging:vt.optional(),completions:vt.optional(),prompts:V(P({listChanged:V(ke())})),resources:P({subscribe:ke().optional(),listChanged:ke().optional()}).optional(),tools:P({listChanged:ke().optional()}).optional()}),Mb=Ge.extend({protocolVersion:_(),capabilities:Zb,serverInfo:Dp,instructions:_().optional()}),yc=it.extend({method:N("notifications/initialized")});var Xo=Me.extend({method:N("ping")}),jb=P({progress:ge(),total:V(ge()),message:V(_())}),Db=P({...Qr.shape,...jb.shape,progressToken:Tp}),Qo=it.extend({method:N("notifications/progress"),params:Db}),Lb=st.extend({cursor:Rp.optional()}),es=Me.extend({params:Lb.optional()}),ts=Ge.extend({nextCursor:V(Rp)}),Lp=P({uri:_(),mimeType:V(_()),_meta:ye(_(),me()).optional()}),qp=Lp.extend({text:_()}),_c=_().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Up=Lp.extend({blob:_c}),Vp=P({...Xr.shape,...Zn.shape,uri:_(),description:V(_()),mimeType:V(_()),_meta:V(Ot({}))}),qb=P({...Xr.shape,...Zn.shape,uriTemplate:_(),description:V(_()),mimeType:V(_()),_meta:V(Ot({}))}),rs=es.extend({method:N("resources/list")}),Ub=ts.extend({resources:Y(Vp)}),ns=es.extend({method:N("resources/templates/list")}),Vb=ts.extend({resourceTemplates:Y(qb)}),vc=st.extend({uri:_()}),Fb=vc,os=Me.extend({method:N("resources/read"),params:Fb}),Hb=Ge.extend({contents:Y(fe([qp,Up]))}),Wb=it.extend({method:N("notifications/resources/list_changed")}),Bb=vc,Kb=Me.extend({method:N("resources/subscribe"),params:Bb}),Jb=vc,Gb=Me.extend({method:N("resources/unsubscribe"),params:Jb}),Yb=Qr.extend({uri:_()}),Xb=it.extend({method:N("notifications/resources/updated"),params:Yb}),Qb=P({name:_(),description:V(_()),required:V(ke())}),ex=P({...Xr.shape,...Zn.shape,description:V(_()),arguments:V(Y(Qb)),_meta:V(Ot({}))}),ss=es.extend({method:N("prompts/list")}),tx=ts.extend({prompts:Y(ex)}),rx=st.extend({name:_(),arguments:ye(_(),_()).optional()}),is=Me.extend({method:N("prompts/get"),params:rx}),Fp=P({type:N("text"),text:_(),_meta:ye(_(),me()).optional()}),Hp=P({type:N("image"),data:_c,mimeType:_(),_meta:ye(_(),me()).optional()}),Wp=P({type:N("audio"),data:_c,mimeType:_(),_meta:ye(_(),me()).optional()}),nx=P({type:N("tool_use"),name:_(),id:_(),input:P({}).passthrough(),_meta:V(P({}).passthrough())}).passthrough(),ox=P({type:N("resource"),resource:fe([qp,Up]),_meta:ye(_(),me()).optional()}),sx=Vp.extend({type:N("resource_link")}),bc=fe([Fp,Hp,Wp,sx,ox]),ix=P({role:Je(["user","assistant"]),content:bc}),ax=Ge.extend({description:V(_()),messages:Y(ix)}),cx=it.extend({method:N("notifications/prompts/list_changed")}),ux=P({title:_().optional(),readOnlyHint:ke().optional(),destructiveHint:ke().optional(),idempotentHint:ke().optional(),openWorldHint:ke().optional()}),Bp=P({...Xr.shape,...Zn.shape,description:_().optional(),inputSchema:P({type:N("object"),properties:ye(_(),vt).optional(),required:Y(_()).optional()}).catchall(me()),outputSchema:P({type:N("object"),properties:ye(_(),vt).optional(),required:Y(_()).optional()}).catchall(me()).optional(),annotations:V(ux),_meta:ye(_(),me()).optional()}),as=es.extend({method:N("tools/list")}),lx=ts.extend({tools:Y(Bp)}),Kp=Ge.extend({content:Y(bc).default([]),structuredContent:ye(_(),me()).optional(),isError:V(ke())}),ET=Kp.or(Ge.extend({toolResult:me()})),dx=st.extend({name:_(),arguments:V(ye(_(),me()))}),cs=Me.extend({method:N("tools/call"),params:dx}),px=it.extend({method:N("notifications/tools/list_changed")}),Mn=Je(["debug","info","notice","warning","error","critical","alert","emergency"]),fx=st.extend({level:Mn}),xc=Me.extend({method:N("logging/setLevel"),params:fx}),mx=Qr.extend({level:Mn,logger:_().optional(),data:me()}),hx=it.extend({method:N("notifications/message"),params:mx}),gx=P({name:_().optional()}),yx=P({hints:V(Y(gx)),costPriority:V(ge().min(0).max(1)),speedPriority:V(ge().min(0).max(1)),intelligencePriority:V(ge().min(0).max(1))}),_x=P({mode:V(Je(["auto","required","none"]))}),vx=P({type:N("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:Y(bc).default([]),structuredContent:P({}).passthrough().optional(),isError:V(ke()),_meta:V(P({}).passthrough())}).passthrough(),Bo=xp("type",[Fp,Hp,Wp,nx,vx]),bx=P({role:Je(["user","assistant"]),content:fe([Bo,Y(Bo)]),_meta:V(P({}).passthrough())}).passthrough(),xx=st.extend({messages:Y(bx),modelPreferences:yx.optional(),systemPrompt:_().optional(),includeContext:Je(["none","thisServer","allServers"]).optional(),temperature:ge().optional(),maxTokens:ge().int(),stopSequences:Y(_()).optional(),metadata:vt.optional(),tools:V(Y(Bp)),toolChoice:V(_x)}),wx=Me.extend({method:N("sampling/createMessage"),params:xx}),wc=Ge.extend({model:_(),stopReason:V(Je(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:Je(["user","assistant"]),content:fe([Bo,Y(Bo)])}),$x=P({type:N("boolean"),title:_().optional(),description:_().optional(),default:ke().optional()}),kx=P({type:N("string"),title:_().optional(),description:_().optional(),minLength:ge().optional(),maxLength:ge().optional(),format:Je(["email","uri","date","date-time"]).optional(),default:_().optional()}),Sx=P({type:Je(["number","integer"]),title:_().optional(),description:_().optional(),minimum:ge().optional(),maximum:ge().optional(),default:ge().optional()}),zx=P({type:N("string"),title:_().optional(),description:_().optional(),enum:Y(_()),default:_().optional()}),Ex=P({type:N("string"),title:_().optional(),description:_().optional(),oneOf:Y(P({const:_(),title:_()})),default:_().optional()}),Px=P({type:N("string"),title:_().optional(),description:_().optional(),enum:Y(_()),enumNames:Y(_()).optional(),default:_().optional()}),Tx=fe([zx,Ex]),Rx=P({type:N("array"),title:_().optional(),description:_().optional(),minItems:ge().optional(),maxItems:ge().optional(),items:P({type:N("string"),enum:Y(_())}),default:Y(_()).optional()}),Ix=P({type:N("array"),title:_().optional(),description:_().optional(),minItems:ge().optional(),maxItems:ge().optional(),items:P({anyOf:Y(P({const:_(),title:_()}))}),default:Y(_()).optional()}),Ox=fe([Rx,Ix]),Nx=fe([Px,Tx,Ox]),Cx=fe([Nx,$x,kx,Sx]),Ax=st.extend({mode:N("form").optional(),message:_(),requestedSchema:P({type:N("object"),properties:ye(_(),Cx),required:Y(_()).optional()})}),Zx=st.extend({mode:N("url"),message:_(),elicitationId:_(),url:_().url()}),Mx=fe([Ax,Zx]),jx=Me.extend({method:N("elicitation/create"),params:Mx}),Dx=Qr.extend({elicitationId:_()}),Lx=it.extend({method:N("notifications/elicitation/complete"),params:Dx}),us=Ge.extend({action:Je(["accept","decline","cancel"]),content:ye(_(),fe([_(),ge(),ke(),Y(_())])).optional()}),qx=P({type:N("ref/resource"),uri:_()});var Ux=P({type:N("ref/prompt"),name:_()}),Vx=st.extend({ref:fe([Ux,qx]),argument:P({name:_(),value:_()}),context:P({arguments:ye(_(),_()).optional()}).optional()}),ls=Me.extend({method:N("completion/complete"),params:Vx});function Jp(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function Gp(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var Fx=Ge.extend({completion:Ot({values:Y(_()).max(100),total:V(ge().int()),hasMore:V(ke())})}),Hx=P({uri:_().startsWith("file://"),name:_().optional(),_meta:ye(_(),me()).optional()}),Wx=Me.extend({method:N("roots/list")}),$c=Ge.extend({roots:Y(Hx)}),Bx=it.extend({method:N("notifications/roots/list_changed")}),PT=fe([Xo,gc,ls,xc,is,ss,rs,ns,os,Kb,Gb,cs,as]),TT=fe([Yo,Qo,yc,Bx]),RT=fe([Go,wc,us,$c]),IT=fe([Xo,wx,jx,Wx]),OT=fe([Yo,Qo,hx,Xb,Wb,px,cx,Lx]),NT=fe([Go,Mb,Fx,ax,tx,Ub,Vb,Hb,Kp,lx]),te=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===ee.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new fc(o.elicitations,r)}return new t(e,r,n)}},fc=class extends te{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(ee.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};var Xp=Symbol("Let zodToJsonSchema decide on which parser to use");var Yp={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"},Qp=t=>typeof t=="string"?{...Yp,name:t}:{...Yp,...t};var ef=t=>{let e=Qp(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(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function kc(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function K(t,e,r,n,o){t[e]=r,kc(t,e,n,o)}var ds=(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("/")};function de(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?ds(e,t.currentPath):e.join("/")}}function tf(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==x.ZodAny&&(r.items=M(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&K(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&K(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(K(r,"minItems",t.exactLength.value,t.exactLength.message,e),K(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function rf(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?K(r,"minimum",n.value,n.message,e):K(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),K(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?K(r,"maximum",n.value,n.message,e):K(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),K(r,"maximum",n.value,n.message,e));break;case"multipleOf":K(r,"multipleOf",n.value,n.message,e);break}return r}function nf(){return{type:"boolean"}}function ps(t,e){return M(t.type._def,e)}var of=(t,e)=>M(t.innerType._def,e);function Sc(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Sc(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Kx(t,e)}}var Kx=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":K(r,"minimum",n.value,n.message,e);break;case"max":K(r,"maximum",n.value,n.message,e);break}return r};function sf(t,e){return{...M(t.innerType._def,e),default:t.defaultValue()}}function af(t,e){return e.effectStrategy==="input"?M(t.schema._def,e):de(e)}function cf(t){return{type:"string",enum:Array.from(t.values)}}var Jx=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function uf(t,e){let r=[M(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),M(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(s=>{if(Jx(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function lf(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 zc,at={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:()=>(zc===void 0&&(zc=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),zc),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function fs(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":K(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":K(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":ct(r,"email",n.message,e);break;case"format:idn-email":ct(r,"idn-email",n.message,e);break;case"pattern:zod":Ie(r,at.email,n.message,e);break}break;case"url":ct(r,"uri",n.message,e);break;case"uuid":ct(r,"uuid",n.message,e);break;case"regex":Ie(r,n.regex,n.message,e);break;case"cuid":Ie(r,at.cuid,n.message,e);break;case"cuid2":Ie(r,at.cuid2,n.message,e);break;case"startsWith":Ie(r,RegExp(`^${Ec(n.value,e)}`),n.message,e);break;case"endsWith":Ie(r,RegExp(`${Ec(n.value,e)}$`),n.message,e);break;case"datetime":ct(r,"date-time",n.message,e);break;case"date":ct(r,"date",n.message,e);break;case"time":ct(r,"time",n.message,e);break;case"duration":ct(r,"duration",n.message,e);break;case"length":K(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),K(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Ie(r,RegExp(Ec(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&ct(r,"ipv4",n.message,e),n.version!=="v4"&&ct(r,"ipv6",n.message,e);break}case"base64url":Ie(r,at.base64url,n.message,e);break;case"jwt":Ie(r,at.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Ie(r,at.ipv4Cidr,n.message,e),n.version!=="v4"&&Ie(r,at.ipv6Cidr,n.message,e);break}case"emoji":Ie(r,at.emoji(),n.message,e);break;case"ulid":{Ie(r,at.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ct(r,"binary",n.message,e);break}case"contentEncoding:base64":{K(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Ie(r,at.base64,n.message,e);break}}break}case"nanoid":Ie(r,at.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Ec(t,e){return e.patternStrategy==="escape"?Yx(t):t}var Gx=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Yx(t){let e="";for(let r=0;r<t.length;r++)Gx.has(t[r])||(e+="\\"),e+=t[r];return e}function ct(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.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&&n.errorMessages&&{errorMessage:{format:r}}})):K(t,"format",e,r,n)}function Ie(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.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:df(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):K(t,"pattern",df(e,n),r,n)}function df(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")},n=r.i?t.source.toLowerCase():t.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){a?(o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(o+=n[c],a=!0):o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
|
|
69
69
|
]))`;continue}else if(n[c]==="$"){o+=`($|(?=[\r
|
|
70
70
|
]))`;continue}}if(r.s&&n[c]==="."){o+=i?`${n[c]}\r
|
|
71
71
|
`:`[${n[c]}\r
|
|
@@ -73,7 +73,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
73
73
|
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),eE(r)}clear(){this._buffer=void 0}};function eE(t){return jp.parse(JSON.parse(t))}function Sg(t){return JSON.stringify(t)+`
|
|
74
74
|
`}var ri=class{constructor(e=zg.stdin,r=zg.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new ti,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{var o;(o=this.onerror)===null||o===void 0||o.call(this,n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(r=>{let n=Sg(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};async function Dg(){return(process.env.SUPERCLAWD_BACKEND||"real").toLowerCase()==="mock"?(await Promise.resolve().then(()=>(Cg(),Ng))).mockBackend:(await Promise.resolve().then(()=>(jg(),Mg))).realBackend}ni();var ai="superclawd",bE="core",xE=`mcp__plugin_${ai}_${bE}__`;var PC=`${xE}*`,TC=`${ai}:`;import{existsSync as El}from"node:fs";import{homedir as wE}from"node:os";import{spawn as $E,execSync as kE}from"node:child_process";var SE="sonnet",zE=2e4;function EE(){let t=process.env.SUPERCLAWD_CLAUDE_BIN;if(t&&El(t))return t;try{let r=process.platform==="win32"?"where claude":"command -v claude",n=kE(r,{encoding:"utf8"}).trim().split(`
|
|
75
75
|
`)[0];if(n&&El(n))return n}catch{}let e=[`${wE()}/.local/bin/claude`,"/opt/homebrew/bin/claude","/usr/local/bin/claude","/usr/bin/claude"];for(let r of e)if(El(r))return r;return null}function PE(t){let e=t.indexOf("{"),r=t.lastIndexOf("}");return e>=0&&r>e?t.slice(e,r+1):t}function TE(t){let{system:e,user:r}=t,n=t.model||SE,o=t.timeoutMs??zE,s=EE();return s?new Promise(i=>{let a="",c=!1,u=h=>{c||(c=!0,i(h))},l;try{l=$E(s,["-p","--model",n,"--output-format","json","--strict-mcp-config","--setting-sources","user","--tools","","--append-system-prompt",e],{stdio:["pipe","pipe","ignore"],env:{...process.env,SUPERCLAWD_POLICY_JUDGE:"1"}})}catch{return u(null)}let d=setTimeout(()=>{try{l.kill("SIGKILL")}catch{}u(null)},o);l.stdout?.on("data",h=>a+=h),l.on("error",()=>{clearTimeout(d),u(null)}),l.on("close",()=>{if(clearTimeout(d),t.onRaw)try{t.onRaw(a)}catch{}u(a)});try{l.stdin?.write(r),l.stdin?.end()}catch{}}):Promise.resolve(null)}function Lg(t){return TE(t).then(e=>{if(!e)return null;try{let r=e;try{let n=JSON.parse(e);typeof n.result=="string"&&(r=n.result)}catch{}return JSON.parse(PE(r))}catch{return null}})}var AC=["You maintain the durable memory for ONE repository. You review a FINISHED coding session and RECONCILE what it taught against the memories ALREADY SAVED (shown below with ids), keeping the set accurate, current, and non-redundant for the NEXT session. ","SAVE or UPDATE a fact when it would save a newcomer real time or prevent a wrong turn \u2014 for example: the build/test/run command (especially anything non-default, e.g. a subdirectory or required env flags); where key code or config lives when the layout is non-obvious (e.g. the app is in a subdirectory, or content is data-driven from one file); a setup step or arrangement needed to make things work (e.g. ESM-only deps must be mocked for tests to run); a correction to a reasonable wrong assumption (e.g. the repo uses npm despite a pnpm convention); or a non-obvious gotcha and its fix. A fact STILL qualifies even if it 'could be figured out by reading the files'. ","NEVER save: secrets or credentials; code dumps; transient state (a test that merely happened to pass or fail this run); one-off task details; or truly trivial facts (e.g. 'this is a React project', or that a file exists). ","NEVER bake VOLATILE SuperClawd identifiers into a fact: a workflow/skill/command/agent SLUG or id, or a tool-invocation recipe like 'call get_workflow with <slug>'. These break the moment the entity is renamed. Refer to an entity by its human NAME (e.g. the 'Code Review Process' workflow), or omit the identifier entirely. ","CRITICAL \u2014 the ALREADY-SAVED list is the ONLY knowledge future sessions have. If it is NONE, this repo has ZERO saved knowledge: nobody knows the build command, the package manager, or where the app lives \u2014 so the session's basic orientation facts (build/test command, package manager, where the app actually lives, key setup steps) are exactly what the first memories should record. Never call a fact 'already known' or 'standard' \u2014 judge only against the literal list. ","Emit OPERATIONS against the existing set: ",'\u2022 "create" \u2014 a genuinely NEW fact not represented by any existing memory. ','\u2022 "update" \u2014 the session REFINES, SHARPENS, or CORRECTS an existing memory: cite its id and rewrite its COMPLETE body to the now-correct version. Prefer update over create whenever an existing memory is about the same thing (the package manager, the app location, the build command, \u2026), even if the wording differs. A correction (e.g. the app moved from apps/web to apps/app) is an UPDATE to that memory, NOT a new one. When you correct a fact, also UPDATE any OTHER memory that still references the now-stale version. ',"\u2022 Omit any fact already captured accurately (no op). ","A memory tagged [LOCKED] is read-only: never update it; you may only create a complementary fact. ","Keep the set MINIMAL and CURRENT: never leave two memories about the same thing, and never leave an outdated fact beside its correction. ",'CRITICAL \u2014 within THIS single response, every fact must end up in EXACTLY ONE memory: never emit a "create" whose content is already covered by (or overlaps) a memory you keep or "update" in the same response. If the session adds a fact related to an existing memory, FOLD it into that memory with ONE "update" \u2014 do NOT also create a separate memory for the same fact. ',"This is a ONE-SHOT reconciliation of an already-finished session \u2014 do NOT continue the work, ask questions, or take any action. ",`Every op MUST include a "title": a distilled, human one-line SUMMARY of its body (<=120 chars) \u2014 a real summary, NOT the body's first words copied verbatim. `,'Respond with ONLY a strict JSON object {"ops":[ ... ],"reason":"<short overall why>"} and nothing else. Each op is {"op":"create","title":"<=120-char summary","body":"<self-contained 1-4 sentence note with concrete commands/paths + the gotcha & its fix>"} or {"op":"update","id":"<existing id>","title":"<=120-char summary","body":"<rewritten complete note>"}. If the session taught nothing durable, return {"ops":[],"reason":"..."}.'].join(""),ZC=["You review a FINISHED coding session and RECONCILE what it taught against the memories ALREADY SAVED (shown below with ids), keeping each memory set accurate, current, and non-redundant for the NEXT session. You maintain TWO memory sets and route every op to the correct one: ",'\u2022 "repo" \u2014 durable knowledge about THIS repository, SHARED with the whole team: the build/test/run command (especially non-default ones, e.g. a subdirectory or required env flags); where key code/config lives when non-obvious; a required setup step (e.g. an ESM-only dep must be mocked for tests); a correction to a wrong assumption; or a non-obvious gotcha and its fix. A rule about the codebase, the product, or how the TEAM works is "repo" EVEN IF the user phrases it as "I want\u2026", "always\u2026", or "going forward\u2026". A fact STILL qualifies even if it could be figured out by reading the files. ',`\u2022 "private" \u2014 a preference PRIVATE to THIS individual user about how THEY themselves want to work or be treated: tone/verbosity, what to call them, their experience level, editor/workflow habits, how the assistant should behave toward them specifically. NEVER shared with the team. ONLY for preferences about the person themselves \u2014 never about the code or the team's process. `,'Route each fact by what it is ABOUT \u2014 the WORK/team (repo) or the PERSON (private). Do NOT require the user to label something "private"; infer it. When genuinely unsure whether a stated preference is a team convention or a private one, treat it as "repo" (shared): never leak a team rule into a private memory, and never put a genuinely private preference into the shared repo set. ',"NEVER save (either set): secrets or credentials; code dumps; transient state (a test that merely passed/failed this run); one-off task details; trivia. ","NEVER bake VOLATILE SuperClawd identifiers into a fact: a workflow/skill/command/agent SLUG or id, or a tool-invocation recipe like 'call get_workflow with <slug>'. These break the moment the entity is renamed. Refer to an entity by its human NAME, or omit the identifier entirely. ","CRITICAL \u2014 the ALREADY-SAVED lists are the ONLY knowledge future sessions have. If a set is NONE it has ZERO saved knowledge (nobody knows the build command, package manager, or where the app lives), so the session's basic orientation facts are exactly what its first memories should record. Judge 'already known' only against the literal lists, never against what is 'standard'. ","Emit OPERATIONS, each tagged with its scope: ",'\u2022 {"op":"create","scope":"repo"|"private","body":"<self-contained note>"} \u2014 a genuinely NEW fact/preference not represented by any existing memory in that set. ','\u2022 {"op":"update","scope":"repo","id":"<existing repo id>","body":"<rewritten COMPLETE body>"} \u2014 the session REFINES, SHARPENS, or CORRECTS an existing REPO memory: prefer update over create whenever an existing repo memory is about the same thing (the package manager, the app location, \u2026); a correction (e.g. the app moved from apps/web to apps/app) is an UPDATE, not a new memory; also update any other repo memory that still references a now-stale fact. UPDATE applies to the repo set ONLY. ','\u2022 For the PRIVATE set, emit ONLY "create" for a genuinely new preference \u2014 never update or restate one already saved (the user curates their private memories themselves); omit (no op) any private preference already captured. ',"\u2022 Omit any fact already captured accurately (no op). ","A memory tagged [LOCKED] is read-only: never update it; you may only create a complementary fact. ","Keep each set MINIMAL and CURRENT: never leave two memories about the same thing, and never leave an outdated fact beside its correction. ",'CRITICAL \u2014 within THIS single response, every fact must end up in EXACTLY ONE memory of its set: never emit a "create" whose content is already covered by (or overlaps) a memory you keep or "update" in the same response. If the session adds a fact related to an existing memory, FOLD it into that memory with ONE "update" \u2014 do NOT also create a separate memory for the same fact. ',"This is a ONE-SHOT reconciliation of an already-finished session \u2014 do NOT continue the work, ask questions, or take any action. ",`Every op MUST include a "title": a distilled, human one-line SUMMARY of its body (<=120 chars) \u2014 a real summary, NOT the body's first words copied verbatim. `,'Respond with ONLY a strict JSON object {"ops":[ ... ],"reason":"<short overall why>"} and nothing else. Each op is {"op":"create","scope":"repo"|"private","title":"<=120-char summary","body":"..."} or {"op":"update","scope":"repo","id":"<existing id>","title":"<=120-char summary","body":"..."}. If the session taught nothing durable, return {"ops":[],"reason":"..."}.'].join(""),MC=["You maintain the durable lessons for a single reusable AGENT (a specialist invoked to do a job). You review a FINISHED run and RECONCILE what it learned about HOW TO PERFORM ITS ROLE against the lessons ALREADY SAVED (shown below with ids), keeping the set accurate, current, and non-redundant for the agent's NEXT invocation (in ANY repository). ","SAVE or UPDATE a lesson when it would make this agent do its job better next time: a standing preference or convention the user/team established for its work, a correction to how it should operate, or a recurring gotcha in its domain and how to handle it. Lessons are about the ROLE, not a codebase \u2014 they qualify regardless of which repo this run happened in. ","NEVER save: secrets or credentials; code dumps; one-off task details specific only to THIS single run; transient state; or truly trivial facts. ","NEVER record a lesson about TOOL AVAILABILITY \u2014 e.g. that a tool 'does not exist', 'is unavailable', 'is not in the toolset', or that a call failed because the tool wasn't callable. Which tools a run can call is an environment/config detail set per-invocation (this agent runs with a RESTRICTED toolset that omits tools the main session has), NOT a durable fact about the role: the tool may well exist and be available in another context, so such a lesson is misleading and goes stale. Treat a 'no such tool' / 'tool not found' error as a transient environment artifact, never a lesson. ","The ALREADY-SAVED list is the ONLY knowledge the agent carries between runs \u2014 treat anything NOT listed as new; never claim a lesson is 'already known' unless it literally appears. ","IMPORTANT \u2014 the agent runs under workspace SKILLS, instructions, and guardrails that you CANNOT see in this transcript. So: do NOT treat an asserted convention, rule, or guideline as fabricated or 'hallucinated' merely because the transcript shows no basis for it \u2014 it may come from the agent's hidden instructions. NEVER record a lesson that tells the agent to stop asserting conventions, to second-guess its guidance, or that is based on YOUR OWN judgment that the agent made a mistake this run. Capture a lesson ONLY when the run itself shows the USER establishing or correcting a standing preference, or a concrete reproducible domain gotcha the agent itself confirmed. ","Emit OPERATIONS against the existing set: ",'\u2022 "create" \u2014 a genuinely NEW lesson not represented by any existing one. ','\u2022 "update" \u2014 the run REFINES or CORRECTS an existing lesson: cite its id and rewrite its COMPLETE body. Prefer update over create whenever an existing lesson is about the same thing, even if the wording differs. ',"\u2022 Omit any lesson already captured accurately (no op). ","A lesson tagged [LOCKED] is read-only: never update it; you may only create a complementary lesson. ","Keep the set MINIMAL and CURRENT: never leave two lessons about the same thing, and never leave an outdated lesson beside its correction. ",'CRITICAL \u2014 within THIS single response, every lesson must end up exactly ONCE: never emit a "create" whose content is already covered by (or overlaps) a lesson you keep or "update" in the same response. If the run adds something related to an existing lesson, FOLD it in with ONE "update" \u2014 do NOT also create a separate lesson for the same thing. ',"This is a ONE-SHOT reconciliation of an already-finished run \u2014 do NOT continue the work, ask questions, or take any action. ",`Every op MUST include a "title": a distilled, human one-line SUMMARY of its lesson (<=120 chars) \u2014 a real summary, NOT the lesson's first words copied verbatim. `,'Respond with ONLY a strict JSON object {"ops":[ ... ],"reason":"<short overall why>"} and nothing else. Each op is {"op":"create","title":"<=120-char summary","body":"<self-contained instruction the agent can apply next time>"} or {"op":"update","id":"<existing id>","title":"<=120-char summary","body":"<rewritten complete lesson>"}. If the run taught nothing durable, return {"ops":[],"reason":"..."}.'].join(""),qg=`You are given the CONTENT of a saved memory. Return ONLY strict JSON {"title":"..."}: a concise, self-contained one-line summary of the content, MAX 120 characters, that is NOT merely the content's first words copied verbatim. Nothing else but the JSON object.`,jC=["You decide whether a code change makes a remembered lesson STALE (no longer true).",'Respond ONLY strict JSON {"verdict":"stale"|"valid","reason":"<one line>","confidence":<0..1>}.'].join(" ");import{homedir as RE}from"node:os";import{join as go}from"node:path";import{readFileSync as Ug,writeFileSync as IE,mkdirSync as OE,chmodSync as VC,existsSync as FC}from"node:fs";var HC=(process.env.SUPERCLAWD_BACKEND||"real").toLowerCase();var WC=process.env.SUPERCLAWD_MCP_API_URL||"https://mcp-api.superclawd.com",BC=process.env.SUPERCLAWD_API_URL||"https://api.superclawd.com",Vg=process.env.SUPERCLAWD_HOME||go(RE(),".superclawd"),NE=go(Vg,"sessions"),CE=go(Vg,"config.json");function AE(t){if(!t||typeof t!="object")return{};let e=t,r=e.credentials??{...typeof e.keyId=="string"?{keyId:e.keyId}:{},...typeof e.secret=="string"?{secret:e.secret}:{},...typeof e.workspace=="string"?{workspace:e.workspace}:{}},n=e.preferences??{...typeof e.skipPermissions=="boolean"?{skipPermissions:e.skipPermissions}:{},...typeof e.notifications=="boolean"?{notifications:e.notifications}:{},...typeof e.chooseWorkspaceAtStartup=="boolean"?{chooseWorkspaceAtStartup:e.chooseWorkspaceAtStartup}:{},...typeof e.experimental=="boolean"?{experimental:e.experimental}:{}},o={};return Object.keys(r).length&&(o.credentials=r),Object.keys(n).length&&(o.preferences=n),typeof e.machineId=="string"&&(o.machineId=e.machineId),o}function ZE(){try{return AE(JSON.parse(Ug(CE,"utf8")))}catch{return null}}function ME(){return ZE()?.preferences?.notifications===!0}function Fg(t){return go(NE,t)}function Hg(t){return go(t,"config.json")}function Wg(t){try{return JSON.parse(Ug(Hg(t),"utf8"))}catch{return null}}function jE(t,e){try{OE(t,{recursive:!0}),IE(Hg(t),`${JSON.stringify(e,null,2)}
|
|
76
|
-
`)}catch{}}function Bg(t){let e=t?Wg(Fg(t)):null;return e&&typeof e.notifications=="boolean"?e.notifications:ME()}function Kg(t,e){if(!t)return e;let r=Fg(t),n=Wg(r)??{};return jE(r,{...n,notifications:e}),e}var KC=1e3*60*60*24*3;var Jg=(process.env.SUPERCLAWD_PIPELINES_URL||"").replace(/\/+$/,""),DE=process.env.SUPERCLAWD_PIPELINES_TICKET||"",zt=t=>({content:[{type:"text",text:t}]}),yo=t=>zt(JSON.stringify(t,null,2)),se=t=>({isError:!0,content:[{type:"text",text:`<superclawd_error>${t}</superclawd_error>`}]});async function xe(t,e){if(!Jg)throw new Error("SUPERCLAWD_PIPELINES_URL is not set");let r=await fetch(`${Jg}${t}`,{...e,headers:{"Content-Type":"application/json",...e?.headers??{}}});if(!r.ok){let n=await r.text().catch(()=>""),o="";try{let s=JSON.parse(n);typeof s.error=="string"&&(o=s.error,typeof s.unresolved=="number"&&(o+=` (${s.unresolved} unresolved open question${s.unresolved===1?"":"s"})`))}catch{}throw new Error(o||`${e?.method??"GET"} ${t} \u2192 ${r.status}${n?`: ${n.slice(0,300)}`:""}`)}return r.status===204?void 0:await r.json()}function jt(t){return t&&t.trim()||DE||null}var Dt="No ticketId given and no ticket is bound to this session \u2014 pass a ticketId (use list_tickets to find one).";function Gg(t,e="board"){t.tool("list_boards","List the SuperClawd Pipelines boards in this workspace (a Local board plus any connected vendor boards like Linear). Use this to find a board id \u2014 e.g. the Local board to create a ticket on, or a board to list its tickets. `lastSyncedAt` shows how fresh a vendor board's data is (there is no way to sync from here).",{},async()=>{try{let n=await xe("/api/connections");return yo(n.filter(o=>o.linkStatus==="linked").map(o=>({boardId:o.id,name:o.displayName||o.providerAccountName,provider:o.provider,isLocal:o.provider==="local",workspaceId:o.workspaceId,workspaceName:o.workspaceName,ticketCount:o.ticketCount,lastSyncedAt:o.lastSyncedAt})))}catch(n){return se(String(n))}}),t.tool("list_tickets","List the tickets on a Pipelines board (by boardId from list_boards). Returns each ticket's id, identifier, title, priority and whether it's blocked \u2014 use read_ticket for the full detail. Workflow status/column is intentionally omitted.",{boardId:O.string().describe("The board id (from list_boards).")},async({boardId:n})=>{try{let o=await xe(`/api/board?connectionId=${encodeURIComponent(n)}`);return yo(o.map(({ticket:s})=>({ticketId:s.id,identifier:s.externalIdentifier,title:s.title,priority:s.priority,assignee:s.assignee?.name,blocked:!!s.blockedReason})))}catch(o){return se(String(o))}}),t.tool("read_ticket","Read a Pipelines ticket in full \u2014 description, vendor comments (the ticket's discussion, synced read-only from the provider \u2014 often where the real acceptance criteria live), additional context, plan, conclusion, open questions and notes, plus whether it's blocked (and why). For a board run you can omit ticketId to read the ticket this session is working on. Workflow status is intentionally omitted; `lastSyncedAt` shows how fresh vendor data is (no sync is possible from here).",{ticketId:O.string().optional().describe("The Pipelines ticket id. Omit on a board run to read the bound ticket.")},async({ticketId:n})=>{let o=jt(n);if(!o)return se(Dt);try{let[s,i,a,c]=await Promise.all([xe(`/api/tickets/${encodeURIComponent(o)}`),xe(`/api/tickets/${encodeURIComponent(o)}/open-questions`),xe(`/api/tickets/${encodeURIComponent(o)}/notes`),xe("/api/connections").catch(()=>[])]),u=s.ticket,l=c.find(d=>d.id===u.connectionId);return yo({ticketId:u.id,identifier:u.externalIdentifier,title:u.title,description:u.description??null,provider:u.provider,project:u.project??null,parent:u.parent??null,assignee:u.assignee?.name??null,priority:u.priority??null,labels:u.labels?.map(d=>d.name)??[],connectionName:s.connectionName,workspaceName:s.workspaceName,workingDir:u.workingDir??null,model:u.model??null,effort:u.effort??null,blocked:!!u.blockedReason,blockedReason:u.blockedReason??null,additionalContext:u.additionalContext??null,plan:u.plan??null,conclusion:u.conclusion??null,lastSyncedAt:l?.lastSyncedAt??null,openQuestions:i,comments:(u.comments??[]).map(d=>({id:d.id,author:d.author??null,body:d.body,createdAt:d.createdAt??null})),notes:a.map(d=>({id:d.id,author:d.author,body:d.body}))})}catch(s){return se(String(s))}}),t.tool("create_ticket","Create a new ticket on a workspace's LOCAL board (vendor boards are read-only from here). Omit boardId to use the workspace's Local board when there's exactly one; otherwise pass a local boardId from list_boards.",{title:O.string().describe("The ticket title (required)."),description:O.string().optional().describe("Optional description (markdown)."),boardId:O.string().optional().describe("A LOCAL board id (from list_boards). Omit to use the sole Local board.")},async({title:n,description:o,boardId:s})=>{try{let i=s;if(!i){let u=(await xe("/api/connections")).filter(l=>l.provider==="local"&&l.linkStatus==="linked");if(u.length===0)return se("No local board found in this workspace.");if(u.length>1)return se("Multiple local boards exist \u2014 pass a boardId (see list_boards).");i=u[0].id}let a=await xe(`/api/board/${encodeURIComponent(i)}/tickets`,{method:"POST",body:JSON.stringify({title:n,description:o})});return zt(`Created ${a.externalIdentifier} \u2014 "${a.title}" (ticketId ${a.id}).`)}catch(i){return se(String(i))}});let r=[{tool:"set_plan",field:"plan",label:"plan",desc:"Write (or replace) the ticket's Plan \u2014 how you'll approach the task, as markdown (it needn't be technical). Prefer this over writing a plan file in the repo."},{tool:"set_conclusion",field:"conclusion",label:"conclusion",desc:"Write (or replace) the ticket's Conclusion \u2014 a short wrap-up of what you did and any results/findings, as markdown. Write this once you've fully completed what the ticket asked."},{tool:"set_additional_context",field:"additionalContext",label:"additional context",desc:"Write (or replace) the ticket's Additional context \u2014 extra context the vendor description can't carry, as markdown."}];for(let n of r)t.tool(n.tool,n.desc+" For a board run you can omit ticketId to target the bound ticket. Pass empty markdown to clear it.",{markdown:O.string().describe(`The ${n.label} content (markdown).`),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({markdown:o,ticketId:s})=>{let i=jt(s);if(!i)return se(Dt);try{return await xe(`/api/tickets/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify({[n.field]:o})}),zt(`Saved the ${n.label} for ${i}.`)}catch(a){return se(String(a))}});t.tool("add_open_question","Add an open question to a ticket \u2014 something that needs an answer before/while working it. Use this for answerable questions; use block_ticket when you truly can't proceed. Note: if the ticket is (or becomes) blocked, every open question on it must be resolved before it can be unblocked. For a board run you can omit ticketId.",{question:O.string().describe("The question to record."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({question:n,ticketId:o})=>{let s=jt(o);if(!s)return se(Dt);try{let i=await xe(`/api/tickets/${encodeURIComponent(s)}/open-questions`,{method:"POST",body:JSON.stringify({question:n})});return zt(`Added open question (id ${i.id}).`)}catch(i){return se(String(i))}}),t.tool("update_open_question","Answer and/or resolve an existing open question (by its id, from read_ticket). Pass an answer, a resolved flag, or both.",{questionId:O.string().describe("The open question id."),answer:O.string().optional().describe("The answer text."),resolved:O.boolean().optional().describe("Mark the question resolved (true) or reopened (false).")},async({questionId:n,answer:o,resolved:s})=>{if(o===void 0&&s===void 0)return se("Pass an answer and/or a resolved flag.");try{return await xe(`/api/open-questions/${encodeURIComponent(n)}`,{method:"PATCH",body:JSON.stringify({answer:o,resolved:s})}),zt(`Updated open question ${n}.`)}catch(i){return se(String(i))}}),t.tool("add_note","Add a note to a ticket (recorded as authored by the assistant). Use for durable findings or decisions worth keeping on the ticket. For a board run you can omit ticketId.",{body:O.string().describe("The note text."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({body:n,ticketId:o})=>{let s=jt(o);if(!s)return se(Dt);try{let i=await xe(`/api/tickets/${encodeURIComponent(s)}/notes`,{method:"POST",body:JSON.stringify({body:n,author:"assistant"})});return zt(`Added note (id ${i.id}).`)}catch(i){return se(String(i))}}),t.tool("edit_note","Edit the body of an existing note (by its id, from read_ticket). Notes cannot be deleted.",{noteId:O.string().describe("The note id."),body:O.string().describe("The revised note text.")},async({noteId:n,body:o})=>{try{return await xe(`/api/notes/${encodeURIComponent(n)}`,{method:"PATCH",body:JSON.stringify({body:o})}),zt(`Edited note ${n}.`)}catch(s){return se(String(s))}}),t.tool("block_ticket","Mark a ticket as blocked with a reason \u2014 an escalation signal that you can't proceed and a human needs to look. Prefer add_open_question for questions you can still work around. If you record open questions on a blocked ticket, they must all be resolved before it can be unblocked. For a board run you can omit ticketId.",{reason:O.string().describe("Why the ticket is blocked (required)."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({reason:n,ticketId:o})=>{let s=jt(o);if(!s)return se(Dt);if(!n.trim())return se("A blocked reason is required.");try{return await xe(`/api/tickets/${encodeURIComponent(s)}`,{method:"PATCH",body:JSON.stringify({blockedReason:n})}),zt(`Blocked ${s}: ${n}`)}catch(i){return se(String(i))}}),t.tool("unblock_ticket","Clear a ticket's blocked state. Drops a note (authored by the assistant) recording why, so there's a trail. You can only unblock once EVERY open question on the ticket is resolved \u2014 answer/resolve them with update_open_question first, or this will fail. For a board run you can omit ticketId.",{reason:O.string().optional().describe("Why you're unblocking it (recorded as a note)."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({reason:n,ticketId:o})=>{let s=jt(o);if(!s)return se(Dt);try{await xe(`/api/tickets/${encodeURIComponent(s)}`,{method:"PATCH",body:JSON.stringify({blockedReason:null})});let i=`Unblocked${n&&n.trim()?`: ${n.trim()}`:"."}`;return await xe(`/api/tickets/${encodeURIComponent(s)}/notes`,{method:"POST",body:JSON.stringify({body:i,author:"assistant"})}).catch(()=>{}),zt(`Unblocked ${s}.`)}catch(i){return se(String(i))}}),t.tool("list_repos","List the git repositories available in this ticket's working directory. The working dir is often an umbrella project folder holding several repos in subfolders \u2014 use this to see what you can work on. For a board run you can omit ticketId.",{ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({ticketId:n})=>{let o=jt(n);if(!o)return se(Dt);try{let s=await xe(`/api/tickets/${encodeURIComponent(o)}/repos`);return yo(s)}catch(s){return se(String(s))}}),e==="board"&&(t.tool("start_repo_work","Claim a repo to modify \u2014 creates an isolated git worktree on a fresh branch and returns its path. You MUST make ALL changes to that repo inside the returned `worktreePath`, and commit there \u2014 NEVER edit the repo in the working directory itself (other runs may be working on it concurrently). Call once per repo you need (a task may touch several). Returns { worktreePath, branch, base, compareUrl }. When done: commit, push the branch, then record the PR with add_pr_link \u2014 if you can't open a PR (e.g. no `gh`), just push and share the compareUrl. For a board run you can omit ticketId.",{repo:O.string().optional().describe("Which repo (folder name from list_repos). Omit only if the working dir is a single repo."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({repo:n,ticketId:o})=>{let s=jt(o);if(!s)return se(Dt);try{let i=await xe(`/api/tickets/${encodeURIComponent(s)}/worktree`,{method:"POST",body:JSON.stringify({repo:n})});return yo(i)}catch(i){return se(String(i))}}),t.tool("add_pr_link","Record a pull-request link on the ticket. A ticket can have several PRs (one per repo/branch), so call this once per PR you open. If you couldn't open the PR yourself, still push the branch and (optionally) record the compare URL from start_repo_work so a human can open it. For a board run you can omit ticketId.",{url:O.string().describe("The PR (or compare) URL."),title:O.string().optional().describe("Optional short label for the PR."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({url:n,title:o,ticketId:s})=>{let i=jt(s);if(!i)return se(Dt);try{return await xe(`/api/tickets/${encodeURIComponent(i)}/pr-links`,{method:"POST",body:JSON.stringify({url:n,title:o})}),zt(`Recorded PR link on ${i}.`)}catch(a){return se(String(a))}}))}var Ve=await Dg();async function LE(t){if(process.env.SUPERCLAWD_BACKEND!=="mock")try{let r=((await Lg({system:qg,user:`CONTENT:
|
|
76
|
+
`)}catch{}}function Bg(t){let e=t?Wg(Fg(t)):null;return e&&typeof e.notifications=="boolean"?e.notifications:ME()}function Kg(t,e){if(!t)return e;let r=Fg(t),n=Wg(r)??{};return jE(r,{...n,notifications:e}),e}var KC=1e3*60*60*24*3;var Jg=(process.env.SUPERCLAWD_PIPELINES_URL||"").replace(/\/+$/,""),DE=process.env.SUPERCLAWD_PIPELINES_TICKET||"",zt=t=>({content:[{type:"text",text:t}]}),yo=t=>zt(JSON.stringify(t,null,2)),ne=t=>({isError:!0,content:[{type:"text",text:`<superclawd_error>${t}</superclawd_error>`}]});async function xe(t,e){if(!Jg)throw new Error("SUPERCLAWD_PIPELINES_URL is not set");let r=await fetch(`${Jg}${t}`,{...e,headers:{"Content-Type":"application/json",...e?.headers??{}}});if(!r.ok){let n=await r.text().catch(()=>""),o="";try{let s=JSON.parse(n);typeof s.error=="string"&&(o=s.error,typeof s.unresolved=="number"&&(o+=` (${s.unresolved} unresolved open question${s.unresolved===1?"":"s"})`))}catch{}throw new Error(o||`${e?.method??"GET"} ${t} \u2192 ${r.status}${n?`: ${n.slice(0,300)}`:""}`)}return r.status===204?void 0:await r.json()}function jt(t){return t&&t.trim()||DE||null}var Dt="No ticketId given and no ticket is bound to this session \u2014 pass a ticketId (use list_tickets to find one).";function Gg(t,e="board"){t.tool("list_boards","List the SuperClawd Pipelines boards in this workspace (a Local board plus any connected vendor boards like Linear). Use this to find a board id \u2014 e.g. the Local board to create a ticket on, or a board to list its tickets. `lastSyncedAt` shows how fresh a vendor board's data is (there is no way to sync from here).",{},async()=>{try{let n=await xe("/api/connections");return yo(n.filter(o=>o.linkStatus==="linked").map(o=>({boardId:o.id,name:o.displayName||o.providerAccountName,provider:o.provider,isLocal:o.provider==="local",workspaceId:o.workspaceId,workspaceName:o.workspaceName,ticketCount:o.ticketCount,lastSyncedAt:o.lastSyncedAt})))}catch(n){return ne(String(n))}}),t.tool("list_tickets","List the tickets on a Pipelines board (by boardId from list_boards). Returns each ticket's id, identifier, title, priority and whether it's blocked \u2014 use read_ticket for the full detail. Workflow status/column is intentionally omitted.",{boardId:O.string().describe("The board id (from list_boards).")},async({boardId:n})=>{try{let o=await xe(`/api/board?connectionId=${encodeURIComponent(n)}`);return yo(o.map(({ticket:s})=>({ticketId:s.id,identifier:s.externalIdentifier,title:s.title,priority:s.priority,assignee:s.assignee?.name,blocked:!!s.blockedReason})))}catch(o){return ne(String(o))}}),t.tool("read_ticket","Read a Pipelines ticket in full \u2014 description, vendor comments (the ticket's discussion, synced read-only from the provider \u2014 often where the real acceptance criteria live), additional context, plan, conclusion, open questions and notes, plus whether it's blocked (and why). For a board run you can omit ticketId to read the ticket this session is working on. Workflow status is intentionally omitted; `lastSyncedAt` shows how fresh vendor data is (no sync is possible from here).",{ticketId:O.string().optional().describe("The Pipelines ticket id. Omit on a board run to read the bound ticket.")},async({ticketId:n})=>{let o=jt(n);if(!o)return ne(Dt);try{let[s,i,a,c]=await Promise.all([xe(`/api/tickets/${encodeURIComponent(o)}`),xe(`/api/tickets/${encodeURIComponent(o)}/open-questions`),xe(`/api/tickets/${encodeURIComponent(o)}/notes`),xe("/api/connections").catch(()=>[])]),u=s.ticket,l=c.find(d=>d.id===u.connectionId);return yo({ticketId:u.id,identifier:u.externalIdentifier,title:u.title,description:u.description??null,provider:u.provider,project:u.project??null,parent:u.parent??null,assignee:u.assignee?.name??null,priority:u.priority??null,labels:u.labels?.map(d=>d.name)??[],connectionName:s.connectionName,workspaceName:s.workspaceName,workingDir:u.workingDir??null,model:u.model??null,effort:u.effort??null,blocked:!!u.blockedReason,blockedReason:u.blockedReason??null,additionalContext:u.additionalContext??null,plan:u.plan??null,conclusion:u.conclusion??null,lastSyncedAt:l?.lastSyncedAt??null,openQuestions:i,comments:(u.comments??[]).map(d=>({id:d.id,author:d.author??null,body:d.body,createdAt:d.createdAt??null})),notes:a.map(d=>({id:d.id,author:d.author,body:d.body}))})}catch(s){return ne(String(s))}}),t.tool("create_ticket","Create a new ticket on a workspace's LOCAL board (vendor boards are read-only from here). Omit boardId to use the workspace's Local board when there's exactly one; otherwise pass a local boardId from list_boards.",{title:O.string().describe("The ticket title (required)."),description:O.string().optional().describe("Optional description (markdown)."),boardId:O.string().optional().describe("A LOCAL board id (from list_boards). Omit to use the sole Local board.")},async({title:n,description:o,boardId:s})=>{try{let i=s;if(!i){let u=(await xe("/api/connections")).filter(l=>l.provider==="local"&&l.linkStatus==="linked");if(u.length===0)return ne("No local board found in this workspace.");if(u.length>1)return ne("Multiple local boards exist \u2014 pass a boardId (see list_boards).");i=u[0].id}let a=await xe(`/api/board/${encodeURIComponent(i)}/tickets`,{method:"POST",body:JSON.stringify({title:n,description:o})});return zt(`Created ${a.externalIdentifier} \u2014 "${a.title}" (ticketId ${a.id}).`)}catch(i){return ne(String(i))}});let r=[{tool:"set_plan",field:"plan",label:"plan",desc:"Write (or replace) the ticket's Plan \u2014 how you'll approach the task, as markdown (it needn't be technical). Prefer this over writing a plan file in the repo."},{tool:"set_conclusion",field:"conclusion",label:"conclusion",desc:"Write (or replace) the ticket's Conclusion \u2014 a short wrap-up of what you did and any results/findings, as markdown. Write this once you've fully completed what the ticket asked."},{tool:"set_additional_context",field:"additionalContext",label:"additional context",desc:"Write (or replace) the ticket's Additional context \u2014 extra context the vendor description can't carry, as markdown."}];for(let n of r)t.tool(n.tool,n.desc+` For a board run you can omit ticketId to target the bound ticket. Pass an empty ${n.field} to clear it.`,{[n.field]:O.string().optional().describe(`The ${n.label} content (markdown).`),markdown:O.string().optional().describe(`Alias for \`${n.field}\`.`),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async o=>{let s=o[n.field]??o.markdown;if(s===void 0)return ne(`Provide the ${n.label} content (\`${n.field}\`).`);let i=jt(o.ticketId);if(!i)return ne(Dt);try{return await xe(`/api/tickets/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify({[n.field]:s})}),zt(`Saved the ${n.label} for ${i}.`)}catch(a){return ne(String(a))}});t.tool("add_open_question","Add an open question to a ticket \u2014 something that needs an answer before/while working it. Use this for answerable questions; use block_ticket when you truly can't proceed. Note: if the ticket is (or becomes) blocked, every open question on it must be resolved before it can be unblocked. For a board run you can omit ticketId.",{question:O.string().describe("The question to record."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({question:n,ticketId:o})=>{let s=jt(o);if(!s)return ne(Dt);try{let i=await xe(`/api/tickets/${encodeURIComponent(s)}/open-questions`,{method:"POST",body:JSON.stringify({question:n})});return zt(`Added open question (id ${i.id}).`)}catch(i){return ne(String(i))}}),t.tool("update_open_question","Answer and/or resolve an existing open question (by its id, from read_ticket). Pass an answer, a resolved flag, or both.",{questionId:O.string().describe("The open question id."),answer:O.string().optional().describe("The answer text."),resolved:O.boolean().optional().describe("Mark the question resolved (true) or reopened (false).")},async({questionId:n,answer:o,resolved:s})=>{if(o===void 0&&s===void 0)return ne("Pass an answer and/or a resolved flag.");try{return await xe(`/api/open-questions/${encodeURIComponent(n)}`,{method:"PATCH",body:JSON.stringify({answer:o,resolved:s})}),zt(`Updated open question ${n}.`)}catch(i){return ne(String(i))}}),t.tool("add_note","Add a note to a ticket (recorded as authored by the assistant). Use for durable findings or decisions worth keeping on the ticket. For a board run you can omit ticketId.",{body:O.string().describe("The note text."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({body:n,ticketId:o})=>{let s=jt(o);if(!s)return ne(Dt);try{let i=await xe(`/api/tickets/${encodeURIComponent(s)}/notes`,{method:"POST",body:JSON.stringify({body:n,author:"assistant"})});return zt(`Added note (id ${i.id}).`)}catch(i){return ne(String(i))}}),t.tool("edit_note","Edit the body of an existing note (by its id, from read_ticket). Notes cannot be deleted.",{noteId:O.string().describe("The note id."),body:O.string().describe("The revised note text.")},async({noteId:n,body:o})=>{try{return await xe(`/api/notes/${encodeURIComponent(n)}`,{method:"PATCH",body:JSON.stringify({body:o})}),zt(`Edited note ${n}.`)}catch(s){return ne(String(s))}}),t.tool("block_ticket","Mark a ticket as blocked with a reason \u2014 an escalation signal that you can't proceed and a human needs to look. Prefer add_open_question for questions you can still work around. If you record open questions on a blocked ticket, they must all be resolved before it can be unblocked. For a board run you can omit ticketId.",{reason:O.string().describe("Why the ticket is blocked (required)."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({reason:n,ticketId:o})=>{let s=jt(o);if(!s)return ne(Dt);if(!n.trim())return ne("A blocked reason is required.");try{return await xe(`/api/tickets/${encodeURIComponent(s)}`,{method:"PATCH",body:JSON.stringify({blockedReason:n})}),zt(`Blocked ${s}: ${n}`)}catch(i){return ne(String(i))}}),t.tool("unblock_ticket","Clear a ticket's blocked state. Drops a note (authored by the assistant) recording why, so there's a trail. You can only unblock once EVERY open question on the ticket is resolved \u2014 answer/resolve them with update_open_question first, or this will fail. For a board run you can omit ticketId.",{reason:O.string().optional().describe("Why you're unblocking it (recorded as a note)."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({reason:n,ticketId:o})=>{let s=jt(o);if(!s)return ne(Dt);try{await xe(`/api/tickets/${encodeURIComponent(s)}`,{method:"PATCH",body:JSON.stringify({blockedReason:null})});let i=`Unblocked${n&&n.trim()?`: ${n.trim()}`:"."}`;return await xe(`/api/tickets/${encodeURIComponent(s)}/notes`,{method:"POST",body:JSON.stringify({body:i,author:"assistant"})}).catch(()=>{}),zt(`Unblocked ${s}.`)}catch(i){return ne(String(i))}}),t.tool("list_repos","List the git repositories available in this ticket's working directory. The working dir is often an umbrella project folder holding several repos in subfolders \u2014 use this to see what you can work on. For a board run you can omit ticketId.",{ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({ticketId:n})=>{let o=jt(n);if(!o)return ne(Dt);try{let s=await xe(`/api/tickets/${encodeURIComponent(o)}/repos`);return yo(s)}catch(s){return ne(String(s))}}),e==="board"&&(t.tool("start_repo_work","Claim a repo to modify \u2014 creates an isolated git worktree on a fresh branch and returns its path. You MUST make ALL changes to that repo inside the returned `worktreePath`, and commit there \u2014 NEVER edit the repo in the working directory itself (other runs may be working on it concurrently). Call once per repo you need (a task may touch several). Returns { worktreePath, branch, base, compareUrl }. When done: commit, push the branch, then record the PR with add_pr_link \u2014 if you can't open a PR (e.g. no `gh`), just push and share the compareUrl. For a board run you can omit ticketId.",{repo:O.string().optional().describe("Which repo (folder name from list_repos). Omit only if the working dir is a single repo."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({repo:n,ticketId:o})=>{let s=jt(o);if(!s)return ne(Dt);try{let i=await xe(`/api/tickets/${encodeURIComponent(s)}/worktree`,{method:"POST",body:JSON.stringify({repo:n})});return yo(i)}catch(i){return ne(String(i))}}),t.tool("add_pr_link","Record a pull-request link on the ticket. A ticket can have several PRs (one per repo/branch), so call this once per PR you open. If you couldn't open the PR yourself, still push the branch and (optionally) record the compare URL from start_repo_work so a human can open it. For a board run you can omit ticketId.",{url:O.string().describe("The PR (or compare) URL."),title:O.string().optional().describe("Optional short label for the PR."),ticketId:O.string().optional().describe("The ticket id; omit on a board run to use the bound one.")},async({url:n,title:o,ticketId:s})=>{let i=jt(s);if(!i)return ne(Dt);try{return await xe(`/api/tickets/${encodeURIComponent(i)}/pr-links`,{method:"POST",body:JSON.stringify({url:n,title:o})}),zt(`Recorded PR link on ${i}.`)}catch(a){return ne(String(a))}}))}var Ve=await Dg();async function LE(t){if(process.env.SUPERCLAWD_BACKEND!=="mock")try{let r=((await Lg({system:qg,user:`CONTENT:
|
|
77
77
|
${t}`,model:"haiku",timeoutMs:15e3}))?.title||"").trim();return r?r.slice(0,120):void 0}catch{return}}var Ce=new ei({name:ai,version:"0.1.0"});Ce.tool("get_directives","Fetch and apply the authoritative SuperClawd instructions for one or more skills. Call this whenever an SuperClawd skill activates, BEFORE acting, passing the skill's skillId. If several skills activate at the same time, pass them together in `skills` to fetch them in one (cheaper) call.",{skillId:O.string().optional().describe("A single activated skill's skillId."),action:O.string().optional().describe("Action context for `skillId`, e.g. code/test/review."),skills:O.array(O.object({skillId:O.string().describe("The activated skill's skillId."),action:O.string().optional().describe("Action context, e.g. code/test/review.")})).optional().describe("Batch form: multiple activated skills to fetch in a single call.")},async({skillId:t,action:e,skills:r})=>{let n=r?.length?r:t?[{skillId:t,action:e}]:[];if(n.length===0)return{isError:!0,content:[{type:"text",text:'<superclawd_error status="400">Provide a skillId, or a non-empty skills array.</superclawd_error>'}]};let o=await Ve.getDirectives(n);return o.ok?{content:[{type:"text",text:o.text??""}]}:{isError:!0,content:[{type:"text",text:`<superclawd_error status="${o.status}">${o.message}</superclawd_error>`}]}});function qE(){try{let t=JSON.parse(process.env.SUPERCLAWD_RESOURCES??"[]");return Array.isArray(t)?t:[]}catch{return[]}}var Pl=qE();function UE(){return Pl.length===0?"":`
|
|
78
78
|
|
|
79
79
|
Available resources (fetch by name when relevant to the task):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superclawd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Claude Code, supercharged — your team's standards, every session. The superclawd CLI loads your workspace's skills, agents, commands, workflows, and live directives into Claude Code as a plugin.",
|
|
5
5
|
"author": "SuperClawd <support@superclawd.com>",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|