zion-mcp 2.6.0 → 2.6.1
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/README.md +2 -2
- package/dist/{chunk-WAOG4ELA.js → chunk-MFAAEYQG.js} +1 -1
- package/dist/{chunk-7J76ZH63.js → chunk-RXVK6BCP.js} +1 -1
- package/dist/{chunk-DICYFCW5.js → chunk-YALAENOO.js} +1 -1
- package/dist/{corpus-PBJLYDY5.js → corpus-LDBEWS6F.js} +1 -1
- package/dist/{index.cjs-NUKL7GZS.js → index.cjs-4FNTQCNQ.js} +1 -1
- package/dist/{json-crdt-ZUMXFUJH.js → json-crdt-5HXJBI2R.js} +1 -1
- package/dist/{json-crdt-patch-Q72ZO4TR.js → json-crdt-patch-JBM7KIYH.js} +1 -1
- package/dist/server.js +4 -4
- package/dist/{ztype-CJ2CAID5.js → ztype-SWWJNBFU.js} +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __nodeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __nodeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as G,c as v,d as VE,e as Pt,g as d,h as g}from"./chunk-
|
|
3
|
+
import{a as G,c as v,d as VE,e as Pt,g as d,h as g}from"./chunk-MFAAEYQG.js";var Xl=v(ZE=>{d();var Cf=class extends Error{constructor(e,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=e,this.nestedError=void 0}},zE=class extends Cf{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};ZE.CommanderError=Cf;ZE.InvalidArgumentError=zE});var Rf=v(WE=>{d();var{InvalidArgumentError:LJ}=Xl(),KE=class{constructor(e,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,r){return r===this.defaultValue||!Array.isArray(r)?[e]:(r.push(e),r)}default(e,r){return this.defaultValue=e,this.defaultValueDescription=r,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new LJ(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function kJ(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}WE.Argument=KE;WE.humanReadableArgName=kJ});var YE=v(QE=>{d();var{humanReadableArgName:MJ}=Rf(),HE=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let r=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((i,a)=>i.name().localeCompare(a.name())),r}compareOptions(e,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(r))}visibleOptions(e){let r=e.options.filter(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),a=n.long&&e._findOption(n.long);!i&&!a?r.push(n):n.long&&!a?r.push(e.createOption(n.long,n.description)):n.short&&!i&&r.push(e.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let r=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(a=>!a.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(r=>{r.description=r.description||e._argsDescription[r.name()]||""}),e.registeredArguments.find(r=>r.description)?e.registeredArguments:[]}subcommandTerm(e){let r=e.registeredArguments.map(n=>MJ(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,r){return r.visibleCommands(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(i)))),0)}longestOptionTermLength(e,r){return r.visibleOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,r){return r.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(i)))),0)}longestArgumentTermLength(e,r){return r.visibleArguments(e).reduce((n,i)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(i)))),0)}commandUsage(e){let r=e._name;e._aliases[0]&&(r=r+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+r+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&r.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&r.push(`env: ${e.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let r=[];if(e.argChoices&&r.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&r.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,r,n){return r.length===0?[]:[n.styleTitle(e),...r,""]}groupItems(e,r,n){let i=new Map;return e.forEach(a=>{let o=n(a);i.has(o)||i.set(o,[])}),r.forEach(a=>{let o=n(a);i.has(o)||i.set(o,[]),i.get(o).push(a)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function a(p,f){return r.formatItem(p,n,f,r)}let o=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],s=r.commandDescription(e);s.length>0&&(o=o.concat([r.boxWrap(r.styleCommandDescription(s),i),""]));let c=r.visibleArguments(e).map(p=>a(r.styleArgumentTerm(r.argumentTerm(p)),r.styleArgumentDescription(r.argumentDescription(p))));if(o=o.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),p=>p.helpGroupHeading??"Options:").forEach((p,f)=>{let h=p.map(m=>a(r.styleOptionTerm(r.optionTerm(m)),r.styleOptionDescription(r.optionDescription(m))));o=o.concat(this.formatItemList(f,h,r))}),r.showGlobalOptions){let p=r.visibleGlobalOptions(e).map(f=>a(r.styleOptionTerm(r.optionTerm(f)),r.styleOptionDescription(r.optionDescription(f))));o=o.concat(this.formatItemList("Global Options:",p,r))}return this.groupItems(e.commands,r.visibleCommands(e),p=>p.helpGroup()||"Commands:").forEach((p,f)=>{let h=p.map(m=>a(r.styleSubcommandTerm(r.subcommandTerm(m)),r.styleSubcommandDescription(r.subcommandDescription(m))));o=o.concat(this.formatItemList(f,h,r))}),o.join(`
|
|
4
4
|
`)}displayWidth(e){return h0(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,r){return Math.max(r.longestOptionTermLength(e,r),r.longestGlobalOptionTermLength(e,r),r.longestSubcommandTermLength(e,r),r.longestArgumentTermLength(e,r))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,r,n,i){let o=" ".repeat(2);if(!n)return o+e;let s=e.padEnd(r+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-r-c-2,p;return u<this.minWidthToWrap||i.preformatted(n)?p=n:p=i.boxWrap(n,u).replace(/\n/g,`
|
|
5
5
|
`+" ".repeat(r+c)),o+s+" ".repeat(c)+p.replace(/\n/g,`
|
|
6
6
|
${o}`)}boxWrap(e,r){if(r<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,a=[];return n.forEach(o=>{let s=o.match(i);if(s===null){a.push("");return}let c=[s.shift()],l=this.displayWidth(c[0]);s.forEach(u=>{let p=this.displayWidth(u);if(l+p<=r){c.push(u),l+=p;return}a.push(c.join(""));let f=u.trimStart();c=[f],l=this.displayWidth(f)}),a.push(c.join(""))}),a.join(`
|
|
@@ -1343,7 +1343,7 @@ ${String(t)}`)}catch(e){return e}},dF=t=>{if(typeof t!="object"||t===null)throw
|
|
|
1343
1343
|
}
|
|
1344
1344
|
}
|
|
1345
1345
|
}
|
|
1346
|
-
`;d();import{randomUUID as Lme}from"crypto";var XB=Pt(AG(),1);d();var Sme=Pt(bB(),1),wme=Pt(yg(),1),Ime=Pt(Gc(),1),Ome=Pt(QI(),1),Ame=Pt(XI(),1),Nme=Pt(aO(),1),RB=Pt(Tg(),1),Pme=Pt(CB(),1);var DB=RB.default;d();var xB=100*1024*1024,Sg=class{current=Promise.resolve();async run(e){let r=this.current,n=()=>{};this.current=new Promise(i=>{n=i}),await r;try{return await e()}finally{n()}}},UB=async t=>{let e=await fetch(t);if(!e.ok)throw new Error(`Failed to download CRDT model: ${e.status} ${e.statusText}`);let r=e.body?.getReader();if(!r)throw new Error("Failed to read CRDT model response body");let n=[],i=0;for(;;){let{done:s,value:c}=await r.read();if(s)break;if(i+=c.length,i>xB)throw new Error(`CRDT model is larger than ${xB} bytes`);n.push(c)}let a=new Uint8Array(i),o=0;for(let s of n)a.set(s,o),o+=s.length;return a},Cd=async(t,e)=>{try{return await e()}catch(r){return B.warn(`Optional runtime package unavailable: ${t}`,r.message),null}},LB=null,_i=async()=>(LB??=Cd("@functorz/ztype",()=>import("./ztype-CJ2CAID5.js")).then(t=>(t?.default??t)?.com?.functorz?.ztype??null),LB),kB=null,qB=async()=>(kB??=Cd("@functorz/ztype",()=>import("./ztype-CJ2CAID5.js")).then(t=>(t?.default??t)?.kotlin?.collections??null),kB),MB=null,FB=async()=>(MB??=_i().then(t=>t?.typesystem?.schema?.SCHEMA_VERSION??null),MB),jB=null,wg=async()=>(jB??=Cd("@functorz/crdt-helper",()=>import("./index.cjs-NUKL7GZS.js")).then(t=>t?.Crdt??t?.default?.Crdt??null),jB),$B=null,GB=async()=>($B??=Cd("json-joy/lib/json-crdt-patch/index.js",()=>import("./json-crdt-patch-Q72ZO4TR.js")).then(t=>t??Cd("json-joy/lib/json-crdt/index.js",()=>import("./json-crdt-ZUMXFUJH.js"))).then(t=>t?.Patch??t?.default?.Patch??null),$B),sO=t=>t?.lastUploadedSchema??null,cO=t=>[t?.project?.lastDeployedServerSchemaExId,t?.lastDeployedServerSchemaExId,t?.project?.latestDeployedServerSchema?.exId,t?.latestDeployedServerSchema?.exId].find(r=>typeof r=="string"&&r.length>0)??null,lO=t=>t==null?t:structuredClone(t),BB=(t,e)=>t?.appExId?t.appExId:e?.name??"",VB=(t,e)=>{let r=t?.typesystem?.schema?.ClientType;if(r)return e==="WECHAT_MINI_PROGRAM"?r.WECHAT_MINI_PROGRAM??r.WECHAT??r.WEB:e==="MOBILE"?r.MOBILE??r.WEB:r.WEB},zB=t=>{let e=t?.typesystem?.schema?.Product?.[xn];if(!e)throw new Error(`ztype runtime has no Product enum member for ${xn}`);return e},Cme=t=>{try{return JSON.parse(JSON.stringify(t))}catch{return String(t)}},Ig=t=>({componentId:t?.componentId??null,message:typeof t?.getLocalizedErrorMessage=="function"?t.getLocalizedErrorMessage("EN"):t?.message??String(t),zhMessage:typeof t?.getLocalizedErrorMessage=="function"?t.getLocalizedErrorMessage("ZH"):void 0,platform:t?.platform??null,isBackendError:!!t?.isBackendError,fullPath:Cme(t?.fullPath??[])}),Og=t=>t.stableErrors.concat(t.betaErrors).filter(e=>!!e.isBackendError),ZB=t=>Og(t).length,KB=(t,e)=>{if(e.__typename==="DiffItem"){let r=e.pathComponents?.at(-1)?.key??"";if(e.operation==="delete"){delete t[r];return}t[r]=structuredClone(e.newValue);return}if(e.__typename==="ArrayDiffItem"){let r=e.pathComponents?.at(-1)?.index??-1;if(!Array.isArray(t)||r<0)throw new Error("Invalid array diff target");if(e.operation==="delete"){t.splice(r,1);return}if(e.operation==="insert"){t.splice(r,0,structuredClone(e.newValue));return}t[r]=structuredClone(e.newValue)}};d();var HB=Pt(lu(),1);import{createRequire as Rme}from"module";import{fileURLToPath as Dme}from"url";import WB from"path";var QB=Rme(import.meta.url),Hi=typeof g>"u"?void 0:g,YB=()=>{if(Hi)return{version:Hi.agent};try{let t=WB.resolve(WB.dirname(Dme(import.meta.url)),"../../package.json");return QB(t)}catch{return{}}},uO=()=>YB().version??"0.0.0",Ag=t=>{if(Hi){if(t==="@functorz/ztype")return Hi.ztype;if(t==="@functorz/crdt-helper")return Hi.crdtHelper;if(t==="json-joy")return Hi.jsonJoy}try{return QB(`${t}/package.json`).version??"unknown"}catch{return"unavailable"}},xme=async()=>{if(Hi)return{ztypeVersion:Hi.ztype,ztypeSchemaVersion:Hi.ztypeSchemaVersion};try{let t=await _i();return{ztypeVersion:t?.ZTypeSystem?.getZTypeVersion?.()??Ag("@functorz/ztype"),ztypeSchemaVersion:t?.ZTypeSystem?.getSchemaVersion?.()??"unknown"}}catch{return{ztypeVersion:Ag("@functorz/ztype"),ztypeSchemaVersion:"unavailable"}}};async function dO(){let t=YB(),e=await xme();return{agentVersion:t.version??"0.0.0",nodeMajor:process.versions.node.split(".")[0],platform:process.platform,arch:process.arch,ztypeVersion:e.ztypeVersion,ztypeSchemaVersion:e.ztypeSchemaVersion,crdtHelperVersion:Ag("@functorz/crdt-helper"),jsonJoyVersion:Ag("json-joy")}}async function Wc(t,e){let[r,n,i]=await Promise.all([dO(),mi(t),t.loadCredentials()]),a=i?HB.default.decode(i.access_token):null,o=typeof a=="object"&&a!==null?String(a.sub??a.exId??a.id??"authenticated"):"anonymous";return{...r,product:Xe,apiBaseUrl:n.apiBaseUrl,authUserId:o,workspaceRoot:t.getWorkspaceRoot(),typeSystemMode:Ys(),startupFlags:[...e].sort()}}function JB(t,e){return JSON.stringify(t)===JSON.stringify(e)}var pO=Lme(),eV=`${Xe}/${uO()}`,kme=t=>{if(!t)return t;if(Array.isArray(t))return t.map(([r,n])=>[r,String(r).toLowerCase()==="authorization"?"Bearer <redacted>":n]);if(typeof t=="object"&&"forEach"in t&&typeof t.forEach=="function"){let r={};return t.forEach((n,i)=>{r[i]=i.toLowerCase()==="authorization"?"Bearer <redacted>":String(n)}),r}let e={};for(let[r,n]of Object.entries(t))e[r]=r.toLowerCase()==="authorization"?"Bearer <redacted>":String(n);return e};function fO(t){if(!Array.isArray(t)||t.length===0)return null;let e=t.map(r=>{let n=r,i=typeof n.operation=="string"?n.operation:null,a=typeof n.errorType=="string"?n.errorType:typeof n.extensions?.classification=="string"?n.extensions.classification:null,o=typeof n.message=="string"?n.message:null;return!o&&!i&&!a?null:`${i?`${i}: `:""}${o??"GraphQL error"}${a?` (${a})`:""}`}).filter(r=>!!r);return e.length>0?e.join("; "):null}var Mme=t=>{if(typeof t=="string")return t;if(t instanceof Uint8Array)return Buffer.from(t).toString("utf8");try{return String(t)}catch{return"<unserializable body>"}},Hc=async(t,e)=>{let r=fh();B.debug(`[HTTP] Request URL: ${t.toString()}`),e?.headers&&B.debug(`[HTTP] Request Headers: ${JSON.stringify(kme(e.headers))}`),r&&e?.body!=null&&B.debug(`[GQL] Request Body: ${Mme(e.body)}`);let n=await fetch(t,e),i=null;try{i=await n.clone().text()}catch(a){B.debug(`[GQL] Response read failed: ${String(a)}`)}if(r&&B.debug(`[GQL] Response ${n.status}: ${i??"<read failed>"}`),i&&i.includes('"errors"')){let a=null;try{a=JSON.parse(i).errors}catch{a=null}let o=fO(a);o&&B.warn(`[GQL] ${n.status} errors: ${o}`)}return n};async function hO(t,e){let r=await t.getValidToken(),n=await mi(e),i={Authorization:`Bearer ${r}`,"User-Locale":"en_US","X-SESSION-ID":pO,"X-Client":eV},a=await FB();return a&&(i["X-ZED-VERSION"]=a),process.env.REACT_APP_VERSION&&(i["X-REACT-APP-VERSION"]=process.env.REACT_APP_VERSION),new Yt(`${n.apiBaseUrl}/api/graphql`,{headers:i,fetch:Hc})}async function tV(t,e){let r=await t.getValidToken(),i=`${(await mi(e)).apiBaseUrl.replace(/^http:/,"ws:").replace(/^https:/,"wss:")}/api/graphql-subscription`;return async(a,o,s)=>{let c=fh(),l={authToken:r,"X-SESSION-ID":pO,"X-Client":eV};B.debug(`[SUB] connecting ${i} params=${JSON.stringify({...l,authToken:"Bearer <redacted>"})}`);let u=new XB.SubscriptionClient(i,{lazy:!0,reconnect:!0,minTimeout:3e3,connectionParams:l},DB);u.onConnected(()=>B.debug("[SUB] connected")),u.onReconnected(()=>B.debug("[SUB] reconnected")),u.onDisconnected(()=>B.debug("[SUB] disconnected")),u.onError(h=>B.debug(`[SUB] error ${h?.message??String(h)}`));let f=[{name:"onNewCrdtPatchV2",query:VF,variables:{projectExId:a.projectExId,appExId:a.appExId??null,versionExId:a.appVersionExId??null,latestPatchExIdInClient:o}},{name:"onSchemaUploadV3",query:zF,variables:{projectExId:a.projectExId,appExId:a.appExId??null,appVersionExId:a.appVersionExId??null}}].map(h=>(B.debug(`[SUB] subscribe ${h.name} vars=${JSON.stringify(h.variables)}`),u.request({query:h.query,variables:h.variables}).subscribe({next:m=>{c&&B.debug(`[SUB] ${h.name} event: ${JSON.stringify(m)}`),s()},error:m=>{B.warn("Schema subscription event failed",String(m)),s()}})));return{unsubscribe(){for(let h of f)h.unsubscribe();u.close(!1,!1)}}}}async function Ng(t,e){if(e.projectExId)return await t.saveProjectContext(e.projectExId),e.projectExId;let r=await t.loadProjectContext();if(!r?.projectExId)throw new Error("No projectExId provided and no current project is set");return r.projectExId}async function mO(t,e,r,n){try{await t.request(s1,{projectExId:e,client:Xe,clientVersion:uO(),sessionId:n??pO,agent:r??null}),B.debug(`[agent-session] started for project ${e}`)}catch(i){B.debug(`[agent-session] skipped: ${String(i)}`)}}d();d();d();import{createHash as jme}from"crypto";var $me=t=>!!(t&&typeof t=="object"&&!Array.isArray(t)),gO=t=>{if(Array.isArray(t))return t.map(r=>r===void 0?null:gO(r));if(!$me(t))return t;let e={};for(let r of Object.keys(t).sort()){let n=t[r];n!==void 0&&(e[r]=gO(n))}return e},Ume=t=>JSON.stringify(gO(t)),qme=t=>jme("sha256").update(Ume(t)).digest("hex"),rV=t=>({projectExId:t.projectExId,appExId:t.appExId??null,appVersionExId:t.appVersionExId??null,schemaExId:t.schemaExId??null,lastPatchExId:t.lastPatchExId??null,snapshotHash:qme(t.snapshot),deployedSchemaExId:t.deployedSchemaExId??null,checkedAt:t.checkedAt??new Date().toISOString()}),nV=(t,e)=>!t||!e?t!==e:t.schemaExId!==e.schemaExId||t.lastPatchExId!==e.lastPatchExId||t.snapshotHash!==e.snapshotHash||t.deployedSchemaExId!==e.deployedSchemaExId,Pg=t=>t.changes.length>0;var iV=null,Fme=()=>(iV??=_i().then(t=>{let e=t?.typesystem?.schema?.diff?.computeSemanticSchemaChanges;return typeof e=="function"?e:null}),iV),yO=async(t,e)=>{let r=await Fme();return r?r(t,e):{changes:[]}};d();var Gme="Functorz";function aV(t,e,r,n){let i=t?.typesystem?.settings,a=t?.typesystem?.schema,o=t?.api?.ZTypeCoreApi,s=e?.KtList,c=e?.KtMap;if(!i?.ExtraContext||!a?.CustomChatModelDescriptor||!o||!s||!c)return null;try{let{ExtraContext:l,AIModelDescriptors:u,ActionFlowTemplateCodeDescriptor:p}=i,{CustomChatModelDescriptor:f,CustomEmbeddingModelDescriptor:h,ModelCustomParamDescriptor:m,CustomModelParam:_,CustomChatCompletionFeatures:E,Identifier:T,MediaOutputCardinality:b,Variable:S}=a,I=D=>c.fromJsMap(new Map(Object.entries(D??{}))),O=D=>typeof D=="string"?D==="single"?b.SINGLE:D==="multiple"?b.MULTIPLE:b.NONE:typeof D=="boolean"&&D?b.MULTIPLE:b.NONE,C=D=>new m(D.name,I(D.displayName),D.type,I(D.description)),M=D=>new _(C(D.serverUrl),C(D.apiToken),s.fromJsArray((D.extensionParams??[]).map(Ae=>new m(Ae.name,I(Ae.displayName),Ae.type,I(Ae.displayName))))),R=D=>D.provider===Gme&&D.customModelIdentifier?new T(D.customModelIdentifier.id,D.customModelIdentifier.namespace):null,ie=D=>c.fromJsMap(new Map((D??[]).filter(Ae=>Ae!=null).map(Ae=>[Ae.name,new S(Ae.type,null,!Ae.required,null,null,null,null,Ae.defaultValue==null?null:o.parseDataBindingFromJsObject(Ae.defaultValue))]))),ge=(r?.chatModelDescriptors??[]).map(D=>new f(D.provider,D.name,M(D.paramToConfigure),D.delisted,new E(D.features.streamResponse,D.features.multiModal,D.features.imageInput??!1,!1,D.features.videoInput??!1,D.features.imageMessageInput??!1,!1,D.features.videoMessageInput??!1,D.features.tools,D.features.reasoningContent,D.features.imageOutput,D.features.videoOutput,O(D.features.imageOutput),O(D.features.videoOutput),null,D.features.structuredOutput),R(D))),qe=(r?.embeddingModelDescriptors??[]).map(D=>new h(D.provider,D.name,M(D.paramToConfigure),R(D),D.delisted)),A=c.fromJsMap(new Map((n??[]).map(D=>[D.exId,new p(D.exId,D.async,ie(D.inputType),ie(D.outputType))])));return new l(new u(s.fromJsArray(ge),s.fromJsArray(qe)),A)}catch{return null}}d();var Yo=class extends Error{constructor(r,n){super(r);this.diagnostics=n;this.name="ZtypeValidationError"}};d();function Cg(t,e,r){let n=VB(t,r?.appType);return t.api.ZTypeCoreApi.genZTypeApiContext(e,zB(t),n,BB(r,n),t?.utils?.Locale?.EN,null)}d();var oV={QUERY:"query",MUTATION:"mutation"},sV={SUCCESS:"2xx",PERMANENT_FAIL:"4xx",TEMPORARY_FAIL:"5xx"};function cV(t){let e=r=>{if(Array.isArray(r))return r.map(e);if(r&&typeof r=="object"){let n={};for(let[i,a]of Object.entries(r))i==="operation"&&typeof a=="string"&&oV[a]!==void 0?n[i]=oV[a]:i==="responseBranch"&&typeof a=="string"&&sV[a]!==void 0?n[i]=sV[a]:n[i]=e(a);return n}return r};return t.map(e)}function lV(t){let e=r=>typeof r=="string"&&!r.startsWith("http://")&&!r.startsWith("https://");for(let r of t){let n=r;if(!n?.args||typeof n.args!="object")continue;let i=n.args,a=[];if(n.name==="UPDATE_TPA_CONFIG")a.push(i.url);else if(n.name==="ADD_TPA_CONFIGS"&&Array.isArray(i.items))for(let o of i.items)o&&typeof o=="object"&&a.push(o.url);for(let o of a)if(e(o))return`url "${o}" is not an absolute URL. A TPA config url must include the scheme and host (e.g. https://api.example.com/v1/resource) \u2014 find the API's base URL in its documentation.`}return null}d();var Vn=t=>t==null,Bme=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),uV=t=>{if(Bme(t)){if(!Vn(t.id))return{key:"id",value:t.id};if(!Vn(t.uniqueId))return{key:"uniqueId",value:t.uniqueId};if(!Vn(t.mRef))return{key:"mRef",value:t.mRef}}},_O=(t,e)=>{if(Vn(t)&&Vn(e)||t===e)return!0;if(Vn(t)||Vn(e)||typeof t!="object"||typeof e!="object")return!1;let r=t,n=e,i=new Set([...Object.keys(r),...Object.keys(n)]);for(let a of i)if(!_O(r[a],n[a]))return!1;return!0},dV=t=>{if(t.__typename==="DiffItem")switch(t.operation){case"add":return{__typename:"DiffItem",oldValue:t.newValue,newValue:null,operation:"delete",pathComponents:t.pathComponents};case"delete":return{__typename:"DiffItem",oldValue:null,newValue:t.oldValue,operation:"add",pathComponents:t.pathComponents};case"update":return{__typename:"DiffItem",oldValue:t.newValue,newValue:t.oldValue,operation:"update",pathComponents:t.pathComponents}}else switch(t.operation){case"insert":return{__typename:"ArrayDiffItem",oldValue:t.newValue,newValue:null,previousValue:t.previousValue,nextValue:t.nextValue,operation:"delete",pathComponents:t.pathComponents};case"delete":return{__typename:"ArrayDiffItem",oldValue:null,newValue:t.oldValue,previousValue:t.previousValue,nextValue:t.nextValue,operation:"insert",pathComponents:t.pathComponents};case"update":return{__typename:"ArrayDiffItem",oldValue:t.newValue,newValue:t.oldValue,operation:"update",pathComponents:t.pathComponents}}throw new Error(`Cannot reverse diff item: ${JSON.stringify(t)}`)},Vme=t=>t.key??t.index??"",zme=(t,e)=>{let r=t;for(let n of e){if(r===null||typeof r!="object")return;r=r[n]}return r},Zme=(t,e)=>{if(e.__typename!=="DiffItem")return null;let r=e.pathComponents.at(-1)?.key;if(r===void 0)return null;let n=uV(t[r]),i=n===void 0?_O(t[r],e.oldValue):n.value===e.oldValue?.[n.key];switch(e.operation){case"add":t[r]=e.newValue;break;case"update":if(!i)return null;t[r]=e.newValue;break;case"delete":if(!Object.prototype.hasOwnProperty.call(t,r)||!i)return null;delete t[r];break;default:return null}return e},Kme=(t,e)=>{if(e.__typename!=="ArrayDiffItem")return null;let r=e.pathComponents.at(-1)?.index;if(r===void 0||r>t.length)return null;let n=()=>{let i=uV(t[r]);return i===void 0?_O(t[r],e.oldValue):i.value===e.oldValue?.[i.key]};switch(e.operation){case"insert":t.splice(r,0,e.newValue);break;case"delete":if(!n())return null;t.splice(r,1);break;case"update":if(!n())return null;t.splice(r,1,e.newValue);break;default:return null}return e},pV=(t,e)=>{let r=t,n=new WeakSet,i=o=>{if(r===null||typeof r!="object")return r;n.has(r)||(r=Array.isArray(r)?[...r]:{...r},n.add(r));let s=r;for(let c of o){let l=s[c];if(l!==null&&typeof l=="object"){if(!n.has(l)){let u=Array.isArray(l)?[...l]:{...l};n.add(u),s[c]=u}s=s[c]}else s=l}return s},a=[];for(let o of e)try{let c=o.pathComponents.map(Vme).slice(0,-1);if(Vn(zme(r,c)))continue;let l=i(c);if(Array.isArray(l)){let u=Kme(l,o);u&&a.push(u)}else if(l!==null&&typeof l=="object"){let u=Zme(l,o);u&&a.push(u)}}catch{continue}return a};d();var Wme=3e4,Rg=class{constructor(e){this.options=e}timer=null;subscriptionHandle=null;running=!1;isActive(){return this.timer!==null||this.subscriptionHandle!==null}start(){this.timer||this.subscriptionHandle||!this.options.subscriptionFactory||this.options.subscriptionFactory(this.options.sessionKey,this.options.getLastPatchExId(),()=>{this.run()}).then(e=>{this.subscriptionHandle=e}).catch(e=>{B.warn("Schema subscription failed; falling back to polling",e.message)}).finally(()=>{this.schedulePoll()})}dispose(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.subscriptionHandle?.unsubscribe(),this.subscriptionHandle=null}schedulePoll(){!this.options.subscriptionFactory||this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.run().finally(()=>this.schedulePoll())},Wme),this.timer.unref())}async run(){if(!this.running){this.running=!0;try{await this.options.refresh()}finally{this.running=!1}}}};d();d();var y={};VE(y,{BRAND:()=>vge,DIRTY:()=>Jo,EMPTY_PATH:()=>Jme,INVALID:()=>oe,NEVER:()=>nye,OK:()=>gr,ParseStatus:()=>tr,Schema:()=>ve,ZodAny:()=>ja,ZodArray:()=>Xi,ZodBigInt:()=>es,ZodBoolean:()=>ts,ZodBranded:()=>Dd,ZodCatch:()=>ps,ZodDate:()=>rs,ZodDefault:()=>ds,ZodDiscriminatedUnion:()=>Lg,ZodEffects:()=>bn,ZodEnum:()=>ls,ZodError:()=>Mr,ZodFirstPartyTypeKind:()=>k,ZodFunction:()=>Mg,ZodIntersection:()=>os,ZodIssueCode:()=>L,ZodLazy:()=>ss,ZodLiteral:()=>cs,ZodMap:()=>tl,ZodNaN:()=>nl,ZodNativeEnum:()=>us,ZodNever:()=>zn,ZodNull:()=>is,ZodNullable:()=>Ti,ZodNumber:()=>Xo,ZodObject:()=>$r,ZodOptional:()=>jr,ZodParsedType:()=>F,ZodPipeline:()=>xd,ZodPromise:()=>$a,ZodReadonly:()=>fs,ZodRecord:()=>kg,ZodSchema:()=>ve,ZodSet:()=>rl,ZodString:()=>Ma,ZodSymbol:()=>Xc,ZodTransformer:()=>bn,ZodTuple:()=>vi,ZodType:()=>ve,ZodUndefined:()=>ns,ZodUnion:()=>as,ZodUnknown:()=>Ji,ZodVoid:()=>el,addIssueToContext:()=>q,any:()=>Pge,array:()=>xge,bigint:()=>wge,boolean:()=>SV,coerce:()=>rye,custom:()=>vV,date:()=>Ige,datetimeRegex:()=>_V,defaultErrorMap:()=>Qi,discriminatedUnion:()=>Mge,effect:()=>Wge,enum:()=>zge,function:()=>Gge,getErrorMap:()=>Qc,getParsedType:()=>Ei,instanceof:()=>bge,intersection:()=>jge,isAborted:()=>Dg,isAsync:()=>Yc,isDirty:()=>xg,isValid:()=>ka,late:()=>Tge,lazy:()=>Bge,literal:()=>Vge,makeIssue:()=>Rd,map:()=>qge,nan:()=>Sge,nativeEnum:()=>Zge,never:()=>Rge,null:()=>Nge,nullable:()=>Qge,number:()=>bV,object:()=>bO,objectUtil:()=>EO,oboolean:()=>tye,onumber:()=>eye,optional:()=>Hge,ostring:()=>Xge,pipeline:()=>Jge,preprocess:()=>Yge,promise:()=>Kge,quotelessJson:()=>Hme,record:()=>Uge,set:()=>Fge,setErrorMap:()=>Yme,strictObject:()=>Lge,string:()=>TV,symbol:()=>Oge,transformer:()=>Wge,tuple:()=>$ge,undefined:()=>Age,union:()=>kge,unknown:()=>Cge,util:()=>Ie,void:()=>Dge});d();d();d();d();d();var Ie;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Ie||(Ie={}));var EO;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(EO||(EO={}));var F=Ie.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ei=t=>{switch(typeof t){case"undefined":return F.undefined;case"string":return F.string;case"number":return Number.isNaN(t)?F.nan:F.number;case"boolean":return F.boolean;case"function":return F.function;case"bigint":return F.bigint;case"symbol":return F.symbol;case"object":return Array.isArray(t)?F.array:t===null?F.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?F.promise:typeof Map<"u"&&t instanceof Map?F.map:typeof Set<"u"&&t instanceof Set?F.set:typeof Date<"u"&&t instanceof Date?F.date:F.object;default:return F.unknown}};var L=Ie.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"]),Hme=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Mr=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(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return i(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,Ie.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Mr.create=t=>new Mr(t);var Qme=(t,e)=>{let r;switch(t.code){case L.invalid_type:t.received===F.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case L.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ie.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ie.joinValues(t.keys,", ")}`;break;case L.invalid_union:r="Invalid input";break;case L.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ie.joinValues(t.options)}`;break;case L.invalid_enum_value:r=`Invalid enum value. Expected ${Ie.joinValues(t.options)}, received '${t.received}'`;break;case L.invalid_arguments:r="Invalid function arguments";break;case L.invalid_return_type:r="Invalid function return type";break;case L.invalid_date:r="Invalid date";break;case L.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}"`:Ie.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case L.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 L.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 L.custom:r="Invalid input";break;case L.invalid_intersection_types:r="Intersection results could not be merged";break;case L.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case L.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ie.assertNever(t)}return{message:r}},Qi=Qme;var fV=Qi;function Yme(t){fV=t}function Qc(){return fV}d();var Rd=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)s=l(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}},Jme=[];function q(t,e){let r=Qc(),n=Rd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Qi?void 0:Qi].filter(i=>!!i)});t.common.issues.push(n)}var tr=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 i of r){if(i.status==="aborted")return oe;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return oe;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},oe=Object.freeze({status:"aborted"}),Jo=t=>({status:"dirty",value:t}),gr=t=>({status:"valid",value:t}),Dg=t=>t.status==="aborted",xg=t=>t.status==="dirty",ka=t=>t.status==="valid",Yc=t=>typeof Promise<"u"&&t instanceof Promise;d();d();var Q;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Q||(Q={}));var Tn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},hV=(t,e)=>{if(ka(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 Mr(t.common.issues);return this._error=r,this._error}}};function me(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=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:i}:{errorMap:(o,s)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:i}}var ve=class{get description(){return this._def.description}_getType(e){return Ei(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ei(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tr,ctx:{common:e.parent.common,data:e.data,parsedType:Ei(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Yc(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:Ei(e)},i=this._parseSync({data:e,path:n.path,parent:n});return hV(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ei(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return ka(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=>ka(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:Ei(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(Yc(i)?i:Promise.resolve(i));return hV(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:L.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new bn({schema:this,typeName:k.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 jr.create(this,this._def)}nullable(){return Ti.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xi.create(this)}promise(){return $a.create(this,this._def)}or(e){return as.create([this,e],this._def)}and(e){return os.create(this,e,this._def)}transform(e){return new bn({...me(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ds({...me(this._def),innerType:this,defaultValue:r,typeName:k.ZodDefault})}brand(){return new Dd({typeName:k.ZodBranded,type:this,...me(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ps({...me(this._def),innerType:this,catchValue:r,typeName:k.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return xd.create(this,e)}readonly(){return fs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xme=/^c[^\s-]{8,}$/i,ege=/^[0-9a-z]+$/,tge=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rge=/^[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,nge=/^[a-z0-9_-]{21}$/i,ige=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,age=/^[-+]?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)?)??$/,oge=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sge="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",vO,cge=/^(?:(?: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])$/,lge=/^(?:(?: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])$/,uge=/^(([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]))$/,dge=/^(([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])$/,pge=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fge=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gV="((\\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])))",hge=new RegExp(`^${gV}$`);function yV(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 mge(t){return new RegExp(`^${yV(t)}$`)}function _V(t){let e=`${gV}T${yV(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 gge(t,e){return!!((e==="v4"||!e)&&cge.test(t)||(e==="v6"||!e)&&uge.test(t))}function yge(t,e){if(!ige.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,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function _ge(t,e){return!!((e==="v4"||!e)&&lge.test(t)||(e==="v6"||!e)&&dge.test(t))}var Ma=class t extends ve{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==F.string){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:F.string,received:a.parsedType}),oe}let n=new tr,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?q(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&q(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")oge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"email",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")vO||(vO=new RegExp(sge,"u")),vO.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"emoji",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")rge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"uuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")nge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"nanoid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Xme.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ege.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid2",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")tge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ulid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),q(i,{validation:"url",code:L.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"regex",code:L.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?_V(a).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?hge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?mge(a).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?age.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"duration",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?gge(e.data,a.version)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ip",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?yge(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"jwt",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?_ge(e.data,a.version)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cidr",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?pge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"base64",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?fge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"base64url",code:L.invalid_string,message:a.message}),n.dirty()):Ie.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:L.invalid_string,...Q.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Q.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Q.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Q.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Q.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Q.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Q.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,...Q.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,...Q.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Q.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Q.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Q.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Q.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Q.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Q.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Q.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Q.errToObj(r)})}nonempty(e){return this.min(1,Q.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}};Ma.create=t=>new Ma({checks:[],typeName:k.ZodString,coerce:t?.coerce??!1,...me(t)});function Ege(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var Xo=class t extends ve{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)!==F.number){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:F.number,received:a.parsedType}),oe}let n,i=new tr;for(let a of this._def.checks)a.kind==="int"?Ie.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),q(n,{code:L.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?Ege(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_finite,message:a.message}),i.dirty()):Ie.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.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"&&Ie.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)}};Xo.create=t=>new Xo({checks:[],typeName:k.ZodNumber,coerce:t?.coerce||!1,...me(t)});var es=class t extends ve{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)!==F.bigint)return this._getInvalidInput(e);let n,i=new tr;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Ie.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return q(r,{code:L.invalid_type,expected:F.bigint,received:r.parsedType}),oe}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_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:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.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}};es.create=t=>new es({checks:[],typeName:k.ZodBigInt,coerce:t?.coerce??!1,...me(t)});var ts=class extends ve{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==F.boolean){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.boolean,received:n.parsedType}),oe}return gr(e.data)}};ts.create=t=>new ts({typeName:k.ZodBoolean,coerce:t?.coerce||!1,...me(t)});var rs=class t extends ve{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==F.date){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:F.date,received:a.parsedType}),oe}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_date}),oe}let n=new tr,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ie.assertNever(a);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:Q.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Q.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}};rs.create=t=>new rs({checks:[],coerce:t?.coerce||!1,typeName:k.ZodDate,...me(t)});var Xc=class extends ve{_parse(e){if(this._getType(e)!==F.symbol){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.symbol,received:n.parsedType}),oe}return gr(e.data)}};Xc.create=t=>new Xc({typeName:k.ZodSymbol,...me(t)});var ns=class extends ve{_parse(e){if(this._getType(e)!==F.undefined){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.undefined,received:n.parsedType}),oe}return gr(e.data)}};ns.create=t=>new ns({typeName:k.ZodUndefined,...me(t)});var is=class extends ve{_parse(e){if(this._getType(e)!==F.null){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.null,received:n.parsedType}),oe}return gr(e.data)}};is.create=t=>new is({typeName:k.ZodNull,...me(t)});var ja=class extends ve{constructor(){super(...arguments),this._any=!0}_parse(e){return gr(e.data)}};ja.create=t=>new ja({typeName:k.ZodAny,...me(t)});var Ji=class extends ve{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gr(e.data)}};Ji.create=t=>new Ji({typeName:k.ZodUnknown,...me(t)});var zn=class extends ve{_parse(e){let r=this._getOrReturnCtx(e);return q(r,{code:L.invalid_type,expected:F.never,received:r.parsedType}),oe}};zn.create=t=>new zn({typeName:k.ZodNever,...me(t)});var el=class extends ve{_parse(e){if(this._getType(e)!==F.undefined){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.void,received:n.parsedType}),oe}return gr(e.data)}};el.create=t=>new el({typeName:k.ZodVoid,...me(t)});var Xi=class t extends ve{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==F.array)return q(r,{code:L.invalid_type,expected:F.array,received:r.parsedType}),oe;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(q(r,{code:o?L.too_big:L.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(q(r,{code:L.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(q(r,{code:L.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new Tn(r,o,r.path,s)))).then(o=>tr.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new Tn(r,o,r.path,s)));return tr.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Q.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Q.toString(r)}})}nonempty(e){return this.min(1,e)}};Xi.create=(t,e)=>new Xi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...me(e)});function Jc(t){if(t instanceof $r){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=jr.create(Jc(n))}return new $r({...t._def,shape:()=>e})}else return t instanceof Xi?new Xi({...t._def,type:Jc(t.element)}):t instanceof jr?jr.create(Jc(t.unwrap())):t instanceof Ti?Ti.create(Jc(t.unwrap())):t instanceof vi?vi.create(t.items.map(e=>Jc(e))):t}var $r=class t extends ve{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=Ie.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==F.object){let l=this._getOrReturnCtx(e);return q(l,{code:L.invalid_type,expected:F.object,received:l.parsedType}),oe}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof zn&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||s.push(l);let c=[];for(let l of o){let u=a[l],p=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Tn(i,p,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof zn){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of s)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")s.length>0&&(q(i,{code:L.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of s){let p=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Tn(i,p,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let p=await u.key,f=await u.value;l.push({key:p,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>tr.mergeObjectSync(n,l)):tr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return Q.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(e).message??i}:{message:i}}}:{}})}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:k.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 Ie.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 Ie.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Jc(this)}partial(e){let r={};for(let n of Ie.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Ie.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof jr;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return EV(Ie.objectKeys(this.shape))}};$r.create=(t,e)=>new $r({shape:()=>t,unknownKeys:"strip",catchall:zn.create(),typeName:k.ZodObject,...me(e)});$r.strictCreate=(t,e)=>new $r({shape:()=>t,unknownKeys:"strict",catchall:zn.create(),typeName:k.ZodObject,...me(e)});$r.lazycreate=(t,e)=>new $r({shape:t,unknownKeys:"strip",catchall:zn.create(),typeName:k.ZodObject,...me(e)});var as=class extends ve{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new Mr(s.ctx.common.issues));return q(r,{code:L.invalid_union,unionErrors:o}),oe}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(c=>new Mr(c));return q(r,{code:L.invalid_union,unionErrors:s}),oe}}get options(){return this._def.options}};as.create=(t,e)=>new as({options:t,typeName:k.ZodUnion,...me(e)});var Yi=t=>t instanceof ss?Yi(t.schema):t instanceof bn?Yi(t.innerType()):t instanceof cs?[t.value]:t instanceof ls?t.options:t instanceof us?Ie.objectValues(t.enum):t instanceof ds?Yi(t._def.innerType):t instanceof ns?[void 0]:t instanceof is?[null]:t instanceof jr?[void 0,...Yi(t.unwrap())]:t instanceof Ti?[null,...Yi(t.unwrap())]:t instanceof Dd||t instanceof fs?Yi(t.unwrap()):t instanceof ps?Yi(t._def.innerType):[],Lg=class t extends ve{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==F.object)return q(r,{code:L.invalid_type,expected:F.object,received:r.parsedType}),oe;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(q(r,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=Yi(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...me(n)})}};function TO(t,e){let r=Ei(t),n=Ei(e);if(t===e)return{valid:!0,data:t};if(r===F.object&&n===F.object){let i=Ie.objectKeys(e),a=Ie.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let c=TO(t[s],e[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(r===F.array&&n===F.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],c=TO(o,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===F.date&&n===F.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var os=class extends ve{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(Dg(a)||Dg(o))return oe;let s=TO(a.value,o.value);return s.valid?((xg(a)||xg(o))&&r.dirty(),{status:r.value,value:s.data}):(q(n,{code:L.invalid_intersection_types}),oe)};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(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};os.create=(t,e,r)=>new os({left:t,right:e,typeName:k.ZodIntersection,...me(r)});var vi=class t extends ve{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==F.array)return q(n,{code:L.invalid_type,expected:F.array,received:n.parsedType}),oe;if(n.data.length<this._def.items.length)return q(n,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&n.data.length>this._def.items.length&&(q(n,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Tn(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>tr.mergeArray(r,o)):tr.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};vi.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new vi({items:t,typeName:k.ZodTuple,rest:null,...me(e)})};var kg=class t extends ve{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!==F.object)return q(n,{code:L.invalid_type,expected:F.object,received:n.parsedType}),oe;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new Tn(n,s,n.path,s)),value:o._parse(new Tn(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?tr.mergeObjectAsync(r,i):tr.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ve?new t({keyType:e,valueType:r,typeName:k.ZodRecord,...me(n)}):new t({keyType:Ma.create(),valueType:e,typeName:k.ZodRecord,...me(r)})}},tl=class extends ve{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!==F.map)return q(n,{code:L.invalid_type,expected:F.map,received:n.parsedType}),oe;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,c],l)=>({key:i._parse(new Tn(n,s,n.path,[l,"key"])),value:a._parse(new Tn(n,c,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return oe;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of o){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return oe;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}}}};tl.create=(t,e,r)=>new tl({valueType:e,keyType:t,typeName:k.ZodMap,...me(r)});var rl=class t extends ve{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==F.set)return q(n,{code:L.invalid_type,expected:F.set,received:n.parsedType}),oe;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(q(n,{code:L.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(q(n,{code:L.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(c){let l=new Set;for(let u of c){if(u.status==="aborted")return oe;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((c,l)=>a._parse(new Tn(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Q.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};rl.create=(t,e)=>new rl({valueType:t,minSize:null,maxSize:null,typeName:k.ZodSet,...me(e)});var Mg=class t extends ve{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==F.function)return q(r,{code:L.invalid_type,expected:F.function,received:r.parsedType}),oe;function n(s,c){return Rd({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qc(),Qi].filter(l=>!!l),issueData:{code:L.invalid_arguments,argumentsError:c}})}function i(s,c){return Rd({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qc(),Qi].filter(l=>!!l),issueData:{code:L.invalid_return_type,returnTypeError:c}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof $a){let s=this;return gr(async function(...c){let l=new Mr([]),u=await s._def.args.parseAsync(c,a).catch(h=>{throw l.addIssue(n(c,h)),l}),p=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(p,a).catch(h=>{throw l.addIssue(i(p,h)),l})})}else{let s=this;return gr(function(...c){let l=s._def.args.safeParse(c,a);if(!l.success)throw new Mr([n(c,l.error)]);let u=Reflect.apply(o,this,l.data),p=s._def.returns.safeParse(u,a);if(!p.success)throw new Mr([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:vi.create(e).rest(Ji.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||vi.create([]).rest(Ji.create()),returns:r||Ji.create(),typeName:k.ZodFunction,...me(n)})}},ss=class extends ve{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})}};ss.create=(t,e)=>new ss({getter:t,typeName:k.ZodLazy,...me(e)});var cs=class extends ve{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return q(r,{received:r.data,code:L.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:e.data}}get value(){return this._def.value}};cs.create=(t,e)=>new cs({value:t,typeName:k.ZodLiteral,...me(e)});function EV(t,e){return new ls({values:t,typeName:k.ZodEnum,...me(e)})}var ls=class t extends ve{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return q(r,{expected:Ie.joinValues(n),received:r.parsedType,code:L.invalid_type}),oe}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 q(r,{received:r.data,code:L.invalid_enum_value,options:n}),oe}return gr(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})}};ls.create=EV;var us=class extends ve{_parse(e){let r=Ie.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==F.string&&n.parsedType!==F.number){let i=Ie.objectValues(r);return q(n,{expected:Ie.joinValues(i),received:n.parsedType,code:L.invalid_type}),oe}if(this._cache||(this._cache=new Set(Ie.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Ie.objectValues(r);return q(n,{received:n.data,code:L.invalid_enum_value,options:i}),oe}return gr(e.data)}get enum(){return this._def.values}};us.create=(t,e)=>new us({values:t,typeName:k.ZodNativeEnum,...me(e)});var $a=class extends ve{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==F.promise&&r.common.async===!1)return q(r,{code:L.invalid_type,expected:F.promise,received:r.parsedType}),oe;let n=r.parsedType===F.promise?r.data:Promise.resolve(r.data);return gr(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$a.create=(t,e)=>new $a({type:t,typeName:k.ZodPromise,...me(e)});var bn=class extends ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{q(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return oe;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?oe:c.status==="dirty"?Jo(c.value):r.value==="dirty"?Jo(c.value):c});{if(r.value==="aborted")return oe;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?oe:s.status==="dirty"?Jo(s.value):r.value==="dirty"?Jo(s.value):s}}if(i.type==="refinement"){let o=s=>{let c=i.refinement(s,a);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 s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?oe:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?oe:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ka(o))return oe;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>ka(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):oe);Ie.assertNever(i)}};bn.create=(t,e,r)=>new bn({schema:t,typeName:k.ZodEffects,effect:e,...me(r)});bn.createWithPreprocess=(t,e,r)=>new bn({schema:e,effect:{type:"preprocess",transform:t},typeName:k.ZodEffects,...me(r)});var jr=class extends ve{_parse(e){return this._getType(e)===F.undefined?gr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};jr.create=(t,e)=>new jr({innerType:t,typeName:k.ZodOptional,...me(e)});var Ti=class extends ve{_parse(e){return this._getType(e)===F.null?gr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ti.create=(t,e)=>new Ti({innerType:t,typeName:k.ZodNullable,...me(e)});var ds=class extends ve{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===F.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ds.create=(t,e)=>new ds({innerType:t,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...me(e)});var ps=class extends ve{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Yc(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ps.create=(t,e)=>new ps({innerType:t,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...me(e)});var nl=class extends ve{_parse(e){if(this._getType(e)!==F.nan){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.nan,received:n.parsedType}),oe}return{status:"valid",value:e.data}}};nl.create=t=>new nl({typeName:k.ZodNaN,...me(t)});var vge=Symbol("zod_brand"),Dd=class extends ve{_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}},xd=class t extends ve{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?oe:a.status==="dirty"?(r.dirty(),Jo(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?oe:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:k.ZodPipeline})}},fs=class extends ve{_parse(e){let r=this._def.innerType._parse(e),n=i=>(ka(i)&&(i.value=Object.freeze(i.value)),i);return Yc(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};fs.create=(t,e)=>new fs({innerType:t,typeName:k.ZodReadonly,...me(e)});function mV(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function vV(t,e={},r){return t?ja.create().superRefine((n,i)=>{let a=t(n);if(a instanceof Promise)return a.then(o=>{if(!o){let s=mV(e,n),c=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:c})}});if(!a){let o=mV(e,n),s=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:s})}}):ja.create()}var Tge={object:$r.lazycreate},k;(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"})(k||(k={}));var bge=(t,e={message:`Input not instance of ${t.name}`})=>vV(r=>r instanceof t,e),TV=Ma.create,bV=Xo.create,Sge=nl.create,wge=es.create,SV=ts.create,Ige=rs.create,Oge=Xc.create,Age=ns.create,Nge=is.create,Pge=ja.create,Cge=Ji.create,Rge=zn.create,Dge=el.create,xge=Xi.create,bO=$r.create,Lge=$r.strictCreate,kge=as.create,Mge=Lg.create,jge=os.create,$ge=vi.create,Uge=kg.create,qge=tl.create,Fge=rl.create,Gge=Mg.create,Bge=ss.create,Vge=cs.create,zge=ls.create,Zge=us.create,Kge=$a.create,Wge=bn.create,Hge=jr.create,Qge=Ti.create,Yge=bn.createWithPreprocess,Jge=xd.create,Xge=()=>TV().optional(),eye=()=>bV().optional(),tye=()=>SV().optional(),rye={string:(t=>Ma.create({...t,coerce:!0})),number:(t=>Xo.create({...t,coerce:!0})),boolean:(t=>ts.create({...t,coerce:!0})),bigint:(t=>es.create({...t,coerce:!0})),date:(t=>rs.create({...t,coerce:!0}))};var nye=oe;var jg=[{name:"schema_action_menu",tier:"catalog",description:"\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=GET_SELECTABLE_COMPONENT_ACTIONS \u2014 The frontend actions attachable to a component event, as the same category tree the editor's action picker shows \u2014 already filtered to this client's platform, the project's configured authentication, and what the event accepts. Each leaf carries the `eventType` it resolved to here (a leaf like SIGN_IN becomes whichever login the project configured) and the `path` to address it. Only a few of these have dedicated ADD_COMPONENT_* tools today; the rest are listed so a plan can name what the editor supports rather than guessing.",ops:{GET_SELECTABLE_COMPONENT_ACTIONS:"GET_SELECTABLE_COMPONENT_ACTIONS"},inputSchema:{componentId:y.string().optional(),displayName:y.string().optional(),eventType:y.string().optional()}},{name:"schema_actionflow",tier:"core",description:`Action flows \u2014 flow-level (addressed by actionFlowId). Discover types via op=SELECTABLE_TYPES and ids via op=GET_DETAIL. AI nodes require isAsync=true.
|
|
1346
|
+
`;d();import{randomUUID as Lme}from"crypto";var XB=Pt(AG(),1);d();var Sme=Pt(bB(),1),wme=Pt(yg(),1),Ime=Pt(Gc(),1),Ome=Pt(QI(),1),Ame=Pt(XI(),1),Nme=Pt(aO(),1),RB=Pt(Tg(),1),Pme=Pt(CB(),1);var DB=RB.default;d();var xB=100*1024*1024,Sg=class{current=Promise.resolve();async run(e){let r=this.current,n=()=>{};this.current=new Promise(i=>{n=i}),await r;try{return await e()}finally{n()}}},UB=async t=>{let e=await fetch(t);if(!e.ok)throw new Error(`Failed to download CRDT model: ${e.status} ${e.statusText}`);let r=e.body?.getReader();if(!r)throw new Error("Failed to read CRDT model response body");let n=[],i=0;for(;;){let{done:s,value:c}=await r.read();if(s)break;if(i+=c.length,i>xB)throw new Error(`CRDT model is larger than ${xB} bytes`);n.push(c)}let a=new Uint8Array(i),o=0;for(let s of n)a.set(s,o),o+=s.length;return a},Cd=async(t,e)=>{try{return await e()}catch(r){return B.warn(`Optional runtime package unavailable: ${t}`,r.message),null}},LB=null,_i=async()=>(LB??=Cd("@functorz/ztype",()=>import("./ztype-SWWJNBFU.js")).then(t=>(t?.default??t)?.com?.functorz?.ztype??null),LB),kB=null,qB=async()=>(kB??=Cd("@functorz/ztype",()=>import("./ztype-SWWJNBFU.js")).then(t=>(t?.default??t)?.kotlin?.collections??null),kB),MB=null,FB=async()=>(MB??=_i().then(t=>t?.typesystem?.schema?.SCHEMA_VERSION??null),MB),jB=null,wg=async()=>(jB??=Cd("@functorz/crdt-helper",()=>import("./index.cjs-4FNTQCNQ.js")).then(t=>t?.Crdt??t?.default?.Crdt??null),jB),$B=null,GB=async()=>($B??=Cd("json-joy/lib/json-crdt-patch/index.js",()=>import("./json-crdt-patch-JBM7KIYH.js")).then(t=>t??Cd("json-joy/lib/json-crdt/index.js",()=>import("./json-crdt-5HXJBI2R.js"))).then(t=>t?.Patch??t?.default?.Patch??null),$B),sO=t=>t?.lastUploadedSchema??null,cO=t=>[t?.project?.lastDeployedServerSchemaExId,t?.lastDeployedServerSchemaExId,t?.project?.latestDeployedServerSchema?.exId,t?.latestDeployedServerSchema?.exId].find(r=>typeof r=="string"&&r.length>0)??null,lO=t=>t==null?t:structuredClone(t),BB=(t,e)=>t?.appExId?t.appExId:e?.name??"",VB=(t,e)=>{let r=t?.typesystem?.schema?.ClientType;if(r)return e==="WECHAT_MINI_PROGRAM"?r.WECHAT_MINI_PROGRAM??r.WECHAT??r.WEB:e==="MOBILE"?r.MOBILE??r.WEB:r.WEB},zB=t=>{let e=t?.typesystem?.schema?.Product?.[xn];if(!e)throw new Error(`ztype runtime has no Product enum member for ${xn}`);return e},Cme=t=>{try{return JSON.parse(JSON.stringify(t))}catch{return String(t)}},Ig=t=>({componentId:t?.componentId??null,message:typeof t?.getLocalizedErrorMessage=="function"?t.getLocalizedErrorMessage("EN"):t?.message??String(t),zhMessage:typeof t?.getLocalizedErrorMessage=="function"?t.getLocalizedErrorMessage("ZH"):void 0,platform:t?.platform??null,isBackendError:!!t?.isBackendError,fullPath:Cme(t?.fullPath??[])}),Og=t=>t.stableErrors.concat(t.betaErrors).filter(e=>!!e.isBackendError),ZB=t=>Og(t).length,KB=(t,e)=>{if(e.__typename==="DiffItem"){let r=e.pathComponents?.at(-1)?.key??"";if(e.operation==="delete"){delete t[r];return}t[r]=structuredClone(e.newValue);return}if(e.__typename==="ArrayDiffItem"){let r=e.pathComponents?.at(-1)?.index??-1;if(!Array.isArray(t)||r<0)throw new Error("Invalid array diff target");if(e.operation==="delete"){t.splice(r,1);return}if(e.operation==="insert"){t.splice(r,0,structuredClone(e.newValue));return}t[r]=structuredClone(e.newValue)}};d();var HB=Pt(lu(),1);import{createRequire as Rme}from"module";import{fileURLToPath as Dme}from"url";import WB from"path";var QB=Rme(import.meta.url),Hi=typeof g>"u"?void 0:g,YB=()=>{if(Hi)return{version:Hi.agent};try{let t=WB.resolve(WB.dirname(Dme(import.meta.url)),"../../package.json");return QB(t)}catch{return{}}},uO=()=>YB().version??"0.0.0",Ag=t=>{if(Hi){if(t==="@functorz/ztype")return Hi.ztype;if(t==="@functorz/crdt-helper")return Hi.crdtHelper;if(t==="json-joy")return Hi.jsonJoy}try{return QB(`${t}/package.json`).version??"unknown"}catch{return"unavailable"}},xme=async()=>{if(Hi)return{ztypeVersion:Hi.ztype,ztypeSchemaVersion:Hi.ztypeSchemaVersion};try{let t=await _i();return{ztypeVersion:t?.ZTypeSystem?.getZTypeVersion?.()??Ag("@functorz/ztype"),ztypeSchemaVersion:t?.ZTypeSystem?.getSchemaVersion?.()??"unknown"}}catch{return{ztypeVersion:Ag("@functorz/ztype"),ztypeSchemaVersion:"unavailable"}}};async function dO(){let t=YB(),e=await xme();return{agentVersion:t.version??"0.0.0",nodeMajor:process.versions.node.split(".")[0],platform:process.platform,arch:process.arch,ztypeVersion:e.ztypeVersion,ztypeSchemaVersion:e.ztypeSchemaVersion,crdtHelperVersion:Ag("@functorz/crdt-helper"),jsonJoyVersion:Ag("json-joy")}}async function Wc(t,e){let[r,n,i]=await Promise.all([dO(),mi(t),t.loadCredentials()]),a=i?HB.default.decode(i.access_token):null,o=typeof a=="object"&&a!==null?String(a.sub??a.exId??a.id??"authenticated"):"anonymous";return{...r,product:Xe,apiBaseUrl:n.apiBaseUrl,authUserId:o,workspaceRoot:t.getWorkspaceRoot(),typeSystemMode:Ys(),startupFlags:[...e].sort()}}function JB(t,e){return JSON.stringify(t)===JSON.stringify(e)}var pO=Lme(),eV=`${Xe}/${uO()}`,kme=t=>{if(!t)return t;if(Array.isArray(t))return t.map(([r,n])=>[r,String(r).toLowerCase()==="authorization"?"Bearer <redacted>":n]);if(typeof t=="object"&&"forEach"in t&&typeof t.forEach=="function"){let r={};return t.forEach((n,i)=>{r[i]=i.toLowerCase()==="authorization"?"Bearer <redacted>":String(n)}),r}let e={};for(let[r,n]of Object.entries(t))e[r]=r.toLowerCase()==="authorization"?"Bearer <redacted>":String(n);return e};function fO(t){if(!Array.isArray(t)||t.length===0)return null;let e=t.map(r=>{let n=r,i=typeof n.operation=="string"?n.operation:null,a=typeof n.errorType=="string"?n.errorType:typeof n.extensions?.classification=="string"?n.extensions.classification:null,o=typeof n.message=="string"?n.message:null;return!o&&!i&&!a?null:`${i?`${i}: `:""}${o??"GraphQL error"}${a?` (${a})`:""}`}).filter(r=>!!r);return e.length>0?e.join("; "):null}var Mme=t=>{if(typeof t=="string")return t;if(t instanceof Uint8Array)return Buffer.from(t).toString("utf8");try{return String(t)}catch{return"<unserializable body>"}},Hc=async(t,e)=>{let r=fh();B.debug(`[HTTP] Request URL: ${t.toString()}`),e?.headers&&B.debug(`[HTTP] Request Headers: ${JSON.stringify(kme(e.headers))}`),r&&e?.body!=null&&B.debug(`[GQL] Request Body: ${Mme(e.body)}`);let n=await fetch(t,e),i=null;try{i=await n.clone().text()}catch(a){B.debug(`[GQL] Response read failed: ${String(a)}`)}if(r&&B.debug(`[GQL] Response ${n.status}: ${i??"<read failed>"}`),i&&i.includes('"errors"')){let a=null;try{a=JSON.parse(i).errors}catch{a=null}let o=fO(a);o&&B.warn(`[GQL] ${n.status} errors: ${o}`)}return n};async function hO(t,e){let r=await t.getValidToken(),n=await mi(e),i={Authorization:`Bearer ${r}`,"User-Locale":"en_US","X-SESSION-ID":pO,"X-Client":eV},a=await FB();return a&&(i["X-ZED-VERSION"]=a),process.env.REACT_APP_VERSION&&(i["X-REACT-APP-VERSION"]=process.env.REACT_APP_VERSION),new Yt(`${n.apiBaseUrl}/api/graphql`,{headers:i,fetch:Hc})}async function tV(t,e){let r=await t.getValidToken(),i=`${(await mi(e)).apiBaseUrl.replace(/^http:/,"ws:").replace(/^https:/,"wss:")}/api/graphql-subscription`;return async(a,o,s)=>{let c=fh(),l={authToken:r,"X-SESSION-ID":pO,"X-Client":eV};B.debug(`[SUB] connecting ${i} params=${JSON.stringify({...l,authToken:"Bearer <redacted>"})}`);let u=new XB.SubscriptionClient(i,{lazy:!0,reconnect:!0,minTimeout:3e3,connectionParams:l},DB);u.onConnected(()=>B.debug("[SUB] connected")),u.onReconnected(()=>B.debug("[SUB] reconnected")),u.onDisconnected(()=>B.debug("[SUB] disconnected")),u.onError(h=>B.debug(`[SUB] error ${h?.message??String(h)}`));let f=[{name:"onNewCrdtPatchV2",query:VF,variables:{projectExId:a.projectExId,appExId:a.appExId??null,versionExId:a.appVersionExId??null,latestPatchExIdInClient:o}},{name:"onSchemaUploadV3",query:zF,variables:{projectExId:a.projectExId,appExId:a.appExId??null,appVersionExId:a.appVersionExId??null}}].map(h=>(B.debug(`[SUB] subscribe ${h.name} vars=${JSON.stringify(h.variables)}`),u.request({query:h.query,variables:h.variables}).subscribe({next:m=>{c&&B.debug(`[SUB] ${h.name} event: ${JSON.stringify(m)}`),s()},error:m=>{B.warn("Schema subscription event failed",String(m)),s()}})));return{unsubscribe(){for(let h of f)h.unsubscribe();u.close(!1,!1)}}}}async function Ng(t,e){if(e.projectExId)return await t.saveProjectContext(e.projectExId),e.projectExId;let r=await t.loadProjectContext();if(!r?.projectExId)throw new Error("No projectExId provided and no current project is set");return r.projectExId}async function mO(t,e,r,n){try{await t.request(s1,{projectExId:e,client:Xe,clientVersion:uO(),sessionId:n??pO,agent:r??null}),B.debug(`[agent-session] started for project ${e}`)}catch(i){B.debug(`[agent-session] skipped: ${String(i)}`)}}d();d();d();import{createHash as jme}from"crypto";var $me=t=>!!(t&&typeof t=="object"&&!Array.isArray(t)),gO=t=>{if(Array.isArray(t))return t.map(r=>r===void 0?null:gO(r));if(!$me(t))return t;let e={};for(let r of Object.keys(t).sort()){let n=t[r];n!==void 0&&(e[r]=gO(n))}return e},Ume=t=>JSON.stringify(gO(t)),qme=t=>jme("sha256").update(Ume(t)).digest("hex"),rV=t=>({projectExId:t.projectExId,appExId:t.appExId??null,appVersionExId:t.appVersionExId??null,schemaExId:t.schemaExId??null,lastPatchExId:t.lastPatchExId??null,snapshotHash:qme(t.snapshot),deployedSchemaExId:t.deployedSchemaExId??null,checkedAt:t.checkedAt??new Date().toISOString()}),nV=(t,e)=>!t||!e?t!==e:t.schemaExId!==e.schemaExId||t.lastPatchExId!==e.lastPatchExId||t.snapshotHash!==e.snapshotHash||t.deployedSchemaExId!==e.deployedSchemaExId,Pg=t=>t.changes.length>0;var iV=null,Fme=()=>(iV??=_i().then(t=>{let e=t?.typesystem?.schema?.diff?.computeSemanticSchemaChanges;return typeof e=="function"?e:null}),iV),yO=async(t,e)=>{let r=await Fme();return r?r(t,e):{changes:[]}};d();var Gme="Functorz";function aV(t,e,r,n){let i=t?.typesystem?.settings,a=t?.typesystem?.schema,o=t?.api?.ZTypeCoreApi,s=e?.KtList,c=e?.KtMap;if(!i?.ExtraContext||!a?.CustomChatModelDescriptor||!o||!s||!c)return null;try{let{ExtraContext:l,AIModelDescriptors:u,ActionFlowTemplateCodeDescriptor:p}=i,{CustomChatModelDescriptor:f,CustomEmbeddingModelDescriptor:h,ModelCustomParamDescriptor:m,CustomModelParam:_,CustomChatCompletionFeatures:E,Identifier:T,MediaOutputCardinality:b,Variable:S}=a,I=D=>c.fromJsMap(new Map(Object.entries(D??{}))),O=D=>typeof D=="string"?D==="single"?b.SINGLE:D==="multiple"?b.MULTIPLE:b.NONE:typeof D=="boolean"&&D?b.MULTIPLE:b.NONE,C=D=>new m(D.name,I(D.displayName),D.type,I(D.description)),M=D=>new _(C(D.serverUrl),C(D.apiToken),s.fromJsArray((D.extensionParams??[]).map(Ae=>new m(Ae.name,I(Ae.displayName),Ae.type,I(Ae.displayName))))),R=D=>D.provider===Gme&&D.customModelIdentifier?new T(D.customModelIdentifier.id,D.customModelIdentifier.namespace):null,ie=D=>c.fromJsMap(new Map((D??[]).filter(Ae=>Ae!=null).map(Ae=>[Ae.name,new S(Ae.type,null,!Ae.required,null,null,null,null,Ae.defaultValue==null?null:o.parseDataBindingFromJsObject(Ae.defaultValue))]))),ge=(r?.chatModelDescriptors??[]).map(D=>new f(D.provider,D.name,M(D.paramToConfigure),D.delisted,new E(D.features.streamResponse,D.features.multiModal,D.features.imageInput??!1,!1,D.features.videoInput??!1,D.features.imageMessageInput??!1,!1,D.features.videoMessageInput??!1,D.features.tools,D.features.reasoningContent,D.features.imageOutput,D.features.videoOutput,O(D.features.imageOutput),O(D.features.videoOutput),null,D.features.structuredOutput),R(D))),qe=(r?.embeddingModelDescriptors??[]).map(D=>new h(D.provider,D.name,M(D.paramToConfigure),R(D),D.delisted)),A=c.fromJsMap(new Map((n??[]).map(D=>[D.exId,new p(D.exId,D.async,ie(D.inputType),ie(D.outputType))])));return new l(new u(s.fromJsArray(ge),s.fromJsArray(qe)),A)}catch{return null}}d();var Yo=class extends Error{constructor(r,n){super(r);this.diagnostics=n;this.name="ZtypeValidationError"}};d();function Cg(t,e,r){let n=VB(t,r?.appType);return t.api.ZTypeCoreApi.genZTypeApiContext(e,zB(t),n,BB(r,n),t?.utils?.Locale?.EN,null)}d();var oV={QUERY:"query",MUTATION:"mutation"},sV={SUCCESS:"2xx",PERMANENT_FAIL:"4xx",TEMPORARY_FAIL:"5xx"};function cV(t){let e=r=>{if(Array.isArray(r))return r.map(e);if(r&&typeof r=="object"){let n={};for(let[i,a]of Object.entries(r))i==="operation"&&typeof a=="string"&&oV[a]!==void 0?n[i]=oV[a]:i==="responseBranch"&&typeof a=="string"&&sV[a]!==void 0?n[i]=sV[a]:n[i]=e(a);return n}return r};return t.map(e)}function lV(t){let e=r=>typeof r=="string"&&!r.startsWith("http://")&&!r.startsWith("https://");for(let r of t){let n=r;if(!n?.args||typeof n.args!="object")continue;let i=n.args,a=[];if(n.name==="UPDATE_TPA_CONFIG")a.push(i.url);else if(n.name==="ADD_TPA_CONFIGS"&&Array.isArray(i.items))for(let o of i.items)o&&typeof o=="object"&&a.push(o.url);for(let o of a)if(e(o))return`url "${o}" is not an absolute URL. A TPA config url must include the scheme and host (e.g. https://api.example.com/v1/resource) \u2014 find the API's base URL in its documentation.`}return null}d();var Vn=t=>t==null,Bme=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),uV=t=>{if(Bme(t)){if(!Vn(t.id))return{key:"id",value:t.id};if(!Vn(t.uniqueId))return{key:"uniqueId",value:t.uniqueId};if(!Vn(t.mRef))return{key:"mRef",value:t.mRef}}},_O=(t,e)=>{if(Vn(t)&&Vn(e)||t===e)return!0;if(Vn(t)||Vn(e)||typeof t!="object"||typeof e!="object")return!1;let r=t,n=e,i=new Set([...Object.keys(r),...Object.keys(n)]);for(let a of i)if(!_O(r[a],n[a]))return!1;return!0},dV=t=>{if(t.__typename==="DiffItem")switch(t.operation){case"add":return{__typename:"DiffItem",oldValue:t.newValue,newValue:null,operation:"delete",pathComponents:t.pathComponents};case"delete":return{__typename:"DiffItem",oldValue:null,newValue:t.oldValue,operation:"add",pathComponents:t.pathComponents};case"update":return{__typename:"DiffItem",oldValue:t.newValue,newValue:t.oldValue,operation:"update",pathComponents:t.pathComponents}}else switch(t.operation){case"insert":return{__typename:"ArrayDiffItem",oldValue:t.newValue,newValue:null,previousValue:t.previousValue,nextValue:t.nextValue,operation:"delete",pathComponents:t.pathComponents};case"delete":return{__typename:"ArrayDiffItem",oldValue:null,newValue:t.oldValue,previousValue:t.previousValue,nextValue:t.nextValue,operation:"insert",pathComponents:t.pathComponents};case"update":return{__typename:"ArrayDiffItem",oldValue:t.newValue,newValue:t.oldValue,operation:"update",pathComponents:t.pathComponents}}throw new Error(`Cannot reverse diff item: ${JSON.stringify(t)}`)},Vme=t=>t.key??t.index??"",zme=(t,e)=>{let r=t;for(let n of e){if(r===null||typeof r!="object")return;r=r[n]}return r},Zme=(t,e)=>{if(e.__typename!=="DiffItem")return null;let r=e.pathComponents.at(-1)?.key;if(r===void 0)return null;let n=uV(t[r]),i=n===void 0?_O(t[r],e.oldValue):n.value===e.oldValue?.[n.key];switch(e.operation){case"add":t[r]=e.newValue;break;case"update":if(!i)return null;t[r]=e.newValue;break;case"delete":if(!Object.prototype.hasOwnProperty.call(t,r)||!i)return null;delete t[r];break;default:return null}return e},Kme=(t,e)=>{if(e.__typename!=="ArrayDiffItem")return null;let r=e.pathComponents.at(-1)?.index;if(r===void 0||r>t.length)return null;let n=()=>{let i=uV(t[r]);return i===void 0?_O(t[r],e.oldValue):i.value===e.oldValue?.[i.key]};switch(e.operation){case"insert":t.splice(r,0,e.newValue);break;case"delete":if(!n())return null;t.splice(r,1);break;case"update":if(!n())return null;t.splice(r,1,e.newValue);break;default:return null}return e},pV=(t,e)=>{let r=t,n=new WeakSet,i=o=>{if(r===null||typeof r!="object")return r;n.has(r)||(r=Array.isArray(r)?[...r]:{...r},n.add(r));let s=r;for(let c of o){let l=s[c];if(l!==null&&typeof l=="object"){if(!n.has(l)){let u=Array.isArray(l)?[...l]:{...l};n.add(u),s[c]=u}s=s[c]}else s=l}return s},a=[];for(let o of e)try{let c=o.pathComponents.map(Vme).slice(0,-1);if(Vn(zme(r,c)))continue;let l=i(c);if(Array.isArray(l)){let u=Kme(l,o);u&&a.push(u)}else if(l!==null&&typeof l=="object"){let u=Zme(l,o);u&&a.push(u)}}catch{continue}return a};d();var Wme=3e4,Rg=class{constructor(e){this.options=e}timer=null;subscriptionHandle=null;running=!1;isActive(){return this.timer!==null||this.subscriptionHandle!==null}start(){this.timer||this.subscriptionHandle||!this.options.subscriptionFactory||this.options.subscriptionFactory(this.options.sessionKey,this.options.getLastPatchExId(),()=>{this.run()}).then(e=>{this.subscriptionHandle=e}).catch(e=>{B.warn("Schema subscription failed; falling back to polling",e.message)}).finally(()=>{this.schedulePoll()})}dispose(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.subscriptionHandle?.unsubscribe(),this.subscriptionHandle=null}schedulePoll(){!this.options.subscriptionFactory||this.timer||(this.timer=setTimeout(()=>{this.timer=null,this.run().finally(()=>this.schedulePoll())},Wme),this.timer.unref())}async run(){if(!this.running){this.running=!0;try{await this.options.refresh()}finally{this.running=!1}}}};d();d();var y={};VE(y,{BRAND:()=>vge,DIRTY:()=>Jo,EMPTY_PATH:()=>Jme,INVALID:()=>oe,NEVER:()=>nye,OK:()=>gr,ParseStatus:()=>tr,Schema:()=>ve,ZodAny:()=>ja,ZodArray:()=>Xi,ZodBigInt:()=>es,ZodBoolean:()=>ts,ZodBranded:()=>Dd,ZodCatch:()=>ps,ZodDate:()=>rs,ZodDefault:()=>ds,ZodDiscriminatedUnion:()=>Lg,ZodEffects:()=>bn,ZodEnum:()=>ls,ZodError:()=>Mr,ZodFirstPartyTypeKind:()=>k,ZodFunction:()=>Mg,ZodIntersection:()=>os,ZodIssueCode:()=>L,ZodLazy:()=>ss,ZodLiteral:()=>cs,ZodMap:()=>tl,ZodNaN:()=>nl,ZodNativeEnum:()=>us,ZodNever:()=>zn,ZodNull:()=>is,ZodNullable:()=>Ti,ZodNumber:()=>Xo,ZodObject:()=>$r,ZodOptional:()=>jr,ZodParsedType:()=>F,ZodPipeline:()=>xd,ZodPromise:()=>$a,ZodReadonly:()=>fs,ZodRecord:()=>kg,ZodSchema:()=>ve,ZodSet:()=>rl,ZodString:()=>Ma,ZodSymbol:()=>Xc,ZodTransformer:()=>bn,ZodTuple:()=>vi,ZodType:()=>ve,ZodUndefined:()=>ns,ZodUnion:()=>as,ZodUnknown:()=>Ji,ZodVoid:()=>el,addIssueToContext:()=>q,any:()=>Pge,array:()=>xge,bigint:()=>wge,boolean:()=>SV,coerce:()=>rye,custom:()=>vV,date:()=>Ige,datetimeRegex:()=>_V,defaultErrorMap:()=>Qi,discriminatedUnion:()=>Mge,effect:()=>Wge,enum:()=>zge,function:()=>Gge,getErrorMap:()=>Qc,getParsedType:()=>Ei,instanceof:()=>bge,intersection:()=>jge,isAborted:()=>Dg,isAsync:()=>Yc,isDirty:()=>xg,isValid:()=>ka,late:()=>Tge,lazy:()=>Bge,literal:()=>Vge,makeIssue:()=>Rd,map:()=>qge,nan:()=>Sge,nativeEnum:()=>Zge,never:()=>Rge,null:()=>Nge,nullable:()=>Qge,number:()=>bV,object:()=>bO,objectUtil:()=>EO,oboolean:()=>tye,onumber:()=>eye,optional:()=>Hge,ostring:()=>Xge,pipeline:()=>Jge,preprocess:()=>Yge,promise:()=>Kge,quotelessJson:()=>Hme,record:()=>Uge,set:()=>Fge,setErrorMap:()=>Yme,strictObject:()=>Lge,string:()=>TV,symbol:()=>Oge,transformer:()=>Wge,tuple:()=>$ge,undefined:()=>Age,union:()=>kge,unknown:()=>Cge,util:()=>Ie,void:()=>Dge});d();d();d();d();d();var Ie;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Ie||(Ie={}));var EO;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(EO||(EO={}));var F=Ie.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ei=t=>{switch(typeof t){case"undefined":return F.undefined;case"string":return F.string;case"number":return Number.isNaN(t)?F.nan:F.number;case"boolean":return F.boolean;case"function":return F.function;case"bigint":return F.bigint;case"symbol":return F.symbol;case"object":return Array.isArray(t)?F.array:t===null?F.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?F.promise:typeof Map<"u"&&t instanceof Map?F.map:typeof Set<"u"&&t instanceof Set?F.set:typeof Date<"u"&&t instanceof Date?F.date:F.object;default:return F.unknown}};var L=Ie.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"]),Hme=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Mr=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(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return i(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,Ie.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Mr.create=t=>new Mr(t);var Qme=(t,e)=>{let r;switch(t.code){case L.invalid_type:t.received===F.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case L.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ie.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ie.joinValues(t.keys,", ")}`;break;case L.invalid_union:r="Invalid input";break;case L.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ie.joinValues(t.options)}`;break;case L.invalid_enum_value:r=`Invalid enum value. Expected ${Ie.joinValues(t.options)}, received '${t.received}'`;break;case L.invalid_arguments:r="Invalid function arguments";break;case L.invalid_return_type:r="Invalid function return type";break;case L.invalid_date:r="Invalid date";break;case L.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}"`:Ie.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case L.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 L.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 L.custom:r="Invalid input";break;case L.invalid_intersection_types:r="Intersection results could not be merged";break;case L.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case L.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ie.assertNever(t)}return{message:r}},Qi=Qme;var fV=Qi;function Yme(t){fV=t}function Qc(){return fV}d();var Rd=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)s=l(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}},Jme=[];function q(t,e){let r=Qc(),n=Rd({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Qi?void 0:Qi].filter(i=>!!i)});t.common.issues.push(n)}var tr=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 i of r){if(i.status==="aborted")return oe;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return oe;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},oe=Object.freeze({status:"aborted"}),Jo=t=>({status:"dirty",value:t}),gr=t=>({status:"valid",value:t}),Dg=t=>t.status==="aborted",xg=t=>t.status==="dirty",ka=t=>t.status==="valid",Yc=t=>typeof Promise<"u"&&t instanceof Promise;d();d();var Q;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Q||(Q={}));var Tn=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},hV=(t,e)=>{if(ka(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 Mr(t.common.issues);return this._error=r,this._error}}};function me(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=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:i}:{errorMap:(o,s)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:i}}var ve=class{get description(){return this._def.description}_getType(e){return Ei(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ei(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new tr,ctx:{common:e.parent.common,data:e.data,parsedType:Ei(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Yc(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:Ei(e)},i=this._parseSync({data:e,path:n.path,parent:n});return hV(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ei(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return ka(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=>ka(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:Ei(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(Yc(i)?i:Promise.resolve(i));return hV(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:L.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new bn({schema:this,typeName:k.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 jr.create(this,this._def)}nullable(){return Ti.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xi.create(this)}promise(){return $a.create(this,this._def)}or(e){return as.create([this,e],this._def)}and(e){return os.create(this,e,this._def)}transform(e){return new bn({...me(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ds({...me(this._def),innerType:this,defaultValue:r,typeName:k.ZodDefault})}brand(){return new Dd({typeName:k.ZodBranded,type:this,...me(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ps({...me(this._def),innerType:this,catchValue:r,typeName:k.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return xd.create(this,e)}readonly(){return fs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xme=/^c[^\s-]{8,}$/i,ege=/^[0-9a-z]+$/,tge=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rge=/^[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,nge=/^[a-z0-9_-]{21}$/i,ige=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,age=/^[-+]?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)?)??$/,oge=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sge="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",vO,cge=/^(?:(?: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])$/,lge=/^(?:(?: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])$/,uge=/^(([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]))$/,dge=/^(([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])$/,pge=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,fge=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gV="((\\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])))",hge=new RegExp(`^${gV}$`);function yV(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 mge(t){return new RegExp(`^${yV(t)}$`)}function _V(t){let e=`${gV}T${yV(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 gge(t,e){return!!((e==="v4"||!e)&&cge.test(t)||(e==="v6"||!e)&&uge.test(t))}function yge(t,e){if(!ige.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,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function _ge(t,e){return!!((e==="v4"||!e)&&lge.test(t)||(e==="v6"||!e)&&dge.test(t))}var Ma=class t extends ve{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==F.string){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:F.string,received:a.parsedType}),oe}let n=new tr,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?q(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&q(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")oge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"email",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")vO||(vO=new RegExp(sge,"u")),vO.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"emoji",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")rge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"uuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")nge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"nanoid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Xme.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ege.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cuid2",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")tge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ulid",code:L.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),q(i,{validation:"url",code:L.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"regex",code:L.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?_V(a).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?hge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?mge(a).test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{code:L.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?age.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"duration",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?gge(e.data,a.version)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"ip",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?yge(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"jwt",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?_ge(e.data,a.version)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"cidr",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?pge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"base64",code:L.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?fge.test(e.data)||(i=this._getOrReturnCtx(e,i),q(i,{validation:"base64url",code:L.invalid_string,message:a.message}),n.dirty()):Ie.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:L.invalid_string,...Q.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Q.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Q.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Q.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Q.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Q.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Q.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Q.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Q.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Q.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Q.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Q.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Q.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Q.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,...Q.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,...Q.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Q.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Q.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...Q.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Q.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Q.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Q.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Q.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Q.errToObj(r)})}nonempty(e){return this.min(1,Q.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}};Ma.create=t=>new Ma({checks:[],typeName:k.ZodString,coerce:t?.coerce??!1,...me(t)});function Ege(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var Xo=class t extends ve{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)!==F.number){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:F.number,received:a.parsedType}),oe}let n,i=new tr;for(let a of this._def.checks)a.kind==="int"?Ie.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),q(n,{code:L.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?Ege(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_finite,message:a.message}),i.dirty()):Ie.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Q.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Q.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.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"&&Ie.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)}};Xo.create=t=>new Xo({checks:[],typeName:k.ZodNumber,coerce:t?.coerce||!1,...me(t)});var es=class t extends ve{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)!==F.bigint)return this._getInvalidInput(e);let n,i=new tr;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),q(n,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Ie.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return q(r,{code:L.invalid_type,expected:F.bigint,received:r.parsedType}),oe}gte(e,r){return this.setLimit("min",e,!0,Q.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Q.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Q.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Q.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:Q.toString(i)}]})}_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:Q.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Q.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}};es.create=t=>new es({checks:[],typeName:k.ZodBigInt,coerce:t?.coerce??!1,...me(t)});var ts=class extends ve{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==F.boolean){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.boolean,received:n.parsedType}),oe}return gr(e.data)}};ts.create=t=>new ts({typeName:k.ZodBoolean,coerce:t?.coerce||!1,...me(t)});var rs=class t extends ve{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==F.date){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_type,expected:F.date,received:a.parsedType}),oe}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return q(a,{code:L.invalid_date}),oe}let n=new tr,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),q(i,{code:L.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Ie.assertNever(a);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:Q.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Q.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}};rs.create=t=>new rs({checks:[],coerce:t?.coerce||!1,typeName:k.ZodDate,...me(t)});var Xc=class extends ve{_parse(e){if(this._getType(e)!==F.symbol){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.symbol,received:n.parsedType}),oe}return gr(e.data)}};Xc.create=t=>new Xc({typeName:k.ZodSymbol,...me(t)});var ns=class extends ve{_parse(e){if(this._getType(e)!==F.undefined){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.undefined,received:n.parsedType}),oe}return gr(e.data)}};ns.create=t=>new ns({typeName:k.ZodUndefined,...me(t)});var is=class extends ve{_parse(e){if(this._getType(e)!==F.null){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.null,received:n.parsedType}),oe}return gr(e.data)}};is.create=t=>new is({typeName:k.ZodNull,...me(t)});var ja=class extends ve{constructor(){super(...arguments),this._any=!0}_parse(e){return gr(e.data)}};ja.create=t=>new ja({typeName:k.ZodAny,...me(t)});var Ji=class extends ve{constructor(){super(...arguments),this._unknown=!0}_parse(e){return gr(e.data)}};Ji.create=t=>new Ji({typeName:k.ZodUnknown,...me(t)});var zn=class extends ve{_parse(e){let r=this._getOrReturnCtx(e);return q(r,{code:L.invalid_type,expected:F.never,received:r.parsedType}),oe}};zn.create=t=>new zn({typeName:k.ZodNever,...me(t)});var el=class extends ve{_parse(e){if(this._getType(e)!==F.undefined){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.void,received:n.parsedType}),oe}return gr(e.data)}};el.create=t=>new el({typeName:k.ZodVoid,...me(t)});var Xi=class t extends ve{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==F.array)return q(r,{code:L.invalid_type,expected:F.array,received:r.parsedType}),oe;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(q(r,{code:o?L.too_big:L.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(q(r,{code:L.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(q(r,{code:L.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new Tn(r,o,r.path,s)))).then(o=>tr.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new Tn(r,o,r.path,s)));return tr.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Q.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Q.toString(r)}})}nonempty(e){return this.min(1,e)}};Xi.create=(t,e)=>new Xi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,...me(e)});function Jc(t){if(t instanceof $r){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=jr.create(Jc(n))}return new $r({...t._def,shape:()=>e})}else return t instanceof Xi?new Xi({...t._def,type:Jc(t.element)}):t instanceof jr?jr.create(Jc(t.unwrap())):t instanceof Ti?Ti.create(Jc(t.unwrap())):t instanceof vi?vi.create(t.items.map(e=>Jc(e))):t}var $r=class t extends ve{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=Ie.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==F.object){let l=this._getOrReturnCtx(e);return q(l,{code:L.invalid_type,expected:F.object,received:l.parsedType}),oe}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof zn&&this._def.unknownKeys==="strip"))for(let l in i.data)o.includes(l)||s.push(l);let c=[];for(let l of o){let u=a[l],p=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Tn(i,p,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof zn){let l=this._def.unknownKeys;if(l==="passthrough")for(let u of s)c.push({key:{status:"valid",value:u},value:{status:"valid",value:i.data[u]}});else if(l==="strict")s.length>0&&(q(i,{code:L.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let u of s){let p=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Tn(i,p,i.path,u)),alwaysSet:u in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let l=[];for(let u of c){let p=await u.key,f=await u.value;l.push({key:p,value:f,alwaysSet:u.alwaysSet})}return l}).then(l=>tr.mergeObjectSync(n,l)):tr.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return Q.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(e).message??i}:{message:i}}}:{}})}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:k.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 Ie.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 Ie.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Jc(this)}partial(e){let r={};for(let n of Ie.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of Ie.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof jr;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return EV(Ie.objectKeys(this.shape))}};$r.create=(t,e)=>new $r({shape:()=>t,unknownKeys:"strip",catchall:zn.create(),typeName:k.ZodObject,...me(e)});$r.strictCreate=(t,e)=>new $r({shape:()=>t,unknownKeys:"strict",catchall:zn.create(),typeName:k.ZodObject,...me(e)});$r.lazycreate=(t,e)=>new $r({shape:t,unknownKeys:"strip",catchall:zn.create(),typeName:k.ZodObject,...me(e)});var as=class extends ve{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new Mr(s.ctx.common.issues));return q(r,{code:L.invalid_union,unionErrors:o}),oe}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let c of n){let l={...r,common:{...r.common,issues:[]},parent:null},u=c._parseSync({data:r.data,path:r.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(c=>new Mr(c));return q(r,{code:L.invalid_union,unionErrors:s}),oe}}get options(){return this._def.options}};as.create=(t,e)=>new as({options:t,typeName:k.ZodUnion,...me(e)});var Yi=t=>t instanceof ss?Yi(t.schema):t instanceof bn?Yi(t.innerType()):t instanceof cs?[t.value]:t instanceof ls?t.options:t instanceof us?Ie.objectValues(t.enum):t instanceof ds?Yi(t._def.innerType):t instanceof ns?[void 0]:t instanceof is?[null]:t instanceof jr?[void 0,...Yi(t.unwrap())]:t instanceof Ti?[null,...Yi(t.unwrap())]:t instanceof Dd||t instanceof fs?Yi(t.unwrap()):t instanceof ps?Yi(t._def.innerType):[],Lg=class t extends ve{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==F.object)return q(r,{code:L.invalid_type,expected:F.object,received:r.parsedType}),oe;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(q(r,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=Yi(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:k.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...me(n)})}};function TO(t,e){let r=Ei(t),n=Ei(e);if(t===e)return{valid:!0,data:t};if(r===F.object&&n===F.object){let i=Ie.objectKeys(e),a=Ie.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let c=TO(t[s],e[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(r===F.array&&n===F.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],c=TO(o,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===F.date&&n===F.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var os=class extends ve{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(Dg(a)||Dg(o))return oe;let s=TO(a.value,o.value);return s.valid?((xg(a)||xg(o))&&r.dirty(),{status:r.value,value:s.data}):(q(n,{code:L.invalid_intersection_types}),oe)};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(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};os.create=(t,e,r)=>new os({left:t,right:e,typeName:k.ZodIntersection,...me(r)});var vi=class t extends ve{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==F.array)return q(n,{code:L.invalid_type,expected:F.array,received:n.parsedType}),oe;if(n.data.length<this._def.items.length)return q(n,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),oe;!this._def.rest&&n.data.length>this._def.items.length&&(q(n,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Tn(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>tr.mergeArray(r,o)):tr.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};vi.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new vi({items:t,typeName:k.ZodTuple,rest:null,...me(e)})};var kg=class t extends ve{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!==F.object)return q(n,{code:L.invalid_type,expected:F.object,received:n.parsedType}),oe;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new Tn(n,s,n.path,s)),value:o._parse(new Tn(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?tr.mergeObjectAsync(r,i):tr.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof ve?new t({keyType:e,valueType:r,typeName:k.ZodRecord,...me(n)}):new t({keyType:Ma.create(),valueType:e,typeName:k.ZodRecord,...me(r)})}},tl=class extends ve{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!==F.map)return q(n,{code:L.invalid_type,expected:F.map,received:n.parsedType}),oe;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,c],l)=>({key:i._parse(new Tn(n,s,n.path,[l,"key"])),value:a._parse(new Tn(n,c,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return oe;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of o){let l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return oe;(l.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(l.value,u.value)}return{status:r.value,value:s}}}};tl.create=(t,e,r)=>new tl({valueType:e,keyType:t,typeName:k.ZodMap,...me(r)});var rl=class t extends ve{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==F.set)return q(n,{code:L.invalid_type,expected:F.set,received:n.parsedType}),oe;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(q(n,{code:L.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(q(n,{code:L.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(c){let l=new Set;for(let u of c){if(u.status==="aborted")return oe;u.status==="dirty"&&r.dirty(),l.add(u.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((c,l)=>a._parse(new Tn(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:Q.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Q.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};rl.create=(t,e)=>new rl({valueType:t,minSize:null,maxSize:null,typeName:k.ZodSet,...me(e)});var Mg=class t extends ve{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==F.function)return q(r,{code:L.invalid_type,expected:F.function,received:r.parsedType}),oe;function n(s,c){return Rd({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qc(),Qi].filter(l=>!!l),issueData:{code:L.invalid_arguments,argumentsError:c}})}function i(s,c){return Rd({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Qc(),Qi].filter(l=>!!l),issueData:{code:L.invalid_return_type,returnTypeError:c}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof $a){let s=this;return gr(async function(...c){let l=new Mr([]),u=await s._def.args.parseAsync(c,a).catch(h=>{throw l.addIssue(n(c,h)),l}),p=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(p,a).catch(h=>{throw l.addIssue(i(p,h)),l})})}else{let s=this;return gr(function(...c){let l=s._def.args.safeParse(c,a);if(!l.success)throw new Mr([n(c,l.error)]);let u=Reflect.apply(o,this,l.data),p=s._def.returns.safeParse(u,a);if(!p.success)throw new Mr([i(u,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:vi.create(e).rest(Ji.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||vi.create([]).rest(Ji.create()),returns:r||Ji.create(),typeName:k.ZodFunction,...me(n)})}},ss=class extends ve{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})}};ss.create=(t,e)=>new ss({getter:t,typeName:k.ZodLazy,...me(e)});var cs=class extends ve{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return q(r,{received:r.data,code:L.invalid_literal,expected:this._def.value}),oe}return{status:"valid",value:e.data}}get value(){return this._def.value}};cs.create=(t,e)=>new cs({value:t,typeName:k.ZodLiteral,...me(e)});function EV(t,e){return new ls({values:t,typeName:k.ZodEnum,...me(e)})}var ls=class t extends ve{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return q(r,{expected:Ie.joinValues(n),received:r.parsedType,code:L.invalid_type}),oe}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 q(r,{received:r.data,code:L.invalid_enum_value,options:n}),oe}return gr(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})}};ls.create=EV;var us=class extends ve{_parse(e){let r=Ie.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==F.string&&n.parsedType!==F.number){let i=Ie.objectValues(r);return q(n,{expected:Ie.joinValues(i),received:n.parsedType,code:L.invalid_type}),oe}if(this._cache||(this._cache=new Set(Ie.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Ie.objectValues(r);return q(n,{received:n.data,code:L.invalid_enum_value,options:i}),oe}return gr(e.data)}get enum(){return this._def.values}};us.create=(t,e)=>new us({values:t,typeName:k.ZodNativeEnum,...me(e)});var $a=class extends ve{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==F.promise&&r.common.async===!1)return q(r,{code:L.invalid_type,expected:F.promise,received:r.parsedType}),oe;let n=r.parsedType===F.promise?r.data:Promise.resolve(r.data);return gr(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};$a.create=(t,e)=>new $a({type:t,typeName:k.ZodPromise,...me(e)});var bn=class extends ve{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===k.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{q(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return oe;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?oe:c.status==="dirty"?Jo(c.value):r.value==="dirty"?Jo(c.value):c});{if(r.value==="aborted")return oe;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?oe:s.status==="dirty"?Jo(s.value):r.value==="dirty"?Jo(s.value):s}}if(i.type==="refinement"){let o=s=>{let c=i.refinement(s,a);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 s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?oe:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?oe:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ka(o))return oe;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>ka(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):oe);Ie.assertNever(i)}};bn.create=(t,e,r)=>new bn({schema:t,typeName:k.ZodEffects,effect:e,...me(r)});bn.createWithPreprocess=(t,e,r)=>new bn({schema:e,effect:{type:"preprocess",transform:t},typeName:k.ZodEffects,...me(r)});var jr=class extends ve{_parse(e){return this._getType(e)===F.undefined?gr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};jr.create=(t,e)=>new jr({innerType:t,typeName:k.ZodOptional,...me(e)});var Ti=class extends ve{_parse(e){return this._getType(e)===F.null?gr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ti.create=(t,e)=>new Ti({innerType:t,typeName:k.ZodNullable,...me(e)});var ds=class extends ve{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===F.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ds.create=(t,e)=>new ds({innerType:t,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...me(e)});var ps=class extends ve{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Yc(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Mr(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ps.create=(t,e)=>new ps({innerType:t,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...me(e)});var nl=class extends ve{_parse(e){if(this._getType(e)!==F.nan){let n=this._getOrReturnCtx(e);return q(n,{code:L.invalid_type,expected:F.nan,received:n.parsedType}),oe}return{status:"valid",value:e.data}}};nl.create=t=>new nl({typeName:k.ZodNaN,...me(t)});var vge=Symbol("zod_brand"),Dd=class extends ve{_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}},xd=class t extends ve{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?oe:a.status==="dirty"?(r.dirty(),Jo(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?oe:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:k.ZodPipeline})}},fs=class extends ve{_parse(e){let r=this._def.innerType._parse(e),n=i=>(ka(i)&&(i.value=Object.freeze(i.value)),i);return Yc(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};fs.create=(t,e)=>new fs({innerType:t,typeName:k.ZodReadonly,...me(e)});function mV(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function vV(t,e={},r){return t?ja.create().superRefine((n,i)=>{let a=t(n);if(a instanceof Promise)return a.then(o=>{if(!o){let s=mV(e,n),c=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:c})}});if(!a){let o=mV(e,n),s=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:s})}}):ja.create()}var Tge={object:$r.lazycreate},k;(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"})(k||(k={}));var bge=(t,e={message:`Input not instance of ${t.name}`})=>vV(r=>r instanceof t,e),TV=Ma.create,bV=Xo.create,Sge=nl.create,wge=es.create,SV=ts.create,Ige=rs.create,Oge=Xc.create,Age=ns.create,Nge=is.create,Pge=ja.create,Cge=Ji.create,Rge=zn.create,Dge=el.create,xge=Xi.create,bO=$r.create,Lge=$r.strictCreate,kge=as.create,Mge=Lg.create,jge=os.create,$ge=vi.create,Uge=kg.create,qge=tl.create,Fge=rl.create,Gge=Mg.create,Bge=ss.create,Vge=cs.create,zge=ls.create,Zge=us.create,Kge=$a.create,Wge=bn.create,Hge=jr.create,Qge=Ti.create,Yge=bn.createWithPreprocess,Jge=xd.create,Xge=()=>TV().optional(),eye=()=>bV().optional(),tye=()=>SV().optional(),rye={string:(t=>Ma.create({...t,coerce:!0})),number:(t=>Xo.create({...t,coerce:!0})),boolean:(t=>ts.create({...t,coerce:!0})),bigint:(t=>es.create({...t,coerce:!0})),date:(t=>rs.create({...t,coerce:!0}))};var nye=oe;var jg=[{name:"schema_action_menu",tier:"catalog",description:"\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=GET_SELECTABLE_COMPONENT_ACTIONS \u2014 The frontend actions attachable to a component event, as the same category tree the editor's action picker shows \u2014 already filtered to this client's platform, the project's configured authentication, and what the event accepts. Each leaf carries the `eventType` it resolved to here (a leaf like SIGN_IN becomes whichever login the project configured) and the `path` to address it. Only a few of these have dedicated ADD_COMPONENT_* tools today; the rest are listed so a plan can name what the editor supports rather than guessing.",ops:{GET_SELECTABLE_COMPONENT_ACTIONS:"GET_SELECTABLE_COMPONENT_ACTIONS"},inputSchema:{componentId:y.string().optional(),displayName:y.string().optional(),eventType:y.string().optional()}},{name:"schema_actionflow",tier:"core",description:`Action flows \u2014 flow-level (addressed by actionFlowId). Discover types via op=SELECTABLE_TYPES and ids via op=GET_DETAIL. AI nodes require isAsync=true.
|
|
1347
1347
|
Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
1348
1348
|
- op=ADD \u2014 Result echoes each new flow's id.
|
|
1349
1349
|
- op=ADD_GLOBAL_VARS \u2014 Result echoes each new variable's minted key.
|
|
@@ -1744,7 +1744,7 @@ ${Vg(e," ")}
|
|
|
1744
1744
|
}`),ez=()=>`mutation AgentRunCode($jsCode: String!, $args: JsonObject, $updateDb: Boolean!) {
|
|
1745
1745
|
fz_debug_action_code(jsCode: $jsCode, args: $args, updateDb: $updateDb)
|
|
1746
1746
|
}`;var h_e=20,m_e=200,g_e=20,NO="id",nz=t=>t&&typeof t=="object"&&!Array.isArray(t)?t:{},iz=t=>Array.isArray(t)?t:[],tz=(t,e)=>typeof t=="number"&&Number.isFinite(t)?Math.trunc(t):e,y_e=(t,e)=>{let r=t[e];if(typeof r!="string"||r.trim()==="")throw new Error(`'${e}' is required.`);return r},rz=(t,e,r)=>{let n=nz(t.where);if(Object.keys(n).length>0)return n;if(t[r]===!0)return{};throw new Error(`'where' is required and must not be empty \u2014 this ${e} runs against the live app and there is no change-everything option.`)},zg=(t,e)=>{let r=iz(t.fields).filter(n=>typeof n=="string"&&n.trim()!=="");return r.length>0?(AO(r,"fields"),r):e.length>0?e.slice(0,g_e):[NO]},__e=t=>t.includes(NO)?t:[NO,...t],az=(t,e,r=[])=>{let n=y_e(e,"tableName");switch(Fa(n,"tableName"),t){case"runtime.query":return{document:HV(n,zg(e,r)),variables:{where:e.where??{},limit:Math.min(tz(e.limit,h_e),m_e),offset:tz(e.offset,0),order_by:e.orderBy??null},rootField:n};case"runtime.aggregate":return{document:QV(n),variables:{where:e.where??{}},rootField:`${n}_aggregate`};case"runtime.insert":{let i=iz(e.objects);if(i.length===0)throw new Error("'objects' must contain at least one row to insert.");if(i.some(a=>!a||typeof a!="object"||Array.isArray(a)))throw new Error("every entry in 'objects' must be an object of column values.");return{document:YV(n,__e(zg(e,r))),variables:{objects:i},rootField:`insert_${n}`}}case"runtime.update":{let i=rz(e,"update","allowUpdateAll"),a=nz(e.set);if(Object.keys(a).length===0)throw new Error("'set' must contain at least one column to change.");return{document:JV(n,zg(e,r)),variables:{where:i,set:a},rootField:`update_${n}`}}case"runtime.delete":return{document:XV(n,zg(e,r)),variables:{where:rz(e,"delete","allowDeleteAll")},rootField:`delete_${n}`};default:throw new Error(`'${t}' is not a table operation.`)}},oz=t=>{if(!t||typeof t!="object"||Array.isArray(t))return t;let e=Object.keys(t);return e.length===1?t[e[0]]:t};async function qd(t,e,r,n){let i=await r.checkSchema(e),a=await r.getProjectArgs(e),o=il(e.tableName,"tableName"),s=await al(r.client,a),c=NV(s.dataModel,o),l=az(t,{...e,tableName:c},PV(s.dataModel,c)),u=await s.dataClient.request(l.document,l.variables);return r.ok(Ur(n?oz(u):u,i))}var E_e=async(t,e)=>{let r=await e.checkSchema(t),n=await e.getProjectArgs(t),i=il(t.query,"query"),o=await(await al(e.client,n)).dataClient.request(i,t.variables??{});return e.ok(Ur(o,r))},v_e=async(t,e)=>qd("runtime.query",t,e,!1),T_e=async(t,e)=>qd("runtime.aggregate",t,e,!1),b_e=async(t,e)=>qd("runtime.insert",t,e,!0),S_e=async(t,e)=>qd("runtime.update",t,e,!0),w_e=async(t,e)=>qd("runtime.delete",t,e,!0),I_e=async(t,e)=>{let r=await e.getProjectArgs(t),n=il(t.jsCode,"jsCode"),i=t.updateDb===!0,o=await(await al(e.client,r)).adminClient.request(ez(),{jsCode:n,args:t.args??null,updateDb:i});return e.ok({keptWrites:i,result:o?.fz_debug_action_code})},sz={"runtime.graphql":E_e,"runtime.run_code":I_e,"runtime.query":v_e,"runtime.aggregate":T_e,"runtime.insert":b_e,"runtime.update":S_e,"runtime.delete":w_e};d();var O_e=["GATEWAY","ACTION_FLOW","ACTION_FLOW_NODE","ACTION_FLOW_CONTEXT_LOG","DEPLOYMENT","TPA","TRIGGER","SQL_GENERATION","GQL","ZAI"],A_e=["INFO","WARNING","ERROR"],N_e=50,P_e=100,cz=5,lz=t=>`${t.toISOString().slice(0,19)}Z`,C_e=t=>{if(!t)return new Date;let e=new Date(t);return Number.isNaN(e.getTime())?new Date:e},uz=(t,e)=>{if(!t)return;let r=t.map(n=>n.toUpperCase()).filter(n=>e.includes(n));return r.length>0?r:void 0},R_e=async(t,e)=>{let r=await e.getProjectArgs(t),i=(await al(e.client,r)).dataVisualizer.token;if(!i)throw new Error(`Log admin token is missing for project ${r.projectExId}`);let a=C_e(ye(t.requestCreatedAt)),o={start:lz(new Date(a.getTime()-cz*6e4)),end:lz(new Date(a.getTime()+cz*6e4)),desc:!0},s=uz(Md(t.types),O_e);s&&(o.type=s);let c=uz(Md(t.levels),A_e);c&&(o.level=c);let l=ye(t.customQueryCondition);l&&(o.customQueryCondition=l);let u=Math.min(P_e,rn(t.limit,N_e)),p=pr().logApiUrlTemplate.replace("{projectExId}",r.projectExId),m=((await new Yt(p,{headers:{authorization:`Bearer ${i}`},fetch:Hc}).request(l1,{queryCreation:o,paginator:{first:u}}))?.fetchLogsByPaginator?.edges??[]).map(_=>_?.node).filter(_=>!!_);return e.ok({entries:m})},dz={"logs.search":R_e};d();d();d();d();import{readFileSync as q_e}from"node:fs";import{dirname as F_e,join as G_e}from"node:path";import{fileURLToPath as B_e}from"node:url";d();var Gt,Fd=null;function Zg(){return(Fd===null||Fd.byteLength===0)&&(Fd=new Uint8Array(Gt.memory.buffer)),Fd}var Kg=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Kg.decode();var D_e=2146435072,PO=0;function x_e(t,e){return PO+=e,PO>=D_e&&(Kg=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}},Kg.decode(),PO=e),Kg.decode(Zg().subarray(t,t+e))}function CO(t,e){return t=t>>>0,x_e(t,e)}function RO(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){let i=t.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){let i=t.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(t)){let i=t.length,a="[";i>0&&(a+=RO(t[0]));for(let o=1;o<i;o++)a+=", "+RO(t[o]);return a+="]",a}let r=/\[object ([^\]]+)\]/.exec(toString.call(t)),n;if(r&&r.length>1)n=r[1];else return toString.call(t);if(n=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
|
|
1747
|
-
${t.stack}`:n}var Hg=0,Wg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},L_e=typeof Wg.encodeInto=="function"?function(t,e){return Wg.encodeInto(t,e)}:function(t,e){let r=Wg.encode(t);return e.set(r),{read:t.length,written:r.length}};function pz(t,e,r){if(r===void 0){let s=Wg.encode(t),c=e(s.length,1)>>>0;return Zg().subarray(c,c+s.length).set(s),Hg=s.length,c}let n=t.length,i=e(n,1)>>>0,a=Zg(),o=0;for(;o<n;o++){let s=t.charCodeAt(o);if(s>127)break;a[i+o]=s}if(o!==n){o!==0&&(t=t.slice(o)),i=r(i,n,n=o+t.length*3,1)>>>0;let s=Zg().subarray(i+o,i+n),c=L_e(t,s);o+=c.written,i=r(i,n,o,1)>>>0}return Hg=o,i}var hs=null;function DO(){return(hs===null||hs.buffer.detached===!0||hs.buffer.detached===void 0&&hs.buffer!==Gt.memory.buffer)&&(hs=new DataView(Gt.memory.buffer)),hs}function k_e(t){return t==null}function M_e(t,e){t=t>>>0;let r=DO(),n=[];for(let i=t;i<t+4*e;i+=4)n.push(Gt.__wbindgen_export_2.get(r.getUint32(i,!0)));return Gt.__externref_drop_slice(t,e),n}function fz(t,e){let r=pz(t,Gt.__wbindgen_malloc,Gt.__wbindgen_realloc),n=Hg,i=Gt.cut(r,n,k_e(e)?16777215:e?1:0);var a=M_e(i[0],i[1]).slice();return Gt.__wbindgen_free(i[0],i[1]*4,4),a}var j_e=new Set(["basic","cors","default"]);async function $_e(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.ok&&j_e.has(t.type)&&t.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function hz(){let t={};return t.wbg={},t.wbg.__wbg_Error_0497d5bdba9362e5=function(e,r){return Error(CO(e,r))},t.wbg.__wbg_new_07b483f72211fd66=function(){return new Object},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,r,n){e[r]=n},t.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_debug_string=function(e,r){let n=RO(r),i=pz(n,Gt.__wbindgen_malloc,Gt.__wbindgen_realloc),a=Hg;DO().setInt32(e+4,a,!0),DO().setInt32(e+0,i,!0)},t.wbg.__wbindgen_init_externref_table=function(){let e=Gt.__wbindgen_export_2,r=e.grow(4);e.set(0,void 0),e.set(r+0,void 0),e.set(r+1,null),e.set(r+2,!0),e.set(r+3,!1)},t.wbg.__wbindgen_number_new=function(e){return e},t.wbg.__wbindgen_string_new=function(e,r){return CO(e,r)},t.wbg.__wbindgen_throw=function(e,r){throw new Error(CO(e,r))},t}function mz(t,e){return Gt=t.exports,U_e.__wbindgen_wasm_module=e,hs=null,Fd=null,Gt.__wbindgen_start(),Gt}function gz(t){if(Gt!==void 0)return Gt;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=hz();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return mz(r,t)}async function U_e(t){if(Gt!==void 0)return Gt;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("jieba_rs_wasm_bg.wasm",import.meta.url));let e=hz();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await $_e(await t,e);return mz(r,n)}var yz=!1,_z=(t,e)=>{if(!yz){let r=G_e(F_e(B_e(import.meta.url)),"jieba-engine.wasm");gz({module:q_e(r)}),yz=!0}return fz(t,e)};var V_e=new Set(["a","an","and","are","as","at","be","but","by","for","if","in","into","is","it","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]),z_e=/[a-z0-9]+/g,Z_e=t=>{let e=t.toLowerCase().replace(/'s\b/g,""),r=[];for(let n of e.matchAll(z_e)){let i=n[0];V_e.has(i)||r.push(H_e(i))}return r},K_e=/[㐀-鿿豈--ヿ가-]|[a-z0-9]/i,W_e=t=>_z(t.toLowerCase(),!0).filter(e=>K_e.test(e)),sl=t=>{switch(xn){case"ZION":return W_e(t);case"MOMEN":return Z_e(t);default:throw new Error(`[analyzer] unknown PRODUCT '${xn}'`)}},ms=(t,e)=>{let r=t[e];return r==="a"||r==="e"||r==="i"||r==="o"||r==="u"?!1:r==="y"?e===0?!0:!ms(t,e-1):!0},Ga=t=>{let e=0,r=!1;for(let n=0;n<t.length;n+=1){let i=!ms(t,n);r&&!i&&(e+=1),r=i}return e},xO=t=>{for(let e=0;e<t.length;e+=1)if(!ms(t,e))return!0;return!1},Ez=t=>{let e=t.length;return e>=2&&t[e-1]===t[e-2]&&ms(t,e-1)},vz=t=>{let e=t.length;if(e<3||!ms(t,e-1)||ms(t,e-2)||!ms(t,e-3))return!1;let r=t[e-1];return r!=="w"&&r!=="x"&&r!=="y"},Qg=(t,e,r)=>t.slice(0,t.length-e.length)+r;function H_e(t){let e=t;if(e.length<=2)return e;e.endsWith("sses")?e=Qg(e,"sses","ss"):e.endsWith("ies")?e=Qg(e,"ies","i"):e.endsWith("ss")||e.endsWith("s")&&(e=e.slice(0,-1));let r=!1;e.endsWith("eed")?Ga(e.slice(0,-3))>0&&(e=e.slice(0,-1)):e.endsWith("ed")&&xO(e.slice(0,-2))?(e=e.slice(0,-2),r=!0):e.endsWith("ing")&&xO(e.slice(0,-3))&&(e=e.slice(0,-3),r=!0),r&&(e.endsWith("at")||e.endsWith("bl")||e.endsWith("iz")?e+="e":Ez(e)&&!/[lsz]$/.test(e)?e=e.slice(0,-1):Ga(e)===1&&vz(e)&&(e+="e")),e.endsWith("y")&&xO(e.slice(0,-1))&&(e=`${e.slice(0,-1)}i`);let n=[["ational","ate"],["tional","tion"],["enci","ence"],["anci","ance"],["izer","ize"],["bli","ble"],["alli","al"],["entli","ent"],["eli","e"],["ousli","ous"],["ization","ize"],["ation","ate"],["ator","ate"],["alism","al"],["iveness","ive"],["fulness","ful"],["ousness","ous"],["aliti","al"],["iviti","ive"],["biliti","ble"],["logi","log"]];for(let[s,c]of n)if(e.endsWith(s)){Ga(e.slice(0,e.length-s.length))>0&&(e=Qg(e,s,c));break}let i=[["icate","ic"],["ative",""],["alize","al"],["iciti","ic"],["ical","ic"],["ful",""],["ness",""]];for(let[s,c]of i)if(e.endsWith(s)){Ga(e.slice(0,e.length-s.length))>0&&(e=Qg(e,s,c));break}let a=["al","ance","ence","er","ic","able","ible","ant","ement","ment","ent","ou","ism","ate","iti","ous","ive","ize"],o=!1;for(let s of a)if(e.endsWith(s)){let c=e.slice(0,e.length-s.length);Ga(c)>1&&(e=c),o=!0;break}if(!o&&e.endsWith("ion")){let s=e.slice(0,-3);Ga(s)>1&&/[st]$/.test(s)&&(e=s)}if(e.endsWith("e")){let s=e.slice(0,-1),c=Ga(s);(c>1||c===1&&!vz(s))&&(e=s)}return Ga(e)>1&&Ez(e)&&e.endsWith("l")&&(e=e.slice(0,-1)),e}d();var Tz=1.5,bz=.75,LO=t=>{let e=[],r=new Map,n=0;for(let{ref:i,tokens:a}of t){let o=new Map;for(let s of a)o.set(s,(o.get(s)??0)+1);for(let s of o.keys())r.set(s,(r.get(s)??0)+1);e.push({ref:i,tf:o,length:a.length}),n+=a.length}return{docs:e,df:r,avgdl:e.length>0?n/e.length:0}},kO=(t,e)=>{let r=[...new Set(sl(e))],n=t.docs.length;return r.length===0||n===0?[]:t.docs.map(i=>{let a=0;for(let o of r){let s=i.tf.get(o);if(!s)continue;let c=t.df.get(o)??0,l=Math.log(1+(n-c+.5)/(c+.5)),u=s+Tz*(1-bz+bz*i.length/(t.avgdl||1));a+=l*(s*(Tz+1)/u)}return{ref:i.ref,score:a}})};var Q_e=async()=>(await import("./corpus-PBJLYDY5.js")).DOCS_CORPUS,Y_e=3,Sz=null,J_e=t=>{let e=new Map,r=t.map(n=>{e.set(n.path,n);let i=sl(n.content),a=sl(n.title);for(let o=0;o<Y_e;o+=1)i.push(...a);return{ref:n,tokens:i}});return{index:LO(r),byPath:e}},wz=async()=>(Sz??=J_e(await Q_e()),Sz),Iz=async(t,e=10)=>{let{index:r}=await wz();return kO(r,t).filter(n=>n.score>0).sort((n,i)=>i.score-n.score).slice(0,Math.max(1,e)).map(n=>({path:n.ref.path,title:n.ref.title,url:n.ref.url}))},Oz=async t=>{let e=t.replace(/\.mdx$/,""),r=e.startsWith("/")?e:`/${e}`;return(await wz()).byPath.get(r)??null};var X_e=async(t,e)=>{let r=ye(t.query);if(!r)throw new Error("query is required");let n=rn(t.limit,10);return e.ok({results:await Iz(r,n)})},eEe=async(t,e)=>{let r=ye(t.path);if(!r)throw new Error("path is required");let n=await Oz(r);if(!n)throw new Error(`No doc page found for path: ${r}`);return e.ok(n)},Az={"docs.search":X_e,"docs.get_page":eEe};d();var tEe=async(t,e)=>{let r=ye(t.query);if(!r)throw new Error("query is required");let n=t.variables&&typeof t.variables=="object"?t.variables:{};return e.ok(await e.client.request(r,n))},Nz={"platform.graphql":tEe};d();var rEe=async(t,e)=>{let n=((await e.client.request(CF)).visibleAfCustomCodeTemplates??[]).map(i=>({templateCodeId:i.exId,displayName:i.displayName,group:i.templateGroup,async:i.async,inputs:i.inputType,outputs:i.outputType}));return e.ok({templates:n})},Pz={"actionflow.list_node_templates":rEe};d();var kW=Pt(_W(),1);d();function CSe(t){let e;try{e=new URL(t)}catch{throw new Error(`Unsupported or malformed URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Only http/https URLs are allowed: ${t}`);return e}async function RSe(t,e){let r=t.body?.getReader();if(!r)throw new Error(`Empty response body from ${e}`);let n=[],i=0;for(;;){let{done:a,value:o}=await r.read();if(a)break;if(i+=o.byteLength,i>10485760)throw await r.cancel(),new Error("Response exceeds size limit of 10485760 bytes");n.push(o)}return Buffer.concat(n).toString("utf8")}async function gN(t){let e=t;for(let r=0;r<=5;r++){let n=CSe(e),i=await fetch(n,{redirect:"manual",signal:AbortSignal.timeout(2e4),headers:{Accept:"application/json, application/yaml, text/yaml, text/html, */*","User-Agent":"Momen-Agent-TpaImport"}});if(i.status>=300&&i.status<400){let a=i.headers.get("location");if(await i.body?.cancel(),!a)throw new Error(`Redirect without Location from ${e}`);e=new URL(a,n).toString();continue}if(!i.ok)throw await i.body?.cancel(),new Error(`HTTP ${i.status} fetching ${e}`);return{finalUrl:n.toString(),contentType:i.headers.get("content-type"),body:await RSe(i,e)}}throw new Error(`Too many redirects fetching ${t}`)}d();var DSe=/(?:href|src|url)\s*[=:]\s*["']?([^"'\s>)]+)/gi,xSe=/<(script|style|noscript|svg|iframe|canvas|template|nav|footer|aside)\b[\s\S]*?<\/\1\s*>/gi,LSe=new Set(["css","js","png","jpg","jpeg","gif","svg","ico","woff","woff2","ttf","webp","mp4","zip","pdf"]);function EW(t,e){if(t&&t.toLowerCase().includes("html"))return!0;let r=e.trimStart();return r.startsWith("<")&&!r.startsWith("<?xml")}function vW(t){let e=t.length>4e3?t.slice(0,4e3):t;return e.includes('"openapi"')||e.includes('"swagger"')||/(^|\n)\s*openapi\s*:/.test(e)||/(^|\n)\s*swagger\s*:/.test(e)}function TW(t,e){try{return new URL(e,t).toString()}catch{return e.startsWith("http")?e:null}}var kSe=/^https?:\/\/app\.swaggerhub\.com\/apis(?:-docs)?\/([^/?#]+)\/([^/?#]+)\/([^/?#]+)/i;function MSe(t){let e=t.match(kSe);return e?`https://api.swaggerhub.com/apis/${e[1]}/${e[2]}/${e[3]}`:null}function bW(t,e){let r=[],n=i=>{i&&r.length<20&&!r.includes(i)&&r.push(i)};for(let i of t.matchAll(DSe)){if(r.length>=20)break;let a=i[1],o=a.toLowerCase();if(!(o.includes("openapi")||o.includes("swagger")||(o.endsWith(".json")||o.endsWith(".yaml")||o.endsWith(".yml"))&&o.includes("api")))continue;let c=TW(e,a);n(c&&MSe(c)),n(c)}return r}function SW(t,e){let r=[],n;try{n=new URL(e).host}catch{return r}for(let i of t.matchAll(/<a\b[^>]*href\s*=\s*["']([^"'#]+)[^"']*["']/gi)){if(r.length>=40)break;let a;try{a=new URL(i[1],e)}catch{continue}if(a.host!==n)continue;a.hash="";let o=a.toString(),s=a.pathname.toLowerCase(),c=s.slice(s.lastIndexOf(".")+1);LSe.has(c)||o===e||r.includes(o)||r.push(o)}return r}var jSe={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",copy:"\xA9"};function yN(t){return t.replace(/&#x([0-9a-f]+);/gi,(e,r)=>String.fromCodePoint(parseInt(r,16))).replace(/&#(\d+);/g,(e,r)=>String.fromCodePoint(parseInt(r,10))).replace(/&([a-z]+);/gi,(e,r)=>jSe[r.toLowerCase()]??e)}var _p=t=>t.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();function wW(t,e){let r=t.replace(/<!--[\s\S]*?-->/g,"").replace(xSe,"");return r=r.replace(/<pre\b[^>]*>([\s\S]*?)<\/pre\s*>/gi,(n,i)=>`
|
|
1747
|
+
${t.stack}`:n}var Hg=0,Wg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},L_e=typeof Wg.encodeInto=="function"?function(t,e){return Wg.encodeInto(t,e)}:function(t,e){let r=Wg.encode(t);return e.set(r),{read:t.length,written:r.length}};function pz(t,e,r){if(r===void 0){let s=Wg.encode(t),c=e(s.length,1)>>>0;return Zg().subarray(c,c+s.length).set(s),Hg=s.length,c}let n=t.length,i=e(n,1)>>>0,a=Zg(),o=0;for(;o<n;o++){let s=t.charCodeAt(o);if(s>127)break;a[i+o]=s}if(o!==n){o!==0&&(t=t.slice(o)),i=r(i,n,n=o+t.length*3,1)>>>0;let s=Zg().subarray(i+o,i+n),c=L_e(t,s);o+=c.written,i=r(i,n,o,1)>>>0}return Hg=o,i}var hs=null;function DO(){return(hs===null||hs.buffer.detached===!0||hs.buffer.detached===void 0&&hs.buffer!==Gt.memory.buffer)&&(hs=new DataView(Gt.memory.buffer)),hs}function k_e(t){return t==null}function M_e(t,e){t=t>>>0;let r=DO(),n=[];for(let i=t;i<t+4*e;i+=4)n.push(Gt.__wbindgen_export_2.get(r.getUint32(i,!0)));return Gt.__externref_drop_slice(t,e),n}function fz(t,e){let r=pz(t,Gt.__wbindgen_malloc,Gt.__wbindgen_realloc),n=Hg,i=Gt.cut(r,n,k_e(e)?16777215:e?1:0);var a=M_e(i[0],i[1]).slice();return Gt.__wbindgen_free(i[0],i[1]*4,4),a}var j_e=new Set(["basic","cors","default"]);async function $_e(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(n){if(t.ok&&j_e.has(t.type)&&t.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let r=await t.arrayBuffer();return await WebAssembly.instantiate(r,e)}else{let r=await WebAssembly.instantiate(t,e);return r instanceof WebAssembly.Instance?{instance:r,module:t}:r}}function hz(){let t={};return t.wbg={},t.wbg.__wbg_Error_0497d5bdba9362e5=function(e,r){return Error(CO(e,r))},t.wbg.__wbg_new_07b483f72211fd66=function(){return new Object},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,r,n){e[r]=n},t.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_debug_string=function(e,r){let n=RO(r),i=pz(n,Gt.__wbindgen_malloc,Gt.__wbindgen_realloc),a=Hg;DO().setInt32(e+4,a,!0),DO().setInt32(e+0,i,!0)},t.wbg.__wbindgen_init_externref_table=function(){let e=Gt.__wbindgen_export_2,r=e.grow(4);e.set(0,void 0),e.set(r+0,void 0),e.set(r+1,null),e.set(r+2,!0),e.set(r+3,!1)},t.wbg.__wbindgen_number_new=function(e){return e},t.wbg.__wbindgen_string_new=function(e,r){return CO(e,r)},t.wbg.__wbindgen_throw=function(e,r){throw new Error(CO(e,r))},t}function mz(t,e){return Gt=t.exports,U_e.__wbindgen_wasm_module=e,hs=null,Fd=null,Gt.__wbindgen_start(),Gt}function gz(t){if(Gt!==void 0)return Gt;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=hz();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let r=new WebAssembly.Instance(t,e);return mz(r,t)}async function U_e(t){if(Gt!==void 0)return Gt;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("jieba_rs_wasm_bg.wasm",import.meta.url));let e=hz();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:r,module:n}=await $_e(await t,e);return mz(r,n)}var yz=!1,_z=(t,e)=>{if(!yz){let r=G_e(F_e(B_e(import.meta.url)),"jieba-engine.wasm");gz({module:q_e(r)}),yz=!0}return fz(t,e)};var V_e=new Set(["a","an","and","are","as","at","be","but","by","for","if","in","into","is","it","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]),z_e=/[a-z0-9]+/g,Z_e=t=>{let e=t.toLowerCase().replace(/'s\b/g,""),r=[];for(let n of e.matchAll(z_e)){let i=n[0];V_e.has(i)||r.push(H_e(i))}return r},K_e=/[㐀-鿿豈--ヿ가-]|[a-z0-9]/i,W_e=t=>_z(t.toLowerCase(),!0).filter(e=>K_e.test(e)),sl=t=>{switch(xn){case"ZION":return W_e(t);case"MOMEN":return Z_e(t);default:throw new Error(`[analyzer] unknown PRODUCT '${xn}'`)}},ms=(t,e)=>{let r=t[e];return r==="a"||r==="e"||r==="i"||r==="o"||r==="u"?!1:r==="y"?e===0?!0:!ms(t,e-1):!0},Ga=t=>{let e=0,r=!1;for(let n=0;n<t.length;n+=1){let i=!ms(t,n);r&&!i&&(e+=1),r=i}return e},xO=t=>{for(let e=0;e<t.length;e+=1)if(!ms(t,e))return!0;return!1},Ez=t=>{let e=t.length;return e>=2&&t[e-1]===t[e-2]&&ms(t,e-1)},vz=t=>{let e=t.length;if(e<3||!ms(t,e-1)||ms(t,e-2)||!ms(t,e-3))return!1;let r=t[e-1];return r!=="w"&&r!=="x"&&r!=="y"},Qg=(t,e,r)=>t.slice(0,t.length-e.length)+r;function H_e(t){let e=t;if(e.length<=2)return e;e.endsWith("sses")?e=Qg(e,"sses","ss"):e.endsWith("ies")?e=Qg(e,"ies","i"):e.endsWith("ss")||e.endsWith("s")&&(e=e.slice(0,-1));let r=!1;e.endsWith("eed")?Ga(e.slice(0,-3))>0&&(e=e.slice(0,-1)):e.endsWith("ed")&&xO(e.slice(0,-2))?(e=e.slice(0,-2),r=!0):e.endsWith("ing")&&xO(e.slice(0,-3))&&(e=e.slice(0,-3),r=!0),r&&(e.endsWith("at")||e.endsWith("bl")||e.endsWith("iz")?e+="e":Ez(e)&&!/[lsz]$/.test(e)?e=e.slice(0,-1):Ga(e)===1&&vz(e)&&(e+="e")),e.endsWith("y")&&xO(e.slice(0,-1))&&(e=`${e.slice(0,-1)}i`);let n=[["ational","ate"],["tional","tion"],["enci","ence"],["anci","ance"],["izer","ize"],["bli","ble"],["alli","al"],["entli","ent"],["eli","e"],["ousli","ous"],["ization","ize"],["ation","ate"],["ator","ate"],["alism","al"],["iveness","ive"],["fulness","ful"],["ousness","ous"],["aliti","al"],["iviti","ive"],["biliti","ble"],["logi","log"]];for(let[s,c]of n)if(e.endsWith(s)){Ga(e.slice(0,e.length-s.length))>0&&(e=Qg(e,s,c));break}let i=[["icate","ic"],["ative",""],["alize","al"],["iciti","ic"],["ical","ic"],["ful",""],["ness",""]];for(let[s,c]of i)if(e.endsWith(s)){Ga(e.slice(0,e.length-s.length))>0&&(e=Qg(e,s,c));break}let a=["al","ance","ence","er","ic","able","ible","ant","ement","ment","ent","ou","ism","ate","iti","ous","ive","ize"],o=!1;for(let s of a)if(e.endsWith(s)){let c=e.slice(0,e.length-s.length);Ga(c)>1&&(e=c),o=!0;break}if(!o&&e.endsWith("ion")){let s=e.slice(0,-3);Ga(s)>1&&/[st]$/.test(s)&&(e=s)}if(e.endsWith("e")){let s=e.slice(0,-1),c=Ga(s);(c>1||c===1&&!vz(s))&&(e=s)}return Ga(e)>1&&Ez(e)&&e.endsWith("l")&&(e=e.slice(0,-1)),e}d();var Tz=1.5,bz=.75,LO=t=>{let e=[],r=new Map,n=0;for(let{ref:i,tokens:a}of t){let o=new Map;for(let s of a)o.set(s,(o.get(s)??0)+1);for(let s of o.keys())r.set(s,(r.get(s)??0)+1);e.push({ref:i,tf:o,length:a.length}),n+=a.length}return{docs:e,df:r,avgdl:e.length>0?n/e.length:0}},kO=(t,e)=>{let r=[...new Set(sl(e))],n=t.docs.length;return r.length===0||n===0?[]:t.docs.map(i=>{let a=0;for(let o of r){let s=i.tf.get(o);if(!s)continue;let c=t.df.get(o)??0,l=Math.log(1+(n-c+.5)/(c+.5)),u=s+Tz*(1-bz+bz*i.length/(t.avgdl||1));a+=l*(s*(Tz+1)/u)}return{ref:i.ref,score:a}})};var Q_e=async()=>(await import("./corpus-LDBEWS6F.js")).DOCS_CORPUS,Y_e=3,Sz=null,J_e=t=>{let e=new Map,r=t.map(n=>{e.set(n.path,n);let i=sl(n.content),a=sl(n.title);for(let o=0;o<Y_e;o+=1)i.push(...a);return{ref:n,tokens:i}});return{index:LO(r),byPath:e}},wz=async()=>(Sz??=J_e(await Q_e()),Sz),Iz=async(t,e=10)=>{let{index:r}=await wz();return kO(r,t).filter(n=>n.score>0).sort((n,i)=>i.score-n.score).slice(0,Math.max(1,e)).map(n=>({path:n.ref.path,title:n.ref.title,url:n.ref.url}))},Oz=async t=>{let e=t.replace(/\.mdx$/,""),r=e.startsWith("/")?e:`/${e}`;return(await wz()).byPath.get(r)??null};var X_e=async(t,e)=>{let r=ye(t.query);if(!r)throw new Error("query is required");let n=rn(t.limit,10);return e.ok({results:await Iz(r,n)})},eEe=async(t,e)=>{let r=ye(t.path);if(!r)throw new Error("path is required");let n=await Oz(r);if(!n)throw new Error(`No doc page found for path: ${r}`);return e.ok(n)},Az={"docs.search":X_e,"docs.get_page":eEe};d();var tEe=async(t,e)=>{let r=ye(t.query);if(!r)throw new Error("query is required");let n=t.variables&&typeof t.variables=="object"?t.variables:{};return e.ok(await e.client.request(r,n))},Nz={"platform.graphql":tEe};d();var rEe=async(t,e)=>{let n=((await e.client.request(CF)).visibleAfCustomCodeTemplates??[]).map(i=>({templateCodeId:i.exId,displayName:i.displayName,group:i.templateGroup,async:i.async,inputs:i.inputType,outputs:i.outputType}));return e.ok({templates:n})},Pz={"actionflow.list_node_templates":rEe};d();var kW=Pt(_W(),1);d();function CSe(t){let e;try{e=new URL(t)}catch{throw new Error(`Unsupported or malformed URL: ${t}`)}if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`Only http/https URLs are allowed: ${t}`);return e}async function RSe(t,e){let r=t.body?.getReader();if(!r)throw new Error(`Empty response body from ${e}`);let n=[],i=0;for(;;){let{done:a,value:o}=await r.read();if(a)break;if(i+=o.byteLength,i>10485760)throw await r.cancel(),new Error("Response exceeds size limit of 10485760 bytes");n.push(o)}return Buffer.concat(n).toString("utf8")}async function gN(t){let e=t;for(let r=0;r<=5;r++){let n=CSe(e),i=await fetch(n,{redirect:"manual",signal:AbortSignal.timeout(2e4),headers:{Accept:"application/json, application/yaml, text/yaml, text/html, */*","User-Agent":"Momen-Agent-TpaImport"}});if(i.status>=300&&i.status<400){let a=i.headers.get("location");if(await i.body?.cancel(),!a)throw new Error(`Redirect without Location from ${e}`);e=new URL(a,n).toString();continue}if(!i.ok)throw await i.body?.cancel(),new Error(`HTTP ${i.status} fetching ${e}`);return{finalUrl:n.toString(),contentType:i.headers.get("content-type"),body:await RSe(i,e)}}throw new Error(`Too many redirects fetching ${t}`)}d();var DSe=/(?:href|src|url)\s*[=:]\s*["']?([^"'\s>)]+)/gi,xSe=/<(script|style|noscript|svg|iframe|canvas|template|nav|footer|aside)\b[\s\S]*?<\/\1\s*>/gi,LSe=new Set(["css","js","png","jpg","jpeg","gif","svg","ico","woff","woff2","ttf","webp","mp4","zip","pdf"]);function EW(t,e){if(t&&t.toLowerCase().includes("html"))return!0;let r=e.trimStart();return r.startsWith("<")&&!r.startsWith("<?xml")}function vW(t){let e=t.length>4e3?t.slice(0,4e3):t;return e.includes('"openapi"')||e.includes('"swagger"')||/(^|\n)\s*openapi\s*:/.test(e)||/(^|\n)\s*swagger\s*:/.test(e)}function TW(t,e){try{return new URL(e,t).toString()}catch{return e.startsWith("http")?e:null}}var kSe=/^https?:\/\/app\.swaggerhub\.com\/apis(?:-docs)?\/([^/?#]+)\/([^/?#]+)\/([^/?#]+)/i;function MSe(t){let e=t.match(kSe);return e?`https://api.swaggerhub.com/apis/${e[1]}/${e[2]}/${e[3]}`:null}function bW(t,e){let r=[],n=i=>{i&&r.length<20&&!r.includes(i)&&r.push(i)};for(let i of t.matchAll(DSe)){if(r.length>=20)break;let a=i[1],o=a.toLowerCase();if(!(o.includes("openapi")||o.includes("swagger")||(o.endsWith(".json")||o.endsWith(".yaml")||o.endsWith(".yml"))&&o.includes("api")))continue;let c=TW(e,a);n(c&&MSe(c)),n(c)}return r}function SW(t,e){let r=[],n;try{n=new URL(e).host}catch{return r}for(let i of t.matchAll(/<a\b[^>]*href\s*=\s*["']([^"'#]+)[^"']*["']/gi)){if(r.length>=40)break;let a;try{a=new URL(i[1],e)}catch{continue}if(a.host!==n)continue;a.hash="";let o=a.toString(),s=a.pathname.toLowerCase(),c=s.slice(s.lastIndexOf(".")+1);LSe.has(c)||o===e||r.includes(o)||r.push(o)}return r}var jSe={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",copy:"\xA9"};function yN(t){return t.replace(/&#x([0-9a-f]+);/gi,(e,r)=>String.fromCodePoint(parseInt(r,16))).replace(/&#(\d+);/g,(e,r)=>String.fromCodePoint(parseInt(r,10))).replace(/&([a-z]+);/gi,(e,r)=>jSe[r.toLowerCase()]??e)}var _p=t=>t.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();function wW(t,e){let r=t.replace(/<!--[\s\S]*?-->/g,"").replace(xSe,"");return r=r.replace(/<pre\b[^>]*>([\s\S]*?)<\/pre\s*>/gi,(n,i)=>`
|
|
1748
1748
|
\`\`\`
|
|
1749
1749
|
${yN($Se(i))}
|
|
1750
1750
|
\`\`\`
|
|
@@ -2692,7 +2692,7 @@ it anywhere else, use the id.
|
|
|
2692
2692
|
MediaFormat: CSS, CSV, DOC, DOCX, GIF, HTML, ICO, JPEG, JPG, JSON, MOV, MP3, MP4, OTHER, PDF, PNG,
|
|
2693
2693
|
PPT, PPTX, SVG, TXT, WAV, WEBP, XLS, XLSX, XML.
|
|
2694
2694
|
CannedAccessControlList: AUTHENTICATE_READ, AWS_EXEC_READ, BUCKET_OWNER_FULL_CONTROL,
|
|
2695
|
-
BUCKET_OWNER_READ, DEFAULT, LOG_DELIVERY_WRITE, PRIVATE, PUBLIC_READ, PUBLIC_READ_WRITE.`};d();function z9(t,e){let r=Wl[t];if(!r)throw new Error(`No guide available for '${t}'.`);let n=r[e];if(!n.available||!n.prompt)throw new Error(`Plugin '${t}' is not available for ${e} projects.`);return n.prompt}var lr={projectExId:y.string().optional(),appExId:y.string().nullable().optional(),appVersionExId:y.string().nullable().optional()},UE=t=>({content:[{type:"text",text:t.ok?t.message??JSON.stringify(t.data??{},null,2):JSON.stringify({error:t.error??"Unknown error",data:t.data},null,2)}],isError:!t.ok}),Sf=(t,e,r,n,i)=>{t.registerTool(e,{description:r,inputSchema:n},i)},Z9=(t,e,r)=>{for(let n of e)Sf(t,n.name,n.description,n.inputSchema??{},async(i,a)=>UE(await r({name:n.command,args:i},a.signal)))},K9=(t,e,r)=>{for(let n of e){let{ops:i}=n,a={op:y.enum(Object.keys(i)),...n.inputSchema??{}};Sf(t,n.name,n.description,a,async(o,s)=>{let{op:c,...l}=o;return UE(await r({name:i[String(c)],args:l},s.signal))})}};var pLe=t=>({content:[{type:"text",text:t}],isError:!1});var W9=(t,e,r)=>{for(let n of e){let i={...lr,op:y.enum(n.ops),args:y.record(y.any()).optional()};Sf(t,n.name,n.description,i,async(a,o)=>{let{op:s,projectExId:c,appExId:l,appVersionExId:u,args:p}=a;return UE(await r({name:"schema.ztype_tool_calls",args:{projectExId:c,appExId:l,appVersionExId:u,toolCalls:[{toolCallId:`${n.name}-${String(s)}-${Date.now()}`,name:String(s),args:p??{}}]}},o?.signal))})}},H9=(t,e)=>{let r=Object.keys(Wl);Sf(t,"guide","Load the domain guide for a backend capability \u2014 the rules, conventions, and gotchas for a plugin area (database, type, bindings, actionflow, api, tpa, zai, component, permissions, payments, logs, agent). Returns guidance for the loaded project\u2019s type-system state. Call before editing an unfamiliar area, or when a meta-tool call is rejected.",{plugin:y.enum(r),projectExId:y.string().optional()},async(n,i)=>{let a=await $g(e,n.projectExId,i?.signal);return pLe(z9(String(n.plugin),a))})},Q9=(t,e)=>{Sf(t,"agent_command","Advanced escape hatch for directly invoking an internal agent command.",{name:y.string(),args:y.record(y.any()).optional()},async(r,n)=>UE(await e({name:String(r.name),args:r.args??{}},n.signal)))};d();var fLe={"actionflow.list_node_templates":{description:"List the published preset action-flow integration nodes (the dynamic TEMPLATE_CODE catalog \u2014 e.g. SMS, video/AI generation). Returns each template\u2019s templateCodeId, displayName, group, async flag, and input/output param types. Pass a returned templateCodeId to schema tool-call ADD_ACTION_FLOW_NODE (TEMPLATE_CODE node) to insert it. The set is server-managed and changes over time, so query it rather than assuming a fixed provider.",tool:{name:"list_actionflow_node_templates"},cli:{path:"actionflow list-node-templates"}},"workspace.set":{description:"Set the workspace root for local credentials, daemon registry, and project context.",tool:{name:"set_current_working_directory",inputSchema:{cwd:y.string()}}},"auth.login":{description:"Start browser login and save credentials.",cli:{path:"login"}},"auth.logout":{description:"Delete local credentials and unload schema sessions.",cli:{path:"logout"}},"auth.whoami":{description:"Show the currently authenticated account token payload.",cli:{path:"whoami"}},"auth.reauth":{description:"Delete credentials and start login again.",cli:{path:"reauth"}},"account.profile":{description:"Fetch current account and organization/project-space metadata used for project creation.",tool:{name:"get_account_profile"},cli:{path:"account profile",alias:"account me"}},"projects.search":{description:"List/search projects with pagination.",tool:{name:"get_projects",inputSchema:{projectName:y.string().optional(),cursor:y.string().nullable().optional(),limit:y.number().optional()}},cli:{path:"projects search"}},"projects.list":{description:"List projects.",cli:{path:"projects list"}},"project.create":{description:"Create a new blank project. Defaults to the current account organization and waits for the project to appear in search. Creates a pre- or post-type-system-refactor project automatically based on the account rollout; pass useNewType/useRefactoredComponent to override.",tool:{name:"create_project",inputSchema:{projectName:y.string(),templateExId:y.string().nullable().optional(),platform:y.string().nullable().optional(),projectSpaceType:y.string().optional(),organizationExId:y.string().optional(),category:y.string().nullable().optional(),forBeginnerGuide:y.boolean().optional(),useRefactoredComponent:y.boolean().optional(),useNewType:y.boolean().optional(),wait:y.boolean().optional(),timeoutMs:y.number().optional()}},cli:{path:"project create"}},"project.set_current":{description:"Set the default project context by external id.",tool:{name:"set_current_project",inputSchema:{projectExId:y.string()}},cli:{path:"project set-current"}},"project.get_current":{description:"Get the current project context.",tool:{name:"get_current_project"},cli:{path:"project current",alias:"project get-current"}},"project.detail":{description:"Fetch the Zed project/app detail payload, including app list, project config, latest schema metadata, and deployment info.",cli:{path:"project detail"}},"project.metadata":{description:"Fetch a lean project summary: identity, platforms, publish/deploy state (incl. hasUndeployedChanges), configured integrations, plan, capabilities, and RPS. Pass raw=true for the full unshaped payload.",cli:{path:"project metadata",alias:"project inspect"}},"project.resources":{description:"Fetch project resource consumption, plan/capability limits, RPS stats, and optional resource history.",cli:{path:"project resources"}},"project.rename":{description:"Rename a project.",tool:{name:"rename_project",inputSchema:{...lr,projectName:y.string()}},cli:{path:"project rename"}},"project.rename_app":{description:"Rename an app inside a project.",tool:{name:"rename_project_app",inputSchema:{projectExId:y.string(),appExId:y.string(),appName:y.string()}},cli:{path:"project rename-app"}},"project.delete":{description:"Delete a project. IRREVERSIBLE: requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve. Set MCP_HITL=off to fall back to the confirmProjectExId/force text gate in headless automation.",tool:{name:"delete_project",inputSchema:{projectExId:y.string(),confirmProjectExId:y.string().optional(),force:y.boolean().optional()}},cli:{path:"project delete"}},"project.reset":{description:"Reset a project. IRREVERSIBLE: requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve. Set MCP_HITL=off to fall back to the confirmProjectExId/force text gate in headless automation.",tool:{name:"reset_project",inputSchema:{projectExId:y.string(),confirmProjectExId:y.string().optional(),force:y.boolean().optional(),languageType:y.string().optional()}},cli:{path:"project reset"}},"project.schema_simplified":{description:"Fetch the simplified caught-up server schema. Kept for backwards compatibility.",tool:{name:"get_project_schema",inputSchema:{projectExId:y.string().optional()}}},"project.sync_backend":{description:"Save the schema and deploy/sync the project runtime backend. Returns ztype diagnostics and blocks on backend validation errors by default.",tool:{name:"sync_backend",inputSchema:{...lr,buildTarget:y.string().optional(),validateMultiClient:y.boolean().optional(),allowValidationErrors:y.boolean().optional()}},cli:{path:"project sync-backend",alias:"project deploy-backend"}},"schema.load":{description:"Load a project's CRDT schema into the daemon's in-memory headless schema session.",cli:{path:"schema load"}},"schema.reload":{description:"Force reload a project schema session from the backend CRDT model and patch log.",cli:{path:"schema reload"}},"schema.status":{description:"Show daemon schema sessions and TTL state.",tool:{name:"schema_status"},cli:{path:"schema status"}},"schema.state":{description:"Read the daemon's schema revision, stale state, and latest semantic schema-change event for a project.",cli:{path:"schema state"}},"schema.events":{description:"Read recent semantic schema-change events observed by the daemon for a project.",cli:{path:"schema events"}},"schema.sync":{description:"Catch up schema CRDT patches from the backend for the loaded project session.",cli:{path:"schema sync"}},"schema.snapshot":{description:"Return the data model of the loaded schema (tables, relations, enum types). Pass full=true for the entire raw ZSchema document (UI tree + all server configs), which is much larger.",cli:{path:"schema snapshot"}},"schema.validate":{description:"Run ztype validation/type checks against the loaded schema and return stable/beta/backend diagnostics.",cli:{path:"schema validate",alias:"schema type-check"}},"schema.ztype_tool_calls":{description:"Run ztype Copilot tool calls against the loaded schema. Any resulting CRDT patch is applied immediately; use schema_undo to revert the last change.",tool:{name:"ztype_tool_calls",inputSchema:{...lr,toolCalls:y.array(y.record(y.any())),verbose:y.boolean().optional()}},cli:{path:"schema tool-call",alias:"schema tool-calls"}},"schema.undo":{description:"Undo the most recent schema change made in this session by applying a reverse CRDT patch. Refuses if a concurrent edit touched the same path. Pairs with schema_redo.",tool:{name:"schema_undo",inputSchema:{...lr}},cli:{path:"schema undo"}},"schema.redo":{description:"Re-apply the schema change most recently undone via schema_undo in this session.",tool:{name:"schema_redo",inputSchema:{...lr}},cli:{path:"schema redo"}},"secret.save_value":{description:"Prompt the user (native GUI dialog) to set a secret's plaintext value, store it, and attach the handle so the secret reports hasValue:true. Provide secretId (an existing secret) OR displayName (create a new one). The value is typed into the dialog and never passes through this tool call or the model. Requires a desktop session (fails on headless/SSH/CI).",tool:{name:"save_secret_value",inputSchema:{...lr,secretId:y.string().optional(),displayName:y.string().optional(),description:y.string().optional()}},cli:{path:"secret save-value"}},"runtime.graphql":{description:"Run a raw GraphQL operation against the deployed project's runtime backend (the auto-generated data/actionflow/AI/TPA API), as admin.",tool:{name:"runtime_graphql",inputSchema:{...lr,query:y.string(),variables:y.record(y.any()).optional()}},cli:{path:"runtime graphql"}},"runtime.run_code":{description:"Execute a JavaScript snippet in the deployed project's Run Code sandbox and return its result. Database writes are reverted unless updateDb is true, so this is the cheap way to check what a Run Code node will actually return before wiring it into a flow. Runs on the admin surface, as admin.",tool:{name:"runtime_run_code",inputSchema:{...lr,jsCode:y.string(),args:y.record(y.any()).optional(),updateDb:y.boolean().optional()}},cli:{path:"runtime run-code"}},"runtime.query":{description:"Query rows from a deployed project's runtime table.",cli:{path:"runtime query"}},"runtime.aggregate":{description:"Count rows matching a filter in a deployed project's runtime table \u2014 the cheapest assertion available.",cli:{path:"runtime aggregate"}},"runtime.insert":{description:"Insert one or more rows into a deployed project's runtime table.",cli:{path:"runtime insert"}},"runtime.update":{description:"Update rows in a deployed project's runtime table.",cli:{path:"runtime update"}},"runtime.delete":{description:"Delete rows from a deployed project's runtime table. Requires where unless allowDeleteAll=true.",cli:{path:"runtime delete"}},"logs.search":{description:`Fetch recent runtime logs from the project's log endpoint. Window is \xB15 minutes around requestCreatedAt (ISO-8601, defaults to now). types: GATEWAY, ACTION_FLOW, ACTION_FLOW_NODE, ACTION_FLOW_CONTEXT_LOG, DEPLOYMENT, TPA, TRIGGER, SQL_GENERATION, GQL, ZAI. levels: INFO, WARNING, ERROR. customQueryCondition is an Elasticsearch condition (e.g. 'traceId: "abc-123"').`,tool:{name:"search_logs",inputSchema:{...lr,requestCreatedAt:y.string().optional(),types:y.array(y.string()).optional(),levels:y.array(y.string()).optional(),customQueryCondition:y.string().optional(),limit:y.number().optional()}},cli:{path:"logs search"}},"docs.search":{description:"Full-text search the bundled product documentation. Returns the best-matching pages as { path, title, url }, where url is the public HTTPS docs link you can cite. Use docs.get_page with a returned path to read a page.",tool:{name:"search_docs",inputSchema:{query:y.string(),limit:y.number().optional()}},cli:{path:"docs search"}},"docs.get_page":{description:'Fetch a documentation page as markdown by its path (as returned by docs.search, e.g. "/02_design/01_layout_concepts").',tool:{name:"get_doc_page",inputSchema:{path:y.string()}},cli:{path:"docs get-page"}},"platform.graphql":{description:"Guarded raw GraphQL passthrough to the platform backend (projects, accounts, publishing \u2014 the editor/meta API, not the deployed runtime).",tool:{name:"platform_graphql",inputSchema:{query:y.string(),variables:y.record(y.any()).optional()}},cli:{path:"platform graphql"}},"tpa.import_from_openapi":{description:"Import one or more Third-Party API (TPA) configs from an OpenAPI v3 spec. Provide the spec as a `url` (fetched from this machine) or paste it as `specText` (JSON or YAML). Each operation becomes a TPA endpoint with its request parameters and success/fail response shape. Capped at 25 endpoints per call \u2014 use `pathsFilter` to scope larger specs. On any failure the whole import is rolled back. Duplicates are created (not merged) with a numbered name suffix. Works on every project generation.",tool:{name:"import_tpa_from_openapi",inputSchema:{...lr,url:y.string().optional(),specText:y.string().optional(),pathsFilter:y.array(y.string()).optional()}},cli:{path:"tpa import-from-openapi"}},"tpa.fetch_doc":{description:"Fetch a web page or spec by URL for reading. Returns the page content (HTML converted to Markdown; long pages are windowed \u2014 pass `offset` with the same url to keep reading, guided by `totalLength`/`truncated`), same-site `pageLinks` to explore the documentation further, and any OpenAPI/Swagger `specLinks` found. Explore iteratively by fetching returned links, within a budget of 15 fetches per session (`fetchesRemaining`). Prefer importing a discovered spec via tpa import-from-openapi; otherwise author configs with the granular TPA schema ops.",tool:{name:"fetch_api_doc",inputSchema:{url:y.string(),offset:y.number().optional()}},cli:{path:"tpa fetch-doc"}},"site.deploy":{description:"Deploy a built frontend directory (e.g. ./dist) to the project\u2019s hosted static site and return the live url. Scans the directory, declares the manifest, uploads every asset to object storage, and switches the site over in one call \u2014 the agent never handles checksums or upload urls itself. `target` is BETA (default) or PROD; a PROD deploy takes the site live and requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve, and `force` does NOT approve it. Set MCP_HITL=off to fall back to the confirmProjectExId text gate in headless automation. An interrupted run resumes automatically when the directory is unchanged; pass `force` to discard it and start over. `dryRun` reports what would be uploaded without creating a deployment. The total size must fit the project\u2019s remaining object storage, and the directory must contain an index.html.",tool:{name:"deploy_static_site",inputSchema:{...lr,dir:y.string(),target:y.string().optional(),dryRun:y.boolean().optional(),force:y.boolean().optional(),concurrency:y.number().optional(),confirmProjectExId:y.string().optional()}},cli:{path:"site deploy"}},"site.status":{description:"Report the project\u2019s static site: the currently live deployment (with its url) and any upload still in progress. Use to find the site url, or to see whether an interrupted deploy is still resumable.",tool:{name:"get_static_site_status",inputSchema:{...lr,target:y.string().optional()}},cli:{path:"site status"}},"site.abort":{description:"Abandon an in-progress static site upload and delete whatever it already uploaded. Targets the current in-progress deployment unless `deploymentExId` names one. The live site is untouched.",tool:{name:"abort_static_site_deployment",inputSchema:{...lr,target:y.string().optional(),deploymentExId:y.string().optional()}},cli:{path:"site abort"}}},qE=Object.entries(fLe).map(([t,e])=>({command:t,...e})),Y9=[{name:"schema_session",description:"Schema session lifecycle for the loaded project. op: LOAD (warm the in-memory CRDT session) | RELOAD (force reload from backend) | SYNC (catch up patches) | SNAPSHOT (return the data model: tables, relations, enum types; pass full=true for the entire raw document) | VALIDATE (ztype type checks, stable/beta/backend diagnostics). Edits do not go live until sync_backend.",ops:{LOAD:"schema.load",RELOAD:"schema.reload",SYNC:"schema.sync",SNAPSHOT:"schema.snapshot",VALIDATE:"schema.validate"},inputSchema:{...lr,full:y.boolean().optional()}},{name:"schema_observe",description:"Read the daemon's schema change-state for a project. op: STATE (revision, stale flag, latest change event) | EVENTS (recent semantic schema-change events; afterEventId/limit paginate).",ops:{STATE:"schema.state",EVENTS:"schema.events"},inputSchema:{projectExId:y.string().optional(),afterEventId:y.string().nullable().optional(),limit:y.number().optional()}},{name:"auth",description:"Authentication. op: LOGIN (browser login + save credentials) | LOGOUT (delete credentials, unload sessions) | WHOAMI (show authenticated account token payload) | REAUTH (delete credentials and log in again).",ops:{LOGIN:"auth.login",LOGOUT:"auth.logout",WHOAMI:"auth.whoami",REAUTH:"auth.reauth"}},{name:"project_inspect",description:"Inspect a project. op: DETAIL (app list, project config, latest schema metadata, deployment) | METADATA (plan/capability, deployment, app list, schema metadata, RPS summary) | RESOURCES (resource consumption, plan limits, RPS, optional history). includeSecrets applies to DETAIL/METADATA; refresh/resourceType/nonRealTimeDisplayedResourceTypes apply to RESOURCES.",ops:{DETAIL:"project.detail",METADATA:"project.metadata",RESOURCES:"project.resources"},inputSchema:{...lr,includeSecrets:y.boolean().optional(),refresh:y.boolean().optional(),resourceType:y.string().optional(),nonRealTimeDisplayedResourceTypes:y.array(y.string()).optional()}}];d();var hLe={schema_table:"database",schema_common:"database",schema_overview:"database",schema_type:"type",schema_binding_inspect:"bindings",schema_create_binding:"bindings",schema_conditional_branch:"bindings",schema_condition_expr:"bindings",schema_request_filter:"bindings",schema_actionflow:"actionflow",schema_actionflow_node:"actionflow",schema_trigger:"actionflow",schema_api:"api",schema_component:"component",schema_design_system:"component",schema_action_menu:"component",schema_permission:"permissions",schema_secret:"tpa",schema_zai_config:"zai",schema_callback:"webhook",schema_payment:"payments"},J9=t=>hLe[t]??(t.includes("tpa")?"tpa":"UNMAPPED"),mLe={database:'Edit the data model \u2014 tables, columns, relations, unique constraints, display names. op is a schema ToolName from the enum; args is its payload. Call guide {plugin:"database"} first for the rules and per-op arg shapes.',type:'Edit enums and object/custom type definitions (post-type-system-refactor only). op is a schema ToolName; args is its payload. Call guide {plugin:"type"} for the rules and arg shapes.',bindings:'Create and edit data bindings \u2014 option/const/formula/conditional bindings, boolean condition expressions, and request filters (where + sort), all addressed by schemaPath. op is a schema ToolName; args is its payload. Call guide {plugin:"bindings"} for the rules and arg shapes.',actionflow:'Edit server-side action flows \u2014 flows, nodes, branches, I/O, global variables, and triggers (scheduled / database-change). op is a schema ToolName; args is its payload. Call guide {plugin:"actionflow"} for the rules and arg shapes.',api:'Edit the API-integration library \u2014 workspaces, APIs, request parameters, response configs, input variables, and workspace constants. op is a schema ToolName; args is its payload. Call guide {plugin:"api"} for the rules and arg shapes.',tpa:'Edit third-party API (TPA) configs used by the action-flow Call API node \u2014 configs, parameters, nested response trees, and paging. op is a schema ToolName; args is its payload. Call guide {plugin:"tpa"} for the rules and arg shapes.',zai:'Edit ZAI AI-agent configs \u2014 agents, input args, and model settings. op is a schema ToolName; args is its payload. Call guide {plugin:"zai"} for the rules and arg shapes.',component:'Inspect the UI component tree \u2014 pages, containers, children, and binding context. op is a schema ToolName; args is its payload. Editing components is editor-only. Call guide {plugin:"component"} for the rules.',permissions:'Edit roles and their table, API, action-flow, AI, TPA, and payment permissions. op is a schema ToolName; args is its payload. Call guide {plugin:"permissions"} for the rules and arg shapes.',webhook:'Edit incoming HTTP triggers (webhooks, called callbacks in the schema) \u2014 the bound action flow, request and response body shapes, body codecs, and the provider protocol. op is a schema ToolName; args is its payload. Call guide {plugin:"webhook"} for the rules and arg shapes.',payments:'Turn payments on and pick the order table. Provider credentials stay editor-only. op is a schema ToolName; args is its payload. Call guide {plugin:"payments"} for the rules and arg shapes.'},X9=(()=>{let t=new Map;for(let e of jg){let r=J9(e.name);if(r==="UNMAPPED")continue;let n=t.get(r)??new Set;for(let i of Object.values(e.ops))n.add(i);t.set(r,n)}return[...t.entries()].map(([e,r])=>({name:e,description:mLe[e]??`Edit ${e}.`,ops:[...r].sort()})).sort((e,r)=>e.name.localeCompare(r.name))})(),Qet=jg.filter(t=>J9(t.name)==="UNMAPPED").map(t=>t.name);function gLe(){let t=[];for(let e of qE){if(!e.tool)continue;let{name:r,aliases:n,inputSchema:i}=e.tool;t.push({name:r,description:e.description,command:e.command,inputSchema:i});for(let a of n??[])t.push({name:a.name,description:a.description??e.description,command:e.command,inputSchema:i})}return t}function eJ(t,e){Z9(t,gLe(),e),K9(t,Y9,e),W9(t,X9,e),H9(t,e),Q9(t,e)}d();d();var yLe={productName:"Zion",utcOffset:"+08:00",accountTable:"\u5E10\u6237(\u8D26\u6237)",paymentTables:"\u652F\u4ED8, \u5468\u671F\u6027\u652F\u4ED8, \u9000\u6B3E",aiTables:"\u4F1A\u8BDD, \u6D88\u606F, \u5DE5\u5177\u4F7F\u7528\u8BB0\u5F55, \u6D88\u606F\u5185\u5BB9",displayNameRule:'user-visible; use the natural Chinese name as the displayName and derive the English snake_case systemName from it (e.g. displayName "\u7528\u6237\u540D" \u2192 systemName "user_name").',enumDisplayNameRule:'use a natural Chinese phrase (enum displayName "\u8BA2\u5355\u72B6\u6001", option displayName "\u5F85\u5904\u7406"); the enum id and option values stay English.',runtimeGraphqlUrl:t=>pr().zeroApiUrlTemplate.replace("{projectExId}",t)},_Le={productName:"Momen",utcOffset:"+00:00",accountTable:"account",paymentTables:"payment_record, recurring_payment, refund",aiTables:"conversation, message, tool_usage_record, message_content",displayNameRule:'user-visible; prefer it IDENTICAL to the systemName (e.g. systemName "first_name" \u2192 displayName "first_name").',enumDisplayNameRule:'keep it close to the name/value itself (enum displayName \u2248 the enum name, e.g. "OrderStatus"; an option displayName \u2248 its value, e.g. "PENDING").',runtimeGraphqlUrl:t=>pr().zeroApiUrlTemplate.replace("{projectExId}",t)},Hl=()=>{switch(xn){case"MOMEN":return _Le;case"ZION":return yLe;default:throw new Error(`[product-context] unknown PRODUCT '${xn}'`)}};d();function tJ({brand:t,zeroApiUrl:e}){let r=e.replace(/^http:/,"ws:").replace(/^https:/,"wss:").replace("/api/graphql-v2","/api/graphql-subscription");return{brand:t,zeroApiUrl:e,zeroSubscriptionUrl:r}}function rJ(t){let e=t.brand==="Zion"?"Zion apps conventionally sign up / log in by phone number (SMS code); email and username work too.":"Momen apps conventionally sign up / log in by email; phone (SMS code) and username work too.";return`## App-user authentication (for the frontend you generate)
|
|
2695
|
+
BUCKET_OWNER_READ, DEFAULT, LOG_DELIVERY_WRITE, PRIVATE, PUBLIC_READ, PUBLIC_READ_WRITE.`};d();function z9(t,e){let r=Wl[t];if(!r)throw new Error(`No guide available for '${t}'.`);let n=r[e];if(!n.available||!n.prompt)throw new Error(`Plugin '${t}' is not available for ${e} projects.`);return n.prompt}var lr={projectExId:y.string().optional(),appExId:y.string().nullable().optional(),appVersionExId:y.string().nullable().optional()},UE=t=>({content:[{type:"text",text:t.ok?t.message??JSON.stringify(t.data??{},null,2):JSON.stringify({error:t.error??"Unknown error",data:t.data},null,2)}],isError:!t.ok}),Sf=(t,e,r,n,i)=>{t.registerTool(e,{description:r,inputSchema:n},i)},Z9=(t,e,r)=>{for(let n of e)Sf(t,n.name,n.description,n.inputSchema??{},async(i,a)=>UE(await r({name:n.command,args:i},a.signal)))},K9=(t,e,r)=>{for(let n of e){let{ops:i}=n,a={op:y.enum(Object.keys(i)),...n.inputSchema??{}};Sf(t,n.name,n.description,a,async(o,s)=>{let{op:c,...l}=o;return UE(await r({name:i[String(c)],args:l},s.signal))})}};var pLe=t=>({content:[{type:"text",text:t}],isError:!1});var W9=(t,e,r)=>{for(let n of e){let i={...lr,op:y.enum(n.ops),args:y.record(y.any()).optional()};Sf(t,n.name,n.description,i,async(a,o)=>{let{op:s,projectExId:c,appExId:l,appVersionExId:u,args:p}=a;return UE(await r({name:"schema.ztype_tool_calls",args:{projectExId:c,appExId:l,appVersionExId:u,toolCalls:[{toolCallId:`${n.name}-${String(s)}-${Date.now()}`,name:String(s),args:p??{}}]}},o?.signal))})}},H9=(t,e)=>{let r=Object.keys(Wl);Sf(t,"guide","Load the domain guide for a backend capability \u2014 the rules, conventions, and gotchas for a plugin area (database, type, bindings, actionflow, api, tpa, zai, component, permissions, payments, logs, agent). Returns guidance for the loaded project\u2019s type-system state. Call before editing an unfamiliar area, or when a meta-tool call is rejected.",{plugin:y.enum(r),projectExId:y.string().optional()},async(n,i)=>{let a=await $g(e,n.projectExId,i?.signal);return pLe(z9(String(n.plugin),a))})},Q9=(t,e)=>{Sf(t,"agent_command","Advanced escape hatch for directly invoking an internal agent command.",{name:y.string(),args:y.record(y.any()).optional()},async(r,n)=>UE(await e({name:String(r.name),args:r.args??{}},n.signal)))};d();var fLe={"actionflow.list_node_templates":{description:"List the published preset action-flow integration nodes (the dynamic TEMPLATE_CODE catalog \u2014 e.g. SMS, video/AI generation). Returns each template\u2019s templateCodeId, displayName, group, async flag, and input/output param types. Pass a returned templateCodeId to schema tool-call ADD_ACTION_FLOW_NODE (TEMPLATE_CODE node) to insert it. The set is server-managed and changes over time, so query it rather than assuming a fixed provider.",tool:{name:"list_actionflow_node_templates"},cli:{path:"actionflow list-node-templates"}},"workspace.set":{description:"Set the workspace root for local credentials, daemon registry, and project context.",tool:{name:"set_current_working_directory",inputSchema:{cwd:y.string()}}},"auth.login":{description:"Start browser login and save credentials.",cli:{path:"login"}},"auth.logout":{description:"Delete local credentials and unload schema sessions.",cli:{path:"logout"}},"auth.whoami":{description:"Show the currently authenticated account token payload.",cli:{path:"whoami"}},"auth.reauth":{description:"Delete credentials and start login again.",cli:{path:"reauth"}},"account.profile":{description:"Fetch current account and organization/project-space metadata used for project creation.",tool:{name:"get_account_profile"},cli:{path:"account profile",alias:"account me"}},"projects.search":{description:"List/search projects with pagination.",tool:{name:"get_projects",inputSchema:{projectName:y.string().optional(),cursor:y.string().nullable().optional(),limit:y.number().optional()}},cli:{path:"projects search"}},"projects.list":{description:"List projects.",cli:{path:"projects list"}},"project.create":{description:"Create a new blank project. Defaults to the current account organization and waits for the project to appear in search. Creates a pre- or post-type-system-refactor project automatically based on the account rollout; pass useNewType/useRefactoredComponent to override.",tool:{name:"create_project",inputSchema:{projectName:y.string(),templateExId:y.string().nullable().optional(),platform:y.string().nullable().optional(),projectSpaceType:y.string().optional(),organizationExId:y.string().optional(),category:y.string().nullable().optional(),forBeginnerGuide:y.boolean().optional(),useRefactoredComponent:y.boolean().optional(),useNewType:y.boolean().optional(),wait:y.boolean().optional(),timeoutMs:y.number().optional()}},cli:{path:"project create"}},"project.set_current":{description:"Set the default project context by external id.",tool:{name:"set_current_project",inputSchema:{projectExId:y.string()}},cli:{path:"project set-current"}},"project.get_current":{description:"Get the current project context.",tool:{name:"get_current_project"},cli:{path:"project current",alias:"project get-current"}},"project.detail":{description:"Fetch the Zed project/app detail payload, including app list, project config, latest schema metadata, and deployment info.",cli:{path:"project detail"}},"project.metadata":{description:"Fetch a lean project summary: identity, platforms, publish/deploy state (incl. hasUndeployedChanges), configured integrations, plan, capabilities, and RPS. Pass raw=true for the full unshaped payload.",cli:{path:"project metadata",alias:"project inspect"}},"project.resources":{description:"Fetch project resource consumption, plan/capability limits, RPS stats, and optional resource history.",cli:{path:"project resources"}},"project.rename":{description:"Rename a project.",tool:{name:"rename_project",inputSchema:{...lr,projectName:y.string()}},cli:{path:"project rename"}},"project.rename_app":{description:"Rename an app inside a project.",tool:{name:"rename_project_app",inputSchema:{projectExId:y.string(),appExId:y.string(),appName:y.string()}},cli:{path:"project rename-app"}},"project.delete":{description:"Delete a project. IRREVERSIBLE: requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve. Set MCP_HITL=off to fall back to the confirmProjectExId/force text gate in headless automation.",tool:{name:"delete_project",inputSchema:{projectExId:y.string(),confirmProjectExId:y.string().optional(),force:y.boolean().optional()}},cli:{path:"project delete"}},"project.reset":{description:"Reset a project. IRREVERSIBLE: requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve. Set MCP_HITL=off to fall back to the confirmProjectExId/force text gate in headless automation.",tool:{name:"reset_project",inputSchema:{projectExId:y.string(),confirmProjectExId:y.string().optional(),force:y.boolean().optional(),languageType:y.string().optional()}},cli:{path:"project reset"}},"project.schema_simplified":{description:"Fetch the simplified caught-up server schema. Kept for backwards compatibility.",tool:{name:"get_project_schema",inputSchema:{projectExId:y.string().optional()}}},"project.sync_backend":{description:"Save the schema and deploy/sync the project runtime backend. Returns ztype diagnostics and blocks on backend validation errors by default.",tool:{name:"sync_backend",inputSchema:{...lr,buildTarget:y.string().optional(),validateMultiClient:y.boolean().optional(),allowValidationErrors:y.boolean().optional()}},cli:{path:"project sync-backend",alias:"project deploy-backend"}},"schema.load":{description:"Load a project's CRDT schema into the daemon's in-memory headless schema session.",cli:{path:"schema load"}},"schema.reload":{description:"Force reload a project schema session from the backend CRDT model and patch log.",cli:{path:"schema reload"}},"schema.status":{description:"Show daemon schema sessions and TTL state.",tool:{name:"schema_status"},cli:{path:"schema status"}},"schema.state":{description:"Read the daemon's schema revision, stale state, and latest semantic schema-change event for a project.",cli:{path:"schema state"}},"schema.events":{description:"Read recent semantic schema-change events observed by the daemon for a project.",cli:{path:"schema events"}},"schema.sync":{description:"Catch up schema CRDT patches from the backend for the loaded project session.",cli:{path:"schema sync"}},"schema.snapshot":{description:"Return the data model of the loaded schema (tables, relations, enum types). Pass full=true for the entire raw ZSchema document (UI tree + all server configs), which is much larger.",cli:{path:"schema snapshot"}},"schema.validate":{description:"Run ztype validation/type checks against the loaded schema and return stable/beta/backend diagnostics.",cli:{path:"schema validate",alias:"schema type-check"}},"schema.ztype_tool_calls":{description:"Run ztype Copilot tool calls against the loaded schema. Any resulting CRDT patch is applied immediately; use schema_undo to revert the last change.",tool:{name:"ztype_tool_calls",inputSchema:{...lr,toolCalls:y.array(y.record(y.any())),verbose:y.boolean().optional()}},cli:{path:"schema tool-call",alias:"schema tool-calls"}},"schema.undo":{description:"Undo the most recent schema change made in this session by applying a reverse CRDT patch. Refuses if a concurrent edit touched the same path. Pairs with schema_redo.",tool:{name:"schema_undo",inputSchema:{...lr}},cli:{path:"schema undo"}},"schema.redo":{description:"Re-apply the schema change most recently undone via schema_undo in this session.",tool:{name:"schema_redo",inputSchema:{...lr}},cli:{path:"schema redo"}},"secret.save_value":{description:"Prompt the user (native GUI dialog) to set a secret's plaintext value, store it, and attach the handle so the secret reports hasValue:true. Provide secretId (an existing secret) OR displayName (create a new one). The value is typed into the dialog and never passes through this tool call or the model. Requires a desktop session (fails on headless/SSH/CI).",tool:{name:"save_secret_value",inputSchema:{...lr,secretId:y.string().optional(),displayName:y.string().optional(),description:y.string().optional()}},cli:{path:"secret save-value"}},"runtime.graphql":{description:"Run a raw GraphQL operation against the deployed project's runtime backend (the auto-generated data/actionflow/AI/TPA API), as admin.",tool:{name:"runtime_graphql",inputSchema:{...lr,query:y.string(),variables:y.record(y.any()).optional()}},cli:{path:"runtime graphql"}},"runtime.run_code":{description:"Execute a JavaScript snippet in the deployed project's Run Code sandbox and return its result. Database writes are reverted unless updateDb is true, so this is the cheap way to check what a Run Code node will actually return before wiring it into a flow. Runs on the admin surface, as admin.",tool:{name:"runtime_run_code",inputSchema:{...lr,jsCode:y.string(),args:y.record(y.any()).optional(),updateDb:y.boolean().optional()}},cli:{path:"runtime run-code"}},"runtime.query":{description:"Query rows from a deployed project's runtime table.",cli:{path:"runtime query"}},"runtime.aggregate":{description:"Count rows matching a filter in a deployed project's runtime table \u2014 the cheapest assertion available.",cli:{path:"runtime aggregate"}},"runtime.insert":{description:"Insert one or more rows into a deployed project's runtime table.",cli:{path:"runtime insert"}},"runtime.update":{description:"Update rows in a deployed project's runtime table.",cli:{path:"runtime update"}},"runtime.delete":{description:"Delete rows from a deployed project's runtime table. Requires where unless allowDeleteAll=true.",cli:{path:"runtime delete"}},"logs.search":{description:`Fetch recent runtime logs from the project's log endpoint. Window is \xB15 minutes around requestCreatedAt (ISO-8601, defaults to now). types: GATEWAY, ACTION_FLOW, ACTION_FLOW_NODE, ACTION_FLOW_CONTEXT_LOG, DEPLOYMENT, TPA, TRIGGER, SQL_GENERATION, GQL, ZAI. levels: INFO, WARNING, ERROR. customQueryCondition is an Elasticsearch condition (e.g. 'traceId: "abc-123"').`,tool:{name:"search_logs",inputSchema:{...lr,requestCreatedAt:y.string().optional(),types:y.array(y.string()).optional(),levels:y.array(y.string()).optional(),customQueryCondition:y.string().optional(),limit:y.number().optional()}},cli:{path:"logs search"}},"docs.search":{description:"Full-text search the bundled product documentation. Returns the best-matching pages as { path, title, url }, where url is the public HTTPS docs link you can cite. Use docs.get_page with a returned path to read a page.",tool:{name:"search_docs",inputSchema:{query:y.string(),limit:y.number().optional()}},cli:{path:"docs search"}},"docs.get_page":{description:'Fetch a documentation page as markdown by its path (as returned by docs.search, e.g. "/02_design/01_layout_concepts").',tool:{name:"get_doc_page",inputSchema:{path:y.string()}},cli:{path:"docs get-page"}},"platform.graphql":{description:"Guarded raw GraphQL passthrough to the platform backend (projects, accounts, publishing \u2014 the editor/meta API, not the deployed runtime).",tool:{name:"platform_graphql",inputSchema:{query:y.string(),variables:y.record(y.any()).optional()}},cli:{path:"platform graphql"}},"tpa.import_from_openapi":{description:"Import one or more Third-Party API (TPA) configs from an OpenAPI v3 spec. Provide the spec as a `url` (fetched from this machine) or paste it as `specText` (JSON or YAML). Each operation becomes a TPA endpoint with its request parameters and success/fail response shape. Capped at 25 endpoints per call \u2014 use `pathsFilter` to scope larger specs. On any failure the whole import is rolled back. Duplicates are created (not merged) with a numbered name suffix. Works on every project generation.",tool:{name:"import_tpa_from_openapi",inputSchema:{...lr,url:y.string().optional(),specText:y.string().optional(),pathsFilter:y.array(y.string()).optional()}},cli:{path:"tpa import-from-openapi"}},"tpa.fetch_doc":{description:"Fetch a web page or spec by URL for reading. Returns the page content (HTML converted to Markdown; long pages are windowed \u2014 pass `offset` with the same url to keep reading, guided by `totalLength`/`truncated`), same-site `pageLinks` to explore the documentation further, and any OpenAPI/Swagger `specLinks` found. Explore iteratively by fetching returned links, within a budget of 15 fetches per session (`fetchesRemaining`). Prefer importing a discovered spec via tpa import-from-openapi; otherwise author configs with the granular TPA schema ops.",tool:{name:"fetch_api_doc",inputSchema:{url:y.string(),offset:y.number().optional()}},cli:{path:"tpa fetch-doc"}},"site.deploy":{description:"Deploy a built frontend directory (e.g. ./dist) to the project\u2019s hosted static site and return the live url. Scans the directory, declares the manifest, uploads every asset to object storage, and switches the site over in one call \u2014 the agent never handles checksums or upload urls itself. `target` is BETA (default) or PROD; a PROD deploy takes the site live and requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve, and `force` does NOT approve it. Set MCP_HITL=off to fall back to the confirmProjectExId text gate in headless automation. An interrupted run resumes automatically when the directory is unchanged; pass `force` to discard it and start over. `dryRun` reports what would be uploaded without creating a deployment. The total size must fit the project\u2019s remaining object storage, and the directory must contain an index.html.",tool:{name:"deploy_static_site",inputSchema:{...lr,dir:y.string(),target:y.string().optional(),dryRun:y.boolean().optional(),force:y.boolean().optional(),concurrency:y.number().optional(),confirmProjectExId:y.string().optional()}},cli:{path:"site deploy"}},"site.status":{description:"Report the project\u2019s static site: the currently live deployment (with its url) and any upload still in progress. Use to find the site url, or to see whether an interrupted deploy is still resumable.",tool:{name:"get_static_site_status",inputSchema:{...lr,target:y.string().optional()}},cli:{path:"site status"}},"site.abort":{description:"Abandon an in-progress static site upload and delete whatever it already uploaded. Targets the current in-progress deployment unless `deploymentExId` names one. The live site is untouched.",tool:{name:"abort_static_site_deployment",inputSchema:{...lr,target:y.string().optional(),deploymentExId:y.string().optional()}},cli:{path:"site abort"}}},qE=Object.entries(fLe).map(([t,e])=>({command:t,...e})),Y9=[{name:"schema_session",description:"Schema session lifecycle for the loaded project. op: LOAD (warm the in-memory CRDT session) | RELOAD (force reload from backend) | SYNC (catch up patches) | SNAPSHOT (return the data model: tables, relations, enum types; pass full=true for the entire raw document) | VALIDATE (ztype type checks, stable/beta/backend diagnostics). Edits do not go live until sync_backend.",ops:{LOAD:"schema.load",RELOAD:"schema.reload",SYNC:"schema.sync",SNAPSHOT:"schema.snapshot",VALIDATE:"schema.validate"},inputSchema:{...lr,full:y.boolean().optional()}},{name:"schema_observe",description:"Read the daemon's schema change-state for a project. op: STATE (revision, stale flag, latest change event) | EVENTS (recent semantic schema-change events; afterEventId/limit paginate).",ops:{STATE:"schema.state",EVENTS:"schema.events"},inputSchema:{projectExId:y.string().optional(),afterEventId:y.string().nullable().optional(),limit:y.number().optional()}},{name:"auth",description:"Authentication. op: LOGIN (browser login + save credentials) | LOGOUT (delete credentials, unload sessions) | WHOAMI (show authenticated account token payload) | REAUTH (delete credentials and log in again).",ops:{LOGIN:"auth.login",LOGOUT:"auth.logout",WHOAMI:"auth.whoami",REAUTH:"auth.reauth"}},{name:"project_inspect",description:"Inspect a project. op: DETAIL (app list, project config, latest schema metadata, deployment) | METADATA (plan/capability, deployment, app list, schema metadata, RPS summary) | RESOURCES (resource consumption, plan limits, RPS, optional history). includeSecrets applies to DETAIL/METADATA; refresh/resourceType/nonRealTimeDisplayedResourceTypes apply to RESOURCES.",ops:{DETAIL:"project.detail",METADATA:"project.metadata",RESOURCES:"project.resources"},inputSchema:{...lr,includeSecrets:y.boolean().optional(),refresh:y.boolean().optional(),resourceType:y.string().optional(),nonRealTimeDisplayedResourceTypes:y.array(y.string()).optional()}}];d();var hLe={schema_table:"database",schema_common:"database",schema_overview:"database",schema_type:"type",schema_binding_inspect:"bindings",schema_create_binding:"bindings",schema_conditional_branch:"bindings",schema_condition_expr:"bindings",schema_request_filter:"bindings",schema_actionflow:"actionflow",schema_actionflow_node:"actionflow",schema_trigger:"actionflow",schema_api:"api",schema_component:"component",schema_design_system:"component",schema_action_menu:"component",schema_permission:"permissions",schema_secret:"tpa",schema_zai_config:"zai",schema_callback:"webhook",schema_payment:"payments"},J9=t=>hLe[t]??(t.includes("tpa")?"tpa":"UNMAPPED"),mLe={database:'Edit the data model \u2014 tables, columns, relations, unique constraints, display names. op is a schema ToolName from the enum; args is its payload. Call guide {plugin:"database"} first for the rules and per-op arg shapes.',type:'Edit enums and object/custom type definitions (post-type-system-refactor only). op is a schema ToolName; args is its payload. Call guide {plugin:"type"} for the rules and arg shapes.',bindings:'Create and edit data bindings \u2014 option/const/formula/conditional bindings, boolean condition expressions, and request filters (where + sort), all addressed by schemaPath. op is a schema ToolName; args is its payload. Call guide {plugin:"bindings"} for the rules and arg shapes.',actionflow:'Edit server-side action flows \u2014 flows, nodes, branches, I/O, global variables, and triggers (scheduled / database-change). op is a schema ToolName; args is its payload. Call guide {plugin:"actionflow"} for the rules and arg shapes.',api:'Edit the API-integration library \u2014 workspaces, APIs, request parameters, response configs, input variables, and workspace constants. op is a schema ToolName; args is its payload. Call guide {plugin:"api"} for the rules and arg shapes.',tpa:'Edit third-party API (TPA) configs used by the action-flow Call API node \u2014 configs, parameters, nested response trees, and paging. op is a schema ToolName; args is its payload. Call guide {plugin:"tpa"} for the rules and arg shapes.',zai:'Edit ZAI AI-agent configs \u2014 agents, input args, and model settings. op is a schema ToolName; args is its payload. Call guide {plugin:"zai"} for the rules and arg shapes.',component:'Build and edit the UI \u2014 pages, containers, components, slots, properties, styles and responsive breakpoints, plus the design system (color themes, style scale). op is a schema ToolName; args is its payload. Call guide {plugin:"component"} first for the tree rules, component templates, and per-op arg shapes.',permissions:'Edit roles and their table, API, action-flow, AI, TPA, and payment permissions. op is a schema ToolName; args is its payload. Call guide {plugin:"permissions"} for the rules and arg shapes.',webhook:'Edit incoming HTTP triggers (webhooks, called callbacks in the schema) \u2014 the bound action flow, request and response body shapes, body codecs, and the provider protocol. op is a schema ToolName; args is its payload. Call guide {plugin:"webhook"} for the rules and arg shapes.',payments:'Turn payments on and pick the order table. Provider credentials stay editor-only. op is a schema ToolName; args is its payload. Call guide {plugin:"payments"} for the rules and arg shapes.'},X9=(()=>{let t=new Map;for(let e of jg){let r=J9(e.name);if(r==="UNMAPPED")continue;let n=t.get(r)??new Set;for(let i of Object.values(e.ops))n.add(i);t.set(r,n)}return[...t.entries()].map(([e,r])=>({name:e,description:mLe[e]??`Edit ${e}.`,ops:[...r].sort()})).sort((e,r)=>e.name.localeCompare(r.name))})(),Qet=jg.filter(t=>J9(t.name)==="UNMAPPED").map(t=>t.name);function gLe(){let t=[];for(let e of qE){if(!e.tool)continue;let{name:r,aliases:n,inputSchema:i}=e.tool;t.push({name:r,description:e.description,command:e.command,inputSchema:i});for(let a of n??[])t.push({name:a.name,description:a.description??e.description,command:e.command,inputSchema:i})}return t}function eJ(t,e){Z9(t,gLe(),e),K9(t,Y9,e),W9(t,X9,e),H9(t,e),Q9(t,e)}d();d();var yLe={productName:"Zion",utcOffset:"+08:00",accountTable:"\u5E10\u6237(\u8D26\u6237)",paymentTables:"\u652F\u4ED8, \u5468\u671F\u6027\u652F\u4ED8, \u9000\u6B3E",aiTables:"\u4F1A\u8BDD, \u6D88\u606F, \u5DE5\u5177\u4F7F\u7528\u8BB0\u5F55, \u6D88\u606F\u5185\u5BB9",displayNameRule:'user-visible; use the natural Chinese name as the displayName and derive the English snake_case systemName from it (e.g. displayName "\u7528\u6237\u540D" \u2192 systemName "user_name").',enumDisplayNameRule:'use a natural Chinese phrase (enum displayName "\u8BA2\u5355\u72B6\u6001", option displayName "\u5F85\u5904\u7406"); the enum id and option values stay English.',runtimeGraphqlUrl:t=>pr().zeroApiUrlTemplate.replace("{projectExId}",t)},_Le={productName:"Momen",utcOffset:"+00:00",accountTable:"account",paymentTables:"payment_record, recurring_payment, refund",aiTables:"conversation, message, tool_usage_record, message_content",displayNameRule:'user-visible; prefer it IDENTICAL to the systemName (e.g. systemName "first_name" \u2192 displayName "first_name").',enumDisplayNameRule:'keep it close to the name/value itself (enum displayName \u2248 the enum name, e.g. "OrderStatus"; an option displayName \u2248 its value, e.g. "PENDING").',runtimeGraphqlUrl:t=>pr().zeroApiUrlTemplate.replace("{projectExId}",t)},Hl=()=>{switch(xn){case"MOMEN":return _Le;case"ZION":return yLe;default:throw new Error(`[product-context] unknown PRODUCT '${xn}'`)}};d();function tJ({brand:t,zeroApiUrl:e}){let r=e.replace(/^http:/,"ws:").replace(/^https:/,"wss:").replace("/api/graphql-v2","/api/graphql-subscription");return{brand:t,zeroApiUrl:e,zeroSubscriptionUrl:r}}function rJ(t){let e=t.brand==="Zion"?"Zion apps conventionally sign up / log in by phone number (SMS code); email and username work too.":"Momen apps conventionally sign up / log in by email; phone (SMS code) and username work too.";return`## App-user authentication (for the frontend you generate)
|
|
2696
2696
|
The deployed app's end-users obtain a JWT by logging in / registering against the same GraphQL API;
|
|
2697
2697
|
unauthenticated requests fall back to the anonymous role. Distinct from the developer \`login\` that
|
|
2698
2698
|
authenticates THIS CLI to ${t.brand}. ${e}
|