zion-mcp 2.7.6 → 2.7.7
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-ISAQDS44.js → chunk-IM3M7UTZ.js} +1 -1
- package/dist/{chunk-E6ASVWI5.js → chunk-R72GRU6I.js} +1 -1
- package/dist/chunk-UCLDQIKU.js +3 -0
- package/dist/{corpus-GPYGTVKY.js → corpus-CJ4HEC2R.js} +45 -1
- package/dist/{index.cjs-RT7TSUCM.js → index.cjs-IG5PCKO2.js} +1 -1
- package/dist/{json-crdt-A5YDWM6F.js → json-crdt-FZ6DRYLA.js} +1 -1
- package/dist/{json-crdt-patch-LWAXPXOC.js → json-crdt-patch-6LCNKUXL.js} +1 -1
- package/dist/server.js +9 -9
- package/dist/{ztype-3RHWJVWZ.js → ztype-V7PKOFML.js} +84 -84
- package/package.json +1 -1
- package/dist/chunk-HLU6G2PH.js +0 -3
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 YE,e as Rt,g as d,h as y}from"./chunk-
|
|
3
|
+
import{a as G,c as v,d as YE,e as Rt,g as d,h as y}from"./chunk-UCLDQIKU.js";var nu=v(JE=>{d();var Rh=class extends Error{constructor(e,n,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=n,this.exitCode=e,this.nestedError=void 0}},QE=class extends Rh{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};JE.CommanderError=Rh;JE.InvalidArgumentError=QE});var Dh=v(ev=>{d();var{InvalidArgumentError:u6}=nu(),XE=class{constructor(e,n){switch(this.description=n||"",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,n){return n===this.defaultValue||!Array.isArray(n)?[e]:(n.push(e),n)}default(e,n){return this.defaultValue=e,this.defaultValueDescription=n,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(n,r)=>{if(!this.argChoices.includes(n))throw new u6(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(n,r):n},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function d6(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}ev.Argument=XE;ev.humanReadableArgName=d6});var rv=v(nv=>{d();var{humanReadableArgName:p6}=Dh(),tv=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 n=e.commands.filter(i=>!i._hidden),r=e._getHelpCommand();return r&&!r._hidden&&n.push(r),this.sortSubcommands&&n.sort((i,a)=>i.name().localeCompare(a.name())),n}compareOptions(e,n){let r=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return r(e).localeCompare(r(n))}visibleOptions(e){let n=e.options.filter(i=>!i.hidden),r=e._getHelpOption();if(r&&!r.hidden){let i=r.short&&e._findOption(r.short),a=r.long&&e._findOption(r.long);!i&&!a?n.push(r):r.long&&!a?n.push(e.createOption(r.long,r.description)):r.short&&!i&&n.push(e.createOption(r.short,r.description))}return this.sortOptions&&n.sort(this.compareOptions),n}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let n=[];for(let r=e.parent;r;r=r.parent){let i=r.options.filter(a=>!a.hidden);n.push(...i)}return this.sortOptions&&n.sort(this.compareOptions),n}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(n=>{n.description=n.description||e._argsDescription[n.name()]||""}),e.registeredArguments.find(n=>n.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(r=>p6(r)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(n?" "+n:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,n){return n.visibleCommands(e).reduce((r,i)=>Math.max(r,this.displayWidth(n.styleSubcommandTerm(n.subcommandTerm(i)))),0)}longestOptionTermLength(e,n){return n.visibleOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestGlobalOptionTermLength(e,n){return n.visibleGlobalOptions(e).reduce((r,i)=>Math.max(r,this.displayWidth(n.styleOptionTerm(n.optionTerm(i)))),0)}longestArgumentTermLength(e,n){return n.visibleArguments(e).reduce((r,i)=>Math.max(r,this.displayWidth(n.styleArgumentTerm(n.argumentTerm(i)))),0)}commandUsage(e){let n=e._name;e._aliases[0]&&(n=n+"|"+e._aliases[0]);let r="";for(let i=e.parent;i;i=i.parent)r=i.name()+" "+r;return r+n+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let n=[];if(e.argChoices&&n.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&n.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&n.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&n.push(`env: ${e.envVar}`),n.length>0){let r=`(${n.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}argumentDescription(e){let n=[];if(e.argChoices&&n.push(`choices: ${e.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),e.defaultValue!==void 0&&n.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),n.length>0){let r=`(${n.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatItemList(e,n,r){return n.length===0?[]:[r.styleTitle(e),...n,""]}groupItems(e,n,r){let i=new Map;return e.forEach(a=>{let o=r(a);i.has(o)||i.set(o,[])}),n.forEach(a=>{let o=r(a);i.has(o)||i.set(o,[]),i.get(o).push(a)}),i}formatHelp(e,n){let r=n.padWidth(e,n),i=n.helpWidth??80;function a(p,h){return n.formatItem(p,r,h,n)}let o=[`${n.styleTitle("Usage:")} ${n.styleUsage(n.commandUsage(e))}`,""],s=n.commandDescription(e);s.length>0&&(o=o.concat([n.boxWrap(n.styleCommandDescription(s),i),""]));let c=n.visibleArguments(e).map(p=>a(n.styleArgumentTerm(n.argumentTerm(p)),n.styleArgumentDescription(n.argumentDescription(p))));if(o=o.concat(this.formatItemList("Arguments:",c,n)),this.groupItems(e.options,n.visibleOptions(e),p=>p.helpGroupHeading??"Options:").forEach((p,h)=>{let f=p.map(m=>a(n.styleOptionTerm(n.optionTerm(m)),n.styleOptionDescription(n.optionDescription(m))));o=o.concat(this.formatItemList(h,f,n))}),n.showGlobalOptions){let p=n.visibleGlobalOptions(e).map(h=>a(n.styleOptionTerm(n.optionTerm(h)),n.styleOptionDescription(n.optionDescription(h))));o=o.concat(this.formatItemList("Global Options:",p,n))}return this.groupItems(e.commands,n.visibleCommands(e),p=>p.helpGroup()||"Commands:").forEach((p,h)=>{let f=p.map(m=>a(n.styleSubcommandTerm(n.subcommandTerm(m)),n.styleSubcommandDescription(n.subcommandDescription(m))));o=o.concat(this.formatItemList(h,f,n))}),o.join(`
|
|
4
4
|
`)}displayWidth(e){return Sx(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(n=>n==="[options]"?this.styleOptionText(n):n==="[command]"?this.styleSubcommandText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleCommandText(n)).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(n=>n==="[options]"?this.styleOptionText(n):n[0]==="["||n[0]==="<"?this.styleArgumentText(n):this.styleSubcommandText(n)).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,n){return Math.max(n.longestOptionTermLength(e,n),n.longestGlobalOptionTermLength(e,n),n.longestSubcommandTermLength(e,n),n.longestArgumentTermLength(e,n))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,n,r,i){let o=" ".repeat(2);if(!r)return o+e;let s=e.padEnd(n+e.length-i.displayWidth(e)),c=2,u=(this.helpWidth??80)-n-c-2,p;return u<this.minWidthToWrap||i.preformatted(r)?p=r:p=i.boxWrap(r,u).replace(/\n/g,`
|
|
5
5
|
`+" ".repeat(n+c)),o+s+" ".repeat(c)+p.replace(/\n/g,`
|
|
6
6
|
${o}`)}boxWrap(e,n){if(n<this.minWidthToWrap)return e;let r=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,a=[];return r.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<=n){c.push(u),l+=p;return}a.push(c.join(""));let h=u.trimStart();c=[h],l=this.displayWidth(h)}),a.push(c.join(""))}),a.join(`
|
|
@@ -1484,7 +1484,7 @@ ${String(t)}`)}catch(e){return e}},vq=t=>{if(typeof t!="object"||t===null)throw
|
|
|
1484
1484
|
}
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
|
-
`;d();import{randomUUID as uge}from"crypto";var yV=Rt(V1(),1);d();var Xme=Rt($B(),1),ege=Rt(_g(),1),tge=Rt(Wc(),1),nge=Rt(nA(),1),rge=Rt(aA(),1),ige=Rt(dA(),1),HB=Rt(bg(),1),age=Rt(ZB(),1);var KB=HB.default;d();var YB=100*1024*1024,wg=class{current=Promise.resolve();async run(e){let n=this.current,r=()=>{};this.current=new Promise(i=>{r=i}),await n;try{return await e()}finally{r()}}},nV=async t=>{let e=await fetch(t);if(!e.ok)throw new Error(`Failed to download CRDT model: ${e.status} ${e.statusText}`);let n=e.body?.getReader();if(!n)throw new Error("Failed to read CRDT model response body");let r=[],i=0;for(;;){let{done:s,value:c}=await n.read();if(s)break;if(i+=c.length,i>YB)throw new Error(`CRDT model is larger than ${YB} bytes`);r.push(c)}let a=new Uint8Array(i),o=0;for(let s of r)a.set(s,o),o+=s.length;return a},xd=async(t,e)=>{try{return await e()}catch(n){return F.warn(`Optional runtime package unavailable: ${t}`,n.message),null}},QB=null,Ti=async()=>(QB??=xd("@functorz/ztype",()=>import("./ztype-3RHWJVWZ.js")).then(t=>(t?.default??t)?.com?.functorz?.ztype??null),QB),JB=null,rV=async()=>(JB??=xd("@functorz/ztype",()=>import("./ztype-3RHWJVWZ.js")).then(t=>(t?.default??t)?.kotlin?.collections??null),JB),XB=null,iV=async()=>(XB??=Ti().then(t=>t?.typesystem?.schema?.SCHEMA_VERSION??null),XB),eV=null,Ig=async()=>(eV??=xd("@functorz/crdt-helper",()=>import("./index.cjs-RT7TSUCM.js")).then(t=>t?.Crdt??t?.default?.Crdt??null),eV),tV=null,aV=async()=>(tV??=xd("json-joy/lib/json-crdt-patch/index.js",()=>import("./json-crdt-patch-LWAXPXOC.js")).then(t=>t??xd("json-joy/lib/json-crdt/index.js",()=>import("./json-crdt-A5YDWM6F.js"))).then(t=>t?.Patch??t?.default?.Patch??null),tV),hA=t=>t?.lastUploadedSchema??null,fA=t=>[t?.project?.lastDeployedServerSchemaExId,t?.lastDeployedServerSchemaExId,t?.project?.latestDeployedServerSchema?.exId,t?.latestDeployedServerSchema?.exId].find(n=>typeof n=="string"&&n.length>0)??null,mA=t=>t==null?t:structuredClone(t),oV=(t,e)=>t?.appExId?t.appExId:e?.name??"",sV=(t,e)=>{let n=t?.typesystem?.schema?.ClientType;if(n)return e==="WECHAT_MINI_PROGRAM"?n.WECHAT_MINI_PROGRAM??n.WECHAT??n.WEB:e==="MOBILE"?n.MOBILE??n.WEB:n.WEB},cV=t=>{let e=t?.typesystem?.schema?.Product?.[Mr];if(!e)throw new Error(`ztype runtime has no Product enum member for ${Mr}`);return e},lV=t=>{let e=t?.typesystem?.schema?.Locale?.EN;if(!e)throw new Error("ztype runtime has no Locale enum member for EN");return e},oge=t=>{try{return JSON.parse(JSON.stringify(t))}catch{return String(t)}},Ag=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:oge(t?.fullPath??[])}),Og=t=>t.stableErrors.concat(t.betaErrors).filter(e=>!!e.isBackendError),uV=t=>Og(t).length,dV=(t,e)=>{if(e.__typename==="DiffItem"){let n=e.pathComponents?.at(-1)?.key??"";if(e.operation==="delete"){delete t[n];return}t[n]=structuredClone(e.newValue);return}if(e.__typename==="ArrayDiffItem"){let n=e.pathComponents?.at(-1)?.index??-1;if(!Array.isArray(t)||n<0)throw new Error("Invalid array diff target");if(e.operation==="delete"){t.splice(n,1);return}if(e.operation==="insert"){t.splice(n,0,structuredClone(e.newValue));return}t[n]=structuredClone(e.newValue)}};d();var hV=Rt(pu(),1);import{createRequire as sge}from"module";import{fileURLToPath as cge}from"url";import pV from"path";var fV=sge(import.meta.url),Xi=typeof y>"u"?void 0:y,mV=()=>{if(Xi)return{version:Xi.agent};try{let t=pV.resolve(pV.dirname(cge(import.meta.url)),"../../package.json");return fV(t)}catch{return{}}},gA=()=>mV().version??"0.0.0",Ng=t=>{if(Xi){if(t==="@functorz/ztype")return Xi.ztype;if(t==="@functorz/crdt-helper")return Xi.crdtHelper;if(t==="json-joy")return Xi.jsonJoy}try{let e=fV(`${t}/package.json`);return e.ztypeBuild??e.version??"unknown"}catch{return"unavailable"}},lge=async()=>{if(Xi)return{ztypeVersion:Xi.ztype,ztypeSchemaVersion:Xi.ztypeSchemaVersion};try{let t=await Ti();return{ztypeVersion:Ng("@functorz/ztype"),ztypeSchemaVersion:t?.ZTypeSystem?.getSchemaVersion?.()??"unknown"}}catch{return{ztypeVersion:Ng("@functorz/ztype"),ztypeSchemaVersion:"unavailable"}}};async function yA(){let t=mV(),e=await lge();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:Ng("@functorz/crdt-helper"),jsonJoyVersion:Ng("json-joy")}}async function Jc(t,e){let[n,r,i]=await Promise.all([yA(),_i(t),t.loadCredentials()]),a=i?hV.default.decode(i.access_token):null,o=typeof a=="object"&&a!==null?String(a.sub??a.exId??a.id??"authenticated"):"anonymous";return{...n,product:Xe,apiBaseUrl:r.apiBaseUrl,authUserId:o,workspaceRoot:t.getWorkspaceRoot(),typeSystemMode:tc(),startupFlags:[...e].sort()}}function gV(t,e){return JSON.stringify(t)===JSON.stringify(e)}var _A=uge(),_V=`${Xe}/${gA()}`,dge=t=>{if(!t)return t;if(Array.isArray(t))return t.map(([n,r])=>[n,String(n).toLowerCase()==="authorization"?"Bearer <redacted>":r]);if(typeof t=="object"&&"forEach"in t&&typeof t.forEach=="function"){let n={};return t.forEach((r,i)=>{n[i]=i.toLowerCase()==="authorization"?"Bearer <redacted>":String(r)}),n}let e={};for(let[n,r]of Object.entries(t))e[n]=n.toLowerCase()==="authorization"?"Bearer <redacted>":String(r);return e};function EA(t){if(!Array.isArray(t)||t.length===0)return null;let e=t.map(n=>{let r=n,i=typeof r.operation=="string"?r.operation:null,a=typeof r.errorType=="string"?r.errorType:typeof r.extensions?.classification=="string"?r.extensions.classification:null,o=typeof r.message=="string"?r.message:null;return!o&&!i&&!a?null:`${i?`${i}: `:""}${o??"GraphQL error"}${a?` (${a})`:""}`}).filter(n=>!!n);return e.length>0?e.join("; "):null}var pge=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>"}},Xc=async(t,e)=>{let n=mf();F.debug(`[HTTP] Request URL: ${t.toString()}`),e?.headers&&F.debug(`[HTTP] Request Headers: ${JSON.stringify(dge(e.headers))}`),n&&e?.body!=null&&F.debug(`[GQL] Request Body: ${pge(e.body)}`);let r=await fetch(t,e),i=null;try{i=await r.clone().text()}catch(a){F.debug(`[GQL] Response read failed: ${String(a)}`)}if(n&&F.debug(`[GQL] Response ${r.status}: ${i??"<read failed>"}`),i&&i.includes('"errors"')){let a=null;try{a=JSON.parse(i).errors}catch{a=null}let o=EA(a);o&&F.warn(`[GQL] ${r.status} errors: ${o}`)}return r};async function vA(t,e){let n=await t.getValidToken(),r=await _i(e),i={Authorization:`Bearer ${n}`,"User-Locale":"en_US","X-SESSION-ID":_A,"X-Client":_V},a=await iV();return a&&(i["X-ZED-VERSION"]=a),process.env.REACT_APP_VERSION&&(i["X-REACT-APP-VERSION"]=process.env.REACT_APP_VERSION),new tn(`${r.apiBaseUrl}/api/graphql`,{headers:i,fetch:Xc})}async function EV(t,e){let n=await t.getValidToken(),i=`${(await _i(e)).apiBaseUrl.replace(/^http:/,"ws:").replace(/^https:/,"wss:")}/api/graphql-subscription`;return async(a,o,s)=>{let c=mf(),l={authToken:n,"X-SESSION-ID":_A,"X-Client":_V};F.debug(`[SUB] connecting ${i} params=${JSON.stringify({...l,authToken:"Bearer <redacted>"})}`);let u=new yV.SubscriptionClient(i,{lazy:!0,reconnect:!0,minTimeout:3e3,connectionParams:l},KB);u.onConnected(()=>F.debug("[SUB] connected")),u.onReconnected(()=>F.debug("[SUB] reconnected")),u.onDisconnected(()=>F.debug("[SUB] disconnected")),u.onError(f=>F.debug(`[SUB] error ${f?.message??String(f)}`));let h=[{name:"onNewCrdtPatchV2",query:Xq,variables:{projectExId:a.projectExId,appExId:a.appExId??null,versionExId:a.appVersionExId??null,latestPatchExIdInClient:o}},{name:"onSchemaUploadV3",query:eG,variables:{projectExId:a.projectExId,appExId:a.appExId??null,appVersionExId:a.appVersionExId??null}}].map(f=>(F.debug(`[SUB] subscribe ${f.name} vars=${JSON.stringify(f.variables)}`),u.request({query:f.query,variables:f.variables}).subscribe({next:m=>{c&&F.debug(`[SUB] ${f.name} event: ${JSON.stringify(m)}`),s()},error:m=>{F.warn("Schema subscription event failed",String(m)),s()}})));return{unsubscribe(){for(let f of h)f.unsubscribe();u.close(!1,!1)}}}}async function vV(t,e){if(e.projectExId)return await t.saveProjectContext(e.projectExId),e.projectExId;let n=await t.loadProjectContext();if(!n?.projectExId)throw new Error("No projectExId provided and no current project is set");return n.projectExId}async function TA(t,e,n,r){try{await t.request(gG,{projectExId:e,client:Xe,clientVersion:gA(),sessionId:r??_A,agent:n??null}),F.debug(`[agent-session] started for project ${e}`)}catch(i){F.debug(`[agent-session] skipped: ${String(i)}`)}}d();d();d();import{createHash as hge}from"crypto";var fge=t=>!!(t&&typeof t=="object"&&!Array.isArray(t)),bA=t=>{if(Array.isArray(t))return t.map(n=>n===void 0?null:bA(n));if(!fge(t))return t;let e={};for(let n of Object.keys(t).sort()){let r=t[n];r!==void 0&&(e[n]=bA(r))}return e},mge=t=>JSON.stringify(bA(t)),gge=t=>hge("sha256").update(mge(t)).digest("hex"),TV=t=>({projectExId:t.projectExId,appExId:t.appExId??null,appVersionExId:t.appVersionExId??null,schemaExId:t.schemaExId??null,lastPatchExId:t.lastPatchExId??null,snapshotHash:gge(t.snapshot),deployedSchemaExId:t.deployedSchemaExId??null,checkedAt:t.checkedAt??new Date().toISOString()}),bV=(t,e)=>!t||!e?t!==e:t.schemaExId!==e.schemaExId||t.lastPatchExId!==e.lastPatchExId||t.snapshotHash!==e.snapshotHash||t.deployedSchemaExId!==e.deployedSchemaExId,Cg=t=>t.changes.length>0;var SV=null,yge=()=>(SV??=Ti().then(t=>{let e=t?.typesystem?.schema?.diff?.computeSemanticSchemaChanges;return typeof e=="function"?e:null}),SV),SA=async(t,e)=>{let n=await yge();return n?n(t,e):{changes:[]}};d();var _ge="Functorz";function wV(t,e,n,r){let i=t?.typesystem?.settings,a=t?.typesystem?.schema,o=t?.api?.ZTypeCoreApi,s=e?.KtList,c=e?.KtMap;if(!i?.ExtraContext||!a?.CustomChatModelDescriptor||!a?.AIModelDescriptors||!a?.ActionFlowTemplateCodeDescriptor||!a?.GeneralInputVariable||!a?.InputVariableCategory||!a?.Locale||!o||!s||!c)return F.warn("ztype ExtraContext symbols missing; schema graph will be built without custom models or AF templates"),null;try{let{ExtraContext:l}=i,{AIModelDescriptors:u,ActionFlowTemplateCodeDescriptor:p,Locale:h,CustomChatModelDescriptor:f,CustomEmbeddingModelDescriptor:m,ModelCustomParamDescriptor:_,CustomModelParam:E,CustomChatCompletionFeatures:T,Identifier:b,MediaOutputCardinality:S,Variable:A,GeneralInputVariable:I,InputVariableCategory:N}=a,x=K=>c.fromJsMap(new Map(Object.entries(K??{}))),R=K=>typeof K=="string"?K==="single"?S.SINGLE:K==="multiple"?S.MULTIPLE:S.NONE:typeof K=="boolean"&&K?S.MULTIPLE:S.NONE,ie=K=>new _(K.name,x(K.displayName),K.type,x(K.description)),oe=K=>new E(ie(K.serverUrl),ie(K.apiToken),s.fromJsArray((K.extensionParams??[]).map(It=>new _(It.name,x(It.displayName),It.type,x(It.displayName))))),Ne=K=>K.provider===_ge&&K.customModelIdentifier?new b(K.customModelIdentifier.id,K.customModelIdentifier.namespace):null,O=K=>c.fromJsMap(new Map((K??[]).filter(It=>It!=null).map(It=>[It.name,new I(It.name,null,It.type,null,N.GENERAL,!It.required,It.defaultValue==null?null:o.parseDataBindingFromJsObject(It.defaultValue))]))),ue=K=>c.fromJsMap(new Map((K??[]).filter(It=>It!=null).map(It=>[It.name,new A(It.type,null,!It.required,null,null,null,null,It.defaultValue==null?null:o.parseDataBindingFromJsObject(It.defaultValue))]))),ut=(n?.chatModelDescriptors??[]).map(K=>new f(K.provider,K.name,oe(K.paramToConfigure),K.delisted,new T(K.features.streamResponse,K.features.multiModal,K.features.imageInput??!1,!1,K.features.videoInput??!1,K.features.imageMessageInput??!1,!1,K.features.videoMessageInput??!1,K.features.tools,K.features.reasoningContent,K.features.imageOutput,K.features.videoOutput,R(K.features.imageOutput),R(K.features.videoOutput),null,K.features.structuredOutput),Ne(K))),lr=(n?.embeddingModelDescriptors??[]).map(K=>new m(K.provider,K.name,oe(K.paramToConfigure),Ne(K),K.delisted)),KE=c.fromJsMap(new Map((r??[]).map(K=>[K.exId,new p(K.exId,c.fromJsMap(new Map([[h.EN,K.displayName??""]])),K.logoUrl??"",s.fromJsArray([K.templateGroup??""]),K.async,O(K.inputType),ue(K.outputType))])));return new l(new u(s.fromJsArray(ut),s.fromJsArray(lr)),KE)}catch(l){return F.warn("ztype ExtraContext construction failed; schema graph will be built without custom models or AF templates",l.message),null}}d();var Xo=class extends Error{constructor(n,r){super(n);this.diagnostics=r;this.name="ZtypeValidationError"}};d();function Pg(t,e,n){let r=sV(t,n?.appType);return t.api.ZTypeCoreApi.genZTypeApiContext(e,cV(t),r,oV(n,r),lV(t),null)}d();var IV={QUERY:"query",MUTATION:"mutation"},AV={SUCCESS:"2xx",PERMANENT_FAIL:"4xx",TEMPORARY_FAIL:"5xx"};function OV(t){let e=n=>{if(Array.isArray(n))return n.map(e);if(n&&typeof n=="object"){let r={};for(let[i,a]of Object.entries(n))i==="operation"&&typeof a=="string"&&IV[a]!==void 0?r[i]=IV[a]:i==="responseBranch"&&typeof a=="string"&&AV[a]!==void 0?r[i]=AV[a]:r[i]=e(a);return r}return n};return t.map(e)}function NV(t){let e=n=>typeof n=="string"&&!n.startsWith("http://")&&!n.startsWith("https://");for(let n of t){let r=n;if(!r?.args||typeof r.args!="object")continue;let i=r.args,a=[];if(r.name==="UPDATE_TPA_CONFIG")a.push(i.url);else if(r.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 Zr=t=>t==null,Ege=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),CV=t=>{if(Ege(t)){if(!Zr(t.id))return{key:"id",value:t.id};if(!Zr(t.uniqueId))return{key:"uniqueId",value:t.uniqueId};if(!Zr(t.mRef))return{key:"mRef",value:t.mRef}}},wA=(t,e)=>{if(Zr(t)&&Zr(e)||t===e)return!0;if(Zr(t)||Zr(e)||typeof t!="object"||typeof e!="object")return!1;let n=t,r=e,i=new Set([...Object.keys(n),...Object.keys(r)]);for(let a of i)if(!wA(n[a],r[a]))return!1;return!0},PV=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)}`)},vge=t=>t.key??t.index??"",Tge=(t,e)=>{let n=t;for(let r of e){if(n===null||typeof n!="object")return;n=n[r]}return n},bge=(t,e)=>{if(e.__typename!=="DiffItem")return null;let n=e.pathComponents.at(-1)?.key;if(n===void 0)return null;let r=CV(t[n]),i=r===void 0?wA(t[n],e.oldValue):r.value===e.oldValue?.[r.key];switch(e.operation){case"add":t[n]=e.newValue;break;case"update":if(!i)return null;t[n]=e.newValue;break;case"delete":if(!Object.prototype.hasOwnProperty.call(t,n)||!i)return null;delete t[n];break;default:return null}return e},Sge=(t,e)=>{if(e.__typename!=="ArrayDiffItem")return null;let n=e.pathComponents.at(-1)?.index;if(n===void 0||n>t.length)return null;let r=()=>{let i=CV(t[n]);return i===void 0?wA(t[n],e.oldValue):i.value===e.oldValue?.[i.key]};switch(e.operation){case"insert":t.splice(n,0,e.newValue);break;case"delete":if(!r())return null;t.splice(n,1);break;case"update":if(!r())return null;t.splice(n,1,e.newValue);break;default:return null}return e},RV=(t,e)=>{let n=t,r=new WeakSet,i=o=>{if(n===null||typeof n!="object")return n;r.has(n)||(n=Array.isArray(n)?[...n]:{...n},r.add(n));let s=n;for(let c of o){let l=s[c];if(l!==null&&typeof l=="object"){if(!r.has(l)){let u=Array.isArray(l)?[...l]:{...l};r.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(vge).slice(0,-1);if(Zr(Tge(n,c)))continue;let l=i(c);if(Array.isArray(l)){let u=Sge(l,o);u&&a.push(u)}else if(l!==null&&typeof l=="object"){let u=bge(l,o);u&&a.push(u)}}catch{continue}return a};d();var wge=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=>{F.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())},wge),this.timer.unref())}async run(){if(!this.running){this.running=!0;try{await this.options.refresh()}finally{this.running=!1}}}};d();d();var g={};YE(g,{BRAND:()=>Yge,DIRTY:()=>es,EMPTY_PATH:()=>Nge,INVALID:()=>ce,NEVER:()=>xye,OK:()=>En,ParseStatus:()=>on,Schema:()=>Te,ZodAny:()=>Fa,ZodArray:()=>ra,ZodBigInt:()=>ns,ZodBoolean:()=>rs,ZodBranded:()=>kd,ZodCatch:()=>fs,ZodDate:()=>is,ZodDefault:()=>hs,ZodDiscriminatedUnion:()=>Lg,ZodEffects:()=>Ir,ZodEnum:()=>ds,ZodError:()=>Fn,ZodFirstPartyTypeKind:()=>k,ZodFunction:()=>Mg,ZodIntersection:()=>cs,ZodIssueCode:()=>L,ZodLazy:()=>ls,ZodLiteral:()=>us,ZodMap:()=>al,ZodNaN:()=>sl,ZodNativeEnum:()=>ps,ZodNever:()=>Hr,ZodNull:()=>os,ZodNullable:()=>wi,ZodNumber:()=>ts,ZodObject:()=>Gn,ZodOptional:()=>qn,ZodParsedType:()=>q,ZodPipeline:()=>Md,ZodPromise:()=>qa,ZodReadonly:()=>ms,ZodRecord:()=>kg,ZodSchema:()=>Te,ZodSet:()=>ol,ZodString:()=>$a,ZodSymbol:()=>rl,ZodTransformer:()=>Ir,ZodTuple:()=>Si,ZodType:()=>Te,ZodUndefined:()=>as,ZodUnion:()=>ss,ZodUnknown:()=>na,ZodVoid:()=>il,addIssueToContext:()=>$,any:()=>aye,array:()=>lye,bigint:()=>eye,boolean:()=>GV,coerce:()=>Dye,custom:()=>$V,date:()=>tye,datetimeRegex:()=>jV,defaultErrorMap:()=>ea,discriminatedUnion:()=>pye,effect:()=>wye,enum:()=>Tye,function:()=>_ye,getErrorMap:()=>el,getParsedType:()=>bi,instanceof:()=>Jge,intersection:()=>hye,isAborted:()=>Dg,isAsync:()=>tl,isDirty:()=>xg,isValid:()=>Ua,late:()=>Qge,lazy:()=>Eye,literal:()=>vye,makeIssue:()=>Ld,map:()=>gye,nan:()=>Xge,nativeEnum:()=>bye,never:()=>sye,null:()=>iye,nullable:()=>Aye,number:()=>qV,object:()=>NA,objectUtil:()=>IA,oboolean:()=>Rye,onumber:()=>Pye,optional:()=>Iye,ostring:()=>Cye,pipeline:()=>Nye,preprocess:()=>Oye,promise:()=>Sye,quotelessJson:()=>Ige,record:()=>mye,set:()=>yye,setErrorMap:()=>Oge,strictObject:()=>uye,string:()=>FV,symbol:()=>nye,transformer:()=>wye,tuple:()=>fye,undefined:()=>rye,union:()=>dye,unknown:()=>oye,util:()=>Ae,void:()=>cye});d();d();d();d();d();var Ae;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,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 r(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Ae||(Ae={}));var IA;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(IA||(IA={}));var q=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bi=t=>{switch(typeof t){case"undefined":return q.undefined;case"string":return q.string;case"number":return Number.isNaN(t)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(t)?q.array:t===null?q.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?q.promise:typeof Map<"u"&&t instanceof Map?q.map:typeof Set<"u"&&t instanceof Set?q.set:typeof Date<"u"&&t instanceof Date?q.date:q.object;default:return q.unknown}};var L=Ae.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"]),Ige=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Fn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(a){return a.message},r={_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)r._errors.push(n(o));else{let s=r,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(n(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return i(this),r}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,Ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Fn.create=t=>new Fn(t);var Age=(t,e)=>{let n;switch(t.code){case L.invalid_type:t.received===q.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case L.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ae.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ae.joinValues(t.keys,", ")}`;break;case L.invalid_union:n="Invalid input";break;case L.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ae.joinValues(t.options)}`;break;case L.invalid_enum_value:n=`Invalid enum value. Expected ${Ae.joinValues(t.options)}, received '${t.received}'`;break;case L.invalid_arguments:n="Invalid function arguments";break;case L.invalid_return_type:n="Invalid function return type";break;case L.invalid_date:n="Invalid date";break;case L.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ae.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case L.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case L.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case L.custom:n="Invalid input";break;case L.invalid_intersection_types:n="Intersection results could not be merged";break;case L.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case L.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ae.assertNever(t)}return{message:n}},ea=Age;var DV=ea;function Oge(t){DV=t}function el(){return DV}d();var Ld=t=>{let{data:e,path:n,errorMaps:r,issueData:i}=t,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)s=l(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}},Nge=[];function $(t,e){let n=el(),r=Ld({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ea?void 0:ea].filter(i=>!!i)});t.common.issues.push(r)}var on=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let i of n){if(i.status==="aborted")return ce;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n){let a=await i.key,o=await i.value;r.push({key:a,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return ce;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[a.value]=o.value)}return{status:e.value,value:r}}},ce=Object.freeze({status:"aborted"}),es=t=>({status:"dirty",value:t}),En=t=>({status:"valid",value:t}),Dg=t=>t.status==="aborted",xg=t=>t.status==="dirty",Ua=t=>t.status==="valid",tl=t=>typeof Promise<"u"&&t instanceof Promise;d();d();var Y;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Y||(Y={}));var wr=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,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}},xV=(t,e)=>{if(Ua(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 n=new Fn(t.common.issues);return this._error=n,this._error}}};function _e(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))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??r??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:c??n??s.defaultError}},description:i}}var Te=class{get description(){return this._def.description}_getType(e){return bi(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:bi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new on,ctx:{common:e.parent.common,data:e.data,parsedType:bi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(tl(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)},i=this._parseSync({data:e,path:r.path,parent:r});return xV(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return Ua(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>Ua(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)},i=this._parse({data:e,path:r.path,parent:r}),a=await(tl(i)?i:Promise.resolve(i));return xV(r,a)}refine(e,n){let r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:L.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Ir({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:n=>this["~validate"](n)}}optional(){return qn.create(this,this._def)}nullable(){return wi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ra.create(this)}promise(){return qa.create(this,this._def)}or(e){return ss.create([this,e],this._def)}and(e){return cs.create(this,e,this._def)}transform(e){return new Ir({..._e(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new hs({..._e(this._def),innerType:this,defaultValue:n,typeName:k.ZodDefault})}brand(){return new kd({typeName:k.ZodBranded,type:this,..._e(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new fs({..._e(this._def),innerType:this,catchValue:n,typeName:k.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Md.create(this,e)}readonly(){return ms.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Cge=/^c[^\s-]{8,}$/i,Pge=/^[0-9a-z]+$/,Rge=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Dge=/^[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,xge=/^[a-z0-9_-]{21}$/i,Lge=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,kge=/^[-+]?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)?)??$/,Mge=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jge="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",AA,Uge=/^(?:(?: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])$/,$ge=/^(?:(?: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])$/,Fge=/^(([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]))$/,qge=/^(([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])$/,Gge=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Bge=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kV="((\\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])))",Vge=new RegExp(`^${kV}$`);function MV(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function zge(t){return new RegExp(`^${MV(t)}$`)}function jV(t){let e=`${kV}T${MV(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Wge(t,e){return!!((e==="v4"||!e)&&Uge.test(t)||(e==="v6"||!e)&&Fge.test(t))}function Zge(t,e){if(!Lge.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Hge(t,e){return!!((e==="v4"||!e)&&$ge.test(t)||(e==="v6"||!e)&&qge.test(t))}var $a=class t extends Te{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let a=this._getOrReturnCtx(e);return $(a,{code:L.invalid_type,expected:q.string,received:a.parsedType}),ce}let r=new on,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),$(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),$(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.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?$(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&$(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Mge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"email",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")AA||(AA=new RegExp(jge,"u")),AA.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"emoji",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Dge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"uuid",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")xge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"nanoid",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Cge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"cuid",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Pge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"cuid2",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Rge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"ulid",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),$(i,{validation:"url",code:L.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"regex",code:L.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),$(i,{code:L.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.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),$(i,{code:L.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),$(i,{code:L.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?jV(a).test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{code:L.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?Vge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{code:L.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?zge(a).test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{code:L.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?kge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"duration",code:L.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?Wge(e.data,a.version)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"ip",code:L.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?Zge(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"jwt",code:L.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?Hge(e.data,a.version)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"cidr",code:L.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?Gge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"base64",code:L.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?Bge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"base64url",code:L.invalid_string,message:a.message}),r.dirty()):Ae.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:L.invalid_string,...Y.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Y.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,...Y.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,...Y.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Y.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Y.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Y.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Y.errToObj(n)})}nonempty(e){return this.min(1,Y.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 n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};$a.create=t=>new $a({checks:[],typeName:k.ZodString,coerce:t?.coerce??!1,..._e(t)});function Kge(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var ts=class t extends Te{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)!==q.number){let a=this._getOrReturnCtx(e);return $(a,{code:L.invalid_type,expected:q.number,received:a.parsedType}),ce}let r,i=new on;for(let a of this._def.checks)a.kind==="int"?Ae.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{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)&&(r=this._getOrReturnCtx(e,r),$(r,{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)&&(r=this._getOrReturnCtx(e,r),$(r,{code:L.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?Kge(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),$(r,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{code:L.not_finite,message:a.message}),i.dirty()):Ae.assertNever(a);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Y.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Y.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Y.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Y.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Y.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ae.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};ts.create=t=>new ts({checks:[],typeName:k.ZodNumber,coerce:t?.coerce||!1,..._e(t)});var ns=class t extends Te{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)!==q.bigint)return this._getInvalidInput(e);let r,i=new on;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),$(r,{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)&&(r=this._getOrReturnCtx(e,r),$(r,{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)&&(r=this._getOrReturnCtx(e,r),$(r,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Ae.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return $(n,{code:L.invalid_type,expected:q.bigint,received:n.parsedType}),ce}gte(e,n){return this.setLimit("min",e,!0,Y.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Y.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Y.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Y.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Y.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:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ns.create=t=>new ns({checks:[],typeName:k.ZodBigInt,coerce:t?.coerce??!1,..._e(t)});var rs=class extends Te{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.boolean,received:r.parsedType}),ce}return En(e.data)}};rs.create=t=>new rs({typeName:k.ZodBoolean,coerce:t?.coerce||!1,..._e(t)});var is=class t extends Te{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let a=this._getOrReturnCtx(e);return $(a,{code:L.invalid_type,expected:q.date,received:a.parsedType}),ce}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return $(a,{code:L.invalid_date}),ce}let r=new on,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),$(i,{code:L.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),$(i,{code:L.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):Ae.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};is.create=t=>new is({checks:[],coerce:t?.coerce||!1,typeName:k.ZodDate,..._e(t)});var rl=class extends Te{_parse(e){if(this._getType(e)!==q.symbol){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.symbol,received:r.parsedType}),ce}return En(e.data)}};rl.create=t=>new rl({typeName:k.ZodSymbol,..._e(t)});var as=class extends Te{_parse(e){if(this._getType(e)!==q.undefined){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.undefined,received:r.parsedType}),ce}return En(e.data)}};as.create=t=>new as({typeName:k.ZodUndefined,..._e(t)});var os=class extends Te{_parse(e){if(this._getType(e)!==q.null){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.null,received:r.parsedType}),ce}return En(e.data)}};os.create=t=>new os({typeName:k.ZodNull,..._e(t)});var Fa=class extends Te{constructor(){super(...arguments),this._any=!0}_parse(e){return En(e.data)}};Fa.create=t=>new Fa({typeName:k.ZodAny,..._e(t)});var na=class extends Te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return En(e.data)}};na.create=t=>new na({typeName:k.ZodUnknown,..._e(t)});var Hr=class extends Te{_parse(e){let n=this._getOrReturnCtx(e);return $(n,{code:L.invalid_type,expected:q.never,received:n.parsedType}),ce}};Hr.create=t=>new Hr({typeName:k.ZodNever,..._e(t)});var il=class extends Te{_parse(e){if(this._getType(e)!==q.undefined){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.void,received:r.parsedType}),ce}return En(e.data)}};il.create=t=>new il({typeName:k.ZodVoid,..._e(t)});var ra=class t extends Te{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==q.array)return $(n,{code:L.invalid_type,expected:q.array,received:n.parsedType}),ce;if(i.exactLength!==null){let o=n.data.length>i.exactLength.value,s=n.data.length<i.exactLength.value;(o||s)&&($(n,{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}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&($(n,{code:L.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&($(n,{code:L.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,s)=>i.type._parseAsync(new wr(n,o,n.path,s)))).then(o=>on.mergeArray(r,o));let a=[...n.data].map((o,s)=>i.type._parseSync(new wr(n,o,n.path,s)));return on.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:Y.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:Y.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:Y.toString(n)}})}nonempty(e){return this.min(1,e)}};ra.create=(t,e)=>new ra({type:t,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,..._e(e)});function nl(t){if(t instanceof Gn){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=qn.create(nl(r))}return new Gn({...t._def,shape:()=>e})}else return t instanceof ra?new ra({...t._def,type:nl(t.element)}):t instanceof qn?qn.create(nl(t.unwrap())):t instanceof wi?wi.create(nl(t.unwrap())):t instanceof Si?Si.create(t.items.map(e=>nl(e))):t}var Gn=class t extends Te{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(),n=Ae.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==q.object){let l=this._getOrReturnCtx(e);return $(l,{code:L.invalid_type,expected:q.object,received:l.parsedType}),ce}let{status:r,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Hr&&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 wr(i,p,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Hr){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&&($(i,{code:L.unrecognized_keys,keys:s}),r.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 wr(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,h=await u.value;l.push({key:p,value:h,alwaysSet:u.alwaysSet})}return l}).then(l=>on.mergeObjectSync(r,l)):on.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:Y.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,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of Ae.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of Ae.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return nl(this)}partial(e){let n={};for(let r of Ae.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of Ae.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof qn;)a=a._def.innerType;n[r]=a}return new t({...this._def,shape:()=>n})}keyof(){return UV(Ae.objectKeys(this.shape))}};Gn.create=(t,e)=>new Gn({shape:()=>t,unknownKeys:"strip",catchall:Hr.create(),typeName:k.ZodObject,..._e(e)});Gn.strictCreate=(t,e)=>new Gn({shape:()=>t,unknownKeys:"strict",catchall:Hr.create(),typeName:k.ZodObject,..._e(e)});Gn.lazycreate=(t,e)=>new Gn({shape:t,unknownKeys:"strip",catchall:Hr.create(),typeName:k.ZodObject,..._e(e)});var ss=class extends Te{_parse(e){let{ctx:n}=this._processInputParams(e),r=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 n.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new Fn(s.ctx.common.issues));return $(n,{code:L.invalid_union,unionErrors:o}),ce}if(n.common.async)return Promise.all(r.map(async a=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.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 n.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(c=>new Fn(c));return $(n,{code:L.invalid_union,unionErrors:s}),ce}}get options(){return this._def.options}};ss.create=(t,e)=>new ss({options:t,typeName:k.ZodUnion,..._e(e)});var ta=t=>t instanceof ls?ta(t.schema):t instanceof Ir?ta(t.innerType()):t instanceof us?[t.value]:t instanceof ds?t.options:t instanceof ps?Ae.objectValues(t.enum):t instanceof hs?ta(t._def.innerType):t instanceof as?[void 0]:t instanceof os?[null]:t instanceof qn?[void 0,...ta(t.unwrap())]:t instanceof wi?[null,...ta(t.unwrap())]:t instanceof kd||t instanceof ms?ta(t.unwrap()):t instanceof fs?ta(t._def.innerType):[],Lg=class t extends Te{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.object)return $(n,{code:L.invalid_type,expected:q.object,received:n.parsedType}),ce;let r=this.discriminator,i=n.data[r],a=this.optionsMap.get(i);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):($(n,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ce)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let i=new Map;for(let a of n){let o=ta(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:n,optionsMap:i,..._e(r)})}};function OA(t,e){let n=bi(t),r=bi(e);if(t===e)return{valid:!0,data:t};if(n===q.object&&r===q.object){let i=Ae.objectKeys(e),a=Ae.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let c=OA(t[s],e[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(n===q.array&&r===q.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=OA(o,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return n===q.date&&r===q.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var cs=class extends Te{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(a,o)=>{if(Dg(a)||Dg(o))return ce;let s=OA(a.value,o.value);return s.valid?((xg(a)||xg(o))&&n.dirty(),{status:n.value,value:s.data}):($(r,{code:L.invalid_intersection_types}),ce)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};cs.create=(t,e,n)=>new cs({left:t,right:e,typeName:k.ZodIntersection,..._e(n)});var Si=class t extends Te{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.array)return $(r,{code:L.invalid_type,expected:q.array,received:r.parsedType}),ce;if(r.data.length<this._def.items.length)return $(r,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ce;!this._def.rest&&r.data.length>this._def.items.length&&($(r,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((o,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new wr(r,o,r.path,s)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>on.mergeArray(n,o)):on.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Si.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Si({items:t,typeName:k.ZodTuple,rest:null,..._e(e)})};var kg=class t extends Te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.object)return $(r,{code:L.invalid_type,expected:q.object,received:r.parsedType}),ce;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in r.data)i.push({key:a._parse(new wr(r,s,r.path,s)),value:o._parse(new wr(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?on.mergeObjectAsync(n,i):on.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Te?new t({keyType:e,valueType:n,typeName:k.ZodRecord,..._e(r)}):new t({keyType:$a.create(),valueType:e,typeName:k.ZodRecord,..._e(n)})}},al=class extends Te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.map)return $(r,{code:L.invalid_type,expected:q.map,received:r.parsedType}),ce;let i=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([s,c],l)=>({key:i._parse(new wr(r,s,r.path,[l,"key"])),value:a._parse(new wr(r,c,r.path,[l,"value"]))}));if(r.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 ce;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(l.value,u.value)}return{status:n.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 ce;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(l.value,u.value)}return{status:n.value,value:s}}}};al.create=(t,e,n)=>new al({valueType:e,keyType:t,typeName:k.ZodMap,..._e(n)});var ol=class t extends Te{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.set)return $(r,{code:L.invalid_type,expected:q.set,received:r.parsedType}),ce;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&($(r,{code:L.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&($(r,{code:L.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let a=this._def.valueType;function o(c){let l=new Set;for(let u of c){if(u.status==="aborted")return ce;u.status==="dirty"&&n.dirty(),l.add(u.value)}return{status:n.value,value:l}}let s=[...r.data.values()].map((c,l)=>a._parse(new wr(r,c,r.path,l)));return r.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(e,n){return new t({...this._def,minSize:{value:e,message:Y.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:Y.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};ol.create=(t,e)=>new ol({valueType:t,minSize:null,maxSize:null,typeName:k.ZodSet,..._e(e)});var Mg=class t extends Te{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.function)return $(n,{code:L.invalid_type,expected:q.function,received:n.parsedType}),ce;function r(s,c){return Ld({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,el(),ea].filter(l=>!!l),issueData:{code:L.invalid_arguments,argumentsError:c}})}function i(s,c){return Ld({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,el(),ea].filter(l=>!!l),issueData:{code:L.invalid_return_type,returnTypeError:c}})}let a={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof qa){let s=this;return En(async function(...c){let l=new Fn([]),u=await s._def.args.parseAsync(c,a).catch(f=>{throw l.addIssue(r(c,f)),l}),p=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(p,a).catch(f=>{throw l.addIssue(i(p,f)),l})})}else{let s=this;return En(function(...c){let l=s._def.args.safeParse(c,a);if(!l.success)throw new Fn([r(c,l.error)]);let u=Reflect.apply(o,this,l.data),p=s._def.returns.safeParse(u,a);if(!p.success)throw new Fn([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:Si.create(e).rest(na.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,n,r){return new t({args:e||Si.create([]).rest(na.create()),returns:n||na.create(),typeName:k.ZodFunction,..._e(r)})}},ls=class extends Te{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ls.create=(t,e)=>new ls({getter:t,typeName:k.ZodLazy,..._e(e)});var us=class extends Te{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return $(n,{received:n.data,code:L.invalid_literal,expected:this._def.value}),ce}return{status:"valid",value:e.data}}get value(){return this._def.value}};us.create=(t,e)=>new us({value:t,typeName:k.ZodLiteral,..._e(e)});function UV(t,e){return new ds({values:t,typeName:k.ZodEnum,..._e(e)})}var ds=class t extends Te{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return $(n,{expected:Ae.joinValues(r),received:n.parsedType,code:L.invalid_type}),ce}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return $(n,{received:n.data,code:L.invalid_enum_value,options:r}),ce}return En(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};ds.create=UV;var ps=class extends Te{_parse(e){let n=Ae.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==q.string&&r.parsedType!==q.number){let i=Ae.objectValues(n);return $(r,{expected:Ae.joinValues(i),received:r.parsedType,code:L.invalid_type}),ce}if(this._cache||(this._cache=new Set(Ae.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Ae.objectValues(n);return $(r,{received:r.data,code:L.invalid_enum_value,options:i}),ce}return En(e.data)}get enum(){return this._def.values}};ps.create=(t,e)=>new ps({values:t,typeName:k.ZodNativeEnum,..._e(e)});var qa=class extends Te{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.promise&&n.common.async===!1)return $(n,{code:L.invalid_type,expected:q.promise,received:n.parsedType}),ce;let r=n.parsedType===q.promise?n.data:Promise.resolve(n.data);return En(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};qa.create=(t,e)=>new qa({type:t,typeName:k.ZodPromise,..._e(e)});var Ir=class extends Te{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:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{$(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(r.data,a);if(r.common.async)return Promise.resolve(o).then(async s=>{if(n.value==="aborted")return ce;let c=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return c.status==="aborted"?ce:c.status==="dirty"?es(c.value):n.value==="dirty"?es(c.value):c});{if(n.value==="aborted")return ce;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});return s.status==="aborted"?ce:s.status==="dirty"?es(s.value):n.value==="dirty"?es(s.value):s}}if(i.type==="refinement"){let o=s=>{let c=i.refinement(s,a);if(r.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(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ce:(s.status==="dirty"&&n.dirty(),o(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?ce:(s.status==="dirty"&&n.dirty(),o(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ua(o))return ce;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:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Ua(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:n.value,value:s})):ce);Ae.assertNever(i)}};Ir.create=(t,e,n)=>new Ir({schema:t,typeName:k.ZodEffects,effect:e,..._e(n)});Ir.createWithPreprocess=(t,e,n)=>new Ir({schema:e,effect:{type:"preprocess",transform:t},typeName:k.ZodEffects,..._e(n)});var qn=class extends Te{_parse(e){return this._getType(e)===q.undefined?En(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};qn.create=(t,e)=>new qn({innerType:t,typeName:k.ZodOptional,..._e(e)});var wi=class extends Te{_parse(e){return this._getType(e)===q.null?En(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};wi.create=(t,e)=>new wi({innerType:t,typeName:k.ZodNullable,..._e(e)});var hs=class extends Te{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===q.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};hs.create=(t,e)=>new hs({innerType:t,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._e(e)});var fs=class extends Te{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return tl(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Fn(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Fn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};fs.create=(t,e)=>new fs({innerType:t,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._e(e)});var sl=class extends Te{_parse(e){if(this._getType(e)!==q.nan){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.nan,received:r.parsedType}),ce}return{status:"valid",value:e.data}}};sl.create=t=>new sl({typeName:k.ZodNaN,..._e(t)});var Yge=Symbol("zod_brand"),kd=class extends Te{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Md=class t extends Te{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ce:a.status==="dirty"?(n.dirty(),es(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ce:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:k.ZodPipeline})}},ms=class extends Te{_parse(e){let n=this._def.innerType._parse(e),r=i=>(Ua(i)&&(i.value=Object.freeze(i.value)),i);return tl(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};ms.create=(t,e)=>new ms({innerType:t,typeName:k.ZodReadonly,..._e(e)});function LV(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function $V(t,e={},n){return t?Fa.create().superRefine((r,i)=>{let a=t(r);if(a instanceof Promise)return a.then(o=>{if(!o){let s=LV(e,r),c=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:c})}});if(!a){let o=LV(e,r),s=o.fatal??n??!0;i.addIssue({code:"custom",...o,fatal:s})}}):Fa.create()}var Qge={object:Gn.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 Jge=(t,e={message:`Input not instance of ${t.name}`})=>$V(n=>n instanceof t,e),FV=$a.create,qV=ts.create,Xge=sl.create,eye=ns.create,GV=rs.create,tye=is.create,nye=rl.create,rye=as.create,iye=os.create,aye=Fa.create,oye=na.create,sye=Hr.create,cye=il.create,lye=ra.create,NA=Gn.create,uye=Gn.strictCreate,dye=ss.create,pye=Lg.create,hye=cs.create,fye=Si.create,mye=kg.create,gye=al.create,yye=ol.create,_ye=Mg.create,Eye=ls.create,vye=us.create,Tye=ds.create,bye=ps.create,Sye=qa.create,wye=Ir.create,Iye=qn.create,Aye=wi.create,Oye=Ir.createWithPreprocess,Nye=Md.create,Cye=()=>FV().optional(),Pye=()=>qV().optional(),Rye=()=>GV().optional(),Dye={string:(t=>$a.create({...t,coerce:!0})),number:(t=>ts.create({...t,coerce:!0})),boolean:(t=>rs.create({...t,coerce:!0})),bigint:(t=>ns.create({...t,coerce:!0})),date:(t=>is.create({...t,coerce:!0}))};var xye=ce;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. A leaf's `kind` is what you send to ADD_COMPONENT_ACTIONS to attach it. A leaf with no `kind` cannot be attached by that tool at all \u2014 say so and let the user add it in the editor, rather than attaching some other action that looks close. `kind` is necessary but not sufficient: one kind can cover several eventTypes and may not be able to express the one you want, so if the write is refused, follow that error instead of substituting a different action.",ops:{GET_SELECTABLE_COMPONENT_ACTIONS:"GET_SELECTABLE_COMPONENT_ACTIONS"},inputSchema:{componentId:g.string().optional(),eventType:g.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.
|
|
1487
|
+
`;d();import{randomUUID as uge}from"crypto";var yV=Rt(V1(),1);d();var Xme=Rt($B(),1),ege=Rt(_g(),1),tge=Rt(Wc(),1),nge=Rt(nA(),1),rge=Rt(aA(),1),ige=Rt(dA(),1),HB=Rt(bg(),1),age=Rt(ZB(),1);var KB=HB.default;d();var YB=100*1024*1024,wg=class{current=Promise.resolve();async run(e){let n=this.current,r=()=>{};this.current=new Promise(i=>{r=i}),await n;try{return await e()}finally{r()}}},nV=async t=>{let e=await fetch(t);if(!e.ok)throw new Error(`Failed to download CRDT model: ${e.status} ${e.statusText}`);let n=e.body?.getReader();if(!n)throw new Error("Failed to read CRDT model response body");let r=[],i=0;for(;;){let{done:s,value:c}=await n.read();if(s)break;if(i+=c.length,i>YB)throw new Error(`CRDT model is larger than ${YB} bytes`);r.push(c)}let a=new Uint8Array(i),o=0;for(let s of r)a.set(s,o),o+=s.length;return a},xd=async(t,e)=>{try{return await e()}catch(n){return F.warn(`Optional runtime package unavailable: ${t}`,n.message),null}},QB=null,Ti=async()=>(QB??=xd("@functorz/ztype",()=>import("./ztype-V7PKOFML.js")).then(t=>(t?.default??t)?.com?.functorz?.ztype??null),QB),JB=null,rV=async()=>(JB??=xd("@functorz/ztype",()=>import("./ztype-V7PKOFML.js")).then(t=>(t?.default??t)?.kotlin?.collections??null),JB),XB=null,iV=async()=>(XB??=Ti().then(t=>t?.typesystem?.schema?.SCHEMA_VERSION??null),XB),eV=null,Ig=async()=>(eV??=xd("@functorz/crdt-helper",()=>import("./index.cjs-IG5PCKO2.js")).then(t=>t?.Crdt??t?.default?.Crdt??null),eV),tV=null,aV=async()=>(tV??=xd("json-joy/lib/json-crdt-patch/index.js",()=>import("./json-crdt-patch-6LCNKUXL.js")).then(t=>t??xd("json-joy/lib/json-crdt/index.js",()=>import("./json-crdt-FZ6DRYLA.js"))).then(t=>t?.Patch??t?.default?.Patch??null),tV),hA=t=>t?.lastUploadedSchema??null,fA=t=>[t?.project?.lastDeployedServerSchemaExId,t?.lastDeployedServerSchemaExId,t?.project?.latestDeployedServerSchema?.exId,t?.latestDeployedServerSchema?.exId].find(n=>typeof n=="string"&&n.length>0)??null,mA=t=>t==null?t:structuredClone(t),oV=(t,e)=>t?.appExId?t.appExId:e?.name??"",sV=(t,e)=>{let n=t?.typesystem?.schema?.ClientType;if(n)return e==="WECHAT_MINI_PROGRAM"?n.WECHAT_MINI_PROGRAM??n.WECHAT??n.WEB:e==="MOBILE"?n.MOBILE??n.WEB:n.WEB},cV=t=>{let e=t?.typesystem?.schema?.Product?.[Mr];if(!e)throw new Error(`ztype runtime has no Product enum member for ${Mr}`);return e},lV=t=>{let e=t?.typesystem?.schema?.Locale?.EN;if(!e)throw new Error("ztype runtime has no Locale enum member for EN");return e},oge=t=>{try{return JSON.parse(JSON.stringify(t))}catch{return String(t)}},Ag=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:oge(t?.fullPath??[])}),Og=t=>t.stableErrors.concat(t.betaErrors).filter(e=>!!e.isBackendError),uV=t=>Og(t).length,dV=(t,e)=>{if(e.__typename==="DiffItem"){let n=e.pathComponents?.at(-1)?.key??"";if(e.operation==="delete"){delete t[n];return}t[n]=structuredClone(e.newValue);return}if(e.__typename==="ArrayDiffItem"){let n=e.pathComponents?.at(-1)?.index??-1;if(!Array.isArray(t)||n<0)throw new Error("Invalid array diff target");if(e.operation==="delete"){t.splice(n,1);return}if(e.operation==="insert"){t.splice(n,0,structuredClone(e.newValue));return}t[n]=structuredClone(e.newValue)}};d();var hV=Rt(pu(),1);import{createRequire as sge}from"module";import{fileURLToPath as cge}from"url";import pV from"path";var fV=sge(import.meta.url),Xi=typeof y>"u"?void 0:y,mV=()=>{if(Xi)return{version:Xi.agent};try{let t=pV.resolve(pV.dirname(cge(import.meta.url)),"../../package.json");return fV(t)}catch{return{}}},gA=()=>mV().version??"0.0.0",Ng=t=>{if(Xi){if(t==="@functorz/ztype")return Xi.ztype;if(t==="@functorz/crdt-helper")return Xi.crdtHelper;if(t==="json-joy")return Xi.jsonJoy}try{let e=fV(`${t}/package.json`);return e.ztypeBuild??e.version??"unknown"}catch{return"unavailable"}},lge=async()=>{if(Xi)return{ztypeVersion:Xi.ztype,ztypeSchemaVersion:Xi.ztypeSchemaVersion};try{let t=await Ti();return{ztypeVersion:Ng("@functorz/ztype"),ztypeSchemaVersion:t?.ZTypeSystem?.getSchemaVersion?.()??"unknown"}}catch{return{ztypeVersion:Ng("@functorz/ztype"),ztypeSchemaVersion:"unavailable"}}};async function yA(){let t=mV(),e=await lge();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:Ng("@functorz/crdt-helper"),jsonJoyVersion:Ng("json-joy")}}async function Jc(t,e){let[n,r,i]=await Promise.all([yA(),_i(t),t.loadCredentials()]),a=i?hV.default.decode(i.access_token):null,o=typeof a=="object"&&a!==null?String(a.sub??a.exId??a.id??"authenticated"):"anonymous";return{...n,product:Xe,apiBaseUrl:r.apiBaseUrl,authUserId:o,workspaceRoot:t.getWorkspaceRoot(),typeSystemMode:tc(),startupFlags:[...e].sort()}}function gV(t,e){return JSON.stringify(t)===JSON.stringify(e)}var _A=uge(),_V=`${Xe}/${gA()}`,dge=t=>{if(!t)return t;if(Array.isArray(t))return t.map(([n,r])=>[n,String(n).toLowerCase()==="authorization"?"Bearer <redacted>":r]);if(typeof t=="object"&&"forEach"in t&&typeof t.forEach=="function"){let n={};return t.forEach((r,i)=>{n[i]=i.toLowerCase()==="authorization"?"Bearer <redacted>":String(r)}),n}let e={};for(let[n,r]of Object.entries(t))e[n]=n.toLowerCase()==="authorization"?"Bearer <redacted>":String(r);return e};function EA(t){if(!Array.isArray(t)||t.length===0)return null;let e=t.map(n=>{let r=n,i=typeof r.operation=="string"?r.operation:null,a=typeof r.errorType=="string"?r.errorType:typeof r.extensions?.classification=="string"?r.extensions.classification:null,o=typeof r.message=="string"?r.message:null;return!o&&!i&&!a?null:`${i?`${i}: `:""}${o??"GraphQL error"}${a?` (${a})`:""}`}).filter(n=>!!n);return e.length>0?e.join("; "):null}var pge=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>"}},Xc=async(t,e)=>{let n=mf();F.debug(`[HTTP] Request URL: ${t.toString()}`),e?.headers&&F.debug(`[HTTP] Request Headers: ${JSON.stringify(dge(e.headers))}`),n&&e?.body!=null&&F.debug(`[GQL] Request Body: ${pge(e.body)}`);let r=await fetch(t,e),i=null;try{i=await r.clone().text()}catch(a){F.debug(`[GQL] Response read failed: ${String(a)}`)}if(n&&F.debug(`[GQL] Response ${r.status}: ${i??"<read failed>"}`),i&&i.includes('"errors"')){let a=null;try{a=JSON.parse(i).errors}catch{a=null}let o=EA(a);o&&F.warn(`[GQL] ${r.status} errors: ${o}`)}return r};async function vA(t,e){let n=await t.getValidToken(),r=await _i(e),i={Authorization:`Bearer ${n}`,"User-Locale":"en_US","X-SESSION-ID":_A,"X-Client":_V},a=await iV();return a&&(i["X-ZED-VERSION"]=a),process.env.REACT_APP_VERSION&&(i["X-REACT-APP-VERSION"]=process.env.REACT_APP_VERSION),new tn(`${r.apiBaseUrl}/api/graphql`,{headers:i,fetch:Xc})}async function EV(t,e){let n=await t.getValidToken(),i=`${(await _i(e)).apiBaseUrl.replace(/^http:/,"ws:").replace(/^https:/,"wss:")}/api/graphql-subscription`;return async(a,o,s)=>{let c=mf(),l={authToken:n,"X-SESSION-ID":_A,"X-Client":_V};F.debug(`[SUB] connecting ${i} params=${JSON.stringify({...l,authToken:"Bearer <redacted>"})}`);let u=new yV.SubscriptionClient(i,{lazy:!0,reconnect:!0,minTimeout:3e3,connectionParams:l},KB);u.onConnected(()=>F.debug("[SUB] connected")),u.onReconnected(()=>F.debug("[SUB] reconnected")),u.onDisconnected(()=>F.debug("[SUB] disconnected")),u.onError(f=>F.debug(`[SUB] error ${f?.message??String(f)}`));let h=[{name:"onNewCrdtPatchV2",query:Xq,variables:{projectExId:a.projectExId,appExId:a.appExId??null,versionExId:a.appVersionExId??null,latestPatchExIdInClient:o}},{name:"onSchemaUploadV3",query:eG,variables:{projectExId:a.projectExId,appExId:a.appExId??null,appVersionExId:a.appVersionExId??null}}].map(f=>(F.debug(`[SUB] subscribe ${f.name} vars=${JSON.stringify(f.variables)}`),u.request({query:f.query,variables:f.variables}).subscribe({next:m=>{c&&F.debug(`[SUB] ${f.name} event: ${JSON.stringify(m)}`),s()},error:m=>{F.warn("Schema subscription event failed",String(m)),s()}})));return{unsubscribe(){for(let f of h)f.unsubscribe();u.close(!1,!1)}}}}async function vV(t,e){if(e.projectExId)return await t.saveProjectContext(e.projectExId),e.projectExId;let n=await t.loadProjectContext();if(!n?.projectExId)throw new Error("No projectExId provided and no current project is set");return n.projectExId}async function TA(t,e,n,r){try{await t.request(gG,{projectExId:e,client:Xe,clientVersion:gA(),sessionId:r??_A,agent:n??null}),F.debug(`[agent-session] started for project ${e}`)}catch(i){F.debug(`[agent-session] skipped: ${String(i)}`)}}d();d();d();import{createHash as hge}from"crypto";var fge=t=>!!(t&&typeof t=="object"&&!Array.isArray(t)),bA=t=>{if(Array.isArray(t))return t.map(n=>n===void 0?null:bA(n));if(!fge(t))return t;let e={};for(let n of Object.keys(t).sort()){let r=t[n];r!==void 0&&(e[n]=bA(r))}return e},mge=t=>JSON.stringify(bA(t)),gge=t=>hge("sha256").update(mge(t)).digest("hex"),TV=t=>({projectExId:t.projectExId,appExId:t.appExId??null,appVersionExId:t.appVersionExId??null,schemaExId:t.schemaExId??null,lastPatchExId:t.lastPatchExId??null,snapshotHash:gge(t.snapshot),deployedSchemaExId:t.deployedSchemaExId??null,checkedAt:t.checkedAt??new Date().toISOString()}),bV=(t,e)=>!t||!e?t!==e:t.schemaExId!==e.schemaExId||t.lastPatchExId!==e.lastPatchExId||t.snapshotHash!==e.snapshotHash||t.deployedSchemaExId!==e.deployedSchemaExId,Cg=t=>t.changes.length>0;var SV=null,yge=()=>(SV??=Ti().then(t=>{let e=t?.typesystem?.schema?.diff?.computeSemanticSchemaChanges;return typeof e=="function"?e:null}),SV),SA=async(t,e)=>{let n=await yge();return n?n(t,e):{changes:[]}};d();var _ge="Functorz";function wV(t,e,n,r){let i=t?.typesystem?.settings,a=t?.typesystem?.schema,o=t?.api?.ZTypeCoreApi,s=e?.KtList,c=e?.KtMap;if(!i?.ExtraContext||!a?.CustomChatModelDescriptor||!a?.AIModelDescriptors||!a?.ActionFlowTemplateCodeDescriptor||!a?.GeneralInputVariable||!a?.InputVariableCategory||!a?.Locale||!o||!s||!c)return F.warn("ztype ExtraContext symbols missing; schema graph will be built without custom models or AF templates"),null;try{let{ExtraContext:l}=i,{AIModelDescriptors:u,ActionFlowTemplateCodeDescriptor:p,Locale:h,CustomChatModelDescriptor:f,CustomEmbeddingModelDescriptor:m,ModelCustomParamDescriptor:_,CustomModelParam:E,CustomChatCompletionFeatures:T,Identifier:b,MediaOutputCardinality:S,Variable:A,GeneralInputVariable:I,InputVariableCategory:N}=a,x=K=>c.fromJsMap(new Map(Object.entries(K??{}))),R=K=>typeof K=="string"?K==="single"?S.SINGLE:K==="multiple"?S.MULTIPLE:S.NONE:typeof K=="boolean"&&K?S.MULTIPLE:S.NONE,ie=K=>new _(K.name,x(K.displayName),K.type,x(K.description)),oe=K=>new E(ie(K.serverUrl),ie(K.apiToken),s.fromJsArray((K.extensionParams??[]).map(It=>new _(It.name,x(It.displayName),It.type,x(It.displayName))))),Ne=K=>K.provider===_ge&&K.customModelIdentifier?new b(K.customModelIdentifier.id,K.customModelIdentifier.namespace):null,O=K=>c.fromJsMap(new Map((K??[]).filter(It=>It!=null).map(It=>[It.name,new I(It.name,null,It.type,null,N.GENERAL,!It.required,It.defaultValue==null?null:o.parseDataBindingFromJsObject(It.defaultValue))]))),ue=K=>c.fromJsMap(new Map((K??[]).filter(It=>It!=null).map(It=>[It.name,new A(It.type,null,!It.required,null,null,null,null,It.defaultValue==null?null:o.parseDataBindingFromJsObject(It.defaultValue))]))),ut=(n?.chatModelDescriptors??[]).map(K=>new f(K.provider,K.name,oe(K.paramToConfigure),K.delisted,new T(K.features.streamResponse,K.features.multiModal,K.features.imageInput??!1,!1,K.features.videoInput??!1,K.features.imageMessageInput??!1,!1,K.features.videoMessageInput??!1,K.features.tools,K.features.reasoningContent,K.features.imageOutput,K.features.videoOutput,R(K.features.imageOutput),R(K.features.videoOutput),null,K.features.structuredOutput),Ne(K))),lr=(n?.embeddingModelDescriptors??[]).map(K=>new m(K.provider,K.name,oe(K.paramToConfigure),Ne(K),K.delisted)),KE=c.fromJsMap(new Map((r??[]).map(K=>[K.exId,new p(K.exId,c.fromJsMap(new Map([[h.EN,K.displayName??""]])),K.logoUrl??"",s.fromJsArray([K.templateGroup??""]),K.async,O(K.inputType),ue(K.outputType))])));return new l(new u(s.fromJsArray(ut),s.fromJsArray(lr)),KE)}catch(l){return F.warn("ztype ExtraContext construction failed; schema graph will be built without custom models or AF templates",l.message),null}}d();var Xo=class extends Error{constructor(n,r){super(n);this.diagnostics=r;this.name="ZtypeValidationError"}};d();function Pg(t,e,n){let r=sV(t,n?.appType);return t.api.ZTypeCoreApi.genZTypeApiContext(e,cV(t),r,oV(n,r),lV(t),null)}d();var IV={QUERY:"query",MUTATION:"mutation"},AV={SUCCESS:"2xx",PERMANENT_FAIL:"4xx",TEMPORARY_FAIL:"5xx"};function OV(t){let e=n=>{if(Array.isArray(n))return n.map(e);if(n&&typeof n=="object"){let r={};for(let[i,a]of Object.entries(n))i==="operation"&&typeof a=="string"&&IV[a]!==void 0?r[i]=IV[a]:i==="responseBranch"&&typeof a=="string"&&AV[a]!==void 0?r[i]=AV[a]:r[i]=e(a);return r}return n};return t.map(e)}function NV(t){let e=n=>typeof n=="string"&&!n.startsWith("http://")&&!n.startsWith("https://");for(let n of t){let r=n;if(!r?.args||typeof r.args!="object")continue;let i=r.args,a=[];if(r.name==="UPDATE_TPA_CONFIG")a.push(i.url);else if(r.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 Zr=t=>t==null,Ege=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),CV=t=>{if(Ege(t)){if(!Zr(t.id))return{key:"id",value:t.id};if(!Zr(t.uniqueId))return{key:"uniqueId",value:t.uniqueId};if(!Zr(t.mRef))return{key:"mRef",value:t.mRef}}},wA=(t,e)=>{if(Zr(t)&&Zr(e)||t===e)return!0;if(Zr(t)||Zr(e)||typeof t!="object"||typeof e!="object")return!1;let n=t,r=e,i=new Set([...Object.keys(n),...Object.keys(r)]);for(let a of i)if(!wA(n[a],r[a]))return!1;return!0},PV=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)}`)},vge=t=>t.key??t.index??"",Tge=(t,e)=>{let n=t;for(let r of e){if(n===null||typeof n!="object")return;n=n[r]}return n},bge=(t,e)=>{if(e.__typename!=="DiffItem")return null;let n=e.pathComponents.at(-1)?.key;if(n===void 0)return null;let r=CV(t[n]),i=r===void 0?wA(t[n],e.oldValue):r.value===e.oldValue?.[r.key];switch(e.operation){case"add":t[n]=e.newValue;break;case"update":if(!i)return null;t[n]=e.newValue;break;case"delete":if(!Object.prototype.hasOwnProperty.call(t,n)||!i)return null;delete t[n];break;default:return null}return e},Sge=(t,e)=>{if(e.__typename!=="ArrayDiffItem")return null;let n=e.pathComponents.at(-1)?.index;if(n===void 0||n>t.length)return null;let r=()=>{let i=CV(t[n]);return i===void 0?wA(t[n],e.oldValue):i.value===e.oldValue?.[i.key]};switch(e.operation){case"insert":t.splice(n,0,e.newValue);break;case"delete":if(!r())return null;t.splice(n,1);break;case"update":if(!r())return null;t.splice(n,1,e.newValue);break;default:return null}return e},RV=(t,e)=>{let n=t,r=new WeakSet,i=o=>{if(n===null||typeof n!="object")return n;r.has(n)||(n=Array.isArray(n)?[...n]:{...n},r.add(n));let s=n;for(let c of o){let l=s[c];if(l!==null&&typeof l=="object"){if(!r.has(l)){let u=Array.isArray(l)?[...l]:{...l};r.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(vge).slice(0,-1);if(Zr(Tge(n,c)))continue;let l=i(c);if(Array.isArray(l)){let u=Sge(l,o);u&&a.push(u)}else if(l!==null&&typeof l=="object"){let u=bge(l,o);u&&a.push(u)}}catch{continue}return a};d();var wge=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=>{F.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())},wge),this.timer.unref())}async run(){if(!this.running){this.running=!0;try{await this.options.refresh()}finally{this.running=!1}}}};d();d();var g={};YE(g,{BRAND:()=>Yge,DIRTY:()=>es,EMPTY_PATH:()=>Nge,INVALID:()=>ce,NEVER:()=>xye,OK:()=>En,ParseStatus:()=>on,Schema:()=>Te,ZodAny:()=>Fa,ZodArray:()=>ra,ZodBigInt:()=>ns,ZodBoolean:()=>rs,ZodBranded:()=>kd,ZodCatch:()=>fs,ZodDate:()=>is,ZodDefault:()=>hs,ZodDiscriminatedUnion:()=>Lg,ZodEffects:()=>Ir,ZodEnum:()=>ds,ZodError:()=>Fn,ZodFirstPartyTypeKind:()=>k,ZodFunction:()=>Mg,ZodIntersection:()=>cs,ZodIssueCode:()=>L,ZodLazy:()=>ls,ZodLiteral:()=>us,ZodMap:()=>al,ZodNaN:()=>sl,ZodNativeEnum:()=>ps,ZodNever:()=>Hr,ZodNull:()=>os,ZodNullable:()=>wi,ZodNumber:()=>ts,ZodObject:()=>Gn,ZodOptional:()=>qn,ZodParsedType:()=>q,ZodPipeline:()=>Md,ZodPromise:()=>qa,ZodReadonly:()=>ms,ZodRecord:()=>kg,ZodSchema:()=>Te,ZodSet:()=>ol,ZodString:()=>$a,ZodSymbol:()=>rl,ZodTransformer:()=>Ir,ZodTuple:()=>Si,ZodType:()=>Te,ZodUndefined:()=>as,ZodUnion:()=>ss,ZodUnknown:()=>na,ZodVoid:()=>il,addIssueToContext:()=>$,any:()=>aye,array:()=>lye,bigint:()=>eye,boolean:()=>GV,coerce:()=>Dye,custom:()=>$V,date:()=>tye,datetimeRegex:()=>jV,defaultErrorMap:()=>ea,discriminatedUnion:()=>pye,effect:()=>wye,enum:()=>Tye,function:()=>_ye,getErrorMap:()=>el,getParsedType:()=>bi,instanceof:()=>Jge,intersection:()=>hye,isAborted:()=>Dg,isAsync:()=>tl,isDirty:()=>xg,isValid:()=>Ua,late:()=>Qge,lazy:()=>Eye,literal:()=>vye,makeIssue:()=>Ld,map:()=>gye,nan:()=>Xge,nativeEnum:()=>bye,never:()=>sye,null:()=>iye,nullable:()=>Aye,number:()=>qV,object:()=>NA,objectUtil:()=>IA,oboolean:()=>Rye,onumber:()=>Pye,optional:()=>Iye,ostring:()=>Cye,pipeline:()=>Nye,preprocess:()=>Oye,promise:()=>Sye,quotelessJson:()=>Ige,record:()=>mye,set:()=>yye,setErrorMap:()=>Oge,strictObject:()=>uye,string:()=>FV,symbol:()=>nye,transformer:()=>wye,tuple:()=>fye,undefined:()=>rye,union:()=>dye,unknown:()=>oye,util:()=>Ae,void:()=>cye});d();d();d();d();d();var Ae;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,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 r(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(Ae||(Ae={}));var IA;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(IA||(IA={}));var q=Ae.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),bi=t=>{switch(typeof t){case"undefined":return q.undefined;case"string":return q.string;case"number":return Number.isNaN(t)?q.nan:q.number;case"boolean":return q.boolean;case"function":return q.function;case"bigint":return q.bigint;case"symbol":return q.symbol;case"object":return Array.isArray(t)?q.array:t===null?q.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?q.promise:typeof Map<"u"&&t instanceof Map?q.map:typeof Set<"u"&&t instanceof Set?q.set:typeof Date<"u"&&t instanceof Date?q.date:q.object;default:return q.unknown}};var L=Ae.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"]),Ige=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Fn=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(a){return a.message},r={_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)r._errors.push(n(o));else{let s=r,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(n(o))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return i(this),r}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,Ae.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};Fn.create=t=>new Fn(t);var Age=(t,e)=>{let n;switch(t.code){case L.invalid_type:t.received===q.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case L.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Ae.jsonStringifyReplacer)}`;break;case L.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ae.joinValues(t.keys,", ")}`;break;case L.invalid_union:n="Invalid input";break;case L.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ae.joinValues(t.options)}`;break;case L.invalid_enum_value:n=`Invalid enum value. Expected ${Ae.joinValues(t.options)}, received '${t.received}'`;break;case L.invalid_arguments:n="Invalid function arguments";break;case L.invalid_return_type:n="Invalid function return type";break;case L.invalid_date:n="Invalid date";break;case L.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Ae.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case L.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case L.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case L.custom:n="Invalid input";break;case L.invalid_intersection_types:n="Intersection results could not be merged";break;case L.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case L.not_finite:n="Number must be finite";break;default:n=e.defaultError,Ae.assertNever(t)}return{message:n}},ea=Age;var DV=ea;function Oge(t){DV=t}function el(){return DV}d();var Ld=t=>{let{data:e,path:n,errorMaps:r,issueData:i}=t,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)s=l(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}},Nge=[];function $(t,e){let n=el(),r=Ld({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ea?void 0:ea].filter(i=>!!i)});t.common.issues.push(r)}var on=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let i of n){if(i.status==="aborted")return ce;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let i of n){let a=await i.key,o=await i.value;r.push({key:a,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let i of n){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return ce;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[a.value]=o.value)}return{status:e.value,value:r}}},ce=Object.freeze({status:"aborted"}),es=t=>({status:"dirty",value:t}),En=t=>({status:"valid",value:t}),Dg=t=>t.status==="aborted",xg=t=>t.status==="dirty",Ua=t=>t.status==="valid",tl=t=>typeof Promise<"u"&&t instanceof Promise;d();d();var Y;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Y||(Y={}));var wr=class{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,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}},xV=(t,e)=>{if(Ua(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 n=new Fn(t.common.issues);return this._error=n,this._error}}};function _e(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))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??r??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:c??n??s.defaultError}},description:i}}var Te=class{get description(){return this._def.description}_getType(e){return bi(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:bi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new on,ctx:{common:e.parent.common,data:e.data,parsedType:bi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(tl(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)},i=this._parseSync({data:e,path:r.path,parent:r});return xV(r,i)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return Ua(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>Ua(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:bi(e)},i=this._parse({data:e,path:r.path,parent:r}),a=await(tl(i)?i:Promise.resolve(i));return xV(r,a)}refine(e,n){let r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:L.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Ir({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:n=>this["~validate"](n)}}optional(){return qn.create(this,this._def)}nullable(){return wi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ra.create(this)}promise(){return qa.create(this,this._def)}or(e){return ss.create([this,e],this._def)}and(e){return cs.create(this,e,this._def)}transform(e){return new Ir({..._e(this._def),schema:this,typeName:k.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new hs({..._e(this._def),innerType:this,defaultValue:n,typeName:k.ZodDefault})}brand(){return new kd({typeName:k.ZodBranded,type:this,..._e(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new fs({..._e(this._def),innerType:this,catchValue:n,typeName:k.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Md.create(this,e)}readonly(){return ms.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Cge=/^c[^\s-]{8,}$/i,Pge=/^[0-9a-z]+$/,Rge=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Dge=/^[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,xge=/^[a-z0-9_-]{21}$/i,Lge=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,kge=/^[-+]?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)?)??$/,Mge=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jge="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",AA,Uge=/^(?:(?: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])$/,$ge=/^(?:(?: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])$/,Fge=/^(([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]))$/,qge=/^(([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])$/,Gge=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Bge=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kV="((\\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])))",Vge=new RegExp(`^${kV}$`);function MV(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function zge(t){return new RegExp(`^${MV(t)}$`)}function jV(t){let e=`${kV}T${MV(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Wge(t,e){return!!((e==="v4"||!e)&&Uge.test(t)||(e==="v6"||!e)&&Fge.test(t))}function Zge(t,e){if(!Lge.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function Hge(t,e){return!!((e==="v4"||!e)&&$ge.test(t)||(e==="v6"||!e)&&qge.test(t))}var $a=class t extends Te{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==q.string){let a=this._getOrReturnCtx(e);return $(a,{code:L.invalid_type,expected:q.string,received:a.parsedType}),ce}let r=new on,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),$(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),$(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.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?$(i,{code:L.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&$(i,{code:L.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Mge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"email",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")AA||(AA=new RegExp(jge,"u")),AA.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"emoji",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Dge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"uuid",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")xge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"nanoid",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Cge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"cuid",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Pge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"cuid2",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Rge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"ulid",code:L.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),$(i,{validation:"url",code:L.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"regex",code:L.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),$(i,{code:L.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.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),$(i,{code:L.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),$(i,{code:L.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?jV(a).test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{code:L.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?Vge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{code:L.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?zge(a).test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{code:L.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?kge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"duration",code:L.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?Wge(e.data,a.version)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"ip",code:L.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?Zge(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"jwt",code:L.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?Hge(e.data,a.version)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"cidr",code:L.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?Gge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"base64",code:L.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?Bge.test(e.data)||(i=this._getOrReturnCtx(e,i),$(i,{validation:"base64url",code:L.invalid_string,message:a.message}),r.dirty()):Ae.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:L.invalid_string,...Y.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Y.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,...Y.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,...Y.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...Y.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Y.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Y.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Y.errToObj(n)})}nonempty(e){return this.min(1,Y.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 n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};$a.create=t=>new $a({checks:[],typeName:k.ZodString,coerce:t?.coerce??!1,..._e(t)});function Kge(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var ts=class t extends Te{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)!==q.number){let a=this._getOrReturnCtx(e);return $(a,{code:L.invalid_type,expected:q.number,received:a.parsedType}),ce}let r,i=new on;for(let a of this._def.checks)a.kind==="int"?Ae.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{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)&&(r=this._getOrReturnCtx(e,r),$(r,{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)&&(r=this._getOrReturnCtx(e,r),$(r,{code:L.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?Kge(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),$(r,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),$(r,{code:L.not_finite,message:a.message}),i.dirty()):Ae.assertNever(a);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Y.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Y.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Y.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Y.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Y.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ae.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};ts.create=t=>new ts({checks:[],typeName:k.ZodNumber,coerce:t?.coerce||!1,..._e(t)});var ns=class t extends Te{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)!==q.bigint)return this._getInvalidInput(e);let r,i=new on;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),$(r,{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)&&(r=this._getOrReturnCtx(e,r),$(r,{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)&&(r=this._getOrReturnCtx(e,r),$(r,{code:L.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):Ae.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return $(n,{code:L.invalid_type,expected:q.bigint,received:n.parsedType}),ce}gte(e,n){return this.setLimit("min",e,!0,Y.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Y.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Y.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Y.toString(n))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:Y.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:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ns.create=t=>new ns({checks:[],typeName:k.ZodBigInt,coerce:t?.coerce??!1,..._e(t)});var rs=class extends Te{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==q.boolean){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.boolean,received:r.parsedType}),ce}return En(e.data)}};rs.create=t=>new rs({typeName:k.ZodBoolean,coerce:t?.coerce||!1,..._e(t)});var is=class t extends Te{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==q.date){let a=this._getOrReturnCtx(e);return $(a,{code:L.invalid_type,expected:q.date,received:a.parsedType}),ce}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return $(a,{code:L.invalid_date}),ce}let r=new on,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),$(i,{code:L.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),$(i,{code:L.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):Ae.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};is.create=t=>new is({checks:[],coerce:t?.coerce||!1,typeName:k.ZodDate,..._e(t)});var rl=class extends Te{_parse(e){if(this._getType(e)!==q.symbol){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.symbol,received:r.parsedType}),ce}return En(e.data)}};rl.create=t=>new rl({typeName:k.ZodSymbol,..._e(t)});var as=class extends Te{_parse(e){if(this._getType(e)!==q.undefined){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.undefined,received:r.parsedType}),ce}return En(e.data)}};as.create=t=>new as({typeName:k.ZodUndefined,..._e(t)});var os=class extends Te{_parse(e){if(this._getType(e)!==q.null){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.null,received:r.parsedType}),ce}return En(e.data)}};os.create=t=>new os({typeName:k.ZodNull,..._e(t)});var Fa=class extends Te{constructor(){super(...arguments),this._any=!0}_parse(e){return En(e.data)}};Fa.create=t=>new Fa({typeName:k.ZodAny,..._e(t)});var na=class extends Te{constructor(){super(...arguments),this._unknown=!0}_parse(e){return En(e.data)}};na.create=t=>new na({typeName:k.ZodUnknown,..._e(t)});var Hr=class extends Te{_parse(e){let n=this._getOrReturnCtx(e);return $(n,{code:L.invalid_type,expected:q.never,received:n.parsedType}),ce}};Hr.create=t=>new Hr({typeName:k.ZodNever,..._e(t)});var il=class extends Te{_parse(e){if(this._getType(e)!==q.undefined){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.void,received:r.parsedType}),ce}return En(e.data)}};il.create=t=>new il({typeName:k.ZodVoid,..._e(t)});var ra=class t extends Te{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==q.array)return $(n,{code:L.invalid_type,expected:q.array,received:n.parsedType}),ce;if(i.exactLength!==null){let o=n.data.length>i.exactLength.value,s=n.data.length<i.exactLength.value;(o||s)&&($(n,{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}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&($(n,{code:L.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&($(n,{code:L.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,s)=>i.type._parseAsync(new wr(n,o,n.path,s)))).then(o=>on.mergeArray(r,o));let a=[...n.data].map((o,s)=>i.type._parseSync(new wr(n,o,n.path,s)));return on.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:Y.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:Y.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:Y.toString(n)}})}nonempty(e){return this.min(1,e)}};ra.create=(t,e)=>new ra({type:t,minLength:null,maxLength:null,exactLength:null,typeName:k.ZodArray,..._e(e)});function nl(t){if(t instanceof Gn){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=qn.create(nl(r))}return new Gn({...t._def,shape:()=>e})}else return t instanceof ra?new ra({...t._def,type:nl(t.element)}):t instanceof qn?qn.create(nl(t.unwrap())):t instanceof wi?wi.create(nl(t.unwrap())):t instanceof Si?Si.create(t.items.map(e=>nl(e))):t}var Gn=class t extends Te{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(),n=Ae.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==q.object){let l=this._getOrReturnCtx(e);return $(l,{code:L.invalid_type,expected:q.object,received:l.parsedType}),ce}let{status:r,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Hr&&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 wr(i,p,i.path,l)),alwaysSet:l in i.data})}if(this._def.catchall instanceof Hr){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&&($(i,{code:L.unrecognized_keys,keys:s}),r.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 wr(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,h=await u.value;l.push({key:p,value:h,alwaysSet:u.alwaysSet})}return l}).then(l=>on.mergeObjectSync(r,l)):on.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let i=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:Y.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,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of Ae.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of Ae.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return nl(this)}partial(e){let n={};for(let r of Ae.objectKeys(this.shape)){let i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of Ae.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof qn;)a=a._def.innerType;n[r]=a}return new t({...this._def,shape:()=>n})}keyof(){return UV(Ae.objectKeys(this.shape))}};Gn.create=(t,e)=>new Gn({shape:()=>t,unknownKeys:"strip",catchall:Hr.create(),typeName:k.ZodObject,..._e(e)});Gn.strictCreate=(t,e)=>new Gn({shape:()=>t,unknownKeys:"strict",catchall:Hr.create(),typeName:k.ZodObject,..._e(e)});Gn.lazycreate=(t,e)=>new Gn({shape:t,unknownKeys:"strip",catchall:Hr.create(),typeName:k.ZodObject,..._e(e)});var ss=class extends Te{_parse(e){let{ctx:n}=this._processInputParams(e),r=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 n.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new Fn(s.ctx.common.issues));return $(n,{code:L.invalid_union,unionErrors:o}),ce}if(n.common.async)return Promise.all(r.map(async a=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.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 n.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(c=>new Fn(c));return $(n,{code:L.invalid_union,unionErrors:s}),ce}}get options(){return this._def.options}};ss.create=(t,e)=>new ss({options:t,typeName:k.ZodUnion,..._e(e)});var ta=t=>t instanceof ls?ta(t.schema):t instanceof Ir?ta(t.innerType()):t instanceof us?[t.value]:t instanceof ds?t.options:t instanceof ps?Ae.objectValues(t.enum):t instanceof hs?ta(t._def.innerType):t instanceof as?[void 0]:t instanceof os?[null]:t instanceof qn?[void 0,...ta(t.unwrap())]:t instanceof wi?[null,...ta(t.unwrap())]:t instanceof kd||t instanceof ms?ta(t.unwrap()):t instanceof fs?ta(t._def.innerType):[],Lg=class t extends Te{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.object)return $(n,{code:L.invalid_type,expected:q.object,received:n.parsedType}),ce;let r=this.discriminator,i=n.data[r],a=this.optionsMap.get(i);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):($(n,{code:L.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ce)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let i=new Map;for(let a of n){let o=ta(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:n,optionsMap:i,..._e(r)})}};function OA(t,e){let n=bi(t),r=bi(e);if(t===e)return{valid:!0,data:t};if(n===q.object&&r===q.object){let i=Ae.objectKeys(e),a=Ae.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let c=OA(t[s],e[s]);if(!c.valid)return{valid:!1};o[s]=c.data}return{valid:!0,data:o}}else if(n===q.array&&r===q.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=OA(o,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return n===q.date&&r===q.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var cs=class extends Te{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),i=(a,o)=>{if(Dg(a)||Dg(o))return ce;let s=OA(a.value,o.value);return s.valid?((xg(a)||xg(o))&&n.dirty(),{status:n.value,value:s.data}):($(r,{code:L.invalid_intersection_types}),ce)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};cs.create=(t,e,n)=>new cs({left:t,right:e,typeName:k.ZodIntersection,..._e(n)});var Si=class t extends Te{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.array)return $(r,{code:L.invalid_type,expected:q.array,received:r.parsedType}),ce;if(r.data.length<this._def.items.length)return $(r,{code:L.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ce;!this._def.rest&&r.data.length>this._def.items.length&&($(r,{code:L.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((o,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new wr(r,o,r.path,s)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>on.mergeArray(n,o)):on.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Si.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Si({items:t,typeName:k.ZodTuple,rest:null,..._e(e)})};var kg=class t extends Te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.object)return $(r,{code:L.invalid_type,expected:q.object,received:r.parsedType}),ce;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in r.data)i.push({key:a._parse(new wr(r,s,r.path,s)),value:o._parse(new wr(r,r.data[s],r.path,s)),alwaysSet:s in r.data});return r.common.async?on.mergeObjectAsync(n,i):on.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Te?new t({keyType:e,valueType:n,typeName:k.ZodRecord,..._e(r)}):new t({keyType:$a.create(),valueType:e,typeName:k.ZodRecord,..._e(n)})}},al=class extends Te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.map)return $(r,{code:L.invalid_type,expected:q.map,received:r.parsedType}),ce;let i=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([s,c],l)=>({key:i._parse(new wr(r,s,r.path,[l,"key"])),value:a._parse(new wr(r,c,r.path,[l,"value"]))}));if(r.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 ce;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(l.value,u.value)}return{status:n.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 ce;(l.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(l.value,u.value)}return{status:n.value,value:s}}}};al.create=(t,e,n)=>new al({valueType:e,keyType:t,typeName:k.ZodMap,..._e(n)});var ol=class t extends Te{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==q.set)return $(r,{code:L.invalid_type,expected:q.set,received:r.parsedType}),ce;let i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&($(r,{code:L.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&($(r,{code:L.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());let a=this._def.valueType;function o(c){let l=new Set;for(let u of c){if(u.status==="aborted")return ce;u.status==="dirty"&&n.dirty(),l.add(u.value)}return{status:n.value,value:l}}let s=[...r.data.values()].map((c,l)=>a._parse(new wr(r,c,r.path,l)));return r.common.async?Promise.all(s).then(c=>o(c)):o(s)}min(e,n){return new t({...this._def,minSize:{value:e,message:Y.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:Y.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};ol.create=(t,e)=>new ol({valueType:t,minSize:null,maxSize:null,typeName:k.ZodSet,..._e(e)});var Mg=class t extends Te{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.function)return $(n,{code:L.invalid_type,expected:q.function,received:n.parsedType}),ce;function r(s,c){return Ld({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,el(),ea].filter(l=>!!l),issueData:{code:L.invalid_arguments,argumentsError:c}})}function i(s,c){return Ld({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,el(),ea].filter(l=>!!l),issueData:{code:L.invalid_return_type,returnTypeError:c}})}let a={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof qa){let s=this;return En(async function(...c){let l=new Fn([]),u=await s._def.args.parseAsync(c,a).catch(f=>{throw l.addIssue(r(c,f)),l}),p=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(p,a).catch(f=>{throw l.addIssue(i(p,f)),l})})}else{let s=this;return En(function(...c){let l=s._def.args.safeParse(c,a);if(!l.success)throw new Fn([r(c,l.error)]);let u=Reflect.apply(o,this,l.data),p=s._def.returns.safeParse(u,a);if(!p.success)throw new Fn([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:Si.create(e).rest(na.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,n,r){return new t({args:e||Si.create([]).rest(na.create()),returns:n||na.create(),typeName:k.ZodFunction,..._e(r)})}},ls=class extends Te{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ls.create=(t,e)=>new ls({getter:t,typeName:k.ZodLazy,..._e(e)});var us=class extends Te{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return $(n,{received:n.data,code:L.invalid_literal,expected:this._def.value}),ce}return{status:"valid",value:e.data}}get value(){return this._def.value}};us.create=(t,e)=>new us({value:t,typeName:k.ZodLiteral,..._e(e)});function UV(t,e){return new ds({values:t,typeName:k.ZodEnum,..._e(e)})}var ds=class t extends Te{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return $(n,{expected:Ae.joinValues(r),received:n.parsedType,code:L.invalid_type}),ce}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return $(n,{received:n.data,code:L.invalid_enum_value,options:r}),ce}return En(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};ds.create=UV;var ps=class extends Te{_parse(e){let n=Ae.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==q.string&&r.parsedType!==q.number){let i=Ae.objectValues(n);return $(r,{expected:Ae.joinValues(i),received:r.parsedType,code:L.invalid_type}),ce}if(this._cache||(this._cache=new Set(Ae.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=Ae.objectValues(n);return $(r,{received:r.data,code:L.invalid_enum_value,options:i}),ce}return En(e.data)}get enum(){return this._def.values}};ps.create=(t,e)=>new ps({values:t,typeName:k.ZodNativeEnum,..._e(e)});var qa=class extends Te{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==q.promise&&n.common.async===!1)return $(n,{code:L.invalid_type,expected:q.promise,received:n.parsedType}),ce;let r=n.parsedType===q.promise?n.data:Promise.resolve(n.data);return En(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}};qa.create=(t,e)=>new qa({type:t,typeName:k.ZodPromise,..._e(e)});var Ir=class extends Te{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:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{$(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(r.data,a);if(r.common.async)return Promise.resolve(o).then(async s=>{if(n.value==="aborted")return ce;let c=await this._def.schema._parseAsync({data:s,path:r.path,parent:r});return c.status==="aborted"?ce:c.status==="dirty"?es(c.value):n.value==="dirty"?es(c.value):c});{if(n.value==="aborted")return ce;let s=this._def.schema._parseSync({data:o,path:r.path,parent:r});return s.status==="aborted"?ce:s.status==="dirty"?es(s.value):n.value==="dirty"?es(s.value):s}}if(i.type==="refinement"){let o=s=>{let c=i.refinement(s,a);if(r.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(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ce:(s.status==="dirty"&&n.dirty(),o(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?ce:(s.status==="dirty"&&n.dirty(),o(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ua(o))return ce;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:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Ua(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:n.value,value:s})):ce);Ae.assertNever(i)}};Ir.create=(t,e,n)=>new Ir({schema:t,typeName:k.ZodEffects,effect:e,..._e(n)});Ir.createWithPreprocess=(t,e,n)=>new Ir({schema:e,effect:{type:"preprocess",transform:t},typeName:k.ZodEffects,..._e(n)});var qn=class extends Te{_parse(e){return this._getType(e)===q.undefined?En(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};qn.create=(t,e)=>new qn({innerType:t,typeName:k.ZodOptional,..._e(e)});var wi=class extends Te{_parse(e){return this._getType(e)===q.null?En(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};wi.create=(t,e)=>new wi({innerType:t,typeName:k.ZodNullable,..._e(e)});var hs=class extends Te{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===q.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};hs.create=(t,e)=>new hs({innerType:t,typeName:k.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._e(e)});var fs=class extends Te{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return tl(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Fn(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Fn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};fs.create=(t,e)=>new fs({innerType:t,typeName:k.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._e(e)});var sl=class extends Te{_parse(e){if(this._getType(e)!==q.nan){let r=this._getOrReturnCtx(e);return $(r,{code:L.invalid_type,expected:q.nan,received:r.parsedType}),ce}return{status:"valid",value:e.data}}};sl.create=t=>new sl({typeName:k.ZodNaN,..._e(t)});var Yge=Symbol("zod_brand"),kd=class extends Te{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Md=class t extends Te{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?ce:a.status==="dirty"?(n.dirty(),es(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ce:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:k.ZodPipeline})}},ms=class extends Te{_parse(e){let n=this._def.innerType._parse(e),r=i=>(Ua(i)&&(i.value=Object.freeze(i.value)),i);return tl(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}};ms.create=(t,e)=>new ms({innerType:t,typeName:k.ZodReadonly,..._e(e)});function LV(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function $V(t,e={},n){return t?Fa.create().superRefine((r,i)=>{let a=t(r);if(a instanceof Promise)return a.then(o=>{if(!o){let s=LV(e,r),c=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:c})}});if(!a){let o=LV(e,r),s=o.fatal??n??!0;i.addIssue({code:"custom",...o,fatal:s})}}):Fa.create()}var Qge={object:Gn.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 Jge=(t,e={message:`Input not instance of ${t.name}`})=>$V(n=>n instanceof t,e),FV=$a.create,qV=ts.create,Xge=sl.create,eye=ns.create,GV=rs.create,tye=is.create,nye=rl.create,rye=as.create,iye=os.create,aye=Fa.create,oye=na.create,sye=Hr.create,cye=il.create,lye=ra.create,NA=Gn.create,uye=Gn.strictCreate,dye=ss.create,pye=Lg.create,hye=cs.create,fye=Si.create,mye=kg.create,gye=al.create,yye=ol.create,_ye=Mg.create,Eye=ls.create,vye=us.create,Tye=ds.create,bye=ps.create,Sye=qa.create,wye=Ir.create,Iye=qn.create,Aye=wi.create,Oye=Ir.createWithPreprocess,Nye=Md.create,Cye=()=>FV().optional(),Pye=()=>qV().optional(),Rye=()=>GV().optional(),Dye={string:(t=>$a.create({...t,coerce:!0})),number:(t=>ts.create({...t,coerce:!0})),boolean:(t=>rs.create({...t,coerce:!0})),bigint:(t=>ns.create({...t,coerce:!0})),date:(t=>is.create({...t,coerce:!0}))};var xye=ce;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. A leaf's `kind` is what you send to ADD_COMPONENT_ACTIONS to attach it. A leaf with no `kind` cannot be attached by that tool at all \u2014 say so and let the user add it in the editor, rather than attaching some other action that looks close. `kind` is necessary but not sufficient: one kind can cover several eventTypes and may not be able to express the one you want, so if the write is refused, follow that error instead of substituting a different action.",ops:{GET_SELECTABLE_COMPONENT_ACTIONS:"GET_SELECTABLE_COMPONENT_ACTIONS"},inputSchema:{componentId:g.string().optional(),eventType:g.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.
|
|
1488
1488
|
Changes apply immediately; use schema_undo to revert the last change. Ops:
|
|
1489
1489
|
- op=ADD \u2014 Result echoes each new flow's id.
|
|
1490
1490
|
- op=ADD_GLOBAL_VARS \u2014 Result echoes each new variable's minted key.
|
|
@@ -1917,7 +1917,7 @@ ${Wg(e," ")}
|
|
|
1917
1917
|
}`),bz=()=>`mutation AgentRunCode($jsCode: String!, $args: JsonObject, $updateDb: Boolean!) {
|
|
1918
1918
|
fz_debug_action_code(jsCode: $jsCode, args: $args, updateDb: $updateDb)
|
|
1919
1919
|
}`;var Y_e=20,Q_e=200,J_e=20,LA="id",kA=t=>t&&typeof t=="object"&&!Array.isArray(t)?t:{},Az=t=>Array.isArray(t)?t:[],X_e=(t,e)=>typeof t=="boolean"?t:t==null?e:String(t).toLowerCase()==="true",Sz=(t,e)=>typeof t=="number"&&Number.isFinite(t)?Math.trunc(t):e,wz=(t,e)=>{let n=t[e];if(typeof n!="string"||n.trim()==="")throw new Error(`'${e}' is required.`);return n},Iz=(t,e,n)=>{let r=kA(t.where);if(Object.keys(r).length>0)return r;if(t[n]===!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 n=Az(t.fields).filter(r=>typeof r=="string"&&r.trim()!=="");return n.length>0?(xA(n,"fields"),n):e.length>0?e.slice(0,J_e):[LA]},eEe=t=>t.includes(LA)?t:[LA,...t],MA=(t,e,n=[])=>{if(t==="runtime.run_code")return{document:bz(),variables:{jsCode:wz(e,"jsCode"),args:kA(e.args),updateDb:X_e(e.updateDb,!1)},rootField:"fz_debug_action_code"};let r=wz(e,"tableName");switch(Ba(r,"tableName"),t){case"runtime.query":return{document:yz(r,Zg(e,n)),variables:{where:e.where??{},limit:Math.min(Sz(e.limit,Y_e),Q_e),offset:Sz(e.offset,0),order_by:e.orderBy??null},rootField:r};case"runtime.aggregate":return{document:_z(r),variables:{where:e.where??{}},rootField:`${r}_aggregate`};case"runtime.insert":{let i=Az(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:Ez(r,eEe(Zg(e,n))),variables:{objects:i},rootField:`insert_${r}`}}case"runtime.update":{let i=Iz(e,"update","allowUpdateAll"),a=kA(e.set);if(Object.keys(a).length===0)throw new Error("'set' must contain at least one column to change.");return{document:vz(r,Zg(e,n)),variables:{where:i,set:a},rootField:`update_${r}`}}case"runtime.delete":return{document:Tz(r,Zg(e,n)),variables:{where:Iz(e,"delete","allowDeleteAll")},rootField:`delete_${r}`};default:throw new Error(`'${t}' is not a planned runtime 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 Gd(t,e,n,r){let i=await n.checkSchema(e),a=await n.getProjectArgs(e),o=ys(e.tableName,"tableName"),[s,c]=await Promise.all([n.schemaManager.dataModel(Ii(a.projectExId,a)),cl(n.client,a)]);gz(s,o,gs(e.fields));let l=MA(t,{...e,tableName:o},ZV(s,o)),u;try{u=await c.dataClient.request(l.document,l.variables)}catch(p){throw mz(p,o,s)}return n.ok(Bn(r?Oz(u):u,i))}var tEe=async(t,e)=>{let n=await e.checkSchema(t),r=await e.getProjectArgs(t),i=ys(t.query,"query"),o=await(await cl(e.client,r)).dataClient.request(i,t.variables??{});return e.ok(Bn(o,n))},nEe=async(t,e)=>Gd("runtime.query",t,e,!1),rEe=async(t,e)=>Gd("runtime.aggregate",t,e,!1),iEe=async(t,e)=>Gd("runtime.insert",t,e,!0),aEe=async(t,e)=>Gd("runtime.update",t,e,!0),oEe=async(t,e)=>Gd("runtime.delete",t,e,!0),sEe=async(t,e)=>{let n=await e.getProjectArgs(t),r=MA("runtime.run_code",t),a=await(await cl(e.client,n)).adminClient.request(r.document,r.variables);return e.ok({keptWrites:r.variables.updateDb===!0,result:a?.fz_debug_action_code})},Nz={"runtime.graphql":tEe,"runtime.run_code":sEe,"runtime.query":nEe,"runtime.aggregate":rEe,"runtime.insert":iEe,"runtime.update":aEe,"runtime.delete":oEe};d();var cEe=["GATEWAY","ACTION_FLOW","ACTION_FLOW_NODE","ACTION_FLOW_CONTEXT_LOG","DEPLOYMENT","TPA","TRIGGER","SQL_GENERATION","GQL","ZAI"],lEe=["INFO","WARNING","ERROR"],uEe=50,dEe=100,Cz=5,Pz=t=>`${t.toISOString().slice(0,19)}Z`,pEe=t=>{if(!t)return new Date;let e=new Date(t);return Number.isNaN(e.getTime())?new Date:e},Rz=(t,e)=>{if(!t)return;let n=t.map(r=>r.toUpperCase()).filter(r=>e.includes(r));return n.length>0?n:void 0},hEe=async(t,e)=>{let n=await e.getProjectArgs(t),i=(await cl(e.client,n)).dataVisualizer.token;if(!i)throw new Error(`Log admin token is missing for project ${n.projectExId}`);let a=pEe(me(t.requestCreatedAt)),o={start:Pz(new Date(a.getTime()-Cz*6e4)),end:Pz(new Date(a.getTime()+Cz*6e4)),desc:!0},s=Rz(gs(t.types),cEe);s&&(o.type=s);let c=Rz(gs(t.levels),lEe);c&&(o.level=c);let l=me(t.customQueryCondition);l&&(o.customQueryCondition=l);let u=Math.min(dEe,vn(t.limit,uEe)),p=mn().logApiUrlTemplate.replace("{projectExId}",n.projectExId),m=((await new tn(p,{headers:{authorization:`Bearer ${i}`},fetch:Xc}).request(AG,{queryCreation:o,paginator:{first:u}}))?.fetchLogsByPaginator?.edges??[]).map(_=>_?.node).filter(_=>!!_);return e.ok({entries:m})},Dz={"logs.search":hEe};d();d();d();d();import{readFileSync as bEe}from"node:fs";import{dirname as SEe,join as wEe}from"node:path";import{fileURLToPath as IEe}from"node:url";d();var Wt,Bd=null;function Hg(){return(Bd===null||Bd.byteLength===0)&&(Bd=new Uint8Array(Wt.memory.buffer)),Bd}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 fEe=2146435072,jA=0;function mEe(t,e){return jA+=e,jA>=fEe&&(Kg=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}},Kg.decode(),jA=e),Kg.decode(Hg().subarray(t,t+e))}function UA(t,e){return t=t>>>0,mEe(t,e)}function $A(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+=$A(t[0]));for(let o=1;o<i;o++)a+=", "+$A(t[o]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(t)),r;if(n&&n.length>1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
|
|
1920
|
-
${t.stack}`:r}var Qg=0,Yg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},gEe=typeof Yg.encodeInto=="function"?function(t,e){return Yg.encodeInto(t,e)}:function(t,e){let n=Yg.encode(t);return e.set(n),{read:t.length,written:n.length}};function xz(t,e,n){if(n===void 0){let s=Yg.encode(t),c=e(s.length,1)>>>0;return Hg().subarray(c,c+s.length).set(s),Qg=s.length,c}let r=t.length,i=e(r,1)>>>0,a=Hg(),o=0;for(;o<r;o++){let s=t.charCodeAt(o);if(s>127)break;a[i+o]=s}if(o!==r){o!==0&&(t=t.slice(o)),i=n(i,r,r=o+t.length*3,1)>>>0;let s=Hg().subarray(i+o,i+r),c=gEe(t,s);o+=c.written,i=n(i,r,o,1)>>>0}return Qg=o,i}var _s=null;function FA(){return(_s===null||_s.buffer.detached===!0||_s.buffer.detached===void 0&&_s.buffer!==Wt.memory.buffer)&&(_s=new DataView(Wt.memory.buffer)),_s}function yEe(t){return t==null}function _Ee(t,e){t=t>>>0;let n=FA(),r=[];for(let i=t;i<t+4*e;i+=4)r.push(Wt.__wbindgen_export_2.get(n.getUint32(i,!0)));return Wt.__externref_drop_slice(t,e),r}function Lz(t,e){let n=xz(t,Wt.__wbindgen_malloc,Wt.__wbindgen_realloc),r=Qg,i=Wt.cut(n,r,yEe(e)?16777215:e?1:0);var a=_Ee(i[0],i[1]).slice();return Wt.__wbindgen_free(i[0],i[1]*4,4),a}var EEe=new Set(["basic","cors","default"]);async function vEe(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.ok&&EEe.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",r);else throw r}let n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{let n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function kz(){let t={};return t.wbg={},t.wbg.__wbg_Error_0497d5bdba9362e5=function(e,n){return Error(UA(e,n))},t.wbg.__wbg_new_07b483f72211fd66=function(){return new Object},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,r){e[n]=r},t.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_debug_string=function(e,n){let r=$A(n),i=xz(r,Wt.__wbindgen_malloc,Wt.__wbindgen_realloc),a=Qg;FA().setInt32(e+4,a,!0),FA().setInt32(e+0,i,!0)},t.wbg.__wbindgen_init_externref_table=function(){let e=Wt.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t.wbg.__wbindgen_number_new=function(e){return e},t.wbg.__wbindgen_string_new=function(e,n){return UA(e,n)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(UA(e,n))},t}function Mz(t,e){return Wt=t.exports,TEe.__wbindgen_wasm_module=e,_s=null,Bd=null,Wt.__wbindgen_start(),Wt}function jz(t){if(Wt!==void 0)return Wt;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=kz();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let n=new WebAssembly.Instance(t,e);return Mz(n,t)}async function TEe(t){if(Wt!==void 0)return Wt;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=kz();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:n,module:r}=await vEe(await t,e);return Mz(n,r)}var Uz=!1,$z=(t,e)=>{if(!Uz){let n=wEe(SEe(IEe(import.meta.url)),"jieba-engine.wasm");jz({module:bEe(n)}),Uz=!0}return Lz(t,e)};var AEe=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"]),OEe=/[a-z0-9]+/g,NEe=t=>{let e=t.toLowerCase().replace(/'s\b/g,""),n=[];for(let r of e.matchAll(OEe)){let i=r[0];AEe.has(i)||n.push(REe(i))}return n},CEe=/[㐀-鿿豈--ヿ가-]|[a-z0-9]/i,PEe=t=>$z(t.toLowerCase(),!0).filter(e=>CEe.test(e)),ul=t=>{switch(Mr){case"ZION":return PEe(t);case"MOMEN":return NEe(t);default:throw new Error(`[analyzer] unknown PRODUCT '${Mr}'`)}},Es=(t,e)=>{let n=t[e];return n==="a"||n==="e"||n==="i"||n==="o"||n==="u"?!1:n==="y"?e===0?!0:!Es(t,e-1):!0},Va=t=>{let e=0,n=!1;for(let r=0;r<t.length;r+=1){let i=!Es(t,r);n&&!i&&(e+=1),n=i}return e},qA=t=>{for(let e=0;e<t.length;e+=1)if(!Es(t,e))return!0;return!1},Fz=t=>{let e=t.length;return e>=2&&t[e-1]===t[e-2]&&Es(t,e-1)},qz=t=>{let e=t.length;if(e<3||!Es(t,e-1)||Es(t,e-2)||!Es(t,e-3))return!1;let n=t[e-1];return n!=="w"&&n!=="x"&&n!=="y"},Jg=(t,e,n)=>t.slice(0,t.length-e.length)+n;function REe(t){let e=t;if(e.length<=2)return e;e.endsWith("sses")?e=Jg(e,"sses","ss"):e.endsWith("ies")?e=Jg(e,"ies","i"):e.endsWith("ss")||e.endsWith("s")&&(e=e.slice(0,-1));let n=!1;e.endsWith("eed")?Va(e.slice(0,-3))>0&&(e=e.slice(0,-1)):e.endsWith("ed")&&qA(e.slice(0,-2))?(e=e.slice(0,-2),n=!0):e.endsWith("ing")&&qA(e.slice(0,-3))&&(e=e.slice(0,-3),n=!0),n&&(e.endsWith("at")||e.endsWith("bl")||e.endsWith("iz")?e+="e":Fz(e)&&!/[lsz]$/.test(e)?e=e.slice(0,-1):Va(e)===1&&qz(e)&&(e+="e")),e.endsWith("y")&&qA(e.slice(0,-1))&&(e=`${e.slice(0,-1)}i`);let r=[["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 r)if(e.endsWith(s)){Va(e.slice(0,e.length-s.length))>0&&(e=Jg(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)){Va(e.slice(0,e.length-s.length))>0&&(e=Jg(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);Va(c)>1&&(e=c),o=!0;break}if(!o&&e.endsWith("ion")){let s=e.slice(0,-3);Va(s)>1&&/[st]$/.test(s)&&(e=s)}if(e.endsWith("e")){let s=e.slice(0,-1),c=Va(s);(c>1||c===1&&!qz(s))&&(e=s)}return Va(e)>1&&Fz(e)&&e.endsWith("l")&&(e=e.slice(0,-1)),e}d();var Gz=1.5,Bz=.75,GA=t=>{let e=[],n=new Map,r=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())n.set(s,(n.get(s)??0)+1);e.push({ref:i,tf:o,length:a.length}),r+=a.length}return{docs:e,df:n,avgdl:e.length>0?r/e.length:0}},BA=(t,e)=>{let n=[...new Set(ul(e))],r=t.docs.length;return n.length===0||r===0?[]:t.docs.map(i=>{let a=0;for(let o of n){let s=i.tf.get(o);if(!s)continue;let c=t.df.get(o)??0,l=Math.log(1+(r-c+.5)/(c+.5)),u=s+Gz*(1-Bz+Bz*i.length/(t.avgdl||1));a+=l*(s*(Gz+1)/u)}return{ref:i.ref,score:a}})};var DEe=async()=>(await import("./corpus-GPYGTVKY.js")).DOCS_CORPUS,xEe=3,Vz=null,LEe=t=>{let e=new Map,n=t.map(r=>{e.set(r.path,r);let i=ul(r.content),a=ul(r.title);for(let o=0;o<xEe;o+=1)i.push(...a);return{ref:r,tokens:i}});return{index:GA(n),byPath:e}},zz=async()=>(Vz??=LEe(await DEe()),Vz),Wz=async(t,e=10)=>{let{index:n}=await zz();return BA(n,t).filter(r=>r.score>0).sort((r,i)=>i.score-r.score).slice(0,Math.max(1,e)).map(r=>({path:r.ref.path,title:r.ref.title,url:r.ref.url}))},Zz=async t=>{let e=t.replace(/\.mdx$/,""),n=e.startsWith("/")?e:`/${e}`;return(await zz()).byPath.get(n)??null};var kEe=async(t,e)=>{let n=me(t.query);if(!n)throw new Error("query is required");let r=vn(t.limit,10);return e.ok({results:await Wz(n,r)})},MEe=async(t,e)=>{let n=me(t.path);if(!n)throw new Error("path is required");let r=await Zz(n);if(!r)throw new Error(`No doc page found for path: ${n}`);return e.ok(r)},Hz={"docs.search":kEe,"docs.get_page":MEe};d();var jEe=async(t,e)=>{let n=me(t.query);if(!n)throw new Error("query is required");let r=t.variables&&typeof t.variables=="object"?t.variables:{};return e.ok(await e.client.request(n,r))},Kz={"platform.graphql":jEe};d();var UEe=async(t,e)=>{let r=((await e.client.request($q)).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:r})},Yz={"actionflow.list_node_templates":UEe};d();var nK=Rt($H(),1);d();function pwe(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 hwe(t,e){let n=t.body?.getReader();if(!n)throw new Error(`Empty response body from ${e}`);let r=[],i=0;for(;;){let{done:a,value:o}=await n.read();if(a)break;if(i+=o.byteLength,i>10485760)throw await n.cancel(),new Error("Response exceeds size limit of 10485760 bytes");r.push(o)}return Buffer.concat(r).toString("utf8")}async function wN(t){let e=t;for(let n=0;n<=5;n++){let r=pwe(e),i=await fetch(r,{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,r).toString();continue}if(!i.ok)throw await i.body?.cancel(),new Error(`HTTP ${i.status} fetching ${e}`);return{finalUrl:r.toString(),contentType:i.headers.get("content-type"),body:await hwe(i,e)}}throw new Error(`Too many redirects fetching ${t}`)}d();var fwe=/(?:href|src|url)\s*[=:]\s*["']?([^"'\s>)]+)/gi,mwe=/<(script|style|noscript|svg|iframe|canvas|template|nav|footer|aside)\b[\s\S]*?<\/\1\s*>/gi,gwe=new Set(["css","js","png","jpg","jpeg","gif","svg","ico","woff","woff2","ttf","webp","mp4","zip","pdf"]);function FH(t,e){if(t&&t.toLowerCase().includes("html"))return!0;let n=e.trimStart();return n.startsWith("<")&&!n.startsWith("<?xml")}function qH(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 GH(t,e){try{return new URL(e,t).toString()}catch{return e.startsWith("http")?e:null}}var ywe=/^https?:\/\/app\.swaggerhub\.com\/apis(?:-docs)?\/([^/?#]+)\/([^/?#]+)\/([^/?#]+)/i;function _we(t){let e=t.match(ywe);return e?`https://api.swaggerhub.com/apis/${e[1]}/${e[2]}/${e[3]}`:null}function BH(t,e){let n=[],r=i=>{i&&n.length<20&&!n.includes(i)&&n.push(i)};for(let i of t.matchAll(fwe)){if(n.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=GH(e,a);r(c&&_we(c)),r(c)}return n}function VH(t,e){let n=[],r;try{r=new URL(e).host}catch{return n}for(let i of t.matchAll(/<a\b[^>]*href\s*=\s*["']([^"'#]+)[^"']*["']/gi)){if(n.length>=40)break;let a;try{a=new URL(i[1],e)}catch{continue}if(a.host!==r)continue;a.hash="";let o=a.toString(),s=a.pathname.toLowerCase(),c=s.slice(s.lastIndexOf(".")+1);gwe.has(c)||o===e||n.includes(o)||n.push(o)}return n}var Ewe={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",copy:"\xA9"};function IN(t){return t.replace(/&#x([0-9a-f]+);/gi,(e,n)=>String.fromCodePoint(parseInt(n,16))).replace(/&#(\d+);/g,(e,n)=>String.fromCodePoint(parseInt(n,10))).replace(/&([a-z]+);/gi,(e,n)=>Ewe[n.toLowerCase()]??e)}var vp=t=>t.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();function zH(t,e){let n=t.replace(/<!--[\s\S]*?-->/g,"").replace(mwe,"");return n=n.replace(/<pre\b[^>]*>([\s\S]*?)<\/pre\s*>/gi,(r,i)=>`
|
|
1920
|
+
${t.stack}`:r}var Qg=0,Yg=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},gEe=typeof Yg.encodeInto=="function"?function(t,e){return Yg.encodeInto(t,e)}:function(t,e){let n=Yg.encode(t);return e.set(n),{read:t.length,written:n.length}};function xz(t,e,n){if(n===void 0){let s=Yg.encode(t),c=e(s.length,1)>>>0;return Hg().subarray(c,c+s.length).set(s),Qg=s.length,c}let r=t.length,i=e(r,1)>>>0,a=Hg(),o=0;for(;o<r;o++){let s=t.charCodeAt(o);if(s>127)break;a[i+o]=s}if(o!==r){o!==0&&(t=t.slice(o)),i=n(i,r,r=o+t.length*3,1)>>>0;let s=Hg().subarray(i+o,i+r),c=gEe(t,s);o+=c.written,i=n(i,r,o,1)>>>0}return Qg=o,i}var _s=null;function FA(){return(_s===null||_s.buffer.detached===!0||_s.buffer.detached===void 0&&_s.buffer!==Wt.memory.buffer)&&(_s=new DataView(Wt.memory.buffer)),_s}function yEe(t){return t==null}function _Ee(t,e){t=t>>>0;let n=FA(),r=[];for(let i=t;i<t+4*e;i+=4)r.push(Wt.__wbindgen_export_2.get(n.getUint32(i,!0)));return Wt.__externref_drop_slice(t,e),r}function Lz(t,e){let n=xz(t,Wt.__wbindgen_malloc,Wt.__wbindgen_realloc),r=Qg,i=Wt.cut(n,r,yEe(e)?16777215:e?1:0);var a=_Ee(i[0],i[1]).slice();return Wt.__wbindgen_free(i[0],i[1]*4,4),a}var EEe=new Set(["basic","cors","default"]);async function vEe(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.ok&&EEe.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",r);else throw r}let n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{let n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function kz(){let t={};return t.wbg={},t.wbg.__wbg_Error_0497d5bdba9362e5=function(e,n){return Error(UA(e,n))},t.wbg.__wbg_new_07b483f72211fd66=function(){return new Object},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,r){e[n]=r},t.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_debug_string=function(e,n){let r=$A(n),i=xz(r,Wt.__wbindgen_malloc,Wt.__wbindgen_realloc),a=Qg;FA().setInt32(e+4,a,!0),FA().setInt32(e+0,i,!0)},t.wbg.__wbindgen_init_externref_table=function(){let e=Wt.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t.wbg.__wbindgen_number_new=function(e){return e},t.wbg.__wbindgen_string_new=function(e,n){return UA(e,n)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(UA(e,n))},t}function Mz(t,e){return Wt=t.exports,TEe.__wbindgen_wasm_module=e,_s=null,Bd=null,Wt.__wbindgen_start(),Wt}function jz(t){if(Wt!==void 0)return Wt;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=kz();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let n=new WebAssembly.Instance(t,e);return Mz(n,t)}async function TEe(t){if(Wt!==void 0)return Wt;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=kz();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:n,module:r}=await vEe(await t,e);return Mz(n,r)}var Uz=!1,$z=(t,e)=>{if(!Uz){let n=wEe(SEe(IEe(import.meta.url)),"jieba-engine.wasm");jz({module:bEe(n)}),Uz=!0}return Lz(t,e)};var AEe=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"]),OEe=/[a-z0-9]+/g,NEe=t=>{let e=t.toLowerCase().replace(/'s\b/g,""),n=[];for(let r of e.matchAll(OEe)){let i=r[0];AEe.has(i)||n.push(REe(i))}return n},CEe=/[㐀-鿿豈--ヿ가-]|[a-z0-9]/i,PEe=t=>$z(t.toLowerCase(),!0).filter(e=>CEe.test(e)),ul=t=>{switch(Mr){case"ZION":return PEe(t);case"MOMEN":return NEe(t);default:throw new Error(`[analyzer] unknown PRODUCT '${Mr}'`)}},Es=(t,e)=>{let n=t[e];return n==="a"||n==="e"||n==="i"||n==="o"||n==="u"?!1:n==="y"?e===0?!0:!Es(t,e-1):!0},Va=t=>{let e=0,n=!1;for(let r=0;r<t.length;r+=1){let i=!Es(t,r);n&&!i&&(e+=1),n=i}return e},qA=t=>{for(let e=0;e<t.length;e+=1)if(!Es(t,e))return!0;return!1},Fz=t=>{let e=t.length;return e>=2&&t[e-1]===t[e-2]&&Es(t,e-1)},qz=t=>{let e=t.length;if(e<3||!Es(t,e-1)||Es(t,e-2)||!Es(t,e-3))return!1;let n=t[e-1];return n!=="w"&&n!=="x"&&n!=="y"},Jg=(t,e,n)=>t.slice(0,t.length-e.length)+n;function REe(t){let e=t;if(e.length<=2)return e;e.endsWith("sses")?e=Jg(e,"sses","ss"):e.endsWith("ies")?e=Jg(e,"ies","i"):e.endsWith("ss")||e.endsWith("s")&&(e=e.slice(0,-1));let n=!1;e.endsWith("eed")?Va(e.slice(0,-3))>0&&(e=e.slice(0,-1)):e.endsWith("ed")&&qA(e.slice(0,-2))?(e=e.slice(0,-2),n=!0):e.endsWith("ing")&&qA(e.slice(0,-3))&&(e=e.slice(0,-3),n=!0),n&&(e.endsWith("at")||e.endsWith("bl")||e.endsWith("iz")?e+="e":Fz(e)&&!/[lsz]$/.test(e)?e=e.slice(0,-1):Va(e)===1&&qz(e)&&(e+="e")),e.endsWith("y")&&qA(e.slice(0,-1))&&(e=`${e.slice(0,-1)}i`);let r=[["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 r)if(e.endsWith(s)){Va(e.slice(0,e.length-s.length))>0&&(e=Jg(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)){Va(e.slice(0,e.length-s.length))>0&&(e=Jg(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);Va(c)>1&&(e=c),o=!0;break}if(!o&&e.endsWith("ion")){let s=e.slice(0,-3);Va(s)>1&&/[st]$/.test(s)&&(e=s)}if(e.endsWith("e")){let s=e.slice(0,-1),c=Va(s);(c>1||c===1&&!qz(s))&&(e=s)}return Va(e)>1&&Fz(e)&&e.endsWith("l")&&(e=e.slice(0,-1)),e}d();var Gz=1.5,Bz=.75,GA=t=>{let e=[],n=new Map,r=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())n.set(s,(n.get(s)??0)+1);e.push({ref:i,tf:o,length:a.length}),r+=a.length}return{docs:e,df:n,avgdl:e.length>0?r/e.length:0}},BA=(t,e)=>{let n=[...new Set(ul(e))],r=t.docs.length;return n.length===0||r===0?[]:t.docs.map(i=>{let a=0;for(let o of n){let s=i.tf.get(o);if(!s)continue;let c=t.df.get(o)??0,l=Math.log(1+(r-c+.5)/(c+.5)),u=s+Gz*(1-Bz+Bz*i.length/(t.avgdl||1));a+=l*(s*(Gz+1)/u)}return{ref:i.ref,score:a}})};var DEe=async()=>(await import("./corpus-CJ4HEC2R.js")).DOCS_CORPUS,xEe=3,Vz=null,LEe=t=>{let e=new Map,n=t.map(r=>{e.set(r.path,r);let i=ul(r.content),a=ul(r.title);for(let o=0;o<xEe;o+=1)i.push(...a);return{ref:r,tokens:i}});return{index:GA(n),byPath:e}},zz=async()=>(Vz??=LEe(await DEe()),Vz),Wz=async(t,e=10)=>{let{index:n}=await zz();return BA(n,t).filter(r=>r.score>0).sort((r,i)=>i.score-r.score).slice(0,Math.max(1,e)).map(r=>({path:r.ref.path,title:r.ref.title,url:r.ref.url}))},Zz=async t=>{let e=t.replace(/\.mdx$/,""),n=e.startsWith("/")?e:`/${e}`;return(await zz()).byPath.get(n)??null};var kEe=async(t,e)=>{let n=me(t.query);if(!n)throw new Error("query is required");let r=vn(t.limit,10);return e.ok({results:await Wz(n,r)})},MEe=async(t,e)=>{let n=me(t.path);if(!n)throw new Error("path is required");let r=await Zz(n);if(!r)throw new Error(`No doc page found for path: ${n}`);return e.ok(r)},Hz={"docs.search":kEe,"docs.get_page":MEe};d();var jEe=async(t,e)=>{let n=me(t.query);if(!n)throw new Error("query is required");let r=t.variables&&typeof t.variables=="object"?t.variables:{};return e.ok(await e.client.request(n,r))},Kz={"platform.graphql":jEe};d();var UEe=async(t,e)=>{let r=((await e.client.request($q)).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:r})},Yz={"actionflow.list_node_templates":UEe};d();var nK=Rt($H(),1);d();function pwe(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 hwe(t,e){let n=t.body?.getReader();if(!n)throw new Error(`Empty response body from ${e}`);let r=[],i=0;for(;;){let{done:a,value:o}=await n.read();if(a)break;if(i+=o.byteLength,i>10485760)throw await n.cancel(),new Error("Response exceeds size limit of 10485760 bytes");r.push(o)}return Buffer.concat(r).toString("utf8")}async function wN(t){let e=t;for(let n=0;n<=5;n++){let r=pwe(e),i=await fetch(r,{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,r).toString();continue}if(!i.ok)throw await i.body?.cancel(),new Error(`HTTP ${i.status} fetching ${e}`);return{finalUrl:r.toString(),contentType:i.headers.get("content-type"),body:await hwe(i,e)}}throw new Error(`Too many redirects fetching ${t}`)}d();var fwe=/(?:href|src|url)\s*[=:]\s*["']?([^"'\s>)]+)/gi,mwe=/<(script|style|noscript|svg|iframe|canvas|template|nav|footer|aside)\b[\s\S]*?<\/\1\s*>/gi,gwe=new Set(["css","js","png","jpg","jpeg","gif","svg","ico","woff","woff2","ttf","webp","mp4","zip","pdf"]);function FH(t,e){if(t&&t.toLowerCase().includes("html"))return!0;let n=e.trimStart();return n.startsWith("<")&&!n.startsWith("<?xml")}function qH(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 GH(t,e){try{return new URL(e,t).toString()}catch{return e.startsWith("http")?e:null}}var ywe=/^https?:\/\/app\.swaggerhub\.com\/apis(?:-docs)?\/([^/?#]+)\/([^/?#]+)\/([^/?#]+)/i;function _we(t){let e=t.match(ywe);return e?`https://api.swaggerhub.com/apis/${e[1]}/${e[2]}/${e[3]}`:null}function BH(t,e){let n=[],r=i=>{i&&n.length<20&&!n.includes(i)&&n.push(i)};for(let i of t.matchAll(fwe)){if(n.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=GH(e,a);r(c&&_we(c)),r(c)}return n}function VH(t,e){let n=[],r;try{r=new URL(e).host}catch{return n}for(let i of t.matchAll(/<a\b[^>]*href\s*=\s*["']([^"'#]+)[^"']*["']/gi)){if(n.length>=40)break;let a;try{a=new URL(i[1],e)}catch{continue}if(a.host!==r)continue;a.hash="";let o=a.toString(),s=a.pathname.toLowerCase(),c=s.slice(s.lastIndexOf(".")+1);gwe.has(c)||o===e||n.includes(o)||n.push(o)}return n}var Ewe={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",copy:"\xA9"};function IN(t){return t.replace(/&#x([0-9a-f]+);/gi,(e,n)=>String.fromCodePoint(parseInt(n,16))).replace(/&#(\d+);/g,(e,n)=>String.fromCodePoint(parseInt(n,10))).replace(/&([a-z]+);/gi,(e,n)=>Ewe[n.toLowerCase()]??e)}var vp=t=>t.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim();function zH(t,e){let n=t.replace(/<!--[\s\S]*?-->/g,"").replace(mwe,"");return n=n.replace(/<pre\b[^>]*>([\s\S]*?)<\/pre\s*>/gi,(r,i)=>`
|
|
1921
1921
|
\`\`\`
|
|
1922
1922
|
${IN(vwe(i))}
|
|
1923
1923
|
\`\`\`
|
|
@@ -2364,7 +2364,7 @@ creating a field, still pass the primitive name (a column shown as TEXT is creat
|
|
|
2364
2364
|
separate 'required' field controls nullability; never wrap a type in a null union.
|
|
2365
2365
|
|
|
2366
2366
|
### Naming
|
|
2367
|
-
apiName \u2014 spelled 'tableApiName' on a table, 'apiName' on a field, and reported under those names by every read: English snake_case. Tables are nouns or noun phrases, singular not plural ("order", not "orders"), concise (e.g. "user_profile"); fields are snake_case (e.g. "first_name", "is_active"). No name may contain a space \u2014 not tables, fields, relations, or constraints, and not even the displayName. An apiName is permanent once created; only the displayName can be changed later. displayName: user-visible; use the natural Chinese name as the displayName and derive the English snake_case apiName from it (e.g. displayName "\u7528\u6237\u540D" \u2192 apiName "user_name").
|
|
2367
|
+
apiName \u2014 spelled 'tableApiName' on a table, 'apiName' on a field, 'fieldApiNameInSourceTable' / 'fieldApiNameInTargetTable' on the two sides of a relation, and reported under those names by every read: English snake_case. Tables are nouns or noun phrases, singular not plural ("order", not "orders"), concise (e.g. "user_profile"); fields are snake_case (e.g. "first_name", "is_active"). No name may contain a space \u2014 not tables, fields, relations, or constraints, and not even the displayName. An apiName is permanent once created; only the displayName can be changed later. displayName: user-visible; use the natural Chinese name as the displayName and derive the English snake_case apiName from it (e.g. displayName "\u7528\u6237\u540D" \u2192 apiName "user_name").
|
|
2368
2368
|
|
|
2369
2369
|
### System Built-ins & Product Context
|
|
2370
2370
|
Every table has non-deletable built-in fields: id (BIGINT), created_at (TIMESTAMPTZ), updated_at (TIMESTAMPTZ). Do NOT include these when creating a table. Any table, field, or relation where 'editable' is false is system built-in and cannot be modified or deleted. System tables and timezone configurations for Zion:
|
|
@@ -2383,9 +2383,9 @@ That leaves 'required' as the one to place carefully, since a mandatory column n
|
|
|
2383
2383
|
### Relations
|
|
2384
2384
|
Types: one_to_one, one_to_many. Defined on the source table.
|
|
2385
2385
|
To make one table reference another, create a RELATION \u2014 never add a manual foreign-key column (e.g. a "*_id" field) or a column whose type is another table. The FK column and the virtual reference fields are generated automatically. Add the relation on the SOURCE table only; it is reflected on the target automatically.
|
|
2386
|
-
A relation is configured by
|
|
2386
|
+
A relation is configured by seven required fields: relationType, sourceTableDisplayName, targetTableDisplayName, and both a display name and an apiName for the field it adds to each side \u2014 fieldDisplayNameInSourceTable / fieldApiNameInSourceTable and fieldDisplayNameInTargetTable / fieldApiNameInTargetTable. Reads report those seven plus 'editable'. Each of those four names a field that does not exist yet, so each must be unique among its own table's fields, relations on that table included: reusing a column name ("id"), the table's own name, or another relation's field name on that table is rejected.
|
|
2387
2387
|
Creating a relation auto-generates:
|
|
2388
|
-
- A non-editable FK field in the target table
|
|
2388
|
+
- A non-editable FK field in the target table, its display name fieldDisplayNameInTargetTable + "_id" (e.g. "user_id", "\u6D3B\u52A8_id") and its apiName fieldApiNameInTargetTable + "_id". Stores the source row's id, and is unique when the relation is one_to_one. Never write that "_id" yourself: "user_id" as the target-side name produces the field "user_id_id". Deleted when the relation is deleted.
|
|
2389
2389
|
- Virtual reference fields in both tables (NOT real columns), one per side: fieldDisplayNameInSourceTable lives on the source; fieldDisplayNameInTargetTable lives on the target.
|
|
2390
2390
|
Examples:
|
|
2391
2391
|
- 1:n user (source) \u2192 post (target), source field "posts", target field "user"
|
|
@@ -2440,7 +2440,7 @@ A computed field's value is derived from the row's other fields every time it is
|
|
|
2440
2440
|
Never fake a computed field with a plain column written at insert time: it goes stale the moment any input changes. Reach for a write-time value only when the user wants the number frozen as of the write.
|
|
2441
2441
|
|
|
2442
2442
|
### Naming
|
|
2443
|
-
apiName \u2014 spelled 'tableApiName' on a table, 'apiName' on a field, and reported under those names by every read: English snake_case. Tables are nouns or noun phrases, singular not plural ("order", not "orders"), concise (e.g. "user_profile"); fields are snake_case (e.g. "first_name", "is_active"). No name may contain a space \u2014 not tables, fields, relations, or constraints, and not even the displayName. An apiName is permanent once created; only the displayName can be changed later. displayName: user-visible; use the natural Chinese name as the displayName and derive the English snake_case apiName from it (e.g. displayName "\u7528\u6237\u540D" \u2192 apiName "user_name").
|
|
2443
|
+
apiName \u2014 spelled 'tableApiName' on a table, 'apiName' on a field, 'fieldApiNameInSourceTable' / 'fieldApiNameInTargetTable' on the two sides of a relation, and reported under those names by every read: English snake_case. Tables are nouns or noun phrases, singular not plural ("order", not "orders"), concise (e.g. "user_profile"); fields are snake_case (e.g. "first_name", "is_active"). No name may contain a space \u2014 not tables, fields, relations, or constraints, and not even the displayName. An apiName is permanent once created; only the displayName can be changed later. displayName: user-visible; use the natural Chinese name as the displayName and derive the English snake_case apiName from it (e.g. displayName "\u7528\u6237\u540D" \u2192 apiName "user_name").
|
|
2444
2444
|
|
|
2445
2445
|
### System Built-ins & Product Context
|
|
2446
2446
|
Every table has non-deletable built-in fields: id (s:p:bigint), created_at (s:p:timestamptz), updated_at (s:p:timestamptz). Do NOT include these when creating a table. Any table, field, or relation where 'editable' is false is system built-in and cannot be modified or deleted. System tables and timezone configurations for Zion:
|
|
@@ -2462,9 +2462,9 @@ Default value formatting:
|
|
|
2462
2462
|
### Relations
|
|
2463
2463
|
Types: one_to_one, one_to_many. Defined on the source table.
|
|
2464
2464
|
To make one table reference another, create a RELATION \u2014 never add a manual foreign-key column (e.g. a "*_id" field) or a column whose type is another table. The FK column and the virtual reference fields are generated automatically. Add the relation on the SOURCE table only; it is reflected on the target automatically.
|
|
2465
|
-
A relation is configured by
|
|
2465
|
+
A relation is configured by seven required fields: relationType, sourceTableDisplayName, targetTableDisplayName, and both a display name and an apiName for the field it adds to each side \u2014 fieldDisplayNameInSourceTable / fieldApiNameInSourceTable and fieldDisplayNameInTargetTable / fieldApiNameInTargetTable. Reads report those seven plus 'editable'. Each of those four names a field that does not exist yet, so each must be unique among its own table's fields, relations on that table included: reusing a column name ("id"), the table's own name, or another relation's field name on that table is rejected.
|
|
2466
2466
|
Creating a relation auto-generates:
|
|
2467
|
-
- A non-editable FK field in the target table
|
|
2467
|
+
- A non-editable FK field in the target table, its display name fieldDisplayNameInTargetTable + "_id" (e.g. "user_id", "\u6D3B\u52A8_id") and its apiName fieldApiNameInTargetTable + "_id". Stores the source row's id, and is unique when the relation is one_to_one. Never write that "_id" yourself: "user_id" as the target-side name produces the field "user_id_id". Deleted when the relation is deleted.
|
|
2468
2468
|
- Virtual reference fields in both tables (NOT real columns), one per side: fieldDisplayNameInSourceTable lives on the source; fieldDisplayNameInTargetTable lives on the target.
|
|
2469
2469
|
Examples:
|
|
2470
2470
|
- 1:n user (source) \u2192 post (target), source field "posts", target field "user"
|