@oomol-lab/open-flow 0.1.0-beta.76 → 0.1.0-beta.78
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 +3 -0
- package/dist/browser/{ContentIcon-Cm1hbVzW.js → ContentIcon-CMn0c-kl.js} +99 -6
- package/dist/browser/{FlowCanvas-NzKtla_c.js → FlowCanvas-BQGBcfoL.js} +1709 -613
- package/dist/browser/{createResourceDialog-BgdedQqu.js → createResourceDialog-DCGxfKFM.js} +63 -57
- package/dist/browser/{dialog-aSElFFw2.js → dialog-WzR4CRFH.js} +76 -77
- package/dist/browser/{exportSvg-Dcz4HTo_.js → exportSvg-CYwyYiuH.js} +2 -2
- package/dist/browser/{flowChanges-NZyS7HSp.js → flowChanges-Bz4dbDN_.js} +6875 -11091
- package/dist/browser/{flowWorkspace-Bl0SDehy.js → flowWorkspace-BI6L6a4r.js} +1415 -3037
- package/dist/browser/licenses.md +1 -1
- package/dist/browser/preview.css +619 -462
- package/dist/browser/preview.js +9016 -14956
- package/dist/browser/theme.css +4 -2
- package/dist/browser/{tooltip-3XMK9jkr.js → tooltip-BDcVTNpu.js} +65 -2
- package/dist/browser/{typeScriptSession-C9sBGOKZ.js → typeScriptSession-CRoezJPN.js} +1 -1
- package/dist/browser/ui.css +112 -24
- package/dist/browser/ui.js +3 -2
- package/dist/browser/workbench.css +10020 -9842
- package/dist/browser/workbench.d.ts +5 -2
- package/dist/browser/workbench.js +2382 -2668
- package/dist/browser/{workbenchSelect-DBGP7Y4Z.js → workbenchSelect-DtAd0zc4.js} +2 -2
- package/dist/command/index.js +48 -48
- package/dist/common/authoring.d.ts +4 -4
- package/dist/common/authoringExamples.d.ts +3 -2
- package/dist/common/authoringSchema.d.ts +15 -4
- package/dist/common/control-api-conformance.js +155 -15
- package/dist/common/control-api-errors.d.ts +12 -0
- package/dist/common/control-api.d.ts +39 -2
- package/dist/common/control-api.js +180 -37
- package/dist/common/control-requests.d.ts +23 -3
- package/dist/common/control-requests.js +141 -14
- package/dist/common/engine-contract.d.ts +3 -2
- package/dist/common/flow-authoring.js +47 -7
- package/dist/common/flow-change-schema.d.ts +1 -1
- package/dist/common/flow-change.d.ts +2 -2
- package/dist/common/flow-change.js +48 -8
- package/dist/common/flow-encoding.js +47 -7
- package/dist/common/flow-semantics.js +86 -8
- package/dist/common/flow-state.d.ts +100 -0
- package/dist/common/flow-state.js +5794 -0
- package/dist/common/mcp.d.ts +96 -3
- package/dist/common/mcp.js +158 -13
- package/dist/common/run-events.js +19 -8
- package/dist/common/runtime-contract.d.ts +14 -0
- package/dist/common/runtime-contract.js +124 -17
- package/dist/common/runtime-nodejs-compat.js +11 -12
- package/dist/common/scheduler-node-execution.d.ts +1 -0
- package/dist/common/scheduler.d.ts +2 -1
- package/dist/common/scheduler.js +95 -40
- package/dist/common/state-conformance.d.ts +16 -0
- package/dist/common/tags.d.ts +4 -0
- package/dist/index.d.ts +11 -0
- package/package.json +5 -1
- package/src/control/common/api.ts +101 -11
- package/src/control/common/authoring.ts +7 -1
- package/src/control/common/authoringExamples.ts +9 -0
- package/src/control/common/authoringSchema.ts +18 -12
- package/src/control/common/errors.ts +6 -0
- package/src/control/common/flowDecoders.ts +1 -0
- package/src/control/common/mcp.ts +16 -0
- package/src/control/common/requests.ts +16 -2
- package/src/control/common/tags.ts +20 -0
- package/src/execution/common/events.ts +22 -7
- package/src/execution/common/node-execution.ts +3 -0
- package/src/execution/common/scheduler.ts +29 -13
- package/src/flow/common/change.ts +2 -1
- package/src/flow/common/changeSchema.ts +11 -1
- package/src/flow/common/errorHandling.ts +1 -1
- package/src/flow/common/semantics.ts +27 -1
- package/src/runtime/common/engineContract.ts +6 -3
- package/src/runtime/common/nodejsGuest.generated.json +11 -12
- package/src/runtime/common/runtime.ts +122 -7
- package/src/state/common/conformance.ts +81 -0
- package/src/state/common/state.ts +141 -0
- package/src/types/index.ts +11 -0
package/dist/command/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var Ew=Object.defineProperty;var Ow=(e)=>e;function jw(e,t){this[e]=Ow.bind(null,t)}var co=(e,t)=>{for(var n in t)Ew(e,n,{get:t[n],enumerable:!0,configurable:!0,set:jw.bind(t,n)})};var Ot={};co(Ot,{anyString:()=>ra,base64:()=>Ws,base64url:()=>Gs,bigint:()=>ia,boolean:()=>sa,browserEmail:()=>cv,cidrv4:()=>Bs,cidrv6:()=>Ks,creditCard:()=>Io,cuid:()=>Ps,cuid2:()=>Ts,currencyCode:()=>Xs,date:()=>ea,datetime:()=>na,domain:()=>Qs,duration:()=>Vs,e164:()=>Ys,email:()=>Ms,emoji:()=>Fs,extendedDuration:()=>tv,guid:()=>Ls,hex:()=>da,hostname:()=>Hs,html5Email:()=>iv,httpProtocol:()=>tr,iban:()=>Co,idnEmail:()=>av,integer:()=>nr,ipv4:()=>Zs,ipv6:()=>Js,ksuid:()=>zs,lowercase:()=>la,mac:()=>Us,md5_base64:()=>pv,md5_base64url:()=>fv,md5_hex:()=>dv,nanoid:()=>Ds,nanoidOfLength:()=>qs,null:()=>aa,number:()=>Bt,rfc5322Email:()=>sv,sha1_base64:()=>gv,sha1_base64url:()=>hv,sha1_hex:()=>mv,sha256_base64:()=>bv,sha256_base64url:()=>wv,sha256_hex:()=>yv,sha384_base64:()=>xv,sha384_base64url:()=>kv,sha384_hex:()=>vv,sha512_base64:()=>Iv,sha512_base64url:()=>Cv,sha512_hex:()=>Sv,string:()=>oa,time:()=>ta,ulid:()=>$s,undefined:()=>ca,unicodeEmail:()=>Ed,uppercase:()=>ua,uuid:()=>Ut,uuid4:()=>nv,uuid6:()=>rv,uuid7:()=>ov,xid:()=>Ns});var ul={};co(ul,{ZodAny:()=>rg,ZodArray:()=>cg,ZodBase64:()=>Xc,ZodBase64URL:()=>el,ZodBigInt:()=>il,ZodBigIntFormat:()=>sl,ZodBoolean:()=>ol,ZodCIDRv4:()=>Qc,ZodCIDRv6:()=>Yc,ZodCUID:()=>Jc,ZodCUID2:()=>Uc,ZodCatch:()=>jg,ZodCodec:()=>hi,ZodCreditCard:()=>Qm,ZodCustom:()=>yi,ZodCustomStringFormat:()=>kn,ZodDate:()=>ag,ZodDefault:()=>kg,ZodDiscriminatedUnion:()=>ug,ZodE164:()=>tl,ZodEmail:()=>Lc,ZodEmoji:()=>Fc,ZodEnum:()=>wr,ZodExactOptional:()=>cl,ZodFile:()=>bg,ZodFunction:()=>qg,ZodGUID:()=>Mc,ZodIBAN:()=>Ym,ZodIPv4:()=>Gc,ZodIPv6:()=>Hc,ZodISODate:()=>wn,ZodISODateTime:()=>bn,ZodISODuration:()=>xn,ZodISOTime:()=>vn,ZodInstanceOf:()=>Mg,ZodIntersection:()=>dg,ZodJWT:()=>nl,ZodKSUID:()=>Wc,ZodLazy:()=>Ng,ZodLiteral:()=>yg,ZodMAC:()=>Hm,ZodMap:()=>gg,ZodNaN:()=>Rg,ZodNanoID:()=>Zc,ZodNever:()=>ig,ZodNonOptional:()=>ll,ZodNull:()=>tg,ZodNullable:()=>xg,ZodNumber:()=>rl,ZodNumberFormat:()=>Sn,ZodObject:()=>pi,ZodOptional:()=>mi,ZodPipe:()=>gi,ZodPrefault:()=>Ig,ZodPreprocess:()=>Ag,ZodPromise:()=>Dg,ZodReadonly:()=>Pg,ZodRecord:()=>br,ZodSet:()=>hg,ZodString:()=>Vc,ZodStringFormat:()=>ce,ZodSuccess:()=>Og,ZodSymbol:()=>Xm,ZodTemplateLiteral:()=>$g,ZodTransform:()=>wg,ZodTuple:()=>fg,ZodType:()=>J,ZodULID:()=>Bc,ZodURL:()=>di,ZodUUID:()=>vt,ZodUndefined:()=>eg,ZodUnion:()=>fi,ZodUnknown:()=>og,ZodVoid:()=>sg,ZodXID:()=>Kc,ZodXor:()=>lg,_ZodString:()=>qc,_default:()=>Sg,_function:()=>gk,any:()=>Hx,array:()=>A,base64:()=>Rx,base64url:()=>Ax,bigint:()=>Ux,boolean:()=>me,catch:()=>_g,check:()=>hk,cidrv4:()=>jx,cidrv6:()=>_x,codec:()=>dk,creditCard:()=>Tx,cuid:()=>vx,cuid2:()=>xx,currencyCode:()=>Vx,custom:()=>yk,date:()=>Yx,describe:()=>bk,discriminatedUnion:()=>ot,e164:()=>Px,email:()=>ux,emoji:()=>bx,enum:()=>B,exactOptional:()=>vg,file:()=>ak,float32:()=>Mx,float64:()=>Fx,function:()=>gk,guid:()=>dx,hash:()=>Lx,hex:()=>qx,hostname:()=>Dx,httpUrl:()=>yx,iban:()=>$x,instanceof:()=>vk,int:()=>xe,int32:()=>Zx,int64:()=>Bx,intersection:()=>pg,invertCodec:()=>pk,ipv4:()=>Cx,ipv6:()=>Ox,json:()=>Ae,jwt:()=>Nx,keyof:()=>Xx,ksuid:()=>Ix,lazy:()=>zg,literal:()=>w,looseObject:()=>ek,looseRecord:()=>rk,mac:()=>Ex,map:()=>ok,meta:()=>wk,nan:()=>uk,nanoid:()=>wx,nativeEnum:()=>sk,never:()=>rt,nonoptional:()=>Eg,null:()=>ng,nullable:()=>ui,nullish:()=>ck,number:()=>U,object:()=>C,optional:()=>li,partialRecord:()=>nk,pipe:()=>Dc,prefault:()=>Cg,preprocess:()=>Fg,promise:()=>mk,readonly:()=>Tg,record:()=>oe,refine:()=>Vg,set:()=>ik,strictObject:()=>v,string:()=>j,stringFormat:()=>zx,stringbool:()=>xk,success:()=>lk,superRefine:()=>Lg,symbol:()=>Wx,templateLiteral:()=>fk,transform:()=>al,tuple:()=>mg,uint32:()=>Jx,uint64:()=>Kx,ulid:()=>kx,undefined:()=>Gx,union:()=>Y,unknown:()=>ut,url:()=>hx,uuid:()=>px,uuidv4:()=>fx,uuidv6:()=>mx,uuidv7:()=>gx,void:()=>Qx,xid:()=>Sx,xor:()=>tk});var ai={};co(ai,{endsWith:()=>Qo,gt:()=>_t,gte:()=>nt,includes:()=>Go,length:()=>ur,lowercase:()=>Ko,lt:()=>jt,lte:()=>tt,maxLength:()=>lr,maxSize:()=>fn,mime:()=>Xo,minLength:()=>Kt,minSize:()=>Rt,multipleOf:()=>pn,negative:()=>am,nonnegative:()=>lm,nonpositive:()=>cm,normalize:()=>ei,overwrite:()=>wt,positive:()=>sm,properties:()=>Yo,property:()=>um,regex:()=>Bo,size:()=>cr,slugify:()=>oi,startsWith:()=>Ho,toLowerCase:()=>ni,toUpperCase:()=>ri,trim:()=>ti,uppercase:()=>Wo});var vr={};co(vr,{ZodISODate:()=>wn,ZodISODateTime:()=>bn,ZodISODuration:()=>xn,ZodISOTime:()=>vn,date:()=>Sk,datetime:()=>kk,duration:()=>Ck,time:()=>Ik});var Mu="0.1.0-beta.78";var gs=["en","zh-CN","zh-TW","ja","ko","ru","fr"],Fu="en";var ms=new Map(gs.map((e)=>[e.toLowerCase(),e])),Rw=new Set(["hk","mo","tw"]);function Zu(e){return typeof e=="string"&&ms.get(e.toLowerCase())==e}function lo(e,t="en"){for(let n of e){let r=n==null?void 0:Aw(n);if(r!=null)return r}return t}function Aw(e){let t=e.trim().toLowerCase();if(t.length==0)return;let n=ms.get(t);if(n!=null)return n;let r=t.split("-");if(r[0]=="zh"){if(r.includes("hant"))return"zh-TW";if(r.includes("hans"))return"zh-CN";return r.some((o)=>Rw.has(o))?"zh-TW":"zh-CN"}return ms.get(r[0])}function Ju(e){return{en:"Imported workflow","zh-CN":"\u5BFC\u5165\u7684\u5DE5\u4F5C\u6D41","zh-TW":"\u532F\u5165\u7684\u5DE5\u4F5C\u6D41",ja:"\u30A4\u30F3\u30DD\u30FC\u30C8\u3057\u305F\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC",ko:"\uAC00\uC838\uC628 \uC6CC\uD06C\uD50C\uB85C",fr:"Workflow import\xE9",ru:"\u0418\u043C\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u043F\u0440\u043E\u0446\u0435\u0441\u0441"}[e]}import{spawn as mE}from"child_process";import{readFile as gE}from"fs/promises";import{setTimeout as hE}from"timers/promises";var cn="open-flow-engine/v10";var an=(e)=>`export const engineContract = ${JSON.stringify(e)}
|
|
3
3
|
export function identity(value) { return value }
|
|
4
|
-
`,so={workflowTools:!0,httpRequests:!0,waitAutoContinue:!0,webhookResponses:!0,platformExports:new Set(["engineContract","identity"]),platformModule:"open-flow:platform",platformSource:Jt("open-flow-engine/v8")},ao={...so,builtinModules:new Set(["assert","assert/strict","buffer","console","constants","crypto","events","fs","fs/promises","os","path","path/posix","process","punycode","querystring","stream","stream/promises","stream/web","string_decoder","timers","timers/promises","url","util","zlib"].flatMap((e)=>[e,`node:${e}`])),platformSource:Jt("open-flow-engine/v8/nodejs-compat-v1")},xw={...ao,codeFetch:!0,platformSource:Jt("open-flow-engine/v9")};function qu(e){if(e=="open-flow-engine/v9")return xw;if(e=="open-flow-engine/v8")return so;if(e=="open-flow-engine/v8/nodejs-compat-v1")return ao;if(e=="open-flow-engine/v7"||e=="open-flow-engine/v7/nodejs-compat-v1")return{...e.endsWith("/nodejs-compat-v1")?ao:so,workflowTools:!1,httpRequests:!1,platformSource:Jt(e)};if(e=="open-flow-engine/v6"||e=="open-flow-engine/v6/nodejs-compat-v1")return{...e=="open-flow-engine/v6"?so:ao,workflowTools:!1,httpRequests:!1,waitAutoContinue:!1,webhookResponses:!1,platformSource:Jt(e)};return}var Lu=Object.prototype.hasOwnProperty;function ke(e,n){var t,r;if(e===n)return!0;if(e&&n&&(t=e.constructor)===n.constructor){if(t===Date)return e.getTime()===n.getTime();if(t===RegExp)return e.toString()===n.toString();if(t===Array){if((r=e.length)===n.length)while(r--&&ke(e[r],n[r]));return r===-1}if(!t||typeof e==="object"){r=0;for(t in e){if(Lu.call(e,t)&&++r&&!Lu.call(n,t))return!1;if(!(t in n)||!ke(e[t],n[t]))return!1}return Object.keys(n).length===r}}return e!==e&&n!==n}function Bt(e){let n=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>n.indexOf(+r)===-1).map(([r,o])=>o)}function ds(e,n="|"){return e.map((t)=>gs(t)).join(n)}function Kt(e,n){if(typeof n==="bigint")return n.toString();return n}class Mu{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Wt(e){return new Mu(e)}function ps(e){return e===null||e===void 0}function On(e){let n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}function Fu(e,n){let t=e/n,r=Math.round(t),o=4*Number.EPSILON*Math.max(Math.abs(t),1);if(Math.abs(t-r)<o)return 0;return t-r}var Vu=Symbol("evaluating");function Zu(e,n,t){let r=void 0;Object.defineProperty(e,n,{get(){if(r===Vu)return;if(r===void 0)r=Vu,r=t();return r},set(o){Object.defineProperty(e,n,{value:o})},configurable:!0})}function _e(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Gt(e){let n=Object.getOwnPropertyDescriptor(e,"shape");return n?.get?n.get.raw:n?.value}function hn(e){return Gt(e._zod.def)??e._zod.def.shape}function Ju(e,n,t){Object.defineProperty(e,n,{get(){let r=t();return _e(this,n,r),r},enumerable:!0,configurable:!0})}function Uu(e,n,t){if(n in e)_e(e,n,t);else e[n]=t}function Fn(e,n,t,r){let o=hn(n);for(let i of t){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)Ju(e,i,()=>{let a=n._zod.def.shape[i];return r?r(a,i):a});else Uu(e,i,r?r(s.value,i):s.value)}}function kw(e,n){for(let t of Reflect.ownKeys(n)){let r=Object.getOwnPropertyDescriptor(n,t);if(!r.enumerable)continue;if(r.get)Ju(e,t,()=>n[t]);else Uu(e,t,r.value)}}function Je(...e){let n={};for(let t of e){let r=Object.getOwnPropertyDescriptors(t);Object.assign(n,r)}return Object.defineProperties({},n)}function Bu(e){return JSON.stringify(e)}function Ku(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var fs="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ct(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Wu=Wt(()=>{if(je.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function bn(e){if(ct(e)===!1)return!1;let n=e.constructor;if(n===void 0)return!0;if(typeof n!=="function")return!0;let t=n.prototype;if(ct(t)===!1)return!1;if(Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)return!1;return!0}function ms(e){if(bn(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var co=new Set(["string","number","symbol"]),Gu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function en(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ln(e,n,t){let r=new e._zod.constr(n??e._zod.def);if(!n||t?.parent)r._zod.parent=e;return r}function C(e){let n=e;if(!n)return{};if(typeof n==="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");n.error=n.message}if(delete n.message,typeof n.error==="string")return{...n,error:()=>n.error};return n}function gs(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Hu(e){return Object.keys(e).filter((n)=>e[n]._zod.optin!==void 0&&e[n]._zod.optout==="optional")}var lo=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),uo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Sw(e,n){let t=e._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Fn(i,e,po(e,n)),ln(e,Je(t,{shape:i,checks:[]}))}function po(e,n){let t=hn(e),r=[];for(let o of Reflect.ownKeys(n)){if(!Object.getOwnPropertyDescriptor(t,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(n[o])r.push(o)}return r}function Iw(e,n){let t=e._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(po(e,n)),s={};return Fn(s,e,Reflect.ownKeys(hn(e)).filter((a)=>!i.has(a))),ln(e,Je(t,{shape:s,checks:[]}))}function Cw(e,n){if(!bn(n))throw Error("Invalid input to extend: expected a plain object");let t=e._zod.def.checks;if(t&&t.length>0){let o=hn(e);for(let i of Reflect.ownKeys(n))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ln(e,Je(e._zod.def,{shape:Qu(e,n)}))}function Qu(e,n){let t={};return Fn(t,e,Reflect.ownKeys(hn(e))),kw(t,n),t}function Ew(e,n){if(!bn(n))throw Error("Invalid input to safeExtend: expected a plain object");return ln(e,Je(e._zod.def,{shape:Qu(e,n)}))}function Ow(e,n){if(!n?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let t={};Fn(t,e,Reflect.ownKeys(hn(e))),Fn(t,n,Reflect.ownKeys(hn(n)));let r=Je(e._zod.def,{shape:t,get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return ln(e,r)}function Yu(e,n,t,r="partial"){let i=n._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=t?new Set(po(n,t)):void 0,c={};return Fn(c,n,Reflect.ownKeys(hn(n)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),ln(n,Je(n._zod.def,{shape:c,checks:[]}))}function jw(e,n,t){let r=t?new Set(po(n,t)):void 0,o={};return Fn(o,n,Reflect.ownKeys(hn(n)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),ln(n,Je(n._zod.def,{shape:o}))}function Le(e,n=0){if(e.aborted===!0)return!0;for(let t=n;t<e.issues.length;t++)if(e.issues[t]?.continue!==!0)return!0;return!1}function Xu(e,n=0){if(e.aborted===!0)return!0;for(let t=n;t<e.issues.length;t++)if(e.issues[t]?.continue===!1)return!0;return!1}function Ue(e,n){return n.map((t)=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Ut(e){return typeof e==="string"?e:e?.message}function hs(e,n,t){var r;for(let o=n;o<e.length;o++)(r=e[o]).schema??(r.schema=t)}function Be(e,n,t){var r;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Ut(e.inst?._zod.def?.error?.(e))??Ut(i?.(e))??Ut(n?.error?.(e))??Ut(t.customError?.(e))??Ut(t.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,n?.reportInput)a.input=e.input;return a}function fo(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var _w=/[\uD800-\uDBFF]/;function mo(e){let n=e.length;if(!_w.test(e))return n;let t=n;for(let r=0;r<n-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)t--,r++;return t}function go(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ed(e){let n=typeof e;switch(n){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return n}function Zn(...e){let[n,t,r]=e;if(typeof n==="string")return{message:n,code:"custom",input:t,inst:r};return{...n}}function nd(e,n){for(let t in n){let r=Object.getOwnPropertyDescriptor(n,t);if(r.get)Object.defineProperty(e,t,{...r,enumerable:!1});else Rw(e,t,r.value)}}function yn(e,n,t,r=!0){return Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:r,value:t}),t}function Ht(e,n,t){return yn(e,n,t,!1)}function ho(e,n){for(let t in e){let r=e[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get(){return yn(this,t,r(this))},set(o){yn(this,t,o)}})}return n}function Rw(e,n,t){Object.defineProperty(e,n,{configurable:!0,get(){return this==null?t:yn(this,n,t.bind(this))},set(r){yn(this,n,r)}})}function Aw(e,n){let t=Object.getPrototypeOf(e);return n in t?void 0:t}var us,En=!1,Pw={configurable:!0,get(){En=!0;return}};function B(e,n,t){let r=Object.getPrototypeOf(e._zod);if(n in r&&us!==e._zod){us=void 0;return}us=e._zod,Object.defineProperty(r,n,{configurable:!0,get(){Object.defineProperty(this,n,Pw);let o=En;En=!1;try{let i=t(this);if(En)delete this[n];else Object.defineProperty(this,n,{configurable:!0,writable:!0,value:i});return En=En||o,i}catch(i){throw delete this[n],En=En||o,i}},set(o){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:o})}})}function Tw(e,n,t,r){let o=Aw(e,n);if(!o)return;Object.defineProperty(o,n,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,n,i),i.value=t(this),Object.defineProperty(this,n,i),i.value},set(i){Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var $w="~constantCatch";function td(e){let n=()=>e;return n[$w]=!0,n}var rd;var ys={value:void 0,enumerable:!1},od="captureStackTrace"in Error?Error:null;function Nw(e){let n=od;if(n){let t=n.stackTraceLimit;if(typeof t==="number"){try{n.stackTraceLimit=0}catch{return od=null,new e}try{return new e}finally{n.stackTraceLimit=t}}}return new e}function m(e,n,t,r){let o={};function i(g){this.def=g,this.constr=d,this.traits=new Set}i.prototype=o;let s=t,a=s&&new WeakSet;function c(g,h){if(!g._zod){ys.value=new i(h);try{Object.defineProperty(g,"_zod",ys)}finally{ys.value=void 0}}else if(g._zod.traits.has(e))return;if(g._zod.traits.add(e),n(g,h),a){let S=Object.getPrototypeOf(g),R=g._zod.constr.prototype,N=S;while(N&&N!==R)N=Object.getPrototypeOf(N);let D=N??S;if(!a.has(D))a.add(D),nd(D,s)}let y=d.prototype;for(let S in y){if(!Object.prototype.hasOwnProperty.call(y,S))continue;if(!(S in g))g[S]=y[S].bind(g)}}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(g){let h=r?.Parent?Nw(u):this;c(h,g);let y=h._zod.deferred;if(y){for(let R of y)R();h._zod.deferred=void 0}let S=globalThis.__zod_globalConfig?.postProcessor;if(S)S(h);return h}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(g)=>{if(r?.Parent&&g instanceof r.Parent)return!0;return g?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class un extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class lt extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(rd=globalThis).__zod_globalConfig??(rd.__zod_globalConfig={});var je=globalThis.__zod_globalConfig;function Re(e){if(e)Object.assign(je,e);return je}function zw(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Kt,2)),e.message}function Dw(e){this._zod.message=e}var qw={get:zw,set:Dw,enumerable:!0,configurable:!0},ws={value:void 0,enumerable:!1},id=new WeakSet([Object.prototype,Error.prototype]),sd=(e,n)=>{e.name="$ZodError",ws.value=n,Object.defineProperty(e,"issues",ws),ws.value=void 0,Object.defineProperty(e,"message",qw);let t=Object.getPrototypeOf(e);if(!id.has(t))id.add(t),Object.defineProperty(t,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},ad=m("$ZodError",sd),vs=m("$ZodError",sd,void 0,{Parent:Error});function Lw(e,n,t){if(!Object.prototype.hasOwnProperty.call(e,n))if(n==="__proto__")Object.defineProperty(e,n,{value:t(),writable:!0,enumerable:!0,configurable:!0});else e[n]=t();return e[n]}function cd(e,n=(t)=>t.message){let t={},r=[];for(let o of e.issues)if(o.path.length>0)Lw(t,o.path[0],()=>[]).push(n(o));else r.push(n(o));return{formErrors:r,fieldErrors:t}}function ld(e,n=(t)=>t.message){let t={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)t._errors.push(n(s));else{let c=t,l=0;while(l<a.length){let u=a[l],d=l===a.length-1;if(u==="_errors"){if(d)c._errors.push(n(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,u))Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let g=c[u];if(d)g._errors.push(n(s));c=g,l++}}}};return r(e),t}function yo(e,n){return{callee:n?.callee??e,Err:n?.Err}}var Qt=(e)=>{let n=(t,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new un;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Be(l,s,Re())));throw fs(c,i?.callee??n),c}return a.value};return n},xs=Qt(vs),Yt=(e)=>{let n=async(t,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Be(l,s,Re())));throw fs(c,i?.callee??n),c}return a.value};return n},ks=Yt(vs),bo=(e)=>(n,t,r)=>{let o=r?{...r,async:!1}:{async:!1},i=n._zod.run({value:t,issues:[]},o);if(i instanceof Promise)throw new un;return i.issues.length?ud(e,i.issues,o):{success:!0,data:i.value}};function ud(e,n,t){let r;return{success:!1,get error(){if(!r)r=new e(n.map((o)=>Be(o,t,Re()))),n=void 0,t=void 0;return r},set error(o){r=o,n=void 0,t=void 0}}}var wo=(e)=>async(n,t,r)=>{let o=r?{...r,async:!0}:{async:!0},i=n._zod.run({value:t,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?ud(e,i.issues,o):{success:!0,data:i.value}};var Mw=Symbol.for("zod.compile.invalid"),Fw=Symbol.for("zod.compile.fallback"),Ss=(e,n,t)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(n)!==Mw)return!0;if(r.definite===!0&&t===void 0)return!1}return Zw(e,n,t)};function Zw(e,n,t){let r=t?{...t,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[Fw]=!0,i=o({value:n,issues:[]},r);else i=e._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new un;return i.issues.length===0}var Is=async(e,n,t)=>{let r=t?{...t,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:n,issues:[]},r);if(o instanceof Promise)o=await o;return o.issues.length===0},dd=(e)=>{let n=Qt(e),t=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return n(r,o,a,yo(t,s))};return t};var pd=(e)=>{let n=Qt(e),t=(r,o,i,s)=>n(r,o,i,yo(t,s));return t};var fd=(e)=>{let n=Yt(e),t=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await n(r,o,a,yo(t,s))};return t};var md=(e)=>{let n=Yt(e),t=async(r,o,i,s)=>await n(r,o,i,yo(t,s));return t};var gd=(e)=>(n,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return bo(e)(n,t,o)};var hd=(e)=>(n,t,r)=>bo(e)(n,t,r);var yd=(e)=>async(n,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return wo(e)(n,t,o)};var bd=(e)=>async(n,t,r)=>wo(e)(n,t,r);var Es=/^[cC][0-9a-z]{6,}$/,Os=/^[0-9a-z]+$/,js=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,_s=/^[0-9a-vA-V]{20}$/,Rs=/^[A-Za-z0-9]{27}$/,As=/^[a-zA-Z0-9_-]{21}$/;function Ps(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ts=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Jw=/^[-+]?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)?)??$/,$s=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Jn=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Uw=Jn(4),Bw=Jn(6),Kw=Jn(7),Ns=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ww=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Gw=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,wd=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Hw=wd,Qw=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Yw="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function zs(){return new RegExp(Yw,"u")}var Ds=/^(?:(?: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])$/,qs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ls=(e)=>{let n=en(e??":");return new RegExp(`^(?:[0-9A-F]{2}${n}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${n}){5}[0-9a-f]{2}$`)},Vs=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ms=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Fs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Js=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Us=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Xt=/^https?$/,Bs=/^\+[1-9]\d{6,14}$/,vo=/^\d(?:[ -]?\d){11,18}$/,Ks=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,xo=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,vd="(?:(?:\\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])))";function Xw(e){return new RegExp(`^${e}$`)}var Ws=Xw(vd);function Cs(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Gs(e){return new RegExp(`^${Cs(e)}$`)}function Hs(e){let n=["Z"];if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let t=`${Cs({precision:e.precision,seconds:!0})}(?:${n.join("|")})`,r=e.local?`${t}|${Cs({precision:e.precision})}`:t;return new RegExp(`^${vd}T(?:${r})$`)}var Qs=/^[\s\S]{0,}$/,Ys=(e)=>{let n=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},Xs=/^-?\d+n?$/,er=/^-?\d+$/,Un=/^-?\d+(?:\.\d+)?$/,ea=/^(?:true|false)$/i,na=/^null$/i;var ta=/^undefined$/i;var ra=/^[^A-Z]*$/,oa=/^[^a-z]*$/,ia=/^[0-9a-fA-F]*$/;function nr(e,n){return new RegExp(`^[A-Za-z0-9+/]{${e}}${n}$`)}function tr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var ev=/^[0-9a-fA-F]{32}$/,nv=nr(22,"=="),tv=tr(22),rv=/^[0-9a-fA-F]{40}$/,ov=nr(27,"="),iv=tr(27),sv=/^[0-9a-fA-F]{64}$/,av=nr(43,"="),cv=tr(43),lv=/^[0-9a-fA-F]{96}$/,uv=nr(64,""),dv=tr(64),pv=/^[0-9a-fA-F]{128}$/,fv=nr(86,"=="),mv=tr(86);var le=m("$ZodCheck",(e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])}),sa=(e)=>{let n=e.value;return!ps(n)&&n.size!==void 0},aa=(e)=>{let n=e.value;return!ps(n)&&n.length!==void 0},ko={number:"number",bigint:"bigint",object:"date"},ca=m("$ZodCheckLessThan",(e,n)=>{le.init(e,n);let t=ko[typeof n.value];e._zod.check=(r)=>{if(n.inclusive?r.value<=n.value:r.value<n.value)return;r.issues.push({origin:ko[typeof r.value]??t,code:"too_big",maximum:typeof n.value==="object"?n.value.getTime():n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),la=m("$ZodCheckGreaterThan",(e,n)=>{le.init(e,n);let t=ko[typeof n.value];e._zod.check=(r)=>{if(n.inclusive?r.value>=n.value:r.value>n.value)return;r.issues.push({origin:ko[typeof r.value]??t,code:"too_small",minimum:typeof n.value==="object"?n.value.getTime():n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),xd=m("$ZodCheckMultipleOf",(e,n)=>{le.init(e,n),e._zod.check=(t)=>{if(typeof t.value!==typeof n.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof t.value==="bigint"?n.value!==BigInt(0)&&t.value%n.value===BigInt(0):Fu(t.value,n.value)===0)return;t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:n.value,input:t.value,inst:e,continue:!n.abort})}}),kd=m("$ZodCheckNumberFormat",(e,n)=>{le.init(e,n),n.format=n.format||"float64";let t=n.format?.includes("int"),r=t?"int":"number",[o,i]=lo[n.format];e._zod.check=(s)=>{let a=s.value;if(t){if(!Number.isInteger(a)){s.issues.push({expected:r,format:n.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort});return}}if(a<o)s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!n.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!n.abort})}}),Sd=m("$ZodCheckBigIntFormat",(e,n)=>{le.init(e,n);let[t,r]=uo[n.format];e._zod.check=(o)=>{let i=o.value;if(i<t)o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:t,inclusive:!0,inst:e,continue:!n.abort});if(i>r)o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!n.abort})}}),Id=m("$ZodCheckMaxSize",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=sa),e._zod.check=(r)=>{let o=r.value;if(o.size<=n.maximum)return;r.issues.push({origin:fo(o),code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Cd=m("$ZodCheckMinSize",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=sa),e._zod.check=(r)=>{let o=r.value;if(o.size>=n.minimum)return;r.issues.push({origin:fo(o),code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Ed=m("$ZodCheckSizeEquals",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=sa),e._zod.check=(r)=>{let o=r.value,i=o.size;if(i===n.size)return;let s=i>n.size;r.issues.push({origin:fo(o),...s?{code:"too_big",maximum:n.size}:{code:"too_small",minimum:n.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!n.abort})}}),Od=m("$ZodCheckMaxLength",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=aa),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>n.maximum?mo(o):i)<=n.maximum)return;let a=go(o);r.issues.push({origin:a,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),jd=m("$ZodCheckMinLength",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=aa),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>=n.minimum&&i<n.minimum*2?mo(o):i)>=n.minimum)return;let a=go(o);r.issues.push({origin:a,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),_d=m("$ZodCheckLengthEquals",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=aa),e._zod.check=(r)=>{let o=r.value,i=o.length,s=typeof o==="string"&&i>=n.length&&i<=n.length*2?mo(o):i;if(s===n.length)return;let a=go(o),c=s>n.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!n.abort})}}),rr=m("$ZodCheckStringFormat",(e,n)=>{var t,r;if(le.init(e,n),n.pattern)(t=e._zod).check??(t.check=(o)=>{if(n.pattern.lastIndex=0,n.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:n.format,input:o.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})});else(r=e._zod).check??(r.check=()=>{})}),Rd=m("$ZodCheckRegex",(e,n)=>{rr.init(e,n),e._zod.check=(t)=>{if(n.pattern.lastIndex=0,n.pattern.test(t.value))return;t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}}),Ad=m("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=ra),rr.init(e,n)}),Pd=m("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=oa),rr.init(e,n)}),Td=m("$ZodCheckIncludes",(e,n)=>{le.init(e,n);let t=en(n.includes),r=new RegExp(typeof n.position==="number"?`^.{${n.position},}${t}`:t);n.pattern=r,e._zod.check=(o)=>{if(o.value.includes(n.includes,n.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:o.value,inst:e,continue:!n.abort})}}),$d=m("$ZodCheckStartsWith",(e,n)=>{le.init(e,n);let t=new RegExp(`^${en(n.prefix)}.*`);n.pattern??(n.pattern=t),e._zod.check=(r)=>{if(r.value.startsWith(n.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:r.value,inst:e,continue:!n.abort})}}),Nd=m("$ZodCheckEndsWith",(e,n)=>{le.init(e,n);let t=new RegExp(`.*${en(n.suffix)}$`);n.pattern??(n.pattern=t),e._zod.check=(r)=>{if(r.value.endsWith(n.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:r.value,inst:e,continue:!n.abort})}});function So(e,n,t){if(e.issues.length)n.issues.push(...Ue(t,e.issues))}var zd=m("$ZodCheckProperty",(e,n)=>{le.init(e,n),e._zod.check=(t)=>{let r=n.schema._zod.run({value:t.value[n.property],issues:[]},{});if(r instanceof Promise)return r.then((o)=>So(o,t,n.property));So(r,t,n.property);return}}),Dd=m("$ZodCheckProperties",(e,n)=>{le.init(e,n),Ht(e,Symbol.iterator,function*(){yield e});let t;e._zod.check=(r)=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}t??(t=Reflect.ownKeys(n.shape).map((s)=>[s,n.shape[s]]));let o=r.value,i;for(let[s,a]of t){let c=a._zod.run({value:o[s],issues:[]},{});if(c instanceof Promise)i??(i=[]),i.push(c.then((l)=>So(l,r,s)));else So(c,r,s)}if(i)return Promise.all(i).then(()=>{return});return}}),qd=m("$ZodCheckMimeType",(e,n)=>{le.init(e,n);let t=new Set(n.mime);e._zod.check=(r)=>{if(t.has(r.value.type))return;r.issues.push({code:"invalid_value",values:n.mime,input:r.value.type,inst:e,continue:!n.abort})}}),Ld=m("$ZodCheckOverwrite",(e,n)=>{le.init(e,n),e._zod.check=(t)=>{t.value=n.tx(t.value)}});class ua{constructor(e=[],n={}){this.content=[],this.indent=0,this.args=e,this.closed=n}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split(`
|
|
5
|
-
`).filter((i)=>i),r=Math.min(...
|
|
6
|
-
${
|
|
4
|
+
`,uo={workflowTools:!0,httpRequests:!0,waitAutoContinue:!0,webhookResponses:!0,platformExports:new Set(["engineContract","identity"]),platformModule:"open-flow:platform",platformSource:an("open-flow-engine/v8")},po={...uo,builtinModules:new Set(["assert","assert/strict","buffer","console","constants","crypto","events","fs","fs/promises","os","path","path/posix","process","punycode","querystring","stream","stream/promises","stream/web","string_decoder","timers","timers/promises","url","util","zlib"].flatMap((e)=>[e,`node:${e}`])),platformSource:an("open-flow-engine/v8/nodejs-compat-v1")},Uu={...po,codeFetch:!0,platformSource:an("open-flow-engine/v9")},Pw={...Uu,flowState:!0,platformSource:an("open-flow-engine/v10")};function Bu(e){if(e=="open-flow-engine/v10")return Pw;if(e=="open-flow-engine/v9")return Uu;if(e=="open-flow-engine/v8")return uo;if(e=="open-flow-engine/v8/nodejs-compat-v1")return po;if(e=="open-flow-engine/v7"||e=="open-flow-engine/v7/nodejs-compat-v1")return{...e.endsWith("/nodejs-compat-v1")?po:uo,workflowTools:!1,httpRequests:!1,platformSource:an(e)};if(e=="open-flow-engine/v6"||e=="open-flow-engine/v6/nodejs-compat-v1")return{...e=="open-flow-engine/v6"?uo:po,workflowTools:!1,httpRequests:!1,waitAutoContinue:!1,webhookResponses:!1,platformSource:an(e)};return}function Wn(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ys(e,t="|"){return e.map((n)=>xs(n)).join(t)}function Gn(e,t){if(typeof t==="bigint")return t.toString();return t}class Wu{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Hn(e){return new Wu(e)}function bs(e){return e===null||e===void 0}function Et(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Gu(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-r)<o)return 0;return n-r}var Ku=Symbol("evaluating");function Hu(e,t,n){let r=void 0;Object.defineProperty(e,t,{get(){if(r===Ku)return;if(r===void 0)r=Ku,r=n();return r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function _e(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Qn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ht(e){return Qn(e._zod.def)??e._zod.def.shape}function Qu(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return _e(this,t,r),r},enumerable:!0,configurable:!0})}function Yu(e,t,n){if(t in e)_e(e,t,n);else e[t]=n}function Zt(e,t,n,r){let o=ht(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)Qu(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a});else Yu(e,i,r?r(s.value,i):s.value)}}function Tw(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);if(!r.enumerable)continue;if(r.get)Qu(e,n,()=>t[n]);else Yu(e,n,r.value)}}function Je(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Xu(e){return JSON.stringify(e)}function ed(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ws="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ln(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var td=Hn(()=>{if(je.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function bt(e){if(ln(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(ln(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function vs(e){if(bt(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var fo=new Set(["string","number","symbol"]),nd=new Set(["string","number","bigint","boolean","symbol","undefined"]);function et(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ct(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function O(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function xs(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function rd(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var mo=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),go={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function $w(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Zt(i,e,ho(e,t)),ct(e,Je(n,{shape:i,checks:[]}))}function ho(e,t){let n=ht(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])r.push(o)}return r}function Nw(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ho(e,t)),s={};return Zt(s,e,Reflect.ownKeys(ht(e)).filter((a)=>!i.has(a))),ct(e,Je(n,{shape:s,checks:[]}))}function zw(e,t){if(!bt(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=ht(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ct(e,Je(e._zod.def,{shape:od(e,t)}))}function od(e,t){let n={};return Zt(n,e,Reflect.ownKeys(ht(e))),Tw(n,t),n}function Dw(e,t){if(!bt(t))throw Error("Invalid input to safeExtend: expected a plain object");return ct(e,Je(e._zod.def,{shape:od(e,t)}))}function qw(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Zt(n,e,Reflect.ownKeys(ht(e))),Zt(n,t,Reflect.ownKeys(ht(t)));let r=Je(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ct(e,r)}function id(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(ho(t,n)):void 0,c={};return Zt(c,t,Reflect.ownKeys(ht(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),ct(t,Je(t._zod.def,{shape:c,checks:[]}))}function Vw(e,t,n){let r=n?new Set(ho(t,n)):void 0,o={};return Zt(o,t,Reflect.ownKeys(ht(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),ct(t,Je(t._zod.def,{shape:o}))}function Ve(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function sd(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Ue(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Kn(e){return typeof e==="string"?e:e?.message}function ks(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function Be(e,t,n){var r;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Kn(e.inst?._zod.def?.error?.(e))??Kn(i?.(e))??Kn(t?.error?.(e))??Kn(n.customError?.(e))??Kn(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,t?.reportInput)a.input=e.input;return a}function yo(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var Lw=/[\uD800-\uDBFF]/;function bo(e){let t=e.length;if(!Lw.test(e))return t;let n=t;for(let r=0;r<t-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)n--,r++;return n}function wo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ad(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Jt(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function cd(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else Mw(e,n,r.value)}}function yt(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Yn(e,t,n){return yt(e,t,n,!1)}function vo(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return yt(this,n,r(this))},set(o){yt(this,n,o)}})}return t}function Mw(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:yt(this,t,n.bind(this))},set(r){yt(this,t,r)}})}function Fw(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var hs,Ct=!1,Zw={configurable:!0,get(){Ct=!0;return}};function W(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&hs!==e._zod){hs=void 0;return}hs=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Zw);let o=Ct;Ct=!1;try{let i=n(this);if(Ct)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return Ct=Ct||o,i}catch(i){throw delete this[t],Ct=Ct||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Jw(e,t,n,r){let o=Fw(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var Uw="~constantCatch";function ld(e){let t=()=>e;return t[Uw]=!0,t}var ud;var Ss={value:void 0,enumerable:!1},dd="captureStackTrace"in Error?Error:null;function Bw(e){let t=dd;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return dd=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function m(e,t,n,r){let o={};function i(g){this.def=g,this.constr=d,this.traits=new Set}i.prototype=o;let s=n,a=s&&new WeakSet;function c(g,h){if(!g._zod){Ss.value=new i(h);try{Object.defineProperty(g,"_zod",Ss)}finally{Ss.value=void 0}}else if(g._zod.traits.has(e))return;if(g._zod.traits.add(e),t(g,h),a){let S=Object.getPrototypeOf(g),R=g._zod.constr.prototype,N=S;while(N&&N!==R)N=Object.getPrototypeOf(N);let q=N??S;if(!a.has(q))a.add(q),cd(q,s)}let y=d.prototype;for(let S in y){if(!Object.prototype.hasOwnProperty.call(y,S))continue;if(!(S in g))g[S]=y[S].bind(g)}}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(g){let h=r?.Parent?Bw(u):this;c(h,g);let y=h._zod.deferred;if(y){for(let R of y)R();h._zod.deferred=void 0}let S=globalThis.__zod_globalConfig?.postProcessor;if(S)S(h);return h}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(g)=>{if(r?.Parent&&g instanceof r.Parent)return!0;return g?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class lt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class un extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(ud=globalThis).__zod_globalConfig??(ud.__zod_globalConfig={});var je=globalThis.__zod_globalConfig;function Re(e){if(e)Object.assign(je,e);return je}function Kw(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Gn,2)),e.message}function Ww(e){this._zod.message=e}var Gw={get:Kw,set:Ww,enumerable:!0,configurable:!0},Cs={value:void 0,enumerable:!1},pd=new WeakSet([Object.prototype,Error.prototype]),fd=(e,t)=>{e.name="$ZodError",Cs.value=t,Object.defineProperty(e,"issues",Cs),Cs.value=void 0,Object.defineProperty(e,"message",Gw);let n=Object.getPrototypeOf(e);if(!pd.has(n))pd.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},md=m("$ZodError",fd),Es=m("$ZodError",fd,void 0,{Parent:Error});function Hw(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0});else e[t]=n();return e[t]}function gd(e,t=(n)=>n.message){let n={},r=[];for(let o of e.issues)if(o.path.length>0)Hw(n,o.path[0],()=>[]).push(t(o));else r.push(t(o));return{formErrors:r,fieldErrors:n}}function hd(e,t=(n)=>n.message){let n={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,l=0;while(l<a.length){let u=a[l],d=l===a.length-1;if(u==="_errors"){if(d)c._errors.push(t(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,u))Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let g=c[u];if(d)g._errors.push(t(s));c=g,l++}}}};return r(e),n}function xo(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Xn=(e)=>{let t=(n,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new lt;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Be(l,s,Re())));throw ws(c,i?.callee??t),c}return a.value};return t},Os=Xn(Es),er=(e)=>{let t=async(n,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Be(l,s,Re())));throw ws(c,i?.callee??t),c}return a.value};return t},js=er(Es),ko=(e)=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new lt;return i.issues.length?yd(e,i.issues,o):{success:!0,data:i.value}};function yd(e,t,n){let r;return{success:!1,get error(){if(!r)r=new e(t.map((o)=>Be(o,n,Re()))),t=void 0,n=void 0;return r},set error(o){r=o,t=void 0,n=void 0}}}var So=(e)=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?yd(e,i.issues,o):{success:!0,data:i.value}};var Yw=Symbol.for("zod.compile.invalid"),Xw=Symbol.for("zod.compile.fallback"),_s=(e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Yw)return!0;if(r.definite===!0&&n===void 0)return!1}return ev(e,t,n)};function ev(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[Xw]=!0,i=o({value:t,issues:[]},r);else i=e._zod.run({value:t,issues:[]},r);if(i instanceof Promise)throw new lt;return i.issues.length===0}var Rs=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise)o=await o;return o.issues.length===0},bd=(e)=>{let t=Xn(e),n=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,xo(n,s))};return n};var wd=(e)=>{let t=Xn(e),n=(r,o,i,s)=>t(r,o,i,xo(n,s));return n};var vd=(e)=>{let t=er(e),n=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,xo(n,s))};return n};var xd=(e)=>{let t=er(e),n=async(r,o,i,s)=>await t(r,o,i,xo(n,s));return n};var kd=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return ko(e)(t,n,o)};var Sd=(e)=>(t,n,r)=>ko(e)(t,n,r);var Id=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return So(e)(t,n,o)};var Cd=(e)=>async(t,n,r)=>So(e)(t,n,r);var Ps=/^[cC][0-9a-z]{6,}$/,Ts=/^[0-9a-z]+$/,$s=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ns=/^[0-9a-vA-V]{20}$/,zs=/^[A-Za-z0-9]{27}$/,Ds=/^[a-zA-Z0-9_-]{21}$/;function qs(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Vs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tv=/^[-+]?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)?)??$/,Ls=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ut=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},nv=Ut(4),rv=Ut(6),ov=Ut(7),Ms=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,iv=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,sv=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Ed=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,av=Ed,cv=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,lv="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Fs(){return new RegExp(lv,"u")}var Zs=/^(?:(?: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])$/,Js=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Us=(e)=>{let t=et(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Bs=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ks=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ws=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Gs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Hs=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Qs=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,tr=/^https?$/,Ys=/^\+[1-9]\d{6,14}$/,Io=/^\d(?:[ -]?\d){11,18}$/,Xs=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Co=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,Od="(?:(?:\\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])))";function uv(e){return new RegExp(`^${e}$`)}var ea=uv(Od);function As(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function ta(e){return new RegExp(`^${As(e)}$`)}function na(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${As({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${As({precision:e.precision})}`:n;return new RegExp(`^${Od}T(?:${r})$`)}var ra=/^[\s\S]{0,}$/,oa=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ia=/^-?\d+n?$/,nr=/^-?\d+$/,Bt=/^-?\d+(?:\.\d+)?$/,sa=/^(?:true|false)$/i,aa=/^null$/i;var ca=/^undefined$/i;var la=/^[^A-Z]*$/,ua=/^[^a-z]*$/,da=/^[0-9a-fA-F]*$/;function rr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function or(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var dv=/^[0-9a-fA-F]{32}$/,pv=rr(22,"=="),fv=or(22),mv=/^[0-9a-fA-F]{40}$/,gv=rr(27,"="),hv=or(27),yv=/^[0-9a-fA-F]{64}$/,bv=rr(43,"="),wv=or(43),vv=/^[0-9a-fA-F]{96}$/,xv=rr(64,""),kv=or(64),Sv=/^[0-9a-fA-F]{128}$/,Iv=rr(86,"=="),Cv=or(86);var ue=m("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),pa=(e)=>{let t=e.value;return!bs(t)&&t.size!==void 0},fa=(e)=>{let t=e.value;return!bs(t)&&t.length!==void 0},Eo={number:"number",bigint:"bigint",object:"date"},ma=m("$ZodCheckLessThan",(e,t)=>{ue.init(e,t);let n=Eo[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:Eo[typeof r.value]??n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ga=m("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let n=Eo[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:Eo[typeof r.value]??n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),jd=m("$ZodCheckMultipleOf",(e,t)=>{ue.init(e,t),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Gu(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),_d=m("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=mo[t.format];e._zod.check=(s)=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}if(a<o)s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Rd=m("$ZodCheckBigIntFormat",(e,t)=>{ue.init(e,t);let[n,r]=go[t.format];e._zod.check=(o)=>{let i=o.value;if(i<n)o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(i>r)o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),Ad=m("$ZodCheckMaxSize",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=pa),e._zod.check=(r)=>{let o=r.value;if(o.size<=t.maximum)return;r.issues.push({origin:yo(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Pd=m("$ZodCheckMinSize",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=pa),e._zod.check=(r)=>{let o=r.value;if(o.size>=t.minimum)return;r.issues.push({origin:yo(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Td=m("$ZodCheckSizeEquals",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=pa),e._zod.check=(r)=>{let o=r.value,i=o.size;if(i===t.size)return;let s=i>t.size;r.issues.push({origin:yo(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),$d=m("$ZodCheckMaxLength",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=fa),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>t.maximum?bo(o):i)<=t.maximum)return;let a=wo(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Nd=m("$ZodCheckMinLength",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=fa),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?bo(o):i)>=t.minimum)return;let a=wo(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),zd=m("$ZodCheckLengthEquals",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=fa),e._zod.check=(r)=>{let o=r.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?bo(o):i;if(s===t.length)return;let a=wo(o),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ir=m("$ZodCheckStringFormat",(e,t)=>{var n,r;if(ue.init(e,t),t.pattern)(n=e._zod).check??(n.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),Dd=m("$ZodCheckRegex",(e,t)=>{ir.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qd=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=la),ir.init(e,t)}),Vd=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ua),ir.init(e,t)}),Ld=m("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);let n=et(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Md=m("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);let n=new RegExp(`^${et(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Fd=m("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);let n=new RegExp(`.*${et(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function Oo(e,t,n){if(e.issues.length)t.issues.push(...Ue(n,e.issues))}var Zd=m("$ZodCheckProperty",(e,t)=>{ue.init(e,t),e._zod.check=(n)=>{let r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then((o)=>Oo(o,n,t.property));Oo(r,n,t.property);return}}),Jd=m("$ZodCheckProperties",(e,t)=>{ue.init(e,t),Yn(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=(r)=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map((s)=>[s,t.shape[s]]));let o=r.value,i;for(let[s,a]of n){let c=a._zod.run({value:o[s],issues:[]},{});if(c instanceof Promise)i??(i=[]),i.push(c.then((l)=>Oo(l,r,s)));else Oo(c,r,s)}if(i)return Promise.all(i).then(()=>{return});return}}),Ud=m("$ZodCheckMimeType",(e,t)=>{ue.init(e,t);let n=new Set(t.mime);e._zod.check=(r)=>{if(n.has(r.value.type))return;r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),Bd=m("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class ha{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
5
|
+
`).filter((i)=>i),r=Math.min(...n.map((i)=>i.length-i.trimStart().length)),o=n.map((i)=>i.slice(r)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
6
|
+
${t.join(`
|
|
7
7
|
`)}
|
|
8
|
-
};`)(...Object.values(this.closed))}}var Md={major:4,minor:6,patch:5};var V=m("$ZodType",(e,n)=>{var t;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=Md;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{if(a.memo)return a;let u=Le(a),d;for(let g of c){if(g._zod.def.when){if(Xu(a))continue;if(!g._zod.def.when(a))continue}else if(u)continue;let h=a.issues.length,y=g._zod.check(a);if(y instanceof Promise&&l?.async===!1)throw new un;if(d||y instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await y,a.issues.length===h)return;if(hs(a.issues,h,e),!u)u=Le(a,h)});else{if(a.issues.length===h)continue;if(hs(a.issues,h,e),!u)u=Le(a,h)}}if(d)return d.then(()=>a);return a},s=(a,c,l)=>{if(Le(a))return a.aborted=!0,a;let u=i(c,o,l);if(u instanceof Promise){if(l.async===!1)throw new un;return u.then((d)=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((d)=>s(d,a,c));return s(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new un;return l.then((u)=>i(u,o,c))}return i(l,o,c)}}},{get "~standard"(){return Ht(this,"~standard",fa(this))},set "~standard"(e){yn(this,"~standard",e)}}),op=(e,n)=>e.issues.length?{issues:e.issues.map((t)=>Be(t,n,Re()))}:{value:e.value};async function gv(e,n){let t={async:!0};return op(await e._zod.run({value:n,issues:[]},t),t)}function fa(e){return{validate:(n)=>{let t={async:!1};try{let r=e._zod.run({value:n,issues:[]},t);if(!(r instanceof Promise))return op(r,t)}catch(r){}return gv(e,n)},vendor:"zod",version:1}}var ut=m("$ZodString",(e,n)=>{V.init(e,n),e._zod.pattern=n.pattern??Qs,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=String(t.value)}catch(o){}if(typeof t.value==="string")return t;return t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:e}),t}}),se=m("$ZodStringFormat",(e,n)=>{rr.init(e,n),ut.init(e,n)}),ip=m("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=$s),se.init(e,n)}),sp=m("$ZodUUID",(e,n)=>{if(n.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(r===void 0)throw Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=Jn(r))}else n.pattern??(n.pattern=Jn());se.init(e,n)}),ap=m("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=Ns),se.init(e,n)}),cp=1,Oo=2;function lp(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function hv(e,n){if(!("normalize"in n)&&!("hostname"in n)&&!("protocol"in n))return lp(e)||Oo;return yv(e,n)}function yv(e,n){if(!n.normalize&&n.protocol?.source===Xt.source&&!/^https?:\/\//i.test(e))return cp;try{if(typeof URL<"u"){let t=URL;if(typeof t.parse==="function")return t.parse(e)??Oo}return new URL(e)}catch{return Oo}}var bv=/[\t\n\r]/g;function Fd(e){return e.replace(bv,"")}function wv(e,n){return n.lastIndex=0,n.test(e.hostname)}function vv(e,n){return n.lastIndex=0,n.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var up=m("$ZodURL",(e,n)=>{se.init(e,n),e._zod.check=(t)=>{try{let r=t.value.trim(),o=hv(r,n);if(o===cp){t.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:t.value,inst:e,continue:!n.abort});return}if(o===Oo){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort});return}if(o===!0){t.value=Fd(r);return}if(n.hostname&&!wv(o,n.hostname))t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:t.value,inst:e,continue:!n.abort});if(n.protocol&&!vv(o,n.protocol))t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:t.value,inst:e,continue:!n.abort});t.value=n.normalize?o.href:Fd(r);return}catch(r){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort})}}}),dp=m("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=zs()),se.init(e,n)}),pp=m("$ZodNanoID",(e,n)=>{if(n.length!==void 0&&(!Number.isInteger(n.length)||n.length<1))throw Error(`Invalid nanoid length: ${n.length}`);n.pattern??(n.pattern=n.length===void 0?As:Ps(n.length)),se.init(e,n)}),fp=m("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=Es),se.init(e,n)}),mp=m("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=Os),se.init(e,n)}),gp=m("$ZodULID",(e,n)=>{n.pattern??(n.pattern=js),se.init(e,n)}),hp=m("$ZodXID",(e,n)=>{n.pattern??(n.pattern=_s),se.init(e,n)}),yp=m("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=Rs),se.init(e,n)}),bp=m("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=Hs(n)),se.init(e,n)}),wp=m("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=Ws),se.init(e,n)}),vp=m("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=Gs(n)),se.init(e,n)}),xp=m("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=Ts),se.init(e,n)}),kp=m("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=Ds),se.init(e,n)}),xv=/^[0-9a-fA-F:.]+$/;function Sp(e){if(!xv.test(e))return!1;return lp(`http://[${e}]`)}var Ip=m("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=qs),se.init(e,n),e._zod.check=(t)=>{if(!Sp(t.value))t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e,continue:!n.abort})}}),Cp=m("$ZodMAC",(e,n)=>{n.pattern??(n.pattern=Ls(n.delimiter)),se.init(e,n)}),Ep=m("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=Vs),se.init(e,n)});function kv(e){let n=e.split("/");if(n.length!==2)return!1;let[t,r]=n;if(!r)return!1;let o=Number(r);if(`${o}`!==r)return!1;if(o<0||o>128)return!1;return Sp(t)}var Op=m("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=Ms),se.init(e,n),e._zod.check=(t)=>{if(!kv(t.value))t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e,continue:!n.abort})}});function jp(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var ma=/^[0-9a-zA-Z+/]*={0,2}$/,_p=m("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=ma),se.init(e,n),e._zod.check=(t)=>{if(jp(t.value))return;t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!n.abort})}}),_o=/^[A-Za-z0-9_-]*$/;function Sv(e){if(!_o.test(e))return!1;let n=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),t=n.padEnd(Math.ceil(n.length/4)*4,"=");return jp(t)}var Rp=m("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=_o),se.init(e,n),e._zod.check=(t)=>{if(Sv(t.value))return;t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e,continue:!n.abort})}}),Ap=m("$ZodE164",(e,n)=>{n.pattern??(n.pattern=Bs),se.init(e,n)}),Iv=/[- ]/g;function Cv(e){let n=e.length,t=1,r=0;while(n){let o=e.charCodeAt(--n)-48;t^=1,r+=t?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function Ev(e){if(!vo.test(e))return!1;return Cv(e.replace(Iv,""))}var Pp=m("$ZodCreditCard",(e,n)=>{n.pattern??(n.pattern=vo),se.init(e,n),e._zod.check=(t)=>{if(Ev(t.value))return;t.issues.push({code:"invalid_format",format:"credit_card",input:t.value,inst:e,continue:!n.abort})}});function Ov(e){let n=0,t=e.length;for(let r=4;r<t;r++){let o=e.charCodeAt(r);n=(o>=65?n*100+(o-55):n*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);n=(o>=65?n*100+(o-55):n*10+(o-48))%97}return n===1}function jv(e){if(!xo.test(e))return!1;return Ov(e)}var Tp=m("$ZodIBAN",(e,n)=>{n.pattern??(n.pattern=xo),se.init(e,n),e._zod.check=(t)=>{if(jv(t.value))return;t.issues.push({code:"invalid_format",format:"iban",input:t.value,inst:e,continue:!n.abort})}});function _v(e,n=null){try{let t=e.split(".");if(t.length!==3)return!1;let[r]=t;if(!r)return!1;let o=JSON.parse(atob(r));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(n&&(!("alg"in o)||o.alg!==n))return!1;return!0}catch{return!1}}var $p=m("$ZodJWT",(e,n)=>{se.init(e,n),e._zod.check=(t)=>{if(_v(t.value,n.alg))return;t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!n.abort})}}),Np=m("$ZodCustomStringFormat",(e,n)=>{se.init(e,n),e._zod.check=(t)=>{if(n.fn(t.value))return;t.issues.push({code:"invalid_format",format:n.format,input:t.value,inst:e,continue:!n.abort})}}),ga=m("$ZodNumber",(e,n)=>{V.init(e,n),e._zod.pattern=Un,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=Number(t.value)}catch(s){}let o=t.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return t;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return t.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),t}}),zp=m("$ZodNumberFormat",(e,n)=>{kd.init(e,n),ga.init(e,n)}),Ro=m("$ZodBoolean",(e,n)=>{V.init(e,n),e._zod.pattern=ea,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=Boolean(t.value)}catch(i){}let o=t.value;if(typeof o==="boolean")return t;return t.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),t}}),ha=m("$ZodBigInt",(e,n)=>{V.init(e,n),e._zod.pattern=Xs,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=BigInt(t.value)}catch(o){}if(typeof t.value==="bigint")return t;return t.issues.push({expected:"bigint",code:"invalid_type",input:t.value,inst:e}),t}}),Dp=m("$ZodBigIntFormat",(e,n)=>{Sd.init(e,n),ha.init(e,n)}),qp=m("$ZodSymbol",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o==="symbol")return t;return t.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),t}}),Lp=m("$ZodUndefined",(e,n)=>{V.init(e,n),e._zod.pattern=ta,e._zod.values=new Set([void 0]),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o>"u")return t;return t.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),t}}),Vp=m("$ZodNull",(e,n)=>{V.init(e,n),e._zod.pattern=na,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let o=t.value;if(o===null)return t;return t.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),t}}),Mp=m("$ZodAny",(e,n)=>{V.init(e,n),e._zod.parse=(t)=>t}),Fp=m("$ZodUnknown",(e,n)=>{V.init(e,n),e._zod.parse=(t)=>t}),Zp=m("$ZodNever",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),Jp=m("$ZodVoid",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o>"u")return t;return t.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),t}}),Up=m("$ZodDate",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=new Date(t.value)}catch(a){}let o=t.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return t;return t.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),t}});function Zd(e,n,t){if(e.issues.length)n.issues.push(...Ue(t,e.issues));n.value[t]=e.value}var Bp=m("$ZodArray",(e,n)=>{V.init(e,n);let t=je.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=t?t.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let l=i[c],u=n.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>Zd(d,r,c)));else if(Zd(u,r,c),a&&u.issues.length!==0&&Le(u))break}if(s.length)return Promise.all(s).then(()=>r);return r}});function jo(e,n,t,r,o,i){let s=t in r,a=i==="optional";if(!s&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!s)return;n.issues.push(...Ue(t,e.issues))}if(!s&&o===void 0){if(!e.issues.length)n.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[t]});return}if(e.value===void 0){if(s||o==="defaulted"&&!a)n.value[t]=void 0}else n.value[t]=e.value}var Rv=[];function Kp(e){let n=Object.keys(e.shape),t=Object.getOwnPropertySymbols(e.shape),r=t.length?t:Rv,o=r.length?[...n,...r]:n;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Hu(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(i)}}function Wp(e,n,t,r,o,i,s){let a=[],c=o.keySet,l=o.catchall._zod,u=l.def.type,{optin:d,optout:g}=l,h=0;for(let y in n){if(s&&t.issues.length!==h){if(Le(t,h))break;h=t.issues.length}if(c.has(y))continue;if(y==="__proto__"){if(u==="never")a.push(y);continue}if(u==="never"){a.push(y);continue}let S=l.run({value:n[y],issues:[]},r);if(S instanceof Promise)e.push(S.then((R)=>jo(R,t,y,n,d,g)));else jo(S,t,y,n,d,g)}if(a.length)t.issues.push({code:"unrecognized_keys",keys:a,input:n,inst:i,continue:!0});if(!e.length)return t;return Promise.all(e).then(()=>t)}var Av=m("$ZodObject",(e,n)=>{V.init(e,n);let t=Object.getOwnPropertyDescriptor(n,"shape"),r=t?.get?t.get.raw:n.shape??{};if(r){let l=()=>{let u={...r};return Object.defineProperty(n,"shape",{value:u}),l.raw=u,u};l.raw=r,Object.defineProperty(n,"shape",{get:l})}let o=Wt(()=>Kp(n));B(e,"propValues",(l)=>{let u=l.def.shape,d={};for(let g in u){let h=u[g]._zod;if(h.values){if(!Object.prototype.hasOwnProperty.call(d,g))_e(d,g,new Set);for(let y of h.values)d[g].add(y);if(h.optin!==void 0)d[g].add(void 0)}}return d});let i=ct,s=n.catchall,a,c=je.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=o.value);let d=l.value;if(!i(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let g=[],h=a.shape,y=u?.abortEarly,S=l.issues.length;for(let R of a.allKeys){if(y&&l.issues.length!==S){if(Le(l,S))break;S=l.issues.length}if(R==="__proto__")continue;let N=h[R],D=N._zod.optin,L=N._zod.optout,Oe=N._zod.run({value:d[R],issues:[]},u);if(Oe instanceof Promise)g.push(Oe.then((fe)=>jo(fe,l,R,d,D,L)));else jo(Oe,l,R,d,D,L)}if(!s)return g.length?Promise.all(g).then(()=>l):l;return Wp(g,d,l,u,o.value,e,y===!0)}}),Gp=m("$ZodObjectJIT",(e,n)=>{Av.init(e,n);let t=e._zod.parse,r=Wt(()=>Kp(n)),o=je.memoizer,i=(h)=>{let y=r.value,S=y.symbolKeys,R=new ua(["payload","ctx"],{shape:h,inst:e,memo:o,syms:S}),N=(fe)=>`shape[${fe}]._zod.run({ value: input[${fe}], issues: [] }, ctx)`,D=(fe,ie)=>`
|
|
8
|
+
};`)(...Object.values(this.closed))}}var Wd={major:4,minor:6,patch:5};var F=m("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Wd;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{if(a.memo)return a;let u=Ve(a),d;for(let g of c){if(g._zod.def.when){if(sd(a))continue;if(!g._zod.def.when(a))continue}else if(u)continue;let h=a.issues.length,y=g._zod.check(a);if(y instanceof Promise&&l?.async===!1)throw new lt;if(d||y instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await y,a.issues.length===h)return;if(ks(a.issues,h,e),!u)u=Ve(a,h)});else{if(a.issues.length===h)continue;if(ks(a.issues,h,e),!u)u=Ve(a,h)}}if(d)return d.then(()=>a);return a},s=(a,c,l)=>{if(Ve(a))return a.aborted=!0,a;let u=i(c,o,l);if(u instanceof Promise){if(l.async===!1)throw new lt;return u.then((d)=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((d)=>s(d,a,c));return s(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new lt;return l.then((u)=>i(u,o,c))}return i(l,o,c)}}},{get "~standard"(){return Yn(this,"~standard",wa(this))},set "~standard"(e){yt(this,"~standard",e)}}),dp=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>Be(n,t,Re()))}:{value:e.value};async function Ev(e,t){let n={async:!0};return dp(await e._zod.run({value:t,issues:[]},n),n)}function wa(e){return{validate:(t)=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return dp(r,n)}catch(r){}return Ev(e,t)},vendor:"zod",version:1}}var dn=m("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=t.pattern??ra,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ae=m("$ZodStringFormat",(e,t)=>{ir.init(e,t),dn.init(e,t)}),pp=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ls),ae.init(e,t)}),fp=m("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ut(r))}else t.pattern??(t.pattern=Ut());ae.init(e,t)}),mp=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ms),ae.init(e,t)}),gp=1,Ao=2;function hp(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Ov(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return hp(e)||Ao;return jv(e,t)}function jv(e,t){if(!t.normalize&&t.protocol?.source===tr.source&&!/^https?:\/\//i.test(e))return gp;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??Ao}return new URL(e)}catch{return Ao}}var _v=/[\t\n\r]/g;function Gd(e){return e.replace(_v,"")}function Rv(e,t){return t.lastIndex=0,t.test(e.hostname)}function Av(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var yp=m("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim(),o=Ov(r,t);if(o===gp){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Ao){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=Gd(r);return}if(t.hostname&&!Rv(o,t.hostname))n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort});if(t.protocol&&!Av(o,t.protocol))n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort});n.value=t.normalize?o.href:Gd(r);return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),bp=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Fs()),ae.init(e,t)}),wp=m("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Ds:qs(t.length)),ae.init(e,t)}),vp=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ps),ae.init(e,t)}),xp=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ts),ae.init(e,t)}),kp=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=$s),ae.init(e,t)}),Sp=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ns),ae.init(e,t)}),Ip=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=zs),ae.init(e,t)}),Cp=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=na(t)),ae.init(e,t)}),Ep=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ea),ae.init(e,t)}),Op=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ta(t)),ae.init(e,t)}),jp=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Vs),ae.init(e,t)}),_p=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Zs),ae.init(e,t)}),Pv=/^[0-9a-fA-F:.]+$/;function Rp(e){if(!Pv.test(e))return!1;return hp(`http://[${e}]`)}var Ap=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Js),ae.init(e,t),e._zod.check=(n)=>{if(!Rp(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Pp=m("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Us(t.delimiter)),ae.init(e,t)}),Tp=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Bs),ae.init(e,t)});function Tv(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);if(`${o}`!==r)return!1;if(o<0||o>128)return!1;return Rp(n)}var $p=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ks),ae.init(e,t),e._zod.check=(n)=>{if(!Tv(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Np(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var va=/^[0-9a-zA-Z+/]*={0,2}$/,zp=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=va),ae.init(e,t),e._zod.check=(n)=>{if(Np(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),To=/^[A-Za-z0-9_-]*$/;function $v(e){if(!To.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Np(n)}var Dp=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=To),ae.init(e,t),e._zod.check=(n)=>{if($v(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),qp=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ys),ae.init(e,t)}),Nv=/[- ]/g;function zv(e){let t=e.length,n=1,r=0;while(t){let o=e.charCodeAt(--t)-48;n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function Dv(e){if(!Io.test(e))return!1;return zv(e.replace(Nv,""))}var Vp=m("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Io),ae.init(e,t),e._zod.check=(n)=>{if(Dv(n.value))return;n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function qv(e){let t=0,n=e.length;for(let r=4;r<n;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function Vv(e){if(!Co.test(e))return!1;return qv(e)}var Lp=m("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Co),ae.init(e,t),e._zod.check=(n)=>{if(Vv(n.value))return;n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function Lv(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Mp=m("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=(n)=>{if(Lv(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Fp=m("$ZodCustomStringFormat",(e,t)=>{ae.init(e,t),e._zod.check=(n)=>{if(t.fn(n.value))return;n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),xa=m("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=Bt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}let o=n.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Zp=m("$ZodNumberFormat",(e,t)=>{_d.init(e,t),xa.init(e,t)}),$o=m("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=sa,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}let o=n.value;if(typeof o==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),ka=m("$ZodBigInt",(e,t)=>{F.init(e,t),e._zod.pattern=ia,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(o){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Jp=m("$ZodBigIntFormat",(e,t)=>{Rd.init(e,t),ka.init(e,t)}),Up=m("$ZodSymbol",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(typeof o==="symbol")return n;return n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),Bp=m("$ZodUndefined",(e,t)=>{F.init(e,t),e._zod.pattern=ca,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{let o=n.value;if(typeof o>"u")return n;return n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),Kp=m("$ZodNull",(e,t)=>{F.init(e,t),e._zod.pattern=aa,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;if(o===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Wp=m("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=(n)=>n}),Gp=m("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=(n)=>n}),Hp=m("$ZodNever",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Qp=m("$ZodVoid",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(typeof o>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),Yp=m("$ZodDate",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let o=n.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function Hd(e,t,n){if(e.issues.length)t.issues.push(...Ue(n,e.issues));t.value[n]=e.value}var Xp=m("$ZodArray",(e,t)=>{F.init(e,t);let n=je.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let l=i[c],u=t.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>Hd(d,r,c)));else if(Hd(u,r,c),a&&u.issues.length!==0&&Ve(u))break}if(s.length)return Promise.all(s).then(()=>r);return r}});function Po(e,t,n,r,o,i){let s=n in r,a=i==="optional";if(!s&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...Ue(n,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(s||o==="defaulted"&&!a)t.value[n]=void 0}else t.value[n]=e.value}var Mv=[];function ef(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Mv,o=r.length?[...t,...r]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=rd(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function tf(e,t,n,r,o,i,s){let a=[],c=o.keySet,l=o.catchall._zod,u=l.def.type,{optin:d,optout:g}=l,h=0;for(let y in t){if(s&&n.issues.length!==h){if(Ve(n,h))break;h=n.issues.length}if(c.has(y))continue;if(y==="__proto__"){if(u==="never")a.push(y);continue}if(u==="never"){a.push(y);continue}let S=l.run({value:t[y],issues:[]},r);if(S instanceof Promise)e.push(S.then((R)=>Po(R,n,y,t,d,g)));else Po(S,n,y,t,d,g)}if(a.length)n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var Fv=m("$ZodObject",(e,t)=>{F.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let l=()=>{let u={...r};return Object.defineProperty(t,"shape",{value:u}),l.raw=u,u};l.raw=r,Object.defineProperty(t,"shape",{get:l})}let o=Hn(()=>ef(t));W(e,"propValues",(l)=>{let u=l.def.shape,d={};for(let g in u){let h=u[g]._zod;if(h.values){if(!Object.prototype.hasOwnProperty.call(d,g))_e(d,g,new Set);for(let y of h.values)d[g].add(y);if(h.optin!==void 0)d[g].add(void 0)}}return d});let i=ln,s=t.catchall,a,c=je.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=o.value);let d=l.value;if(!i(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let g=[],h=a.shape,y=u?.abortEarly,S=l.issues.length;for(let R of a.allKeys){if(y&&l.issues.length!==S){if(Ve(l,S))break;S=l.issues.length}if(R==="__proto__")continue;let N=h[R],q=N._zod.optin,V=N._zod.optout,Oe=N._zod.run({value:d[R],issues:[]},u);if(Oe instanceof Promise)g.push(Oe.then((fe)=>Po(fe,l,R,d,q,V)));else Po(Oe,l,R,d,q,V)}if(!s)return g.length?Promise.all(g).then(()=>l):l;return tf(g,d,l,u,o.value,e,y===!0)}}),nf=m("$ZodObjectJIT",(e,t)=>{Fv.init(e,t);let n=e._zod.parse,r=Hn(()=>ef(t)),o=je.memoizer,i=(h)=>{let y=r.value,S=y.symbolKeys,R=new ha(["payload","ctx"],{shape:h,inst:e,memo:o,syms:S}),N=(fe)=>`shape[${fe}]._zod.run({ value: input[${fe}], issues: [] }, ctx)`,q=(fe,se)=>`
|
|
9
9
|
let ${fe}_ab = false;
|
|
10
10
|
for (let i = 0; i < ${fe}.issues.length; i++) {
|
|
11
11
|
const iss = ${fe}.issues[i];
|
|
12
|
-
iss.path = iss.path ? [${
|
|
12
|
+
iss.path = iss.path ? [${se}, ...iss.path] : [${se}];
|
|
13
13
|
payload.issues.push(iss);
|
|
14
14
|
if (iss.continue !== true) ${fe}_ab = true;
|
|
15
15
|
}
|
|
16
16
|
if (${fe}_ab && ctx && ctx.abortEarly) {
|
|
17
17
|
payload.value = newResult;
|
|
18
18
|
return payload;
|
|
19
|
-
}`;R.write("const input = payload.value;");let
|
|
20
|
-
const ${
|
|
21
|
-
if (!${
|
|
22
|
-
if (${
|
|
19
|
+
}`;R.write("const input = payload.value;");let V=Object.create(null),Oe=0;for(let fe of y.allKeys)V[fe]=`key_${Oe++}`;R.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let fe of y.allKeys){if(fe==="__proto__")continue;let se=V[fe],qe=typeof fe==="symbol"?`syms[${S.indexOf(fe)}]`:Xu(fe),Mt=`${qe} in input`,on=h[fe],Ft=on?._zod?.optin,Zn=Ft!==void 0,Jn=on?._zod?.optout==="optional";if(R.write(`const ${se} = ${N(qe)};`),Zn&&Jn){let so=Ft==="optional"?`${se}_present`:`${se}.value !== undefined || ${se}_present`;R.write(`
|
|
20
|
+
const ${se}_present = ${Mt};
|
|
21
|
+
if (!${se}.issues.length || ${se}_present) {
|
|
22
|
+
if (${se}.issues.length) {${q(se,qe)}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
if (${
|
|
26
|
-
newResult[${qe}] = ${
|
|
25
|
+
if (${so}) {
|
|
26
|
+
newResult[${qe}] = ${se}.value;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
`)}else if(!
|
|
31
|
-
const ${
|
|
32
|
-
if (${
|
|
30
|
+
`)}else if(!Zn)R.write(`
|
|
31
|
+
const ${se}_present = ${Mt};
|
|
32
|
+
if (${se}.issues.length) {${q(se,qe)}
|
|
33
33
|
}
|
|
34
|
-
if (!${
|
|
34
|
+
if (!${se}_present && !${se}.issues.length) {
|
|
35
35
|
payload.issues.push({
|
|
36
36
|
code: "invalid_type",
|
|
37
37
|
expected: "nonoptional",
|
|
@@ -44,44 +44,44 @@ ${n.join(`
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
if (${
|
|
48
|
-
newResult[${qe}] = ${
|
|
47
|
+
if (${se}_present) {
|
|
48
|
+
newResult[${qe}] = ${se}.value;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
`);else if(R.write(`
|
|
52
|
-
if (${
|
|
52
|
+
if (${se}.issues.length) {${q(se,qe)}
|
|
53
53
|
}
|
|
54
|
-
`),
|
|
55
|
-
if (${
|
|
56
|
-
newResult[${qe}] = ${
|
|
54
|
+
`),Ft==="defaulted")R.write(`newResult[${qe}] = ${se}.value;`);else R.write(`
|
|
55
|
+
if (${se}.value !== undefined || ${Mt}) {
|
|
56
|
+
newResult[${qe}] = ${se}.value;
|
|
57
57
|
}
|
|
58
|
-
`)}return R.write("payload.value = newResult;"),R.write("return payload;"),R.compile()},s,a=ct,c=!je.jitless,u=c&&Wu.value,d=n.catchall,g;e._zod.parse=(h,y)=>{g??(g=r.value);let S=h.value;if(!a(S))return h.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),h;if(c&&u&&y?.async===!1&&y.jitless!==!0){if(!s)s=i(n.shape);if(h=s(h,y),!d)return h;return Wp([],S,h,y,g,e,y?.abortEarly===!0)}return t(h,y)}});function Jd(e,n,t,r){for(let i of e)if(i.issues.length===0)return n.value=i.value,n;let o=e.filter((i)=>!Le(i));if(o.length===1)return n.value=o[0].value,o[0];return n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((i)=>i.issues.map((s)=>Be(s,r,Re())))}),n}var Ao=m("$ZodUnion",(e,n)=>{V.init(e,n),B(e,"optin",(r)=>r.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),B(e,"optout",(r)=>r.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),B(e,"values",(r)=>{if(r.def.options.every((o)=>o._zod.values))return new Set(r.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),B(e,"pattern",(r)=>{if(r.def.options.every((o)=>o._zod.pattern)){let o=r.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>On(i.source)).join("|")})$`)}return});let t=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(t)return t(r,o);let i=!1,s=[];for(let a of n.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return Jd(s,r,e,o);return Promise.all(s).then((a)=>Jd(a,r,e,o))}});function Ud(e,n,t,r){let o=[];for(let i=0;i<e.length;i++)if(e[i].issues.length===0)o.push(i);if(o.length===1)return n.value=e[o[0]].value,n;if(o.length===0)n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((i)=>i.issues.map((s)=>Be(s,r,Re())))});else n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:[],inclusive:!1,matches:o});return n}var Hp=m("$ZodXor",(e,n)=>{Ao.init(e,n),n.inclusive=!1;let t=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(t)return t(r,o);let i=!1,s=[];for(let a of n.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else s.push(c)}if(!i)return Ud(s,r,e,o);return Promise.all(s).then((a)=>Ud(a,r,e,o))}});function Pv(e){let n=new Map;for(let t of e.options){let r=t._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(t)}"`);for(let o of r)if(n.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);n.set(o,null)}else n.set(o,t)}return n}var Qp=m("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,Ao.init(e,n);let t=e._zod.parse;B(e,"propValues",(o)=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))s++;for(let[l,u]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,l))_e(i,l,new Set);for(let d of u)i[l].add(d)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),n.options.forEach((o,i)=>{let s=Gt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,n.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let r=Wt(()=>Pv(n));e._zod.parse=(o,i)=>{let s=o.value;if(!ct(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[n.discriminator],c=r.value.get(a);if(c&&(a!==void 0||i.direction!=="backward"))return c._zod.run(o,i);if(n.unionFallback||i.direction==="backward")return t(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,options:Array.from(r.value.keys()).filter((l)=>r.value.get(l)!==null),input:s,path:[n.discriminator],inst:e}),o}}),Yp=m("$ZodIntersection",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{let o=t.value,i=n.left._zod.run({value:o,issues:[]},r),s=n.right._zod.run({value:o,issues:[]},r);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,l])=>Bd(t,c,l));return Bd(t,i,s)}});function da(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e===+n)return{valid:!0,data:e};if(bn(e)&&bn(n)){let t=Object.keys(n),r=Object.keys(e).filter((i)=>t.indexOf(i)!==-1),o={...e,...n};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=da(e[i],n[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};let t=[];for(let r=0;r<e.length;r++){let o=e[r],i=n[r],s=da(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};t.push(s.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Bd(e,n,t){let r=new Map,o,i=new Map,s=(l,u)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let g=String(l.path[0]);if(!i.has(g))i.set(g,l);d=[g]}else return!1;for(let g of d){if(!r.has(g))r.set(g,{});r.get(g)[u]=!0}return!0};for(let l of n.issues)if(!s(l,"l"))e.issues.push(l);for(let l of t.issues)if(!s(l,"r"))e.issues.push(l);let a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter((u)=>o.keys.includes(u)):[];if(l.length)e.issues.push({...o,keys:l});for(let u of a)if(!l.includes(u)&&i.has(u))e.issues.push(i.get(u))}let c=da(n.value,t.value);if(!c.valid){if(Le(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ya=m("$ZodTuple",(e,n)=>{V.init(e,n);let t=n.items,r=je.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=Kd(t,"optin"),l=Kd(t,"optout");if(!n.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>t.length)o.issues.push({code:"too_big",maximum:t.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=Array(t.length),d=n.rest?i?.abortEarly:void 0,g=!1;for(let h=0;h<t.length;h++){let y=t[h]._zod.run({value:s[h],issues:[]},i);if(y instanceof Promise)a.push(y.then((S)=>{u[h]=S}));else if(u[h]=y,d&&!g&&y.issues.length)g=Le(y)}if(n.rest&&!g){let h=t.length-1,y=s.slice(t.length),S=o.issues.length;for(let R of y){if(d&&o.issues.length!==S){if(Le(o,S))break;S=o.issues.length}h++;let N=n.rest._zod.run({value:R,issues:[]},i);if(N instanceof Promise)a.push(N.then((D)=>Wd(D,o,h)));else Wd(N,o,h)}}if(a.length)return Promise.all(a).then(()=>Gd(u,o,t,s,l));return Gd(u,o,t,s,l)}});function Kd(e,n){for(let t=e.length-1;t>=0;t--)if(!(n==="optin"?e[t]._zod.optin!==void 0:e[t]._zod.optout==="optional"))return t+1;return 0}function Wd(e,n,t){if(e.issues.length)n.issues.push(...Ue(t,e.issues));n.value[t]=e.value}function Gd(e,n,t,r,o){for(let i=0;i<t.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&t[i]._zod.optin==="optional"){n.value.length=i;break}if(s.issues.length){if(!a&&i>=o){n.value.length=i;break}n.issues.push(...Ue(i,s.issues))}n.value[i]=s.value}for(let i=n.value.length-1;i>=r.length;i--)if(t[i]._zod.optout==="optional"&&n.value[i]===void 0)n.value.length=i;else break;return n}var Xp=m("$ZodRecord",(e,n)=>{V.init(e,n);let t=je.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!bn(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=n.keyType._zod.values;if(a&&!n.partial){r.value=t?t.alloc(e,r,{},o):{};let c=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){if(c.add(typeof u==="number"?u.toString():u),u==="__proto__")continue;let d=n.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((y)=>Be(y,o,Re())),input:u,path:[u],inst:e});continue}let g=d.value;if(g==="__proto__")continue;let h=n.valueType._zod.run({value:i[u],issues:[]},o);if(h instanceof Promise)s.push(h.then((y)=>{if(y.issues.length)r.issues.push(...Ue(u,y.issues));r.value[g]=y.value}));else{if(h.issues.length)r.issues.push(...Ue(u,h.issues));r.value[g]=h.value}}let l;for(let u in i)if(!c.has(u))if(n.mode==="loose"){if(u==="__proto__")continue;r.value[u]=i[u]}else l=l??[],l.push(u);if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{r.value=t?t.alloc(e,r,{},o):{};let c;for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let u=n.keyType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&Un.test(l)&&u.issues.length){let y=n.keyType._zod.run({value:Number(l),issues:[]},o);if(y instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(y.issues.length===0)u=y}if(u.issues.length){if(n.mode==="loose")r.value[l]=i[l];else if(a)c=c??[],c.push(l);else r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((y)=>Be(y,o,Re())),input:l,path:[l],inst:e});continue}let g=u.value;if(g==="__proto__")continue;let h=n.valueType._zod.run({value:i[l],issues:[]},o);if(h instanceof Promise)s.push(h.then((y)=>{if(y.issues.length)r.issues.push(...Ue(l,y.issues));r.value[g]=y.value}));else{if(h.issues.length)r.issues.push(...Ue(l,h.issues));r.value[g]=h.value}}if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}if(s.length)return Promise.all(s).then(()=>r);return r}}),ef=m("$ZodMap",(e,n)=>{V.init(e,n);let t=je.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let s=[];r.value=t?t.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,c=r.issues.length;for(let[l,u]of i){if(a&&r.issues.length!==c){if(Le(r,c))break;c=r.issues.length}let d=n.keyType._zod.run({value:l,issues:[]},o),g=n.valueType._zod.run({value:u,issues:[]},o);if(d instanceof Promise||g instanceof Promise)s.push(Promise.all([d,g]).then(([h,y])=>{Hd(h,y,r,l,i,e,o)}));else Hd(d,g,r,l,i,e,o)}if(s.length)return Promise.all(s).then(()=>r);return r}});function Hd(e,n,t,r,o,i,s){if(e.issues.length)if(co.has(typeof r))t.issues.push(...Ue(r,e.issues));else t.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map((a)=>Be(a,s,Re()))});if(n.issues.length)if(co.has(typeof r))t.issues.push(...Ue(r,n.issues));else t.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:n.issues.map((a)=>Be(a,s,Re()))});t.value.set(e.value,n.value)}var nf=m("$ZodSet",(e,n)=>{V.init(e,n);let t=je.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let s=[];r.value=t?t.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,c=r.issues.length;for(let l of i){if(a&&r.issues.length!==c){if(Le(r,c))break;c=r.issues.length}let u=n.valueType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>Qd(d,r)));else Qd(u,r)}if(s.length)return Promise.all(s).then(()=>r);return r}});function Qd(e,n){if(e.issues.length)n.issues.push(...e.issues);n.value.add(e.value)}var tf=m("$ZodEnum",(e,n)=>{V.init(e,n);let t=Bt(n.entries),r=new Set(t);e._zod.values=r,B(e,"pattern",(o)=>{let i=Bt(o.def.entries).filter((s)=>co.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>en(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:t,input:s,inst:e}),o}}),rf=m("$ZodLiteral",(e,n)=>{V.init(e,n);let t=new Set(n.values);e._zod.values=t,B(e,"pattern",(r)=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?en(i):i?en(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;if(t.has(i))return r;return r.issues.push({code:"invalid_value",values:n.values,input:i,inst:e}),r}}),of=m("$ZodFile",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(o instanceof File)return t;return t.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),t}}),sf=m("$ZodTransform",(e,n)=>{V.init(e,n),e._zod.optin="optional",je.memoizer?.guard(e),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new lt(e.constructor.name);let o=n.transform(t.value,t);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(t.value=s,t));if(o instanceof Promise)throw new un;return t.value=o,t}});function Yd(e,n){return e.value=n.issues.length?void 0:n.value,e}var ba=m("$ZodOptional",(e,n)=>{V.init(e,n),B(e,"optin",(t)=>t.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",B(e,"values",(t)=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),B(e,"pattern",(t)=>{let r=t.def.innerType._zod.pattern;return r?new RegExp(`^(${On(r.source)})?$`):void 0}),e._zod.parse=(t,r)=>{if(t.value===void 0){if(n.innerType._zod.optin!=="defaulted")return t;let o=n.innerType._zod.run({value:t.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>Yd(t,i));return Yd(t,o)}return n.innerType._zod.run(t,r)}}),af=m("$ZodExactOptional",(e,n)=>{ba.init(e,n),B(e,"values",(t)=>t.def.innerType._zod.values),B(e,"pattern",(t)=>t.def.innerType._zod.pattern),e._zod.parse=(t,r)=>n.innerType._zod.run(t,r)}),cf=m("$ZodNullable",(e,n)=>{V.init(e,n),B(e,"optin",(t)=>t.def.innerType._zod.optin),B(e,"optout",(t)=>t.def.innerType._zod.optout),B(e,"pattern",(t)=>{let r=t.def.innerType._zod.pattern;return r?new RegExp(`^(${On(r.source)}|null)$`):void 0}),B(e,"values",(t)=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),e._zod.parse=(t,r)=>{if(t.value===null)return t;return n.innerType._zod.run(t,r)}}),lf=m("$ZodDefault",(e,n)=>{V.init(e,n),e._zod.optin="defaulted",B(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);if(t.value===void 0)return t.value=n.defaultValue,t;let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>Xd(i,n));return Xd(o,n)}});function Xd(e,n){if(e.value===void 0)e.value=n.defaultValue;return e}var uf=m("$ZodPrefault",(e,n)=>{V.init(e,n),e._zod.optin="defaulted",B(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);if(t.value===void 0)t.value=n.defaultValue;return n.innerType._zod.run(t,r)}}),df=m("$ZodNonOptional",(e,n)=>{V.init(e,n),B(e,"values",(t)=>{let r=t.def.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(t,r)=>{let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>ep(i,e));return ep(o,e)}});function ep(e,n){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n});return e}var pf=m("$ZodSuccess",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new lt("ZodSuccess");let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>(t.value=i.issues.length===0,t));return t.value=o.issues.length===0,t}});function np(e,n,t,r){if(!n.issues.length){if(e.value=n.value,n.memo)e.memo=!0;return e}return e.value=t.catchValue({...n,value:e.value,error:{issues:n.issues.map((o)=>Be(o,r,Re()))},input:e.value}),e}var ff=m("$ZodCatch",(e,n)=>{V.init(e,n),B(e,"optin",(t)=>t.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),B(e,"optout",(t)=>t.def.innerType._zod.optout),B(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);let o=n.innerType._zod.run({value:t.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>np(t,i,n,r));return np(t,o,n,r)}}),mf=m("$ZodNaN",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{if(typeof t.value!=="number"||!Number.isNaN(t.value))return t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t;return t}}),wa=m("$ZodPipe",(e,n)=>{V.init(e,n),B(e,"values",(t)=>t.def.in._zod.values),B(e,"optin",(t)=>t.def.in._zod.optin),B(e,"optout",(t)=>t.def.out._zod.optout),B(e,"propValues",(t)=>t.def.in._zod.propValues),e._zod.parse=(t,r)=>{if(r.direction==="backward"){let i=n.out._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>Io(s,n.in,r));return Io(i,n.in,r)}let o=n.in._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>Io(i,n.out,r));return Io(o,n.out,r)}});function Io(e,n,t){if(e.issues.some((r)=>r.code!=="unrecognized_keys"))return e.aborted=!0,e;return n._zod.run({value:e.value,issues:e.issues},t)}var Po=m("$ZodCodec",(e,n)=>{V.init(e,n),B(e,"values",(t)=>t.def.in._zod.values),B(e,"optin",(t)=>t.def.in._zod.optin),B(e,"optout",(t)=>t.def.out._zod.optout),B(e,"propValues",(t)=>t.def.in._zod.propValues),e._zod.parse=(t,r)=>{if((r.direction||"forward")==="forward"){let i=n.in._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>Co(s,n,r));return Co(i,n,r)}else{let i=n.out._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>Co(s,n,r));return Co(i,n,r)}}});function Co(e,n,t){if(e.issues.length)return e.aborted=!0,e;if((t.direction||"forward")==="forward"){let o=n.transform(e.value,e);if(o instanceof Promise)return o.then((i)=>Eo(e,i,n.out,t));return Eo(e,o,n.out,t)}else{let o=n.reverseTransform(e.value,e);if(o instanceof Promise)return o.then((i)=>Eo(e,i,n.in,t));return Eo(e,o,n.in,t)}}function Eo(e,n,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:n,issues:e.issues},r)}var gf=m("$ZodPreprocess",(e,n)=>{wa.init(e,n)}),hf=m("$ZodReadonly",(e,n)=>{V.init(e,n),B(e,"propValues",(t)=>t.def.innerType._zod.propValues),B(e,"values",(t)=>t.def.innerType._zod.values),B(e,"optin",(t)=>t.def.innerType?._zod?.optin),B(e,"optout",(t)=>t.def.innerType?._zod?.optout),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then(tp);return tp(o)}});function tp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}function Tv(e){let n=e._zod.def,t=n.pattern,r=!!n.format?.includes("int"),o,i;for(let a of n.checks??[]){let c=a._zod.def;if(c.pattern)t=c.pattern;r||(r=!!c.format?.includes("int"));let l=c.minimum??c.length,u=c.maximum??c.length;if(l!==void 0&&(o===void 0||l>o))o=l;if(u!==void 0&&(i===void 0||u<i))i=u}if(t)return t.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Ys({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===Un?er:s)?.source}function pa(e){let n=e._zod.def,t=e._zod.pattern?.source,r=n.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=pa(r);if(t&&o&&i&&i!==o)return t.replace(On(o),()=>On(i));return t}if(n.options){let o=n.options.map(pa);if(o.every(Boolean))return`^(${o.map((i)=>On(i)).join("|")})$`}return Tv(e)}var yf=m("$ZodTemplateLiteral",(e,n)=>{V.init(e,n);let t=[];for(let r of n.parts)if(typeof r==="object"&&r!==null){let o=pa(r);if(!o)throw Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);t.push(On(o))}else if(r===null||Gu.has(typeof r))t.push(en(`${r}`));else throw Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${t.join("")}$`),e._zod.parse=(r,o)=>{if(typeof r.value!=="string")return r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(r.value))return r.issues.push({input:r.value,inst:e,code:"invalid_format",format:n.format??"template_literal",pattern:e._zod.pattern.source}),r;return r}}),bf=m("$ZodFunction",(e,n)=>(V.init(e,n),Object.defineProperty(e,"_def",{value:n}),e._zod.def=n,e.implement=(t)=>{if(typeof t!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?xs(e._def.input,r):r,i=Reflect.apply(t,this,o);if(e._def.output)return xs(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(t)=>{if(typeof t!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await ks(e._def.input,r):r,i=await Reflect.apply(t,this,o);if(e._def.output)return await ks(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(t,r)=>{if(typeof t.value!=="function")return t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}),t;if(e._def.output&&e._def.output._zod.def.type==="promise")t.value=e.implementAsync(t.value);else t.value=e.implement(t.value);return t},e.input=(...t)=>{let r=e.constructor;if(Array.isArray(t[0]))return new r({type:"function",input:new ya({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output});return new r({type:"function",input:t[0],output:e._def.output})},e.output=(t)=>new e.constructor({type:"function",input:e._def.input,output:t}),e)),wf=m("$ZodPromise",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>Promise.resolve(t.value).then((o)=>n.innerType._zod.run({value:o,issues:[]},r))}),vf=m("$ZodLazy",(e,n)=>{V.init(e,n),Zu(e._zod,"innerType",()=>{let t=n;if(!t._cachedInner)t._cachedInner=n.getter();return t._cachedInner}),B(e,"pattern",(t)=>t.innerType?._zod?.pattern),B(e,"propValues",(t)=>t.innerType?._zod?.propValues),B(e,"optin",(t)=>t.innerType?._zod?.optin??void 0),B(e,"optout",(t)=>t.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),xf=m("$ZodCustom",(e,n)=>{le.init(e,n),V.init(e,n),e._zod.parse=(t,r)=>t,e._zod.check=(t)=>{let r=t.value,o=n.fn(r);if(o instanceof Promise)return o.then((i)=>rp(i,t,r,e));rp(o,t,r,e);return}});function rp(e,n,t,r){if(!e){let o={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)o.params=r._zod.def.params;n.issues.push(Zn(o))}}class Sf extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var xa="~memo",kf=[];function If(e){return e!==null&&typeof e==="object"}function va(e){return e.map((n)=>n.path?{...n,path:n.path.slice()}:{...n})}var Cf=new WeakMap,or=0,No=1,ir=2;function zo(e,n,t){let r=Cf.get(e);if(r!==void 0)return r?ir:or;if(n.has(e))return ir;n.add(e);let o=or,i=(u)=>{if(o!==ir&&u?._zod){let d=zo(u,n,t);if(d>o)o=d}},s=(u,d)=>{let g=or;for(let h of Reflect.ownKeys(u)){let y=Object.getOwnPropertyDescriptor(u,h);if(d&&!y.enumerable)continue;let S=y.get?No:y.value?._zod?zo(y.value,n,t):or;if(S>g)g=S}return g},a=(u)=>{if(u>o)o=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=Gt(c);a(u?s(u,!0):No),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let u of c.items)i(u);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let u of c.options)i(u);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let u=c._cachedInner??(t?e._zod.innerType:void 0);a(u?zo(u,n,!1):No);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in c){let d=Object.getOwnPropertyDescriptor(c,u);if(!d||d.get)continue;let g=d.value;if(!g||typeof g!=="object")continue;if(g._zod)i(g);else if(Array.isArray(g))for(let h of g)i(h)}}return n.delete(e),Nv(e,o)}function Nv(e,n){if(n!==No)Cf.set(e,n===ir);return n}function zv(e,n){let t=e.buckets.get(n);if(!t)t=new WeakMap,e.buckets.set(n,t);return t}var To,$o=[],Dv={alloc(e,n,t){let r=To;if(!r)return t;To=void 0;let o={value:t,issues:null};return r.set(n.value,o),$o.push(o),t},guard(e){var n;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&qv(i,o.value))throw new Sf;return t(o,i)};if(e._zod.parse=r,e._zod.run===t)e._zod.run=r})},attach(e){var n;let t,r=!1,o,i;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(t===void 0){let N=zo(e,new Set,!1);if(N===or){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(N===ir||r)t=!0;else r=!0}let u=c.value;if(!If(u))return s(c,l);let d=l[xa];if(!d)d={buckets:new WeakMap,backEdges:void 0},l[xa]=d;let g;if(o===l)g=i;else g=zv(d,e),o=l,i=g;let h=g.get(u);if(h){if(c.value=h.value,h.issues){if(h.issues.length)c.issues.push(...va(h.issues))}else c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(h.value);return c}To=g;let y=$o.length,S=s(c,l);To=void 0;let R=$o.length>y?$o.pop():void 0;if(S instanceof Promise)return S.then((N)=>{if(R)R.issues=N.issues.length?va(N.issues):kf;return N});if(R)R.issues=S.issues.length?va(S.issues):kf;return S};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function Ef(){return Dv}function qv(e,n){let t=e[xa]?.backEdges;return t!==void 0&&If(n)&&t.has(n)}var Lv=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function n(i){return e[i]??null}let t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return r[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=ed(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${gs(i.values[0])}`;return`Invalid option: expected one of ${ds(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=n(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=n(i.origin);if(a)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${t[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${ds(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((a)=>`'${a}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function ka(){return{localeError:Lv()}}var Of;class jf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){let t=n[0];if(this._map.set(e,t),t&&typeof t==="object"&&"id"in t)this._idmap.set(t.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let n=this._map.get(e);if(n&&typeof n==="object"&&"id"in n)this._idmap.delete(n.id);return this._map.delete(e),this}get(e){let n=e._zod.parent;if(n){let t={...this.get(n)??{}};delete t.id;let r={...t,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Vv(){return new jf}(Of=globalThis).__zod_globalRegistry??(Of.__zod_globalRegistry=Vv());var Ve=globalThis.__zod_globalRegistry;function _f(e){if(e.checks)e.checks=[...e.checks];return e}function Rf(e,n){return new e(_f({type:"string",...C(n)}))}function Sa(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...C(n)})}function Ia(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...C(n)})}function Ca(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...C(n)})}function Ea(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...C(n)})}function Oa(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...C(n)})}function ja(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...C(n)})}function Do(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...C(n)})}function _a(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...C(n)})}function Ra(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...C(n)})}function Aa(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...C(n)})}function Pa(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...C(n)})}function Ta(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...C(n)})}function $a(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...C(n)})}function Na(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...C(n)})}function za(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...C(n)})}function Da(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...C(n)})}function Af(e,n){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...C(n)})}function qa(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...C(n)})}function La(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...C(n)})}function Va(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...C(n)})}function Ma(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...C(n)})}function Fa(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...C(n)})}function Pf(e,n){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...C(n)})}function Tf(e,n){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...C(n)})}function Za(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...C(n)})}function qo(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...C(n)})}function Lo(e,n){return new e({type:"string",format:"date",check:"string_format",...C(n)})}function Vo(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...C(n)})}function Mo(e,n){return new e({type:"string",format:"duration",check:"string_format",...C(n)})}function $f(e,n){return new e(_f({type:"number",checks:[],...C(n)}))}function Nf(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...C(n)})}function zf(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...C(n)})}function Df(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...C(n)})}function qf(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...C(n)})}function Lf(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...C(n)})}function Vf(e,n){return new e({type:"boolean",...C(n)})}function Mf(e,n){return new e({type:"bigint",...C(n)})}function Ff(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...C(n)})}function Zf(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...C(n)})}function Jf(e,n){return new e({type:"symbol",...C(n)})}function Uf(e,n){return new e({type:"undefined",...C(n)})}function Bf(e,n){return new e({type:"null",...C(n)})}function Kf(e){return new e({type:"any"})}function Wf(e){return new e({type:"unknown"})}function Gf(e,n){return new e({type:"never",...C(n)})}function Hf(e,n){return new e({type:"void",...C(n)})}function Qf(e,n){return new e({type:"date",...C(n)})}function Yf(e,n){return new e({type:"nan",...C(n)})}function _n(e,n){return new ca({check:"less_than",...C(n),value:e,inclusive:!1})}function nn(e,n){return new ca({check:"less_than",...C(n),value:e,inclusive:!0})}function Rn(e,n){return new la({check:"greater_than",...C(n),value:e,inclusive:!1})}function tn(e,n){return new la({check:"greater_than",...C(n),value:e,inclusive:!0})}function Xf(e){return Rn(0,e)}function em(e){return _n(0,e)}function nm(e){return nn(0,e)}function tm(e){return tn(0,e)}function dt(e,n){return new xd({check:"multiple_of",...C(n),value:e})}function pt(e,n){return new Id({check:"max_size",...C(n),maximum:e})}function An(e,n){return new Cd({check:"min_size",...C(n),minimum:e})}function sr(e,n){return new Ed({check:"size_equals",...C(n),size:e})}function ar(e,n){return new Od({check:"max_length",...C(n),maximum:e})}function Bn(e,n){return new jd({check:"min_length",...C(n),minimum:e})}function cr(e,n){return new _d({check:"length_equals",...C(n),length:e})}function Fo(e,n){return new Rd({check:"string_format",format:"regex",...C(n),pattern:e})}function Zo(e){return new Ad({check:"string_format",format:"lowercase",...C(e)})}function Jo(e){return new Pd({check:"string_format",format:"uppercase",...C(e)})}function Uo(e,n){return new Td({check:"string_format",format:"includes",...C(n),includes:e})}function Bo(e,n){return new $d({check:"string_format",format:"starts_with",...C(n),prefix:e})}function Ko(e,n){return new Nd({check:"string_format",format:"ends_with",...C(n),suffix:e})}function rm(e,n,t){return new zd({check:"property",property:e,schema:n,...C(t)})}function Wo(e,n){return new Dd({check:"properties",shape:e,...C(n)})}function Go(e,n){return new qd({check:"mime_type",mime:e,...C(n)})}function wn(e){return new Ld({check:"overwrite",tx:e})}function Ho(e){return wn((n)=>n.normalize(e))}function Qo(){return wn((e)=>e.trim())}function Yo(){return wn((e)=>e.toLowerCase())}function Xo(){return wn((e)=>e.toUpperCase())}function ei(){return wn((e)=>Ku(e))}function om(e,n,t){return new e({type:"array",element:n,...C(t)})}function im(e,n){return new e({type:"file",...C(n)})}function sm(e,n,t){let r=C(t);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:n,...r})}function am(e,n,t){return new e({type:"custom",check:"custom",fn:n,...C(t)})}function cm(e,n){let t=Fv((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Zn(o,r.value,t._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(Zn(i))}},e(r.value,r)),n);return t}function Fv(e,n){let t=new le({check:"custom",...C(n)});return t._zod.check=e,t}function lm(e){let n=new le({check:"describe"});return n._zod.onattach=[(t)=>{let r=Ve.get(t)??{};Ve.add(t,{...r,description:e})}],n._zod.check=()=>{},n}function um(e){let n=new le({check:"meta"});return n._zod.onattach=[(t)=>{let r=Ve.get(t)??{};Ve.add(t,{...r,...e})}],n._zod.check=()=>{},n}function dm(e,n){let t=C(n),r=t.truthy??["true","1","yes","on","y","enabled"],o=t.falsy??["false","0","no","off","n","disabled"];if(t.case!=="sensitive")r=r.map((h)=>typeof h==="string"?h.toLowerCase():h),o=o.map((h)=>typeof h==="string"?h.toLowerCase():h);let i=new Set(r),s=new Set(o),a=e.Codec??Po,c=e.Boolean??Ro,u=new(e.String??ut)({type:"string",error:t.error}),d=new c({type:"boolean",error:t.error}),g=new a({type:"pipe",in:u,out:d,transform:(h,y)=>{let S=h;if(t.case!=="sensitive")S=S.toLowerCase();if(i.has(S))return!0;else if(s.has(S))return!1;else return y.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:y.value,inst:g,continue:!1}),{}},reverseTransform:(h,y)=>{if(h===!0)return r[0]||"true";else return o[0]||"false"},error:t.error});return g._zod.bag.truthy=r,g._zod.bag.falsy=o,g._zod.bag.case=t.case??"insensitive",g}function ft(e,n,t,r={}){let o=C(r),i={check:"string_format",type:"string",format:n,fn:typeof t==="function"?t:(a)=>t.test(a),...o};if(t instanceof RegExp)i.pattern=t;return new e(i)}function lr(e,...n){for(let t of n)for(let r of Reflect.ownKeys(t))if(Object.prototype.propertyIsEnumerable.call(t,r))_e(e,r,t[r]);return e}function dr(e){let n=e?.target??"draft-2020-12";if(n==="draft-4")n="draft-04";if(n==="draft-7")n="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Ve,target:n,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ce(e,n,t,r,o){let i=typeof n.unrepresentable==="function"?n.unrepresentable({zodSchema:e,path:r.path,message:o}):n.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(t,i),!0}function ue(e,n,t={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=n.seen.get(e);if(i){if(i.count++,t.schemaPath.includes(e))i.cycle=t.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:t.path};n.seen.set(e,s),n.sharedDefsExtractedFor=void 0,n.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...t,schemaPath:[...t.schemaPath,e],path:t.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,s.schema,u);else{let g=s.schema,h=n.processors[o.type];if(!h)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,n,g,u)}let d=e._zod.parent;if(d){if(!s.ref)s.ref=d;ue(d,n,u),n.seen.get(d).isParent=!0}}let c=n.metadataRegistry.get(e);if(c)lr(s.schema,c);if(n.io==="input"&&Te(e))delete s.schema.examples,delete s.schema.default;if(n.io==="input"&&"_prefault"in s.schema)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,n.seen.get(e).schema}function pm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function pr(e,n){let t=e.seen.get(n);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,g=e.external.uri??((y)=>y);if(d)return{ref:g(d)};let h=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=h,{defId:h,ref:`${g("__shared")}#/${a}/${pm(h)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===t&&!s[1].schema.id)return{ref:c};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+pm(u)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=o(s);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
58
|
+
`)}return R.write("payload.value = newResult;"),R.write("return payload;"),R.compile()},s,a=ln,c=!je.jitless,u=c&&td.value,d=t.catchall,g;e._zod.parse=(h,y)=>{g??(g=r.value);let S=h.value;if(!a(S))return h.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),h;if(c&&u&&y?.async===!1&&y.jitless!==!0){if(!s)s=i(t.shape);if(h=s(h,y),!d)return h;return tf([],S,h,y,g,e,y?.abortEarly===!0)}return n(h,y)}});function Qd(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!Ve(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((i)=>i.issues.map((s)=>Be(s,r,Re())))}),t}var No=m("$ZodUnion",(e,t)=>{F.init(e,t),W(e,"optin",(r)=>r.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),W(e,"optout",(r)=>r.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),W(e,"values",(r)=>{if(r.def.options.every((o)=>o._zod.values))return new Set(r.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),W(e,"pattern",(r)=>{if(r.def.options.every((o)=>o._zod.pattern)){let o=r.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>Et(i.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return Qd(s,r,e,o);return Promise.all(s).then((a)=>Qd(a,r,e,o))}});function Yd(e,t,n,r){let o=[];for(let i=0;i<e.length;i++)if(e[i].issues.length===0)o.push(i);if(o.length===1)return t.value=e[o[0]].value,t;if(o.length===0)t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((i)=>i.issues.map((s)=>Be(s,r,Re())))});else t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o});return t}var rf=m("$ZodXor",(e,t)=>{No.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else s.push(c)}if(!i)return Yd(s,r,e,o);return Promise.all(s).then((a)=>Yd(a,r,e,o))}});function Zv(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let o of r)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}var of=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,No.init(e,t);let n=e._zod.parse;W(e,"propValues",(o)=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))s++;for(let[l,u]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,l))_e(i,l,new Set);for(let d of u)i[l].add(d)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),t.options.forEach((o,i)=>{let s=Qn(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let r=Hn(()=>Zv(t));e._zod.parse=(o,i)=>{let s=o.value;if(!ln(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=r.value.get(a);if(c&&(a!==void 0||i.direction!=="backward"))return c._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return n(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter((l)=>r.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),o}}),sf=m("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,l])=>Xd(n,c,l));return Xd(n,i,s)}});function ya(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(bt(e)&&bt(t)){let n=Object.keys(t),r=Object.keys(e).filter((i)=>n.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=ya(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],s=ya(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Xd(e,t,n){let r=new Map,o,i=new Map,s=(l,u)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let g=String(l.path[0]);if(!i.has(g))i.set(g,l);d=[g]}else return!1;for(let g of d){if(!r.has(g))r.set(g,{});r.get(g)[u]=!0}return!0};for(let l of t.issues)if(!s(l,"l"))e.issues.push(l);for(let l of n.issues)if(!s(l,"r"))e.issues.push(l);let a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter((u)=>o.keys.includes(u)):[];if(l.length)e.issues.push({...o,keys:l});for(let u of a)if(!l.includes(u)&&i.has(u))e.issues.push(i.get(u))}let c=ya(t.value,n.value);if(!c.valid){if(Ve(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Sa=m("$ZodTuple",(e,t)=>{F.init(e,t);let n=t.items,r=je.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=ep(n,"optin"),l=ep(n,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>n.length)o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=Array(n.length),d=t.rest?i?.abortEarly:void 0,g=!1;for(let h=0;h<n.length;h++){let y=n[h]._zod.run({value:s[h],issues:[]},i);if(y instanceof Promise)a.push(y.then((S)=>{u[h]=S}));else if(u[h]=y,d&&!g&&y.issues.length)g=Ve(y)}if(t.rest&&!g){let h=n.length-1,y=s.slice(n.length),S=o.issues.length;for(let R of y){if(d&&o.issues.length!==S){if(Ve(o,S))break;S=o.issues.length}h++;let N=t.rest._zod.run({value:R,issues:[]},i);if(N instanceof Promise)a.push(N.then((q)=>tp(q,o,h)));else tp(N,o,h)}}if(a.length)return Promise.all(a).then(()=>np(u,o,n,s,l));return np(u,o,n,s,l)}});function ep(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function tp(e,t,n){if(e.issues.length)t.issues.push(...Ue(n,e.issues));t.value[n]=e.value}function np(e,t,n,r,o){for(let i=0;i<n.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...Ue(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length;i--)if(n[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var af=m("$ZodRecord",(e,t)=>{F.init(e,t);let n=je.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!bt(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let c=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){if(c.add(typeof u==="number"?u.toString():u),u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((y)=>Be(y,o,Re())),input:u,path:[u],inst:e});continue}let g=d.value;if(g==="__proto__")continue;let h=t.valueType._zod.run({value:i[u],issues:[]},o);if(h instanceof Promise)s.push(h.then((y)=>{if(y.issues.length)r.issues.push(...Ue(u,y.issues));r.value[g]=y.value}));else{if(h.issues.length)r.issues.push(...Ue(u,h.issues));r.value[g]=h.value}}let l;for(let u in i)if(!c.has(u))if(t.mode==="loose"){if(u==="__proto__")continue;r.value[u]=i[u]}else l=l??[],l.push(u);if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&Bt.test(l)&&u.issues.length){let y=t.keyType._zod.run({value:Number(l),issues:[]},o);if(y instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(y.issues.length===0)u=y}if(u.issues.length){if(t.mode==="loose")r.value[l]=i[l];else if(a)c=c??[],c.push(l);else r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((y)=>Be(y,o,Re())),input:l,path:[l],inst:e});continue}let g=u.value;if(g==="__proto__")continue;let h=t.valueType._zod.run({value:i[l],issues:[]},o);if(h instanceof Promise)s.push(h.then((y)=>{if(y.issues.length)r.issues.push(...Ue(l,y.issues));r.value[g]=y.value}));else{if(h.issues.length)r.issues.push(...Ue(l,h.issues));r.value[g]=h.value}}if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}if(s.length)return Promise.all(s).then(()=>r);return r}}),cf=m("$ZodMap",(e,t)=>{F.init(e,t);let n=je.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let s=[];r.value=n?n.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,c=r.issues.length;for(let[l,u]of i){if(a&&r.issues.length!==c){if(Ve(r,c))break;c=r.issues.length}let d=t.keyType._zod.run({value:l,issues:[]},o),g=t.valueType._zod.run({value:u,issues:[]},o);if(d instanceof Promise||g instanceof Promise)s.push(Promise.all([d,g]).then(([h,y])=>{rp(h,y,r,l,i,e,o)}));else rp(d,g,r,l,i,e,o)}if(s.length)return Promise.all(s).then(()=>r);return r}});function rp(e,t,n,r,o,i,s){if(e.issues.length)if(fo.has(typeof r))n.issues.push(...Ue(r,e.issues));else n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map((a)=>Be(a,s,Re()))});if(t.issues.length)if(fo.has(typeof r))n.issues.push(...Ue(r,t.issues));else n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map((a)=>Be(a,s,Re()))});n.value.set(e.value,t.value)}var lf=m("$ZodSet",(e,t)=>{F.init(e,t);let n=je.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let s=[];r.value=n?n.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,c=r.issues.length;for(let l of i){if(a&&r.issues.length!==c){if(Ve(r,c))break;c=r.issues.length}let u=t.valueType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>op(d,r)));else op(u,r)}if(s.length)return Promise.all(s).then(()=>r);return r}});function op(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var uf=m("$ZodEnum",(e,t)=>{F.init(e,t);let n=Wn(t.entries),r=new Set(n);e._zod.values=r,W(e,"pattern",(o)=>{let i=Wn(o.def.entries).filter((s)=>fo.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>et(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),df=m("$ZodLiteral",(e,t)=>{F.init(e,t);let n=new Set(t.values);e._zod.values=n,W(e,"pattern",(r)=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?et(i):i?et(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;if(n.has(i))return r;return r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),pf=m("$ZodFile",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(o instanceof File)return n;return n.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),n}}),ff=m("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.optin="optional",je.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new un(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(n.value=s,n));if(o instanceof Promise)throw new lt;return n.value=o,n}});function ip(e,t){return e.value=t.issues.length?void 0:t.value,e}var Ia=m("$ZodOptional",(e,t)=>{F.init(e,t),W(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",W(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),W(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Et(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>ip(n,i));return ip(n,o)}return t.innerType._zod.run(n,r)}}),mf=m("$ZodExactOptional",(e,t)=>{Ia.init(e,t),W(e,"values",(n)=>n.def.innerType._zod.values),W(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),gf=m("$ZodNullable",(e,t)=>{F.init(e,t),W(e,"optin",(n)=>n.def.innerType._zod.optin),W(e,"optout",(n)=>n.def.innerType._zod.optout),W(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Et(r.source)}|null)$`):void 0}),W(e,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>{if(n.value===null)return n;return t.innerType._zod.run(n,r)}}),hf=m("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="defaulted",W(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>sp(i,t));return sp(o,t)}});function sp(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var yf=m("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="defaulted",W(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,r)}}),bf=m("$ZodNonOptional",(e,t)=>{F.init(e,t),W(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>ap(i,e));return ap(o,e)}});function ap(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var wf=m("$ZodSuccess",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new un("ZodSuccess");let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>(n.value=i.issues.length===0,n));return n.value=o.issues.length===0,n}});function cp(e,t,n,r){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>Be(o,r,Re()))},input:e.value}),e}var vf=m("$ZodCatch",(e,t)=>{F.init(e,t),W(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),W(e,"optout",(n)=>n.def.innerType._zod.optout),W(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>cp(n,i,t,r));return cp(n,o,t,r)}}),xf=m("$ZodNaN",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{if(typeof n.value!=="number"||!Number.isNaN(n.value))return n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n;return n}}),Ca=m("$ZodPipe",(e,t)=>{F.init(e,t),W(e,"values",(n)=>n.def.in._zod.values),W(e,"optin",(n)=>n.def.in._zod.optin),W(e,"optout",(n)=>n.def.out._zod.optout),W(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);if(i instanceof Promise)return i.then((s)=>jo(s,t.in,r));return jo(i,t.in,r)}let o=t.in._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>jo(i,t.out,r));return jo(o,t.out,r)}});function jo(e,t,n){if(e.issues.some((r)=>r.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var zo=m("$ZodCodec",(e,t)=>{F.init(e,t),W(e,"values",(n)=>n.def.in._zod.values),W(e,"optin",(n)=>n.def.in._zod.optin),W(e,"optout",(n)=>n.def.out._zod.optout),W(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){let i=t.in._zod.run(n,r);if(i instanceof Promise)return i.then((s)=>_o(s,t,r));return _o(i,t,r)}else{let i=t.out._zod.run(n,r);if(i instanceof Promise)return i.then((s)=>_o(s,t,r));return _o(i,t,r)}}});function _o(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let o=t.transform(e.value,e);if(o instanceof Promise)return o.then((i)=>Ro(e,i,t.out,n));return Ro(e,o,t.out,n)}else{let o=t.reverseTransform(e.value,e);if(o instanceof Promise)return o.then((i)=>Ro(e,i,t.in,n));return Ro(e,o,t.in,n)}}function Ro(e,t,n,r){if(e.issues.length)return e.aborted=!0,e;return n._zod.run({value:t,issues:e.issues},r)}var kf=m("$ZodPreprocess",(e,t)=>{Ca.init(e,t)}),Sf=m("$ZodReadonly",(e,t)=>{F.init(e,t),W(e,"propValues",(n)=>n.def.innerType._zod.propValues),W(e,"values",(n)=>n.def.innerType._zod.values),W(e,"optin",(n)=>n.def.innerType?._zod?.optin),W(e,"optout",(n)=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then(lp);return lp(o)}});function lp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}function Jv(e){let t=e._zod.def,n=t.pattern,r=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let c=a._zod.def;if(c.pattern)n=c.pattern;r||(r=!!c.format?.includes("int"));let l=c.minimum??c.length,u=c.maximum??c.length;if(l!==void 0&&(o===void 0||l>o))o=l;if(u!==void 0&&(i===void 0||u<i))i=u}if(n)return n.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return oa({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===Bt?nr:s)?.source}function ba(e){let t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=ba(r);if(n&&o&&i&&i!==o)return n.replace(Et(o),()=>Et(i));return n}if(t.options){let o=t.options.map(ba);if(o.every(Boolean))return`^(${o.map((i)=>Et(i)).join("|")})$`}return Jv(e)}var If=m("$ZodTemplateLiteral",(e,t)=>{F.init(e,t);let n=[];for(let r of t.parts)if(typeof r==="object"&&r!==null){let o=ba(r);if(!o)throw Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(Et(o))}else if(r===null||nd.has(typeof r))n.push(et(`${r}`));else throw Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,o)=>{if(typeof r.value!=="string")return r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(r.value))return r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r;return r}}),Cf=m("$ZodFunction",(e,t)=>(F.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?Os(e._def.input,r):r,i=Reflect.apply(n,this,o);if(e._def.output)return Os(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await js(e._def.input,r):r,i=await Reflect.apply(n,this,o);if(e._def.output)return await js(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n;if(e._def.output&&e._def.output._zod.def.type==="promise")n.value=e.implementAsync(n.value);else n.value=e.implement(n.value);return n},e.input=(...n)=>{let r=e.constructor;if(Array.isArray(n[0]))return new r({type:"function",input:new Sa({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output});return new r({type:"function",input:n[0],output:e._def.output})},e.output=(n)=>new e.constructor({type:"function",input:e._def.input,output:n}),e)),Ef=m("$ZodPromise",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then((o)=>t.innerType._zod.run({value:o,issues:[]},r))}),Of=m("$ZodLazy",(e,t)=>{F.init(e,t),Hu(e._zod,"innerType",()=>{let n=t;if(!n._cachedInner)n._cachedInner=t.getter();return n._cachedInner}),W(e,"pattern",(n)=>n.innerType?._zod?.pattern),W(e,"propValues",(n)=>n.innerType?._zod?.propValues),W(e,"optin",(n)=>n.innerType?._zod?.optin??void 0),W(e,"optout",(n)=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),jf=m("$ZodCustom",(e,t)=>{ue.init(e,t),F.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=(n)=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then((i)=>up(i,n,r,e));up(o,n,r,e);return}});function up(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)o.params=r._zod.def.params;t.issues.push(Jt(o))}}class Rf extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Oa="~memo",_f=[];function Af(e){return e!==null&&typeof e==="object"}function Ea(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Pf=new WeakMap,sr=0,Vo=1,ar=2;function Lo(e,t,n){let r=Pf.get(e);if(r!==void 0)return r?ar:sr;if(t.has(e))return ar;t.add(e);let o=sr,i=(u)=>{if(o!==ar&&u?._zod){let d=Lo(u,t,n);if(d>o)o=d}},s=(u,d)=>{let g=sr;for(let h of Reflect.ownKeys(u)){let y=Object.getOwnPropertyDescriptor(u,h);if(d&&!y.enumerable)continue;let S=y.get?Vo:y.value?._zod?Lo(y.value,t,n):sr;if(S>g)g=S}return g},a=(u)=>{if(u>o)o=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=Qn(c);a(u?s(u,!0):Vo),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let u of c.items)i(u);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let u of c.options)i(u);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let u=c._cachedInner??(n?e._zod.innerType:void 0);a(u?Lo(u,t,!1):Vo);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in c){let d=Object.getOwnPropertyDescriptor(c,u);if(!d||d.get)continue;let g=d.value;if(!g||typeof g!=="object")continue;if(g._zod)i(g);else if(Array.isArray(g))for(let h of g)i(h)}}return t.delete(e),Bv(e,o)}function Bv(e,t){if(t!==Vo)Pf.set(e,t===ar);return t}function Kv(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var Do,qo=[],Wv={alloc(e,t,n){let r=Do;if(!r)return n;Do=void 0;let o={value:n,issues:null};return r.set(t.value,o),qo.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&Gv(i,o.value))throw new Rf;return n(o,i)};if(e._zod.parse=r,e._zod.run===n)e._zod.run=r})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(n===void 0){let N=Lo(e,new Set,!1);if(N===sr){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(N===ar||r)n=!0;else r=!0}let u=c.value;if(!Af(u))return s(c,l);let d=l[Oa];if(!d)d={buckets:new WeakMap,backEdges:void 0},l[Oa]=d;let g;if(o===l)g=i;else g=Kv(d,e),o=l,i=g;let h=g.get(u);if(h){if(c.value=h.value,h.issues){if(h.issues.length)c.issues.push(...Ea(h.issues))}else c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(h.value);return c}Do=g;let y=qo.length,S=s(c,l);Do=void 0;let R=qo.length>y?qo.pop():void 0;if(S instanceof Promise)return S.then((N)=>{if(R)R.issues=N.issues.length?Ea(N.issues):_f;return N});if(R)R.issues=S.issues.length?Ea(S.issues):_f;return S};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function Tf(){return Wv}function Gv(e,t){let n=e[Oa]?.backEdges;return n!==void 0&&Af(t)&&n.has(t)}var Hv=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return r[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=ad(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${xs(i.values[0])}`;return`Invalid option: expected one of ${ys(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);if(a)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${ys(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((a)=>`'${a}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function ja(){return{localeError:Hv()}}var $f;class Nf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Qv(){return new Nf}($f=globalThis).__zod_globalRegistry??($f.__zod_globalRegistry=Qv());var Le=globalThis.__zod_globalRegistry;function zf(e){if(e.checks)e.checks=[...e.checks];return e}function Df(e,t){return new e(zf({type:"string",...O(t)}))}function _a(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function Ra(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function Aa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Pa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Ta(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function $a(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function Mo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function Na(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function za(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function Da(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function qa(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Va(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function La(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function Ma(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Fa(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Za(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function qf(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...O(t)})}function Ja(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function Ua(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function Ba(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function Ka(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function Wa(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function Vf(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...O(t)})}function Lf(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...O(t)})}function Ga(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function Fo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function Zo(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function Jo(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function Uo(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function Mf(e,t){return new e(zf({type:"number",checks:[],...O(t)}))}function Ff(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function Zf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...O(t)})}function Jf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...O(t)})}function Uf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...O(t)})}function Bf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...O(t)})}function Kf(e,t){return new e({type:"boolean",...O(t)})}function Wf(e,t){return new e({type:"bigint",...O(t)})}function Gf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...O(t)})}function Hf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...O(t)})}function Qf(e,t){return new e({type:"symbol",...O(t)})}function Yf(e,t){return new e({type:"undefined",...O(t)})}function Xf(e,t){return new e({type:"null",...O(t)})}function em(e){return new e({type:"any"})}function tm(e){return new e({type:"unknown"})}function nm(e,t){return new e({type:"never",...O(t)})}function rm(e,t){return new e({type:"void",...O(t)})}function om(e,t){return new e({type:"date",...O(t)})}function im(e,t){return new e({type:"nan",...O(t)})}function jt(e,t){return new ma({check:"less_than",...O(t),value:e,inclusive:!1})}function tt(e,t){return new ma({check:"less_than",...O(t),value:e,inclusive:!0})}function _t(e,t){return new ga({check:"greater_than",...O(t),value:e,inclusive:!1})}function nt(e,t){return new ga({check:"greater_than",...O(t),value:e,inclusive:!0})}function sm(e){return _t(0,e)}function am(e){return jt(0,e)}function cm(e){return tt(0,e)}function lm(e){return nt(0,e)}function pn(e,t){return new jd({check:"multiple_of",...O(t),value:e})}function fn(e,t){return new Ad({check:"max_size",...O(t),maximum:e})}function Rt(e,t){return new Pd({check:"min_size",...O(t),minimum:e})}function cr(e,t){return new Td({check:"size_equals",...O(t),size:e})}function lr(e,t){return new $d({check:"max_length",...O(t),maximum:e})}function Kt(e,t){return new Nd({check:"min_length",...O(t),minimum:e})}function ur(e,t){return new zd({check:"length_equals",...O(t),length:e})}function Bo(e,t){return new Dd({check:"string_format",format:"regex",...O(t),pattern:e})}function Ko(e){return new qd({check:"string_format",format:"lowercase",...O(e)})}function Wo(e){return new Vd({check:"string_format",format:"uppercase",...O(e)})}function Go(e,t){return new Ld({check:"string_format",format:"includes",...O(t),includes:e})}function Ho(e,t){return new Md({check:"string_format",format:"starts_with",...O(t),prefix:e})}function Qo(e,t){return new Fd({check:"string_format",format:"ends_with",...O(t),suffix:e})}function um(e,t,n){return new Zd({check:"property",property:e,schema:t,...O(n)})}function Yo(e,t){return new Jd({check:"properties",shape:e,...O(t)})}function Xo(e,t){return new Ud({check:"mime_type",mime:e,...O(t)})}function wt(e){return new Bd({check:"overwrite",tx:e})}function ei(e){return wt((t)=>t.normalize(e))}function ti(){return wt((e)=>e.trim())}function ni(){return wt((e)=>e.toLowerCase())}function ri(){return wt((e)=>e.toUpperCase())}function oi(){return wt((e)=>ed(e))}function dm(e,t,n){return new e({type:"array",element:t,...O(n)})}function pm(e,t){return new e({type:"file",...O(t)})}function fm(e,t,n){let r=O(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function mm(e,t,n){return new e({type:"custom",check:"custom",fn:t,...O(n)})}function gm(e,t){let n=Xv((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Jt(o,r.value,n._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Jt(i))}},e(r.value,r)),t);return n}function Xv(e,t){let n=new ue({check:"custom",...O(t)});return n._zod.check=e,n}function hm(e){let t=new ue({check:"describe"});return t._zod.onattach=[(n)=>{let r=Le.get(n)??{};Le.add(n,{...r,description:e})}],t._zod.check=()=>{},t}function ym(e){let t=new ue({check:"meta"});return t._zod.onattach=[(n)=>{let r=Le.get(n)??{};Le.add(n,{...r,...e})}],t._zod.check=()=>{},t}function bm(e,t){let n=O(t),r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];if(n.case!=="sensitive")r=r.map((h)=>typeof h==="string"?h.toLowerCase():h),o=o.map((h)=>typeof h==="string"?h.toLowerCase():h);let i=new Set(r),s=new Set(o),a=e.Codec??zo,c=e.Boolean??$o,u=new(e.String??dn)({type:"string",error:n.error}),d=new c({type:"boolean",error:n.error}),g=new a({type:"pipe",in:u,out:d,transform:(h,y)=>{let S=h;if(n.case!=="sensitive")S=S.toLowerCase();if(i.has(S))return!0;else if(s.has(S))return!1;else return y.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:y.value,inst:g,continue:!1}),{}},reverseTransform:(h,y)=>{if(h===!0)return r[0]||"true";else return o[0]||"false"},error:n.error});return g._zod.bag.truthy=r,g._zod.bag.falsy=o,g._zod.bag.case=n.case??"insensitive",g}function mn(e,t,n,r={}){let o=O(r),i={check:"string_format",type:"string",format:t,fn:typeof n==="function"?n:(a)=>n.test(a),...o};if(n instanceof RegExp)i.pattern=n;return new e(i)}function dr(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,r))_e(e,r,n[r]);return e}function fr(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Le,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ce(e,t,n,r,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(n,i),!0}function de(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,n.schemaPath.includes(e))i.cycle=n.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,u);else{let g=s.schema,h=t.processors[o.type];if(!h)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,t,g,u)}let d=e._zod.parent;if(d){if(!s.ref)s.ref=d;de(d,t,u),t.seen.get(d).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)dr(s.schema,c);if(t.io==="input"&&$e(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function wm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function mr(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,g=e.external.uri??((y)=>y);if(d)return{ref:g(d)};let h=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=h,{defId:h,ref:`${g("__shared")}#/${a}/${wm(h)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+wm(u)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=o(s);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
59
59
|
|
|
60
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(n===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(n!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function gm(e){let n=e.anyOf;if(!Array.isArray(n)||n.length===0||e.type!==void 0)return;let t=[];for(let r of n){if(!r||typeof r!=="object")return;gm(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!t.includes(s))t.push(s)}}delete e.anyOf,e.type=t.length===1?t[0]:t}var hm=new Set(["type","properties","required","additionalProperties"]),fm=["oneOf","anyOf"];function mm(e){let n=e.additionalProperties;if(n===void 0||n===!1||typeof n!=="object"||n===null)return null;return Object.keys(n).length?n:null}function Ja(e){let n=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!hm.has(s))return null;n.push(i)}let t={},r=new Set;for(let i of n){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(t,s))continue;let a=[];for(let l of n){let u=l.properties?.[s]??mm(l);if(u===null||u===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(u)))a.push(u)}let c=a.length===1?a[0]:Ja(a)??{allOf:a};_e(t,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:t};if(r.size)o.required=[...r];if(n.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of n){let a=mm(s);if(a&&!i.some((c)=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function Zv(e){let n=e.allOf;if(!Array.isArray(n)||n.length<2)return;for(let o of hm)if(o in e)return;let t=n.filter((o)=>fm.some((i)=>Array.isArray(o[i]))),r=null;if(!t.length)r=Ja(n);else{let o=t[0],i=fm.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=n.filter((c)=>c!==o),a=o[i].map((c)=>Ja([...s,c]));if(a.some((c)=>!c))return;r={[i]:a}}if(!r)return;delete e.allOf,lr(e,r)}function fr(e,n){let t=e.seen.get(n);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){r(d);let h=e.seen.get(d),y=h.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(y);else lr(l,y);if(lr(l,u),a._zod.parent===d)for(let R in l){if(R==="$ref"||R==="allOf")continue;if(!(R in u))delete l[R]}if(y.$ref&&h.def)for(let R in l){if(R==="$ref"||R==="allOf")continue;if(R in h.def&&JSON.stringify(l[R])===JSON.stringify(h.def[R]))delete l[R]}}let g=a._zod.parent;if(g&&g!==d){r(g);let h=e.seen.get(g);if(h?.schema.$ref){if(l.$ref=h.schema.$ref,h.def)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(y in h.def&&JSON.stringify(l[y])===JSON.stringify(h.def[y]))delete l[y]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())gm(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);if(d)d.push(l);else a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])Zv(l)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(n)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}lr(o,t.defId?t.schema:t.def??t.schema);let i=e.metadataRegistry.get(n)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;_e(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...n["~standard"],jsonSchema:{input:ur(n,"input",e.processors),output:ur(n,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function Te(e,n){let t=n??{seen:new Set};if(t.seen.has(e))return!1;t.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Te(r.element,t);if(r.type==="set")return Te(r.valueType,t);if(r.type==="lazy")return Te(r.getter(),t);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return Te(r.innerType,t);if(r.type==="intersection")return Te(r.left,t)||Te(r.right,t);if(r.type==="record"||r.type==="map")return Te(r.keyType,t)||Te(r.valueType,t);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Te(r.in,t)||Te(r.out,t)}if(r.type==="object"){for(let o in r.shape)if(Te(r.shape[o],t))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(Te(o,t))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(Te(o,t))return!0;if(r.rest&&Te(r.rest,t))return!0;return!1}return!1}var ym=(e,n={})=>(t)=>{let r=dr({...t,processors:n});return ue(e,r),pr(r,e),fr(r,e)},ur=(e,n,t={})=>(r)=>{let{libraryOptions:o,target:i}=r??{},s=dr({...o??{},target:i,io:n,processors:t});return ue(e,s),pr(s,e),fr(s,e)};var mt=(e,n,t)=>{if(e[n]===void 0||t>e[n])e[n]=t},gt=(e,n,t)=>{if(e[n]===void 0||t<e[n])e[n]=t},bm=(e,n)=>{mt(e,"minimum",n),gt(e,"maximum",n)},Sm=(e,n)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(n))e.multipleOf.push(n)},Im=(e,n)=>{e.patterns??(e.patterns=new Set),e.patterns.add(n)},Cm=(e,n)=>{e.mime=e.mime?e.mime.filter((t)=>n.includes(t)):[...n]},Em=(e,n)=>{if(e.format=n,n.includes("int"))e.isInt=!0},wm=(e,n)=>mt(e,"minimum",n.minimum),vm=(e,n)=>gt(e,"maximum",n.maximum),xm=(e)=>(n,t)=>{Em(n,t.format);let[r,o]=e[t.format];mt(n,"minimum",r),gt(n,"maximum",o)},Jv={greater_than:(e,n)=>mt(e,n.inclusive?"minimum":"exclusiveMinimum",n.value),less_than:(e,n)=>gt(e,n.inclusive?"maximum":"exclusiveMaximum",n.value),multiple_of:(e,n)=>Sm(e,n.value),number_format:xm(lo),bigint_format:xm(uo),min_length:wm,max_length:vm,length_equals:(e,n)=>bm(e,n.length),min_size:wm,max_size:vm,size_equals:(e,n)=>bm(e,n.size),string_format:(e,n)=>{if(Em(e,n.format),n.pattern)Im(e,n.pattern);if(n.format==="base64"||n.format==="base64url")e.contentEncoding=n.format;if(n.local||n.precision===-1)e.laxFormat=!0},mime_type:(e,n)=>Cm(e,n.mime)};function Se(e){let n={},t=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...t.checks??[]]:t.checks??[];for(let i of r)Jv[i._zod.def.check]?.(n,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)mt(n,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)mt(n,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)gt(n,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)gt(n,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Sm(n,o.multipleOf);if(o.format!==void 0){if(n.format??(n.format=o.format),o.format.includes("int"))n.isInt=!0}if(o.mime)Cm(n,o.mime);for(let i of o.patterns??[])Im(n,i);return n}var Uv={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Bv=new Map([[ma,Fs],[_o,Zs]]),Om=(e)=>Bv.get(e)??e,Ka=(e,n,t,r)=>{let o=t;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Se(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=Uv[a]??a,o.format==="")delete o.format;if(a==="time"||u)delete o.format}if(l)o.contentEncoding=l;if(c&&c.size>0){let d=[...c].map(Om);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((g)=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))]}},Wa=(e,n,t,r)=>{let o=t,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Se(e);o.type=u?"integer":"number";let d=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),g=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),h=n.target==="draft-04"||n.target==="openapi-3.0";if(d)if(h)o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;else if(typeof i==="number")o.minimum=i;if(g)if(h)o.maximum=c,o.exclusiveMaximum=!0;else o.exclusiveMaximum=c;else if(typeof s==="number")o.maximum=s;if(a){let y=new Set;for(let N of a)if(Number.isFinite(N)&&N!==0)y.add(Math.abs(N));else Ce(e,n,o,r,`A multipleOf divisor of ${N} cannot be represented in JSON Schema`);let[S,...R]=y;if(S!==void 0)o.multipleOf=S;if(R.length)o.allOf=[...o.allOf??[],...R.map((N)=>({multipleOf:N}))]}},Ga=(e,n,t,r)=>{t.type="boolean"},Ha=(e,n,t,r)=>{Ce(e,n,t,r,"BigInt cannot be represented in JSON Schema")},Qa=(e,n,t,r)=>{Ce(e,n,t,r,"Symbols cannot be represented in JSON Schema")},Ya=(e,n,t,r)=>{if(n.target==="openapi-3.0")t.type="string",t.nullable=!0,t.enum=[null];else t.type="null"},Xa=(e,n,t,r)=>{Ce(e,n,t,r,"Undefined cannot be represented in JSON Schema")},ec=(e,n,t,r)=>{Ce(e,n,t,r,"Void cannot be represented in JSON Schema")},nc=(e,n,t,r)=>{t.not={}},tc=(e,n,t,r)=>{},rc=(e,n,t,r)=>{},oc=(e,n,t,r)=>{Ce(e,n,t,r,"Date cannot be represented in JSON Schema")},ic=(e,n,t,r)=>{let o=e._zod.def,i=Bt(o.entries);if(i.length===0){t.not={};return}if(i.every((s)=>typeof s==="number"))t.type="number";if(i.every((s)=>typeof s==="string"))t.type="string";t.enum=i},sc=(e,n,t,r)=>{let o=e._zod.def;if(o.values.length===0){t.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(Ce(e,n,t,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(Ce(e,n,t,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(t.type=s===null?"null":typeof s,n.target==="draft-04"||n.target==="openapi-3.0")t.enum=[s];else t.const=s}else{if(i.every((s)=>typeof s==="number"))t.type="number";if(i.every((s)=>typeof s==="string"))t.type="string";if(i.every((s)=>typeof s==="boolean"))t.type="boolean";if(i.every((s)=>s===null))t.type="null";t.enum=i}},ac=(e,n,t,r)=>{Ce(e,n,t,r,"NaN cannot be represented in JSON Schema")},cc=(e,n,t,r)=>{let o=t,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},lc=(e,n,t,r)=>{let o=t;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=Se(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!a)return;if(a.length===0)o.not={};else if(a.length===1)o.contentMediaType=a[0];else o.anyOf=a.map((c)=>({contentMediaType:c}))},uc=(e,n,t,r)=>{t.type="boolean"},dc=(e,n,t,r)=>{Ce(e,n,t,r,"Custom types cannot be represented in JSON Schema")},pc=(e,n,t,r)=>{Ce(e,n,t,r,"Function types cannot be represented in JSON Schema")},fc=(e,n,t,r)=>{Ce(e,n,t,r,"Transforms cannot be represented in JSON Schema")},mc=(e,n,t,r)=>{Ce(e,n,t,r,"Map cannot be represented in JSON Schema")},gc=(e,n,t,r)=>{Ce(e,n,t,r,"Set cannot be represented in JSON Schema")},hc=(e,n,t,r)=>{let o=t,i=e._zod.def,{minimum:s,maximum:a}=Se(e);if(typeof s==="number")o.minItems=s;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=ue(i.element,n,{...r,path:[...r.path,"items"]})};function mr(e){let n=e._zod.def;if(n.type==="pipe"&&n.in._zod.traits.has("$ZodTransform"))return mr(n.out);if(n.type==="catch")return mr(n.innerType);return e._zod.optin}var yc=(e,n,t,r)=>{let o=t,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Ce(e,n,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)_e(o.properties,l,ue(s[l],n,{...r,path:[...r.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let u=i.shape[l];if(n.io==="input"?mr(u)===void 0:u._zod.optout===void 0)c.push(l)}if(c.length>0)o.required=c;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(n.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=ue(i.catchall,n,{...r,path:[...r.path,"additionalProperties"]})},ni=(e,n,t,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>ue(a,n,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));if(i)t.oneOf=s;else t.anyOf=s},bc=(e,n,t,r)=>{let o=e._zod.def,i=ue(o.left,n,{...r,path:[...r.path,"allOf",0]}),s=ue(o.right,n,{...r,path:[...r.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];t.allOf=c,n.intersections.push(c)},wc=(e,n,t,r)=>{let o=t,i=e._zod.def;o.type="array";let s=n.target==="draft-2020-12"?"prefixItems":"items",a=n.target==="draft-2020-12"?"items":n.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((S,R)=>ue(S,n,{...r,path:[...r.path,s,R]})),l=i.rest?ue(i.rest,n,{...r,path:[...r.path,a,...n.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;while(u>0){let S=i.items[u-1];if(!(n.io==="input"?mr(S)!==void 0:S._zod.optout==="optional"))break;u--}let d=i.items.length,g=!i.rest;if(n.target==="draft-2020-12"){if(o.prefixItems=c,g)o.items=!1;else if(l)o.items=l;if(u>0)o.minItems=u;if(g)o.maxItems=d}else if(n.target==="openapi-3.0"){if(o.items={anyOf:c},l)o.items.anyOf.push(l);if(u>0)o.minItems=u;if(g)o.maxItems=d}else{if(o.items=c,g)o.additionalItems=!1;else if(l)o.additionalItems=l;if(u>0)o.minItems=u;if(g)o.maxItems=d}let{minimum:h,maximum:y}=Se(e);if(typeof h==="number")o.minItems=h;if(typeof y==="number")o.maxItems=y};function Ua(e,n,t){if(n.$ref){if(t.has(n))return n;t.add(n);let y=e.get(n)?.def;if(!y)return n;let S=Ua(e,y,t);return S===y?n:S}for(let y of["anyOf","oneOf"]){let S=n[y];if(!Array.isArray(S))continue;let R=S.map((N)=>Ua(e,N,t));if(R.some((N,D)=>N!==S[D]))n={...n,[y]:R}}let r=Array.isArray(n.type)?n.type:[n.type],o=!r.includes("string")&&r.some((y)=>y==="number"||y==="integer"),i=n.enum??(n.const!==void 0?[n.const]:void 0);if(!o&&!i?.some((y)=>typeof y==="number"))return n;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:g,...h}=n;if(h.enum)h.enum=h.enum.map((y)=>typeof y==="number"?String(y):y);else if(typeof h.const==="number")h.const=String(h.const);if(!o)return h;if(h.type="string",!i)h.pattern=(r.includes("number")?Un:er).source;return h}var Ba=new WeakMap;function Kv(e){let n=new Map;for(let r of e.seen.values())if(r.def&&!n.has(r.schema))n.set(r.schema,r);let t=new Map;for(let r of Ba.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||t.has(i))continue;let s=Ua(n,i,new Set);if(s!==i)t.set(i,s)}if(!t.size)return;for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&t.get(o.propertyNames);if(i)o.propertyNames=i}}var vc=(e,n,t,r)=>{let o=t,i=e._zod.def;o.type="object";let s=i.keyType,a=Se(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let u=ue(i.valueType,n,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)_e(o.patternProperties,Om(d).source,u)}else{if(n.target==="draft-07"||n.target==="draft-2020-12"){o.propertyNames=ue(i.keyType,n,{...r,path:[...r.path,"propertyNames"]});let u=Ba.get(n);if(!u)u=[],Ba.set(n,u),n.deferred.push(()=>Kv(n));u.push(e)}o.additionalProperties=ue(i.valueType,n,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,l=n.io==="input"&&mr(i.valueType)!==void 0;if(c&&!i.partial&&!l){let u=[...c].filter((d)=>typeof d==="string"||typeof d==="number");if(u.length>0)o.required=u.map(String)}},xc=(e,n,t,r)=>{let o=e._zod.def,i=ue(o.innerType,n,r),s=n.seen.get(e);if(n.target==="openapi-3.0")s.ref=o.innerType,t.nullable=!0;else t.anyOf=[i,{type:"null"}]},kc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},Sc=Symbol();function jm(e,n,t,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return i=!0,null});if(!i)return JSON.parse(s);return Ce(n,t,r,o,"BigInt defaults cannot be represented in JSON Schema"),Sc}var Ic=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType;let s=jm(o.defaultValue,e,n,t,r);if(s!==Sc)t.default=s},Cc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);if(i.ref=o.innerType,n.io!=="input")return;let s=jm(o.defaultValue,e,n,t,r);if(s!==Sc)t._prefault=s},Ec=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{Ce(e,n,t,r,"Dynamic catch values are not supported in JSON Schema");return}t.default=s},Oc=(e,n,t,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=n.io==="input"?i?o.out:o.in:o.out;ue(s,n,r);let a=n.seen.get(e);a.ref=s},jc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType,t.readOnly=!0},_c=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},ti=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},Rc=(e,n,t,r)=>{let o=e._zod.innerType;ue(o,n,r);let i=n.seen.get(e);i.ref=o},km={string:Ka,number:Wa,boolean:Ga,bigint:Ha,symbol:Qa,null:Ya,undefined:Xa,void:ec,never:nc,any:tc,unknown:rc,date:oc,enum:ic,literal:sc,nan:ac,template_literal:cc,file:lc,success:uc,custom:dc,function:pc,transform:fc,map:mc,set:gc,array:hc,object:yc,union:ni,intersection:bc,tuple:wc,record:vc,nullable:xc,nonoptional:kc,default:Ic,prefault:Cc,catch:Ec,pipe:Oc,readonly:jc,promise:_c,optional:ti,lazy:Rc};function ht(e,n){if("_idmap"in e){let r=e,o=dr({...n,processors:km}),i={};for(let c of r._idmap.entries()){let[l,u]=c;ue(u,o)}let s={},a={registry:r,uri:n?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[l,u]=c;pr(o,u),_e(s,l,fr(o,u))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let t=dr({...n,processors:km});return ue(e,t),pr(t,e),fr(t,e)}var _m=new WeakSet([Object.prototype,Error.prototype]);function oi(e,n,t){Object.defineProperty(e,n,{configurable:!0,enumerable:!1,get(){let r=t(this);return Object.defineProperty(this,n,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,n,{value:r,configurable:!0,writable:!0})}})}var Rm=(e,n)=>{ad.init(e,n),e.name="ZodError";let t=Object.getPrototypeOf(e);if(_m.has(t))return;_m.add(t),oi(t,"format",(r)=>(o)=>ld(r,o)),oi(t,"flatten",(r)=>(o)=>cd(r,o)),oi(t,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Kt,2)}),oi(t,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Kt,2)}),Object.defineProperty(t,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},Hv=m("ZodError",Rm),Ke=m("ZodError",Rm,void 0,{Parent:Error});var Am=Qt(Ke),Pm=Yt(Ke),Tm=bo(Ke),$m=wo(Ke),Nm=dd(Ke),zm=pd(Ke),Dm=fd(Ke),qm=md(Ke),Lm=gd(Ke),Vm=hd(Ke),Mm=yd(Ke),Fm=bd(Ke);function Yv(){if(!je.localeError)Re(ka())}function Kn(){if(!je.memoizer)Re({memoizer:Ef()})}var Z=m("ZodType",(e,n)=>(Yv(),V.init(e,n),e.def=n,e.type=n.type,e),{check(...e){let n=this.def;return this.clone(Je(n,{checks:[...n.checks??[],...e.map((t)=>typeof t==="function"?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,n){return ln(this,e,n)},brand(){return this},register(e,n){return e.add(this,n),this},refine(e,n){return this.check(Pg(e,n))},superRefine(e,n){return this.check(Tg(e,n))},overwrite(e){return this.check(wn(e))},optional(){return ii(this)},exactOptional(){return fg(this)},nullable(){return si(this)},nullish(){return ii(si(this))},nonoptional(e){return wg(this,e)},array(){return A(this)},or(e){return Q([this,e])},and(e){return ig(this,e)},transform(e){return Ac(this,nl(e))},default(e){return hg(this,e)},prefault(e){return bg(this,e)},catch(e){return kg(this,e)},pipe(e){return Ac(this,e)},readonly(){return Eg(this)},describe(e){let n=this.clone();return Ve.add(n,{description:e}),n},meta(...e){if(e.length===0)return Ve.get(this);let n=this.clone();return Ve.add(n,e[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...n){return n.length===0?e(this):e(this,...n)},get "~standard"(){return Ht(this,"~standard",{...fa(this),jsonSchema:{input:ur(this,"input"),output:ur(this,"output")}})},set "~standard"(e){yn(this,"~standard",e)},parse:function e(n,t){return Am(this,n,t,{callee:e})},parseAsync:async function e(n,t){return await Pm(this,n,t,{callee:e})},safeParse(e,n){return Tm(this,e,n)},async safeParseAsync(e,n){return $m(this,e,n)},get spa(){return this?.safeParseAsync},set spa(e){yn(this,"spa",e)},validate(e,n){return Ss(this,e,n)},validateAsync(e,n){return Is(this,e,n)},encode:function e(n,t){return Nm(this,n,t,{callee:e})},decode:function e(n,t){return zm(this,n,t,{callee:e})},encodeAsync:async function e(n,t){return await Dm(this,n,t,{callee:e})},decodeAsync:async function e(n,t){return await qm(this,n,t,{callee:e})},safeEncode(e,n){return Lm(this,e,n)},safeDecode(e,n){return Vm(this,e,n)},async safeEncodeAsync(e,n){return Mm(this,e,n)},async safeDecodeAsync(e,n){return Fm(this,e,n)},toJSONSchema(e){return ym(this,{})(e)},get description(){return Ve.get(this)?.description},get _def(){return this._zod.def}}),Pc=m("_ZodString",(e,n)=>{ut.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ka(e,t,r,o)},ho({format:(e)=>Se(e).format??null,minLength:(e)=>Se(e).minimum??null,maxLength:(e)=>Se(e).maximum??null},{regex(...e){return this.check(Fo(...e))},includes(...e){return this.check(Uo(...e))},startsWith(...e){return this.check(Bo(...e))},endsWith(...e){return this.check(Ko(...e))},min(...e){return this.check(Bn(...e))},max(...e){return this.check(ar(...e))},length(...e){return this.check(cr(...e))},nonempty(...e){return this.check(Bn(1,...e))},lowercase(e){return this.check(Zo(e))},uppercase(e){return this.check(Jo(e))},trim(){return this.check(Qo())},normalize(...e){return this.check(Ho(...e))},toLowerCase(){return this.check(Yo())},toUpperCase(){return this.check(Xo())},slugify(){return this.check(ei())}})),Tc=m("ZodString",(e,n)=>{ut.init(e,n),Pc.init(e,n)},{email(e){return this.check(Sa($c,e))},url(e){return this.check(Do(ai,e))},jwt(e){return this.check(Za(Hc,e))},emoji(e){return this.check(_a(zc,e))},guid(e){return this.check(Ia(Nc,e))},uuid(e){return this.check(Ca(vn,e))},uuidv4(e){return this.check(Ea(vn,e))},uuidv6(e){return this.check(Oa(vn,e))},uuidv7(e){return this.check(ja(vn,e))},nanoid(e){return this.check(Ra(Dc,e))},cuid(e){return this.check(Aa(qc,e))},cuid2(e){return this.check(Pa(Lc,e))},ulid(e){return this.check(Ta(Vc,e))},base64(e){return this.check(Va(Kc,e))},base64url(e){return this.check(Ma(Wc,e))},xid(e){return this.check($a(Mc,e))},ksuid(e){return this.check(Na(Fc,e))},ipv4(e){return this.check(za(Zc,e))},ipv6(e){return this.check(Da(Jc,e))},cidrv4(e){return this.check(qa(Uc,e))},cidrv6(e){return this.check(La(Bc,e))},e164(e){return this.check(Fa(Gc,e))},datetime(e){return this.check(qo(yt,e))},date(e){return this.check(Lo(bt,e))},time(e){return this.check(Vo(wt,e))},duration(e){return this.check(Mo(vt,e))}});function j(e){return Rf(Tc,e)}var ae=m("ZodStringFormat",(e,n)=>{se.init(e,n),Pc.init(e,n)}),yt=m("ZodISODateTime",(e,n)=>{bp.init(e,n),ae.init(e,n)}),bt=m("ZodISODate",(e,n)=>{wp.init(e,n),ae.init(e,n)}),wt=m("ZodISOTime",(e,n)=>{vp.init(e,n),ae.init(e,n)}),vt=m("ZodISODuration",(e,n)=>{xp.init(e,n),ae.init(e,n)}),$c=m("ZodEmail",(e,n)=>{ap.init(e,n),ae.init(e,n)});function Xv(e){return Sa($c,e)}var Nc=m("ZodGUID",(e,n)=>{ip.init(e,n),ae.init(e,n)});function ex(e){return Ia(Nc,e)}var vn=m("ZodUUID",(e,n)=>{sp.init(e,n),ae.init(e,n)});function nx(e){return Ca(vn,e)}function tx(e){return Ea(vn,e)}function rx(e){return Oa(vn,e)}function ox(e){return ja(vn,e)}var ai=m("ZodURL",(e,n)=>{up.init(e,n),ae.init(e,n)});function ix(e){return Do(ai,e)}function sx(e){return Do(ai,{protocol:Xt,hostname:Us,...C(e)})}var zc=m("ZodEmoji",(e,n)=>{dp.init(e,n),ae.init(e,n)});function ax(e){return _a(zc,e)}var Dc=m("ZodNanoID",(e,n)=>{pp.init(e,n),ae.init(e,n)});function cx(e){return Ra(Dc,e)}var qc=m("ZodCUID",(e,n)=>{fp.init(e,n),ae.init(e,n)});function lx(e){return Aa(qc,e)}var Lc=m("ZodCUID2",(e,n)=>{mp.init(e,n),ae.init(e,n)});function ux(e){return Pa(Lc,e)}var Vc=m("ZodULID",(e,n)=>{gp.init(e,n),ae.init(e,n)});function dx(e){return Ta(Vc,e)}var Mc=m("ZodXID",(e,n)=>{hp.init(e,n),ae.init(e,n)});function px(e){return $a(Mc,e)}var Fc=m("ZodKSUID",(e,n)=>{yp.init(e,n),ae.init(e,n)});function fx(e){return Na(Fc,e)}var Zc=m("ZodIPv4",(e,n)=>{kp.init(e,n),ae.init(e,n)});function mx(e){return za(Zc,e)}var Zm=m("ZodMAC",(e,n)=>{Cp.init(e,n),ae.init(e,n)});function gx(e){return Af(Zm,e)}var Jc=m("ZodIPv6",(e,n)=>{Ip.init(e,n),ae.init(e,n)});function hx(e){return Da(Jc,e)}var Uc=m("ZodCIDRv4",(e,n)=>{Ep.init(e,n),ae.init(e,n)});function yx(e){return qa(Uc,e)}var Bc=m("ZodCIDRv6",(e,n)=>{Op.init(e,n),ae.init(e,n)});function bx(e){return La(Bc,e)}var Kc=m("ZodBase64",(e,n)=>{_p.init(e,n),ae.init(e,n)});function wx(e){return Va(Kc,e)}var Wc=m("ZodBase64URL",(e,n)=>{Rp.init(e,n),ae.init(e,n)});function vx(e){return Ma(Wc,e)}var Gc=m("ZodE164",(e,n)=>{Ap.init(e,n),ae.init(e,n)});function xx(e){return Fa(Gc,e)}var Jm=m("ZodCreditCard",(e,n)=>{Pp.init(e,n),ae.init(e,n)});function kx(e){return Pf(Jm,e)}var Um=m("ZodIBAN",(e,n)=>{Tp.init(e,n),ae.init(e,n)});function Sx(e){return Tf(Um,e)}var Hc=m("ZodJWT",(e,n)=>{$p.init(e,n),ae.init(e,n)});function Ix(e){return Za(Hc,e)}var xt=m("ZodCustomStringFormat",(e,n)=>{Np.init(e,n),ae.init(e,n)});function Cx(e,n,t={}){return ft(xt,e,n,t)}function Ex(e){return ft(xt,"hostname",Js,e)}function Ox(e){return ft(xt,"hex",ia,e)}function jx(e){return ft(xt,"currency_code",Ks,e)}function _x(e,n){let t=n?.enc??"hex",r=`${e}_${t}`,o=jn[r];if(!o)throw Error(`Unrecognized hash format: ${r}`);return ft(xt,r,o,n)}var Qc=m("ZodNumber",(e,n)=>{ga.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Wa(e,t,r,o),e.isFinite=!0},ho({minValue:(e)=>{let{minimum:n,exclusiveMinimum:t}=Se(e);return Math.max(n??Number.NEGATIVE_INFINITY,t??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:n,exclusiveMaximum:t}=Se(e);return Math.min(n??Number.POSITIVE_INFINITY,t??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:n,multipleOf:t}=Se(e);return!!n||!!t?.some(Number.isSafeInteger)},format:(e)=>Se(e).format??null},{gt(e,n){return this.check(Rn(e,n))},gte(e,n){return this.check(tn(e,n))},min(e,n){return this.check(tn(e,n))},lt(e,n){return this.check(_n(e,n))},lte(e,n){return this.check(nn(e,n))},max(e,n){return this.check(nn(e,n))},int(e){return this.check(we(e))},safe(e){return this.check(we(e))},positive(e){return this.check(Rn(0,e))},nonnegative(e){return this.check(tn(0,e))},negative(e){return this.check(_n(0,e))},nonpositive(e){return this.check(nn(0,e))},multipleOf(e,n){return this.check(dt(e,n))},step(e,n){return this.check(dt(e,n))},finite(){return this}}));function ne(e){return $f(Qc,e)}var kt=m("ZodNumberFormat",(e,n)=>{zp.init(e,n),Qc.init(e,n)});function we(e){return Nf(kt,e)}function Rx(e){return zf(kt,e)}function Ax(e){return Df(kt,e)}function Px(e){return qf(kt,e)}function Tx(e){return Lf(kt,e)}var Yc=m("ZodBoolean",(e,n)=>{Ro.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ga(e,t,r,o)});function me(e){return Vf(Yc,e)}var Xc=m("ZodBigInt",(e,n)=>{ha.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ha(e,t,r,o)},ho({minValue:(e)=>Se(e).minimum??null,maxValue:(e)=>Se(e).maximum??null,format:(e)=>Se(e).format??null},{gte(e,n){return this.check(tn(e,n))},min(e,n){return this.check(tn(e,n))},gt(e,n){return this.check(Rn(e,n))},lt(e,n){return this.check(_n(e,n))},lte(e,n){return this.check(nn(e,n))},max(e,n){return this.check(nn(e,n))},positive(e){return this.check(Rn(BigInt(0),e))},negative(e){return this.check(_n(BigInt(0),e))},nonpositive(e){return this.check(nn(BigInt(0),e))},nonnegative(e){return this.check(tn(BigInt(0),e))},multipleOf(e,n){return this.check(dt(e,n))}}));function $x(e){return Mf(Xc,e)}var el=m("ZodBigIntFormat",(e,n)=>{Dp.init(e,n),Xc.init(e,n)});function Nx(e){return Ff(el,e)}function zx(e){return Zf(el,e)}var Bm=m("ZodSymbol",(e,n)=>{qp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Qa(e,t,r,o)});function Dx(e){return Jf(Bm,e)}var Km=m("ZodUndefined",(e,n)=>{Lp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Xa(e,t,r,o)});function qx(e){return Uf(Km,e)}var Wm=m("ZodNull",(e,n)=>{Vp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ya(e,t,r,o)});function Gm(e){return Bf(Wm,e)}var Hm=m("ZodAny",(e,n)=>{Mp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>tc(e,t,r,o)});function Lx(){return Kf(Hm)}var Qm=m("ZodUnknown",(e,n)=>{Fp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>rc(e,t,r,o)});function dn(){return Wf(Qm)}var Ym=m("ZodNever",(e,n)=>{Zp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>nc(e,t,r,o)});function rn(e){return Gf(Ym,e)}var Xm=m("ZodVoid",(e,n)=>{Jp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ec(e,t,r,o)});function Vx(e){return Hf(Xm,e)}var eg=m("ZodDate",(e,n)=>{Up.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>oc(e,t,r,o),e.min=(t,r)=>e.check(tn(t,r)),e.max=(t,r)=>e.check(nn(t,r))},ho({minDate:(e)=>{let{minimum:n}=Se(e);return n?new Date(n):null},maxDate:(e)=>{let{maximum:n}=Se(e);return n?new Date(n):null}},{}));function Mx(e){return Qf(eg,e)}var ng=m("ZodArray",(e,n)=>{Kn(),Bp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>hc(e,t,r,o),e.element=n.element},{min(e,n){return this.check(Bn(e,n))},nonempty(e){return this.check(Bn(1,e))},max(e,n){return this.check(ar(e,n))},length(e,n){return this.check(cr(e,n))},unwrap(){return this.element}});function A(e,n){return om(ng,e,n)}function Fx(e){let n=e._zod.def.shape;return W(Object.keys(n))}var ci=m("ZodObject",(e,n)=>{Kn(),Gp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>yc(e,t,r,o),Tw(e,"shape",(t)=>t._zod.def.shape,!1)},{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Je(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Je(this._zod.def,{catchall:dn()}))},loose(){return this.clone(Je(this._zod.def,{catchall:dn()}))},strict(){return this.clone(Je(this._zod.def,{catchall:rn()}))},strip(){return this.clone(Je(this._zod.def,{catchall:void 0}))},extend(e){return Cw(this,e)},safeExtend(e){return Ew(this,e)},merge(e){return Ow(this,e)},pick(e){return Sw(this,e)},omit(e){return Iw(this,e)},partial(...e){return Yu(ui,this,e[0])},exactPartial(...e){return Yu(tl,this,e[0],"exactPartial")},required(...e){return jw(rl,this,e[0])}});function E(e,n){let t={type:"object",shape:e??{},...C(n)};return new ci(t)}function v(e,n){return new ci({type:"object",shape:e,catchall:rn(),...C(n)})}function Zx(e,n){return new ci({type:"object",shape:e,catchall:dn(),...C(n)})}var li=m("ZodUnion",(e,n)=>{Ao.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ni(e,t,r,o),e.options=n.options});function Q(e,n){return new li({type:"union",options:e,...C(n)})}var tg=m("ZodXor",(e,n)=>{li.init(e,n),Hp.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ni(e,t,r,o),e.options=n.options});function Jx(e,n){return new tg({type:"union",options:e,inclusive:!1,...C(n)})}var rg=m("ZodDiscriminatedUnion",(e,n)=>{li.init(e,n),Qp.init(e,n)});function on(e,n,t){return new rg({type:"union",options:n,discriminator:e,...C(t)})}var og=m("ZodIntersection",(e,n)=>{Yp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>bc(e,t,r,o)});function ig(e,n){return new og({type:"intersection",left:e,right:n})}var sg=m("ZodTuple",(e,n)=>{Kn(),ya.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>wc(e,t,r,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((n)=>new ui({type:"optional",innerType:n}))})}});function ag(e,n,t){let r=n instanceof V,o=r?t:n;return new sg({type:"tuple",items:e,rest:r?n:null,...C(o)})}var hr=m("ZodRecord",(e,n)=>{Kn(),Xp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>vc(e,t,r,o),e.keyType=n.keyType,e.valueType=n.valueType});function re(e,n,t){if(!n||!n._zod)return new hr({type:"record",keyType:j(),valueType:e,...C(n)});return new hr({type:"record",keyType:e,valueType:n,...C(t)})}function Ux(e,n,t){return new hr({type:"record",keyType:e,valueType:n,...C(t),partial:!0})}function Bx(e,n,t){return new hr({type:"record",keyType:e,valueType:n,mode:"loose",...C(t)})}var cg=m("ZodMap",(e,n)=>{Kn(),ef.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>mc(e,t,r,o),e.keyType=n.keyType,e.valueType=n.valueType,e.min=(...t)=>e.check(An(...t)),e.nonempty=(t)=>e.check(An(1,t)),e.max=(...t)=>e.check(pt(...t)),e.size=(...t)=>e.check(sr(...t))});function Kx(e,n,t){return new cg({type:"map",keyType:e,valueType:n,...C(t)})}var lg=m("ZodSet",(e,n)=>{Kn(),nf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>gc(e,t,r,o),e.min=(...t)=>e.check(An(...t)),e.nonempty=(t)=>e.check(An(1,t)),e.max=(...t)=>e.check(pt(...t)),e.size=(...t)=>e.check(sr(...t))});function Wx(e,n){return new lg({type:"set",valueType:e,...C(n)})}var yr=m("ZodEnum",(e,n)=>{tf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(r,o,i)=>ic(e,r,o,i),e.enum=n.entries,e.options=[...e._zod.values];let t=new Set(Object.keys(n.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(t.has(s))i[s]=n.entries[s];else throw Error(`Key ${s} not found in enum`);return new yr({...n,checks:[],...C(o),entries:i})},e.exclude=(r,o)=>{let i={...n.entries};for(let s of r)if(t.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new yr({...n,checks:[],...C(o),entries:i})}});function W(e,n){let t=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new yr({type:"enum",entries:t,...C(n)})}function Gx(e,n){return new yr({type:"enum",entries:e,...C(n)})}var ug=m("ZodLiteral",(e,n)=>{rf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>sc(e,t,r,o),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function w(e,n){return new ug({type:"literal",values:Array.isArray(e)?e:[e],...C(n)})}var dg=m("ZodFile",(e,n)=>{of.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>lc(e,t,r,o),e.min=(t,r)=>e.check(An(t,r)),e.max=(t,r)=>e.check(pt(t,r)),e.mime=(t,r)=>e.check(Go(Array.isArray(t)?t:[t],r))});function Hx(e){return im(dg,e)}var pg=m("ZodTransform",(e,n)=>{Kn(),sf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>fc(e,t,r,o),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new lt(e.constructor.name);t.addIssue=(i)=>{if(typeof i==="string")t.issues.push(Zn(i,t.value,n));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=t.value;s.inst??(s.inst=e),t.issues.push(Zn(s))}};let o=n.transform(t.value,t);if(o instanceof Promise)return o.then((i)=>(t.value=i,t));return t.value=o,t}});function nl(e){return new pg({type:"transform",transform:e})}var ui=m("ZodOptional",(e,n)=>{ba.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ti(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function ii(e){return new ui({type:"optional",innerType:e})}var tl=m("ZodExactOptional",(e,n)=>{af.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ti(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function fg(e){return new tl({type:"optional",innerType:e})}var mg=m("ZodNullable",(e,n)=>{cf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>xc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function si(e){return new mg({type:"nullable",innerType:e})}function Qx(e){return ii(si(e))}var gg=m("ZodDefault",(e,n)=>{lf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ic(e,t,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function hg(e,n){return new gg({type:"default",innerType:e,get defaultValue(){return typeof n==="function"?n():ms(n)}})}var yg=m("ZodPrefault",(e,n)=>{uf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Cc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function bg(e,n){return new yg({type:"prefault",innerType:e,get defaultValue(){return typeof n==="function"?n():ms(n)}})}var rl=m("ZodNonOptional",(e,n)=>{df.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>kc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function wg(e,n){return new rl({type:"nonoptional",innerType:e,...C(n)})}var vg=m("ZodSuccess",(e,n)=>{pf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>uc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Yx(e){return new vg({type:"success",innerType:e})}var xg=m("ZodCatch",(e,n)=>{ff.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ec(e,t,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function kg(e,n){return new xg({type:"catch",innerType:e,catchValue:typeof n==="function"?n:td(n)})}var Sg=m("ZodNaN",(e,n)=>{mf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ac(e,t,r,o)});function Xx(e){return Yf(Sg,e)}var di=m("ZodPipe",(e,n)=>{wa.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Oc(e,t,r,o),e.in=n.in,e.out=n.out});function Ac(e,n){return new di({type:"pipe",in:e,out:n})}var pi=m("ZodCodec",(e,n)=>{di.init(e,n),Po.init(e,n)});function ek(e,n,t){return new pi({type:"pipe",in:e,out:n,transform:t.decode,reverseTransform:t.encode})}function nk(e){let n=e._zod.def;return new pi({type:"pipe",in:n.out,out:n.in,transform:n.reverseTransform,reverseTransform:n.transform})}var Ig=m("ZodPreprocess",(e,n)=>{di.init(e,n),gf.init(e,n)}),Cg=m("ZodReadonly",(e,n)=>{hf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>jc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Eg(e){return new Cg({type:"readonly",innerType:e})}var Og=m("ZodTemplateLiteral",(e,n)=>{yf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>cc(e,t,r,o)});function tk(e,n){return new Og({type:"template_literal",parts:e,...C(n)})}var jg=m("ZodLazy",(e,n)=>{vf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Rc(e,t,r,o),e.unwrap=()=>e._zod.def.getter()});function _g(e){return new jg({type:"lazy",getter:e})}var Rg=m("ZodPromise",(e,n)=>{wf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>_c(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function rk(e){return new Rg({type:"promise",innerType:e})}var Ag=m("ZodFunction",(e,n)=>{bf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>pc(e,t,r,o)});function ok(e){return new Ag({type:"function",input:Array.isArray(e?.input)?ag(e?.input):e?.input??A(dn()),output:e?.output??dn()})}var fi=m("ZodCustom",(e,n)=>{xf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>dc(e,t,r,o)});function ik(e){let n=new le({check:"custom"});return n._zod.check=e,n}function sk(e,n){return sm(fi,e??(()=>!0),n)}function Pg(e,n={}){return am(fi,e,n)}function Tg(e,n){return cm(e,n)}var ak=lm,ck=um,$g=m("ZodInstanceOf",(e,n)=>{fi.init(e,n)},{properties(e,n){return this.check(Wo(e,n))}});function lk(e,n={}){let t=new $g({type:"custom",check:"custom",fn:(r)=>r instanceof e,abort:!0,...C(n)});return t._zod.bag.Class=e,t._zod.check=(r)=>{if(!(r.value instanceof e))r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:t,path:[...t._zod.def.path??[]]})},t}var uk=(...e)=>dm({Codec:pi,Boolean:Yc,String:Tc},...e);function $e(e){let n=_g(()=>Q([j(e),ne(),me(),Gm(),A(n),re(j(),n)]));return n}function Ng(e,n){return new Ig({type:"pipe",in:nl(e),out:n})}function dk(e){return qo(yt,e)}function pk(e){return Lo(bt,e)}function fk(e){return Vo(wt,e)}function mk(e){return Mo(vt,e)}var T={...ol,...ri,iso:br},gk=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function hk(e,n){let t=e.$schema;if(t==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(t==="http://json-schema.org/draft-07/schema#")return"draft-7";if(t==="http://json-schema.org/draft-04/schema#")return"draft-4";return n??"draft-2020-12"}function zg(e,n){return e.map((t,r)=>r<n?t:t.optional())}function yk(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function bk(e,n){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let t=e.slice(1).split("/").filter(Boolean);if(t.length===0)return n.rootSchema;let r=n.version==="draft-2020-12"?"$defs":"definitions";if(t[0]===r){let o=t[1]===void 0?void 0:yk(t[1]);if(!o||!n.defs[o])throw Error(`Reference not found: ${e}`);return n.defs[o]}throw Error(`Reference not found: ${e}`)}function wk(e,n){return T.transform((r)=>r).check((r)=>{let o=r.value;if(typeof o!=="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(n.minProperties!==void 0&&i.length<n.minProperties)r.issues.push({origin:"object",code:"too_small",minimum:n.minProperties,inclusive:!0,message:`Too small: expected object to have >=${n.minProperties} properties`,input:o,inst:e,continue:!0});if(n.maxProperties!==void 0&&i.length>n.maxProperties)r.issues.push({origin:"object",code:"too_big",maximum:n.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${n.maxProperties} properties`,input:o,inst:e,continue:!0});if(n.keySchema)for(let s of i){let a=n.keySchema.safeParse(s);if(a.success)continue;r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function il(e,n){if(e===null)return"z";let t=typeof e;if(t!=="object"){if(t==="number"&&Number.isNaN(e))return null;let r=String(e);return`${t[0]}${r.length}:${r}`}if(n.has(e))return null;n.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=il(s,n);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let s=il(e[i],n);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{n.delete(e)}}var vk=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),xk=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function wr(e){if(typeof e!=="object"||e===null)return!1;if(Array.isArray(e))return e.some(wr);if(typeof e.$ref==="string")return!0;return Object.entries(e).some(([n,t])=>{if(vk.has(n))return wr(t);if(!xk.has(n)||typeof t!=="object"||t===null)return!1;return Object.values(t).some(wr)})}function Dg(e){return e===1?"element":"elements"}function kk(e,n){return T.transform((r)=>r).check((r)=>{let o=r.value;if(!Array.isArray(o))return;if(n.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=il(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(n.containsSchema){let i=n.minContains??1,s=n.maxContains!==void 0?n.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(n.containsSchema.safeParse(c).success&&++a>=s)break;if(a<i)r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Dg(i)}; found ${a}`,input:o,continue:!0});if(n.maxContains!==void 0&&a>n.maxContains)r.issues.push({code:"custom",message:`Array must contain at most ${n.maxContains} matching ${Dg(n.maxContains)}`,input:o,continue:!0})}}).pipe(e)}function qg(e,n){if(e===!1)return;if(e===void 0||e===!0)return T.any();return Ne(e,n)}var Sk=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Lg(e,n){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return T.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(n.refs.has(o))return n.refs.get(o);if(n.processing.has(o))return T.lazy(()=>{if(!n.refs.has(o))throw Error(`Circular reference not resolved: ${o}`);return n.refs.get(o)});n.processing.add(o);let i=bk(o,n),s=Ne(i,n);return n.refs.set(o,s),n.processing.delete(o),s}if(e.enum!==void 0){let o=e.enum;if(n.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return T.null();if(o.length===0)return T.never();if(o.length===1)return T.literal(o[0]);if(o.every((s)=>typeof s==="string"))return T.enum(o);let i=o.map((s)=>T.literal(s));if(i.length<2)return i[0];return T.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return T.literal(e.const);let t=e.type;if(Array.isArray(t)){let o=t.map((i)=>{let s={...e,type:i};return Lg(s,n)});if(o.length===0)return T.never();if(o.length===1)return o[0];return T.union(o)}if(!t)return T.any();let r;switch(t){case"string":{let o=T.string();if(e.format){let i=e.format;if(i==="email")o=o.check(T.email());else if(i==="uri"||i==="uri-reference")o=o.check(T.url());else if(i==="uuid"||i==="guid")o=o.check(T.uuid());else if(i==="date-time")o=o.check(T.iso.datetime({offset:!0}));else if(i==="date")o=o.check(T.iso.date());else if(i==="time")o=o.check(T.regex(Sk));else if(i==="duration")o=o.check(T.iso.duration());else if(i==="hostname")o=o.check(T.hostname());else if(i==="ipv4")o=o.check(T.ipv4());else if(i==="ipv6")o=o.check(T.ipv6());else if(i==="mac")o=o.check(T.mac());else if(i==="cidr")o=o.check(T.cidrv4());else if(i==="cidr-v6")o=o.check(T.cidrv6());else if(i==="base64")o=o.check(T.base64());else if(i==="base64url")o=o.check(T.base64url());else if(i==="e164")o=o.check(T.e164());else if(i==="credit_card")o=o.check(T.creditCard());else if(i==="iban")o=o.check(T.iban());else if(i==="jwt")o=o.check(T.jwt());else if(i==="emoji")o=o.check(T.emoji());else if(i==="nanoid")o=o.check(T.nanoid());else if(i==="cuid")o=o.check(T.cuid());else if(i==="cuid2")o=o.check(T.cuid2());else if(i==="ulid")o=o.check(T.ulid());else if(i==="xid")o=o.check(T.xid());else if(i==="ksuid")o=o.check(T.ksuid())}if(typeof e.minLength==="number")o=o.min(e.minLength);if(typeof e.maxLength==="number")o=o.max(e.maxLength);if(e.pattern)o=o.regex(new RegExp(e.pattern));r=o;break}case"number":case"integer":{let o=t==="integer"?T.number().int():T.number();if(typeof e.minimum==="number"&&e.exclusiveMinimum!==!0)o=o.min(e.minimum);if(typeof e.maximum==="number"&&e.exclusiveMaximum!==!0)o=o.max(e.maximum);if(typeof e.exclusiveMinimum==="number")o=o.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")o=o.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")o=o.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")o=o.lt(e.maximum);if(typeof e.multipleOf==="number")o=o.multipleOf(e.multipleOf);r=o;break}case"boolean":{r=T.boolean();break}case"null":{r=T.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties==="object"?Ne(e.additionalProperties,n):void 0;for(let[d,g]of Object.entries(i)){let h=Ne(g,n);_e(o,d,s.has(d)?h:h.optional())}if(e.patternProperties){let d=e.patternProperties,g=Object.keys(d),h=[];for(let S of g){let R=Ne(d[S],n),N=T.string().regex(new RegExp(S));h.push(T.looseRecord(N,R))}let y=[];if(Object.keys(o).length>0)y.push(T.object(o).passthrough());if(y.push(...h),y.length===0)r=T.object({}).passthrough();else if(y.length===1)r=y[0];else{let S=T.intersection(y[0],y[1]);for(let R=2;R<y.length;R++)S=T.intersection(S,y[R]);r=S}if(e.additionalProperties===!1){let S=Object.keys(o),R=g.map((D)=>new RegExp(D)),N=r;r=r.check((D)=>{if(!bn(D.value))return;let L=[];for(let Oe of Object.keys(D.value)){if(S.includes(Oe))continue;if(R.some((fe)=>fe.test(Oe)))continue;L.push(Oe)}if(L.length)D.issues.push({code:"unrecognized_keys",keys:L,input:D.value,inst:N})})}}else{let d=T.object(o);if(e.additionalProperties===!1)r=d.strict();else if(a)r=d.catchall(a);else r=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties==="number"?e.minProperties:void 0,u=typeof e.maxProperties==="number"?e.maxProperties:void 0;if(c||l!==void 0||u!==void 0){let d;if(c){let g=typeof e.propertyNames==="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Ne(g,n)}r=wk(r,{keySchema:d,minProperties:l,maxProperties:u})}break}case"array":{let{prefixItems:o,items:i}=e;if(o&&Array.isArray(o)){let s=typeof e.minItems==="number"?e.minItems:0,a=o.map((d)=>Ne(d,n)),c=zg(a,s),l=!Array.isArray(i)?qg(i,n):void 0,u=T.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(T.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(T.maxLength(e.maxItems))}else if(Array.isArray(i)){let s=typeof e.minItems==="number"?e.minItems:0,a=i.map((d)=>Ne(d,n)),c=zg(a,s),l=qg(e.additionalItems,n),u=T.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(T.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(T.maxLength(e.maxItems))}else if(i!==void 0){let s=Ne(i,n),a=T.array(s);if(typeof e.minItems==="number")a=a.min(e.minItems);if(typeof e.maxItems==="number")a=a.max(e.maxItems);r=a}else r=T.array(T.any());if(e.uniqueItems===!0||e.contains!==void 0)r=kk(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Ne(e.contains,n):void 0,minContains:typeof e.minContains==="number"?e.minContains:void 0,maxContains:typeof e.maxContains==="number"?e.maxContains:void 0});break}default:throw Error(`Unsupported type: ${t}`)}return r}function Ne(e,n){if(typeof e==="boolean")return e?T.any():T.never();let t=Lg(e,n),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map((l)=>Ne(l,n)),c=T.union(a);t=r?T.intersection(t,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map((l)=>Ne(l,n)),c=T.xor(a);t=r?T.intersection(t,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)t=r?t:T.any();else{let a=r?t:Ne(e.allOf[0],n),c=r?0:1;for(let l=c;l<e.allOf.length;l++)a=T.intersection(a,Ne(e.allOf[l],n));t=a}if(e.nullable===!0&&n.version==="openapi-3.0")t=T.nullable(t);if(e.readOnly===!0)t=T.readonly(t);if(e.default!==void 0)t=t.default(e.default);let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)if(a in e)o[a]=e[a];let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)if(a in e)o[a]=e[a];if(e.type==="object"&&e.$ref===void 0){if(e.propertyNames!==void 0&&!wr(e.propertyNames))o.propertyNames=e.propertyNames;for(let a of["minProperties","maxProperties"])if(e[a]!==void 0)o[a]=e[a]}if(e.type==="array"&&e.$ref===void 0){if(e.contains!==void 0&&!wr(e.contains))o.contains=e.contains;for(let a of["uniqueItems","minContains","maxContains"])if(e[a]!==void 0)o[a]=e[a]}for(let a of Object.keys(e))if(!gk.has(a))_e(o,a,e[a]);if(Object.keys(o).length>0)n.registry.add(t,o);if(e.description)t=t.describe(e.description);return t}function Vg(e,n){if(typeof e==="boolean")return e?T.any():T.never();let t;try{t=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=hk(t,n?.defaultTarget),o=t.$defs||t.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:t,registry:n?.registry??Ve};return Ne(t,i)}var Mg=0;function Pn(){let e=Mg;return Mg+=1,e}function It(e){if(typeof e==="object"&&e!==null&&!Object.isFrozen(e)){for(let n of Object.getOwnPropertyNames(e)){let t=Reflect.get(e,n);It(t)}Object.freeze(e)}return e}function sl(e,n){let t={};for(let r of n)if(r in e)t[r]=e[r];return t}function mi(e){if(typeof e!=="object"||e===null)return e;else if(Array.isArray(e)){let n=[];for(let[t,r]of e.entries())n[t]=mi(r);return n}else{let n={};for(let t in e)n[t]=mi(e[t]);return n}}function St(e,n){if(e===n)return!0;if(e===null)return!1;if(typeof e!=="object")return!1;if(typeof e!==typeof n)return!1;if(Array.isArray(e)){if(!Array.isArray(n))return!1;if(e.length!==n.length)return!1;for(let[t,r]of e.entries())if(!St(r,n[t]))return!1}else{if(Array.isArray(n))return!1;for(let t in e){if(!(t in n))return!1;if(!St(e[t],n[t]))return!1}for(let t in n)if(!(t in e))return!1}return!0}var b=Object.freeze({Equals:0,Containing:1,ContainedBy:2,Rejection:3,Intersection:4}),K=Tn(b.Equals),M=Tn(b.Containing),J=Tn(b.ContainedBy),G=Tn(b.Rejection),X=Tn(b.Intersection),xn=It([[b.Equals,K],[b.Containing,M],[b.ContainedBy,J],[b.Rejection,G],[b.Intersection,X]]),de=0,We=(()=>{let e=de;for(let[n,t]of xn)e|=t;return e})();function vr(e){return!!(e&K)}function xr(e){return!!(e&M)}function kr(e){return!!(e&J)}function Sr(e){return!!(e&G)}function Ir(e){return!!(e&X)}function Tn(e){return 1<<e}function al(e){let n=de,t=0,r={push:(o)=>{if(t===0)n=o;else n=Ik(n,o,e);return t+=1,n}};return Object.defineProperties(r,{result:{get:()=>n},count:{get:()=>t}}),r}function Ik(e,n,t){let r=de;for(let[o,i]of xn)if(i&e){for(let[s,a]of xn)if(a&n){if(r|=t(o,s),r===We)return r}}return r}var he=Object.freeze({Save:0,OneOf:1,AllOf:2,AnyOf:3,Not:4,Swap:5});function Fg(e,n){switch(e){case he.Save:return n[0];case he.OneOf:return Ck(n);case he.AllOf:case he.AnyOf:return Cr(e,n);case he.Not:case he.Swap:return cl(e,n[0])}}function $n(e){return cl(he.Swap,e)}function Ck(e){if(e.length===1)return e[0];let n=Cr(he.AnyOf,e),t=[];for(let i=0;i<e.length;++i)for(let s=i+1;s<e.length;++s){let a=e[i],c=e[s],l=Cr(he.AllOf,[a,c]);t.push(l)}let r=Cr(he.AnyOf,t),o=cl(he.Not,r);return Cr(he.AllOf,[n,o])}function Cr(e,n){if(n.length<0)throw Error("invalid expressions: empty array");let t;switch(e){case he.AllOf:{t=al(Ek);break}case he.AnyOf:{t=al(Ok);break}default:throw Error(`invalid operator ${e}`)}for(let r of n)t.push(r);return t.result}function cl(e,n){let t,r=de;switch(e){case he.Not:{t=jk;break}case he.Swap:{t=_k;break}default:throw Error(`invalid operator ${e}`)}for(let[o,i]of xn)if(i&n)r|=t(o);return r}function Ek(e,n){let t=de;switch(e){case b.Equals:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=K;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=de;break}case b.Intersection:{t=J;break}}break}case b.Containing:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=K|M;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=G;break}case b.Intersection:{t=X|J;break}}break}case b.ContainedBy:{switch(n){case b.Equals:{t=J;break}case b.Containing:{t=J;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=de;break}case b.Intersection:{t=J;break}}break}case b.Rejection:{switch(n){case b.Equals:{t=de;break}case b.Containing:{t=G;break}case b.ContainedBy:{t=de;break}case b.Rejection:{t=G;break}case b.Intersection:{t=G;break}}break}case b.Intersection:{switch(n){case b.Equals:{t=J;break}case b.Containing:{t=X|J;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=G;break}case b.Intersection:{t=J|G|X;break}}break}}return t}function Ok(e,n){let t=de;switch(e){case b.Equals:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=M;break}case b.ContainedBy:{t=K;break}case b.Rejection:{t=M;break}case b.Intersection:{t=M;break}}break}case b.Containing:{switch(n){case b.Equals:{t=M;break}case b.Containing:{t=M;break}case b.ContainedBy:{t=M;break}case b.Rejection:{t=M;break}case b.Intersection:{t=M;break}}break}case b.ContainedBy:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=M;break}case b.ContainedBy:{t=K|J;break}case b.Rejection:{t=X;break}case b.Intersection:{t=M|X;break}}break}case b.Rejection:{switch(n){case b.Equals:{t=M;break}case b.Containing:{t=M;break}case b.ContainedBy:{t=X;break}case b.Rejection:{t=G;break}case b.Intersection:{t=X;break}}break}case b.Intersection:{switch(n){case b.Equals:{t=M;break}case b.Containing:{t=M;break}case b.ContainedBy:{t=M|X;break}case b.Rejection:{t=X;break}case b.Intersection:{t=M|X;break}}break}}return t}function jk(e){let n=de;switch(e){case b.Equals:{n=G;break}case b.Containing:{n=G;break}case b.ContainedBy:{n=X;break}case b.Rejection:{n=K|M;break}case b.Intersection:{n=J|X;break}}return n}function _k(e){let n=de;switch(e){case b.Equals:{n=K;break}case b.Containing:{n=J;break}case b.ContainedBy:{n=M;break}case b.Rejection:{n=G;break}case b.Intersection:{n=X;break}}return n}var Me=Object.freeze({Leaf:0,Not:1,AllOf:2,AnyOf:3,OneOf:4});var ll=(e)=>(n,t)=>{let r={parent:null,swapped:!1,expressions:null,calculation:{operator:he.Save,results:[de],willSwap:!1,count:0}},o=[{parent:{node:r,index:0},swapped:!1,expressions:[n,t],calculation:null}],i=[];while(o.length>0||i.length>0){while(o.length>0){let u=o.pop();s(u)}while(i.length>0){let u=i.pop();c(u)}}function s(u){let d=K,[g,h]=u.expressions;if(!e.equals(g,h)){let y=e.describe(g);if(y.kind!==Me.Leaf){let[N,D]=a(y,!1);u.expressions=null,u.calculation=N;for(let[L,Oe]of D.entries())o.push({parent:{node:u,index:L},swapped:u.swapped,expressions:[Oe,h],calculation:null});return}let S=e.describe(h);if(S.kind!==Me.Leaf){let[N,D]=a(S,!0);u.expressions=null,u.calculation=N;for(let[L,Oe]of D.entries())o.push({parent:{node:u,index:L},swapped:!u.swapped,expressions:[Oe,g],calculation:null});return}if(d=e.calculate(g,h),e.observeCalculation?.(g,h,d,u.swapped),d===de)throw Error("cannot response expression as none")}u.expressions=null,u.calculation={operator:he.Save,results:[d],willSwap:!1,count:0},i.push(u)}function a(u,d){let g=he.Save,h;switch(u.kind){case Me.Not:{g=he.Not,h=[u.expression];break}case Me.AllOf:{g=he.AllOf,h=[...u.expressions];break}case Me.AnyOf:{g=he.AnyOf,h=[...u.expressions];break}case Me.OneOf:{g=he.OneOf,h=[...u.expressions];break}default:throw Error(`invalid kind ${u.kind}`)}return[{operator:g,willSwap:d,count:0,results:Array(h.length).fill(-1)},h]}function c(u){let{calculation:d,parent:g}=u,h=Fg(d.operator,d.results);if(h===de)h=J;if(d.willSwap)h=$n(h);if(g){let y=g.node.calculation,S=y.results;if(S[g.index]=h,y.count+=1,y.count>=S.length)i.push(g.node)}}let l=r.calculation.results[0];if(l===0)throw Error("cannot find result of root");return l};class gi extends Error{constructor(e=[]){super(Rk(e));this.name="SchemaError",this.items=e}}var Ct=Object.freeze({Compiled:0,External:1});function Et(e){switch(e.kind){case Ct.Compiled:{let{message:n,path:t}=e;return`${n} (at ${t.length>0?t.join("."):"$root"})`}case Ct.External:return String(e.error)}}function Rk(e){switch(e.length){case 0:return"without any items";case 1:return Et(e[0]);default:return`${Et(e[0])} ... omit the rest ${e.length-1} items`}}var Ak=new Set(["type","enum","const","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","items","additionalItems","maxItems","minItems","uniqueItems","contains","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames","if","then","else","allOf","anyOf","oneOf","not","format","contentMediaType","contentEncoding","definitions"]);function pn(e){return Ak.has(e)}function Zg(e){for(let n in e)if(pn(n))return!1;return!0}function ze(e,...n){return{...e,path:[...e.path,...n]}}function Fe(e){if(typeof e==="boolean")throw Error("JSONSchema7Definition cannot be boolean");return e}function Nn({path:e,errors:n},t,...r){n.push(Jg(e,r,t))}function ee({path:e,warns:n},t,...r){n.push(Jg(e,r,t))}function Jg(e,n,t){return{kind:Ct.Compiled,message:t,path:[...e,...n]}}function hi(e){for(let n in e){let t=e[n];if(t===void 0)delete e[n];else if(t&&typeof t==="object"){if(Array.isArray(t)){if(t.length===0)delete e[n]}else if(Pk(t))delete e[n]}}return e}function Pk(e){for(let n in e)return!1;return!0}var Er=Symbol("compiledId"),ul=Symbol("compiledKind"),dl=Symbol("compiledPath"),Ug=Symbol("validatorLoader"),I=Object.freeze({Extends:0,Never:1,Any:2,Null:3,String:4,Numeric:5,Boolean:6,Object:7,Array:8,Not:9,Combination:10,EnumOrConst:11}),zn=It(yi(I.Any,Pn(),{},()=>()=>!0)),Or=It(yi(I.Never,Pn(),{type:"string",maxLength:0,minLength:1},()=>()=>!1));function jr(e){if(e===null||typeof e!=="object")return!1;return Er in e}function Ze(e){if(e===null||typeof e!=="object")return!1;return Er in e&&ul in e}function Y(e){if(Ze(e))return e[ul];else return I.Extends}function Wn(e){if(Ze(e)||jr(e))return e[Er];else return e.id}function pl(e){return Ze(e)?e[dl]:void 0}function fl(e){if(e===null||typeof e!=="object")return e;return Object.defineProperty(e,Er,{value:Pn(),configurable:!1,writable:!1,enumerable:!1}),e}function ye(e,n,t,r=[]){return yi(e,Pn(),n,t&&(()=>t.compile(n)),r)}function _r(e){return yi(I.Never,Pn(),{...e},e[Ug],e[dl])}function yi(e,n,t,r,o=[]){let i=null;return Object.defineProperties(t,{[ul]:{value:e,configurable:!1,writable:!1,enumerable:!1},[Er]:{value:n,configurable:!1,writable:!1,enumerable:!1},[dl]:{value:o,configurable:!1,writable:!1,enumerable:!1},[Ug]:{value:r,configurable:!1,writable:!1,enumerable:!1},isValid:{configurable:!1,enumerable:!1,get:()=>{if(r){if(!i)i=r();return i}else return}}}),t}function Wg(e,n){let t=Tk(e,n),r=Bg(e,"maxItems",n),o=Bg(e,"minItems",n),i=$k(e,n),s=n.uniqueItems,a;if(Array.isArray(t))a=Nk(e,n);else if(n.additionalItems)ee(e,"it is needless when items is not array","additionalItems");if(!t||!i||a===null)return null;let c=!1,l=!1;if(Array.isArray(t)){if(r!==void 0&&r<=t.length)t=t.splice(r),a=Kg(a,e.delegate);let g=t.findIndex((h)=>Y(h)===I.Never);if(g!==-1){if(t=t.splice(g),a=Kg(a,e.delegate),r===void 0)r=t.length,l=!0}if(o!==void 0&&t.length<o)ee(e,`length(${t.length}) of items if less than minItems(${o})`),c=!0;if(t.length===0&&a&&Y(a)===I.Never)c=!0}else if(Y(t)===I.Never)c=!0;if(r!==void 0&&o!==void 0&&r<o){if(!l)ee(e,`maxItems(${r}) is less than minItems(${o})`);c=!0}let u=c?I.Never:I.Array,d=hi({type:"array",items:t,contains:i,uniqueItems:s,maxItems:r,minItems:o,additionalItems:a});return ye(u,d,e.delegate,e.path)}function Tk(e,{items:n}){if(!n)return ye(I.Any,{},e.delegate,e.path);if(Array.isArray(n)){let t=[],r=!1;for(let[o,i]of n.entries()){let s=ze(e,"items",o),a=De(s,Fe(i));if(!a){r=!0;continue}t.push(a)}if(r)return null;return t}else{let t=ze(e,"items"),r=Fe(n);return De(t,r)}}function Bg(e,n,t){let r=t[n];if(r===void 0)return;if(Number.isNaN(r)){ee(e,"find NaN",n);return}if(r<0){ee(e,`find invalid number ${r}`,n);return}return r}function $k(e,{contains:n}){if(!n)return ye(I.Any,{},e.delegate,e.path);let t=ze(e,"contains"),r=Fe(n);return De(t,r)}function Nk(e,{additionalItems:n}){switch(typeof n){case"boolean":if(n)return ye(I.Any,{},e.delegate,e.path);else return!1;case"object":{let t=ze(e,"additionalItems");return De(t,n)}default:return ye(I.Any,{},e.delegate,e.path)}}function Kg(e,n){if(e===void 0)return ye(I.Never,{type:"string",maxLength:0,minLength:1},n);else if(Ze(e))return Y(e)===I.Never?e:_r(e);else return e}var Gg=Object.freeze(["allOf","anyOf","oneOf"]);function ml(e,n,t,r){if(t.length===0)return Nn(e,"disable empty list",n),null;let o=[];for(let[c,l]of t.entries()){let u=ze(e,n,c),d=Fe(l),g=De(u,d);if(g)o.push(g)}if(o.length<t.length)return null;let i=0,s=0;for(let c of o)switch(Y(c)){case I.Any:{i+=1;break}case I.Never:{s+=1;break}}let a=I.Combination;switch(n){case"allOf":{if(s>0)a=I.Never;else if(i===o.length)a=I.Any;else if(!zk(o))a=I.Never;break}case"anyOf":{if(i>0)a=I.Any;else if(s===o.length)a=I.Never;break}case"oneOf":{if(i>1)a=I.Never;else if(s===o.length)a=I.Never;else if(i===1&&s===o.length-1)a=I.Any;break}}return ye(a,{[n]:o},r,e.path)}function zk(e){let n=null;for(let t of e){let r=Y(t);switch(r){case I.Any:case I.Never:break;default:{if(n===null)n=r;else if(n!==r)return!1;break}}}return!0}var Ae=Object.freeze({Valid:0,Invalid:1,Unknown:2});function fn(e,n){let t=e.isValid;if(t)if(t(n)===!0)return Ae.Valid;else return Ae.Invalid;else return Ae.Unknown}function Hg(e,n,t,r){let o,i=!1;if(n){if(n.length===0)return Nn(e,"disable empty list","enum"),null;o=[];for(let[c,l]of n.entries())switch(fn(r,l)){case Ae.Valid:{o.push(fl(l));break}case Ae.Invalid:{ee(e,"cannot pass JSON schema of currently schema object","enum",c);break}}if(o.length===0)ee(e,"all of elements from list is rejected by currently schema object","enum")}if(t!==void 0&&fn(r,t)===Ae.Invalid)i=!0;if(o){if(o.length===0)i=!0;else if(t!==void 0){let c=!1;for(let l of o)if(St(l,t)){c=!0;break}if(!c)i=!0}}let s=i?I.Never:I.EnumOrConst,a={};if(r.type)a.type=r.type;if(o)a.enum=o;if(t!==void 0)a.const=fl(mi(t));return ye(s,a,e.delegate,e.path)}var Dk=new Set(["type","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames"]);function Yg(e,n){let t=Object.keys(n).filter((y)=>!Dk.has(y)&&pn(y));if(t.length>0)ee(e,`type="object" will exclude other keys: ${t.toSorted().join(", ")}`);let r=Qg(e,"maxProperties",n),o=Qg(e,"minProperties",n),i=qk(e,n),s=Lk(e,n),a=Vk(e,n),c=Fk(e,n);if(!i||!s||!a||!c)return null;let l=Mk(e,s,a,n);if(!l)return null;let u=Zk(i,s,a,l),d=Jk(e,u,c,n),g=Uk(e,i,l,d,r,o)?I.Never:I.Object,h=hi({type:"object",required:d,properties:l,minProperties:o,maxProperties:r,additionalProperties:i,patternProperties:Wk(s),dependencies:Gk(c,n),propertyNames:a});return ye(g,h,e.delegate,e.path)}function Qg(e,n,t){let r=t[n];if(r===void 0)return;if(Number.isNaN(r)){ee(e,"find NaN",n);return}if(r<0){ee(e,`find invalid number ${r}`,n);return}return r}function qk(e,{additionalProperties:n}){if(n===!1)return ye(I.Never,{type:"string",maxLength:0,minLength:1},e.delegate,e.path);if(typeof n!=="object")return ye(I.Any,{},e.delegate,e.path);let t=ze(e,"additionalProperties"),r=Fe(n);return De(t,r)}function Lk(e,{patternProperties:n}){let t=!1,r={};for(let o in n){let i=Kk(o);if(i instanceof Error){ee(e,`property name invalid. ${o}`,"patternProperties",o);continue}let s=Fe(n[o]),a=ze(e,"patternProperties",o),c=De(a,s);if(!c){t=!0;continue}r[o]=[c,i]}if(t)return null;return r}function Vk(e,{propertyNames:n}){if(!n)return ye(I.Any,{},e.delegate,e.path);n=Fe(n);let t=ze(e,"propertyNames"),r=De(t,n);if(!r)return null;let o=Y(r);if(o!==I.String&&o!==I.Any)return _r(r);return r}function Mk(e,n,t,{properties:r}){let o=!1;if(!r)return{};let i={};for(let s in r){if(fn(t,s)===Ae.Invalid){ee(e,`key ${JSON.stringify(s)} cannot pass JSON schema from propertyNames`,"properties");continue}let a=eh(n,s);if(a&&Y(a)===I.Never){ee(e,`key ${JSON.stringify(s)} matches a pattern that has a impossible(never) schema`,"properties");continue}let c=Fe(r[s]),l=ze(e,"properties",s),u=De(l,c);if(!u){o=!0;continue}i[s]=u}if(o)return null;return i}function Fk(e,{dependencies:n}){if(!n)return[{},{}];let t={},r={};for(let o in n){let i=Fe(n[o]);if(Array.isArray(i)){let{keys:s,duplicated:a}=Xg(i);if(a)ee(e,`found duplicated property names: ${a.join(", ")}`,"dependencies",o);t[o]=s}else{let s=ze(e,"dependencies",o),a=De(s,i);if(a){let c=Y(a);if(c===I.Object||c===I.Any)r[o]=a;else if(c===I.Extends)r[o]=Or;else r[o]=_r(a)}}}return[t,r]}function Zk(e,n,t,r){return(o)=>{if(fn(t,o)===Ae.Invalid)return!0;let i=eh(n,o);if(i&&Y(i)===I.Never)return!0;let s=r[o]??e;if(Y(s)===I.Never)return!0;return!1}}function Jk(e,n,t,{required:r}){if(!r)return[];let o=Xg(r);if(o.duplicated)ee(e,`found duplicated required keys: ${o.duplicated.join(", ")}`,"required");let i=[],s=[];for(let a of o.keys)if(Bk(t,a).some((l)=>n(l)))s.push(a);else i.push(a);if(s.length>0)ee(e,`key ${s.map((a)=>JSON.stringify(a)).join(", ")} will ban by another condition`,"required");return i}function Uk(e,n,t,r,o,i){if(o!==void 0&&i!==void 0&&o<i)return ee(e,`maxProperties(${o}) is less than minProperties(${i})`),!0;if(o!==void 0&&r.length>o)return ee(e,`length(${r.length}) of required is greater than maxProperties(${o})`),!0;if(i!==void 0&&r.length<i)return ee(e,`length(${r.length}) of required is less than minProperties(${i})`),!0;if(Y(n)!==I.Never)return!1;for(let s in t){let a=t[s];if(Y(a)!==I.Never)return!1}return!0}function Bk([e,n],t){let r=[t],o=new Set(r);while(r.length>0){let s=r.pop(),a=n[s],c=e[s];if(a){if(Y(a)===I.Object)i(a.required)}if(c)i(c)}function i(s){if(s){for(let a of s)if(!o.has(a))o.add(a),r.push(a)}}return[...o]}function Xg(e){let n=new Set,t=new Set;for(let r of e)if(n.has(r))t.add(r);else n.add(r);if(t.size===0)return{keys:[...e],duplicated:null};else return{keys:[...n],duplicated:[...t]}}function eh(e,n){for(let t in e){let[r,o]=e[t];if(o.test(n))return r}return null}function Kk(e){try{return new RegExp(e,"i")}catch(n){if(n instanceof SyntaxError)return n;else throw n}}function Wk(e){let n={};for(let t in e)n[t]=e[t][0];return n}function Gk([e,n],{dependencies:t}){let r={};for(let o in t){let i=e[o],s=n[o];r[o]=i||s}return r}var gl=new Set(["type","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum"]),nh=new Set(["type","format","maxLength","minLength","pattern"]);function rh(e,n){let{type:t}=n;switch(t){case"number":case"integer":return Hk(e,n);case"string":return Yk(e,n);case"boolean":case"null":{let r=Object.keys(n).filter((s)=>pn(s)&&s!=="type");if(r.length>0)ee(e,`key "type" will exclude other keys: ${r.toSorted().join(", ")}`);let o=t==="null"?I.Null:I.Boolean;return ye(o,{type:t},e.delegate,e.path)}default:return Nn(e,`invalid type ${JSON.stringify(t)}`),null}}function Hk(e,n){let t=Object.keys(n).filter((u)=>!gl.has(u)&&pn(u));if(t.length>0)ee(e,`type=${JSON.stringify(n.type)} will exclude other keys: ${t.toSorted().join(", ")}`);let r=sl(n,gl);for(let u of gl){let d=r[u];if(u!=="type"&&d!==void 0&&Number.isNaN(d))ee(e,"found NaN",u),delete r[u]}let{maximum:o,exclusiveMaximum:i,minimum:s,exclusiveMinimum:a}=r;if(o!==void 0&&i!==void 0){if(o===i)delete r.maximum;else if(o<i)delete r.exclusiveMaximum;else if(o>i)delete r.maximum}if(s!==void 0&&a!==void 0){if(s===a)delete r.minimum;else if(s<a)delete r.exclusiveMinimum;else if(s>a)delete r.minimum}let{multipleOf:c}=r;if(c===0)delete r.multipleOf,r.type="number",ee(e,"cannot be 0","multipleOf");let l=I.Numeric;if(!Qk(r))l=I.Never;return ye(l,r,e.delegate,e.path)}function Qk(e){let{maximum:n,exclusiveMaximum:t,minimum:r,exclusiveMinimum:o}=e;if(n!==void 0&&r!==void 0)return n>=r;else if(t!==void 0&&r!==void 0)return t>r;else if(n!==void 0&&o!==void 0)return n>o;else if(t!==void 0&&o!==void 0)return t>o;else return!0}function Yk(e,n){let t=Object.keys(n).filter((a)=>!nh.has(a)&&pn(a));if(t.length>0)ee(e,`type="string" will exclude other keys: ${t.toSorted().join(", ")}`);let r=sl(n,nh);th(e,r,"maxLength"),th(e,r,"minLength");let{maxLength:o,minLength:i}=r,s=I.String;if(o!==void 0){if(o<0)s=I.Never;else if(o!==void 0&&i!==void 0&&o<i)s=I.Never}return ye(s,r,e.delegate,e.path)}function th(e,n,t){let r=n[t];if(r!==void 0){if(Number.isNaN(r))ee(e,"found NaN",t),delete n[t]}}var oh=Object.freeze([]);function bi(e,n,t,r){if(Ze(e))return{schema:e,warns:oh};if(n.isExtendsSchema(e))return{schema:e,warns:oh};if(r){let s=r.isSchema(e);if(typeof s==="object"){let a=[];for(let c of s)a.push({kind:Ct.External,error:c});if(a.length>0)return a}else if(s===!1)throw Error("it is not a JSON Schema 7")}let o={delegate:r,payload:t,extends:n,path:[],errors:[],warns:[]},i=De(o,e);if(i)ih(o.errors.length===0,"found errors (it should be empty)");else return ih(o.errors.length>0,"cannot found any errors"),o.errors;return{schema:i,warns:o.warns}}function ih(e,n){if(!e)throw Error(n)}function De(e,n){if(e.extends.isExtendsSchema(n))return n;if(Ze(n))return n;let t=e.extends.tryCompiledExtendsSchema(n,e.payload);if(t)return t;let r=n,o=!1,{enum:i,const:s}=n;if(i||s!==void 0){let{enum:c,const:l,...u}=n;r=u,o=!0}let a=Xk(e,r);if(a&&o)a=Hg(e,i,s,a);if(!a)return null;return a}function Xk(e,n){for(let t of Gg){let r=n[t];if(r){let o=Object.keys(n).filter((s)=>pn(s)&&s!==t);if(o.length>0)ee(e,`composition key ${JSON.stringify(t)} will exclude other keys: ${o.toSorted().join(", ")}`);let i=ml(e,t,r);if(!i)return null;return i}}{let t=Fe(n.not);if(t){let r=Object.keys(n).filter((a)=>pn(a)&&a!=="not");if(r.length>0)ee(e,`key "not" will exclude other keys: ${r.toSorted().join(", ")}`);let o=ze(e,"not"),i=De(o,t);if(!i)return null;let s=I.Not;switch(Y(i)){case I.Never:{s=I.Any;break}case I.Any:{s=I.Never;break}}return ye(s,{not:i},e.delegate,e.path)}}if(n.type){let{type:t}=n;if(Array.isArray(t)){let{type:r,...o}=n;return ml(e,"anyOf",t.map((i)=>({...o,type:i})))}switch(t){case"object":return Yg(e,n);case"array":return Wg(e,n);default:return rh(e,n)}}if(Zg(n))return ye(I.Any,{},e.delegate,e.path);return Nn(e,"unrecognized"),null}class hl{constructor(e){let n=Object.freeze(e.toSorted());if(n.length>32)throw Error(`cannot define ${n.length} keys which is greater than 32`);this.keys=n,this.clazz=class extends sh{constructor(t){super(n,t)}};for(let[t,r]of this.keys.entries()){let o=1<<t;Object.defineProperty(this.clazz.prototype,r,{enumerable:!0,get:function(){return!!(this.int32&o)},set:function(s){if(s)this.int32|=o;else this.int32&=~o}})}}toBundle(e){let n=0;if(typeof e==="number")n=e;else if(e){for(let[t,r]of this.keys.entries())if(e[r])n|=1<<t}return new this.clazz(n)}}class sh{constructor(e,n){this.keys=e,this.int32=n}toInt32(){return this.int32}toString(){let e={};for(let n of this.keys)e[n]=this[n];return JSON.stringify(e)}}function wi(e){return new ah(e)}class ah{constructor(e){this.description=new hl(e)}get keys(){return this.description.keys}variable(e){let n;if(e)n=this.description.toBundle(e).toInt32();return new ch(this.description,n)}}class ch{constructor(e,n){this.values=new Set;if(this.description=e,n!==void 0)this.values.add(n)}[Symbol.iterator](){let e=this.values[Symbol.iterator]();return{next:()=>{let n=e.next();if(n.done)return n;else return{done:!1,value:this.description.toBundle(n.value)}}}}assign(e){let{values:n}=e;for(let t of n)this.values.add(t);return this}push(e,n){let t=new Set;for(let r of this.values)for(let[o,i]of xn)if(e&i){let s=this.description.toBundle(r);n(o,s),t.add(s.toInt32())}this.values=t}update(e){let n=new Set;for(let t of this.values){let r=this.description.toBundle(t);e(r),n.add(r.toInt32())}this.values=n}}function Dn(e,n){let[t]=e,[r]=n;if(t.num<r.num)return eS(e,n);else if(t.num>r.num)return nS(e,n);else return tS(e,n)}function eS(e,n){let[t,r]=e,[o,i]=n;if(r.num<=o.num){let s=r.exclusive,a=o.exclusive;if(r.num<o.num||s||a)return{left:{fromLeft:!0,range:e},right:{fromLeft:!1,range:n}}}if(r.num<=i.num){let s=!0,a=!1;if(r.num===i.num){let c=r.exclusive,l=i.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!1,range:[He(r),i]};return{left:{fromLeft:!0,range:[t,He(o)]},center:[o,r],right:c}}}return{left:{fromLeft:!0,range:[t,He(o)]},center:[o,i],right:{fromLeft:!0,range:[He(i),r]}}}function nS(e,n){let[t,r]=e,[o,i]=n;if(t.num>=i.num){let s=i.exclusive,a=t.exclusive;if(t.num>i.num||s||a)return{left:{fromLeft:!1,range:n},right:{fromLeft:!0,range:e}}}if(i.num<=r.num){let s=!0,a=!1;if(r.num===i.num){let c=i.exclusive,l=r.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!0,range:[He(i),r]};return{left:{fromLeft:!1,range:[o,He(t)]},center:[t,i],right:c}}}return{left:{fromLeft:!1,range:[o,He(t)]},center:[t,r],right:{fromLeft:!1,range:[He(r),i]}}}function tS(e,n){let[t,r]=e,[o,i]=n,s=t.exclusive,a=o.exclusive,c,l=t;if(!s&&a)l=o,c={fromLeft:!0,range:[t,He(o)]};else if(s&&!a)c={fromLeft:!1,range:[o,He(t)]};if(r.num<=i.num){let u=!0,d=!1;if(r.num===i.num){let g=r.exclusive,h=i.exclusive;u=g!==h,d=!g&&h}if(!d){let g;if(u)g={fromLeft:!1,range:[He(r),i]};return{left:c,center:[l,r],right:g}}}return{left:c,center:[l,i],right:{fromLeft:!0,range:[He(i),r]}}}function He(e){return{num:e.num,exclusive:!e.exclusive}}var Ot=(e)=>(n=e,t=Number.POSITIVE_INFINITY,r=e,o=Number.POSITIVE_INFINITY)=>{let{left:i,center:s,right:a}=Dn([{num:n,exclusive:!1},{num:t,exclusive:!1}],[{num:r,exclusive:!1},{num:o,exclusive:!1}]),c,l,u;if(i)c={min:i.range[0].num,max:i.range[1].num,isFrom1:i.fromLeft};if(a)l={min:a.range[0].num,max:a.range[1].num,isFrom1:a.fromLeft};if(s)u={min:s[0].num,max:s[1].num};return{left:c,right:l,intersection:u}};function jt({left:e,right:n,intersection:t}){if(!t)return b.Rejection;let r=!1,o=!1;if(e)if(e.isFrom1)r=!0;else o=!0;if(n)if(n.isFrom1)r=!0;else o=!0;if(r&&o)return b.Intersection;if(r)return b.Containing;if(o)return b.ContainedBy;return b.Equals}var rS=Ot(0),oS=wi(["hasCommon","hasExtra1","hasExtra2","hasRejection","hasCommonBroken"]);function uh({calculate:e},n,t){let r=rS(n.minItems,n.maxItems,t.minItems,t.maxItems),o=jt(r);if(o===b.Rejection)return G;let[i,s]=lh(n),[a,c]=lh(t),l=Math.max(i.length,a.length)+1,u=Math.min(l,r.intersection.max),d=oS.variable({}),g=Math.min(n.minItems??0,t.minItems??0);for(let y=0;y<u;y++){let S=i[y]??s,R=a[y]??c,N=e(S,R);d.push(N,(D,L)=>{switch(D){case b.Equals:{if(!L.hasRejection)L.hasCommon=!0;break}case b.Containing:{if(!L.hasRejection)L.hasCommon=!0;L.hasExtra1=!0;break}case b.ContainedBy:{if(!L.hasRejection)L.hasCommon=!0;L.hasExtra2=!0;break}case b.Intersection:{if(!L.hasRejection)L.hasCommon=!0;L.hasExtra1=!0,L.hasExtra2=!0;break}case b.Rejection:{if(y<g)L.hasCommonBroken=!0;L.hasRejection=!0,L.hasExtra1=!0,L.hasExtra2=!0;break}}})}d.update((y)=>{switch(o){case b.Containing:{y.hasExtra1=!0;break}case b.ContainedBy:{y.hasExtra2=!0;break}case b.Intersection:{y.hasExtra1=!0,y.hasExtra2=!0;break}}if(n.uniqueItems&&!t.uniqueItems&&(t.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra2=!0;else if(!n.uniqueItems&&t.uniqueItems&&(n.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra1=!0;if(n.maxItems===0||t.maxItems===0){if(y.hasCommon=!0,n.maxItems!==0)y.hasExtra1=!0;if(t.maxItems!==0)y.hasExtra2=!0}});let h=de;for(let{hasExtra1:y,hasExtra2:S,hasCommon:R,hasCommonBroken:N}of d){let D=R;if(N)D=!1;if(!D)h|=G;else if(y&&S)h|=X;else if(y)h|=M;else if(S)h|=J;else h|=K}return h}function lh({items:e,additionalItems:n}){if(Array.isArray(e))return[e,n??zn];else return[[],e??zn]}function dh(e){let n=new Map;return(t,r)=>{let o=jr(t),i=jr(r);if(o!==i)return!1;if(!o)return t===r;return fh(n,t,r,e)}}function ph(e){let n=new Map;return(t,r)=>fh(n,t,r,e)}function fh(e,n,t,r){let o=Wn(n),i=Wn(t),s=`${o}/${i}`,a=e.get(s);if(a===void 0)e.set(s,a=r(n,t));return a}function gh(e,n,t){let r=yl(n),o=yl(t),i=!1,s=!1,a=!1;for(let c of r){if(mh(e,o,c))a=!0;else i=!0;if(i&&a)break}for(let c of o){if(mh(e,r,c))a=!0;else s=!0;if(s&&a)break}if(!a)return G;if(i&&s)return X;if(i)return M;if(s)return J;return K}function bl(e,n){let t=!1,r=!1;for(let o of yl(e)){switch(fn(n,o)){case Ae.Valid:{t=!0;break}case Ae.Invalid:{r=!0;break}case Ae.Unknown:return We}if(t&&r)break}if(t&&r)return X;if(t)return K|J;if(r)return G;if(Y(n)===I.Never)return K;return J}function yl({const:e,enum:n}){if(e!==void 0)return[e];if(n)return n;throw Error("invalid branch")}function mh({isEquals:e},n,t){for(let r of n)if(e(r,t))return!0;return!1}function hh(e){function n(s,a){let c=e.isExtendsSchema(s),l=e.isExtendsSchema(a);if(c||l)return e.equals(s,a);else return r(s,a)}let t=new Map;function r(s,a){let c=Wn(s),l=Wn(a);if(c===l)return!0;let u=`${c}/${l}`,d=t.get(u);if(d===void 0)d=o(s,a),t.set(u,d);return d}function o(s,a){if(Array.isArray(s)){if(!Array.isArray(a))return!1;if(s.length!==a.length)return!1;for(let[c,l]of s.entries())if(!i(l,a[c]))return!1}else{if(Array.isArray(a))return!1;for(let c in s){if(!(c in a))return!1;let l=Reflect.get(s,c),u=Reflect.get(a,c);if(!i(l,u))return!1}for(let c in a)if(!(c in s))return!1}return!0}function i(s,a){if(s===a)return!0;if(s===null||a===null)return!1;if(typeof s!=="object")return!1;if(typeof s!==typeof a)return!1;if(Ze(s)&&Ze(a))return r(s,a);return o(s,a)}return n}function Rr(e){let n=Ar(e),t=e.multipleOf??1,r=sn(n,t);if(!r)return null;return{multipleOf:t,range:r}}function yh([e,n]){if(e.num!==n.num)return!1;if(e.exclusive)return!1;if(n.exclusive)return!1;return!0}function sn(e,n){if(!e)return;let[t,r]=e,o=iS(t.num,n),i=sS(r.num,n);if(o===t.num&&t.exclusive)o+=n;if(i===r.num&&r.exclusive)i-=n;if(o>i)return;if(o===i){if(o===Number.POSITIVE_INFINITY)return;if(o===Number.NEGATIVE_INFINITY)return}return[{num:o,exclusive:!1},{num:i,exclusive:!1}]}function iS(e,n){return Math.ceil(e/n)*n}function sS(e,n){return Math.floor(e/n)*n}function wh(e,n){let t=Ar(e),r=Ar(n),{left:o,right:i,center:s}=Dn(t,r);if(!s)return G;let a=!1,c=!1;if(o)if(o.fromLeft)a=!0;else c=!0;if(i)if(i.fromLeft)a=!0;else c=!0;if(a&&c)return X;if(a)return M;if(c)return J;return K}function wl(e,n){let t=Ar(e),r=Rr(n);if(!r)return M;let o=Dn(t,r.range),i=sn(o.center,r.multipleOf),s=bh(o.left,r.multipleOf),a=bh(o.right,r.multipleOf);if(!o.center)return G;let c=!1,l=!1;if(o.left?.fromLeft)c=!0;if(o.right?.fromLeft)c=!0;if(!i||!yh(o.center))c=!0;if(s)l=!0;if(a)l=!0;if(c&&l)return X;if(c)return M;if(l)return J;return K}function Ar(e){let n,t;if(e.exclusiveMinimum!==void 0)n={num:e.exclusiveMinimum,exclusive:!0};else if(e.minimum!==void 0)n={num:e.minimum,exclusive:!1};else n={num:Number.NEGATIVE_INFINITY,exclusive:!0};if(e.exclusiveMaximum!==void 0)t={num:e.exclusiveMaximum,exclusive:!0};else if(e.maximum!==void 0)t={num:e.maximum,exclusive:!1};else t={num:Number.POSITIVE_INFINITY,exclusive:!0};return[n,t]}function bh(e,n){if(!e)return;if(e.fromLeft)return;return sn(e.range,n)}function kh(e,n){let t=Rr(e),r=Rr(n);if(!t&&!r)return K;if(!t)return J;if(!r)return M;let{range:o,multipleOf:i}=t,{range:s,multipleOf:a}=r,c=Dn(o,s),l,u=0;if(c.center)u=aS(i,a),l=sn(c.center,u);if(!l)return G;let d=!1,g=!1,{left:h,right:y}=c;if(h&&sn(h.range,h.fromLeft?i:a))if(h.fromLeft)d=!0;else g=!0;if(y&&sn(y.range,y.fromLeft?i:a))if(y.fromLeft)d=!0;else g=!0;if(d=d||vh(t,l,u),g=g||vh(r,l,u),d&&g)return X;if(d)return M;if(g)return J;return K}function vh({range:e,multipleOf:n},t,r){let o=Dn(e,t);if(sn(o.left?.range,n))return!0;if(sn(o.right?.range,n))return!0;let i=sn(o.center,n);if(!i)return!1;let s=xh(t);if(xh(i)>s)return!0;if(s===1)return!1;if(n<r)return!0;return!1}function aS(e,n){return e*n/Sh(e,n)}function Sh(e,n){if(e===0)return n;return Sh(n%e,e)}function xh(e){if(!e)return 0;let[n,t]=e;return t.num-n.num+1}function vl(e,n){if(Ih(e)||Ih(n))return We;let t=Ch(e),r=Ch(n);if(t&&r)return wh(e,n);else if(t)return wl(e,n);else if(r)return $n(wl(n,e));else return kh(e,n)}function Ih(e){let{multipleOf:n}=e;if(n===void 0)return!1;if(!Number.isInteger(n))return!0;if(n<0)return!0;return!1}function Ch(e){let{multipleOf:n}=e;if(n!==void 0&&Number.isInteger(n))return!1;if(e.type==="integer")return!1;return!0}var cS=Ot(0),lS=wi(["hasCommonInRequired","hasCommonOutRequired","hasExtra1","hasExtra2","hasRejection"]);function jh(e,n,t){if(uS(n,t))return G;let r=dS(n,t);if(!r)return G;let o=Eh(n),i=Eh(t),s=(S)=>{let R=o(S),N=i(S);if(Oh(R,N))return e.calculate(R,N);else return de},{commonRequired:a,extraRequired1:c,extraRequired2:l}=r,u=lS.variable({});for(let S of[...a].toSorted())u.push(s(S),fS);for(let S of[...c].toSorted())u.push(s(S),mS);for(let S of[...l].toSorted())u.push(s(S),gS);let{hasOptional1:d,hasOptional2:g}=r;if(d||g){let S=hS(d,g);for(let D of[...pS(n,t)].toSorted()){let L=s(D);if(L!==de)u.push(L,S)}let R=n.additionalProperties??zn,N=t.additionalProperties??zn;if(Oh(R,N)){let D=e.calculate(R,N);u.push(D,S)}}u.update((S)=>{if(!S.hasRejection){if(c.size>0)S.hasExtra2=!0;if(l.size>0)S.hasExtra1=!0}});let{requiredKeysCount:h}=r,y=de;for(let{hasExtra1:S,hasExtra2:R,hasCommonInRequired:N,hasCommonOutRequired:D,hasRejection:L}of u)if(!N&&h>0)y|=G;else if(!D&&h===0)y|=G;else if(L)y|=G;else if(S&&R)y|=X;else if(S)y|=M;else if(R)y|=J;else y|=K;return y}function uS(e,n){let t=cS(e.minProperties,e.maxProperties,n.minProperties,n.maxProperties);return jt(t)===b.Rejection}function dS(e,n){let t=new Set(e.required),r=new Set(n.required),o=new Set,i=new Set,s=t.size,a=r.size;for(let d of t){if(r.has(d))o.add(d);i.add(d)}for(let d of r){if(t.has(d))o.add(d);i.add(d)}let c=i.size;for(let d of o)t.delete(d),r.delete(d);let l=e.maxProperties??Number.MAX_SAFE_INTEGER,u=n.maxProperties??Number.MAX_SAFE_INTEGER;if(c>l||c>u)return null;return{requiredKeysCount:c,extraRequired1:t,extraRequired2:r,commonRequired:o,hasOptional1:l>s,hasOptional2:u>a}}function pS(e,n){let t=new Set(e.required),r=e.properties,o=n.properties,i=e.required,s=n.required;if(r)for(let a in r)t.add(a);if(o)for(let a in o)t.add(a);if(i)for(let a of i)t.delete(a);if(s)for(let a of s)t.delete(a);return t}var fS=(e,n)=>{switch(e){case b.Equals:{n.hasCommonInRequired=!0;break}case b.Containing:{n.hasExtra1=!0,n.hasCommonInRequired=!0;break}case b.ContainedBy:{n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case b.Intersection:{n.hasExtra1=!0,n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case b.Rejection:{n.hasRejection=!0;break}}},mS=(e,n)=>{switch(e){case b.Equals:case b.ContainedBy:{n.hasCommonInRequired=!0;break}case b.Intersection:case b.Containing:{n.hasExtra1=!0,n.hasCommonInRequired=!0;break}case b.Rejection:{n.hasRejection=!0;break}}},gS=(e,n)=>{switch(e){case b.Equals:case b.Containing:{n.hasCommonInRequired=!0;break}case b.Intersection:case b.ContainedBy:{n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case b.Rejection:{n.hasRejection=!0;break}}},hS=(e,n)=>(t,r)=>{if(r.hasRejection)return;let o=!1,i=!1,s=!1;switch(t){case b.Equals:{s=!0;break}case b.Containing:{o=!0,s=!0;break}case b.ContainedBy:{i=!0,s=!0;break}case b.Intersection:{o=!0,i=!0,s=!0;break}case b.Rejection:{o=!0,i=!0;break}}if(e&&o)r.hasExtra1=!0;if(n&&i)r.hasExtra2=!0;if(e&&n&&s)r.hasCommonOutRequired=!0};function Eh(e){let{properties:n,propertyNames:t,additionalProperties:r}=e,o=[];if(e.patternProperties)for(let i in e.patternProperties){let s=e.patternProperties[i],a=new RegExp(i,"i");o.push({pattern:a,schema:s})}return(i)=>{if(t&&fn(t,i)===Ae.Invalid)return Or;for(let{pattern:a,schema:c}of o)if(a.test(i))return c;let s=(n&&n[i])??r;if(!s)return zn;return s}}function Oh(e,n){let t=Y(e),r=Y(n);return t!==I.Never||r!==I.Never}var yS=Ot(0);function _h(e,n){if(n.format&&!e.format)return M;if(e.format&&n.format&&e.format!==n.format)return We;let t=yS(e.minLength,e.maxLength,n.minLength,n.maxLength),r=jt(t),o=!!e.pattern,i=!!n.pattern;switch(r){case b.Rejection:return G;case b.Containing:return o?We:M;case b.ContainedBy:return i?We:J;case b.Equals:{if(o&&i)return e.pattern===n.pattern?K:We;if(o)return K|J;if(i)return K|M;return K}case b.Intersection:{if(o&&i)return We;if(o)return X|G|J;if(i)return X|G|M;return X}}}function Ah(e,n,t){let r={},o=[],i=ph(wS(e,r)),s=bS(),a=hh(e);r.isEquals=dh(St),r.calculate=ll({describe:s,equals:a,calculate:i,observeCalculation:(l,u,d,g)=>{let h=g?$n(d):d;if(!vS(h))return;let y=g?Rh(u,l):Rh(l,u);if(y)o.push(y)}}),Object.freeze(r);let c=r.calculate(n,t);return{errorPath:o[0],expression:c}}var bS=()=>(e)=>{let n;switch(Y(e)){case I.Not:{n={kind:Me.Not,expression:e.not};break}case I.Combination:{if("allOf"in e)n={kind:Me.AllOf,expressions:xl(e.allOf,I.Any)};else if("anyOf"in e)n={kind:Me.AnyOf,expressions:xl(e.anyOf,I.Never)};else if("oneOf"in e)n={kind:Me.OneOf,expressions:xl(e.oneOf,I.Never)};else throw Error(`invalid combination JSON Schema: ${JSON.stringify(e)}`);break}default:{n={kind:Me.Leaf};break}}return n},wS=(e,n)=>(t,r)=>{let o=Y(t),i=Y(r);if(o===I.Extends||i===I.Extends)return e.calculate(t,r);switch(o){case I.Any:return i===I.Any?K:M;case I.Never:return i===I.Never?K:J}switch(i){case I.Any:return J;case I.Never:return M}if(o===I.EnumOrConst&&i===I.EnumOrConst)return gh(n,t,r);if(o===I.EnumOrConst)return bl(t,r);if(i===I.EnumOrConst)return $n(bl(r,t));if(o!==i)return G;switch(o){case I.Null:return K;case I.Numeric:return vl(t,r);case I.String:return _h(t,r);case I.Boolean:return K;case I.Object:return jh(n,t,r);case I.Array:return uh(n,t,r);default:throw Error(`invalid kind ${o}`)}};function xl(e,n){return e.filter((t)=>Y(t)!==n)}function vS(e){return!vr(e)&&!kr(e)&&(xr(e)||Ir(e)||Sr(e))}function Rh(e,n){let t=pl(n);if(!t)return;let r=Y(e),o=Y(n);if(r!==o)return[...t,"type"];let i=e,s=n;switch(o){case I.String:{if((i.minLength??0)<(s.minLength??0))return[...t,"minLength"];if((i.maxLength??Number.POSITIVE_INFINITY)>(s.maxLength??Number.POSITIVE_INFINITY))return[...t,"maxLength"];if(i.pattern!==s.pattern&&s.pattern)return[...t,"pattern"];if(i.format!==s.format&&s.format)return[...t,"format"];break}case I.Numeric:{if((i.minimum??i.exclusiveMinimum??Number.NEGATIVE_INFINITY)<(s.minimum??s.exclusiveMinimum??Number.NEGATIVE_INFINITY))return[...t,s.exclusiveMinimum==null?"minimum":"exclusiveMinimum"];if((i.maximum??i.exclusiveMaximum??Number.POSITIVE_INFINITY)>(s.maximum??s.exclusiveMaximum??Number.POSITIVE_INFINITY))return[...t,s.exclusiveMaximum==null?"maximum":"exclusiveMaximum"];if(i.multipleOf!==s.multipleOf&&s.multipleOf!=null)return[...t,"multipleOf"];break}case I.Array:{if((i.minItems??0)<(s.minItems??0))return[...t,"minItems"];if((i.maxItems??Number.POSITIVE_INFINITY)>(s.maxItems??Number.POSITIVE_INFINITY))return[...t,"maxItems"];if(!i.uniqueItems&&s.uniqueItems)return[...t,"uniqueItems"];break}case I.Object:{let a=new Set(i.required??[]);if((s.required??[]).some((c)=>!a.has(c)))return[...t,"required"];if((i.minProperties??0)<(s.minProperties??0))return[...t,"minProperties"];if((i.maxProperties??Number.POSITIVE_INFINITY)>(s.maxProperties??Number.POSITIVE_INFINITY))return[...t,"maxProperties"];break}case I.EnumOrConst:return[...t,s.const===void 0?"enum":"const"]}return t}class Pr{constructor(e=[]){this.extendsSchemaClasses=Object.freeze([...e])}tryCompiledExtendsSchema(e,n){for(let t of this.extendsSchemaClasses)if(t.isMatch(e))return new t(Pn(),e,n);return null}isExtendsSchema(e){for(let n of this.extendsSchemaClasses)if(e instanceof n)return!0;return!1}calculate(e,n){let t=this.findMatchedClass(e,n),r=!(e instanceof t),o=de,i;if(r)i=n.compare(e);else i=e.compare(n);for(let s of i){if(r)s=Pr.swap(s);o|=Tn(s)}return o}equals(e,n){let t=this.findMatchedClass(e,n);if(!(e instanceof t))return n.equals(e);else return e.equals(n)}findMatchedClass(e,n){for(let t of this.extendsSchemaClasses){if(e instanceof t)return t;if(n instanceof t)return t}throw Error("Invalid schema")}static swap(e){switch(e){case b.Containing:return b.ContainedBy;case b.ContainedBy:return b.Containing;default:return e}}}function Ph(e,n,t=!1){let r=n(e);if(Array.isArray(r)){let s=[];throw kl(s,r,"$"),new gi(s)}let{schema:o,warns:i}=r;if(t&&i.length>0){console.warn(`found ${i.length} warns after compile schema`);for(let s of i)console.warn(Et(s))}return o}function Th(e,n,t,r=!1){let o=t(e),i=t(n);if(Array.isArray(o)||Array.isArray(i)){let u=[];if(Array.isArray(o))kl(u,o,"$1");if(Array.isArray(i))kl(u,i,"$2");throw new gi(u)}let{schema:s,warns:a}=o,{schema:c,warns:l}=i;if(r){if(a.length>0)console.warn(`found ${a.length} warns after compile superSchema`);for(let u of a)console.warn(Et(u));if(l.length>0)console.warn(`found ${l.length} warns after compile subSchema`);for(let u of l)console.warn(Et(u))}return[s,c]}function kl(e,n,t){for(let r of n){let o={...r,path:[t,...r.path]};e.push(o)}}var Tr=Object.freeze({True:0,False:1,Unknown:2});function Sl({extendsSchemaClasses:e,delegate:n}={}){let t=new Pr(e);return Object.freeze({compile:(o,i,s)=>Ph(o,(c)=>bi(c,t,i,n),s),isSubset:(o,i,s=!1)=>{let a=(y)=>bi(y,t,void 0,n),[c,l]=Th(o,i,a,s),{errorPath:u,expression:d}=Ah(t,c,l),g=vr(d)||kr(d),h=xr(d)||Ir(d)||Sr(d);if(g&&!h)return{result:Tr.True};if(!g&&h)return{errorPath:u,result:Tr.False};return{result:Tr.Unknown}}})}var vi=(e)=>typeof e==="string";var xS=Array.isArray;var kS=(e)=>e!==null&&typeof e==="object";var SS=(e)=>kS(e)&&!xS(e),Gn=(e)=>SS(e)?e:void 0;function IS(e){return Gn(e)?.type==="string"}function CS(e){let n=Gn(e),t=Gn(n?.error);if(n==null||t==null||n.packageId!=null&&!vi(n.packageId)||t.message!=null&&!vi(t.message))throw TypeError("Invalid schema comparison context.")}function ES(e){if(e==null)return{error:{}};return CS(e),e}class qn{static setError(e,n,t){if(e instanceof qn)e.context.error.message=t;else if(n instanceof qn)n.context.error.message=t}constructor(e,n,t){this.id=e,this.value=n,this.context=ES(t)}compare(e){if(Ze(e)&&Y(e)===I.Any)return[b.ContainedBy];return this.compareImpl(e)}}class $r extends qn{static isMatch(e){let n=Gn(e)?.enum;return Array.isArray(n)&&n.every((t)=>vi(t))}constructor(e,n,t){if(!$r.isMatch(n))throw TypeError("Invalid single-select schema.");super(e,n,t)}compareImpl(e){if(IS(e))return[b.ContainedBy];if(e instanceof $r){let n=new Set(this.value.enum),t=b.Equals;for(let r of e.value.enum){if(!n.has(r))t=b.ContainedBy;n.delete(r)}if(n.size===0)return[t];if(n.size===this.value.enum.length)return[b.Rejection];return[b.Intersection]}return[b.Rejection]}equals(e){if(e instanceof $r){let n=new Set(this.value.enum);for(let t of e.value.enum){if(!n.has(t))return!1;n.delete(t)}return n.size===0}return!1}}class Nr extends qn{static isMatch(e){return Gn(e)?.contentMediaType==="oomol/bin"}constructor(e,n,t){if(!Nr.isMatch(n))throw TypeError("Invalid binary schema.");super(e,n,t)}compareImpl(e){if(e instanceof Nr)return[b.Equals];else return qn.setError(this,e,"edgeError.binDiffType"),[b.Rejection]}equals(e){return e instanceof Nr}}class zr extends qn{static isMatch(e){return Gn(e)?.contentMediaType==="oomol/artifact"}constructor(e,n,t){if(!zr.isMatch(n))throw TypeError("Invalid Artifact schema.");super(e,n,t)}compareImpl(e){if(e instanceof zr)return[b.Equals];return qn.setError(this,e,"edgeError.artifactDiffType"),[b.Rejection]}equals(e){return e instanceof zr}}function $h(){return Sl({extendsSchemaClasses:[$r,Nr,zr]})}var X_=$h();var OS=new Set(["const","enum","exclusiveMaximum","exclusiveMinimum","maximum","maxItems","maxLength","maxProperties","minimum","minItems","minLength","minProperties","multipleOf","pattern","required","type"]);function xi(e){return OS.has(e)}var ki=E({handle:j().min(1),jsonSchema:$e(),nullable:me(),description:j().optional()}),pR=v({inputs:A(ki).nullable(),outputs:A(ki).nullable()});var Nh=E({version:w(1),flowId:j().min(1),name:j(),revisionId:j().min(1),publicationId:j().min(1),inputs:A(ki),outputs:A(ki).nullable()});var zh=E({version:w(1),direction:W(["incoming","outgoing"]),total:we().nonnegative(),nextOffset:we().nonnegative().optional(),references:A(E({flowId:j(),name:j().nullable(),available:me(),draft:me(),live:E({publicationId:j(),enabled:me()}).nullable()}))});var Il=["GET","POST","PUT","PATCH","DELETE"];function Si(e){return e!=="GET"}function _S(e){return e.kind==="decision"}var Cl={choice:255,score:10};function Dh(e){if(e.type==="noul"||e.criteria.length<=Cl[e.type])return e;if(e.type==="choice")return{...e,criteria:e.criteria.slice(0,Cl.choice)};return{...e,criteria:e.criteria.slice(0,Cl.score)}}function RS(e){let n=e.map(Dh);return n.every((t,r)=>t===e[r])?e:n}function qh(e){if(!_S(e.executor))return e;let n=e.executor.questions,t=RS(n);if(t===n)return e;let r=e.outputs.map((o)=>{if(!("handle"in o))return o;let i=n.findIndex((s)=>s.name===o.handle);if(i<0||n[i]===t[i]||!ke(o.jsonSchema,Lh(n[i])))return o;return{...o,jsonSchema:AS(t[i])}});return{...e,executor:{...e.executor,questions:t},outputs:r}}var El={type:"number",minimum:0,maximum:1};function AS(e){return Lh(Dh(e))}function Lh(e){let n={type:{const:e.type}};if(e.type==="noul")n.noul=El;else{let t=e.type==="choice"?e.criteria.map((r)=>r.name):e.criteria.map((r,o)=>String(o));if(n.confidence=El,n.probabilities={type:"object",properties:Object.fromEntries(t.map((r)=>[r,El])),required:t,additionalProperties:!1},e.type==="choice")n.choice={type:"string",...t.length?{enum:t}:{}};else n.score={type:"number",minimum:0,maximum:Math.max(0,t.length-1)},n.legend={type:"object",properties:Object.fromEntries(t.map((r)=>[r,{type:"string"}])),required:t,additionalProperties:!1}}return{type:"object",properties:n,required:Object.keys(n)}}function Vh(e){for(let[n,t]of Object.entries(e))if(n.startsWith("auth.")&&t.kind=="value")throw TypeError("HTTP authentication accepts deployment variables and upstream outputs only.")}var PS=/^(?:\*\.)?(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,Ol=20;function jl(e){return PS.test(e)&&(!e.startsWith("*.")||e.slice(2).includes("."))}var Mh=v({mode:W(["fields","object"]).default("fields"),names:A(j()).default([])}),Ii=v({method:W(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]).default("GET"),query:Mh.default({mode:"fields",names:[]}),headers:Mh.default({mode:"fields",names:[]}),bodyFormat:W(["none","json","text","form"]).default("none"),authentication:Q([v({type:w("none")}),v({type:W(["bearer","basic"])}),v({type:w("apiKey"),name:j(),in:W(["header","query"])})]).default({type:"none"}),responseFormat:W(["auto","json","text"]).default("auto"),statusPolicy:W(["success","all"]).default("success")}),Zh=Ii.extend({kind:w("http-request")});function Hn(e,n=0){if(n>64)throw TypeError("Value exceeds the maximum JSON depth.");if(e!=null&&typeof e=="object")for(let t of Object.values(e))Hn(t,n+1)}var _l=["code","connector","openapi","http-request","llm","decision"],Ci={maxRetries:5,minIntervalMs:1000,maxIntervalMs:60000,intervalStepMs:1000};var mn=v({maxRetries:ne().int().min(0).max(Ci.maxRetries),intervalMs:ne().int().min(Ci.minIntervalMs).max(Ci.maxIntervalMs).multipleOf(Ci.intervalStepMs)});var Ln=A(Q([E({type:w("cron"),expression:j(),timezone:j()}),E({type:w("every"),unit:W(["day","hour","minute","month","week"]),value:ne()})]));function Jh(e){try{return Intl.DateTimeFormat("en",{timeZone:e}),!0}catch{return!1}}var _t=on("kind",[v({kind:w("after"),durationMs:ne().nullable()}),v({kind:w("at"),at:j(),timezone:j().optional()})]),Rl=on("kind",[_t.options[0].extend({durationMs:ne().int().positive().max(Number.MAX_SAFE_INTEGER)}),_t.options[1].extend({at:br.datetime({offset:!0}),timezone:j().refine(Jh,"Select a valid IANA timezone.").optional()})]);var qr={defaultMs:30000,minMs:1000,maxMs:60000};var Uh={jsonSchema:{type:"object",additionalProperties:{type:["string","number","boolean"]}},nullable:!0};var NS=[{handle:"body",jsonSchema:{},nullable:!0,value:""},{handle:"statusCode",jsonSchema:{type:"number"},nullable:!1,value:200},{handle:"headers",jsonSchema:Uh.jsonSchema,nullable:!1,value:{}}];var Ai=12,k=j(),Oi=k.describe('Account selection: omit while unconfigured; use an account ID to select it; use "" to explicitly defer configuration. Deferred Actions fail if called; deferred Agent tools are excluded from the callable tool set. Not supported by Triggers.'),Xn=$e(),Lr=A(k),Vn=E({description:k.optional(),jsonSchema:Xn,nullable:me(),handle:k}),zS=A(Vn.strict()),Qe=Vn.extend({value:Xn.optional()}),Bh=E({collapsed:me().optional(),group:k}),DS=E({kind:w("node"),nodeId:k,output:k,system:w(!0).optional(),field:k.optional()}),Gh=Q([DS,E({kind:w("binding"),bindingId:k})]),Vr=Q([E({kind:w("unset")}),E({kind:w("value"),value:Xn})]),Al=Q([Vr,E({kind:w("sources"),sources:A(Gh)})]),Hh=re(k,Al),At={inputs:A(Q([Qe,Bh])),outputs:A(Q([Vn,Bh]))},qS=v({kind:w("connector"),action:k,connectionId:k.optional(),connections:A(v({connectionId:k,alias:k.optional()}))}),zl=Q([qS,v({kind:w("connector"),mode:w("shared")}),v({kind:w("connector"),mode:w("independent"),actions:A(v({action:k,connectionId:Oi.optional()}))}),v({kind:w("connector"),actionHints:A(k).optional(),connectionHints:A(v({action:k,connectionId:k,alias:k.optional()})).optional()})]),Qh=v({kind:w("workflow"),name:k,flowId:k,revisionId:k,inputs:A(Vn),outputs:A(Vn).nullable()}),Dl=v({kind:w("http"),hosts:A(k.refine(jl,'Use a lowercase host name or IPv4 address, optionally prefixed by "*." for subdomains.')).min(1).max(Ol).describe('Hosts Code may call with context.fetch. "*.example.com" matches subdomains only.')}),ji=Q([zl,Qh,Dl]),Pl=E({...At,name:k,moduleId:k,capabilities:A(ji).optional()}),Yh=Q([E({kind:w("value"),value:Xn}),E({kind:w("input"),input:k})]),LS=Q([Yh,E({kind:w("model")})]),Pi={id:k,name:k,description:k,approval:me(),inputs:A(Qe.extend({source:LS}))},ql=E({...Pi,kind:w("connector").optional(),action:k,connectionId:Oi.optional()}),Ll=Qh.extend(Pi),VS=on("type",[v({name:k,instructions:k,type:w("noul"),criteria:v({true:k.optional(),false:k.optional()}).optional()}),v({name:k,instructions:k,type:w("choice"),criteria:A(v({name:k,description:k}))}),v({name:k,instructions:k,type:w("score"),criteria:Lr})]),Rt=E({...At,name:k,executor:Q([E({kind:w("connector"),action:k,connectionId:Oi.optional(),outputMode:w("value").optional()}),E({kind:w("openapi"),sourceUrl:k,method:k,path:k,serverUrl:k,document:Xn,auth:A(E({id:k,type:W(["bearer","basic","apiKey"]),name:k.optional(),in:W(["header","query"]).optional()}))}),v({kind:w("decision"),questions:A(VS)}),E({kind:w("llm"),mode:W(["chat","json"])}),E({kind:w("agent"),code:me().optional(),model:k,prompt:k,maxRounds:ne(),tools:A(Q([Ll,ql])),notification:E({action:k,connectionId:Oi.optional(),inputDefinitions:A(Qe),messageHandle:k,inputs:re(k,Yh)}).optional()}),v({kind:w("workflow"),flowId:k,revisionId:k}),Zh])}),Tl=Rt.transform(qh),Kh=Q([E({kind:w("value"),value:Xn.optional(),jsonSchema:Xn.optional()}),E({kind:w("source"),source:Gh})]),_i={matchMode:W(["first","all"]),cases:A(E({description:k.optional(),output:k,groups:A(E({expressions:A(E({left:Kh,operator:W(["!=","<","<=","==",">",">=","contains","endsWith","hasKey","hasValue","isEmpty","isFalse","isNotEmpty","isNotNull","isNull","isTrue","notContains","notHasKey","notHasValue","startsWith"]),right:Kh.optional()}))}))}))},Mr={inputDefinitions:A(Qe),prompt:k},MS=E({allowedMethods:rn().optional(),allowedOrigins:Lr.optional(),noResponseBody:rn().optional(),responseBody:on("kind",[v({kind:w("workflow-outputs"),output:k.optional(),timeoutMs:ne().int().min(qr.minMs).max(qr.maxMs).optional()}),v({kind:w("webhook-response"),nodeId:k.optional(),timeoutMs:ne().int().min(qr.minMs).max(qr.maxMs).optional()})]).optional(),responseData:k.optional(),responseHeaders:re(k,k).optional(),responseHeadersSource:v({kind:w("workflow-outputs"),output:k.optional()}).optional(),responseHeaderOutputs:re(k,k).optional(),responseStatusCode:ne().int().min(200).max(599).optional(),responseStatusCodeOutput:k.optional()}),Ri={bodyFields:A(Qe),method:W(Il),options:MS.optional()},Wh={configInputs:At.inputs,definitionVersion:w(2),description:k,displayName:k,key:k,name:k,outputs:A(Vn).refine((e)=>new Set(e.map((n)=>n.handle)).size===e.length,"Duplicate Trigger output handle."),provider:k},FS=E({body:E({allowArray:me(),allowEmpty:me(),formats:A(W(["form","json","multipart","text"]))}),methods:A(W(["DELETE","GET","HEAD","PATCH","POST","PUT"])),successStatus:ne()}),$l=A(k.min(1)).refine((e)=>new Set(e).size===e.length,"Duplicate source Flow ID."),Qn={name:k,description:k.optional(),icon:k.optional()},Yn={maxExecutions:ne().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),inputs:Hh,name:k.optional(),description:k.optional(),icon:k.optional(),timeoutMs:ne().optional(),retry:mn.optional(),onError:W(["stop","error"]).optional()},Ei=Q([v({...Yn,kind:w("webhook-response"),retry:rn().optional(),onError:rn().optional()}),v({...Yn,kind:w("outputs"),outputDefs:A(Vn.strict()),outputMappings:Hh}).omit({inputs:!0}),E({...Yn,inputs:re(k,rn()),kind:w("condition"),..._i}),E({...Yn,inputs:dn().transform(()=>({})).default({}),kind:w("value"),values:A(Qe)}),E({...Yn,kind:w("task"),task:Q([Pl,Tl]),additionalInputs:A(Qe).optional()}),v({...Yn,kind:w("approval"),...Mr}).omit({timeoutMs:!0}),v({...Yn,kind:w("wait"),...Mr,autoContinue:_t.optional()}).omit({timeoutMs:!0}),E({...Qn,kind:w("manual")}),v({...Qn,kind:w("start"),inputDefs:zS}),v({...Qn,kind:w("error"),sourceFlowIds:$l.optional()}),E({...Qn,kind:w("webhook"),...Ri}),E({...Qn,kind:w("cron"),cronTimes:Ln}),E({...Qn,kind:w("poll"),connectionId:k.min(1).optional(),config:re(k,Vr),definition:E({...Wh,type:w("poll")}),pollTimes:Ln}),E({...Qn,kind:w("integration"),connectionId:k.min(1).optional(),config:re(k,Vr),definition:E({...Wh,type:w("integration"),endpoint:FS})})]),cn={input:Qe,port:Vn,ports:At,condition:v(_i),wait:v(Mr),waitAutoContinue:Rl,webhook:v(Ri),schedule:Ln,capabilities:A(ji),connector:Rt.shape.executor.options[0].omit({kind:!0}).strict(),openapi:Rt.shape.executor.options[1].omit({kind:!0}).strict(),decision:Rt.shape.executor.options[2].omit({kind:!0}).strict(),llm:Rt.shape.executor.options[3].omit({kind:!0}).strict(),agent:Rt.shape.executor.options[4].omit({kind:!0,notification:!0}).strict()},Nl=E({source:k,target:k,sourceHandle:k.optional()}),Ee={nodeId:k,target:rn().optional()},ZS=E({nodes:re(k,Ei),edges:A(Nl).default([])}),Xh=E({kind:w("variable"),target:k}),ey=E({name:k,imports:Lr,source:k}),JS=Ng(US,E({bindings:re(k,Xh),graph:ZS})),ny=E({modelVersion:Q([w(2),w(4),w(5),w(6),w(7),w(8),w(9),w(10),w(11),w(Ai)]),document:JS,modules:re(k,ey)}),XR=ny.extend({kind:w("open-flow-flow-revision"),version:w(1)});function US(e){let n=an(e);if(n.tasks!==void 0&&(n.tasks===null||typeof n.tasks!=="object"||Array.isArray(n.tasks)||Object.keys(n.tasks).length>0))throw TypeError("Independent Task definitions are no longer supported.");if(Object.values(an(an(n.graph).nodes)).some((r)=>Object.hasOwn(an(r),"taskId")))throw TypeError("Task references are no longer supported.");let t=n.subflows;if(t!==void 0&&(t===null||typeof t!=="object"||Array.isArray(t)||Object.keys(t).length>0))throw TypeError("Subflows are no longer supported.");if(Object.values(an(an(n.graph).nodes)).some((r)=>an(r).kind==="subflow"))throw TypeError("Subflow nodes are no longer supported.");if(["inputDefs","outputDefs","outputMappings"].some((r)=>Object.hasOwn(n,r)))throw TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");if(Object.values(an(an(n.graph).nodes)).some((r)=>an(r).kind=="start"&&Object.hasOwn(an(r),"parameters")))throw TypeError("Legacy Start.parameters is unsupported; configure node.inputDefs.");return e}function an(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Pt(e){Hn(e);let n=ny.parse(e);return KS(n),oy(n.document),n}var BS={"graph.trigger.sources.set":{nodeId:k,before:$l.optional(),value:$l.optional()},"binding.create":{bindingId:k,binding:Xh},"binding.delete":{bindingId:k},"binding.target.set":{bindingId:k,before:k,value:k},"graph.edge.connect":{edge:Nl,target:rn().optional()},"graph.edge.disconnect":{edge:Nl,target:rn().optional()},"graph.node.create":{...Ee,node:Ei},"graph.node.replace":{...Ee,before:Ei,node:Ei},"graph.node.delete":Ee,"graph.node.field.set":Q([E({...Ee,kind:w("graph.node.field.set"),field:w("retry"),before:mn.optional(),value:mn.optional()}),E({...Ee,kind:w("graph.node.field.set"),field:w("connectionId"),before:k.min(1).optional(),value:k.min(1).optional()}),E({...Ee,kind:w("graph.node.field.set"),field:W(["description","icon","name","onError"]),before:k.optional(),value:k.optional()}),E({...Ee,kind:w("graph.node.field.set"),field:w("maxExecutions"),before:ne().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),value:ne().int().positive().max(Number.MAX_SAFE_INTEGER).optional()}),E({...Ee,kind:w("graph.node.field.set"),field:w("timeoutMs"),before:ne().optional(),value:ne().optional()})]),"graph.node.input.set":{...Ee,handle:k,before:Al.optional(),value:Al.optional()},"graph.node.additional-inputs.set":{...Ee,before:A(Qe).optional(),value:A(Qe).optional()},"graph.node.condition.set":{...Ee,before:E(_i),value:E(_i)},"graph.node.values.set":{...Ee,before:A(Qe),value:A(Qe)},"graph.node.resolution.set":{...Ee,before:v({...Mr,autoContinue:_t.optional()}),value:v({...Mr,autoContinue:_t.optional()})},"graph.node.webhook.set":{...Ee,before:E(Ri),value:E(Ri)},"graph.node.task.ports.set":{...Ee,before:E(At),value:E(At)},"graph.node.task.name.set":{...Ee,before:k,value:k},"graph.node.task.capabilities.set":{...Ee,before:A(ji).optional(),value:A(ji).optional()},"graph.trigger.config.set":{nodeId:k,name:k,before:Vr.optional(),value:Vr.optional()},"graph.trigger.schedule.set":{nodeId:k,before:Ln,value:Ln},"module.create":{moduleId:k,module:ey},"module.delete":{moduleId:k},"module.rename":{moduleId:k,before:k,name:k},"module.source.replace":{moduleId:k,beforeImports:Lr,beforeSource:k,imports:Lr,source:k},"graph.node.task.set":{...Ee,before:Q([Pl,Tl]),value:Q([Pl,Tl])}},ty=new Map(Object.entries(BS).map(([e,n])=>[e,n instanceof Z?n:E({kind:w(e),...n})])),eA=A(Q([...ty.values()])).min(1);function Fr(e,n,t){try{return t(e)}catch(r){if(!(r instanceof Hv))throw r;throw TypeError(`operations[${n}]: ${r.issues.map((o)=>`${o.path.join(".")}: ${o.message}`).join("; ")}`,{cause:r})}}function ry(e,n){let{kind:t}=Fr(e,n,E({kind:k}).parse),r=ty.get(t);if(r==null)throw TypeError(`operations[${n}]: Unknown operation ${JSON.stringify(t)}.`);return Fr(e,n,r.parse)}function KS(e){if(e.modelVersion<12&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("moduleId"in n.task)&&n.task.capabilities?.some((t)=>t.kind=="http")))throw TypeError("Code HTTP access requires Flow model version 12.");if(e.modelVersion<11&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("executor"in n.task)&&n.task.executor.kind=="http-request"))throw TypeError("HTTP Request requires Flow model version 11.");if(e.modelVersion<11&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("moduleId"in n.task?n.task.capabilities?.some((t)=>t.kind=="workflow"):n.task.executor.kind=="agent"&&n.task.executor.tools.some((t)=>t.kind=="workflow"))))throw TypeError("Workflow tools require Flow model version 11.");if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="webhook"&&(n.options?.responseBody!=null||n.options?.responseStatusCodeOutput!=null||n.options?.responseHeadersSource!=null||n.options?.responseHeaderOutputs!=null)))throw TypeError("Dynamic Webhook responses require Flow model version 10.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((n)=>("retry"in n)&&n.retry!=null))throw TypeError("Node retries require Flow model version 9.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((n)=>{if(n.onError!=null)return!0;if([...Object.values("inputs"in n?n.inputs:{}),...Object.values(n.kind=="outputs"?n.outputMappings:{})].some((r)=>r.kind=="sources"&&r.sources.some((o)=>o.kind=="node"&&o.system)))return!0;return n.kind=="condition"&&n.cases.some((r)=>r.groups.some((o)=>o.expressions.some((i)=>[i.left,i.right].some((s)=>s?.kind=="source"&&s.source.kind=="node"&&s.source.system))))}))throw TypeError("Node error handling requires Flow model version 9.");if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((n)=>n.kind==="webhook-response"))throw TypeError("Webhook response nodes require Flow model version 10.");if(e.modelVersion<8&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="outputs"))throw TypeError("Workflow outputs require Flow model version 8.");if(e.modelVersion<7&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="start"))throw TypeError("Start Triggers require Flow model version 7.");if(e.modelVersion<6&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("executor"in n.task)))throw TypeError("Node-owned managed Tasks require Flow model version 6.");if(e.modelVersion<5&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="error"))throw TypeError("Error workflows require Flow model version 5.")}function oy(e){for(let n of Object.values(e.graph.nodes))if(n.kind=="task"&&"executor"in n.task&&["openapi","http-request"].includes(n.task.executor.kind))Vh(n.inputs)}var iy=v({mode:W(["chat","json"]),resultSchema:$e(),model:$e().optional().describe("Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence."),template:$e().optional().describe('Default message templates: [{role: "system" | "user" | "assistant", content: "Text with {{namedInput}}"}].'),messages:$e().optional().describe("Default conversation history, prepended without template interpolation; an array of {role, content} or null.")});var HS=Q([v({schemes:A(j().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.")}),v({type:W(["bearer","basic"])}),v({type:w("apiKey"),name:j().min(1),in:W(["header","query"])})]),sy=v({sourceUrl:j().min(1),path:j().min(1),method:j().min(1),serverUrl:j().optional(),authentication:HS.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")});var z=j().min(1),Ye=$e(),Jl=re(z,Ye),Ti=["start","outputs","webhook-response","workflow","webhook","cron","error","poll","integration","code","connector","agent","llm","decision","openapi","http-request","condition","value","wait","approval"],Ul=W(Ti),gn=z.describe('An existing node reference returned by read/search, or $alias for a preceding node.add in this edit batch. For node.add.as "step", reference "$step", never bare "step". Aliases are local to one batch.'),Vl=v({kind:w("output"),node:gn,port:z.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),field:j().optional()}),Ml=v({kind:w("system"),node:gn,port:w("error"),field:j().optional()}),Fl=v({kind:w("variable"),name:z}),ay=Q([Vl,Ml,Fl,v({kind:w("value"),value:Ye}),v({kind:w("unset")}),v({kind:w("default")}),v({kind:w("sources"),sources:A(Q([Vl,Ml,Fl])).min(1)})]),cy=Q([v({kind:w("value"),value:Ye.optional(),schema:Ye.optional()}),Vl,Ml,Fl]),ly=re(z,Pi.inputs.element.shape.source).optional().describe("Tool input sources by name. The platform resolves types from the selected Action or workflow. New inputs default to model-provided; omitted existing sources are preserved."),QS=Q([Ll.omit({id:!0,inputs:!0,outputs:!0,revisionId:!0}).extend({inputs:ly}).strict(),ql.omit({id:!0,inputs:!0}).extend({inputs:ly}).strict()]),YS=A(Q([zl,v({kind:w("workflow"),name:z,flowId:z}),Dl])),XS=v({...cn.connector.shape,messageHandle:z,inputs:re(z,Q([v({kind:w("value"),value:Ye}),v({kind:w("input"),input:z})]))}),$i=v({schema:Ye.optional(),nullable:me().optional(),description:j().optional()}),Tt=re(z,$i.extend({default:Ye.optional()})).describe("Optional business input constraints by name. A binding to a new Code, Agent, LLM, Wait or Approval input automatically declares an input accepting any JSON. Existing constraints are preserved. Omitted schema accepts any JSON; omitted nullable is true. Use default for inherited values; input.set supplies data."),fy=re(z,$i).describe("Workflow input definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Supply call values as trigger.outputs."),eI=fy.describe("Workflow output definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Set values on the Outputs node with input.set or node.add.inputs."),my=re(z,$i.extend({schema:Ye,nullable:me()})),uy=re(z,$i).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true."),Zl=v({left:cy,operator:cn.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,right:cy.optional()}),dy=v({all:A(Zl)}),nI=Q([Zl,dy,v({any:A(Q([Zl,dy]))})]),kn={"webhook-response":v({}),workflow:v({flowId:z}),start:v({inputDefs:fy.default({})}),outputs:v({outputDefs:eI.default({})}),error:v({sourceFlowIds:A(z).optional()}),webhook:cn.webhook.omit({bodyFields:!0}).extend({body:Tt}).strict(),cron:v({schedule:cn.schedule}),poll:v({key:z,connectionId:z.optional(),schedule:cn.schedule}),integration:v({key:z,connectionId:z.optional()}),code:v({inputs:Tt,outputs:uy,capabilities:YS.optional()}),connector:cn.connector.omit({outputMode:!0}).strict(),openapi:sy,"http-request":Ii,agent:cn.agent.omit({prompt:!0,tools:!0}).extend({inputs:Tt,resultSchema:Ye.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),tools:A(QS),notification:XS.optional()}).strict(),llm:iy.extend({inputs:Tt}),decision:cn.decision,condition:v({match:W(["first","all"]),branches:A(v({name:z,description:j().optional(),when:nI}))}),value:v({values:Jl,outputs:uy}),wait:v({inputs:Tt,autoContinue:cn.waitAutoContinue.optional().describe("Wait only. Omit to disable; clear config.autoContinue to remove. after counts from each wait registration; at requires an explicit offset and continues immediately if already past. Optional timezone preserves the editor zone; at remains the absolute instant. Server requires the deadline to precede the 7-day expiry.")}),approval:v({inputs:Tt})},tI={onError:W(["stop","error"]).optional(),name:z.optional(),description:j().optional(),icon:j().optional(),maxExecutions:we().positive().optional(),timeoutMs:ne().nonnegative().optional(),retry:mn.partial().optional().describe('Node retry policy for Code, Connector, OpenAPI, LLM and AI Decision. Omitted update fields preserve the policy; use clear: [["retry"]] to disable it. maxRetries counts additional attempts; intervalMs is 1000\u201360000 in whole seconds.')},rI=v({...tI,config:Jl.optional().describe('Recursively merge configuration; omitted fields remain unchanged and arrays replace as a whole. This includes schema objects: {} does not clear an existing schema. Use clear paths to remove fields, e.g. ["config","inputs","amount","schema","type"].')}),oI=on("op",[v({op:w("node.add"),as:z.regex(/^[A-Za-z][\w-]*$/).describe("Unique batch-local alias without the $ prefix. Later edits must reference this new node as $alias; the bare alias is not its node ID."),type:Ul,name:z,onError:W(["stop","error"]).optional(),retry:mn.optional(),config:Jl.optional(),inputs:re(z,ay).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),code:j().optional(),prompt:j().optional()}),v({op:w("node.update"),node:gn,set:rI.optional(),clear:A(A(z).min(1)).optional()}),v({op:w("node.refresh"),node:gn,tool:z.optional().describe("Name of a workflow tool on an Agent or Code node. Omit for a Call Workflow node.")}),v({op:w("node.remove"),node:gn}),v({op:w("input.set"),node:gn,input:z,source:ay}),v({op:W(["edge.connect","edge.disconnect"]),source:gn,target:gn,branch:z.optional()}),v({op:w("text.edit"),node:gn,field:W(["code","prompt"]),oldText:z,newText:j()}),v({op:w("text.set"),node:gn,field:W(["code","prompt"]),text:j()})]),Zr=v({baseRevision:z,requestId:z.max(256),edits:A(oI).min(1).max(1000)}),Ni=v({revision:z.optional().describe("Fixed revision from a previous read; omit to read the current draft."),nodes:A(z).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),text:v({node:z,field:W(["code","prompt"]),start:we().positive().default(1),lines:we().min(1).max(200).default(80)}).optional().describe("Read code or prompt by line (1-based). Mutually exclusive with nodes. Follow nextStart at the same revision until truncated is false.")}).refine((e)=>e.nodes==null||e.text==null,"Choose nodes or text.").meta({not:{required:["nodes","text"]},description:"Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."}),Bl=v({revisionId:z}),zi=v({revision:z.optional(),query:z.max(1000),type:Ul.optional(),offset:we().nonnegative().default(0),limit:we().min(1).max(100).default(20)}),gy=v({type:Ul.optional(),action:z.optional()}).refine((e)=>e.type==null||e.action==null,"Choose type or action."),py={read:{schema:Ni,guidance:"Read Start and Outputs node details for their interface definitions and data sources. Choose one mode: outline (omit nodes and text), node details (nodes), or text excerpt (text). nodes and text are mutually exclusive. Text defaults to 80 lines, at most 200 lines and 24000 characters. For the complete text, repeat at nextStart with the same revision until truncated is false.",examples:[{},{revision:"REVISION",nodes:["NODE"]},{revision:"REVISION",text:{node:"NODE",field:"prompt",start:1,lines:80}}]},search:{schema:zi,guidance:"Search names, configurations and text. Keep the returned revision when following nextOffset or reading a match.",examples:[{query:"Customer summary",type:"agent"}]},edit:{schema:Zr,guidance:'Edit Start config.inputDefs and Outputs config.outputDefs through node.add or node.update; clear paths are relative to the node, e.g. ["config","inputDefs","amount"]. Set Outputs values with input.set. Use the observed revision as baseRevision and a stable requestId. Edits are ordered and atomic. node.add.as declares a batch-local alias without $. Every later reference to that new node must use $alias, including node, edge source/target and output source node fields; a bare alias is not the node ID. Use returned node references in later batches. Updates recursively merge objects (including schemas); {} preserves existing fields. Arrays replace as a whole. Remove fields with clear paths. Text replacement requires exactly one match. Read the target text first. A saved draft can have validation diagnostics.',examples:[{baseRevision:"REVISION",requestId:"CREATE_REQUEST",edits:[{op:"node.add",as:"start",type:"start",name:"Start"},{op:"node.add",as:"step",type:"code",name:"Process",code:"export default ({value}) => ({result:value})"},{op:"edge.connect",source:"$start",target:"$step"},{op:"node.update",node:"$step",set:{description:"Created and connected in one atomic edit."}}]},{baseRevision:"REVISION",requestId:"REQUEST",edits:[{op:"text.edit",node:"NODE",field:"prompt",oldText:"Original rule.",newText:"Updated rule."}]}]},check:{schema:Bl,guidance:"Check a fixed revision. In the CLI, pass this identity with --revision REVISION.",examples:[{revisionId:"REVISION"}]}},iI=[...qu(at).builtinModules].filter((e)=>!e.startsWith("node:")),sI=`Code is an ES module whose default export receives (inputs, context) and returns the business outputs. It may import the Node builtins ${iI.join(", ")}, with or without the node: prefix; fs is a fresh in-memory filesystem containing /tmp per execution. require, dynamic import, packages and the http/net builtins are unavailable. To call HTTP APIs, declare their hosts in config.capabilities as {kind: "http", hosts: ["api.example.com", "*.example.org"]} and use context.fetch(url, {method, headers, body}); it returns status, ok, headers.get(), text(), json() and bytes(), does not follow redirects, adds no credentials, and limits bodies to 1 MiB. Prefer an HTTP Request node for a single call without transformation and Connector Actions for services with accounts. context provides inputs, signal, getPrevious(), fetch, actions, workflows, artifact, flowId, runId and blockId. Select workflows through config.capabilities: [{kind: "workflow", flowId, name}]. Call context.workflows.call(name, input) and await its business output. The platform derives input/output types. Refresh a selected workflow tool with node.refresh and tool: its name. Calls obey node and Run time limits.`;function Kl(e){if(!Object.hasOwn(py,e))return;let n=py[e];return{request:ht(n.schema,{io:"input"}),guidance:n.guidance,examples:n.examples}}function Wl(e){return e==null?{types:Ti,request:ht(Zr),guidance:"Read a node type schema before creating or configuring it. Use $alias to reference a preceding node.add in the same batch. Read returns stable node references. Long code and prompt fields use text reads and edits. Changes use the observed baseRevision and a stable requestId."}:{type:e,onError:_l.some((n)=>n==e)?{enum:["stop","error"]}:!1,retry:_l.some((n)=>n==e)?ht(mn):!1,inputSources:["poll","integration"].includes(e)?["value","unset","default"]:["start","outputs","error","cron","webhook","value","condition"].includes(e)?[]:["value","unset","default","output","system","variable","sources"],extensibleInputs:["code","agent","llm","wait","approval"].includes(e),guidance:e=="webhook-response"?'Prepare an HTTP response using fixed inputs body (any JSON, default empty text), statusCode (number, default 200) and headers (scalar-valued object, default {}). Select this node in Webhook options.responseBody as {kind: "webhook-response", nodeId: "node reference", timeoutMs: 30000}. Its first completion responds immediately while the Run continues. It has no business outputs. Multiple response nodes are allowed; each Webhook selects one reachable node.':e=="outputs"?"Declare output fields through config.outputDefs. Set their values through node.add.inputs or input.set. Outputs is a singleton execution sink; it waits for its predecessors and produces workflow business outputs independently of node logs. No downstream edges or data references to Outputs are allowed.":e=="webhook"?'Use options.responseBody: {kind: "webhook-response", nodeId: "node ID or $alias", timeoutMs: 30000} to respond on the selected node\u2019s first completion while the Run continues. Body, statusCode and headers come exclusively from that node; clear workflow-output-only status/header references when switching. Alternatively configure options.responseBody as {kind: "workflow-outputs", output?: "top-level output name", timeoutMs?: 30000} to respond after the Run succeeds. Omit output for the complete object. Connect Webhook to Outputs. Timeout is 1000\u201360000 ms; HTTP timeout does not cancel the Run. Strings return text; other values return JSON. Only in this mode, options.responseStatusCodeOutput can select a numeric top-level workflow output as the HTTP status, overriding the preserved fixed responseStatusCode (default 200). Its runtime value must be an integer from 200 to 599, excluding 204, 205, 304; missing or invalid values return 500. Use responseHeaders for fixed text headers. In workflow-output mode, responseHeaderOutputs maps header names to top-level output names; values can be string, number or boolean and are converted to text. Alternatively responseHeadersSource: {kind: "workflow-outputs", output?: "object field"} replaces the entire header object (omit output for all outputs), preserving but ignoring per-header settings. Missing, null, complex or invalid header values return 500 without fallback. Header restrictions and Content-Type policy still apply. Omit responseBody for immediate responseData. Clear options.responseBody, options.responseStatusCodeOutput, options.responseHeadersSource and options.responseHeaderOutputs explicitly to switch back.':e=="start"?"Declare workflow inputs through config.inputDefs; read them in Start node details. REST calls and manual runs supply them as trigger.outputs. Downstream nodes bind these parameters as Start outputs. Start has no input sources or defaults; non-nullable parameters are required, and omitted nullable parameters become null.":e=="condition"?"Edit branch operands through config.branches. A branch can test one expression, all expressions, or any alternatives. Unmatched execution uses branch otherwise.":["poll","integration"].includes(e)?"Configure static parameters with node.add.inputs or input.set. Definitions come from the selected Trigger key; execution output and variable sources are unavailable.":e=="llm"?"Configure model settings, message templates and history as defaults. Input bindings with the same names override these defaults; named business inputs can be bound directly. Template strings interpolate {{name}}.":e=="http-request"?"Configure method, query/headers modes and names, bodyFormat, authentication, responseFormat and statusPolicy. Bind url, query.<name>/header.<name> or whole query/headers objects, body and auth.token (Basic: auth.username/auth.password). Credentials accept variables or upstream outputs only. Outputs: body, statusCode, headers. Authentication is replaced as a complete choice.":e=="openapi"?"Select an operation; the tool resolves its ports and authentication. Read authenticationChoices from node details. authentication is replaced as a complete choice. Bind advertised credentials through inputs.":e=="workflow"?"Select another workflow with config.flowId. A workflow cannot call itself, including in a disconnected node. Owned unpublished or unavailable targets may be saved as incomplete drafts. Use node.refresh to load the current published interface.":e=="agent"?'Tools accept Connector Actions or {kind: "workflow", flowId, name, description, approval, inputs}. Workflow parameter sources use model, input or value. The platform derives the interface. Refresh a workflow tool with node.refresh and tool: its name.':e=="code"?sI:"Supply business configuration and input data. Fixed definitions are assembled by the tool. Existing constraints and defaults are preserved on partial updates.",example:{op:"node.add",as:"step",type:e,name:"Step",...{start:{config:{inputDefs:{}}},outputs:{config:{outputDefs:{}}},workflow:{config:{flowId:"<Flow ID>"}},connector:{config:{action:"<Action ID>",connectionId:"<Connection ID>"}},poll:{config:{key:"<Trigger key>",schedule:[{type:"every",unit:"minute",value:5}]}},integration:{config:{key:"<Trigger key>"}},"http-request":{config:{},inputs:{url:{kind:"value",value:"https://example.com"}}},openapi:{config:{sourceUrl:"https://example.com/openapi.json",path:"/items",method:"get"}},code:{code:"export default ({value}) => ({result:value})",inputs:{value:{kind:"value",value:"Hello"}}},condition:{config:{match:"first",branches:[{name:"yes",when:{left:{kind:"value",value:120},operator:">",right:{kind:"value",value:100}}}]}},value:{config:{values:{threshold:100,region:"EU"}}},webhook:{config:{method:"POST",body:{orderId:{schema:{type:"string"},nullable:!1}}}},wait:{prompt:"Continue processing this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},approval:{prompt:"Approve this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},llm:{config:{model:{model:"deepseek-v4-flash"},template:[{role:"user",content:"Summarize {{order}}."}]},inputs:{order:{kind:"value",value:{orderId:"A-1",total:42}}}},agent:{config:{model:"deepseek-v4-flash"},inputs:{orders:{kind:"value",value:[{orderId:"A-1",total:42}]}},prompt:"Summarize {{orders}}."}}[e]},configuration:ht(kn[e].partial()),texts:e=="code"?["code"]:["agent","wait","approval"].includes(e)?["prompt"]:[]}}var hy=E({code:z,message:j(),nodes:A(z),field:j().optional(),line:ne().optional(),column:ne().optional()}),yy=E({flowId:z,revisionId:z,valid:me(),diagnostics:A(hy),version:w(1)}),by=E({flowId:z,saved:w(!0),revision:z,nodes:re(z,z),changes:A(E({index:we(),op:z,node:z.optional()})),validation:E({status:W(["valid","invalid","unavailable"]),diagnostics:A(hy).optional()}),version:w(1)}),wy=E({flowId:z,revision:z,data:E({nodes:A(re(j(),Ye)).optional(),edges:A(Ye).optional(),text:re(j(),Ye).optional()}),version:w(1)}),vy=E({flowId:z,revision:z,data:E({matches:A(E({node:z.optional(),field:z,line:we().optional(),excerpt:j()})),total:we(),nextOffset:we().optional()}),version:w(1)});var q={authenticationRequired:"authentication.required",authorizationDenied:"authorization.denied",bindingUnresolved:"binding.unresolved",connectorActionNotFound:"connector.action-not-found",connectorAccessConflict:"connector.access-conflict",connectorAccessInvalid:"connector.access-invalid",connectorAccessRequired:"connector.access-required",connectorAccessUnsupported:"connector.access-unsupported",connectorUnconfigured:"connector.unconfigured",connectorUnavailable:"connector.unavailable",connectorConsoleUnconfigured:"connector.console-unconfigured",engineUnavailable:"engine.unavailable",engineUnsupported:"engine.unsupported",eventSourceInvalid:"event-source.invalid",eventSourceIdentityUnavailable:"event-source.identity-unavailable",eventSourceNotFound:"event-source.not-found",eventSourceConflict:"event-source.conflict",flowInvalid:"flow.invalid",flowRepairRequired:"flow.repair-required",flowUpgradeRequired:"flow.upgrade-required",flowNotFound:"flow.not-found",flowBusy:"flow.busy",flowConflict:"flow.conflict",flowPresentationConflict:"flow.presentation-conflict",flowRevisionConflict:"flow.revision-conflict",liveConflict:"live.conflict",liveNotFound:"live.not-found",pageInvalidCursor:"page.invalid-cursor",publicationConflict:"publication.conflict",publicationNotFound:"publication.not-found",publicationUnsupported:"publication.unsupported",publishOperationNotFound:"publication.operation-not-found",routeNotFound:"route.not-found",runConflict:"run.conflict",runEventsExpired:"run.events-expired",runInvalid:"run.invalid",runNotFound:"run.not-found",runNotTerminal:"run.not-terminal",runOverloaded:"run.overloaded",runWaitNotFound:"run.wait-not-found",triggerKeyInvalid:"trigger-key.invalid",triggerKeyNotFound:"trigger-key.not-found",triggerNotFound:"trigger.not-found",variableInvalid:"variable.invalid",variableLimitReached:"variable.limit-reached",variableNotFound:"variable.not-found"},cI={[q.eventSourceInvalid]:{status:400},[q.eventSourceIdentityUnavailable]:{status:409},[q.eventSourceNotFound]:{status:404},[q.eventSourceConflict]:{status:409},[q.authenticationRequired]:{status:401},[q.authorizationDenied]:{status:403},[q.bindingUnresolved]:{status:409},[q.connectorActionNotFound]:{status:404},[q.connectorAccessConflict]:{status:412},[q.connectorAccessInvalid]:{status:409},[q.connectorAccessRequired]:{status:409},[q.connectorAccessUnsupported]:{status:409},[q.connectorUnconfigured]:{status:503},[q.connectorUnavailable]:{status:503},[q.connectorConsoleUnconfigured]:{status:503},[q.engineUnavailable]:{status:503},[q.engineUnsupported]:{status:409},[q.flowInvalid]:{status:400},[q.flowRepairRequired]:{status:409},[q.flowUpgradeRequired]:{status:409},[q.flowNotFound]:{status:404},[q.flowBusy]:{status:409},[q.flowConflict]:{status:409},[q.flowPresentationConflict]:{status:412},[q.flowRevisionConflict]:{status:412},[q.liveConflict]:{status:412},[q.liveNotFound]:{status:404},[q.pageInvalidCursor]:{status:400},[q.publicationConflict]:{status:409},[q.publicationNotFound]:{status:404},[q.publicationUnsupported]:{status:409},[q.publishOperationNotFound]:{status:404},[q.routeNotFound]:{status:404},[q.runConflict]:{status:409},[q.runEventsExpired]:{status:410},[q.runInvalid]:{status:400},[q.runNotFound]:{status:404},[q.runNotTerminal]:{status:409},[q.runOverloaded]:{status:429},[q.runWaitNotFound]:{status:404},[q.triggerKeyInvalid]:{status:409},[q.triggerKeyNotFound]:{status:404},[q.triggerNotFound]:{status:404},[q.variableInvalid]:{status:400},[q.variableLimitReached]:{status:409},[q.variableNotFound]:{status:404}};class Pe extends Error{constructor(e,n,t,r){super(t);this.code=n,this.details=r,this.name="ApiError",this.status=e}}class xy extends Pe{constructor(e){super(502,"response.invalid",`The Control API returned an invalid response.${e==null?"":` ${e}`}`);this.detail=e}}function p(e){throw new xy(e)}function x(e){if(e==null||typeof e!="object"||Array.isArray(e))return p("Expected an object.");return e}function f(e){return typeof e=="string"&&e.length>0?e:p("Expected a non-empty string.")}function H(e,n){let t=n.filter((r)=>!Object.hasOwn(e,r));if(t.length>0)p(`Missing fields: ${t.join(", ")}.`)}function Xe(e,n){let t=Object.keys(e);if(t.length!=n.length||t.some((r)=>!n.includes(r))){let r=n.filter((i)=>!Object.hasOwn(e,i)),o=t.filter((i)=>!n.includes(i));p([r.length>0?`Missing fields: ${r.join(", ")}.`:"",o.length>0?`Unexpected fields: ${o.join(", ")}.`:""].filter(Boolean).join(" "))}}function ce(e){return Number.isSafeInteger(e)?e:p("Expected a safe integer.")}function be(e){if(e===null||typeof e=="boolean"||typeof e=="string")return e;if(typeof e=="number"&&Number.isFinite(e))return e;if(Array.isArray(e))return e.map(be);let n=x(e);return Object.fromEntries(Object.entries(n).map(([t,r])=>[t,be(r)]))}function Di(e){if(e==null)return;return f(e)}function $t(e){let n=x(e),t=n.liveEnd==null?void 0:x(n.liveEnd);if(t!=null&&typeof t.enabled!="boolean")return p();let{operation:r,sourcePublicationId:o}=n;if(n.version!=1)return p();if(r!="publish"&&r!="rollback")return p();if(o!=null&&typeof o!="string")return p();return{...t==null?{}:{liveEnd:{enabled:t.enabled,endedAt:f(t.endedAt)}},actorId:f(n.actorId),closureDigest:f(n.closureDigest),createdAt:f(n.createdAt),engineContract:f(n.engineContract),flowId:f(n.flowId),modelVersion:ce(n.modelVersion),operation:r,publicationId:f(n.publicationId),sharedAccessDigest:f(n.sharedAccessDigest),revisionDigest:f(n.revisionDigest),revisionId:f(n.revisionId),...o==null?{}:{sourcePublicationId:o},version:1}}function Gl(e){let n=x(e),t=n.status,r={createdAt:f(n.createdAt),flowId:f(n.flowId),operationId:f(n.operationId),revisionId:f(n.revisionId),updatedAt:f(n.updatedAt),version:1};if(n.version!=1)return p();switch(t){case"pending":return H(n,["createdAt","flowId","operationId","revisionId","status","updatedAt","version"]),{...r,status:t};case"succeeded":return H(n,["createdAt","flowId","operationId","publicationId","revisionId","status","updatedAt","version"]),{...r,publicationId:f(n.publicationId),status:t};case"failed":{H(n,["createdAt","flowId","issue","operationId","revisionId","status","updatedAt","version"]);let o=x(n.issue),i=o.nodeId;return H(o,["code","message",...i==null?[]:["nodeId"]]),{...r,issue:{code:f(o.code),message:f(o.message),...i==null?{}:{nodeId:f(i)}},status:t}}default:return p()}}function Hl(e){let n=x(e),{status:t,publication:r}=n;if(n.version!=1||typeof n.hasUnpublishedChanges!="boolean")return p();if(t!="not-published"&&t!="runnable"&&t!="suspended")return p();if(t=="not-published"&&r!==null)return p();if(t!="not-published"&&r===null)return p();return{flowId:f(n.flowId),hasUnpublishedChanges:n.hasUnpublishedChanges,publication:r===null?null:$t(r),revision:ce(n.revision),status:t,version:1}}function ky(e){let n=x(e),{nextCursor:t,total:r}=n;if(n.version!=1||!Array.isArray(n.publications))return p();if(t!=null&&typeof t!="string")return p();if(r!=null&&!Number.isSafeInteger(r))return p();return{...t==null?{}:{nextCursor:t},publications:n.publications.map($t),...r==null?{}:{total:r},version:1}}var Sy=A(Q([v({handle:j().min(1),description:j().optional(),jsonSchema:$e(),nullable:me(),value:$e().optional()}),v({group:j(),collapsed:me().optional()})]));function Ql(e){let n=x(e),t=n.type;if(t!="integration"&&t!="poll")return p();return{description:typeof n.description=="string"?n.description:p(),displayName:f(n.displayName),key:f(n.key),name:f(n.name),provider:f(n.provider),type:t}}function Jr(e){let n=x(e),t=Ql(n),r={configInputs:Sy.parse(n.configInputs),definitionVersion:n.definitionVersion===2?2:p(),description:t.description,displayName:t.displayName,key:t.key,name:t.name,outputs:(Array.isArray(n.outputs)?n.outputs:p()).map((l)=>{let u=x(l);return Object.assign({handle:f(u.handle),jsonSchema:be(u.jsonSchema),nullable:typeof u.nullable==="boolean"?u.nullable:p()},u.description==null?{}:{description:f(u.description)})}),provider:t.provider};if(t.type=="poll")return{...r,type:"poll"};let o=x(n.endpoint),i=x(o.body);if(!Array.isArray(o.methods)||!Array.isArray(i.formats)||typeof i.allowArray!="boolean"||typeof i.allowEmpty!="boolean")return p();let s=o.methods.map(f),a=i.formats.map(f),c=ce(o.successStatus);if(s.some((l)=>!["DELETE","GET","HEAD","PATCH","POST","PUT"].includes(l))||a.some((l)=>!["form","json","multipart","text"].includes(l))||c<200||c>299)return p();return{...r,endpoint:{body:{allowArray:i.allowArray,allowEmpty:i.allowEmpty,formats:a},methods:s,successStatus:c},type:"integration"}}var lI=new Set(["error","cron","integration","poll","webhook"]),uI=new Set(["failed","healthy","initializing","needs_reauth","suspended"]),dI=new Set(["delivery.failed","health.failed","health.needs_reauth","health.recovered","health.suspended","operator.paused","operator.resumed"]);function Ur(e){let n=x(e),t=n.health,r=n.listener==null?void 0:x(n.listener);if(r!=null&&r.health!="healthy"&&r.health!="failed"&&r.health!="needs_reauth")return p();let o=n.kind,i=ce(n.runtimeVersion);if(n.version!=1||typeof t!="string"||!uI.has(t))return p();if(typeof o!="string"||!lI.has(o))return p();if(i<=0)return p();return{...n.currentPublicationId==null?{}:{currentPublicationId:f(n.currentPublicationId)},...n.currentRevisionId==null?{}:{currentRevisionId:f(n.currentRevisionId)},...n.endpointUrl==null?{}:{endpointUrl:f(n.endpointUrl)},...r==null?{}:{listener:{health:r.health,...r.lastErrorCode==null?{}:{lastErrorCode:f(r.lastErrorCode)}}},flowId:f(n.flowId),health:t,kind:o,...n.lastErrorCode==null?{}:{lastErrorCode:f(n.lastErrorCode)},runtimeVersion:i,triggerNodeId:f(n.triggerNodeId),updatedAt:f(n.updatedAt),version:1}}function Iy(e){let n=x(e);if(n.version!=1)return p();return{binding:Ur(n.binding),version:1}}function pI(e){let n=x(e),t=n.kind;if(typeof t!="string"||!dI.has(t))return p();let r=Di(n.errorCode),o=Di(n.errorMessage);if(o!=null&&o.length>512)return p();return{activityId:f(n.activityId),createdAt:f(n.createdAt),...r==null?{}:{errorCode:r},...o==null?{}:{errorMessage:o},kind:t}}function Cy(e){let n=x(e),t=Di(n.nextCursor);if(n.version!=1||!Array.isArray(n.activities))return p();return{activities:n.activities.map(pI),...t==null?{}:{nextCursor:t},version:1}}function Ey(e){let n=x(e),t=ce(n.filtered);if(n.version!=1||!Array.isArray(n.events)||typeof n.hasMore!="boolean"||t<0)return p();return{events:n.events.map((r)=>{let o=x(r);return Object.fromEntries(Object.entries(o).map(([i,s])=>[i,be(s)]))}),filtered:t,hasMore:n.hasMore,version:1}}var et={nodeId:j().min(1),name:j(),description:j().optional()},Br=dn().transform(Ur),Oy={provider:j().min(1),inputs:re(j(),on("kind",[E({kind:w("value"),value:$e()}),E({kind:w("unset")})]))},mI=on("type",[E({...et,type:w("start"),config:kn.start}),E({...et,type:w("manual"),config:E({})}),E({...et,type:w("webhook"),config:kn.webhook,binding:Br}),E({...et,type:w("cron"),config:kn.cron,binding:Br}),E({...et,type:w("error"),config:kn.error,binding:Br}),E({...et,...Oy,type:w("poll"),config:kn.poll,binding:Br}),E({...et,...Oy,type:w("integration"),config:kn.integration,binding:Br})]);function jy(e){let n=x(e),t=f(n.flowId);if(n.version!=1||!Array.isArray(n.entries))return p();if(n.publication===null){if(n.inputDefs!==null||n.status!="not-published"||n.entries.length!=0||Object.hasOwn(n,"enabled"))return p();return{flowId:t,inputDefs:null,publication:null,status:"not-published",entries:[],version:1}}let r=$t(n.publication),o=n.status;if(r.flowId!=t||typeof n.enabled!="boolean")return p();if(o!="runnable"&&o!="suspended")return p();if(!n.enabled&&n.status=="runnable")return p();let i=my.safeParse(n.inputDefs);if(!i.success)return p();return{flowId:t,inputDefs:i.data,publication:r,status:o,enabled:n.enabled,entries:gI(n.entries,r),version:1}}function gI(e,n){let t=A(mI).safeParse(e);if(!t.success)return p();let r=new Set;for(let o of t.data){if(r.has(o.nodeId))return p();if(r.add(o.nodeId),o.type!="start"&&o.type!="manual"&&(o.binding.flowId!=n.flowId||o.binding.triggerNodeId!=o.nodeId||o.binding.kind!=o.type||o.binding.currentPublicationId!=n.publicationId||o.binding.currentRevisionId!=n.revisionId))return p();if(o.type=="webhook"&&(!o.binding.endpointUrl||!Si(o.config.method)&&Object.keys(o.config.body).length>0))return p()}return t.data}function qi(e,n){if(!e||typeof e!="object"||!n||typeof n!="object")return{};let t=e,r=n;if(typeof t.version!="string"||![t.pixelRatio,t.iconSize,t.width,t.height].every((o)=>Number.isInteger(o)&&o>0)||![t.bleed,r.x,r.y].every((o)=>Number.isInteger(o)&&o>=0)||r.x+t.iconSize>t.width||r.y+t.iconSize>t.height)return{};try{for(let o of[t.lightUrl,t.darkUrl])if(typeof o!="string"||!["https:","http:","data:"].includes(new URL(o).protocol))return{}}catch{return{}}return{iconSprite:t,iconSpritePosition:{x:r.x,y:r.y}}}function _y(e){return e.kind=="source"&&e.source.kind=="binding"?{kind:"value"}:e}function Ry(e){return{...e,cases:e.cases.map((n)=>({...n,groups:n.groups.map((t)=>({...t,expressions:t.expressions.map((r)=>({...r,left:_y(r.left),...r.right==null?{}:{right:_y(r.right)}}))}))}))}}var eu=80;function Vi(e){let n=e.trim();if(n.length==0)return"empty";if(n.length>eu)return"tooLong";for(let t of n){let r=t.charCodeAt(0);if(r<=31||r>=127&&r<=159)return"controlCharacter"}if(!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(n))return"specialCharacter"}function Py(e,n){let t=e=="jira.on_issue_event"||e=="intercom.on_conversation_event"||e=="sentry.on_issue_alert"||e=="zoom.on_recording_ready"||e=="fireflies.on_meeting_ready"?["sourceId","eventTypes"]:e=="slackbot.on_event"?["sourceId","eventTypes","channelIds"]:e=="feishu_app_bot.on_event"?["sourceId","eventTypes","resource","chatIds"]:e=="linear.on_issue_changed"?["teamId","stateIds"]:[];return{...n,...Object.fromEntries(t.map((r)=>[r,{kind:"unset"}]))}}function Ty(e,n){return{...e,nodes:Object.fromEntries(Object.entries(e.nodes).map(([t,r])=>{if((r.kind=="poll"||r.kind=="integration")&&(n==null||r.connectionId==n)){let{connectionId:i,...s}=r;return[t,s]}if(r.kind!="task")return[t,r];if("executor"in r.task){let i=r.task.executor,s=(a)=>{if(a.connectionId==="")return a;if(n!=null&&a.connectionId!=n)return a;let{connectionId:c,...l}=a;return l};if(i.kind=="connector")return[t,{...r,task:{...r.task,executor:s(i)}}];if(i.kind=="agent")return[t,{...r,task:{...r.task,executor:{...i,tools:i.tools.map(s),...i.notification==null?{}:{notification:s(i.notification)}}}}];return[t,r]}let o=r.task.capabilities?.map((i)=>{if(i.kind=="workflow"||i.kind=="http")return i;if(!("mode"in i)){if("action"in i){let{connectionId:s,...a}=i;return{...a,connections:i.connections.filter((c)=>n!=null&&c.connectionId!=n),...s!=null&&n!=null&&s!=n?{connectionId:s}:{}}}return{...i,...n==null&&(i.connectionHints?.length??0)>0?{actionHints:[...new Set([...i.actionHints??[],...i.connectionHints.map((s)=>s.action)])]}:{},...i.connectionHints==null?{}:{connectionHints:i.connectionHints.filter((s)=>n!=null&&s.connectionId!=n)}}}if(i.mode!="independent")return i;return{...i,actions:i.actions.map((s)=>{if(s.connectionId==="")return s;if(n!=null&&s.connectionId!=n)return s;let{connectionId:a,...c}=s;return c})}});return[t,o==null?r:{...r,task:{...r.task,capabilities:o}}]}))}}var kI=v({kind:w("open-flow-workflow"),version:w(1),name:j().optional(),content:dn(),presentation:re(j(),$e()).optional()});function Mi(e){Hn(e,-1);let n=kI.parse(e);return{...n,content:Pt(n.content)}}function Ny(e){return Mi(JSON.parse(e))}function $y(e){if(e.kind!="sources"||!e.sources.some((t)=>t.kind=="binding"))return e;let n=e.sources.filter((t)=>t.kind!="binding");return n.length==0?{kind:"unset"}:{kind:"sources",sources:n}}function SI(e){let n=Mi(e),t=n.content.document.graph,r=Ty(t),o=Object.fromEntries(Object.entries(r.nodes).map(([i,s])=>{let a=s;if("inputs"in a)a={...a,inputs:Object.fromEntries(Object.entries(a.inputs).map(([c,l])=>[c,$y(l)]))};if(a.kind=="outputs")a={...a,outputMappings:Object.fromEntries(Object.entries(a.outputMappings).map(([c,l])=>[c,$y(l)]))};if(a.kind=="condition")a=Ry(a);if(a.kind=="error"&&a.sourceFlowIds!=null)a={...a,sourceFlowIds:[]};if(a.kind=="poll"||a.kind=="integration")a={...a,config:Py(a.definition.key,a.config)};return[i,a]}));return{file:{...n,content:{...n.content,document:{...n.content.document,bindings:{},graph:{...r,nodes:o}}}},summary:{changedNodeIds:Object.keys(o).filter((i)=>!ke(o[i],t.nodes[i])),removedBindings:Object.keys(n.content.document.bindings).length}}}function zy(e){return`${JSON.stringify(SI(e).file,null,2)}
|
|
61
|
-
`}function Dy(e){return e.replace(/(?:\.openflow)?\.json$/i,"")}var CI=on("kind",[v({kind:w("admin-delegation")}),v({kind:w("policy"),ruleId:j().min(1).nullable()})]);function Fi(e){return CI.parse(e)}function Vy(e){let n=x(e);if(!Array.isArray(n.bots))return p("Leina bots: expected an array.");let t=n.bots.map((r)=>{let o=x(r);if(!Array.isArray(o.platforms))return p("Leina platforms: expected an array.");return{leinaId:f(o.leinaId),name:f(o.name),status:f(o.status),platforms:o.platforms.map(f)}});if(new Set(t.map((r)=>r.leinaId)).size!=t.length)return p("Leina bots: duplicate identifiers.");return t}function EI(e){let n=x(e);if(Xe(n,["actionIds","allActions","triggerIds","allTriggers","configured","proxy"]),!Array.isArray(n.actionIds))return p("permissions.actionIds: expected an array.");if(!Array.isArray(n.triggerIds))return p("permissions.triggerIds: expected an array.");if(typeof n.allActions!="boolean")return p("permissions.allActions: expected a boolean.");if(typeof n.allTriggers!="boolean")return p("permissions.allTriggers: expected a boolean.");if(typeof n.configured!="boolean")return p("permissions.configured: expected a boolean.");if(typeof n.proxy!="boolean")return p("permissions.proxy: expected a boolean.");let t=n.actionIds.map(f),r=n.triggerIds.map(f);if(new Set(t).size!=t.length)return p("permissions.actionIds: duplicate IDs.");if(n.allActions&&t.length!=0)return p("permissions.actionIds: must be empty when allActions is true.");if(new Set(r).size!=r.length)return p("permissions.triggerIds: duplicate IDs.");if(n.allTriggers&&r.length!=0)return p("permissions.triggerIds: must be empty when allTriggers is true.");if(n.proxy&&(!n.allActions||!n.allTriggers||n.configured))return p("permissions.proxy: requires allActions=true, allTriggers=true and configured=false.");return{actionIds:t,triggerIds:r,allTriggers:n.allTriggers,allActions:n.allActions,configured:n.configured,proxy:n.proxy}}function My(e,n){let t=x(e),{policyRevision:r,status:o,isDefault:i}=t,s=Object.hasOwn(t,"displayName")&&!Object.hasOwn(t,"connectionDisplayName"),a=n&&Object.hasOwn(t,"permissions")?EI(t.permissions):void 0,c=t.permissionGroupName;if(Xe(t,["accessBindingId","connectionId","source",s?"displayName":"connectionDisplayName",...n&&Object.hasOwn(t,"isDefault")?["isDefault"]:[],...n&&a!=null?["permissions"]:[],...Object.hasOwn(t,"permissionGroupName")?["permissionGroupName"]:[],...r==null?[]:["policyRevision"],"providerId",...n?[]:["status"]]),r!=null&&typeof r!="string")return p("policyRevision: expected a string.");if(n&&i!==void 0&&typeof i!="boolean")return p("isDefault: expected a boolean.");if(c!==void 0&&c!==null&&typeof c!="string")return p("permissionGroupName: expected a string or null.");if(!n&&o!="active"&&o!="forbidden"&&o!="invalid"&&o!="missing")return p();let l;try{l=Fi(t.source)}catch{return p("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.")}return{accessBindingId:f(t.accessBindingId),connectionId:f(t.connectionId),source:l,connectionDisplayName:f(s?t.displayName:t.connectionDisplayName),...n&&typeof i=="boolean"?{isDefault:i}:{},...a==null?{}:{permissions:a},...c===void 0?{}:{permissionGroupName:c},...r==null?{}:{policyRevision:r},providerId:f(t.providerId),...n?{}:{status:o}}}function tu(e){if(e!="implicit"&&e!="selectable")return p("mode: expected implicit or selectable.");return e}function Nt(e){let n=x(e);Xe(n,["accessRevision","bindings","mode","sharedAccessDigest",..."providerIds"in n?["providerIds"]:[],..."discardedBindingCount"in n?["discardedBindingCount"]:[],"version"]);let t=ce(n.accessRevision);if(n.version!=1||t<0||!Array.isArray(n.bindings))return p();if("providerIds"in n&&!Array.isArray(n.providerIds))return p();let r=n.providerIds==null?void 0:n.providerIds.map((s)=>f(s));if(r!=null&&new Set(r).size!=r.length)return p();let o=n.discardedBindingCount==null?0:ce(n.discardedBindingCount);if(o<0)return p();let i=[];for(let s of n.bindings)try{i.push(My(s,!1))}catch(a){if(!(a instanceof Pe)||a.code!="response.invalid")throw a;if(s!=null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.accessBindingId=="string"&&s.accessBindingId.length>0&&typeof s.providerId=="string"&&s.providerId.length>0)i.push({accessBindingId:s.accessBindingId,providerId:s.providerId,connectionId:null,source:null,status:"invalid",connectionDisplayName:typeof s.connectionDisplayName=="string"&&s.connectionDisplayName.length>0?s.connectionDisplayName:typeof s.displayName=="string"&&s.displayName.length>0?s.displayName:s.providerId,permissionGroupName:typeof s.permissionGroupName=="string"?s.permissionGroupName:null});else o++}if(new Set(i.map((s)=>s.accessBindingId)).size!=i.length)return p();return{accessRevision:t,...o==0?{}:{discardedBindingCount:o},...r==null?{}:{providerIds:r},bindings:i,mode:tu(n.mode),sharedAccessDigest:f(n.sharedAccessDigest),version:1}}function qy(e){if(!Array.isArray(e))return p();let n=e.map((t)=>{let r=x(t);Xe(r,["accessBindingId","connectionId","providerId","source","connectionDisplayName",..."permissionGroupName"in r?["permissionGroupName"]:[]]);let o;try{o=Fi(r.source)}catch{return p()}if(r.permissionGroupName!=null&&typeof r.permissionGroupName!="string")return p();return{accessBindingId:f(r.accessBindingId),connectionId:f(r.connectionId),providerId:f(r.providerId),source:o,connectionDisplayName:f(r.connectionDisplayName),..."permissionGroupName"in r?{permissionGroupName:r.permissionGroupName}:{}}});if(new Set(n.map((t)=>t.accessBindingId)).size!=n.length)return p();return n}function ru(e){let n=x(e);if(Xe(n,["mode","sharedAccessDigest","sharedBindings","selectedBindings","version"]),n.version!=2)return p();let t=tu(n.mode),r=qy(n.sharedBindings),o=qy(n.selectedBindings);if(t=="implicit"&&(r.length>0||o.length>0))return p();return{mode:t,sharedAccessDigest:f(n.sharedAccessDigest),sharedBindings:r,selectedBindings:o,version:2}}function OI(e,n){let t=x(e);if(Xe(t,["candidates","mode","providerId","version"]),t.version!=1)return p("version: expected 1.");if(f(t.providerId)!=n)return p("providerId: does not match the requested provider.");if(!Array.isArray(t.candidates))return p("candidates: expected an array.");let r=t.candidates.map((o)=>My(o,!0));if(r.some((o)=>o.providerId!=n))return p("candidates[].providerId: does not match the requested provider.");if(new Set(r.map((o)=>o.accessBindingId)).size!=r.length)return p("candidates[].accessBindingId: duplicate IDs.");return{candidates:r,mode:tu(t.mode),providerId:n,version:1}}function Fy(e,n){let t=x(e);if(Xe(t,["results","version"]),t.version!=1)return p("version: expected 1.");if(!Array.isArray(t.results))return p("results: expected an array.");let r=new Set(n),o=t.results.map((i)=>{let s=x(i),a=f(s.providerId);if(!r.delete(a))return p("results[].providerId: duplicate or unrequested provider.");if(!Object.hasOwn(s,"error"))return OI(s,a);Xe(s,["providerId","error"]);let c=x(s.error);return Xe(c,["code","message"]),{providerId:a,error:{code:f(c.code),message:f(c.message)}}});if(r.size!=0)return p("results: missing requested providers.");return{results:o,version:1}}function zt(e){let n=x(e);if(H(n,[...Object.hasOwn(n,"providerAccountId")?["providerAccountId"]:[],...Object.hasOwn(n,"alias")?["alias"]:[],...Object.hasOwn(n,"builtInAccount")?["builtInAccount"]:[],"connectionId","displayName","isDefault","serviceId","status"]),n.builtInAccount!==void 0&&typeof n.builtInAccount!="boolean")return p();let t=n.status;if(t!="active"&&t!="disconnected"&&t!="error"&&t!="reauth_required")return p();if(typeof n.isDefault!="boolean")return p();return{...n.providerAccountId===void 0?{}:{providerAccountId:f(n.providerAccountId)},...n.alias===void 0?{}:{alias:f(n.alias)},...n.builtInAccount===void 0?{}:{builtInAccount:n.builtInAccount},connectionId:f(n.connectionId),displayName:f(n.displayName),isDefault:n.isDefault,serviceId:f(n.serviceId),status:t}}function Zy(e,n=!1){let t=x(e),r=t.description,o=n&&Object.hasOwn(t,"value");if(H(t,["jsonSchema","nullable",...r==null?[]:["description"],...o?["value"]:[]]),r!=null&&typeof r!="string")return p();if(typeof t.nullable!="boolean")return p();return{...r==null?{}:{description:r},jsonSchema:be(t.jsonSchema),nullable:t.nullable,...o?{value:be(t.value)}:{}}}function jI(e){return Zy(e,!0)}function Ly(e,n){return Object.fromEntries(Object.entries(x(e)).map(([t,r])=>[t,n(r)]))}function _I(e){let n=x(e),{homepageUrl:t,icon:r}=n;if(H(n,["actionId",...Object.hasOwn(n,"operationType")?["operationType"]:[],...Object.hasOwn(n,"inputSchema")?["inputSchema"]:[],...Object.hasOwn(n,"outputSchema")?["outputSchema"]:[],"authenticated","description",...t==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in n?["iconSprite"]:[],..."iconSpritePosition"in n?["iconSpritePosition"]:[],"inputs","name","outputs","serviceId","serviceName"]),t!=null&&typeof t!="string"||r!=null&&typeof r!="string")return p();return{...n.inputSchema===void 0?{}:{inputSchema:be(n.inputSchema)},...n.outputSchema===void 0?{}:{outputSchema:be(n.outputSchema)},actionId:f(n.actionId),...n.operationType==null?{}:{operationType:f(n.operationType)},authenticated:typeof n.authenticated=="boolean"?n.authenticated:p(),description:typeof n.description=="string"?n.description:p(),...t==null?{}:{homepageUrl:t},...r==null?{}:{icon:r},...qi(n.iconSprite,n.iconSpritePosition),inputs:Ly(n.inputs,jI),name:f(n.name),outputs:Ly(n.outputs,Zy),serviceId:f(n.serviceId),serviceName:f(n.serviceName)}}function Zi(e){let{defaultConnection:n,...t}=x(e),r=_I(t);if(n==null)return r;let o=zt(n);if(o.serviceId!=r.serviceId||o.status!="active")return p();return{...r,defaultConnection:o}}function Jy(e){let n=x(e),{homepageUrl:t,icon:r}=n;if(n.noSetup!==void 0&&typeof n.noSetup!="boolean")return p();if(H(n,[...Object.hasOwn(n,"noSetup")?["noSetup"]:[],"serviceId","serviceName",...t==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in n?["iconSprite"]:[],..."iconSpritePosition"in n?["iconSpritePosition"]:[]]),t!=null&&typeof t!="string"||r!=null&&typeof r!="string")return p();return{...t==null?{}:{homepageUrl:t},...r==null?{}:{icon:r},...qi(n.iconSprite,n.iconSpritePosition),serviceId:f(n.serviceId),serviceName:f(n.serviceName),...n.noSetup===void 0?{}:{noSetup:n.noSetup}}}function ou(e){return{actionId:e.actionId,authenticated:e.authenticated,...e.defaultConnection==null?{}:{defaultConnection:{connectionId:e.defaultConnection.connectionId,displayName:e.defaultConnection.displayName,status:e.defaultConnection.status}},description:e.description,name:e.name,serviceId:e.serviceId,serviceName:e.serviceName}}var Dt=j().min(1).max(256),By=E({appId:Dt.nullable(),workspaceId:Dt.optional(),installationId:Dt.optional(),organizationId:Dt.optional(),projectId:Dt.optional(),projectKey:Dt.optional(),subscriptionStatus:W(["idle","pending","ready","error"]).optional(),lastError:j().optional(),signingSecretConfigured:me().optional(),manageSubscriptions:me().nullable(),verificationTokenConfigured:me().nullable(),encryptKeyConfigured:me().nullable(),verifiedAt:j().nullable()});var qt=j().min(1).max(256),PI=j().regex(/^[a-z][a-z0-9_.:]{0,127}$/),TI=j().trim().min(1).max(128),Ky=E({version:w(1),sourceId:qt,revision:we().positive(),name:TI,provider:W(["feishu","feishu_app_bot","slackbot","intercom","sentry","zoom","fireflies","jira"]),...By.shape,connectionId:qt,teamId:qt.nullable(),enabled:me(),eventTypes:A(PI),endpointUrl:j().nullable(),lastReceivedAt:j().nullable(),updatedAt:j(),consumers:A(E({flowId:qt,flowName:j(),triggerNodeId:qt}))});function Ji(e){return Ky.parse(e)}function iu(e){return E({version:w(1),sources:A(Ky),teamId:qt.nullable().optional()}).parse(e)}function su(e){let n=x(e);if(H(n,["version","locale","definitions","display"]),n.version!=3||!zu(n.locale)||!Array.isArray(n.definitions))return p();let t=n.definitions.map(Jr),r=x(n.display),o=new Set(t.map((s)=>s.key));if(o.size!=t.length||Object.keys(r).length!=o.size)return p();let i=Object.fromEntries(t.map((s)=>{let{key:a}=s,c=x(r[a]);return H(c,["configInputs","configInputLabels","displayName","description","outputs"]),[a,{configInputs:Wy(c.configInputs,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),configInputLabels:$I(c.configInputLabels,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),displayName:f(c.displayName),description:f(c.description),outputs:Wy(c.outputs,s.outputs.map((l)=>l.handle))}]}));return{version:3,locale:n.locale,definitions:t,display:i}}function Wy(e,n){let t=x(e);return Xe(t,n),Object.fromEntries(Object.entries(t).map(([r,o])=>[r,f(o)]))}function $I(e,n){let t=x(e);if(Object.keys(t).some((r)=>!n.includes(r)))return p();return Object.fromEntries(Object.entries(t).map(([r,o])=>{let i=f(o);return i.trim().length==0?p():[r,i]}))}function au(e,n){if(n==null)return e;let t=n.toLowerCase();return e.filter((r)=>[r.description,r.displayName,r.key,r.name,r.provider,r.type].some((o)=>o.toLowerCase().includes(t)))}var NI=v({pointer:j().max(4096).default(""),offset:ne().int().nonnegative().default(0),limit:ne().int().min(1).max(100).default(20),maxBytes:ne().int().min(1).max(1048576).default(15000)});var zI=$e(),Gy=E({pointer:j(),type:W(["object","array","string","number","boolean","null"]),length:ne().int().nonnegative().optional(),complete:me(),value:zI.optional()}),DI=Gy.extend({offset:ne().int().nonnegative(),nextOffset:ne().int().positive().optional(),entries:A(Gy).optional()}),Hy=E({resultId:j().min(1),callId:j().min(1),toolId:j().min(1),source:on("kind",[E({kind:w("connector"),action:j().min(1)}),E({kind:w("code")}),E({kind:w("workflow"),flowId:j().min(1)})]),bytes:ne().int().nonnegative(),digest:j().regex(/^[a-f0-9]{64}$/),createdAt:j().datetime()}),qI=E({version:w(1),runId:j(),results:A(Hy),nextAfter:j().optional()}),LI=E({version:w(1),runId:j(),result:Hy,page:DI});function cu(e){return qI.parse(e)}function lu(e){return LI.parse(e)}function Qy(e){if(!Array.isArray(e))return p();return e.map((n)=>typeof n=="string"||Number.isSafeInteger(n)?n:p())}function VI(e){let n=x(e),t=f(n.kind);if(t=="artifact"||t=="binary"||t=="nullable")return{kind:t};if(t=="schema")return{kind:t,path:n.path==null?void 0:Qy(n.path)};if(t!="keyword"||typeof n.keyword!="string"||!xi(n.keyword))return p();return{kind:t,keyword:n.keyword,path:Qy(n.path),source:n.source===void 0?void 0:be(n.source),target:n.target===void 0?void 0:be(n.target)}}function MI(e){let n=x(e),t=n.values==null?void 0:x(n.values);return{code:f(n.code),column:ce(n.column),...n.fields===void 0?{}:{fields:Array.isArray(n.fields)?n.fields.map(f):p()},line:ce(n.line),message:f(n.message),mismatch:n.mismatch==null?void 0:VI(n.mismatch),path:typeof n.path=="string"?n.path:p(),...t==null?{}:{values:Object.fromEntries(Object.entries(t).map(([r,o])=>[r,typeof o=="string"||typeof o=="number"?o:p()]))}}}function Yy(e){let n=x(e);if(n.version!=1||typeof n.valid!="boolean"||!Array.isArray(n.diagnostics))return p();return{closureDigest:f(n.closureDigest),diagnostics:n.diagnostics.map(MI),engineContract:f(n.engineContract),flowId:f(n.flowId),modelVersion:ce(n.modelVersion),revisionDigest:f(n.revisionDigest),revisionId:f(n.revisionId),valid:n.valid,version:1}}var Xy=(e)=>e==null?"":`?flowId=${encodeURIComponent(e)}`;function eb(e,n){let t=new URLSearchParams({...e==null?{}:{flowId:e},...n==null?{}:{locale:n}}).toString();return{path:`/v1/connector/providers${t?`?${t}`:""}`,decode:(r)=>{let o=x(r);if(H(o,["providers","version"]),o.version!=1||!Array.isArray(o.providers))return p();return o.providers.map(Jy)}}}function nb(e,n,t){let r=new URLSearchParams({...n==null?{}:{flowId:n},...t==null?{}:{locale:t}}).toString();return{path:`/v1/connector/actions/${encodeURIComponent(e)}${r?`?${r}`:""}`,decode:(o)=>{let i=x(o);if(H(i,["action","version"]),i.version!=1)return p();return Zi(i.action)}}}function tb(e){return{path:`/v1/connector/connections${Xy(e)}`,decode:(n)=>{let t=x(n);if(H(t,["connections","version"]),t.version!=1||!Array.isArray(t.connections))return p();return t.connections.map(zt)}}}function rb(e,n){return{path:`/v1/connector/connections/${encodeURIComponent(e)}${Xy(n)}`,decode:(t)=>{let r=x(t);if(H(r,["connections","serviceId","version"]),r.version!=1||f(r.serviceId)!=e||!Array.isArray(r.connections))return p();return r.connections.map(zt)}}}function Ui(e){return Array.isArray(e)?e.map(f):p()}function FI(e){let n=x(e),t=n.draft===null?null:x(n.draft),r=x(n.sharedAccess);if(t!=null&&!Array.isArray(t.connections))return p();if(!Array.isArray(r.bindings))return p();let o=ce(r.accessRevision);if(o<0)return p();return{draft:t==null?null:{...t.calledFlowIds===void 0?{}:{calledFlowIds:Ui(t.calledFlowIds)},variableNames:Ui(t.variableNames),errorSourceFlowIds:Ui(t.errorSourceFlowIds),connections:t.connections.map((i)=>{let s=x(i);return{providerId:f(s.providerId),connectionId:f(s.connectionId)}})},sharedAccess:{accessRevision:o,providerIds:Ui(r.providerIds),bindings:r.bindings.map((i)=>{let s=x(i);return{providerId:f(s.providerId),connectionId:s.connectionId===null?null:f(s.connectionId),accessBindingId:f(s.accessBindingId)}})}}}function Sn(e){let n=x(e),t=n.status;if(n.version!=1)return p();if(t!="active"&&t!="retiring")return p();let r=n.live==null?void 0:x(n.live);if(r!=null&&(typeof r.enabled!="boolean"||typeof r.hasStart!="boolean"))return p();return{...r==null?{}:{live:{enabled:r.enabled,hasStart:r.hasStart,publicationId:f(r.publicationId),revisionId:f(r.revisionId)}},createdAt:f(n.createdAt),...n.connectorTeamId==null?{}:{connectorTeamId:f(n.connectorTeamId)},draftRevisionId:f(n.draftRevisionId),resourceReferences:FI(n.resourceReferences),flowId:f(n.flowId),name:f(n.name),status:t,updatedAt:f(n.updatedAt),version:1}}function ZI(e){let n=x(e),t=ce(n.referenceCount);if(t<0)return p();return{...Sn(n),referenceCount:t}}function ob(e){let n=x(e);if(n.version!=1||!Array.isArray(n.flows))return p();let{nextCursor:t,total:r}=n;if(t!=null&&typeof t!="string")return p();if(r!=null&&!Number.isSafeInteger(r))return p();return{...t==null?{}:{nextCursor:t},flows:n.flows.map(ZI),...r==null?{}:{total:r},version:1}}function Bi(e){let n=x(e);if(H(n,["name","updatedAt","value","version"]),n.version!=1||typeof n.value!="string")return p();let t=f(n.updatedAt);try{if(new Date(t).toISOString()!=t)return p()}catch{return p()}return{name:f(n.name),updatedAt:t,value:n.value,version:1}}function ib(e){let n=x(e),{referenceCount:t,...r}=n,o=ce(t);if(o<0)return p();return{...Bi(r),referenceCount:o}}function sb(e){let n=x(e);if(typeof n.enabled!="boolean")return p();return{flowId:f(n.flowId),flowName:f(n.flowName),nodeId:f(n.nodeId),nodeName:f(n.nodeName),enabled:n.enabled}}function ab(e){let n=x(e);if(H(n,["version","references"]),n.version!=1||!Array.isArray(n.references))return p();return{version:1,references:n.references.map((t)=>{let r=x(t);if(H(r,["flowId","flowName","draft","live"]),typeof r.draft!="boolean")return p();let o=r.live===null?null:x(r.live);if(o!=null){if(H(o,["publicationId","enabled"]),typeof o.enabled!="boolean")return p()}return{flowId:f(r.flowId),flowName:f(r.flowName),draft:r.draft,live:o==null?null:{publicationId:f(o.publicationId),enabled:o.enabled}}})}}function cb(e){let n=x(e),t=n.parentRevisionId;if(n.version!=1||t!==null&&typeof t!="string")return p();return{actorId:f(n.actorId),createdAt:f(n.createdAt),digest:f(n.digest),flowId:f(n.flowId),modelVersion:ce(n.modelVersion),parentRevisionId:t,revisionId:f(n.revisionId),version:1}}function Kr(e){let n=x(e);try{return{...cb(n),content:Pt(n.content)}}catch{return p()}}function Ki(e){let n=x(e);if(n.version!=1||ce(n.revision)<1)return p();return{revision:ce(n.revision),updatedAt:f(n.updatedAt),value:Object.fromEntries(Object.entries(x(n.value)).map(([t,r])=>[t,be(r)])),version:1}}function Wr(e){let n=x(e);if(n.version!=1)return p();return{revision:cb(n.revision),version:1}}function lb(e){let n=x(e);if(n.version!=1||n.kind!="snapshot")return p();return{draft:Kr(n.draft),kind:"snapshot",version:1}}var JI=["canceled","completed","failed","indeterminate"],Wi=[...JI,"queued","running","starting","waiting"];var UI=new Set(Wi);function Gi(e){return typeof e=="string"&&UI.has(e)?e:p()}function pb(e){let n=x(e),{source:t,startedAt:r,finishedAt:o}=n;if(n.version!=1||t!="draft"&&t!="live")return p();if(r!=null&&typeof r!="string")return p();if(o!=null&&typeof o!="string")return p();return{createdAt:f(n.createdAt),...o==null?{}:{finishedAt:o},flowId:f(n.flowId),revisionId:f(n.revisionId),runId:f(n.runId),source:t,...r==null?{}:{startedAt:r},status:Gi(n.status),version:1}}function BI(e){let n=x(e);H(n,["actions","expiresAt","nodeId","prompt","waitId","waitingSince"]);let t=n.actions;if(!Array.isArray(t)||!(t.length==1&&t[0]=="continue"||t.length==2&&t[0]=="approve"&&t[1]=="reject"))return p();return{actions:t,...n.autoContinueAt===void 0?{}:{autoContinueAt:f(n.autoContinueAt)},expiresAt:f(n.expiresAt),nodeId:f(n.nodeId),prompt:f(n.prompt),waitId:f(n.waitId),waitingSince:f(n.waitingSince)}}function ub(e){let n=x(e);return{flowId:f(n.flowId),runId:f(n.runId),nodeId:f(n.nodeId),executionId:f(n.executionId),...n.callId==null?{}:{callId:f(n.callId)}}}function KI(e){let n=x(e);if(!["workbench","cli","mcp","api","trigger","workflow"].includes(n.channel))return p();return{channel:n.channel,...n.actorId===void 0?{}:{actorId:f(n.actorId)}}}function Hi(e){let n=x(e),t=pb(n),r=n.eventsExpiresAt;if(r!=null&&typeof r!="string")return p();if(n.waiting!==void 0||!Array.isArray(n.waits))return p();let o=n.waits.map(BI);if(new Set(o.map((a)=>a.waitId)).size!=o.length||t.status=="waiting"&&o.length==0&&(!Array.isArray(n.calls)||n.calls.length==0)||["completed","failed","canceled","indeterminate"].includes(t.status)&&o.length>0)return p();if(n.occurrenceId!==void 0&&n.triggerNodeId===void 0)return p();let i={status:t.status,waits:o};if(n.calls!==void 0&&!Array.isArray(n.calls))return p();let s={...t,...n.initiator===void 0?{}:{initiator:KI(n.initiator)},...WI(n),...n.triggerNodeId===void 0?{}:{triggerNodeId:f(n.triggerNodeId)},...n.caller===void 0?{}:{caller:ub(n.caller)},...n.calls===void 0?{}:{calls:n.calls.map((a)=>Object.assign(ub(a),{status:x(a).status===null?null:Gi(x(a).status)}))},closureDigest:f(n.closureDigest),engineContract:f(n.engineContract),engineDigest:f(n.engineDigest),...r==null?{}:{eventsExpiresAt:r},modelVersion:ce(n.modelVersion),sharedAccessDigest:f(n.sharedAccessDigest),revisionDigest:f(n.revisionDigest),...i};switch(t.source){case"draft":return{...s,source:"draft"};case"live":return{...s,publicationId:f(n.publicationId),source:"live",...n.occurrenceId===void 0?{}:{occurrenceId:f(n.occurrenceId),triggerNodeId:f(n.triggerNodeId)}}}}function fb(e){let n=x(e),t=n.nextCursor;if(n.version!=1||!Array.isArray(n.runs))return p();if(t!=null&&typeof t!="string")return p();return{flowId:f(n.flowId),...t==null?{}:{nextCursor:t},runs:n.runs.map(pb),version:1}}function mb(e){let n=x(e),t=Gi(n.status);if(n.version!=1||typeof n.cancelAccepted!="boolean"||t=="queued"||t=="starting"||t=="running"||t=="waiting")return p();return{cancelAccepted:n.cancelAccepted,runId:f(n.runId),status:t,version:1}}function gb(e){let n=x(e);H(n,["action","comment","resolutionAccepted","resolvedAt","runId","status","version","waitId"]);let{action:t,resolvedAt:r}=n;if(n.version!=1||typeof n.resolutionAccepted!="boolean"||n.comment!==null&&typeof n.comment!="string"||t!==null&&t!="approve"&&t!="continue"&&t!="reject"||r!==null&&typeof r!="string"||t===null!=(r===null)||n.resolutionAccepted&&t===null)return p();return{action:t,comment:n.comment,resolutionAccepted:n.resolutionAccepted,resolvedAt:r,runId:f(n.runId),status:Gi(n.status),version:1,waitId:f(n.waitId)}}function hb(e){let n=x(e),t=n.status;if(n.version!=1)return p();let r={finishedAt:f(n.finishedAt),runId:f(n.runId),version:1};if(t=="completed"){if(!Object.hasOwn(n,"result"))return p();return{...r,result:n.result,status:"completed"}}if(t=="canceled")return{...r,status:"canceled"};if(t=="failed"){let o=x(n.error);return{...r,error:db(o),status:"failed"}}if(t=="indeterminate"){let o=x(n.error);return{...r,error:db(o),status:"indeterminate"}}return p()}function WI(e){let n=e.errorSource==null?void 0:x(e.errorSource);if(e.errorDispatches!=null&&!Array.isArray(e.errorDispatches))return p();return{...n==null?{}:{errorSource:{flowId:f(n.flowId),runId:f(n.runId)}},...e.errorDispatches==null?{}:{errorDispatches:e.errorDispatches.map((t)=>{let r=x(t),o=f(r.flowId);switch(r.status){case"pending":return{status:"pending",flowId:o};case"dispatched":return{status:"dispatched",flowId:o,runId:f(r.runId)};case"failed":return{status:"failed",flowId:o,message:f(r.message)};default:return p()}})}}}function db(e){return{code:f(e.code),message:f(e.message),...e.nodeId===void 0?{}:{nodeId:f(e.nodeId)},...e.jobId===void 0?{}:{jobId:f(e.jobId)},...e.path===void 0?{}:{path:(Array.isArray(e.path)?e.path:p()).map(f)}}}function Qi(){let e=globalThis.crypto;if(e!=null){try{if(typeof e.randomUUID=="function")return e.randomUUID()}catch{}if(typeof e.getRandomValues=="function"){let n=e.getRandomValues(new Uint8Array(16));n[6]=(n[6]??0)&15|64,n[8]=(n[8]??0)&63|128;let t=Array.from(n,(r)=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function bb(e){return e?.kind=="run.completed"||e?.kind=="run.failed"||e?.kind=="run.canceled"||e?.kind=="run.indeterminate"}function GI(e){let n=x(e),t=ce(n.sequence);if(t<0)return p();let r={createdAt:f(n.createdAt),sequence:t},o=x(n.payload),i=n.kind;switch(i){case"run.queued":return{...r,kind:i,payload:{}};case"run.started":return{...r,kind:i,payload:{flowId:f(o.flowId),scopeId:f(o.scopeId),...o.parentScopeId===void 0?{}:{parentScopeId:f(o.parentScopeId)}}};case"run.progress":return{...r,kind:i,payload:{flowId:f(o.flowId),scopeId:f(o.scopeId),progress:yb(o.progress)}};case"run.waiting":if(!Array.isArray(o.waitIds))return p();return{...r,kind:i,payload:{waitIds:o.waitIds.map((s)=>f(s))}};case"wait.created":{let s=o.autoContinueAt===void 0?{}:{autoContinueAt:f(o.autoContinueAt)};return{...r,kind:i,payload:{...s,expiresAt:f(o.expiresAt),nodeId:f(o.nodeId),waitId:f(o.waitId),waitingSince:f(o.waitingSince)}}}case"run.resolved":{let{action:s,source:a}=o;if(a!==void 0&&a!=="manual"&&a!=="automatic")return p();let c=a===void 0?{}:{source:a};if(s!=="approve"&&s!=="continue"&&s!=="reject")return p();if(o.comment!==null&&typeof o.comment!="string")return p();return{...r,kind:i,payload:{...c,action:s,comment:o.comment,resolvedAt:f(o.resolvedAt),waitId:f(o.waitId)}}}case"run.completed":case"run.canceled":case"run.failed":case"run.indeterminate":return{...r,kind:i,payload:{result:be(o.result)}};case"run.events-truncated":return{...r,kind:i,payload:Object.fromEntries(Object.entries(o).map(([s,a])=>[s,be(a)]))};case"node.started":case"node.completed":case"node.failed":case"node.log":case"node.progress":case"node.artifact":{let s={flowId:f(o.flowId),scopeId:f(o.scopeId),nodeId:f(o.nodeId),executionId:f(o.executionId)};switch(i){case"node.started":{let a=o.nodeKind;if(a!==void 0&&a!=="approval"&&a!=="condition"&&a!=="connector"&&a!=="javascript"&&a!=="decision"&&a!=="openapi"&&a!=="http-request"&&a!=="llm"&&a!=="agent"&&a!=="value"&&a!=="outputs"&&a!=="webhook-response"&&a!=="workflow"&&a!=="wait")return p();return{...r,kind:i,payload:{...s,...a===void 0?{}:{nodeKind:a},...o.nodeTitle===void 0?{}:{nodeTitle:f(o.nodeTitle)},...o.operation===void 0?{}:{operation:f(o.operation)}}}}case"node.completed":return{...r,kind:i,payload:{...s,...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(x(o.systemOutputs)).map(([a,c])=>[a,be(c)]))},outputs:Object.fromEntries(Object.entries(x(o.outputs)).map(([a,c])=>[a,be(c)]))}};case"node.failed":{let a=x(o.error);return{...r,kind:i,payload:{...s,...o.handled===!0?{handled:!0}:{},...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(x(o.systemOutputs)).map(([c,l])=>[c,be(l)]))},error:{code:f(a.code),message:f(a.message)}}}}case"node.log":{let a=o.level;if(a!=="debug"&&a!=="info"&&a!=="warn"&&a!=="error")return p();return{...r,kind:i,payload:{...s,level:a,message:f(o.message)}}}case"node.progress":return{...r,kind:i,payload:{...s,progress:yb(o.progress)}};case"node.artifact":{let a=x(o.artifact),c=ce(a.size),l=f(a.digest);if(a.kind!="artifact"||c<0||!/^sha256:[0-9a-f]{64}$/.test(l))return p();return{...r,kind:i,payload:{...s,artifact:{kind:"artifact",id:f(a.id),name:f(a.name),size:c,digest:l,...a.mediaType===void 0?{}:{mediaType:f(a.mediaType)}}}}}}}default:return p()}}function yb(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=100?e:p()}function HI(e){let n=x(e),t=n.eventsExpiresAt,r=ce(n.nextAfter);if(n.version!=1||!Array.isArray(n.events)||typeof n.done!="boolean"||typeof n.historyComplete!="boolean")return p();if(t!=null&&typeof t!="string")return p();if(r<0)return p();return{done:n.done,events:n.events.map(GI),...t==null?{}:{eventsExpiresAt:t},historyComplete:n.historyComplete,nextAfter:r,runId:f(n.runId),version:1}}var _=encodeURIComponent;function nt(e){return`${e}-${Qi()}`}class uu{constructor(e,n="api"){this.channel=n,this.requestControl=e}async loadOpenApiDocument(e,n){let t=x(await this.request("/v1/openapi/document",{method:"POST",body:JSON.stringify({url:e,version:1}),signal:n}));if(t.version!=1)return p();return be(t.document)}async listFlows(e={}){let n=new URLSearchParams;if(e.cursor!=null)n.set("cursor",e.cursor);if(e.limit!=null)n.set("limit",String(e.limit));if(e.includeTotal!=null)n.set("includeTotal",String(e.includeTotal));let t=n.size==0?"":`?${n}`;return ob(await this.request(`/v1/flows${t}`,e.signal==null?void 0:{signal:e.signal}))}async listEventSources(e,n){return iu(await this.request("/v1/event-sources"+(e==null?"":`?flowId=${_(e)}`),{signal:n}))}async listEventSourceConnections(e,n,t="feishu"){let r=x(await this.request(`/v1/event-sources/connections?kind=${t}${e==null?"":`&teamId=${_(e)}`}`,{signal:n}));if(H(r,["version","connections"]),r.version!=1||!Array.isArray(r.connections))return p();return r.connections.map(zt)}async createEventSource(e){return Ji(await this.request("/v1/event-sources",{method:"POST",body:JSON.stringify(e)}))}async updateEventSource(e,n){return Ji(await this.request(`/v1/event-sources/${_(e)}`,{method:"PUT",body:JSON.stringify(n)}))}async deleteEventSource(e,n){await this.request(`/v1/event-sources/${_(e)}`,{method:"DELETE",body:JSON.stringify({version:1,expectedRevision:n})})}async listVariables(){let e=x(await this.request("/v1/variables"));if(H(e,["variables","version"]),e.version!=1||!Array.isArray(e.variables))return p();return{variables:e.variables.map(ib),version:1}}async getFlowReferences(e,n={}){let t=new URLSearchParams({direction:n.direction??"incoming",offset:String(n.offset??0),limit:String(n.limit??50)});return zh.parse(await this.request(`/v1/flows/${_(e)}/references?${t}`,{signal:n.signal}))}async getWorkflowContract(e,n){return Nh.parse(await this.request(`/v1/flows/${_(e)}/call-contract`,{signal:n}))}async getVariableReferences(e,n){return ab(await this.request(`/v1/variables/${_(e)}/references`,{signal:n}))}async getVariable(e){return Bi(await this.request(`/v1/variables/${_(e)}`))}async putVariable(e,n){return Bi(await this.request(`/v1/variables/${_(e)}`,{body:JSON.stringify({value:n}),method:"PUT"}))}async deleteVariable(e){let n=x(await this.request(`/v1/variables/${_(e)}`,{method:"DELETE"}));if(H(n,["version"]),n.version!=1)return p()}async exportFlow(e){let n=await this.request(`/v1/flows/${_(e)}/export`);try{return Mi(n)}catch{return p()}}async importFlow(e,n={}){return Sn(await this.request("/v1/flows/import",{method:"POST",headers:{"Idempotency-Key":n.idempotencyKey??`flow-${Qi()}`},body:JSON.stringify({file:e,name:n.name,teamId:n.teamId,version:1})}))}async createFlow(e,n=`flow-${Qi()}`,t){return Sn(await this.request("/v1/flows",{body:JSON.stringify({name:e,...t==null?{}:{teamId:t},version:1}),headers:{"idempotency-key":n},method:"POST"}))}async broadcastCanvas(e,n){let t=x(await this.request(`/v1/flows/${_(e)}/canvas`,{method:"POST",body:JSON.stringify({version:1,command:n})}));if(H(t,["version","flowId","broadcast"]),t.version!=1||t.broadcast!==!0||t.flowId!==e)return p();return{version:1,flowId:f(t.flowId),broadcast:!0}}async getFlow(e){return Sn(await this.request(`/v1/flows/${_(e)}`))}async getErrorListeners(e,n){let t=x(await this.request(`/v1/flows/${_(e)}/error-listeners`,{signal:n}));if(t.version!=1||!Array.isArray(t.listeners))return p();return t.listeners.map(sb)}async renameFlow(e,n){return Sn(await this.request(`/v1/flows/${_(e)}`,{body:JSON.stringify({name:n,version:1}),method:"PATCH"}))}async deleteFlow(e){return Sn(await this.request(`/v1/flows/${_(e)}`,{method:"DELETE"}))}async listTriggerKeys(e,n){let t=x(await this.request(`/v1/trigger-keys${n==null?"":`?locale=${encodeURIComponent(n)}`}`,{signal:e}));if(t.version!=1||!Array.isArray(t.keys))return p();return t.keys.map(Ql)}async listTriggerDefinitions(e){let n=x(await this.request("/v1/trigger-keys/catalog",{signal:e}));if(n.version!=2||!Array.isArray(n.definitions))return p();return n.definitions.map(Jr)}async readCatalog(e,n,t){let r=new Headers;if(n)r.set("if-none-match",n);let o=await this.response(e.path,{headers:r,signal:t},!0),i=o.headers.get("etag")?.trim()||null;if(o.status==304)return{modified:!1,etag:i};return{modified:!0,data:e.decode(await o.json()),etag:i}}async getTriggerCatalog(e,n,t){let r=new Headers;if(n?.etag)r.set("if-none-match",n.etag);let o=await this.response(`/v1/trigger-keys/catalog?locale=${encodeURIComponent(e)}`,{headers:r,signal:t},!0);if(o.status==304){if(n==null)return p();return{...n,etag:o.headers.get("etag")?.trim()||n.etag}}return{data:su(await o.json()),etag:o.headers.get("etag")?.trim()||null}}async getTriggerKey(e,n){let t=x(await this.request(`/v1/trigger-keys/${_(e)}`,{signal:n}));if(t.version!=1)return p();return Jr(t.definition)}async listFlowTriggerBindings(e,n){let t=x(await this.request(`/v1/flows/${_(e)}/triggers`,{signal:n}));if(t.version!=1||f(t.flowId)!=e||!Array.isArray(t.bindings))return p();return t.bindings.map(Ur)}async getFlowTriggerBinding(e,n){return Iy(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}`))}async listFlowTriggerActivities(e,n,t={}){let r=new URLSearchParams;if(t.cursor!=null)r.set("cursor",t.cursor);if(t.limit!=null)r.set("limit",String(t.limit));let o=r.size==0?"":`?${r}`;return Cy(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}/activities${o}`))}async testFlowPollTrigger(e,n){return Ey(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}/test`,{body:JSON.stringify({version:1}),method:"POST"}))}async getEditor(e){let n=x(await this.request(`/v1/flows/${_(e)}/editor`));if(n.version!=1)return p();let t={flow:Sn(n.flow),draft:Kr(n.draft),live:Hl(n.live),presentation:Ki(n.presentation),version:1};if(t.flow.flowId!=e||t.draft.flowId!=e||t.live.flowId!=e||t.flow.draftRevisionId!=t.draft.revisionId)return p();return t}async getPublicationPresentation(e,n,t){let r=x(await this.request(`/v1/flows/${_(e)}/publications/${_(n)}/presentation`,{signal:t}));if(r.version!=1)return p();return{version:1,presentation:r.presentation===null?null:Ki(r.presentation)}}async getPresentation(e){return Ki(await this.request(`/v1/flows/${_(e)}/presentation`))}async getDraft(e){return Kr(await this.request(`/v1/flows/${_(e)}/draft`))}async syncDraft(e){return lb(await this.request(`/v1/flows/${_(e)}/draft/sync`))}async getRevision(e,n,t){return Kr(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}`,{signal:t}))}async listTriggerConfigOptions(e,n,t,r){let o=x(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}/options/${_(t)}`,{signal:r}));if(H(o,["options","version"]),o.version!=1||!Array.isArray(o.options)||o.options.length>1000)return p();return o.options.map((i)=>{let s=x(i);H(s,["value","label",...s.color==null?[]:["color"]]);let a=s.color==null?void 0:f(s.color);if(a!=null&&!/^#[0-9a-fA-F]{6}$/.test(a))return p();return a==null?{value:f(s.value),label:f(s.label)}:{value:f(s.value),label:f(s.label),color:a}})}async listConnectorTeams(e){let n=x(await this.request("/v1/connector/teams",{signal:e}));if(H(n,["enabled","teams","version"]),n.version!=1||typeof n.enabled!="boolean"||!Array.isArray(n.teams))return p();return{enabled:n.enabled,teams:n.teams.map((t)=>{let r=x(t);if(H(r,["id","name","systemCreated"]),typeof r.systemCreated!="boolean")return p();return{id:f(r.id),name:f(r.name),systemCreated:r.systemCreated}}),version:1}}async listConnectorProviders(e,n,t){let r=eb(n,t);return this.connectorRequest(r.path,"providers",e,r.decode)}async listLeinaBots(e,n){return Vy(await this.request(`/v1/connector/leina/bots?flowId=${_(e)}`,{signal:n}))}async removeConnectionUsage(e,n,t,r,o){return Wr(await this.request(`/v1/flows/${_(e)}/connection-usage/remove`,{method:"POST",headers:{"idempotency-key":o},body:JSON.stringify({connectionId:n,expectedRevisionId:t,expectedAccessRevision:r,version:1})}))}async getConnectorAccess(e,n){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access`,{signal:n}))}async getPublishedConnectorAccess(e,n,t){return ru(await this.request(`/v1/flows/${_(e)}/connector-access?publicationId=${_(n)}`,{signal:t}))}async listProviderAccessBindingCandidates(e,n,t){return Fy(await this.request(`/v1/flows/${_(e)}/connector-access/candidates/query`,{method:"POST",body:JSON.stringify({providerIds:n,version:1}),signal:t}),n)}async setConnectorService(e,n,t,r){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access/${_(n)}/service`,{body:JSON.stringify({expectedAccessRevision:r,version:1}),method:t?"PUT":"DELETE"}))}async addProviderAccessBinding(e,n,t,r){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access/${_(n)}`,{body:JSON.stringify({accessBindingId:t,expectedAccessRevision:r,version:1}),method:"PUT"}))}async removeProviderAccessBinding(e,n,t,r){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access/${_(n)}`,{body:JSON.stringify({accessBindingId:t,expectedAccessRevision:r,version:1}),method:"DELETE"}))}async listConnectorActions(e,n,t,r){return await this.connectorActions({...r==null?{}:{locale:r},...t==null?{}:{flowId:t},...e==null?{}:{service:e}},n)}async searchConnectorActions(e,n,t,r){return await this.connectorActions({...r==null?{}:{locale:r},...t==null?{}:{flowId:t},q:e.trim()},n)}async getConnectorAction(e,n,t,r,o=!1){let i=nb(e,t,r);return this.connectorRequest(i.path,"actions",n,i.decode,o)}async listAllConnectorConnections(e,n,t=!1){let r=tb(n);return this.connectorRequest(r.path,"connections",e,r.decode,t)}async listConnectorConnections(e,n,t,r=!1){let o=rb(e,t);return this.connectorRequest(o.path,"connections",n,o.decode,r)}async createConnectorConnectionPage(e,n,t){let r=new URLSearchParams;if(n!=null)r.set("flowId",n);if(t!=null)r.set("teamId",t);let o=x(await this.request(`/v1/connector/connections/${_(e)}/page${r.size==0?"":`?${r}`}`,{body:JSON.stringify({version:1}),method:"POST"}));if(H(o,["url","version"]),o.version!=1)return p();try{let i=new URL(f(o.url));if(i.protocol!="http:"&&i.protocol!="https:")return p();return i.href}catch{return p()}}async readAuthoring(e,n={}){return wy.parse(await this.request(`/v1/flows/${_(e)}/authoring/read`,{method:"POST",body:JSON.stringify(n)}))}async searchAuthoring(e,n){return vy.parse(await this.request(`/v1/flows/${_(e)}/authoring/search`,{method:"POST",body:JSON.stringify(n)}))}async authoringSchema(e,n){return x(await this.request(`/v1/flows/${_(e)}/authoring/schema`,{method:"POST",body:JSON.stringify(n)}))}async editAuthoring(e,n){return by.parse(await this.request(`/v1/flows/${_(e)}/authoring/edit`,{method:"POST",headers:{"idempotency-key":n.requestId},body:JSON.stringify(n)}))}async checkAuthoring(e,n){return yy.parse(await this.request(`/v1/flows/${_(e)}/authoring/check`,{method:"POST",body:JSON.stringify({revisionId:n})}))}async changeDraft(e,n,t,r=nt("change")){return Wr(await this.request(`/v1/flows/${_(e)}/draft/changes`,{body:JSON.stringify({expectedRevisionId:n,operations:t,version:1}),headers:{"idempotency-key":r},method:"POST"}))}async repairDraft(e,n,t=nt("repair")){return Wr(await this.request(`/v1/flows/${_(e)}/draft/repair`,{body:JSON.stringify({expectedRevisionId:n,version:1}),headers:{"idempotency-key":t},method:"POST"}))}async upgradeDraft(e,n,t={}){return Wr(await this.request(`/v1/flows/${_(e)}/draft/upgrade`,{body:JSON.stringify({expectedRevisionId:n,version:1}),headers:{"idempotency-key":t.idempotencyKey??nt("upgrade")},method:"POST"}))}async checkFlow(e,n){return Yy(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}/check`,{body:JSON.stringify({engineContract:at,version:1}),method:"POST"}))}async getLiveDetails(e,n){let t=jy(await this.request(`/v1/flows/${_(e)}/live/details`,{signal:n}));if(t.flowId!=e)return p();return t}async getLive(e,n){return Hl(await this.request(`/v1/flows/${_(e)}/live`,{signal:n}))}async listPublications(e,n={},t){let r=new URLSearchParams;if(n.cursor!=null)r.set("cursor",n.cursor);if(n.limit!=null)r.set("limit",String(n.limit));if(n.includeTotal!=null)r.set("includeTotal",String(n.includeTotal));let o=r.size==0?"":`?${r}`;return ky(await this.request(`/v1/flows/${_(e)}/publications${o}`,{signal:t}))}async createDraftRun(e,n,t){let r=Hi(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}/runs`,{body:JSON.stringify({engineContract:at,inputs:t.inputs??{},trigger:t.trigger,version:2}),headers:{"idempotency-key":t.idempotencyKey??nt("run"),"x-open-flow-client":this.channel},method:"POST"}));return r.source=="draft"?r:p()}async createLiveRun(e,n){let t=Hi(await this.request("/v1/runs",{body:JSON.stringify({inputs:n.inputs??{},trigger:n.trigger,publicationId:e,version:2}),headers:{"idempotency-key":n.idempotencyKey??nt("run"),"x-open-flow-client":this.channel},method:"POST"}));return t.source=="live"?t:p()}async setFlowEnabled(e,n,t){return Sn(await this.request(`/v1/flows/${_(e)}/enabled`,{method:"PUT",body:JSON.stringify({enabled:t,expectedPublicationId:n,version:1})}))}async publishFlow(e,n,t,r={}){return Gl(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}/publications`,{body:JSON.stringify({engineContract:at,expectedLivePublicationId:t,version:1}),headers:{"idempotency-key":r.idempotencyKey??nt("publication")},method:"POST"}))}async getPublishOperation(e,n,t){return Gl(await this.request(`/v1/flows/${_(e)}/publish-operations/${_(n)}`,{signal:t}))}async rollbackFlow(e,n,t,r={}){return $t(await this.request(`/v1/flows/${_(e)}/publications/${_(n)}/rollback`,{body:JSON.stringify({expectedLivePublicationId:t,version:1}),headers:{"idempotency-key":r.idempotencyKey??nt("publication")},method:"POST"}))}async getRun(e,n){return Hi(await this.request(`/v1/runs/${_(e)}`,{signal:n}))}async listRuns(e,n={}){let t=new URLSearchParams;if(n.cursor!=null)t.set("cursor",n.cursor);if(n.limit!=null)t.set("limit",String(n.limit));if(n.status!=null)t.set("status",n.status);if(n.pendingWait!=null)t.set("pendingWait",String(n.pendingWait));if(n.source!=null)t.set("source",n.source);if(n.createdFrom!=null)t.set("createdFrom",n.createdFrom);if(n.createdBefore!=null)t.set("createdBefore",n.createdBefore);if(n.runId!=null)t.set("runId",n.runId);let r=t.size==0?"":`?${t}`;return fb(await this.request(`/v1/flows/${_(e)}/runs${r}`))}async getRunEvents(e,n={},t){let r=new URLSearchParams;if(n.after!=null)r.set("after",String(n.after));if(n.limit!=null)r.set("limit",String(n.limit));let o=r.size==0?"":`?${r}`;return HI(await this.request(`/v1/runs/${_(e)}/events${o}`,{signal:t}))}async listRunResults(e,n,t){return cu(await this.request(`/v1/runs/${_(e)}/results${n==null?"":`?after=${encodeURIComponent(n)}`}`,{signal:t}))}async readRunResult(e,n,t={},r){let o=new URLSearchParams(Object.entries(t).map(([i,s])=>[i,String(s)]));return lu(await this.request(`/v1/runs/${_(e)}/results/${_(n)}?${o}`,{signal:r}))}async downloadRunResult(e,n,t){return(await this.response(`/v1/runs/${_(e)}/results/${_(n)}/content`,{signal:t})).blob()}async getRunResult(e,n){return hb(await this.request(`/v1/runs/${_(e)}/result`,{signal:n}))}async cancelRun(e){return mb(await this.request(`/v1/runs/${_(e)}/cancel`,{body:JSON.stringify({version:1}),method:"POST"}))}async resolveRunWait(e,n,t,r){return gb(await this.request(`/v1/runs/${_(e)}/waits/${_(n)}/resolve`,{body:JSON.stringify({action:t,comment:r,version:1}),method:"POST"}))}async connectorActions(e,n){let t=Object.entries(e).map(([o,i])=>`${_(o)}=${_(i)}`).join("&"),r=t==""?"":`?${t}`;return this.connectorRequest(`/v1/connector/actions${r}`,"actions",n,(o)=>{let i=x(o);if(H(i,["actions","version"]),i.version!=1||!Array.isArray(i.actions))return p();return i.actions.map(Zi)})}async connectorRequest(e,n,t,r,o=!1){return r(await this.request(e,{signal:t}))}async response(e,n,t=!1){let r=new Headers(n.headers);if(n.body!=null)r.set("content-type","application/json");let o=await this.requestControl(e,{...n,headers:r});if(!o.ok&&!(t&&o.status==304)){let i;try{i=await o.json()}catch{return p()}let s=x(i).error,a=s==null?void 0:x(s);throw new Pe(o.status,typeof a?.code=="string"?a.code:"request.failed",typeof a?.message=="string"?a.message:`Request failed with status ${o.status}.`,a?.details==null?void 0:x(a.details))}return o}async request(e,n={}){let t=await this.response(e,n);try{return await t.json()}catch{return p()}}}import{randomUUID as tC}from"crypto";class O extends Error{constructor(e,n,t){super(n);this.code=e,this.details=t,this.name="CliError"}}function Yi(e,n){let t=e.trim();if(Vi(t)!=null)throw new O("cli.invalid-arguments",`${n} name must be between 1 and ${eu} characters and use only letters, numbers, spaces, hyphens, or underscores.`);return t}var QI=100,du=100,pu=100,YI=new Set(["canceled","completed","failed","indeterminate"]);async function XI(e){let n=[],t=new Set,r;do{let o=await e.listFlows({cursor:r,limit:QI});if(n.push(...o.flows),r=o.nextCursor,r!=null&&t.has(r))throw new O("page.invalid-cursor","The deployment returned a repeated Flow cursor.");if(r!=null)t.add(r)}while(r!=null);return n}function eC(e,n){let t=e.find((o)=>o.flowId==n);if(t!=null)return t;let r=e.filter((o)=>o.name==n);if(r.length==1)return r[0];if(r.length>1)throw new O("flow.ambiguous",`Flow name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({flowId:o,name:i})=>({flowId:o,name:i}))});throw new O("flow.not-found",`Flow ${JSON.stringify(n)} was not found.`)}async function ve(e,n){try{return await e.getFlow(n)}catch(t){if(!(t instanceof Pe)||t.code!="flow.invalid"&&t.code!="flow.not-found")throw t}return eC(await XI(e),n)}async function wb(e,n,t){if(t.expectedRevision!=null&&t.expectedRevision!=n.draftRevisionId&&!t.options.includes("idempotency-key"))throw new O("flow.revision-conflict","The Flow Draft changed. Inspect it before submitting a new mutation.",{expectedRevisionId:t.expectedRevision,actualRevisionId:n.draftRevisionId,flowId:n.flowId});let r=await e.getRevision(n.flowId,t.expectedRevision??n.draftRevisionId);return{draft:r,flow:n,graph:r.content.document.graph}}function nC(e,n){let t=e.find((o)=>o.actionId==n);if(t!=null)return t;let r=e.filter((o)=>o.name==n);if(r.length==1)return r[0];if(r.length>1)throw new O("connector.action-ambiguous",`Connector Action name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({actionId:o,name:i,serviceId:s})=>({actionId:o,name:i,serviceId:s}))});throw new O("connector.action-not-found",`Connector Action ${JSON.stringify(n)} was not found.`)}async function vb(e,n,t){try{return await e.getConnectorAction(n,void 0,t)}catch(r){if(!(r instanceof Pe)||r.status!=404)throw r}return nC(await e.searchConnectorActions(n,void 0,t),n)}function xb(e,n){let t=Object.entries(e.document.graph.nodes).filter((i)=>!("inputs"in i[1])),r=t?.find(([i])=>i==n);if(r!=null)return{trigger:r[1],triggerId:r[0]};let o=t?.filter(([,i])=>i.name==n)??[];if(o.length==1)return{trigger:o[0][1],triggerId:o[0][0]};if(o.length>1)throw new O("trigger.ambiguous",`Trigger name ${JSON.stringify(n)} is ambiguous.`,{candidates:o.map(([i,s])=>({name:s.name,triggerId:i}))});throw new O("trigger.not-found",`Trigger ${JSON.stringify(n)} was not found.`)}function fu(e){return`${e.displayName} ${e.key} ${e.provider} ${e.type}`}async function kb(e,n){try{return await e.getTriggerKey(n)}catch(o){if(!(o instanceof Pe)||o.status!=404)throw o}let r=(await e.listTriggerKeys()).filter((o)=>o.name==n||o.displayName==n);if(r.length==1)return await e.getTriggerKey(r[0].key);if(r.length>1)throw new O("trigger-key.ambiguous",`Trigger Key name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({displayName:o,key:i,provider:s})=>({displayName:o,key:i,provider:s}))});throw new O("trigger-key.not-found",`Trigger Key ${JSON.stringify(n)} was not found.`)}function Sb(e){return`${e.displayName} ${e.connectionId} ${e.serviceId} ${e.status}${e.isDefault?"\tdefault":""}`}function mu(e){return`${e.name} ${e.actionId} ${e.serviceName} ${e.serviceId}`}function pe(e,n,t){if(e.length!=n)throw new O("cli.invalid-arguments",`Usage: ${t}`)}function F(e,n,t,r){e.stdout.write(n?`${JSON.stringify(t)}
|
|
60
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function km(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!=="object")return;km(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!n.includes(s))n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Sm=new Set(["type","properties","required","additionalProperties"]),vm=["oneOf","anyOf"];function xm(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Ha(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Sm.has(s))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let l of t){let u=l.properties?.[s]??xm(l);if(u===null||u===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(u)))a.push(u)}let c=a.length===1?a[0]:Ha(a)??{allOf:a};_e(n,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:n};if(r.size)o.required=[...r];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=xm(s);if(a&&!i.some((c)=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function ex(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Sm)if(o in e)return;let n=t.filter((o)=>vm.some((i)=>Array.isArray(o[i]))),r=null;if(!n.length)r=Ha(t);else{let o=n[0],i=vm.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter((c)=>c!==o),a=o[i].map((c)=>Ha([...s,c]));if(a.some((c)=>!c))return;r={[i]:a}}if(!r)return;delete e.allOf,dr(e,r)}function gr(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){r(d);let h=e.seen.get(d),y=h.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(y);else dr(l,y);if(dr(l,u),a._zod.parent===d)for(let R in l){if(R==="$ref"||R==="allOf")continue;if(!(R in u))delete l[R]}if(y.$ref&&h.def)for(let R in l){if(R==="$ref"||R==="allOf")continue;if(R in h.def&&JSON.stringify(l[R])===JSON.stringify(h.def[R]))delete l[R]}}let g=a._zod.parent;if(g&&g!==d){r(g);let h=e.seen.get(g);if(h?.schema.$ref){if(l.$ref=h.schema.$ref,h.def)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(y in h.def&&JSON.stringify(l[y])===JSON.stringify(h.def[y]))delete l[y]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())km(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);if(d)d.push(l);else a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])ex(l)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}dr(o,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;_e(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:pr(t,"input",e.processors),output:pr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function $e(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return $e(r.element,n);if(r.type==="set")return $e(r.valueType,n);if(r.type==="lazy")return $e(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return $e(r.innerType,n);if(r.type==="intersection")return $e(r.left,n)||$e(r.right,n);if(r.type==="record"||r.type==="map")return $e(r.keyType,n)||$e(r.valueType,n);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return $e(r.in,n)||$e(r.out,n)}if(r.type==="object"){for(let o in r.shape)if($e(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if($e(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if($e(o,n))return!0;if(r.rest&&$e(r.rest,n))return!0;return!1}return!1}var Im=(e,t={})=>(n)=>{let r=fr({...n,processors:t});return de(e,r),mr(r,e),gr(r,e)},pr=(e,t,n={})=>(r)=>{let{libraryOptions:o,target:i}=r??{},s=fr({...o??{},target:i,io:t,processors:n});return de(e,s),mr(s,e),gr(s,e)};var gn=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},hn=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},Cm=(e,t)=>{gn(e,"minimum",t),hn(e,"maximum",t)},Rm=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Am=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Pm=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},Tm=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Em=(e,t)=>gn(e,"minimum",t.minimum),Om=(e,t)=>hn(e,"maximum",t.maximum),jm=(e)=>(t,n)=>{Tm(t,n.format);let[r,o]=e[n.format];gn(t,"minimum",r),hn(t,"maximum",o)},tx={greater_than:(e,t)=>gn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>hn(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Rm(e,t.value),number_format:jm(mo),bigint_format:jm(go),min_length:Em,max_length:Om,length_equals:(e,t)=>Cm(e,t.length),min_size:Em,max_size:Om,size_equals:(e,t)=>Cm(e,t.size),string_format:(e,t)=>{if(Tm(e,t.format),t.pattern)Am(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Pm(e,t.mime)};function Ie(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)tx[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)gn(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)gn(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)hn(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)hn(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Rm(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)Pm(t,o.mime);for(let i of o.patterns??[])Am(t,i);return t}var nx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rx=new Map([[va,Ws],[To,Gs]]),$m=(e)=>rx.get(e)??e,Xa=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Ie(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=nx[a]??a,o.format==="")delete o.format;if(a==="time"||u)delete o.format}if(l)o.contentEncoding=l;if(c&&c.size>0){let d=[...c].map($m);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((g)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))]}},ec=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Ie(e);o.type=u?"integer":"number";let d=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),g=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(h)o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;else if(typeof i==="number")o.minimum=i;if(g)if(h)o.maximum=c,o.exclusiveMaximum=!0;else o.exclusiveMaximum=c;else if(typeof s==="number")o.maximum=s;if(a){let y=new Set;for(let N of a)if(Number.isFinite(N)&&N!==0)y.add(Math.abs(N));else Ce(e,t,o,r,`A multipleOf divisor of ${N} cannot be represented in JSON Schema`);let[S,...R]=y;if(S!==void 0)o.multipleOf=S;if(R.length)o.allOf=[...o.allOf??[],...R.map((N)=>({multipleOf:N}))]}},tc=(e,t,n,r)=>{n.type="boolean"},nc=(e,t,n,r)=>{Ce(e,t,n,r,"BigInt cannot be represented in JSON Schema")},rc=(e,t,n,r)=>{Ce(e,t,n,r,"Symbols cannot be represented in JSON Schema")},oc=(e,t,n,r)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},ic=(e,t,n,r)=>{Ce(e,t,n,r,"Undefined cannot be represented in JSON Schema")},sc=(e,t,n,r)=>{Ce(e,t,n,r,"Void cannot be represented in JSON Schema")},ac=(e,t,n,r)=>{n.not={}},cc=(e,t,n,r)=>{},lc=(e,t,n,r)=>{},uc=(e,t,n,r)=>{Ce(e,t,n,r,"Date cannot be represented in JSON Schema")},dc=(e,t,n,r)=>{let o=e._zod.def,i=Wn(o.entries);if(i.length===0){n.not={};return}if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";n.enum=i},pc=(e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(Ce(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(Ce(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[s];else n.const=s}else{if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";if(i.every((s)=>typeof s==="boolean"))n.type="boolean";if(i.every((s)=>s===null))n.type="null";n.enum=i}},fc=(e,t,n,r)=>{Ce(e,t,n,r,"NaN cannot be represented in JSON Schema")},mc=(e,t,n,r)=>{let o=n,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},gc=(e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=Ie(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!a)return;if(a.length===0)o.not={};else if(a.length===1)o.contentMediaType=a[0];else o.anyOf=a.map((c)=>({contentMediaType:c}))},hc=(e,t,n,r)=>{n.type="boolean"},yc=(e,t,n,r)=>{Ce(e,t,n,r,"Custom types cannot be represented in JSON Schema")},bc=(e,t,n,r)=>{Ce(e,t,n,r,"Function types cannot be represented in JSON Schema")},wc=(e,t,n,r)=>{Ce(e,t,n,r,"Transforms cannot be represented in JSON Schema")},vc=(e,t,n,r)=>{Ce(e,t,n,r,"Map cannot be represented in JSON Schema")},xc=(e,t,n,r)=>{Ce(e,t,n,r,"Set cannot be represented in JSON Schema")},kc=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:a}=Ie(e);if(typeof s==="number")o.minItems=s;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=de(i.element,t,{...r,path:[...r.path,"items"]})};function hr(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return hr(t.out);if(t.type==="catch")return hr(t.innerType);return e._zod.optin}var Sc=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Ce(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)_e(o.properties,l,de(s[l],t,{...r,path:[...r.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let u=i.shape[l];if(t.io==="input"?hr(u)===void 0:u._zod.optout===void 0)c.push(l)}if(c.length>0)o.required=c;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=de(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},ii=(e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>de(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));if(i)n.oneOf=s;else n.anyOf=s},Ic=(e,t,n,r)=>{let o=e._zod.def,i=de(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=de(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},Cc=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((S,R)=>de(S,t,{...r,path:[...r.path,s,R]})),l=i.rest?de(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;while(u>0){let S=i.items[u-1];if(!(t.io==="input"?hr(S)!==void 0:S._zod.optout==="optional"))break;u--}let d=i.items.length,g=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=c,g)o.items=!1;else if(l)o.items=l;if(u>0)o.minItems=u;if(g)o.maxItems=d}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},l)o.items.anyOf.push(l);if(u>0)o.minItems=u;if(g)o.maxItems=d}else{if(o.items=c,g)o.additionalItems=!1;else if(l)o.additionalItems=l;if(u>0)o.minItems=u;if(g)o.maxItems=d}let{minimum:h,maximum:y}=Ie(e);if(typeof h==="number")o.minItems=h;if(typeof y==="number")o.maxItems=y};function Qa(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let y=e.get(t)?.def;if(!y)return t;let S=Qa(e,y,n);return S===y?t:S}for(let y of["anyOf","oneOf"]){let S=t[y];if(!Array.isArray(S))continue;let R=S.map((N)=>Qa(e,N,n));if(R.some((N,q)=>N!==S[q]))t={...t,[y]:R}}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some((y)=>y==="number"||y==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((y)=>typeof y==="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:g,...h}=t;if(h.enum)h.enum=h.enum.map((y)=>typeof y==="number"?String(y):y);else if(typeof h.const==="number")h.const=String(h.const);if(!o)return h;if(h.type="string",!i)h.pattern=(r.includes("number")?Bt:nr).source;return h}var Ya=new WeakMap;function ox(e){let t=new Map;for(let r of e.seen.values())if(r.def&&!t.has(r.schema))t.set(r.schema,r);let n=new Map;for(let r of Ya.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Qa(t,i,new Set);if(s!==i)n.set(i,s)}if(!n.size)return;for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);if(i)o.propertyNames=i}}var Ec=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,a=Ie(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let u=de(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)_e(o.patternProperties,$m(d).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=de(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let u=Ya.get(t);if(!u)u=[],Ya.set(t,u),t.deferred.push(()=>ox(t));u.push(e)}o.additionalProperties=de(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,l=t.io==="input"&&hr(i.valueType)!==void 0;if(c&&!i.partial&&!l){let u=[...c].filter((d)=>typeof d==="string"||typeof d==="number");if(u.length>0)o.required=u.map(String)}},Oc=(e,t,n,r)=>{let o=e._zod.def,i=de(o.innerType,t,r),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,n.nullable=!0;else n.anyOf=[i,{type:"null"}]},jc=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},_c=Symbol();function Nm(e,t,n,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return i=!0,null});if(!i)return JSON.parse(s);return Ce(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),_c}var Rc=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s=Nm(o.defaultValue,e,t,n,r);if(s!==_c)n.default=s},Ac=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Nm(o.defaultValue,e,t,n,r);if(s!==_c)n._prefault=s},Pc=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{Ce(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},Tc=(e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;de(s,t,r);let a=t.seen.get(e);a.ref=s},$c=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Nc=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},si=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},zc=(e,t,n,r)=>{let o=e._zod.innerType;de(o,t,r);let i=t.seen.get(e);i.ref=o},_m={string:Xa,number:ec,boolean:tc,bigint:nc,symbol:rc,null:oc,undefined:ic,void:sc,never:ac,any:cc,unknown:lc,date:uc,enum:dc,literal:pc,nan:fc,template_literal:mc,file:gc,success:hc,custom:yc,function:bc,transform:wc,map:vc,set:xc,array:kc,object:Sc,union:ii,intersection:Ic,tuple:Cc,record:Ec,nullable:Oc,nonoptional:jc,default:Rc,prefault:Ac,catch:Pc,pipe:Tc,readonly:$c,promise:Nc,optional:si,lazy:zc};function yn(e,t){if("_idmap"in e){let r=e,o=fr({...t,processors:_m}),i={};for(let c of r._idmap.entries()){let[l,u]=c;de(u,o)}let s={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[l,u]=c;mr(o,u),_e(s,l,gr(o,u))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let n=fr({...t,processors:_m});return de(e,n),mr(n,e),gr(n,e)}var zm=new WeakSet([Object.prototype,Error.prototype]);function ci(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var Dm=(e,t)=>{md.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(zm.has(n))return;zm.add(n),ci(n,"format",(r)=>(o)=>hd(r,o)),ci(n,"flatten",(r)=>(o)=>gd(r,o)),ci(n,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Gn,2)}),ci(n,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Gn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},ax=m("ZodError",Dm),Ke=m("ZodError",Dm,void 0,{Parent:Error});var qm=Xn(Ke),Vm=er(Ke),Lm=ko(Ke),Mm=So(Ke),Fm=bd(Ke),Zm=wd(Ke),Jm=vd(Ke),Um=xd(Ke),Bm=kd(Ke),Km=Sd(Ke),Wm=Id(Ke),Gm=Cd(Ke);function lx(){if(!je.localeError)Re(ja())}function Wt(){if(!je.memoizer)Re({memoizer:Tf()})}var J=m("ZodType",(e,t)=>(lx(),F.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Je(t,{checks:[...t.checks??[],...e.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ct(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Vg(e,t))},superRefine(e,t){return this.check(Lg(e,t))},overwrite(e){return this.check(wt(e))},optional(){return li(this)},exactOptional(){return vg(this)},nullable(){return ui(this)},nullish(){return li(ui(this))},nonoptional(e){return Eg(this,e)},array(){return A(this)},or(e){return Y([this,e])},and(e){return pg(this,e)},transform(e){return Dc(this,al(e))},default(e){return Sg(this,e)},prefault(e){return Cg(this,e)},catch(e){return _g(this,e)},pipe(e){return Dc(this,e)},readonly(){return Tg(this)},describe(e){let t=this.clone();return Le.add(t,{description:e}),t},meta(...e){if(e.length===0)return Le.get(this);let t=this.clone();return Le.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Yn(this,"~standard",{...wa(this),jsonSchema:{input:pr(this,"input"),output:pr(this,"output")}})},set "~standard"(e){yt(this,"~standard",e)},parse:function e(t,n){return qm(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Vm(this,t,n,{callee:e})},safeParse(e,t){return Lm(this,e,t)},async safeParseAsync(e,t){return Mm(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){yt(this,"spa",e)},validate(e,t){return _s(this,e,t)},validateAsync(e,t){return Rs(this,e,t)},encode:function e(t,n){return Fm(this,t,n,{callee:e})},decode:function e(t,n){return Zm(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Jm(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Um(this,t,n,{callee:e})},safeEncode(e,t){return Bm(this,e,t)},safeDecode(e,t){return Km(this,e,t)},async safeEncodeAsync(e,t){return Wm(this,e,t)},async safeDecodeAsync(e,t){return Gm(this,e,t)},toJSONSchema(e){return Im(this,{})(e)},get description(){return Le.get(this)?.description},get _def(){return this._zod.def}}),qc=m("_ZodString",(e,t)=>{dn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xa(e,n,r,o)},vo({format:(e)=>Ie(e).format??null,minLength:(e)=>Ie(e).minimum??null,maxLength:(e)=>Ie(e).maximum??null},{regex(...e){return this.check(Bo(...e))},includes(...e){return this.check(Go(...e))},startsWith(...e){return this.check(Ho(...e))},endsWith(...e){return this.check(Qo(...e))},min(...e){return this.check(Kt(...e))},max(...e){return this.check(lr(...e))},length(...e){return this.check(ur(...e))},nonempty(...e){return this.check(Kt(1,...e))},lowercase(e){return this.check(Ko(e))},uppercase(e){return this.check(Wo(e))},trim(){return this.check(ti())},normalize(...e){return this.check(ei(...e))},toLowerCase(){return this.check(ni())},toUpperCase(){return this.check(ri())},slugify(){return this.check(oi())}})),Vc=m("ZodString",(e,t)=>{dn.init(e,t),qc.init(e,t)},{email(e){return this.check(_a(Lc,e))},url(e){return this.check(Mo(di,e))},jwt(e){return this.check(Ga(nl,e))},emoji(e){return this.check(Na(Fc,e))},guid(e){return this.check(Ra(Mc,e))},uuid(e){return this.check(Aa(vt,e))},uuidv4(e){return this.check(Pa(vt,e))},uuidv6(e){return this.check(Ta(vt,e))},uuidv7(e){return this.check($a(vt,e))},nanoid(e){return this.check(za(Zc,e))},cuid(e){return this.check(Da(Jc,e))},cuid2(e){return this.check(qa(Uc,e))},ulid(e){return this.check(Va(Bc,e))},base64(e){return this.check(Ba(Xc,e))},base64url(e){return this.check(Ka(el,e))},xid(e){return this.check(La(Kc,e))},ksuid(e){return this.check(Ma(Wc,e))},ipv4(e){return this.check(Fa(Gc,e))},ipv6(e){return this.check(Za(Hc,e))},cidrv4(e){return this.check(Ja(Qc,e))},cidrv6(e){return this.check(Ua(Yc,e))},e164(e){return this.check(Wa(tl,e))},datetime(e){return this.check(Fo(bn,e))},date(e){return this.check(Zo(wn,e))},time(e){return this.check(Jo(vn,e))},duration(e){return this.check(Uo(xn,e))}});function j(e){return Df(Vc,e)}var ce=m("ZodStringFormat",(e,t)=>{ae.init(e,t),qc.init(e,t)}),bn=m("ZodISODateTime",(e,t)=>{Cp.init(e,t),ce.init(e,t)}),wn=m("ZodISODate",(e,t)=>{Ep.init(e,t),ce.init(e,t)}),vn=m("ZodISOTime",(e,t)=>{Op.init(e,t),ce.init(e,t)}),xn=m("ZodISODuration",(e,t)=>{jp.init(e,t),ce.init(e,t)}),Lc=m("ZodEmail",(e,t)=>{mp.init(e,t),ce.init(e,t)});function ux(e){return _a(Lc,e)}var Mc=m("ZodGUID",(e,t)=>{pp.init(e,t),ce.init(e,t)});function dx(e){return Ra(Mc,e)}var vt=m("ZodUUID",(e,t)=>{fp.init(e,t),ce.init(e,t)});function px(e){return Aa(vt,e)}function fx(e){return Pa(vt,e)}function mx(e){return Ta(vt,e)}function gx(e){return $a(vt,e)}var di=m("ZodURL",(e,t)=>{yp.init(e,t),ce.init(e,t)});function hx(e){return Mo(di,e)}function yx(e){return Mo(di,{protocol:tr,hostname:Qs,...O(e)})}var Fc=m("ZodEmoji",(e,t)=>{bp.init(e,t),ce.init(e,t)});function bx(e){return Na(Fc,e)}var Zc=m("ZodNanoID",(e,t)=>{wp.init(e,t),ce.init(e,t)});function wx(e){return za(Zc,e)}var Jc=m("ZodCUID",(e,t)=>{vp.init(e,t),ce.init(e,t)});function vx(e){return Da(Jc,e)}var Uc=m("ZodCUID2",(e,t)=>{xp.init(e,t),ce.init(e,t)});function xx(e){return qa(Uc,e)}var Bc=m("ZodULID",(e,t)=>{kp.init(e,t),ce.init(e,t)});function kx(e){return Va(Bc,e)}var Kc=m("ZodXID",(e,t)=>{Sp.init(e,t),ce.init(e,t)});function Sx(e){return La(Kc,e)}var Wc=m("ZodKSUID",(e,t)=>{Ip.init(e,t),ce.init(e,t)});function Ix(e){return Ma(Wc,e)}var Gc=m("ZodIPv4",(e,t)=>{_p.init(e,t),ce.init(e,t)});function Cx(e){return Fa(Gc,e)}var Hm=m("ZodMAC",(e,t)=>{Pp.init(e,t),ce.init(e,t)});function Ex(e){return qf(Hm,e)}var Hc=m("ZodIPv6",(e,t)=>{Ap.init(e,t),ce.init(e,t)});function Ox(e){return Za(Hc,e)}var Qc=m("ZodCIDRv4",(e,t)=>{Tp.init(e,t),ce.init(e,t)});function jx(e){return Ja(Qc,e)}var Yc=m("ZodCIDRv6",(e,t)=>{$p.init(e,t),ce.init(e,t)});function _x(e){return Ua(Yc,e)}var Xc=m("ZodBase64",(e,t)=>{zp.init(e,t),ce.init(e,t)});function Rx(e){return Ba(Xc,e)}var el=m("ZodBase64URL",(e,t)=>{Dp.init(e,t),ce.init(e,t)});function Ax(e){return Ka(el,e)}var tl=m("ZodE164",(e,t)=>{qp.init(e,t),ce.init(e,t)});function Px(e){return Wa(tl,e)}var Qm=m("ZodCreditCard",(e,t)=>{Vp.init(e,t),ce.init(e,t)});function Tx(e){return Vf(Qm,e)}var Ym=m("ZodIBAN",(e,t)=>{Lp.init(e,t),ce.init(e,t)});function $x(e){return Lf(Ym,e)}var nl=m("ZodJWT",(e,t)=>{Mp.init(e,t),ce.init(e,t)});function Nx(e){return Ga(nl,e)}var kn=m("ZodCustomStringFormat",(e,t)=>{Fp.init(e,t),ce.init(e,t)});function zx(e,t,n={}){return mn(kn,e,t,n)}function Dx(e){return mn(kn,"hostname",Hs,e)}function qx(e){return mn(kn,"hex",da,e)}function Vx(e){return mn(kn,"currency_code",Xs,e)}function Lx(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,o=Ot[r];if(!o)throw Error(`Unrecognized hash format: ${r}`);return mn(kn,r,o,t)}var rl=m("ZodNumber",(e,t)=>{xa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ec(e,n,r,o),e.isFinite=!0},vo({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=Ie(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=Ie(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=Ie(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>Ie(e).format??null},{gt(e,t){return this.check(_t(e,t))},gte(e,t){return this.check(nt(e,t))},min(e,t){return this.check(nt(e,t))},lt(e,t){return this.check(jt(e,t))},lte(e,t){return this.check(tt(e,t))},max(e,t){return this.check(tt(e,t))},int(e){return this.check(xe(e))},safe(e){return this.check(xe(e))},positive(e){return this.check(_t(0,e))},nonnegative(e){return this.check(nt(0,e))},negative(e){return this.check(jt(0,e))},nonpositive(e){return this.check(tt(0,e))},multipleOf(e,t){return this.check(pn(e,t))},step(e,t){return this.check(pn(e,t))},finite(){return this}}));function U(e){return Mf(rl,e)}var Sn=m("ZodNumberFormat",(e,t)=>{Zp.init(e,t),rl.init(e,t)});function xe(e){return Ff(Sn,e)}function Mx(e){return Zf(Sn,e)}function Fx(e){return Jf(Sn,e)}function Zx(e){return Uf(Sn,e)}function Jx(e){return Bf(Sn,e)}var ol=m("ZodBoolean",(e,t)=>{$o.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tc(e,n,r,o)});function me(e){return Kf(ol,e)}var il=m("ZodBigInt",(e,t)=>{ka.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nc(e,n,r,o)},vo({minValue:(e)=>Ie(e).minimum??null,maxValue:(e)=>Ie(e).maximum??null,format:(e)=>Ie(e).format??null},{gte(e,t){return this.check(nt(e,t))},min(e,t){return this.check(nt(e,t))},gt(e,t){return this.check(_t(e,t))},lt(e,t){return this.check(jt(e,t))},lte(e,t){return this.check(tt(e,t))},max(e,t){return this.check(tt(e,t))},positive(e){return this.check(_t(BigInt(0),e))},negative(e){return this.check(jt(BigInt(0),e))},nonpositive(e){return this.check(tt(BigInt(0),e))},nonnegative(e){return this.check(nt(BigInt(0),e))},multipleOf(e,t){return this.check(pn(e,t))}}));function Ux(e){return Wf(il,e)}var sl=m("ZodBigIntFormat",(e,t)=>{Jp.init(e,t),il.init(e,t)});function Bx(e){return Gf(sl,e)}function Kx(e){return Hf(sl,e)}var Xm=m("ZodSymbol",(e,t)=>{Up.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rc(e,n,r,o)});function Wx(e){return Qf(Xm,e)}var eg=m("ZodUndefined",(e,t)=>{Bp.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ic(e,n,r,o)});function Gx(e){return Yf(eg,e)}var tg=m("ZodNull",(e,t)=>{Kp.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oc(e,n,r,o)});function ng(e){return Xf(tg,e)}var rg=m("ZodAny",(e,t)=>{Wp.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cc(e,n,r,o)});function Hx(){return em(rg)}var og=m("ZodUnknown",(e,t)=>{Gp.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lc(e,n,r,o)});function ut(){return tm(og)}var ig=m("ZodNever",(e,t)=>{Hp.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ac(e,n,r,o)});function rt(e){return nm(ig,e)}var sg=m("ZodVoid",(e,t)=>{Qp.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sc(e,n,r,o)});function Qx(e){return rm(sg,e)}var ag=m("ZodDate",(e,t)=>{Yp.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uc(e,n,r,o),e.min=(n,r)=>e.check(nt(n,r)),e.max=(n,r)=>e.check(tt(n,r))},vo({minDate:(e)=>{let{minimum:t}=Ie(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=Ie(e);return t?new Date(t):null}},{}));function Yx(e){return om(ag,e)}var cg=m("ZodArray",(e,t)=>{Wt(),Xp.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kc(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Kt(e,t))},nonempty(e){return this.check(Kt(1,e))},max(e,t){return this.check(lr(e,t))},length(e,t){return this.check(ur(e,t))},unwrap(){return this.element}});function A(e,t){return dm(cg,e,t)}function Xx(e){let t=e._zod.def.shape;return B(Object.keys(t))}var pi=m("ZodObject",(e,t)=>{Wt(),nf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sc(e,n,r,o),Jw(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return B(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Je(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Je(this._zod.def,{catchall:ut()}))},loose(){return this.clone(Je(this._zod.def,{catchall:ut()}))},strict(){return this.clone(Je(this._zod.def,{catchall:rt()}))},strip(){return this.clone(Je(this._zod.def,{catchall:void 0}))},extend(e){return zw(this,e)},safeExtend(e){return Dw(this,e)},merge(e){return qw(this,e)},pick(e){return $w(this,e)},omit(e){return Nw(this,e)},partial(...e){return id(mi,this,e[0])},exactPartial(...e){return id(cl,this,e[0],"exactPartial")},required(...e){return Vw(ll,this,e[0])}});function C(e,t){let n={type:"object",shape:e??{},...O(t)};return new pi(n)}function v(e,t){return new pi({type:"object",shape:e,catchall:rt(),...O(t)})}function ek(e,t){return new pi({type:"object",shape:e,catchall:ut(),...O(t)})}var fi=m("ZodUnion",(e,t)=>{No.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ii(e,n,r,o),e.options=t.options});function Y(e,t){return new fi({type:"union",options:e,...O(t)})}var lg=m("ZodXor",(e,t)=>{fi.init(e,t),rf.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ii(e,n,r,o),e.options=t.options});function tk(e,t){return new lg({type:"union",options:e,inclusive:!1,...O(t)})}var ug=m("ZodDiscriminatedUnion",(e,t)=>{fi.init(e,t),of.init(e,t)});function ot(e,t,n){return new ug({type:"union",options:t,discriminator:e,...O(n)})}var dg=m("ZodIntersection",(e,t)=>{sf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ic(e,n,r,o)});function pg(e,t){return new dg({type:"intersection",left:e,right:t})}var fg=m("ZodTuple",(e,t)=>{Wt(),Sa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cc(e,n,r,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new mi({type:"optional",innerType:t}))})}});function mg(e,t,n){let r=t instanceof F,o=r?n:t;return new fg({type:"tuple",items:e,rest:r?t:null,...O(o)})}var br=m("ZodRecord",(e,t)=>{Wt(),af.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ec(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function oe(e,t,n){if(!t||!t._zod)return new br({type:"record",keyType:j(),valueType:e,...O(t)});return new br({type:"record",keyType:e,valueType:t,...O(n)})}function nk(e,t,n){return new br({type:"record",keyType:e,valueType:t,...O(n),partial:!0})}function rk(e,t,n){return new br({type:"record",keyType:e,valueType:t,mode:"loose",...O(n)})}var gg=m("ZodMap",(e,t)=>{Wt(),cf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vc(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Rt(...n)),e.nonempty=(n)=>e.check(Rt(1,n)),e.max=(...n)=>e.check(fn(...n)),e.size=(...n)=>e.check(cr(...n))});function ok(e,t,n){return new gg({type:"map",keyType:e,valueType:t,...O(n)})}var hg=m("ZodSet",(e,t)=>{Wt(),lf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xc(e,n,r,o),e.min=(...n)=>e.check(Rt(...n)),e.nonempty=(n)=>e.check(Rt(1,n)),e.max=(...n)=>e.check(fn(...n)),e.size=(...n)=>e.check(cr(...n))});function ik(e,t){return new hg({type:"set",valueType:e,...O(t)})}var wr=m("ZodEnum",(e,t)=>{uf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,o,i)=>dc(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new wr({...t,checks:[],...O(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let s of r)if(n.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new wr({...t,checks:[],...O(o),entries:i})}});function B(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new wr({type:"enum",entries:n,...O(t)})}function sk(e,t){return new wr({type:"enum",entries:e,...O(t)})}var yg=m("ZodLiteral",(e,t)=>{df.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pc(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function w(e,t){return new yg({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}var bg=m("ZodFile",(e,t)=>{pf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gc(e,n,r,o),e.min=(n,r)=>e.check(Rt(n,r)),e.max=(n,r)=>e.check(fn(n,r)),e.mime=(n,r)=>e.check(Xo(Array.isArray(n)?n:[n],r))});function ak(e){return pm(bg,e)}var wg=m("ZodTransform",(e,t)=>{Wt(),ff.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wc(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new un(e.constructor.name);n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(Jt(i,n.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=n.value;s.inst??(s.inst=e),n.issues.push(Jt(s))}};let o=t.transform(n.value,n);if(o instanceof Promise)return o.then((i)=>(n.value=i,n));return n.value=o,n}});function al(e){return new wg({type:"transform",transform:e})}var mi=m("ZodOptional",(e,t)=>{Ia.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>si(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function li(e){return new mi({type:"optional",innerType:e})}var cl=m("ZodExactOptional",(e,t)=>{mf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>si(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function vg(e){return new cl({type:"optional",innerType:e})}var xg=m("ZodNullable",(e,t)=>{gf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Oc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ui(e){return new xg({type:"nullable",innerType:e})}function ck(e){return li(ui(e))}var kg=m("ZodDefault",(e,t)=>{hf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Sg(e,t){return new kg({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():vs(t)}})}var Ig=m("ZodPrefault",(e,t)=>{yf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ac(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Cg(e,t){return new Ig({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():vs(t)}})}var ll=m("ZodNonOptional",(e,t)=>{bf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Eg(e,t){return new ll({type:"nonoptional",innerType:e,...O(t)})}var Og=m("ZodSuccess",(e,t)=>{wf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lk(e){return new Og({type:"success",innerType:e})}var jg=m("ZodCatch",(e,t)=>{vf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _g(e,t){return new jg({type:"catch",innerType:e,catchValue:typeof t==="function"?t:ld(t)})}var Rg=m("ZodNaN",(e,t)=>{xf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fc(e,n,r,o)});function uk(e){return im(Rg,e)}var gi=m("ZodPipe",(e,t)=>{Ca.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tc(e,n,r,o),e.in=t.in,e.out=t.out});function Dc(e,t){return new gi({type:"pipe",in:e,out:t})}var hi=m("ZodCodec",(e,t)=>{gi.init(e,t),zo.init(e,t)});function dk(e,t,n){return new hi({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function pk(e){let t=e._zod.def;return new hi({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Ag=m("ZodPreprocess",(e,t)=>{gi.init(e,t),kf.init(e,t)}),Pg=m("ZodReadonly",(e,t)=>{Sf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Tg(e){return new Pg({type:"readonly",innerType:e})}var $g=m("ZodTemplateLiteral",(e,t)=>{If.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mc(e,n,r,o)});function fk(e,t){return new $g({type:"template_literal",parts:e,...O(t)})}var Ng=m("ZodLazy",(e,t)=>{Of.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zc(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function zg(e){return new Ng({type:"lazy",getter:e})}var Dg=m("ZodPromise",(e,t)=>{Ef.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function mk(e){return new Dg({type:"promise",innerType:e})}var qg=m("ZodFunction",(e,t)=>{Cf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bc(e,n,r,o)});function gk(e){return new qg({type:"function",input:Array.isArray(e?.input)?mg(e?.input):e?.input??A(ut()),output:e?.output??ut()})}var yi=m("ZodCustom",(e,t)=>{jf.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yc(e,n,r,o)});function hk(e){let t=new ue({check:"custom"});return t._zod.check=e,t}function yk(e,t){return fm(yi,e??(()=>!0),t)}function Vg(e,t={}){return mm(yi,e,t)}function Lg(e,t){return gm(e,t)}var bk=hm,wk=ym,Mg=m("ZodInstanceOf",(e,t)=>{yi.init(e,t)},{properties(e,t){return this.check(Yo(e,t))}});function vk(e,t={}){let n=new Mg({type:"custom",check:"custom",fn:(r)=>r instanceof e,abort:!0,...O(t)});return n._zod.bag.Class=e,n._zod.check=(r)=>{if(!(r.value instanceof e))r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}var xk=(...e)=>bm({Codec:hi,Boolean:ol,String:Vc},...e);function Ae(e){let t=zg(()=>Y([j(e),U(),me(),ng(),A(t),oe(j(),t)]));return t}function Fg(e,t){return new Ag({type:"pipe",in:al(e),out:t})}function kk(e){return Fo(bn,e)}function Sk(e){return Zo(wn,e)}function Ik(e){return Jo(vn,e)}function Ck(e){return Uo(xn,e)}var T={...ul,...ai,iso:vr},Ek=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Ok(e,t){let n=e.$schema;if(n==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(n==="http://json-schema.org/draft-07/schema#")return"draft-7";if(n==="http://json-schema.org/draft-04/schema#")return"draft-4";return t??"draft-2020-12"}function Zg(e,t){return e.map((n,r)=>r<t?n:n.optional())}function jk(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function _k(e,t){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let o=n[1]===void 0?void 0:jk(n[1]);if(!o||!t.defs[o])throw Error(`Reference not found: ${e}`);return t.defs[o]}throw Error(`Reference not found: ${e}`)}function Rk(e,t){return T.transform((r)=>r).check((r)=>{let o=r.value;if(typeof o!=="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties)r.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0});if(t.maxProperties!==void 0&&i.length>t.maxProperties)r.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0});if(t.keySchema)for(let s of i){let a=t.keySchema.safeParse(s);if(a.success)continue;r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function dl(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let r=String(e);return`${n[0]}${r.length}:${r}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=dl(s,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let s=dl(e[i],t);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}var Ak=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Pk=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function xr(e){if(typeof e!=="object"||e===null)return!1;if(Array.isArray(e))return e.some(xr);if(typeof e.$ref==="string")return!0;return Object.entries(e).some(([t,n])=>{if(Ak.has(t))return xr(n);if(!Pk.has(t)||typeof n!=="object"||n===null)return!1;return Object.values(n).some(xr)})}function Jg(e){return e===1?"element":"elements"}function Tk(e,t){return T.transform((r)=>r).check((r)=>{let o=r.value;if(!Array.isArray(o))return;if(t.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=dl(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(t.containsSchema.safeParse(c).success&&++a>=s)break;if(a<i)r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Jg(i)}; found ${a}`,input:o,continue:!0});if(t.maxContains!==void 0&&a>t.maxContains)r.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Jg(t.maxContains)}`,input:o,continue:!0})}}).pipe(e)}function Ug(e,t){if(e===!1)return;if(e===void 0||e===!0)return T.any();return Ne(e,t)}var $k=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Bg(e,t){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return T.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return T.lazy(()=>{if(!t.refs.has(o))throw Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);let i=_k(o,t),s=Ne(i,t);return t.refs.set(o,s),t.processing.delete(o),s}if(e.enum!==void 0){let o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return T.null();if(o.length===0)return T.never();if(o.length===1)return T.literal(o[0]);if(o.every((s)=>typeof s==="string"))return T.enum(o);let i=o.map((s)=>T.literal(s));if(i.length<2)return i[0];return T.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return T.literal(e.const);let n=e.type;if(Array.isArray(n)){let o=n.map((i)=>{let s={...e,type:i};return Bg(s,t)});if(o.length===0)return T.never();if(o.length===1)return o[0];return T.union(o)}if(!n)return T.any();let r;switch(n){case"string":{let o=T.string();if(e.format){let i=e.format;if(i==="email")o=o.check(T.email());else if(i==="uri"||i==="uri-reference")o=o.check(T.url());else if(i==="uuid"||i==="guid")o=o.check(T.uuid());else if(i==="date-time")o=o.check(T.iso.datetime({offset:!0}));else if(i==="date")o=o.check(T.iso.date());else if(i==="time")o=o.check(T.regex($k));else if(i==="duration")o=o.check(T.iso.duration());else if(i==="hostname")o=o.check(T.hostname());else if(i==="ipv4")o=o.check(T.ipv4());else if(i==="ipv6")o=o.check(T.ipv6());else if(i==="mac")o=o.check(T.mac());else if(i==="cidr")o=o.check(T.cidrv4());else if(i==="cidr-v6")o=o.check(T.cidrv6());else if(i==="base64")o=o.check(T.base64());else if(i==="base64url")o=o.check(T.base64url());else if(i==="e164")o=o.check(T.e164());else if(i==="credit_card")o=o.check(T.creditCard());else if(i==="iban")o=o.check(T.iban());else if(i==="jwt")o=o.check(T.jwt());else if(i==="emoji")o=o.check(T.emoji());else if(i==="nanoid")o=o.check(T.nanoid());else if(i==="cuid")o=o.check(T.cuid());else if(i==="cuid2")o=o.check(T.cuid2());else if(i==="ulid")o=o.check(T.ulid());else if(i==="xid")o=o.check(T.xid());else if(i==="ksuid")o=o.check(T.ksuid())}if(typeof e.minLength==="number")o=o.min(e.minLength);if(typeof e.maxLength==="number")o=o.max(e.maxLength);if(e.pattern)o=o.regex(new RegExp(e.pattern));r=o;break}case"number":case"integer":{let o=n==="integer"?T.number().int():T.number();if(typeof e.minimum==="number"&&e.exclusiveMinimum!==!0)o=o.min(e.minimum);if(typeof e.maximum==="number"&&e.exclusiveMaximum!==!0)o=o.max(e.maximum);if(typeof e.exclusiveMinimum==="number")o=o.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")o=o.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")o=o.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")o=o.lt(e.maximum);if(typeof e.multipleOf==="number")o=o.multipleOf(e.multipleOf);r=o;break}case"boolean":{r=T.boolean();break}case"null":{r=T.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties==="object"?Ne(e.additionalProperties,t):void 0;for(let[d,g]of Object.entries(i)){let h=Ne(g,t);_e(o,d,s.has(d)?h:h.optional())}if(e.patternProperties){let d=e.patternProperties,g=Object.keys(d),h=[];for(let S of g){let R=Ne(d[S],t),N=T.string().regex(new RegExp(S));h.push(T.looseRecord(N,R))}let y=[];if(Object.keys(o).length>0)y.push(T.object(o).passthrough());if(y.push(...h),y.length===0)r=T.object({}).passthrough();else if(y.length===1)r=y[0];else{let S=T.intersection(y[0],y[1]);for(let R=2;R<y.length;R++)S=T.intersection(S,y[R]);r=S}if(e.additionalProperties===!1){let S=Object.keys(o),R=g.map((q)=>new RegExp(q)),N=r;r=r.check((q)=>{if(!bt(q.value))return;let V=[];for(let Oe of Object.keys(q.value)){if(S.includes(Oe))continue;if(R.some((fe)=>fe.test(Oe)))continue;V.push(Oe)}if(V.length)q.issues.push({code:"unrecognized_keys",keys:V,input:q.value,inst:N})})}}else{let d=T.object(o);if(e.additionalProperties===!1)r=d.strict();else if(a)r=d.catchall(a);else r=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties==="number"?e.minProperties:void 0,u=typeof e.maxProperties==="number"?e.maxProperties:void 0;if(c||l!==void 0||u!==void 0){let d;if(c){let g=typeof e.propertyNames==="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Ne(g,t)}r=Rk(r,{keySchema:d,minProperties:l,maxProperties:u})}break}case"array":{let{prefixItems:o,items:i}=e;if(o&&Array.isArray(o)){let s=typeof e.minItems==="number"?e.minItems:0,a=o.map((d)=>Ne(d,t)),c=Zg(a,s),l=!Array.isArray(i)?Ug(i,t):void 0,u=T.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(T.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(T.maxLength(e.maxItems))}else if(Array.isArray(i)){let s=typeof e.minItems==="number"?e.minItems:0,a=i.map((d)=>Ne(d,t)),c=Zg(a,s),l=Ug(e.additionalItems,t),u=T.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(T.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(T.maxLength(e.maxItems))}else if(i!==void 0){let s=Ne(i,t),a=T.array(s);if(typeof e.minItems==="number")a=a.min(e.minItems);if(typeof e.maxItems==="number")a=a.max(e.maxItems);r=a}else r=T.array(T.any());if(e.uniqueItems===!0||e.contains!==void 0)r=Tk(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Ne(e.contains,t):void 0,minContains:typeof e.minContains==="number"?e.minContains:void 0,maxContains:typeof e.maxContains==="number"?e.maxContains:void 0});break}default:throw Error(`Unsupported type: ${n}`)}return r}function Ne(e,t){if(typeof e==="boolean")return e?T.any():T.never();let n=Bg(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map((l)=>Ne(l,t)),c=T.union(a);n=r?T.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map((l)=>Ne(l,t)),c=T.xor(a);n=r?T.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:T.any();else{let a=r?n:Ne(e.allOf[0],t),c=r?0:1;for(let l=c;l<e.allOf.length;l++)a=T.intersection(a,Ne(e.allOf[l],t));n=a}if(e.nullable===!0&&t.version==="openapi-3.0")n=T.nullable(n);if(e.readOnly===!0)n=T.readonly(n);if(e.default!==void 0)n=n.default(e.default);let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)if(a in e)o[a]=e[a];let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)if(a in e)o[a]=e[a];if(e.type==="object"&&e.$ref===void 0){if(e.propertyNames!==void 0&&!xr(e.propertyNames))o.propertyNames=e.propertyNames;for(let a of["minProperties","maxProperties"])if(e[a]!==void 0)o[a]=e[a]}if(e.type==="array"&&e.$ref===void 0){if(e.contains!==void 0&&!xr(e.contains))o.contains=e.contains;for(let a of["uniqueItems","minContains","maxContains"])if(e[a]!==void 0)o[a]=e[a]}for(let a of Object.keys(e))if(!Ek.has(a))_e(o,a,e[a]);if(Object.keys(o).length>0)t.registry.add(n,o);if(e.description)n=n.describe(e.description);return n}function Kg(e,t){if(typeof e==="boolean")return e?T.any():T.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=Ok(n,t?.defaultTarget),o=n.$defs||n.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Le};return Ne(n,i)}var Wg=Object.prototype.hasOwnProperty;function Se(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)while(r--&&Se(e[r],t[r]));return r===-1}if(!n||typeof e==="object"){r=0;for(n in e){if(Wg.call(e,n)&&++r&&!Wg.call(t,n))return!1;if(!(n in t)||!Se(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!==e&&t!==t}var jO=v({scope:B(["draft","live"]),values:me().optional()}),_O=v({scope:B(["draft","live"]),key:j().min(1).refine((e)=>new TextEncoder().encode(e).length<=256).optional()}),RO=v({scope:B(["draft","live"]),space:j().regex(/^(flow|node:.+)$/)}),bi=v({fields:A(j().refine((e)=>e.length>0&&e.split(".").every((t)=>t.length>0),"Use a nonempty dot-separated field path.")).refine((e)=>new Set(e).size===e.length,"Identity fields must be distinct.").default([])}),Gg=bi.extend({kind:w("skip-duplicates")});var Hg=C({version:w(1),scope:B(["draft","live"]),limits:C({maxValueBytes:U().positive(),maxValues:U().int().positive(),maxSpaces:U().int().positive(),maxIdentities:U().positive(),maxRunWrites:U().positive()}),values:A(C({key:j(),size:U().nonnegative(),updatedAt:U(),value:Ae().optional()})),spaces:A(C({space:j(),count:U().nonnegative(),pendingCount:U().nonnegative(),reservedCount:U().nonnegative(),updatedAt:U()}))});var Qg=0;function At(){let e=Qg;return Qg+=1,e}function Cn(e){if(typeof e==="object"&&e!==null&&!Object.isFrozen(e)){for(let t of Object.getOwnPropertyNames(e)){let n=Reflect.get(e,t);Cn(n)}Object.freeze(e)}return e}function pl(e,t){let n={};for(let r of t)if(r in e)n[r]=e[r];return n}function wi(e){if(typeof e!=="object"||e===null)return e;else if(Array.isArray(e)){let t=[];for(let[n,r]of e.entries())t[n]=wi(r);return t}else{let t={};for(let n in e)t[n]=wi(e[n]);return t}}function In(e,t){if(e===t)return!0;if(e===null)return!1;if(typeof e!=="object")return!1;if(typeof e!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(!In(r,t[n]))return!1}else{if(Array.isArray(t))return!1;for(let n in e){if(!(n in t))return!1;if(!In(e[n],t[n]))return!1}for(let n in t)if(!(n in e))return!1}return!0}var b=Object.freeze({Equals:0,Containing:1,ContainedBy:2,Rejection:3,Intersection:4}),G=Pt(b.Equals),Z=Pt(b.Containing),K=Pt(b.ContainedBy),H=Pt(b.Rejection),te=Pt(b.Intersection),xt=Cn([[b.Equals,G],[b.Containing,Z],[b.ContainedBy,K],[b.Rejection,H],[b.Intersection,te]]),pe=0,We=(()=>{let e=pe;for(let[t,n]of xt)e|=n;return e})();function kr(e){return!!(e&G)}function Sr(e){return!!(e&Z)}function Ir(e){return!!(e&K)}function Cr(e){return!!(e&H)}function Er(e){return!!(e&te)}function Pt(e){return 1<<e}function fl(e){let t=pe,n=0,r={push:(o)=>{if(n===0)t=o;else t=Nk(t,o,e);return n+=1,t}};return Object.defineProperties(r,{result:{get:()=>t},count:{get:()=>n}}),r}function Nk(e,t,n){let r=pe;for(let[o,i]of xt)if(i&e){for(let[s,a]of xt)if(a&t){if(r|=n(o,s),r===We)return r}}return r}var he=Object.freeze({Save:0,OneOf:1,AllOf:2,AnyOf:3,Not:4,Swap:5});function Yg(e,t){switch(e){case he.Save:return t[0];case he.OneOf:return zk(t);case he.AllOf:case he.AnyOf:return Or(e,t);case he.Not:case he.Swap:return ml(e,t[0])}}function Tt(e){return ml(he.Swap,e)}function zk(e){if(e.length===1)return e[0];let t=Or(he.AnyOf,e),n=[];for(let i=0;i<e.length;++i)for(let s=i+1;s<e.length;++s){let a=e[i],c=e[s],l=Or(he.AllOf,[a,c]);n.push(l)}let r=Or(he.AnyOf,n),o=ml(he.Not,r);return Or(he.AllOf,[t,o])}function Or(e,t){if(t.length<0)throw Error("invalid expressions: empty array");let n;switch(e){case he.AllOf:{n=fl(Dk);break}case he.AnyOf:{n=fl(qk);break}default:throw Error(`invalid operator ${e}`)}for(let r of t)n.push(r);return n.result}function ml(e,t){let n,r=pe;switch(e){case he.Not:{n=Vk;break}case he.Swap:{n=Lk;break}default:throw Error(`invalid operator ${e}`)}for(let[o,i]of xt)if(i&t)r|=n(o);return r}function Dk(e,t){let n=pe;switch(e){case b.Equals:{switch(t){case b.Equals:{n=G;break}case b.Containing:{n=G;break}case b.ContainedBy:{n=K;break}case b.Rejection:{n=pe;break}case b.Intersection:{n=K;break}}break}case b.Containing:{switch(t){case b.Equals:{n=G;break}case b.Containing:{n=G|Z;break}case b.ContainedBy:{n=K;break}case b.Rejection:{n=H;break}case b.Intersection:{n=te|K;break}}break}case b.ContainedBy:{switch(t){case b.Equals:{n=K;break}case b.Containing:{n=K;break}case b.ContainedBy:{n=K;break}case b.Rejection:{n=pe;break}case b.Intersection:{n=K;break}}break}case b.Rejection:{switch(t){case b.Equals:{n=pe;break}case b.Containing:{n=H;break}case b.ContainedBy:{n=pe;break}case b.Rejection:{n=H;break}case b.Intersection:{n=H;break}}break}case b.Intersection:{switch(t){case b.Equals:{n=K;break}case b.Containing:{n=te|K;break}case b.ContainedBy:{n=K;break}case b.Rejection:{n=H;break}case b.Intersection:{n=K|H|te;break}}break}}return n}function qk(e,t){let n=pe;switch(e){case b.Equals:{switch(t){case b.Equals:{n=G;break}case b.Containing:{n=Z;break}case b.ContainedBy:{n=G;break}case b.Rejection:{n=Z;break}case b.Intersection:{n=Z;break}}break}case b.Containing:{switch(t){case b.Equals:{n=Z;break}case b.Containing:{n=Z;break}case b.ContainedBy:{n=Z;break}case b.Rejection:{n=Z;break}case b.Intersection:{n=Z;break}}break}case b.ContainedBy:{switch(t){case b.Equals:{n=G;break}case b.Containing:{n=Z;break}case b.ContainedBy:{n=G|K;break}case b.Rejection:{n=te;break}case b.Intersection:{n=Z|te;break}}break}case b.Rejection:{switch(t){case b.Equals:{n=Z;break}case b.Containing:{n=Z;break}case b.ContainedBy:{n=te;break}case b.Rejection:{n=H;break}case b.Intersection:{n=te;break}}break}case b.Intersection:{switch(t){case b.Equals:{n=Z;break}case b.Containing:{n=Z;break}case b.ContainedBy:{n=Z|te;break}case b.Rejection:{n=te;break}case b.Intersection:{n=Z|te;break}}break}}return n}function Vk(e){let t=pe;switch(e){case b.Equals:{t=H;break}case b.Containing:{t=H;break}case b.ContainedBy:{t=te;break}case b.Rejection:{t=G|Z;break}case b.Intersection:{t=K|te;break}}return t}function Lk(e){let t=pe;switch(e){case b.Equals:{t=G;break}case b.Containing:{t=K;break}case b.ContainedBy:{t=Z;break}case b.Rejection:{t=H;break}case b.Intersection:{t=te;break}}return t}var Me=Object.freeze({Leaf:0,Not:1,AllOf:2,AnyOf:3,OneOf:4});var gl=(e)=>(t,n)=>{let r={parent:null,swapped:!1,expressions:null,calculation:{operator:he.Save,results:[pe],willSwap:!1,count:0}},o=[{parent:{node:r,index:0},swapped:!1,expressions:[t,n],calculation:null}],i=[];while(o.length>0||i.length>0){while(o.length>0){let u=o.pop();s(u)}while(i.length>0){let u=i.pop();c(u)}}function s(u){let d=G,[g,h]=u.expressions;if(!e.equals(g,h)){let y=e.describe(g);if(y.kind!==Me.Leaf){let[N,q]=a(y,!1);u.expressions=null,u.calculation=N;for(let[V,Oe]of q.entries())o.push({parent:{node:u,index:V},swapped:u.swapped,expressions:[Oe,h],calculation:null});return}let S=e.describe(h);if(S.kind!==Me.Leaf){let[N,q]=a(S,!0);u.expressions=null,u.calculation=N;for(let[V,Oe]of q.entries())o.push({parent:{node:u,index:V},swapped:!u.swapped,expressions:[Oe,g],calculation:null});return}if(d=e.calculate(g,h),e.observeCalculation?.(g,h,d,u.swapped),d===pe)throw Error("cannot response expression as none")}u.expressions=null,u.calculation={operator:he.Save,results:[d],willSwap:!1,count:0},i.push(u)}function a(u,d){let g=he.Save,h;switch(u.kind){case Me.Not:{g=he.Not,h=[u.expression];break}case Me.AllOf:{g=he.AllOf,h=[...u.expressions];break}case Me.AnyOf:{g=he.AnyOf,h=[...u.expressions];break}case Me.OneOf:{g=he.OneOf,h=[...u.expressions];break}default:throw Error(`invalid kind ${u.kind}`)}return[{operator:g,willSwap:d,count:0,results:Array(h.length).fill(-1)},h]}function c(u){let{calculation:d,parent:g}=u,h=Yg(d.operator,d.results);if(h===pe)h=K;if(d.willSwap)h=Tt(h);if(g){let y=g.node.calculation,S=y.results;if(S[g.index]=h,y.count+=1,y.count>=S.length)i.push(g.node)}}let l=r.calculation.results[0];if(l===0)throw Error("cannot find result of root");return l};class vi extends Error{constructor(e=[]){super(Mk(e));this.name="SchemaError",this.items=e}}var En=Object.freeze({Compiled:0,External:1});function On(e){switch(e.kind){case En.Compiled:{let{message:t,path:n}=e;return`${t} (at ${n.length>0?n.join("."):"$root"})`}case En.External:return String(e.error)}}function Mk(e){switch(e.length){case 0:return"without any items";case 1:return On(e[0]);default:return`${On(e[0])} ... omit the rest ${e.length-1} items`}}var Fk=new Set(["type","enum","const","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","items","additionalItems","maxItems","minItems","uniqueItems","contains","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames","if","then","else","allOf","anyOf","oneOf","not","format","contentMediaType","contentEncoding","definitions"]);function dt(e){return Fk.has(e)}function Xg(e){for(let t in e)if(dt(t))return!1;return!0}function ze(e,...t){return{...e,path:[...e.path,...t]}}function Fe(e){if(typeof e==="boolean")throw Error("JSONSchema7Definition cannot be boolean");return e}function $t({path:e,errors:t},n,...r){t.push(eh(e,r,n))}function re({path:e,warns:t},n,...r){t.push(eh(e,r,n))}function eh(e,t,n){return{kind:En.Compiled,message:n,path:[...e,...t]}}function xi(e){for(let t in e){let n=e[t];if(n===void 0)delete e[t];else if(n&&typeof n==="object"){if(Array.isArray(n)){if(n.length===0)delete e[t]}else if(Zk(n))delete e[t]}}return e}function Zk(e){for(let t in e)return!1;return!0}var jr=Symbol("compiledId"),hl=Symbol("compiledKind"),yl=Symbol("compiledPath"),th=Symbol("validatorLoader"),I=Object.freeze({Extends:0,Never:1,Any:2,Null:3,String:4,Numeric:5,Boolean:6,Object:7,Array:8,Not:9,Combination:10,EnumOrConst:11}),Nt=Cn(ki(I.Any,At(),{},()=>()=>!0)),_r=Cn(ki(I.Never,At(),{type:"string",maxLength:0,minLength:1},()=>()=>!1));function Rr(e){if(e===null||typeof e!=="object")return!1;return jr in e}function Ze(e){if(e===null||typeof e!=="object")return!1;return jr in e&&hl in e}function X(e){if(Ze(e))return e[hl];else return I.Extends}function Gt(e){if(Ze(e)||Rr(e))return e[jr];else return e.id}function bl(e){return Ze(e)?e[yl]:void 0}function wl(e){if(e===null||typeof e!=="object")return e;return Object.defineProperty(e,jr,{value:At(),configurable:!1,writable:!1,enumerable:!1}),e}function be(e,t,n,r=[]){return ki(e,At(),t,n&&(()=>n.compile(t)),r)}function Ar(e){return ki(I.Never,At(),{...e},e[th],e[yl])}function ki(e,t,n,r,o=[]){let i=null;return Object.defineProperties(n,{[hl]:{value:e,configurable:!1,writable:!1,enumerable:!1},[jr]:{value:t,configurable:!1,writable:!1,enumerable:!1},[yl]:{value:o,configurable:!1,writable:!1,enumerable:!1},[th]:{value:r,configurable:!1,writable:!1,enumerable:!1},isValid:{configurable:!1,enumerable:!1,get:()=>{if(r){if(!i)i=r();return i}else return}}}),n}function oh(e,t){let n=Jk(e,t),r=nh(e,"maxItems",t),o=nh(e,"minItems",t),i=Uk(e,t),s=t.uniqueItems,a;if(Array.isArray(n))a=Bk(e,t);else if(t.additionalItems)re(e,"it is needless when items is not array","additionalItems");if(!n||!i||a===null)return null;let c=!1,l=!1;if(Array.isArray(n)){if(r!==void 0&&r<=n.length)n=n.splice(r),a=rh(a,e.delegate);let g=n.findIndex((h)=>X(h)===I.Never);if(g!==-1){if(n=n.splice(g),a=rh(a,e.delegate),r===void 0)r=n.length,l=!0}if(o!==void 0&&n.length<o)re(e,`length(${n.length}) of items if less than minItems(${o})`),c=!0;if(n.length===0&&a&&X(a)===I.Never)c=!0}else if(X(n)===I.Never)c=!0;if(r!==void 0&&o!==void 0&&r<o){if(!l)re(e,`maxItems(${r}) is less than minItems(${o})`);c=!0}let u=c?I.Never:I.Array,d=xi({type:"array",items:n,contains:i,uniqueItems:s,maxItems:r,minItems:o,additionalItems:a});return be(u,d,e.delegate,e.path)}function Jk(e,{items:t}){if(!t)return be(I.Any,{},e.delegate,e.path);if(Array.isArray(t)){let n=[],r=!1;for(let[o,i]of t.entries()){let s=ze(e,"items",o),a=De(s,Fe(i));if(!a){r=!0;continue}n.push(a)}if(r)return null;return n}else{let n=ze(e,"items"),r=Fe(t);return De(n,r)}}function nh(e,t,n){let r=n[t];if(r===void 0)return;if(Number.isNaN(r)){re(e,"find NaN",t);return}if(r<0){re(e,`find invalid number ${r}`,t);return}return r}function Uk(e,{contains:t}){if(!t)return be(I.Any,{},e.delegate,e.path);let n=ze(e,"contains"),r=Fe(t);return De(n,r)}function Bk(e,{additionalItems:t}){switch(typeof t){case"boolean":if(t)return be(I.Any,{},e.delegate,e.path);else return!1;case"object":{let n=ze(e,"additionalItems");return De(n,t)}default:return be(I.Any,{},e.delegate,e.path)}}function rh(e,t){if(e===void 0)return be(I.Never,{type:"string",maxLength:0,minLength:1},t);else if(Ze(e))return X(e)===I.Never?e:Ar(e);else return e}var ih=Object.freeze(["allOf","anyOf","oneOf"]);function vl(e,t,n,r){if(n.length===0)return $t(e,"disable empty list",t),null;let o=[];for(let[c,l]of n.entries()){let u=ze(e,t,c),d=Fe(l),g=De(u,d);if(g)o.push(g)}if(o.length<n.length)return null;let i=0,s=0;for(let c of o)switch(X(c)){case I.Any:{i+=1;break}case I.Never:{s+=1;break}}let a=I.Combination;switch(t){case"allOf":{if(s>0)a=I.Never;else if(i===o.length)a=I.Any;else if(!Kk(o))a=I.Never;break}case"anyOf":{if(i>0)a=I.Any;else if(s===o.length)a=I.Never;break}case"oneOf":{if(i>1)a=I.Never;else if(s===o.length)a=I.Never;else if(i===1&&s===o.length-1)a=I.Any;break}}return be(a,{[t]:o},r,e.path)}function Kk(e){let t=null;for(let n of e){let r=X(n);switch(r){case I.Any:case I.Never:break;default:{if(t===null)t=r;else if(t!==r)return!1;break}}}return!0}var Pe=Object.freeze({Valid:0,Invalid:1,Unknown:2});function pt(e,t){let n=e.isValid;if(n)if(n(t)===!0)return Pe.Valid;else return Pe.Invalid;else return Pe.Unknown}function sh(e,t,n,r){let o,i=!1;if(t){if(t.length===0)return $t(e,"disable empty list","enum"),null;o=[];for(let[c,l]of t.entries())switch(pt(r,l)){case Pe.Valid:{o.push(wl(l));break}case Pe.Invalid:{re(e,"cannot pass JSON schema of currently schema object","enum",c);break}}if(o.length===0)re(e,"all of elements from list is rejected by currently schema object","enum")}if(n!==void 0&&pt(r,n)===Pe.Invalid)i=!0;if(o){if(o.length===0)i=!0;else if(n!==void 0){let c=!1;for(let l of o)if(In(l,n)){c=!0;break}if(!c)i=!0}}let s=i?I.Never:I.EnumOrConst,a={};if(r.type)a.type=r.type;if(o)a.enum=o;if(n!==void 0)a.const=wl(wi(n));return be(s,a,e.delegate,e.path)}var Wk=new Set(["type","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames"]);function ch(e,t){let n=Object.keys(t).filter((y)=>!Wk.has(y)&&dt(y));if(n.length>0)re(e,`type="object" will exclude other keys: ${n.toSorted().join(", ")}`);let r=ah(e,"maxProperties",t),o=ah(e,"minProperties",t),i=Gk(e,t),s=Hk(e,t),a=Qk(e,t),c=Xk(e,t);if(!i||!s||!a||!c)return null;let l=Yk(e,s,a,t);if(!l)return null;let u=eS(i,s,a,l),d=tS(e,u,c,t),g=nS(e,i,l,d,r,o)?I.Never:I.Object,h=xi({type:"object",required:d,properties:l,minProperties:o,maxProperties:r,additionalProperties:i,patternProperties:iS(s),dependencies:sS(c,t),propertyNames:a});return be(g,h,e.delegate,e.path)}function ah(e,t,n){let r=n[t];if(r===void 0)return;if(Number.isNaN(r)){re(e,"find NaN",t);return}if(r<0){re(e,`find invalid number ${r}`,t);return}return r}function Gk(e,{additionalProperties:t}){if(t===!1)return be(I.Never,{type:"string",maxLength:0,minLength:1},e.delegate,e.path);if(typeof t!=="object")return be(I.Any,{},e.delegate,e.path);let n=ze(e,"additionalProperties"),r=Fe(t);return De(n,r)}function Hk(e,{patternProperties:t}){let n=!1,r={};for(let o in t){let i=oS(o);if(i instanceof Error){re(e,`property name invalid. ${o}`,"patternProperties",o);continue}let s=Fe(t[o]),a=ze(e,"patternProperties",o),c=De(a,s);if(!c){n=!0;continue}r[o]=[c,i]}if(n)return null;return r}function Qk(e,{propertyNames:t}){if(!t)return be(I.Any,{},e.delegate,e.path);t=Fe(t);let n=ze(e,"propertyNames"),r=De(n,t);if(!r)return null;let o=X(r);if(o!==I.String&&o!==I.Any)return Ar(r);return r}function Yk(e,t,n,{properties:r}){let o=!1;if(!r)return{};let i={};for(let s in r){if(pt(n,s)===Pe.Invalid){re(e,`key ${JSON.stringify(s)} cannot pass JSON schema from propertyNames`,"properties");continue}let a=uh(t,s);if(a&&X(a)===I.Never){re(e,`key ${JSON.stringify(s)} matches a pattern that has a impossible(never) schema`,"properties");continue}let c=Fe(r[s]),l=ze(e,"properties",s),u=De(l,c);if(!u){o=!0;continue}i[s]=u}if(o)return null;return i}function Xk(e,{dependencies:t}){if(!t)return[{},{}];let n={},r={};for(let o in t){let i=Fe(t[o]);if(Array.isArray(i)){let{keys:s,duplicated:a}=lh(i);if(a)re(e,`found duplicated property names: ${a.join(", ")}`,"dependencies",o);n[o]=s}else{let s=ze(e,"dependencies",o),a=De(s,i);if(a){let c=X(a);if(c===I.Object||c===I.Any)r[o]=a;else if(c===I.Extends)r[o]=_r;else r[o]=Ar(a)}}}return[n,r]}function eS(e,t,n,r){return(o)=>{if(pt(n,o)===Pe.Invalid)return!0;let i=uh(t,o);if(i&&X(i)===I.Never)return!0;let s=r[o]??e;if(X(s)===I.Never)return!0;return!1}}function tS(e,t,n,{required:r}){if(!r)return[];let o=lh(r);if(o.duplicated)re(e,`found duplicated required keys: ${o.duplicated.join(", ")}`,"required");let i=[],s=[];for(let a of o.keys)if(rS(n,a).some((l)=>t(l)))s.push(a);else i.push(a);if(s.length>0)re(e,`key ${s.map((a)=>JSON.stringify(a)).join(", ")} will ban by another condition`,"required");return i}function nS(e,t,n,r,o,i){if(o!==void 0&&i!==void 0&&o<i)return re(e,`maxProperties(${o}) is less than minProperties(${i})`),!0;if(o!==void 0&&r.length>o)return re(e,`length(${r.length}) of required is greater than maxProperties(${o})`),!0;if(i!==void 0&&r.length<i)return re(e,`length(${r.length}) of required is less than minProperties(${i})`),!0;if(X(t)!==I.Never)return!1;for(let s in n){let a=n[s];if(X(a)!==I.Never)return!1}return!0}function rS([e,t],n){let r=[n],o=new Set(r);while(r.length>0){let s=r.pop(),a=t[s],c=e[s];if(a){if(X(a)===I.Object)i(a.required)}if(c)i(c)}function i(s){if(s){for(let a of s)if(!o.has(a))o.add(a),r.push(a)}}return[...o]}function lh(e){let t=new Set,n=new Set;for(let r of e)if(t.has(r))n.add(r);else t.add(r);if(n.size===0)return{keys:[...e],duplicated:null};else return{keys:[...t],duplicated:[...n]}}function uh(e,t){for(let n in e){let[r,o]=e[n];if(o.test(t))return r}return null}function oS(e){try{return new RegExp(e,"i")}catch(t){if(t instanceof SyntaxError)return t;else throw t}}function iS(e){let t={};for(let n in e)t[n]=e[n][0];return t}function sS([e,t],{dependencies:n}){let r={};for(let o in n){let i=e[o],s=t[o];r[o]=i||s}return r}var xl=new Set(["type","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum"]),dh=new Set(["type","format","maxLength","minLength","pattern"]);function fh(e,t){let{type:n}=t;switch(n){case"number":case"integer":return aS(e,t);case"string":return lS(e,t);case"boolean":case"null":{let r=Object.keys(t).filter((s)=>dt(s)&&s!=="type");if(r.length>0)re(e,`key "type" will exclude other keys: ${r.toSorted().join(", ")}`);let o=n==="null"?I.Null:I.Boolean;return be(o,{type:n},e.delegate,e.path)}default:return $t(e,`invalid type ${JSON.stringify(n)}`),null}}function aS(e,t){let n=Object.keys(t).filter((u)=>!xl.has(u)&&dt(u));if(n.length>0)re(e,`type=${JSON.stringify(t.type)} will exclude other keys: ${n.toSorted().join(", ")}`);let r=pl(t,xl);for(let u of xl){let d=r[u];if(u!=="type"&&d!==void 0&&Number.isNaN(d))re(e,"found NaN",u),delete r[u]}let{maximum:o,exclusiveMaximum:i,minimum:s,exclusiveMinimum:a}=r;if(o!==void 0&&i!==void 0){if(o===i)delete r.maximum;else if(o<i)delete r.exclusiveMaximum;else if(o>i)delete r.maximum}if(s!==void 0&&a!==void 0){if(s===a)delete r.minimum;else if(s<a)delete r.exclusiveMinimum;else if(s>a)delete r.minimum}let{multipleOf:c}=r;if(c===0)delete r.multipleOf,r.type="number",re(e,"cannot be 0","multipleOf");let l=I.Numeric;if(!cS(r))l=I.Never;return be(l,r,e.delegate,e.path)}function cS(e){let{maximum:t,exclusiveMaximum:n,minimum:r,exclusiveMinimum:o}=e;if(t!==void 0&&r!==void 0)return t>=r;else if(n!==void 0&&r!==void 0)return n>r;else if(t!==void 0&&o!==void 0)return t>o;else if(n!==void 0&&o!==void 0)return n>o;else return!0}function lS(e,t){let n=Object.keys(t).filter((a)=>!dh.has(a)&&dt(a));if(n.length>0)re(e,`type="string" will exclude other keys: ${n.toSorted().join(", ")}`);let r=pl(t,dh);ph(e,r,"maxLength"),ph(e,r,"minLength");let{maxLength:o,minLength:i}=r,s=I.String;if(o!==void 0){if(o<0)s=I.Never;else if(o!==void 0&&i!==void 0&&o<i)s=I.Never}return be(s,r,e.delegate,e.path)}function ph(e,t,n){let r=t[n];if(r!==void 0){if(Number.isNaN(r))re(e,"found NaN",n),delete t[n]}}var mh=Object.freeze([]);function Si(e,t,n,r){if(Ze(e))return{schema:e,warns:mh};if(t.isExtendsSchema(e))return{schema:e,warns:mh};if(r){let s=r.isSchema(e);if(typeof s==="object"){let a=[];for(let c of s)a.push({kind:En.External,error:c});if(a.length>0)return a}else if(s===!1)throw Error("it is not a JSON Schema 7")}let o={delegate:r,payload:n,extends:t,path:[],errors:[],warns:[]},i=De(o,e);if(i)gh(o.errors.length===0,"found errors (it should be empty)");else return gh(o.errors.length>0,"cannot found any errors"),o.errors;return{schema:i,warns:o.warns}}function gh(e,t){if(!e)throw Error(t)}function De(e,t){if(e.extends.isExtendsSchema(t))return t;if(Ze(t))return t;let n=e.extends.tryCompiledExtendsSchema(t,e.payload);if(n)return n;let r=t,o=!1,{enum:i,const:s}=t;if(i||s!==void 0){let{enum:c,const:l,...u}=t;r=u,o=!0}let a=uS(e,r);if(a&&o)a=sh(e,i,s,a);if(!a)return null;return a}function uS(e,t){for(let n of ih){let r=t[n];if(r){let o=Object.keys(t).filter((s)=>dt(s)&&s!==n);if(o.length>0)re(e,`composition key ${JSON.stringify(n)} will exclude other keys: ${o.toSorted().join(", ")}`);let i=vl(e,n,r);if(!i)return null;return i}}{let n=Fe(t.not);if(n){let r=Object.keys(t).filter((a)=>dt(a)&&a!=="not");if(r.length>0)re(e,`key "not" will exclude other keys: ${r.toSorted().join(", ")}`);let o=ze(e,"not"),i=De(o,n);if(!i)return null;let s=I.Not;switch(X(i)){case I.Never:{s=I.Any;break}case I.Any:{s=I.Never;break}}return be(s,{not:i},e.delegate,e.path)}}if(t.type){let{type:n}=t;if(Array.isArray(n)){let{type:r,...o}=t;return vl(e,"anyOf",n.map((i)=>({...o,type:i})))}switch(n){case"object":return ch(e,t);case"array":return oh(e,t);default:return fh(e,t)}}if(Xg(t))return be(I.Any,{},e.delegate,e.path);return $t(e,"unrecognized"),null}class kl{constructor(e){let t=Object.freeze(e.toSorted());if(t.length>32)throw Error(`cannot define ${t.length} keys which is greater than 32`);this.keys=t,this.clazz=class extends hh{constructor(n){super(t,n)}};for(let[n,r]of this.keys.entries()){let o=1<<n;Object.defineProperty(this.clazz.prototype,r,{enumerable:!0,get:function(){return!!(this.int32&o)},set:function(s){if(s)this.int32|=o;else this.int32&=~o}})}}toBundle(e){let t=0;if(typeof e==="number")t=e;else if(e){for(let[n,r]of this.keys.entries())if(e[r])t|=1<<n}return new this.clazz(t)}}class hh{constructor(e,t){this.keys=e,this.int32=t}toInt32(){return this.int32}toString(){let e={};for(let t of this.keys)e[t]=this[t];return JSON.stringify(e)}}function Ii(e){return new yh(e)}class yh{constructor(e){this.description=new kl(e)}get keys(){return this.description.keys}variable(e){let t;if(e)t=this.description.toBundle(e).toInt32();return new bh(this.description,t)}}class bh{constructor(e,t){this.values=new Set;if(this.description=e,t!==void 0)this.values.add(t)}[Symbol.iterator](){let e=this.values[Symbol.iterator]();return{next:()=>{let t=e.next();if(t.done)return t;else return{done:!1,value:this.description.toBundle(t.value)}}}}assign(e){let{values:t}=e;for(let n of t)this.values.add(n);return this}push(e,t){let n=new Set;for(let r of this.values)for(let[o,i]of xt)if(e&i){let s=this.description.toBundle(r);t(o,s),n.add(s.toInt32())}this.values=n}update(e){let t=new Set;for(let n of this.values){let r=this.description.toBundle(n);e(r),t.add(r.toInt32())}this.values=t}}function zt(e,t){let[n]=e,[r]=t;if(n.num<r.num)return dS(e,t);else if(n.num>r.num)return pS(e,t);else return fS(e,t)}function dS(e,t){let[n,r]=e,[o,i]=t;if(r.num<=o.num){let s=r.exclusive,a=o.exclusive;if(r.num<o.num||s||a)return{left:{fromLeft:!0,range:e},right:{fromLeft:!1,range:t}}}if(r.num<=i.num){let s=!0,a=!1;if(r.num===i.num){let c=r.exclusive,l=i.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!1,range:[He(r),i]};return{left:{fromLeft:!0,range:[n,He(o)]},center:[o,r],right:c}}}return{left:{fromLeft:!0,range:[n,He(o)]},center:[o,i],right:{fromLeft:!0,range:[He(i),r]}}}function pS(e,t){let[n,r]=e,[o,i]=t;if(n.num>=i.num){let s=i.exclusive,a=n.exclusive;if(n.num>i.num||s||a)return{left:{fromLeft:!1,range:t},right:{fromLeft:!0,range:e}}}if(i.num<=r.num){let s=!0,a=!1;if(r.num===i.num){let c=i.exclusive,l=r.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!0,range:[He(i),r]};return{left:{fromLeft:!1,range:[o,He(n)]},center:[n,i],right:c}}}return{left:{fromLeft:!1,range:[o,He(n)]},center:[n,r],right:{fromLeft:!1,range:[He(r),i]}}}function fS(e,t){let[n,r]=e,[o,i]=t,s=n.exclusive,a=o.exclusive,c,l=n;if(!s&&a)l=o,c={fromLeft:!0,range:[n,He(o)]};else if(s&&!a)c={fromLeft:!1,range:[o,He(n)]};if(r.num<=i.num){let u=!0,d=!1;if(r.num===i.num){let g=r.exclusive,h=i.exclusive;u=g!==h,d=!g&&h}if(!d){let g;if(u)g={fromLeft:!1,range:[He(r),i]};return{left:c,center:[l,r],right:g}}}return{left:c,center:[l,i],right:{fromLeft:!0,range:[He(i),r]}}}function He(e){return{num:e.num,exclusive:!e.exclusive}}var jn=(e)=>(t=e,n=Number.POSITIVE_INFINITY,r=e,o=Number.POSITIVE_INFINITY)=>{let{left:i,center:s,right:a}=zt([{num:t,exclusive:!1},{num:n,exclusive:!1}],[{num:r,exclusive:!1},{num:o,exclusive:!1}]),c,l,u;if(i)c={min:i.range[0].num,max:i.range[1].num,isFrom1:i.fromLeft};if(a)l={min:a.range[0].num,max:a.range[1].num,isFrom1:a.fromLeft};if(s)u={min:s[0].num,max:s[1].num};return{left:c,right:l,intersection:u}};function _n({left:e,right:t,intersection:n}){if(!n)return b.Rejection;let r=!1,o=!1;if(e)if(e.isFrom1)r=!0;else o=!0;if(t)if(t.isFrom1)r=!0;else o=!0;if(r&&o)return b.Intersection;if(r)return b.Containing;if(o)return b.ContainedBy;return b.Equals}var mS=jn(0),gS=Ii(["hasCommon","hasExtra1","hasExtra2","hasRejection","hasCommonBroken"]);function vh({calculate:e},t,n){let r=mS(t.minItems,t.maxItems,n.minItems,n.maxItems),o=_n(r);if(o===b.Rejection)return H;let[i,s]=wh(t),[a,c]=wh(n),l=Math.max(i.length,a.length)+1,u=Math.min(l,r.intersection.max),d=gS.variable({}),g=Math.min(t.minItems??0,n.minItems??0);for(let y=0;y<u;y++){let S=i[y]??s,R=a[y]??c,N=e(S,R);d.push(N,(q,V)=>{switch(q){case b.Equals:{if(!V.hasRejection)V.hasCommon=!0;break}case b.Containing:{if(!V.hasRejection)V.hasCommon=!0;V.hasExtra1=!0;break}case b.ContainedBy:{if(!V.hasRejection)V.hasCommon=!0;V.hasExtra2=!0;break}case b.Intersection:{if(!V.hasRejection)V.hasCommon=!0;V.hasExtra1=!0,V.hasExtra2=!0;break}case b.Rejection:{if(y<g)V.hasCommonBroken=!0;V.hasRejection=!0,V.hasExtra1=!0,V.hasExtra2=!0;break}}})}d.update((y)=>{switch(o){case b.Containing:{y.hasExtra1=!0;break}case b.ContainedBy:{y.hasExtra2=!0;break}case b.Intersection:{y.hasExtra1=!0,y.hasExtra2=!0;break}}if(t.uniqueItems&&!n.uniqueItems&&(n.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra2=!0;else if(!t.uniqueItems&&n.uniqueItems&&(t.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra1=!0;if(t.maxItems===0||n.maxItems===0){if(y.hasCommon=!0,t.maxItems!==0)y.hasExtra1=!0;if(n.maxItems!==0)y.hasExtra2=!0}});let h=pe;for(let{hasExtra1:y,hasExtra2:S,hasCommon:R,hasCommonBroken:N}of d){let q=R;if(N)q=!1;if(!q)h|=H;else if(y&&S)h|=te;else if(y)h|=Z;else if(S)h|=K;else h|=G}return h}function wh({items:e,additionalItems:t}){if(Array.isArray(e))return[e,t??Nt];else return[[],e??Nt]}function xh(e){let t=new Map;return(n,r)=>{let o=Rr(n),i=Rr(r);if(o!==i)return!1;if(!o)return n===r;return Sh(t,n,r,e)}}function kh(e){let t=new Map;return(n,r)=>Sh(t,n,r,e)}function Sh(e,t,n,r){let o=Gt(t),i=Gt(n),s=`${o}/${i}`,a=e.get(s);if(a===void 0)e.set(s,a=r(t,n));return a}function Ch(e,t,n){let r=Sl(t),o=Sl(n),i=!1,s=!1,a=!1;for(let c of r){if(Ih(e,o,c))a=!0;else i=!0;if(i&&a)break}for(let c of o){if(Ih(e,r,c))a=!0;else s=!0;if(s&&a)break}if(!a)return H;if(i&&s)return te;if(i)return Z;if(s)return K;return G}function Il(e,t){let n=!1,r=!1;for(let o of Sl(e)){switch(pt(t,o)){case Pe.Valid:{n=!0;break}case Pe.Invalid:{r=!0;break}case Pe.Unknown:return We}if(n&&r)break}if(n&&r)return te;if(n)return G|K;if(r)return H;if(X(t)===I.Never)return G;return K}function Sl({const:e,enum:t}){if(e!==void 0)return[e];if(t)return t;throw Error("invalid branch")}function Ih({isEquals:e},t,n){for(let r of t)if(e(r,n))return!0;return!1}function Eh(e){function t(s,a){let c=e.isExtendsSchema(s),l=e.isExtendsSchema(a);if(c||l)return e.equals(s,a);else return r(s,a)}let n=new Map;function r(s,a){let c=Gt(s),l=Gt(a);if(c===l)return!0;let u=`${c}/${l}`,d=n.get(u);if(d===void 0)d=o(s,a),n.set(u,d);return d}function o(s,a){if(Array.isArray(s)){if(!Array.isArray(a))return!1;if(s.length!==a.length)return!1;for(let[c,l]of s.entries())if(!i(l,a[c]))return!1}else{if(Array.isArray(a))return!1;for(let c in s){if(!(c in a))return!1;let l=Reflect.get(s,c),u=Reflect.get(a,c);if(!i(l,u))return!1}for(let c in a)if(!(c in s))return!1}return!0}function i(s,a){if(s===a)return!0;if(s===null||a===null)return!1;if(typeof s!=="object")return!1;if(typeof s!==typeof a)return!1;if(Ze(s)&&Ze(a))return r(s,a);return o(s,a)}return t}function Pr(e){let t=Tr(e),n=e.multipleOf??1,r=it(t,n);if(!r)return null;return{multipleOf:n,range:r}}function Oh([e,t]){if(e.num!==t.num)return!1;if(e.exclusive)return!1;if(t.exclusive)return!1;return!0}function it(e,t){if(!e)return;let[n,r]=e,o=hS(n.num,t),i=yS(r.num,t);if(o===n.num&&n.exclusive)o+=t;if(i===r.num&&r.exclusive)i-=t;if(o>i)return;if(o===i){if(o===Number.POSITIVE_INFINITY)return;if(o===Number.NEGATIVE_INFINITY)return}return[{num:o,exclusive:!1},{num:i,exclusive:!1}]}function hS(e,t){return Math.ceil(e/t)*t}function yS(e,t){return Math.floor(e/t)*t}function _h(e,t){let n=Tr(e),r=Tr(t),{left:o,right:i,center:s}=zt(n,r);if(!s)return H;let a=!1,c=!1;if(o)if(o.fromLeft)a=!0;else c=!0;if(i)if(i.fromLeft)a=!0;else c=!0;if(a&&c)return te;if(a)return Z;if(c)return K;return G}function Cl(e,t){let n=Tr(e),r=Pr(t);if(!r)return Z;let o=zt(n,r.range),i=it(o.center,r.multipleOf),s=jh(o.left,r.multipleOf),a=jh(o.right,r.multipleOf);if(!o.center)return H;let c=!1,l=!1;if(o.left?.fromLeft)c=!0;if(o.right?.fromLeft)c=!0;if(!i||!Oh(o.center))c=!0;if(s)l=!0;if(a)l=!0;if(c&&l)return te;if(c)return Z;if(l)return K;return G}function Tr(e){let t,n;if(e.exclusiveMinimum!==void 0)t={num:e.exclusiveMinimum,exclusive:!0};else if(e.minimum!==void 0)t={num:e.minimum,exclusive:!1};else t={num:Number.NEGATIVE_INFINITY,exclusive:!0};if(e.exclusiveMaximum!==void 0)n={num:e.exclusiveMaximum,exclusive:!0};else if(e.maximum!==void 0)n={num:e.maximum,exclusive:!1};else n={num:Number.POSITIVE_INFINITY,exclusive:!0};return[t,n]}function jh(e,t){if(!e)return;if(e.fromLeft)return;return it(e.range,t)}function Ph(e,t){let n=Pr(e),r=Pr(t);if(!n&&!r)return G;if(!n)return K;if(!r)return Z;let{range:o,multipleOf:i}=n,{range:s,multipleOf:a}=r,c=zt(o,s),l,u=0;if(c.center)u=bS(i,a),l=it(c.center,u);if(!l)return H;let d=!1,g=!1,{left:h,right:y}=c;if(h&&it(h.range,h.fromLeft?i:a))if(h.fromLeft)d=!0;else g=!0;if(y&&it(y.range,y.fromLeft?i:a))if(y.fromLeft)d=!0;else g=!0;if(d=d||Rh(n,l,u),g=g||Rh(r,l,u),d&&g)return te;if(d)return Z;if(g)return K;return G}function Rh({range:e,multipleOf:t},n,r){let o=zt(e,n);if(it(o.left?.range,t))return!0;if(it(o.right?.range,t))return!0;let i=it(o.center,t);if(!i)return!1;let s=Ah(n);if(Ah(i)>s)return!0;if(s===1)return!1;if(t<r)return!0;return!1}function bS(e,t){return e*t/Th(e,t)}function Th(e,t){if(e===0)return t;return Th(t%e,e)}function Ah(e){if(!e)return 0;let[t,n]=e;return n.num-t.num+1}function El(e,t){if($h(e)||$h(t))return We;let n=Nh(e),r=Nh(t);if(n&&r)return _h(e,t);else if(n)return Cl(e,t);else if(r)return Tt(Cl(t,e));else return Ph(e,t)}function $h(e){let{multipleOf:t}=e;if(t===void 0)return!1;if(!Number.isInteger(t))return!0;if(t<0)return!0;return!1}function Nh(e){let{multipleOf:t}=e;if(t!==void 0&&Number.isInteger(t))return!1;if(e.type==="integer")return!1;return!0}var wS=jn(0),vS=Ii(["hasCommonInRequired","hasCommonOutRequired","hasExtra1","hasExtra2","hasRejection"]);function qh(e,t,n){if(xS(t,n))return H;let r=kS(t,n);if(!r)return H;let o=zh(t),i=zh(n),s=(S)=>{let R=o(S),N=i(S);if(Dh(R,N))return e.calculate(R,N);else return pe},{commonRequired:a,extraRequired1:c,extraRequired2:l}=r,u=vS.variable({});for(let S of[...a].toSorted())u.push(s(S),IS);for(let S of[...c].toSorted())u.push(s(S),CS);for(let S of[...l].toSorted())u.push(s(S),ES);let{hasOptional1:d,hasOptional2:g}=r;if(d||g){let S=OS(d,g);for(let q of[...SS(t,n)].toSorted()){let V=s(q);if(V!==pe)u.push(V,S)}let R=t.additionalProperties??Nt,N=n.additionalProperties??Nt;if(Dh(R,N)){let q=e.calculate(R,N);u.push(q,S)}}u.update((S)=>{if(!S.hasRejection){if(c.size>0)S.hasExtra2=!0;if(l.size>0)S.hasExtra1=!0}});let{requiredKeysCount:h}=r,y=pe;for(let{hasExtra1:S,hasExtra2:R,hasCommonInRequired:N,hasCommonOutRequired:q,hasRejection:V}of u)if(!N&&h>0)y|=H;else if(!q&&h===0)y|=H;else if(V)y|=H;else if(S&&R)y|=te;else if(S)y|=Z;else if(R)y|=K;else y|=G;return y}function xS(e,t){let n=wS(e.minProperties,e.maxProperties,t.minProperties,t.maxProperties);return _n(n)===b.Rejection}function kS(e,t){let n=new Set(e.required),r=new Set(t.required),o=new Set,i=new Set,s=n.size,a=r.size;for(let d of n){if(r.has(d))o.add(d);i.add(d)}for(let d of r){if(n.has(d))o.add(d);i.add(d)}let c=i.size;for(let d of o)n.delete(d),r.delete(d);let l=e.maxProperties??Number.MAX_SAFE_INTEGER,u=t.maxProperties??Number.MAX_SAFE_INTEGER;if(c>l||c>u)return null;return{requiredKeysCount:c,extraRequired1:n,extraRequired2:r,commonRequired:o,hasOptional1:l>s,hasOptional2:u>a}}function SS(e,t){let n=new Set(e.required),r=e.properties,o=t.properties,i=e.required,s=t.required;if(r)for(let a in r)n.add(a);if(o)for(let a in o)n.add(a);if(i)for(let a of i)n.delete(a);if(s)for(let a of s)n.delete(a);return n}var IS=(e,t)=>{switch(e){case b.Equals:{t.hasCommonInRequired=!0;break}case b.Containing:{t.hasExtra1=!0,t.hasCommonInRequired=!0;break}case b.ContainedBy:{t.hasExtra2=!0,t.hasCommonInRequired=!0;break}case b.Intersection:{t.hasExtra1=!0,t.hasExtra2=!0,t.hasCommonInRequired=!0;break}case b.Rejection:{t.hasRejection=!0;break}}},CS=(e,t)=>{switch(e){case b.Equals:case b.ContainedBy:{t.hasCommonInRequired=!0;break}case b.Intersection:case b.Containing:{t.hasExtra1=!0,t.hasCommonInRequired=!0;break}case b.Rejection:{t.hasRejection=!0;break}}},ES=(e,t)=>{switch(e){case b.Equals:case b.Containing:{t.hasCommonInRequired=!0;break}case b.Intersection:case b.ContainedBy:{t.hasExtra2=!0,t.hasCommonInRequired=!0;break}case b.Rejection:{t.hasRejection=!0;break}}},OS=(e,t)=>(n,r)=>{if(r.hasRejection)return;let o=!1,i=!1,s=!1;switch(n){case b.Equals:{s=!0;break}case b.Containing:{o=!0,s=!0;break}case b.ContainedBy:{i=!0,s=!0;break}case b.Intersection:{o=!0,i=!0,s=!0;break}case b.Rejection:{o=!0,i=!0;break}}if(e&&o)r.hasExtra1=!0;if(t&&i)r.hasExtra2=!0;if(e&&t&&s)r.hasCommonOutRequired=!0};function zh(e){let{properties:t,propertyNames:n,additionalProperties:r}=e,o=[];if(e.patternProperties)for(let i in e.patternProperties){let s=e.patternProperties[i],a=new RegExp(i,"i");o.push({pattern:a,schema:s})}return(i)=>{if(n&&pt(n,i)===Pe.Invalid)return _r;for(let{pattern:a,schema:c}of o)if(a.test(i))return c;let s=(t&&t[i])??r;if(!s)return Nt;return s}}function Dh(e,t){let n=X(e),r=X(t);return n!==I.Never||r!==I.Never}var jS=jn(0);function Vh(e,t){if(t.format&&!e.format)return Z;if(e.format&&t.format&&e.format!==t.format)return We;let n=jS(e.minLength,e.maxLength,t.minLength,t.maxLength),r=_n(n),o=!!e.pattern,i=!!t.pattern;switch(r){case b.Rejection:return H;case b.Containing:return o?We:Z;case b.ContainedBy:return i?We:K;case b.Equals:{if(o&&i)return e.pattern===t.pattern?G:We;if(o)return G|K;if(i)return G|Z;return G}case b.Intersection:{if(o&&i)return We;if(o)return te|H|K;if(i)return te|H|Z;return te}}}function Mh(e,t,n){let r={},o=[],i=kh(RS(e,r)),s=_S(),a=Eh(e);r.isEquals=xh(In),r.calculate=gl({describe:s,equals:a,calculate:i,observeCalculation:(l,u,d,g)=>{let h=g?Tt(d):d;if(!AS(h))return;let y=g?Lh(u,l):Lh(l,u);if(y)o.push(y)}}),Object.freeze(r);let c=r.calculate(t,n);return{errorPath:o[0],expression:c}}var _S=()=>(e)=>{let t;switch(X(e)){case I.Not:{t={kind:Me.Not,expression:e.not};break}case I.Combination:{if("allOf"in e)t={kind:Me.AllOf,expressions:Ol(e.allOf,I.Any)};else if("anyOf"in e)t={kind:Me.AnyOf,expressions:Ol(e.anyOf,I.Never)};else if("oneOf"in e)t={kind:Me.OneOf,expressions:Ol(e.oneOf,I.Never)};else throw Error(`invalid combination JSON Schema: ${JSON.stringify(e)}`);break}default:{t={kind:Me.Leaf};break}}return t},RS=(e,t)=>(n,r)=>{let o=X(n),i=X(r);if(o===I.Extends||i===I.Extends)return e.calculate(n,r);switch(o){case I.Any:return i===I.Any?G:Z;case I.Never:return i===I.Never?G:K}switch(i){case I.Any:return K;case I.Never:return Z}if(o===I.EnumOrConst&&i===I.EnumOrConst)return Ch(t,n,r);if(o===I.EnumOrConst)return Il(n,r);if(i===I.EnumOrConst)return Tt(Il(r,n));if(o!==i)return H;switch(o){case I.Null:return G;case I.Numeric:return El(n,r);case I.String:return Vh(n,r);case I.Boolean:return G;case I.Object:return qh(t,n,r);case I.Array:return vh(t,n,r);default:throw Error(`invalid kind ${o}`)}};function Ol(e,t){return e.filter((n)=>X(n)!==t)}function AS(e){return!kr(e)&&!Ir(e)&&(Sr(e)||Er(e)||Cr(e))}function Lh(e,t){let n=bl(t);if(!n)return;let r=X(e),o=X(t);if(r!==o)return[...n,"type"];let i=e,s=t;switch(o){case I.String:{if((i.minLength??0)<(s.minLength??0))return[...n,"minLength"];if((i.maxLength??Number.POSITIVE_INFINITY)>(s.maxLength??Number.POSITIVE_INFINITY))return[...n,"maxLength"];if(i.pattern!==s.pattern&&s.pattern)return[...n,"pattern"];if(i.format!==s.format&&s.format)return[...n,"format"];break}case I.Numeric:{if((i.minimum??i.exclusiveMinimum??Number.NEGATIVE_INFINITY)<(s.minimum??s.exclusiveMinimum??Number.NEGATIVE_INFINITY))return[...n,s.exclusiveMinimum==null?"minimum":"exclusiveMinimum"];if((i.maximum??i.exclusiveMaximum??Number.POSITIVE_INFINITY)>(s.maximum??s.exclusiveMaximum??Number.POSITIVE_INFINITY))return[...n,s.exclusiveMaximum==null?"maximum":"exclusiveMaximum"];if(i.multipleOf!==s.multipleOf&&s.multipleOf!=null)return[...n,"multipleOf"];break}case I.Array:{if((i.minItems??0)<(s.minItems??0))return[...n,"minItems"];if((i.maxItems??Number.POSITIVE_INFINITY)>(s.maxItems??Number.POSITIVE_INFINITY))return[...n,"maxItems"];if(!i.uniqueItems&&s.uniqueItems)return[...n,"uniqueItems"];break}case I.Object:{let a=new Set(i.required??[]);if((s.required??[]).some((c)=>!a.has(c)))return[...n,"required"];if((i.minProperties??0)<(s.minProperties??0))return[...n,"minProperties"];if((i.maxProperties??Number.POSITIVE_INFINITY)>(s.maxProperties??Number.POSITIVE_INFINITY))return[...n,"maxProperties"];break}case I.EnumOrConst:return[...n,s.const===void 0?"enum":"const"]}return n}class $r{constructor(e=[]){this.extendsSchemaClasses=Object.freeze([...e])}tryCompiledExtendsSchema(e,t){for(let n of this.extendsSchemaClasses)if(n.isMatch(e))return new n(At(),e,t);return null}isExtendsSchema(e){for(let t of this.extendsSchemaClasses)if(e instanceof t)return!0;return!1}calculate(e,t){let n=this.findMatchedClass(e,t),r=!(e instanceof n),o=pe,i;if(r)i=t.compare(e);else i=e.compare(t);for(let s of i){if(r)s=$r.swap(s);o|=Pt(s)}return o}equals(e,t){let n=this.findMatchedClass(e,t);if(!(e instanceof n))return t.equals(e);else return e.equals(t)}findMatchedClass(e,t){for(let n of this.extendsSchemaClasses){if(e instanceof n)return n;if(t instanceof n)return n}throw Error("Invalid schema")}static swap(e){switch(e){case b.Containing:return b.ContainedBy;case b.ContainedBy:return b.Containing;default:return e}}}function Fh(e,t,n=!1){let r=t(e);if(Array.isArray(r)){let s=[];throw jl(s,r,"$"),new vi(s)}let{schema:o,warns:i}=r;if(n&&i.length>0){console.warn(`found ${i.length} warns after compile schema`);for(let s of i)console.warn(On(s))}return o}function Zh(e,t,n,r=!1){let o=n(e),i=n(t);if(Array.isArray(o)||Array.isArray(i)){let u=[];if(Array.isArray(o))jl(u,o,"$1");if(Array.isArray(i))jl(u,i,"$2");throw new vi(u)}let{schema:s,warns:a}=o,{schema:c,warns:l}=i;if(r){if(a.length>0)console.warn(`found ${a.length} warns after compile superSchema`);for(let u of a)console.warn(On(u));if(l.length>0)console.warn(`found ${l.length} warns after compile subSchema`);for(let u of l)console.warn(On(u))}return[s,c]}function jl(e,t,n){for(let r of t){let o={...r,path:[n,...r.path]};e.push(o)}}var Nr=Object.freeze({True:0,False:1,Unknown:2});function _l({extendsSchemaClasses:e,delegate:t}={}){let n=new $r(e);return Object.freeze({compile:(o,i,s)=>Fh(o,(c)=>Si(c,n,i,t),s),isSubset:(o,i,s=!1)=>{let a=(y)=>Si(y,n,void 0,t),[c,l]=Zh(o,i,a,s),{errorPath:u,expression:d}=Mh(n,c,l),g=kr(d)||Ir(d),h=Sr(d)||Er(d)||Cr(d);if(g&&!h)return{result:Nr.True};if(!g&&h)return{errorPath:u,result:Nr.False};return{result:Nr.Unknown}}})}var Ci=(e)=>typeof e==="string";var PS=Array.isArray;var TS=(e)=>e!==null&&typeof e==="object";var $S=(e)=>TS(e)&&!PS(e),Ht=(e)=>$S(e)?e:void 0;function NS(e){return Ht(e)?.type==="string"}function zS(e){let t=Ht(e),n=Ht(t?.error);if(t==null||n==null||t.packageId!=null&&!Ci(t.packageId)||n.message!=null&&!Ci(n.message))throw TypeError("Invalid schema comparison context.")}function DS(e){if(e==null)return{error:{}};return zS(e),e}class Dt{static setError(e,t,n){if(e instanceof Dt)e.context.error.message=n;else if(t instanceof Dt)t.context.error.message=n}constructor(e,t,n){this.id=e,this.value=t,this.context=DS(n)}compare(e){if(Ze(e)&&X(e)===I.Any)return[b.ContainedBy];return this.compareImpl(e)}}class zr extends Dt{static isMatch(e){let t=Ht(e)?.enum;return Array.isArray(t)&&t.every((n)=>Ci(n))}constructor(e,t,n){if(!zr.isMatch(t))throw TypeError("Invalid single-select schema.");super(e,t,n)}compareImpl(e){if(NS(e))return[b.ContainedBy];if(e instanceof zr){let t=new Set(this.value.enum),n=b.Equals;for(let r of e.value.enum){if(!t.has(r))n=b.ContainedBy;t.delete(r)}if(t.size===0)return[n];if(t.size===this.value.enum.length)return[b.Rejection];return[b.Intersection]}return[b.Rejection]}equals(e){if(e instanceof zr){let t=new Set(this.value.enum);for(let n of e.value.enum){if(!t.has(n))return!1;t.delete(n)}return t.size===0}return!1}}class Dr extends Dt{static isMatch(e){return Ht(e)?.contentMediaType==="oomol/bin"}constructor(e,t,n){if(!Dr.isMatch(t))throw TypeError("Invalid binary schema.");super(e,t,n)}compareImpl(e){if(e instanceof Dr)return[b.Equals];else return Dt.setError(this,e,"edgeError.binDiffType"),[b.Rejection]}equals(e){return e instanceof Dr}}class qr extends Dt{static isMatch(e){return Ht(e)?.contentMediaType==="oomol/artifact"}constructor(e,t,n){if(!qr.isMatch(t))throw TypeError("Invalid Artifact schema.");super(e,t,n)}compareImpl(e){if(e instanceof qr)return[b.Equals];return Dt.setError(this,e,"edgeError.artifactDiffType"),[b.Rejection]}equals(e){return e instanceof qr}}function Jh(){return _l({extendsSchemaClasses:[zr,Dr,qr]})}var xR=Jh();var qS=new Set(["const","enum","exclusiveMaximum","exclusiveMinimum","maximum","maxItems","maxLength","maxProperties","minimum","minItems","minLength","minProperties","multipleOf","pattern","required","type"]);function Ei(e){return qS.has(e)}var Oi=C({handle:j().min(1),jsonSchema:Ae(),nullable:me(),description:j().optional()}),$R=v({inputs:A(Oi).nullable(),outputs:A(Oi).nullable()});var Uh=C({version:w(1),flowId:j().min(1),name:j(),revisionId:j().min(1),publicationId:j().min(1),inputs:A(Oi),outputs:A(Oi).nullable()});var Bh=C({version:w(1),direction:B(["incoming","outgoing"]),total:xe().nonnegative(),nextOffset:xe().nonnegative().optional(),references:A(C({flowId:j(),name:j().nullable(),available:me(),draft:me(),live:C({publicationId:j(),enabled:me()}).nullable()}))});var Rl=["GET","POST","PUT","PATCH","DELETE"];function ji(e){return e!=="GET"}function LS(e){return e.kind==="decision"}var Al={choice:255,score:10};function Kh(e){if(e.type==="noul"||e.criteria.length<=Al[e.type])return e;if(e.type==="choice")return{...e,criteria:e.criteria.slice(0,Al.choice)};return{...e,criteria:e.criteria.slice(0,Al.score)}}function MS(e){let t=e.map(Kh);return t.every((n,r)=>n===e[r])?e:t}function Wh(e){if(!LS(e.executor))return e;let t=e.executor.questions,n=MS(t);if(n===t)return e;let r=e.outputs.map((o)=>{if(!("handle"in o))return o;let i=t.findIndex((s)=>s.name===o.handle);if(i<0||t[i]===n[i]||!Se(o.jsonSchema,Gh(t[i])))return o;return{...o,jsonSchema:FS(n[i])}});return{...e,executor:{...e.executor,questions:n},outputs:r}}var Pl={type:"number",minimum:0,maximum:1};function FS(e){return Gh(Kh(e))}function Gh(e){let t={type:{const:e.type}};if(e.type==="noul")t.noul=Pl;else{let n=e.type==="choice"?e.criteria.map((r)=>r.name):e.criteria.map((r,o)=>String(o));if(t.confidence=Pl,t.probabilities={type:"object",properties:Object.fromEntries(n.map((r)=>[r,Pl])),required:n,additionalProperties:!1},e.type==="choice")t.choice={type:"string",...n.length?{enum:n}:{}};else t.score={type:"number",minimum:0,maximum:Math.max(0,n.length-1)},t.legend={type:"object",properties:Object.fromEntries(n.map((r)=>[r,{type:"string"}])),required:n,additionalProperties:!1}}return{type:"object",properties:t,required:Object.keys(t)}}function Hh(e){for(let[t,n]of Object.entries(e))if(t.startsWith("auth.")&&n.kind=="value")throw TypeError("HTTP authentication accepts deployment variables and upstream outputs only.")}var ZS=/^(?:\*\.)?(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,Tl=20;function $l(e){return ZS.test(e)&&(!e.startsWith("*.")||e.slice(2).includes("."))}var Qh=v({mode:B(["fields","object"]).default("fields"),names:A(j()).default([])}),_i=v({method:B(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]).default("GET"),query:Qh.default({mode:"fields",names:[]}),headers:Qh.default({mode:"fields",names:[]}),bodyFormat:B(["none","json","text","form"]).default("none"),authentication:Y([v({type:w("none")}),v({type:B(["bearer","basic"])}),v({type:w("apiKey"),name:j(),in:B(["header","query"])})]).default({type:"none"}),responseFormat:B(["auto","json","text"]).default("auto"),statusPolicy:B(["success","all"]).default("success")}),Xh=_i.extend({kind:w("http-request")});function Qt(e,t=0){if(t>64)throw TypeError("Value exceeds the maximum JSON depth.");if(e!=null&&typeof e=="object")for(let n of Object.values(e))Qt(n,t+1)}var Nl=["code","connector","openapi","http-request","llm","decision"],Ri={maxRetries:5,minIntervalMs:1000,maxIntervalMs:60000,intervalStepMs:1000};var ft=v({maxRetries:U().int().min(0).max(Ri.maxRetries),intervalMs:U().int().min(Ri.minIntervalMs).max(Ri.maxIntervalMs).multipleOf(Ri.intervalStepMs)});var qt=A(Y([C({type:w("cron"),expression:j(),timezone:j()}),C({type:w("every"),unit:B(["day","hour","minute","month","week"]),value:U()})]));function ey(e){try{return Intl.DateTimeFormat("en",{timeZone:e}),!0}catch{return!1}}var Rn=ot("kind",[v({kind:w("after"),durationMs:U().nullable()}),v({kind:w("at"),at:j(),timezone:j().optional()})]),zl=ot("kind",[Rn.options[0].extend({durationMs:U().int().positive().max(Number.MAX_SAFE_INTEGER)}),Rn.options[1].extend({at:vr.datetime({offset:!0}),timezone:j().refine(ey,"Select a valid IANA timezone.").optional()})]);var Lr={defaultMs:30000,minMs:1000,maxMs:60000};var ty={jsonSchema:{type:"object",additionalProperties:{type:["string","number","boolean"]}},nullable:!0};var BS=[{handle:"body",jsonSchema:{},nullable:!0,value:""},{handle:"statusCode",jsonSchema:{type:"number"},nullable:!1,value:200},{handle:"headers",jsonSchema:ty.jsonSchema,nullable:!1,value:{}}];var zi=13,k=j(),Pi=k.describe('Account selection: omit while unconfigured; use an account ID to select it; use "" to explicitly defer configuration. Deferred Actions fail if called; deferred Agent tools are excluded from the callable tool set. Not supported by Triggers.'),en=Ae(),Mr=A(k),Vt=C({description:k.optional(),jsonSchema:en,nullable:me(),handle:k}),KS=A(Vt.strict()),Qe=Vt.extend({value:en.optional()}),ny=C({collapsed:me().optional(),group:k}),WS=C({kind:w("node"),nodeId:k,output:k,system:w(!0).optional(),field:k.optional()}),iy=Y([WS,C({kind:w("binding"),bindingId:k})]),Fr=Y([C({kind:w("unset")}),C({kind:w("value"),value:en})]),Dl=Y([Fr,C({kind:w("sources"),sources:A(iy)})]),sy=oe(k,Dl),Pn={inputs:A(Y([Qe,ny])),outputs:A(Y([Vt,ny]))},GS=v({kind:w("connector"),action:k,connectionId:k.optional(),connections:A(v({connectionId:k,alias:k.optional()}))}),Fl=Y([GS,v({kind:w("connector"),mode:w("shared")}),v({kind:w("connector"),mode:w("independent"),actions:A(v({action:k,connectionId:Pi.optional()}))}),v({kind:w("connector"),actionHints:A(k).optional(),connectionHints:A(v({action:k,connectionId:k,alias:k.optional()})).optional()})]),ay=v({kind:w("workflow"),name:k,flowId:k,revisionId:k,inputs:A(Vt),outputs:A(Vt).nullable()}),Zl=v({kind:w("http"),hosts:A(k.refine($l,'Use a lowercase host name or IPv4 address, optionally prefixed by "*." for subdomains.')).min(1).max(Tl).describe('Hosts Code may call with context.fetch. "*.example.com" matches subdomains only.')}),Ti=Y([Fl,ay,Zl]),ql=C({...Pn,name:k,moduleId:k,capabilities:A(Ti).optional()}),cy=Y([C({kind:w("value"),value:en}),C({kind:w("input"),input:k})]),HS=Y([cy,C({kind:w("model")})]),Di={id:k,name:k,description:k,approval:me(),inputs:A(Qe.extend({source:HS}))},Jl=C({...Di,kind:w("connector").optional(),action:k,connectionId:Pi.optional()}),Ul=ay.extend(Di),QS=ot("type",[v({name:k,instructions:k,type:w("noul"),criteria:v({true:k.optional(),false:k.optional()}).optional()}),v({name:k,instructions:k,type:w("choice"),criteria:A(v({name:k,description:k}))}),v({name:k,instructions:k,type:w("score"),criteria:Mr})]),An=C({...Pn,name:k,executor:Y([C({kind:w("connector"),action:k,connectionId:Pi.optional(),outputMode:w("value").optional()}),C({kind:w("openapi"),sourceUrl:k,method:k,path:k,serverUrl:k,document:en,auth:A(C({id:k,type:B(["bearer","basic","apiKey"]),name:k.optional(),in:B(["header","query"]).optional()}))}),v({kind:w("decision"),questions:A(QS)}),C({kind:w("llm"),mode:B(["chat","json"])}),C({kind:w("agent"),code:me().optional(),model:k,prompt:k,maxRounds:U(),tools:A(Y([Ul,Jl])),notification:C({action:k,connectionId:Pi.optional(),inputDefinitions:A(Qe),messageHandle:k,inputs:oe(k,cy)}).optional()}),v({kind:w("workflow"),flowId:k,revisionId:k}),Xh,Gg])}),Vl=An.transform(Wh),ry=Y([C({kind:w("value"),value:en.optional(),jsonSchema:en.optional()}),C({kind:w("source"),source:iy})]),$i={matchMode:B(["first","all"]),cases:A(C({description:k.optional(),output:k,groups:A(C({expressions:A(C({left:ry,operator:B(["!=","<","<=","==",">",">=","contains","endsWith","hasKey","hasValue","isEmpty","isFalse","isNotEmpty","isNotNull","isNull","isTrue","notContains","notHasKey","notHasValue","startsWith"]),right:ry.optional()}))}))}))},Zr={inputDefinitions:A(Qe),prompt:k},YS=C({allowedMethods:rt().optional(),allowedOrigins:Mr.optional(),noResponseBody:rt().optional(),responseBody:ot("kind",[v({kind:w("workflow-outputs"),output:k.optional(),timeoutMs:U().int().min(Lr.minMs).max(Lr.maxMs).optional()}),v({kind:w("webhook-response"),nodeId:k.optional(),timeoutMs:U().int().min(Lr.minMs).max(Lr.maxMs).optional()})]).optional(),responseData:k.optional(),responseHeaders:oe(k,k).optional(),responseHeadersSource:v({kind:w("workflow-outputs"),output:k.optional()}).optional(),responseHeaderOutputs:oe(k,k).optional(),responseStatusCode:U().int().min(200).max(599).optional(),responseStatusCodeOutput:k.optional()}),Ni={bodyFields:A(Qe),method:B(Rl),options:YS.optional()},oy={configInputs:Pn.inputs,definitionVersion:w(2),description:k,displayName:k,key:k,name:k,outputs:A(Vt).refine((e)=>new Set(e.map((t)=>t.handle)).size===e.length,"Duplicate Trigger output handle."),provider:k},XS=C({body:C({allowArray:me(),allowEmpty:me(),formats:A(B(["form","json","multipart","text"]))}),methods:A(B(["DELETE","GET","HEAD","PATCH","POST","PUT"])),successStatus:U()}),Ll=A(k.min(1)).refine((e)=>new Set(e).size===e.length,"Duplicate source Flow ID."),Yt={name:k,description:k.optional(),icon:k.optional()},Xt={maxExecutions:U().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),inputs:sy,name:k.optional(),description:k.optional(),icon:k.optional(),timeoutMs:U().optional(),retry:ft.optional(),onError:B(["stop","error"]).optional()},Ai=Y([v({...Xt,kind:w("webhook-response"),retry:rt().optional(),onError:rt().optional()}),v({...Xt,kind:w("outputs"),outputDefs:A(Vt.strict()),outputMappings:sy}).omit({inputs:!0}),C({...Xt,inputs:oe(k,rt()),kind:w("condition"),...$i}),C({...Xt,inputs:ut().transform(()=>({})).default({}),kind:w("value"),values:A(Qe)}),C({...Xt,kind:w("task"),task:Y([ql,Vl]),additionalInputs:A(Qe).optional()}),v({...Xt,kind:w("approval"),...Zr}).omit({timeoutMs:!0}),v({...Xt,kind:w("wait"),...Zr,autoContinue:Rn.optional()}).omit({timeoutMs:!0}),C({...Yt,kind:w("manual")}),v({...Yt,kind:w("start"),inputDefs:KS}),v({...Yt,kind:w("error"),sourceFlowIds:Ll.optional()}),C({...Yt,kind:w("webhook"),...Ni}),C({...Yt,kind:w("cron"),cronTimes:qt}),C({...Yt,kind:w("poll"),connectionId:k.min(1).optional(),config:oe(k,Fr),definition:C({...oy,type:w("poll")}),pollTimes:qt}),C({...Yt,kind:w("integration"),connectionId:k.min(1).optional(),config:oe(k,Fr),definition:C({...oy,type:w("integration"),endpoint:XS})})]),at={input:Qe,port:Vt,ports:Pn,condition:v($i),wait:v(Zr),waitAutoContinue:zl,webhook:v(Ni),schedule:qt,capabilities:A(Ti),connector:An.shape.executor.options[0].omit({kind:!0}).strict(),openapi:An.shape.executor.options[1].omit({kind:!0}).strict(),decision:An.shape.executor.options[2].omit({kind:!0}).strict(),llm:An.shape.executor.options[3].omit({kind:!0}).strict(),agent:An.shape.executor.options[4].omit({kind:!0,notification:!0}).strict()},Ml=C({source:k,target:k,sourceHandle:k.optional()}),Ee={nodeId:k,target:rt().optional()},eI=C({nodes:oe(k,Ai),edges:A(Ml).default([])}),ly=C({kind:w("variable"),target:k}),uy=C({name:k,imports:Mr,source:k}),tI=Fg(nI,C({bindings:oe(k,ly),graph:eI})),dy=C({modelVersion:Y([w(2),w(4),w(5),w(6),w(7),w(8),w(9),w(10),w(11),w(12),w(zi)]),document:tI,modules:oe(k,uy)}),kA=dy.extend({kind:w("open-flow-flow-revision"),version:w(1)});function nI(e){let t=st(e);if(t.tasks!==void 0&&(t.tasks===null||typeof t.tasks!=="object"||Array.isArray(t.tasks)||Object.keys(t.tasks).length>0))throw TypeError("Independent Task definitions are no longer supported.");if(Object.values(st(st(t.graph).nodes)).some((r)=>Object.hasOwn(st(r),"taskId")))throw TypeError("Task references are no longer supported.");let n=t.subflows;if(n!==void 0&&(n===null||typeof n!=="object"||Array.isArray(n)||Object.keys(n).length>0))throw TypeError("Subflows are no longer supported.");if(Object.values(st(st(t.graph).nodes)).some((r)=>st(r).kind==="subflow"))throw TypeError("Subflow nodes are no longer supported.");if(["inputDefs","outputDefs","outputMappings"].some((r)=>Object.hasOwn(t,r)))throw TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");if(Object.values(st(st(t.graph).nodes)).some((r)=>st(r).kind=="start"&&Object.hasOwn(st(r),"parameters")))throw TypeError("Legacy Start.parameters is unsupported; configure node.inputDefs.");return e}function st(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Tn(e){Qt(e);let t=dy.parse(e);return oI(t),my(t.document),t}var rI={"graph.trigger.sources.set":{nodeId:k,before:Ll.optional(),value:Ll.optional()},"binding.create":{bindingId:k,binding:ly},"binding.delete":{bindingId:k},"binding.target.set":{bindingId:k,before:k,value:k},"graph.edge.connect":{edge:Ml,target:rt().optional()},"graph.edge.disconnect":{edge:Ml,target:rt().optional()},"graph.node.create":{...Ee,node:Ai},"graph.node.replace":{...Ee,before:Ai,node:Ai},"graph.node.delete":Ee,"graph.node.field.set":Y([C({...Ee,kind:w("graph.node.field.set"),field:w("retry"),before:ft.optional(),value:ft.optional()}),C({...Ee,kind:w("graph.node.field.set"),field:w("connectionId"),before:k.min(1).optional(),value:k.min(1).optional()}),C({...Ee,kind:w("graph.node.field.set"),field:B(["description","icon","name","onError"]),before:k.optional(),value:k.optional()}),C({...Ee,kind:w("graph.node.field.set"),field:w("maxExecutions"),before:U().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),value:U().int().positive().max(Number.MAX_SAFE_INTEGER).optional()}),C({...Ee,kind:w("graph.node.field.set"),field:w("timeoutMs"),before:U().optional(),value:U().optional()})]),"graph.node.input.set":{...Ee,handle:k,before:Dl.optional(),value:Dl.optional()},"graph.node.additional-inputs.set":{...Ee,before:A(Qe).optional(),value:A(Qe).optional()},"graph.node.condition.set":{...Ee,before:C($i),value:C($i)},"graph.node.values.set":{...Ee,before:A(Qe),value:A(Qe)},"graph.node.resolution.set":{...Ee,before:v({...Zr,autoContinue:Rn.optional()}),value:v({...Zr,autoContinue:Rn.optional()})},"graph.node.webhook.set":{...Ee,before:C(Ni),value:C(Ni)},"graph.node.task.ports.set":{...Ee,before:C(Pn),value:C(Pn)},"graph.node.task.name.set":{...Ee,before:k,value:k},"graph.node.task.capabilities.set":{...Ee,before:A(Ti).optional(),value:A(Ti).optional()},"graph.trigger.config.set":{nodeId:k,name:k,before:Fr.optional(),value:Fr.optional()},"graph.trigger.schedule.set":{nodeId:k,before:qt,value:qt},"module.create":{moduleId:k,module:uy},"module.delete":{moduleId:k},"module.rename":{moduleId:k,before:k,name:k},"module.source.replace":{moduleId:k,beforeImports:Mr,beforeSource:k,imports:Mr,source:k},"graph.node.task.set":{...Ee,before:Y([ql,Vl]),value:Y([ql,Vl])}},py=new Map(Object.entries(rI).map(([e,t])=>[e,t instanceof J?t:C({kind:w(e),...t})])),SA=A(Y([...py.values()])).min(1);function Jr(e,t,n){try{return n(e)}catch(r){if(!(r instanceof ax))throw r;throw TypeError(`operations[${t}]: ${r.issues.map((o)=>`${o.path.join(".")}: ${o.message}`).join("; ")}`,{cause:r})}}function fy(e,t){let{kind:n}=Jr(e,t,C({kind:k}).parse),r=py.get(n);if(r==null)throw TypeError(`operations[${t}]: Unknown operation ${JSON.stringify(n)}.`);return Jr(e,t,r.parse)}function oI(e){if(e.modelVersion<13&&Object.values(e.document.graph.nodes).some((t)=>t.kind==="task"&&("executor"in t.task)&&t.task.executor.kind==="skip-duplicates"))throw Error("Skip Duplicates requires Flow model v13.");if(e.modelVersion<12&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="task"&&("moduleId"in t.task)&&t.task.capabilities?.some((n)=>n.kind=="http")))throw TypeError("Code HTTP access requires Flow model version 12.");if(e.modelVersion<11&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="task"&&("executor"in t.task)&&t.task.executor.kind=="http-request"))throw TypeError("HTTP Request requires Flow model version 11.");if(e.modelVersion<11&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="task"&&("moduleId"in t.task?t.task.capabilities?.some((n)=>n.kind=="workflow"):t.task.executor.kind=="agent"&&t.task.executor.tools.some((n)=>n.kind=="workflow"))))throw TypeError("Workflow tools require Flow model version 11.");if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="webhook"&&(t.options?.responseBody!=null||t.options?.responseStatusCodeOutput!=null||t.options?.responseHeadersSource!=null||t.options?.responseHeaderOutputs!=null)))throw TypeError("Dynamic Webhook responses require Flow model version 10.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((t)=>("retry"in t)&&t.retry!=null))throw TypeError("Node retries require Flow model version 9.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((t)=>{if(t.onError!=null)return!0;if([...Object.values("inputs"in t?t.inputs:{}),...Object.values(t.kind=="outputs"?t.outputMappings:{})].some((r)=>r.kind=="sources"&&r.sources.some((o)=>o.kind=="node"&&o.system)))return!0;return t.kind=="condition"&&t.cases.some((r)=>r.groups.some((o)=>o.expressions.some((i)=>[i.left,i.right].some((s)=>s?.kind=="source"&&s.source.kind=="node"&&s.source.system))))}))throw TypeError("Node error handling requires Flow model version 9.");if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((t)=>t.kind==="webhook-response"))throw TypeError("Webhook response nodes require Flow model version 10.");if(e.modelVersion<8&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="outputs"))throw TypeError("Workflow outputs require Flow model version 8.");if(e.modelVersion<7&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="start"))throw TypeError("Start Triggers require Flow model version 7.");if(e.modelVersion<6&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="task"&&("executor"in t.task)))throw TypeError("Node-owned managed Tasks require Flow model version 6.");if(e.modelVersion<5&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="error"))throw TypeError("Error workflows require Flow model version 5.")}function my(e){for(let t of Object.values(e.graph.nodes))if(t.kind=="task"&&"executor"in t.task&&["openapi","http-request"].includes(t.task.executor.kind))Hh(t.inputs)}var gy=v({mode:B(["chat","json"]),resultSchema:Ae(),model:Ae().optional().describe("Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence."),template:Ae().optional().describe('Default message templates: [{role: "system" | "user" | "assistant", content: "Text with {{namedInput}}"}].'),messages:Ae().optional().describe("Default conversation history, prepended without template interpolation; an array of {role, content} or null.")});var aI=Y([v({schemes:A(j().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.")}),v({type:B(["bearer","basic"])}),v({type:w("apiKey"),name:j().min(1),in:B(["header","query"])})]),hy=v({sourceUrl:j().min(1),path:j().min(1),method:j().min(1),serverUrl:j().optional(),authentication:aI.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")});var z=j().min(1),Ye=Ae(),Hl=oe(z,Ye),qi=["start","outputs","webhook-response","workflow","webhook","cron","error","poll","integration","code","connector","agent","llm","decision","openapi","http-request","skip-duplicates","condition","value","wait","approval"],Ql=B(qi),mt=z.describe('An existing node reference returned by read/search, or $alias for a preceding node.add in this edit batch. For node.add.as "step", reference "$step", never bare "step". Aliases are local to one batch.'),Bl=v({kind:w("output"),node:mt,port:z.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),field:j().optional()}),Kl=v({kind:w("system"),node:mt,port:w("error"),field:j().optional()}),Wl=v({kind:w("variable"),name:z}),yy=Y([Bl,Kl,Wl,v({kind:w("value"),value:Ye}),v({kind:w("unset")}),v({kind:w("default")}),v({kind:w("sources"),sources:A(Y([Bl,Kl,Wl])).min(1)})]),by=Y([v({kind:w("value"),value:Ye.optional(),schema:Ye.optional()}),Bl,Kl,Wl]),wy=oe(z,Di.inputs.element.shape.source).optional().describe("Tool input sources by name. The platform resolves types from the selected Action or workflow. New inputs default to model-provided; omitted existing sources are preserved."),cI=Y([Ul.omit({id:!0,inputs:!0,outputs:!0,revisionId:!0}).extend({inputs:wy}).strict(),Jl.omit({id:!0,inputs:!0}).extend({inputs:wy}).strict()]),lI=A(Y([Fl,v({kind:w("workflow"),name:z,flowId:z}),Zl])),uI=v({...at.connector.shape,messageHandle:z,inputs:oe(z,Y([v({kind:w("value"),value:Ye}),v({kind:w("input"),input:z})]))}),Vi=v({schema:Ye.optional(),nullable:me().optional(),description:j().optional()}),$n=oe(z,Vi.extend({default:Ye.optional()})).describe("Optional business input constraints by name. A binding to a new Code, Agent, LLM, Wait or Approval input automatically declares an input accepting any JSON. Existing constraints are preserved. Omitted schema accepts any JSON; omitted nullable is true. Use default for inherited values; input.set supplies data."),Sy=oe(z,Vi).describe("Workflow input definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Supply call values as trigger.outputs."),dI=Sy.describe("Workflow output definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Set values on the Outputs node with input.set or node.add.inputs."),Iy=oe(z,Vi.extend({schema:Ye,nullable:me()})),vy=oe(z,Vi).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true."),Gl=v({left:by,operator:at.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,right:by.optional()}),xy=v({all:A(Gl)}),pI=Y([Gl,xy,v({any:A(Y([Gl,xy]))})]),kt={"webhook-response":v({}),workflow:v({flowId:z}),start:v({inputDefs:Sy.default({})}),outputs:v({outputDefs:dI.default({})}),error:v({sourceFlowIds:A(z).optional()}),webhook:at.webhook.omit({bodyFields:!0}).extend({body:$n}).strict(),cron:v({schedule:at.schedule}),poll:v({key:z,connectionId:z.optional(),schedule:at.schedule}),integration:v({key:z,connectionId:z.optional()}),code:v({inputs:$n,outputs:vy,capabilities:lI.optional()}),connector:at.connector.omit({outputMode:!0}).strict(),openapi:hy,"http-request":_i,"skip-duplicates":bi,agent:at.agent.omit({prompt:!0,tools:!0}).extend({inputs:$n,resultSchema:Ye.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),tools:A(cI),notification:uI.optional()}).strict(),llm:gy.extend({inputs:$n}),decision:at.decision,condition:v({match:B(["first","all"]),branches:A(v({name:z,description:j().optional(),when:pI}))}),value:v({values:Hl,outputs:vy}),wait:v({inputs:$n,autoContinue:at.waitAutoContinue.optional().describe("Wait only. Omit to disable; clear config.autoContinue to remove. after counts from each wait registration; at requires an explicit offset and continues immediately if already past. Optional timezone preserves the editor zone; at remains the absolute instant. Server requires the deadline to precede the 7-day expiry.")}),approval:v({inputs:$n})},fI={onError:B(["stop","error"]).optional(),name:z.optional(),description:j().optional(),icon:j().optional(),maxExecutions:xe().positive().optional(),timeoutMs:U().nonnegative().optional(),retry:ft.partial().optional().describe('Node retry policy for Code, Connector, OpenAPI, LLM and AI Decision. Omitted update fields preserve the policy; use clear: [["retry"]] to disable it. maxRetries counts additional attempts; intervalMs is 1000\u201360000 in whole seconds.')},mI=v({...fI,config:Hl.optional().describe('Recursively merge configuration; omitted fields remain unchanged and arrays replace as a whole. This includes schema objects: {} does not clear an existing schema. Use clear paths to remove fields, e.g. ["config","inputs","amount","schema","type"].')}),gI=ot("op",[v({op:w("node.add"),as:z.regex(/^[A-Za-z][\w-]*$/).describe("Unique batch-local alias without the $ prefix. Later edits must reference this new node as $alias; the bare alias is not its node ID."),type:Ql,name:z,onError:B(["stop","error"]).optional(),retry:ft.optional(),config:Hl.optional(),inputs:oe(z,yy).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),code:j().optional(),prompt:j().optional()}),v({op:w("node.update"),node:mt,set:mI.optional(),clear:A(A(z).min(1)).optional()}),v({op:w("node.refresh"),node:mt,tool:z.optional().describe("Name of a workflow tool on an Agent or Code node. Omit for a Call Workflow node.")}),v({op:w("node.remove"),node:mt}),v({op:w("input.set"),node:mt,input:z,source:yy}),v({op:B(["edge.connect","edge.disconnect"]),source:mt,target:mt,branch:z.optional()}),v({op:w("text.edit"),node:mt,field:B(["code","prompt"]),oldText:z,newText:j()}),v({op:w("text.set"),node:mt,field:B(["code","prompt"]),text:j()})]),Ur=v({baseRevision:z,requestId:z.max(256),edits:A(gI).min(1).max(1000)}),Li=v({revision:z.optional().describe("Fixed revision from a previous read; omit to read the current draft."),nodes:A(z).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),text:v({node:z,field:B(["code","prompt"]),start:xe().positive().default(1),lines:xe().min(1).max(200).default(80)}).optional().describe("Read code or prompt by line (1-based). Mutually exclusive with nodes. Follow nextStart at the same revision until truncated is false.")}).refine((e)=>e.nodes==null||e.text==null,"Choose nodes or text.").meta({not:{required:["nodes","text"]},description:"Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."}),Yl=v({revisionId:z}),Mi=v({revision:z.optional(),query:z.max(1000),type:Ql.optional(),offset:xe().nonnegative().default(0),limit:xe().min(1).max(100).default(20)}),Cy=v({type:Ql.optional(),action:z.optional()}).refine((e)=>e.type==null||e.action==null,"Choose type or action."),ky={read:{schema:Li,guidance:"Read Start and Outputs node details for their interface definitions and data sources. Choose one mode: outline (omit nodes and text), node details (nodes), or text excerpt (text). nodes and text are mutually exclusive. Text defaults to 80 lines, at most 200 lines and 24000 characters. For the complete text, repeat at nextStart with the same revision until truncated is false.",examples:[{},{revision:"REVISION",nodes:["NODE"]},{revision:"REVISION",text:{node:"NODE",field:"prompt",start:1,lines:80}}]},search:{schema:Mi,guidance:"Search names, configurations and text. Keep the returned revision when following nextOffset or reading a match.",examples:[{query:"Customer summary",type:"agent"}]},edit:{schema:Ur,guidance:'Edit Start config.inputDefs and Outputs config.outputDefs through node.add or node.update; clear paths are relative to the node, e.g. ["config","inputDefs","amount"]. Set Outputs values with input.set. Use the observed revision as baseRevision and a stable requestId. Edits are ordered and atomic. node.add.as declares a batch-local alias without $. Every later reference to that new node must use $alias, including node, edge source/target and output source node fields; a bare alias is not the node ID. Use returned node references in later batches. Updates recursively merge objects (including schemas); {} preserves existing fields. Arrays replace as a whole. Remove fields with clear paths. Text replacement requires exactly one match. Read the target text first. A saved draft can have validation diagnostics.',examples:[{baseRevision:"REVISION",requestId:"CREATE_REQUEST",edits:[{op:"node.add",as:"start",type:"start",name:"Start"},{op:"node.add",as:"step",type:"code",name:"Process",code:"export default ({value}) => ({result:value})"},{op:"edge.connect",source:"$start",target:"$step"},{op:"node.update",node:"$step",set:{description:"Created and connected in one atomic edit."}}]},{baseRevision:"REVISION",requestId:"REQUEST",edits:[{op:"text.edit",node:"NODE",field:"prompt",oldText:"Original rule.",newText:"Updated rule."}]}]},check:{schema:Yl,guidance:"Check a fixed revision. In the CLI, pass this identity with --revision REVISION.",examples:[{revisionId:"REVISION"}]}},hI=[...Bu(cn).builtinModules].filter((e)=>!e.startsWith("node:")),yI=`Code is an ES module whose default export receives (inputs, context) and returns the business outputs. It may import the Node builtins ${hI.join(", ")}, with or without the node: prefix; fs is a fresh in-memory filesystem containing /tmp per execution. require, dynamic import, packages and the http/net builtins are unavailable. To call HTTP APIs, declare their hosts in config.capabilities as {kind: "http", hosts: ["api.example.com", "*.example.org"]} and use context.fetch(url, {method, headers, body}); it returns status, ok, headers.get(), text(), json() and bytes(), does not follow redirects, adds no credentials, and limits bodies to 1 MiB. Prefer an HTTP Request node for a single call without transformation and Connector Actions for services with accounts. context provides inputs, signal, getPrevious(), fetch, actions, workflows, artifact, flowId, runId and blockId. Select workflows through config.capabilities: [{kind: "workflow", flowId, name}]. Call context.workflows.call(name, input) and await its business output. The platform derives input/output types. Refresh a selected workflow tool with node.refresh and tool: its name. Calls obey node and Run time limits.`;function Xl(e){if(!Object.hasOwn(ky,e))return;let t=ky[e];return{request:yn(t.schema,{io:"input"}),guidance:t.guidance,examples:t.examples}}function eu(e){return e==null?{types:qi,request:yn(Ur),guidance:"Read a node type schema before creating or configuring it. Use $alias to reference a preceding node.add in the same batch. Read returns stable node references. Long code and prompt fields use text reads and edits. Changes use the observed baseRevision and a stable requestId."}:{type:e,onError:e=="skip-duplicates"||Nl.some((t)=>t==e)?{enum:["stop","error"]}:!1,retry:Nl.some((t)=>t==e)?yn(ft):!1,inputSources:["poll","integration"].includes(e)?["value","unset","default"]:["start","outputs","error","cron","webhook","value","condition"].includes(e)?[]:["value","unset","default","output","system","variable","sources"],extensibleInputs:["code","agent","llm","wait","approval"].includes(e),guidance:e=="webhook-response"?'Prepare an HTTP response using fixed inputs body (any JSON, default empty text), statusCode (number, default 200) and headers (scalar-valued object, default {}). Select this node in Webhook options.responseBody as {kind: "webhook-response", nodeId: "node reference", timeoutMs: 30000}. Its first completion responds immediately while the Run continues. It has no business outputs. Multiple response nodes are allowed; each Webhook selects one reachable node.':e=="outputs"?"Declare output fields through config.outputDefs. Set their values through node.add.inputs or input.set. Outputs is a singleton execution sink; it waits for its predecessors and produces workflow business outputs independently of node logs. No downstream edges or data references to Outputs are allowed.":e=="webhook"?'Use options.responseBody: {kind: "webhook-response", nodeId: "node ID or $alias", timeoutMs: 30000} to respond on the selected node\u2019s first completion while the Run continues. Body, statusCode and headers come exclusively from that node; clear workflow-output-only status/header references when switching. Alternatively configure options.responseBody as {kind: "workflow-outputs", output?: "top-level output name", timeoutMs?: 30000} to respond after the Run succeeds. Omit output for the complete object. Connect Webhook to Outputs. Timeout is 1000\u201360000 ms; HTTP timeout does not cancel the Run. Strings return text; other values return JSON. Only in this mode, options.responseStatusCodeOutput can select a numeric top-level workflow output as the HTTP status, overriding the preserved fixed responseStatusCode (default 200). Its runtime value must be an integer from 200 to 599, excluding 204, 205, 304; missing or invalid values return 500. Use responseHeaders for fixed text headers. In workflow-output mode, responseHeaderOutputs maps header names to top-level output names; values can be string, number or boolean and are converted to text. Alternatively responseHeadersSource: {kind: "workflow-outputs", output?: "object field"} replaces the entire header object (omit output for all outputs), preserving but ignoring per-header settings. Missing, null, complex or invalid header values return 500 without fallback. Header restrictions and Content-Type policy still apply. Omit responseBody for immediate responseData. Clear options.responseBody, options.responseStatusCodeOutput, options.responseHeadersSource and options.responseHeaderOutputs explicitly to switch back.':e=="start"?"Declare workflow inputs through config.inputDefs; read them in Start node details. REST calls and manual runs supply them as trigger.outputs. Downstream nodes bind these parameters as Start outputs. Start has no input sources or defaults; non-nullable parameters are required, and omitted nullable parameters become null.":e=="condition"?"Edit branch operands through config.branches. A branch can test one expression, all expressions, or any alternatives. Unmatched execution uses branch otherwise.":["poll","integration"].includes(e)?"Configure static parameters with node.add.inputs or input.set. Definitions come from the selected Trigger key; execution output and variable sources are unavailable.":e=="llm"?"Configure model settings, message templates and history as defaults. Input bindings with the same names override these defaults; named business inputs can be bound directly. Template strings interpolate {{name}}.":e=="skip-duplicates"?"Bind an items array. Configure fields as dot-separated identity paths; an empty list uses each scalar item. Outputs are items and duplicates. History belongs to this node and commits only when the Run completes successfully. Fields accept strings or finite numbers; missing or complex values reject the batch.":e=="http-request"?"Configure method, query/headers modes and names, bodyFormat, authentication, responseFormat and statusPolicy. Bind url, query.<name>/header.<name> or whole query/headers objects, body and auth.token (Basic: auth.username/auth.password). Credentials accept variables or upstream outputs only. Outputs: body, statusCode, headers. Authentication is replaced as a complete choice.":e=="openapi"?"Select an operation; the tool resolves its ports and authentication. Read authenticationChoices from node details. authentication is replaced as a complete choice. Bind advertised credentials through inputs.":e=="workflow"?"Select another workflow with config.flowId. A workflow cannot call itself, including in a disconnected node. Owned unpublished or unavailable targets may be saved as incomplete drafts. Use node.refresh to load the current published interface.":e=="agent"?'Tools accept Connector Actions or {kind: "workflow", flowId, name, description, approval, inputs}. Workflow parameter sources use model, input or value. The platform derives the interface. Refresh a workflow tool with node.refresh and tool: its name.':e=="code"?yI:"Supply business configuration and input data. Fixed definitions are assembled by the tool. Existing constraints and defaults are preserved on partial updates.",example:{op:"node.add",as:"step",type:e,name:"Step",...{start:{config:{inputDefs:{}}},outputs:{config:{outputDefs:{}}},workflow:{config:{flowId:"<Flow ID>"}},connector:{config:{action:"<Action ID>",connectionId:"<Connection ID>"}},poll:{config:{key:"<Trigger key>",schedule:[{type:"every",unit:"minute",value:5}]}},integration:{config:{key:"<Trigger key>"}},"skip-duplicates":{config:{fields:["id"]},inputs:{items:{kind:"value",value:[{id:"a"},{id:"b"}]}}},"http-request":{config:{},inputs:{url:{kind:"value",value:"https://example.com"}}},openapi:{config:{sourceUrl:"https://example.com/openapi.json",path:"/items",method:"get"}},code:{code:"export default ({value}) => ({result:value})",inputs:{value:{kind:"value",value:"Hello"}}},condition:{config:{match:"first",branches:[{name:"yes",when:{left:{kind:"value",value:120},operator:">",right:{kind:"value",value:100}}}]}},value:{config:{values:{threshold:100,region:"EU"}}},webhook:{config:{method:"POST",body:{orderId:{schema:{type:"string"},nullable:!1}}}},wait:{prompt:"Continue processing this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},approval:{prompt:"Approve this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},llm:{config:{model:{model:"deepseek-v4-flash"},template:[{role:"user",content:"Summarize {{order}}."}]},inputs:{order:{kind:"value",value:{orderId:"A-1",total:42}}}},agent:{config:{model:"deepseek-v4-flash"},inputs:{orders:{kind:"value",value:[{orderId:"A-1",total:42}]}},prompt:"Summarize {{orders}}."}}[e]},configuration:yn(kt[e].partial()),texts:e=="code"?["code"]:["agent","wait","approval"].includes(e)?["prompt"]:[]}}var Ey=C({code:z,message:j(),nodes:A(z),field:j().optional(),line:U().optional(),column:U().optional()}),Oy=C({flowId:z,revisionId:z,valid:me(),diagnostics:A(Ey),version:w(1)}),jy=C({flowId:z,saved:w(!0),revision:z,nodes:oe(z,z),changes:A(C({index:xe(),op:z,node:z.optional()})),validation:C({status:B(["valid","invalid","unavailable"]),diagnostics:A(Ey).optional()}),version:w(1)}),_y=C({flowId:z,revision:z,data:C({nodes:A(oe(j(),Ye)).optional(),edges:A(Ye).optional(),text:oe(j(),Ye).optional()}),version:w(1)}),Ry=C({flowId:z,revision:z,data:C({matches:A(C({node:z.optional(),field:z,line:xe().optional(),excerpt:j()})),total:xe(),nextOffset:xe().optional()}),version:w(1)});var D={authenticationRequired:"authentication.required",authorizationDenied:"authorization.denied",bindingUnresolved:"binding.unresolved",connectorActionNotFound:"connector.action-not-found",connectorAccessConflict:"connector.access-conflict",connectorAccessInvalid:"connector.access-invalid",connectorAccessRequired:"connector.access-required",connectorAccessUnsupported:"connector.access-unsupported",connectorUnconfigured:"connector.unconfigured",connectorUnavailable:"connector.unavailable",connectorConsoleUnconfigured:"connector.console-unconfigured",engineUnavailable:"engine.unavailable",engineUnsupported:"engine.unsupported",eventSourceInvalid:"event-source.invalid",eventSourceIdentityUnavailable:"event-source.identity-unavailable",eventSourceNotFound:"event-source.not-found",eventSourceConflict:"event-source.conflict",flowInvalid:"flow.invalid",flowRepairRequired:"flow.repair-required",flowUpgradeRequired:"flow.upgrade-required",flowNotFound:"flow.not-found",flowBusy:"flow.busy",flowConflict:"flow.conflict",flowPresentationConflict:"flow.presentation-conflict",flowRevisionConflict:"flow.revision-conflict",liveConflict:"live.conflict",liveNotFound:"live.not-found",pageInvalidCursor:"page.invalid-cursor",publicationConflict:"publication.conflict",publicationNotFound:"publication.not-found",publicationUnsupported:"publication.unsupported",publishOperationNotFound:"publication.operation-not-found",routeNotFound:"route.not-found",runConflict:"run.conflict",runEventsExpired:"run.events-expired",runInvalid:"run.invalid",runNotFound:"run.not-found",runNotTerminal:"run.not-terminal",runOverloaded:"run.overloaded",runWaitNotFound:"run.wait-not-found",triggerKeyInvalid:"trigger-key.invalid",triggerKeyNotFound:"trigger-key.not-found",triggerNotFound:"trigger.not-found",tagInvalid:"tag.invalid",tagConflict:"tag.conflict",tagNotFound:"tag.not-found",variableInvalid:"variable.invalid",variableLimitReached:"variable.limit-reached",variableNotFound:"variable.not-found"},wI={[D.eventSourceInvalid]:{status:400},[D.eventSourceIdentityUnavailable]:{status:409},[D.eventSourceNotFound]:{status:404},[D.eventSourceConflict]:{status:409},[D.authenticationRequired]:{status:401},[D.authorizationDenied]:{status:403},[D.bindingUnresolved]:{status:409},[D.connectorActionNotFound]:{status:404},[D.connectorAccessConflict]:{status:412},[D.connectorAccessInvalid]:{status:409},[D.connectorAccessRequired]:{status:409},[D.connectorAccessUnsupported]:{status:409},[D.connectorUnconfigured]:{status:503},[D.connectorUnavailable]:{status:503},[D.connectorConsoleUnconfigured]:{status:503},[D.engineUnavailable]:{status:503},[D.engineUnsupported]:{status:409},[D.flowInvalid]:{status:400},[D.flowRepairRequired]:{status:409},[D.flowUpgradeRequired]:{status:409},[D.flowNotFound]:{status:404},[D.flowBusy]:{status:409},[D.flowConflict]:{status:409},[D.flowPresentationConflict]:{status:412},[D.flowRevisionConflict]:{status:412},[D.liveConflict]:{status:412},[D.liveNotFound]:{status:404},[D.pageInvalidCursor]:{status:400},[D.publicationConflict]:{status:409},[D.publicationNotFound]:{status:404},[D.publicationUnsupported]:{status:409},[D.publishOperationNotFound]:{status:404},[D.routeNotFound]:{status:404},[D.runConflict]:{status:409},[D.runEventsExpired]:{status:410},[D.runInvalid]:{status:400},[D.runNotFound]:{status:404},[D.runNotTerminal]:{status:409},[D.runOverloaded]:{status:429},[D.runWaitNotFound]:{status:404},[D.triggerKeyInvalid]:{status:409},[D.triggerKeyNotFound]:{status:404},[D.triggerNotFound]:{status:404},[D.tagInvalid]:{status:400},[D.tagConflict]:{status:409},[D.tagNotFound]:{status:404},[D.variableInvalid]:{status:400},[D.variableLimitReached]:{status:409},[D.variableNotFound]:{status:404}};class Te extends Error{constructor(e,t,n,r){super(n);this.code=t,this.details=r,this.name="ApiError",this.status=e}}class Ay extends Te{constructor(e){super(502,"response.invalid",`The Control API returned an invalid response.${e==null?"":` ${e}`}`);this.detail=e}}function p(e){throw new Ay(e)}function x(e){if(e==null||typeof e!="object"||Array.isArray(e))return p("Expected an object.");return e}function f(e){return typeof e=="string"&&e.length>0?e:p("Expected a non-empty string.")}function Q(e,t){let n=t.filter((r)=>!Object.hasOwn(e,r));if(n.length>0)p(`Missing fields: ${n.join(", ")}.`)}function Xe(e,t){let n=Object.keys(e);if(n.length!=t.length||n.some((r)=>!t.includes(r))){let r=t.filter((i)=>!Object.hasOwn(e,i)),o=n.filter((i)=>!t.includes(i));p([r.length>0?`Missing fields: ${r.join(", ")}.`:"",o.length>0?`Unexpected fields: ${o.join(", ")}.`:""].filter(Boolean).join(" "))}}function ie(e){return Number.isSafeInteger(e)?e:p("Expected a safe integer.")}function we(e){if(e===null||typeof e=="boolean"||typeof e=="string")return e;if(typeof e=="number"&&Number.isFinite(e))return e;if(Array.isArray(e))return e.map(we);let t=x(e);return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,we(r)]))}function Fi(e){if(e==null)return;return f(e)}function Nn(e){let t=x(e),n=t.liveEnd==null?void 0:x(t.liveEnd);if(n!=null&&typeof n.enabled!="boolean")return p();let{operation:r,sourcePublicationId:o}=t;if(t.version!=1)return p();if(r!="publish"&&r!="rollback")return p();if(o!=null&&typeof o!="string")return p();return{...n==null?{}:{liveEnd:{enabled:n.enabled,endedAt:f(n.endedAt)}},actorId:f(t.actorId),closureDigest:f(t.closureDigest),createdAt:f(t.createdAt),engineContract:f(t.engineContract),flowId:f(t.flowId),modelVersion:ie(t.modelVersion),operation:r,publicationId:f(t.publicationId),sharedAccessDigest:f(t.sharedAccessDigest),revisionDigest:f(t.revisionDigest),revisionId:f(t.revisionId),...o==null?{}:{sourcePublicationId:o},version:1}}function tu(e){let t=x(e),n=t.status,r={createdAt:f(t.createdAt),flowId:f(t.flowId),operationId:f(t.operationId),revisionId:f(t.revisionId),updatedAt:f(t.updatedAt),version:1};if(t.version!=1)return p();switch(n){case"pending":return Q(t,["createdAt","flowId","operationId","revisionId","status","updatedAt","version"]),{...r,status:n};case"succeeded":return Q(t,["createdAt","flowId","operationId","publicationId","revisionId","status","updatedAt","version"]),{...r,publicationId:f(t.publicationId),status:n};case"failed":{Q(t,["createdAt","flowId","issue","operationId","revisionId","status","updatedAt","version"]);let o=x(t.issue),i=o.nodeId;return Q(o,["code","message",...i==null?[]:["nodeId"]]),{...r,issue:{code:f(o.code),message:f(o.message),...i==null?{}:{nodeId:f(i)}},status:n}}default:return p()}}function nu(e){let t=x(e),{status:n,publication:r}=t;if(t.version!=1||typeof t.hasUnpublishedChanges!="boolean")return p();if(n!="not-published"&&n!="runnable"&&n!="suspended")return p();if(n=="not-published"&&r!==null)return p();if(n!="not-published"&&r===null)return p();return{flowId:f(t.flowId),hasUnpublishedChanges:t.hasUnpublishedChanges,publication:r===null?null:Nn(r),revision:ie(t.revision),status:n,version:1}}function Py(e){let t=x(e),{nextCursor:n,total:r}=t;if(t.version!=1||!Array.isArray(t.publications))return p();if(n!=null&&typeof n!="string")return p();if(r!=null&&!Number.isSafeInteger(r))return p();return{...n==null?{}:{nextCursor:n},publications:t.publications.map(Nn),...r==null?{}:{total:r},version:1}}var Ty=A(Y([v({handle:j().min(1),description:j().optional(),jsonSchema:Ae(),nullable:me(),value:Ae().optional()}),v({group:j(),collapsed:me().optional()})]));function ru(e){let t=x(e),n=t.type;if(n!="integration"&&n!="poll")return p();return{description:typeof t.description=="string"?t.description:p(),displayName:f(t.displayName),key:f(t.key),name:f(t.name),provider:f(t.provider),type:n}}function Br(e){let t=x(e),n=ru(t),r={configInputs:Ty.parse(t.configInputs),definitionVersion:t.definitionVersion===2?2:p(),description:n.description,displayName:n.displayName,key:n.key,name:n.name,outputs:(Array.isArray(t.outputs)?t.outputs:p()).map((l)=>{let u=x(l);return Object.assign({handle:f(u.handle),jsonSchema:we(u.jsonSchema),nullable:typeof u.nullable==="boolean"?u.nullable:p()},u.description==null?{}:{description:f(u.description)})}),provider:n.provider};if(n.type=="poll")return{...r,type:"poll"};let o=x(t.endpoint),i=x(o.body);if(!Array.isArray(o.methods)||!Array.isArray(i.formats)||typeof i.allowArray!="boolean"||typeof i.allowEmpty!="boolean")return p();let s=o.methods.map(f),a=i.formats.map(f),c=ie(o.successStatus);if(s.some((l)=>!["DELETE","GET","HEAD","PATCH","POST","PUT"].includes(l))||a.some((l)=>!["form","json","multipart","text"].includes(l))||c<200||c>299)return p();return{...r,endpoint:{body:{allowArray:i.allowArray,allowEmpty:i.allowEmpty,formats:a},methods:s,successStatus:c},type:"integration"}}var vI=new Set(["error","cron","integration","poll","webhook"]),xI=new Set(["failed","healthy","initializing","needs_reauth","suspended"]),kI=new Set(["delivery.failed","health.failed","health.needs_reauth","health.recovered","health.suspended","operator.paused","operator.resumed"]);function Kr(e){let t=x(e),n=t.health,r=t.listener==null?void 0:x(t.listener);if(r!=null&&r.health!="healthy"&&r.health!="failed"&&r.health!="needs_reauth")return p();let o=t.kind,i=ie(t.runtimeVersion);if(t.version!=1||typeof n!="string"||!xI.has(n))return p();if(typeof o!="string"||!vI.has(o))return p();if(i<=0)return p();return{...t.currentPublicationId==null?{}:{currentPublicationId:f(t.currentPublicationId)},...t.currentRevisionId==null?{}:{currentRevisionId:f(t.currentRevisionId)},...t.endpointUrl==null?{}:{endpointUrl:f(t.endpointUrl)},...r==null?{}:{listener:{health:r.health,...r.lastErrorCode==null?{}:{lastErrorCode:f(r.lastErrorCode)}}},flowId:f(t.flowId),health:n,kind:o,...t.lastErrorCode==null?{}:{lastErrorCode:f(t.lastErrorCode)},runtimeVersion:i,triggerNodeId:f(t.triggerNodeId),updatedAt:f(t.updatedAt),version:1}}function $y(e){let t=x(e);if(t.version!=1)return p();return{binding:Kr(t.binding),version:1}}function SI(e){let t=x(e),n=t.kind;if(typeof n!="string"||!kI.has(n))return p();let r=Fi(t.errorCode),o=Fi(t.errorMessage);if(o!=null&&o.length>512)return p();return{activityId:f(t.activityId),createdAt:f(t.createdAt),...r==null?{}:{errorCode:r},...o==null?{}:{errorMessage:o},kind:n}}function Ny(e){let t=x(e),n=Fi(t.nextCursor);if(t.version!=1||!Array.isArray(t.activities))return p();return{activities:t.activities.map(SI),...n==null?{}:{nextCursor:n},version:1}}function zy(e){let t=x(e),n=ie(t.filtered);if(t.version!=1||!Array.isArray(t.events)||typeof t.hasMore!="boolean"||n<0)return p();return{events:t.events.map((r)=>{let o=x(r);return Object.fromEntries(Object.entries(o).map(([i,s])=>[i,we(s)]))}),filtered:n,hasMore:t.hasMore,version:1}}var tn={nodeId:j().min(1),name:j(),description:j().optional()},Wr=ut().transform(Kr),Dy={provider:j().min(1),inputs:oe(j(),ot("kind",[C({kind:w("value"),value:Ae()}),C({kind:w("unset")})]))},CI=ot("type",[C({...tn,type:w("start"),config:kt.start}),C({...tn,type:w("manual"),config:C({})}),C({...tn,type:w("webhook"),config:kt.webhook,binding:Wr}),C({...tn,type:w("cron"),config:kt.cron,binding:Wr}),C({...tn,type:w("error"),config:kt.error,binding:Wr}),C({...tn,...Dy,type:w("poll"),config:kt.poll,binding:Wr}),C({...tn,...Dy,type:w("integration"),config:kt.integration,binding:Wr})]);function qy(e){let t=x(e),n=f(t.flowId);if(t.version!=1||!Array.isArray(t.entries))return p();if(t.publication===null){if(t.inputDefs!==null||t.status!="not-published"||t.entries.length!=0||Object.hasOwn(t,"enabled"))return p();return{flowId:n,inputDefs:null,publication:null,status:"not-published",entries:[],version:1}}let r=Nn(t.publication),o=t.status;if(r.flowId!=n||typeof t.enabled!="boolean")return p();if(o!="runnable"&&o!="suspended")return p();if(!t.enabled&&t.status=="runnable")return p();let i=Iy.safeParse(t.inputDefs);if(!i.success)return p();return{flowId:n,inputDefs:i.data,publication:r,status:o,enabled:t.enabled,entries:EI(t.entries,r),version:1}}function EI(e,t){let n=A(CI).safeParse(e);if(!n.success)return p();let r=new Set;for(let o of n.data){if(r.has(o.nodeId))return p();if(r.add(o.nodeId),o.type!="start"&&o.type!="manual"&&(o.binding.flowId!=t.flowId||o.binding.triggerNodeId!=o.nodeId||o.binding.kind!=o.type||o.binding.currentPublicationId!=t.publicationId||o.binding.currentRevisionId!=t.revisionId))return p();if(o.type=="webhook"&&(!o.binding.endpointUrl||!ji(o.config.method)&&Object.keys(o.config.body).length>0))return p()}return n.data}function Zi(e,t){if(!e||typeof e!="object"||!t||typeof t!="object")return{};let n=e,r=t;if(typeof n.version!="string"||![n.pixelRatio,n.iconSize,n.width,n.height].every((o)=>Number.isInteger(o)&&o>0)||![n.bleed,r.x,r.y].every((o)=>Number.isInteger(o)&&o>=0)||r.x+n.iconSize>n.width||r.y+n.iconSize>n.height)return{};try{for(let o of[n.lightUrl,n.darkUrl])if(typeof o!="string"||!["https:","http:","data:"].includes(new URL(o).protocol))return{}}catch{return{}}return{iconSprite:n,iconSpritePosition:{x:r.x,y:r.y}}}function Vy(e){return e.kind=="source"&&e.source.kind=="binding"?{kind:"value"}:e}function Ly(e){return{...e,cases:e.cases.map((t)=>({...t,groups:t.groups.map((n)=>({...n,expressions:n.expressions.map((r)=>({...r,left:Vy(r.left),...r.right==null?{}:{right:Vy(r.right)}}))}))}))}}var su=80;function Gr(e){let t=e.trim();if(t.length==0)return"empty";if(t.length>su)return"tooLong";for(let n of t){let r=n.charCodeAt(0);if(r<=31||r>=127&&r<=159)return"controlCharacter"}if(!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(t))return"specialCharacter"}function Fy(e,t){let n=e=="jira.on_issue_event"||e=="intercom.on_conversation_event"||e=="sentry.on_issue_alert"||e=="zoom.on_recording_ready"||e=="fireflies.on_meeting_ready"?["sourceId","eventTypes"]:e=="slackbot.on_event"?["sourceId","eventTypes","channelIds"]:e=="feishu_app_bot.on_event"?["sourceId","eventTypes","resource","chatIds"]:e=="linear.on_issue_changed"?["teamId","stateIds"]:[];return{...t,...Object.fromEntries(n.map((r)=>[r,{kind:"unset"}]))}}function Zy(e,t){return{...e,nodes:Object.fromEntries(Object.entries(e.nodes).map(([n,r])=>{if((r.kind=="poll"||r.kind=="integration")&&(t==null||r.connectionId==t)){let{connectionId:i,...s}=r;return[n,s]}if(r.kind!="task")return[n,r];if("executor"in r.task){let i=r.task.executor,s=(a)=>{if(a.connectionId==="")return a;if(t!=null&&a.connectionId!=t)return a;let{connectionId:c,...l}=a;return l};if(i.kind=="connector")return[n,{...r,task:{...r.task,executor:s(i)}}];if(i.kind=="agent")return[n,{...r,task:{...r.task,executor:{...i,tools:i.tools.map(s),...i.notification==null?{}:{notification:s(i.notification)}}}}];return[n,r]}let o=r.task.capabilities?.map((i)=>{if(i.kind=="workflow"||i.kind=="http")return i;if(!("mode"in i)){if("action"in i){let{connectionId:s,...a}=i;return{...a,connections:i.connections.filter((c)=>t!=null&&c.connectionId!=t),...s!=null&&t!=null&&s!=t?{connectionId:s}:{}}}return{...i,...t==null&&(i.connectionHints?.length??0)>0?{actionHints:[...new Set([...i.actionHints??[],...i.connectionHints.map((s)=>s.action)])]}:{},...i.connectionHints==null?{}:{connectionHints:i.connectionHints.filter((s)=>t!=null&&s.connectionId!=t)}}}if(i.mode!="independent")return i;return{...i,actions:i.actions.map((s)=>{if(s.connectionId==="")return s;if(t!=null&&s.connectionId!=t)return s;let{connectionId:a,...c}=s;return c})}});return[n,o==null?r:{...r,task:{...r.task,capabilities:o}}]}))}}var TI=v({kind:w("open-flow-workflow"),version:w(1),name:j().optional(),content:ut(),presentation:oe(j(),Ae()).optional()});function Ui(e){Qt(e,-1);let t=TI.parse(e);return{...t,content:Tn(t.content)}}function Uy(e){return Ui(JSON.parse(e))}function Jy(e){if(e.kind!="sources"||!e.sources.some((n)=>n.kind=="binding"))return e;let t=e.sources.filter((n)=>n.kind!="binding");return t.length==0?{kind:"unset"}:{kind:"sources",sources:t}}function $I(e){let t=Ui(e),n=t.content.document.graph,r=Zy(n),o=Object.fromEntries(Object.entries(r.nodes).map(([i,s])=>{let a=s;if("inputs"in a)a={...a,inputs:Object.fromEntries(Object.entries(a.inputs).map(([c,l])=>[c,Jy(l)]))};if(a.kind=="outputs")a={...a,outputMappings:Object.fromEntries(Object.entries(a.outputMappings).map(([c,l])=>[c,Jy(l)]))};if(a.kind=="condition")a=Ly(a);if(a.kind=="error"&&a.sourceFlowIds!=null)a={...a,sourceFlowIds:[]};if(a.kind=="poll"||a.kind=="integration")a={...a,config:Fy(a.definition.key,a.config)};return[i,a]}));return{file:{...t,content:{...t.content,document:{...t.content.document,bindings:{},graph:{...r,nodes:o}}}},summary:{changedNodeIds:Object.keys(o).filter((i)=>!Se(o[i],n.nodes[i])),removedBindings:Object.keys(t.content.document.bindings).length}}}function By(e){return`${JSON.stringify($I(e).file,null,2)}
|
|
61
|
+
`}function Ky(e){return e.replace(/(?:\.openflow)?\.json$/i,"")}var zI=ot("kind",[v({kind:w("admin-delegation")}),v({kind:w("policy"),ruleId:j().min(1).nullable()})]);function Bi(e){return zI.parse(e)}function Hy(e){let t=x(e);if(!Array.isArray(t.bots))return p("Leina bots: expected an array.");let n=t.bots.map((r)=>{let o=x(r);if(!Array.isArray(o.platforms))return p("Leina platforms: expected an array.");return{leinaId:f(o.leinaId),name:f(o.name),status:f(o.status),platforms:o.platforms.map(f)}});if(new Set(n.map((r)=>r.leinaId)).size!=n.length)return p("Leina bots: duplicate identifiers.");return n}function DI(e){let t=x(e);if(Xe(t,["actionIds","allActions","triggerIds","allTriggers","configured","proxy"]),!Array.isArray(t.actionIds))return p("permissions.actionIds: expected an array.");if(!Array.isArray(t.triggerIds))return p("permissions.triggerIds: expected an array.");if(typeof t.allActions!="boolean")return p("permissions.allActions: expected a boolean.");if(typeof t.allTriggers!="boolean")return p("permissions.allTriggers: expected a boolean.");if(typeof t.configured!="boolean")return p("permissions.configured: expected a boolean.");if(typeof t.proxy!="boolean")return p("permissions.proxy: expected a boolean.");let n=t.actionIds.map(f),r=t.triggerIds.map(f);if(new Set(n).size!=n.length)return p("permissions.actionIds: duplicate IDs.");if(t.allActions&&n.length!=0)return p("permissions.actionIds: must be empty when allActions is true.");if(new Set(r).size!=r.length)return p("permissions.triggerIds: duplicate IDs.");if(t.allTriggers&&r.length!=0)return p("permissions.triggerIds: must be empty when allTriggers is true.");if(t.proxy&&(!t.allActions||!t.allTriggers||t.configured))return p("permissions.proxy: requires allActions=true, allTriggers=true and configured=false.");return{actionIds:n,triggerIds:r,allTriggers:t.allTriggers,allActions:t.allActions,configured:t.configured,proxy:t.proxy}}function Qy(e,t){let n=x(e),{policyRevision:r,status:o,isDefault:i}=n,s=Object.hasOwn(n,"displayName")&&!Object.hasOwn(n,"connectionDisplayName"),a=t&&Object.hasOwn(n,"permissions")?DI(n.permissions):void 0,c=n.permissionGroupName;if(Xe(n,["accessBindingId","connectionId","source",s?"displayName":"connectionDisplayName",...t&&Object.hasOwn(n,"isDefault")?["isDefault"]:[],...t&&a!=null?["permissions"]:[],...Object.hasOwn(n,"permissionGroupName")?["permissionGroupName"]:[],...r==null?[]:["policyRevision"],"providerId",...t?[]:["status"]]),r!=null&&typeof r!="string")return p("policyRevision: expected a string.");if(t&&i!==void 0&&typeof i!="boolean")return p("isDefault: expected a boolean.");if(c!==void 0&&c!==null&&typeof c!="string")return p("permissionGroupName: expected a string or null.");if(!t&&o!="active"&&o!="forbidden"&&o!="invalid"&&o!="missing")return p();let l;try{l=Bi(n.source)}catch{return p("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.")}return{accessBindingId:f(n.accessBindingId),connectionId:f(n.connectionId),source:l,connectionDisplayName:f(s?n.displayName:n.connectionDisplayName),...t&&typeof i=="boolean"?{isDefault:i}:{},...a==null?{}:{permissions:a},...c===void 0?{}:{permissionGroupName:c},...r==null?{}:{policyRevision:r},providerId:f(n.providerId),...t?{}:{status:o}}}function cu(e){if(e!="implicit"&&e!="selectable")return p("mode: expected implicit or selectable.");return e}function zn(e){let t=x(e);Xe(t,["accessRevision","bindings","mode","sharedAccessDigest",..."providerIds"in t?["providerIds"]:[],..."discardedBindingCount"in t?["discardedBindingCount"]:[],"version"]);let n=ie(t.accessRevision);if(t.version!=1||n<0||!Array.isArray(t.bindings))return p();if("providerIds"in t&&!Array.isArray(t.providerIds))return p();let r=t.providerIds==null?void 0:t.providerIds.map((s)=>f(s));if(r!=null&&new Set(r).size!=r.length)return p();let o=t.discardedBindingCount==null?0:ie(t.discardedBindingCount);if(o<0)return p();let i=[];for(let s of t.bindings)try{i.push(Qy(s,!1))}catch(a){if(!(a instanceof Te)||a.code!="response.invalid")throw a;if(s!=null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.accessBindingId=="string"&&s.accessBindingId.length>0&&typeof s.providerId=="string"&&s.providerId.length>0)i.push({accessBindingId:s.accessBindingId,providerId:s.providerId,connectionId:null,source:null,status:"invalid",connectionDisplayName:typeof s.connectionDisplayName=="string"&&s.connectionDisplayName.length>0?s.connectionDisplayName:typeof s.displayName=="string"&&s.displayName.length>0?s.displayName:s.providerId,permissionGroupName:typeof s.permissionGroupName=="string"?s.permissionGroupName:null});else o++}if(new Set(i.map((s)=>s.accessBindingId)).size!=i.length)return p();return{accessRevision:n,...o==0?{}:{discardedBindingCount:o},...r==null?{}:{providerIds:r},bindings:i,mode:cu(t.mode),sharedAccessDigest:f(t.sharedAccessDigest),version:1}}function Wy(e){if(!Array.isArray(e))return p();let t=e.map((n)=>{let r=x(n);Xe(r,["accessBindingId","connectionId","providerId","source","connectionDisplayName",..."permissionGroupName"in r?["permissionGroupName"]:[]]);let o;try{o=Bi(r.source)}catch{return p()}if(r.permissionGroupName!=null&&typeof r.permissionGroupName!="string")return p();return{accessBindingId:f(r.accessBindingId),connectionId:f(r.connectionId),providerId:f(r.providerId),source:o,connectionDisplayName:f(r.connectionDisplayName),..."permissionGroupName"in r?{permissionGroupName:r.permissionGroupName}:{}}});if(new Set(t.map((n)=>n.accessBindingId)).size!=t.length)return p();return t}function lu(e){let t=x(e);if(Xe(t,["mode","sharedAccessDigest","sharedBindings","selectedBindings","version"]),t.version!=2)return p();let n=cu(t.mode),r=Wy(t.sharedBindings),o=Wy(t.selectedBindings);if(n=="implicit"&&(r.length>0||o.length>0))return p();return{mode:n,sharedAccessDigest:f(t.sharedAccessDigest),sharedBindings:r,selectedBindings:o,version:2}}function qI(e,t){let n=x(e);if(Xe(n,["candidates","mode","providerId","version"]),n.version!=1)return p("version: expected 1.");if(f(n.providerId)!=t)return p("providerId: does not match the requested provider.");if(!Array.isArray(n.candidates))return p("candidates: expected an array.");let r=n.candidates.map((o)=>Qy(o,!0));if(r.some((o)=>o.providerId!=t))return p("candidates[].providerId: does not match the requested provider.");if(new Set(r.map((o)=>o.accessBindingId)).size!=r.length)return p("candidates[].accessBindingId: duplicate IDs.");return{candidates:r,mode:cu(n.mode),providerId:t,version:1}}function Yy(e,t){let n=x(e);if(Xe(n,["results","version"]),n.version!=1)return p("version: expected 1.");if(!Array.isArray(n.results))return p("results: expected an array.");let r=new Set(t),o=n.results.map((i)=>{let s=x(i),a=f(s.providerId);if(!r.delete(a))return p("results[].providerId: duplicate or unrequested provider.");if(!Object.hasOwn(s,"error"))return qI(s,a);Xe(s,["providerId","error"]);let c=x(s.error);return Xe(c,["code","message"]),{providerId:a,error:{code:f(c.code),message:f(c.message)}}});if(r.size!=0)return p("results: missing requested providers.");return{results:o,version:1}}function Dn(e){let t=x(e);if(Q(t,[...Object.hasOwn(t,"providerAccountId")?["providerAccountId"]:[],...Object.hasOwn(t,"alias")?["alias"]:[],...Object.hasOwn(t,"builtInAccount")?["builtInAccount"]:[],"connectionId","displayName","isDefault","serviceId","status"]),t.builtInAccount!==void 0&&typeof t.builtInAccount!="boolean")return p();let n=t.status;if(n!="active"&&n!="disconnected"&&n!="error"&&n!="reauth_required")return p();if(typeof t.isDefault!="boolean")return p();return{...t.providerAccountId===void 0?{}:{providerAccountId:f(t.providerAccountId)},...t.alias===void 0?{}:{alias:f(t.alias)},...t.builtInAccount===void 0?{}:{builtInAccount:t.builtInAccount},connectionId:f(t.connectionId),displayName:f(t.displayName),isDefault:t.isDefault,serviceId:f(t.serviceId),status:n}}function Xy(e,t=!1){let n=x(e),r=n.description,o=t&&Object.hasOwn(n,"value");if(Q(n,["jsonSchema","nullable",...r==null?[]:["description"],...o?["value"]:[]]),r!=null&&typeof r!="string")return p();if(typeof n.nullable!="boolean")return p();return{...r==null?{}:{description:r},jsonSchema:we(n.jsonSchema),nullable:n.nullable,...o?{value:we(n.value)}:{}}}function VI(e){return Xy(e,!0)}function Gy(e,t){return Object.fromEntries(Object.entries(x(e)).map(([n,r])=>[n,t(r)]))}function LI(e){let t=x(e),{homepageUrl:n,icon:r}=t;if(Q(t,["actionId",...Object.hasOwn(t,"operationType")?["operationType"]:[],...Object.hasOwn(t,"inputSchema")?["inputSchema"]:[],...Object.hasOwn(t,"outputSchema")?["outputSchema"]:[],"authenticated","description",...n==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in t?["iconSprite"]:[],..."iconSpritePosition"in t?["iconSpritePosition"]:[],"inputs","name","outputs","serviceId","serviceName"]),n!=null&&typeof n!="string"||r!=null&&typeof r!="string")return p();return{...t.inputSchema===void 0?{}:{inputSchema:we(t.inputSchema)},...t.outputSchema===void 0?{}:{outputSchema:we(t.outputSchema)},actionId:f(t.actionId),...t.operationType==null?{}:{operationType:f(t.operationType)},authenticated:typeof t.authenticated=="boolean"?t.authenticated:p(),description:typeof t.description=="string"?t.description:p(),...n==null?{}:{homepageUrl:n},...r==null?{}:{icon:r},...Zi(t.iconSprite,t.iconSpritePosition),inputs:Gy(t.inputs,VI),name:f(t.name),outputs:Gy(t.outputs,Xy),serviceId:f(t.serviceId),serviceName:f(t.serviceName)}}function Ki(e){let{defaultConnection:t,...n}=x(e),r=LI(n);if(t==null)return r;let o=Dn(t);if(o.serviceId!=r.serviceId||o.status!="active")return p();return{...r,defaultConnection:o}}function eb(e){let t=x(e),{homepageUrl:n,icon:r}=t;if(t.noSetup!==void 0&&typeof t.noSetup!="boolean")return p();if(Q(t,[...Object.hasOwn(t,"noSetup")?["noSetup"]:[],"serviceId","serviceName",...n==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in t?["iconSprite"]:[],..."iconSpritePosition"in t?["iconSpritePosition"]:[]]),n!=null&&typeof n!="string"||r!=null&&typeof r!="string")return p();return{...n==null?{}:{homepageUrl:n},...r==null?{}:{icon:r},...Zi(t.iconSprite,t.iconSpritePosition),serviceId:f(t.serviceId),serviceName:f(t.serviceName),...t.noSetup===void 0?{}:{noSetup:t.noSetup}}}function uu(e){return{actionId:e.actionId,authenticated:e.authenticated,...e.defaultConnection==null?{}:{defaultConnection:{connectionId:e.defaultConnection.connectionId,displayName:e.defaultConnection.displayName,status:e.defaultConnection.status}},description:e.description,name:e.name,serviceId:e.serviceId,serviceName:e.serviceName}}var qn=j().min(1).max(256),nb=C({appId:qn.nullable(),workspaceId:qn.optional(),installationId:qn.optional(),organizationId:qn.optional(),projectId:qn.optional(),projectKey:qn.optional(),subscriptionStatus:B(["idle","pending","ready","error"]).optional(),lastError:j().optional(),signingSecretConfigured:me().optional(),manageSubscriptions:me().nullable(),verificationTokenConfigured:me().nullable(),encryptKeyConfigured:me().nullable(),verifiedAt:j().nullable()});var Vn=j().min(1).max(256),ZI=j().regex(/^[a-z][a-z0-9_.:]{0,127}$/),JI=j().trim().min(1).max(128),rb=C({version:w(1),sourceId:Vn,revision:xe().positive(),name:JI,provider:B(["feishu","feishu_app_bot","slackbot","intercom","sentry","zoom","fireflies","jira"]),...nb.shape,connectionId:Vn,teamId:Vn.nullable(),enabled:me(),eventTypes:A(ZI),endpointUrl:j().nullable(),lastReceivedAt:j().nullable(),updatedAt:j(),consumers:A(C({flowId:Vn,flowName:j(),triggerNodeId:Vn}))});function Wi(e){return rb.parse(e)}function du(e){return C({version:w(1),sources:A(rb),teamId:Vn.nullable().optional()}).parse(e)}function pu(e){let t=x(e);if(Q(t,["version","locale","definitions","display"]),t.version!=3||!Zu(t.locale)||!Array.isArray(t.definitions))return p();let n=t.definitions.map(Br),r=x(t.display),o=new Set(n.map((s)=>s.key));if(o.size!=n.length||Object.keys(r).length!=o.size)return p();let i=Object.fromEntries(n.map((s)=>{let{key:a}=s,c=x(r[a]);return Q(c,["configInputs","configInputLabels","displayName","description","outputs"]),[a,{configInputs:ob(c.configInputs,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),configInputLabels:UI(c.configInputLabels,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),displayName:f(c.displayName),description:f(c.description),outputs:ob(c.outputs,s.outputs.map((l)=>l.handle))}]}));return{version:3,locale:t.locale,definitions:n,display:i}}function ob(e,t){let n=x(e);return Xe(n,t),Object.fromEntries(Object.entries(n).map(([r,o])=>[r,f(o)]))}function UI(e,t){let n=x(e);if(Object.keys(n).some((r)=>!t.includes(r)))return p();return Object.fromEntries(Object.entries(n).map(([r,o])=>{let i=f(o);return i.trim().length==0?p():[r,i]}))}function fu(e,t){if(t==null)return e;let n=t.toLowerCase();return e.filter((r)=>[r.description,r.displayName,r.key,r.name,r.provider,r.type].some((o)=>o.toLowerCase().includes(n)))}var BI=v({pointer:j().max(4096).default(""),offset:U().int().nonnegative().default(0),limit:U().int().min(1).max(100).default(20),maxBytes:U().int().min(1).max(1048576).default(15000)});var KI=Ae(),ib=C({pointer:j(),type:B(["object","array","string","number","boolean","null"]),length:U().int().nonnegative().optional(),complete:me(),value:KI.optional()}),WI=ib.extend({offset:U().int().nonnegative(),nextOffset:U().int().positive().optional(),entries:A(ib).optional()}),sb=C({resultId:j().min(1),callId:j().min(1),toolId:j().min(1),source:ot("kind",[C({kind:w("connector"),action:j().min(1)}),C({kind:w("code")}),C({kind:w("workflow"),flowId:j().min(1)})]),bytes:U().int().nonnegative(),digest:j().regex(/^[a-f0-9]{64}$/),createdAt:j().datetime()}),GI=C({version:w(1),runId:j(),results:A(sb),nextAfter:j().optional()}),HI=C({version:w(1),runId:j(),result:sb,page:WI});function mu(e){return GI.parse(e)}function gu(e){return HI.parse(e)}function ab(e){if(!Array.isArray(e))return p();return e.map((t)=>typeof t=="string"||Number.isSafeInteger(t)?t:p())}function QI(e){let t=x(e),n=f(t.kind);if(n=="artifact"||n=="binary"||n=="nullable")return{kind:n};if(n=="schema")return{kind:n,path:t.path==null?void 0:ab(t.path)};if(n!="keyword"||typeof t.keyword!="string"||!Ei(t.keyword))return p();return{kind:n,keyword:t.keyword,path:ab(t.path),source:t.source===void 0?void 0:we(t.source),target:t.target===void 0?void 0:we(t.target)}}function YI(e){let t=x(e),n=t.values==null?void 0:x(t.values);return{code:f(t.code),column:ie(t.column),...t.fields===void 0?{}:{fields:Array.isArray(t.fields)?t.fields.map(f):p()},line:ie(t.line),message:f(t.message),mismatch:t.mismatch==null?void 0:QI(t.mismatch),path:typeof t.path=="string"?t.path:p(),...n==null?{}:{values:Object.fromEntries(Object.entries(n).map(([r,o])=>[r,typeof o=="string"||typeof o=="number"?o:p()]))}}}function cb(e){let t=x(e);if(t.version!=1||typeof t.valid!="boolean"||!Array.isArray(t.diagnostics))return p();return{closureDigest:f(t.closureDigest),diagnostics:t.diagnostics.map(YI),engineContract:f(t.engineContract),flowId:f(t.flowId),modelVersion:ie(t.modelVersion),revisionDigest:f(t.revisionDigest),revisionId:f(t.revisionId),valid:t.valid,version:1}}var lb=(e)=>e==null?"":`?flowId=${encodeURIComponent(e)}`;function ub(e,t){let n=new URLSearchParams({...e==null?{}:{flowId:e},...t==null?{}:{locale:t}}).toString();return{path:`/v1/connector/providers${n?`?${n}`:""}`,decode:(r)=>{let o=x(r);if(Q(o,["providers","version"]),o.version!=1||!Array.isArray(o.providers))return p();return o.providers.map(eb)}}}function db(e,t,n){let r=new URLSearchParams({...t==null?{}:{flowId:t},...n==null?{}:{locale:n}}).toString();return{path:`/v1/connector/actions/${encodeURIComponent(e)}${r?`?${r}`:""}`,decode:(o)=>{let i=x(o);if(Q(i,["action","version"]),i.version!=1)return p();return Ki(i.action)}}}function pb(e){return{path:`/v1/connector/connections${lb(e)}`,decode:(t)=>{let n=x(t);if(Q(n,["connections","version"]),n.version!=1||!Array.isArray(n.connections))return p();return n.connections.map(Dn)}}}function fb(e,t){return{path:`/v1/connector/connections/${encodeURIComponent(e)}${lb(t)}`,decode:(n)=>{let r=x(n);if(Q(r,["connections","serviceId","version"]),r.version!=1||f(r.serviceId)!=e||!Array.isArray(r.connections))return p();return r.connections.map(Dn)}}}function Hr(e){return Array.isArray(e)?e.map(f):p()}function XI(e){let t=x(e),n=t.draft===null?null:x(t.draft),r=x(t.sharedAccess);if(n!=null&&!Array.isArray(n.connections))return p();if(!Array.isArray(r.bindings))return p();let o=ie(r.accessRevision);if(o<0)return p();return{draft:n==null?null:{...n.calledFlowIds===void 0?{}:{calledFlowIds:Hr(n.calledFlowIds)},variableNames:Hr(n.variableNames),errorSourceFlowIds:Hr(n.errorSourceFlowIds),connections:n.connections.map((i)=>{let s=x(i);return{providerId:f(s.providerId),connectionId:f(s.connectionId)}})},sharedAccess:{accessRevision:o,providerIds:Hr(r.providerIds),bindings:r.bindings.map((i)=>{let s=x(i);return{providerId:f(s.providerId),connectionId:s.connectionId===null?null:f(s.connectionId),accessBindingId:f(s.accessBindingId)}})}}}function gt(e){let t=x(e),n=t.status;if(t.version!=1)return p();if(n!="active"&&n!="retiring")return p();let r=t.live==null?void 0:x(t.live);if(r!=null&&(typeof r.enabled!="boolean"||typeof r.hasStart!="boolean"))return p();return{...r==null?{}:{live:{enabled:r.enabled,hasStart:r.hasStart,publicationId:f(r.publicationId),revisionId:f(r.revisionId)}},tagIds:t.tagIds===void 0?[]:Hr(t.tagIds),createdAt:f(t.createdAt),...t.connectorTeamId==null?{}:{connectorTeamId:f(t.connectorTeamId)},draftRevisionId:f(t.draftRevisionId),resourceReferences:XI(t.resourceReferences),flowId:f(t.flowId),name:f(t.name),status:n,updatedAt:f(t.updatedAt),version:1}}function eC(e){let t=x(e),n=ie(t.referenceCount);if(n<0)return p();return{...gt(t),referenceCount:n}}function mb(e){let t=x(e);if(t.version!=1||!Array.isArray(t.flows))return p();let{nextCursor:n,total:r}=t;if(n!=null&&typeof n!="string")return p();if(r!=null&&!Number.isSafeInteger(r))return p();return{...n==null?{}:{nextCursor:n},flows:t.flows.map(eC),...r==null?{}:{total:r},version:1}}function Gi(e){let t=x(e);if(Q(t,["name","updatedAt","value","version"]),t.version!=1||typeof t.value!="string")return p();let n=f(t.updatedAt);try{if(new Date(n).toISOString()!=n)return p()}catch{return p()}return{name:f(t.name),updatedAt:n,value:t.value,version:1}}function gb(e){let t=x(e),{referenceCount:n,...r}=t,o=ie(n);if(o<0)return p();return{...Gi(r),referenceCount:o}}function hb(e){let t=x(e);if(typeof t.enabled!="boolean")return p();return{flowId:f(t.flowId),flowName:f(t.flowName),nodeId:f(t.nodeId),nodeName:f(t.nodeName),enabled:t.enabled}}function yb(e){let t=x(e);if(Q(t,["version","references"]),t.version!=1||!Array.isArray(t.references))return p();return{version:1,references:t.references.map((n)=>{let r=x(n);if(Q(r,["flowId","flowName","draft","live"]),typeof r.draft!="boolean")return p();let o=r.live===null?null:x(r.live);if(o!=null){if(Q(o,["publicationId","enabled"]),typeof o.enabled!="boolean")return p()}return{flowId:f(r.flowId),flowName:f(r.flowName),draft:r.draft,live:o==null?null:{publicationId:f(o.publicationId),enabled:o.enabled}}})}}function bb(e){let t=x(e),n=t.parentRevisionId;if(t.version!=1||n!==null&&typeof n!="string")return p();return{actorId:f(t.actorId),createdAt:f(t.createdAt),digest:f(t.digest),flowId:f(t.flowId),modelVersion:ie(t.modelVersion),parentRevisionId:n,revisionId:f(t.revisionId),version:1}}function Qr(e){let t=x(e);try{return{...bb(t),content:Tn(t.content)}}catch{return p()}}function Hi(e){let t=x(e);if(t.version!=1||ie(t.revision)<1)return p();return{revision:ie(t.revision),updatedAt:f(t.updatedAt),value:Object.fromEntries(Object.entries(x(t.value)).map(([n,r])=>[n,we(r)])),version:1}}function Yr(e){let t=x(e);if(t.version!=1)return p();return{revision:bb(t.revision),version:1}}function wb(e){let t=x(e);if(t.version!=1||t.kind!="snapshot")return p();return{draft:Qr(t.draft),kind:"snapshot",version:1}}var tC=["canceled","completed","failed","indeterminate"],Qi=[...tC,"queued","running","starting","waiting"];var nC=new Set(Qi);function Yi(e){return typeof e=="string"&&nC.has(e)?e:p()}function kb(e){let t=x(e),{source:n,startedAt:r,finishedAt:o}=t;if(t.version!=1||n!="draft"&&n!="live")return p();if(r!=null&&typeof r!="string")return p();if(o!=null&&typeof o!="string")return p();return{createdAt:f(t.createdAt),...o==null?{}:{finishedAt:o},flowId:f(t.flowId),revisionId:f(t.revisionId),runId:f(t.runId),source:n,...r==null?{}:{startedAt:r},status:Yi(t.status),version:1}}function rC(e){let t=x(e);Q(t,["actions","expiresAt","nodeId","prompt","waitId","waitingSince"]);let n=t.actions;if(!Array.isArray(n)||!(n.length==1&&n[0]=="continue"||n.length==2&&n[0]=="approve"&&n[1]=="reject"))return p();return{actions:n,...t.autoContinueAt===void 0?{}:{autoContinueAt:f(t.autoContinueAt)},expiresAt:f(t.expiresAt),nodeId:f(t.nodeId),prompt:f(t.prompt),waitId:f(t.waitId),waitingSince:f(t.waitingSince)}}function vb(e){let t=x(e);return{flowId:f(t.flowId),runId:f(t.runId),nodeId:f(t.nodeId),executionId:f(t.executionId),...t.callId==null?{}:{callId:f(t.callId)}}}function oC(e){let t=x(e);if(!["workbench","cli","mcp","api","trigger","workflow"].includes(t.channel))return p();return{channel:t.channel,...t.actorId===void 0?{}:{actorId:f(t.actorId)}}}function Xi(e){let t=x(e),n=kb(t),r=t.eventsExpiresAt;if(r!=null&&typeof r!="string")return p();if(t.waiting!==void 0||!Array.isArray(t.waits))return p();let o=t.waits.map(rC);if(new Set(o.map((a)=>a.waitId)).size!=o.length||n.status=="waiting"&&o.length==0&&(!Array.isArray(t.calls)||t.calls.length==0)||["completed","failed","canceled","indeterminate"].includes(n.status)&&o.length>0)return p();if(t.occurrenceId!==void 0&&t.triggerNodeId===void 0)return p();let i={status:n.status,waits:o};if(t.calls!==void 0&&!Array.isArray(t.calls))return p();let s={...n,...t.initiator===void 0?{}:{initiator:oC(t.initiator)},...iC(t),...t.triggerNodeId===void 0?{}:{triggerNodeId:f(t.triggerNodeId)},...t.caller===void 0?{}:{caller:vb(t.caller)},...t.calls===void 0?{}:{calls:t.calls.map((a)=>Object.assign(vb(a),{status:x(a).status===null?null:Yi(x(a).status)}))},closureDigest:f(t.closureDigest),engineContract:f(t.engineContract),engineDigest:f(t.engineDigest),...r==null?{}:{eventsExpiresAt:r},modelVersion:ie(t.modelVersion),sharedAccessDigest:f(t.sharedAccessDigest),revisionDigest:f(t.revisionDigest),...i};switch(n.source){case"draft":return{...s,source:"draft"};case"live":return{...s,publicationId:f(t.publicationId),source:"live",...t.occurrenceId===void 0?{}:{occurrenceId:f(t.occurrenceId),triggerNodeId:f(t.triggerNodeId)}}}}function Sb(e){let t=x(e),n=t.nextCursor;if(t.version!=1||!Array.isArray(t.runs))return p();if(n!=null&&typeof n!="string")return p();return{flowId:f(t.flowId),...n==null?{}:{nextCursor:n},runs:t.runs.map(kb),version:1}}function Ib(e){let t=x(e),n=Yi(t.status);if(t.version!=1||typeof t.cancelAccepted!="boolean"||n=="queued"||n=="starting"||n=="running"||n=="waiting")return p();return{cancelAccepted:t.cancelAccepted,runId:f(t.runId),status:n,version:1}}function Cb(e){let t=x(e);Q(t,["action","comment","resolutionAccepted","resolvedAt","runId","status","version","waitId"]);let{action:n,resolvedAt:r}=t;if(t.version!=1||typeof t.resolutionAccepted!="boolean"||t.comment!==null&&typeof t.comment!="string"||n!==null&&n!="approve"&&n!="continue"&&n!="reject"||r!==null&&typeof r!="string"||n===null!=(r===null)||t.resolutionAccepted&&n===null)return p();return{action:n,comment:t.comment,resolutionAccepted:t.resolutionAccepted,resolvedAt:r,runId:f(t.runId),status:Yi(t.status),version:1,waitId:f(t.waitId)}}function Eb(e){let t=x(e),n=t.status;if(t.version!=1)return p();let r={finishedAt:f(t.finishedAt),runId:f(t.runId),version:1};if(n=="completed"){if(!Object.hasOwn(t,"result"))return p();return{...r,result:t.result,status:"completed"}}if(n=="canceled")return{...r,status:"canceled"};if(n=="failed"){let o=x(t.error);return{...r,error:xb(o),status:"failed"}}if(n=="indeterminate"){let o=x(t.error);return{...r,error:xb(o),status:"indeterminate"}}return p()}function iC(e){let t=e.errorSource==null?void 0:x(e.errorSource);if(e.errorDispatches!=null&&!Array.isArray(e.errorDispatches))return p();return{...t==null?{}:{errorSource:{flowId:f(t.flowId),runId:f(t.runId)}},...e.errorDispatches==null?{}:{errorDispatches:e.errorDispatches.map((n)=>{let r=x(n),o=f(r.flowId);switch(r.status){case"pending":return{status:"pending",flowId:o};case"dispatched":return{status:"dispatched",flowId:o,runId:f(r.runId)};case"failed":return{status:"failed",flowId:o,message:f(r.message)};default:return p()}})}}}function xb(e){return{code:f(e.code),message:f(e.message),...e.nodeId===void 0?{}:{nodeId:f(e.nodeId)},...e.jobId===void 0?{}:{jobId:f(e.jobId)},...e.path===void 0?{}:{path:(Array.isArray(e.path)?e.path:p()).map(f)}}}function es(){let e=globalThis.crypto;if(e!=null){try{if(typeof e.randomUUID=="function")return e.randomUUID()}catch{}if(typeof e.getRandomValues=="function"){let t=e.getRandomValues(new Uint8Array(16));t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;let n=Array.from(t,(r)=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function hu(e={}){return{query:e.query?.trim().toLowerCase()??"",tagIds:[...new Set(e.tagIds??[])].toSorted(),untagged:e.untagged??!1}}function ts(e){let t=x(e);if(t.version!=1)return p();return{tagId:f(t.tagId),name:f(t.name),version:1}}function Ob(e){let t=x(e),n=ie(t.referenceCount);if(n<0)return p();return{...ts(t),referenceCount:n}}function _b(e){return e?.kind=="run.completed"||e?.kind=="run.failed"||e?.kind=="run.canceled"||e?.kind=="run.indeterminate"}function sC(e){let t=x(e),n=ie(t.sequence);if(n<0)return p();let r={createdAt:f(t.createdAt),sequence:n},o=x(t.payload),i=t.kind;switch(i){case"run.queued":return{...r,kind:i,payload:{}};case"run.started":return{...r,kind:i,payload:{flowId:f(o.flowId),scopeId:f(o.scopeId),...o.parentScopeId===void 0?{}:{parentScopeId:f(o.parentScopeId)}}};case"run.progress":return{...r,kind:i,payload:{flowId:f(o.flowId),scopeId:f(o.scopeId),progress:jb(o.progress)}};case"run.waiting":if(!Array.isArray(o.waitIds))return p();return{...r,kind:i,payload:{waitIds:o.waitIds.map((s)=>f(s))}};case"wait.created":{let s=o.autoContinueAt===void 0?{}:{autoContinueAt:f(o.autoContinueAt)};return{...r,kind:i,payload:{...s,expiresAt:f(o.expiresAt),nodeId:f(o.nodeId),waitId:f(o.waitId),waitingSince:f(o.waitingSince)}}}case"run.resolved":{let{action:s,source:a}=o;if(a!==void 0&&a!=="manual"&&a!=="automatic")return p();let c=a===void 0?{}:{source:a};if(s!=="approve"&&s!=="continue"&&s!=="reject")return p();if(o.comment!==null&&typeof o.comment!="string")return p();return{...r,kind:i,payload:{...c,action:s,comment:o.comment,resolvedAt:f(o.resolvedAt),waitId:f(o.waitId)}}}case"run.completed":case"run.canceled":case"run.failed":case"run.indeterminate":return{...r,kind:i,payload:{result:we(o.result)}};case"run.events-truncated":return{...r,kind:i,payload:Object.fromEntries(Object.entries(o).map(([s,a])=>[s,we(a)]))};case"node.started":case"node.completed":case"node.failed":case"node.log":case"node.progress":case"node.artifact":{let s={flowId:f(o.flowId),scopeId:f(o.scopeId),nodeId:f(o.nodeId),executionId:f(o.executionId)};switch(i){case"node.started":{let a=o.nodeKind;if(a!==void 0&&a!=="approval"&&a!=="condition"&&a!=="connector"&&a!=="javascript"&&a!=="decision"&&a!=="openapi"&&a!=="http-request"&&a!=="skip-duplicates"&&a!=="llm"&&a!=="agent"&&a!=="value"&&a!=="outputs"&&a!=="webhook-response"&&a!=="workflow"&&a!=="wait")return p();return{...r,kind:i,payload:{...s,...a===void 0?{}:{nodeKind:a},...o.nodeTitle===void 0?{}:{nodeTitle:f(o.nodeTitle)},...o.operation===void 0?{}:{operation:f(o.operation)}}}}case"node.completed":return{...r,kind:i,payload:{...s,...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(x(o.systemOutputs)).map(([a,c])=>[a,we(c)]))},outputs:Object.fromEntries(Object.entries(x(o.outputs)).map(([a,c])=>[a,we(c)]))}};case"node.failed":{let a=x(o.error);return{...r,kind:i,payload:{...s,...o.handled===!0?{handled:!0}:{},...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(x(o.systemOutputs)).map(([c,l])=>[c,we(l)]))},error:{code:f(a.code),message:f(a.message)}}}}case"node.log":{let a=o.level;if(a!=="debug"&&a!=="info"&&a!=="warn"&&a!=="error")return p();return{...r,kind:i,payload:{...s,level:a,message:f(o.message)}}}case"node.progress":return{...r,kind:i,payload:{...s,progress:jb(o.progress)}};case"node.artifact":{let a=x(o.artifact),c=ie(a.size),l=f(a.digest);if(a.kind!="artifact"||c<0||!/^sha256:[0-9a-f]{64}$/.test(l))return p();return{...r,kind:i,payload:{...s,artifact:{kind:"artifact",id:f(a.id),name:f(a.name),size:c,digest:l,...a.mediaType===void 0?{}:{mediaType:f(a.mediaType)}}}}}}}default:return p()}}function jb(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=100?e:p()}function aC(e){let t=x(e),n=t.eventsExpiresAt,r=ie(t.nextAfter);if(t.version!=1||!Array.isArray(t.events)||typeof t.done!="boolean"||typeof t.historyComplete!="boolean")return p();if(n!=null&&typeof n!="string")return p();if(r<0)return p();return{done:t.done,events:t.events.map(sC),...n==null?{}:{eventsExpiresAt:n},historyComplete:t.historyComplete,nextAfter:r,runId:f(t.runId),version:1}}var _=encodeURIComponent;function nn(e){return`${e}-${es()}`}class yu{constructor(e,t="api"){this.channel=t,this.requestControl=e}async loadOpenApiDocument(e,t){let n=x(await this.request("/v1/openapi/document",{method:"POST",body:JSON.stringify({url:e,version:1}),signal:t}));if(n.version!=1)return p();return we(n.document)}async listFlows(e={}){let t=new URLSearchParams,n=hu(e);if(n.query)t.set("query",n.query);if(n.tagIds.length)t.set("tagIds",n.tagIds.join(","));if(n.untagged)t.set("untagged","true");if(e.cursor!=null)t.set("cursor",e.cursor);if(e.limit!=null)t.set("limit",String(e.limit));if(e.includeTotal!=null)t.set("includeTotal",String(e.includeTotal));let r=t.size==0?"":`?${t}`;return mb(await this.request(`/v1/flows${r}`,e.signal==null?void 0:{signal:e.signal}))}async listEventSources(e,t){return du(await this.request("/v1/event-sources"+(e==null?"":`?flowId=${_(e)}`),{signal:t}))}async listEventSourceConnections(e,t,n="feishu"){let r=x(await this.request(`/v1/event-sources/connections?kind=${n}${e==null?"":`&teamId=${_(e)}`}`,{signal:t}));if(Q(r,["version","connections"]),r.version!=1||!Array.isArray(r.connections))return p();return r.connections.map(Dn)}async createEventSource(e){return Wi(await this.request("/v1/event-sources",{method:"POST",body:JSON.stringify(e)}))}async updateEventSource(e,t){return Wi(await this.request(`/v1/event-sources/${_(e)}`,{method:"PUT",body:JSON.stringify(t)}))}async deleteEventSource(e,t){await this.request(`/v1/event-sources/${_(e)}`,{method:"DELETE",body:JSON.stringify({version:1,expectedRevision:t})})}async listVariables(){let e=x(await this.request("/v1/variables"));if(Q(e,["variables","version"]),e.version!=1||!Array.isArray(e.variables))return p();return{variables:e.variables.map(gb),version:1}}async getFlowReferences(e,t={}){let n=new URLSearchParams({direction:t.direction??"incoming",offset:String(t.offset??0),limit:String(t.limit??50)});return Bh.parse(await this.request(`/v1/flows/${_(e)}/references?${n}`,{signal:t.signal}))}async getWorkflowContract(e,t){return Uh.parse(await this.request(`/v1/flows/${_(e)}/call-contract`,{signal:t}))}async getVariableReferences(e,t){return yb(await this.request(`/v1/variables/${_(e)}/references`,{signal:t}))}async getVariable(e){return Gi(await this.request(`/v1/variables/${_(e)}`))}async putVariable(e,t){return Gi(await this.request(`/v1/variables/${_(e)}`,{body:JSON.stringify({value:t}),method:"PUT"}))}async deleteVariable(e){let t=x(await this.request(`/v1/variables/${_(e)}`,{method:"DELETE"}));if(Q(t,["version"]),t.version!=1)return p()}async exportFlow(e){let t=await this.request(`/v1/flows/${_(e)}/export`);try{return Ui(t)}catch{return p()}}async importFlow(e,t={}){return gt(await this.request("/v1/flows/import",{method:"POST",headers:{"Idempotency-Key":t.idempotencyKey??`flow-${es()}`},body:JSON.stringify({file:e,name:t.name,teamId:t.teamId,tagIds:t.tagIds,version:1})}))}async createFlow(e,t=`flow-${es()}`,n,r,o){return gt(await this.request("/v1/flows",{body:JSON.stringify({name:e,...n==null?{}:{teamId:n},...r==null?{}:{tagIds:r},...o==null?{}:{presentation:o},version:1}),headers:{"idempotency-key":t},method:"POST"}))}async broadcastCanvas(e,t){let n=x(await this.request(`/v1/flows/${_(e)}/canvas`,{method:"POST",body:JSON.stringify({version:1,command:t})}));if(Q(n,["version","flowId","broadcast"]),n.version!=1||n.broadcast!==!0||n.flowId!==e)return p();return{version:1,flowId:f(n.flowId),broadcast:!0}}async getFlow(e){return gt(await this.request(`/v1/flows/${_(e)}`))}async getErrorListeners(e,t){let n=x(await this.request(`/v1/flows/${_(e)}/error-listeners`,{signal:t}));if(n.version!=1||!Array.isArray(n.listeners))return p();return n.listeners.map(hb)}async listTags(e){let t=x(await this.request("/v1/tags",{signal:e}));if(t.version!=1||!Array.isArray(t.tags))return p();return{tags:t.tags.map(Ob),version:1}}async createTag(e){return ts(await this.request("/v1/tags",{method:"POST",body:JSON.stringify({name:e,version:1})}))}async renameTag(e,t){return ts(await this.request(`/v1/tags/${_(e)}`,{method:"PATCH",body:JSON.stringify({name:t,version:1})}))}async deleteTag(e){if(x(await this.request(`/v1/tags/${_(e)}`,{method:"DELETE"})).version!=1)p()}async setFlowTags(e,t){return gt(await this.request(`/v1/flows/${_(e)}/tags`,{method:"PUT",body:JSON.stringify({tagIds:t,version:1})}))}async updateFlow(e,t){return gt(await this.request(`/v1/flows/${_(e)}`,{method:"PATCH",body:JSON.stringify({...t,version:1})}))}async getFlowState(e,t,n=!1){let r=Hg.safeParse(await this.request(`/v1/flows/${_(e)}/state?scope=${t}&values=${n}`));return r.success&&r.data.scope===t?r.data:p()}async clearFlowState(e,t,n){let r=x(await this.request(`/v1/flows/${_(e)}/state?scope=${t}${n==null?"":`&key=${encodeURIComponent(n)}`}`,{method:"DELETE"}));if(r.version!==1||r.cleared!==!0)p()}async clearFlowDedupe(e,t,n){let r=x(await this.request(`/v1/flows/${_(e)}/dedupe?scope=${t}&space=${encodeURIComponent(n)}`,{method:"DELETE"}));if(r.version!==1||r.cleared!==!0)p()}async renameFlow(e,t){return this.updateFlow(e,{name:t})}async deleteFlow(e){return gt(await this.request(`/v1/flows/${_(e)}`,{method:"DELETE"}))}async listTriggerKeys(e,t){let n=x(await this.request(`/v1/trigger-keys${t==null?"":`?locale=${encodeURIComponent(t)}`}`,{signal:e}));if(n.version!=1||!Array.isArray(n.keys))return p();return n.keys.map(ru)}async listTriggerDefinitions(e){let t=x(await this.request("/v1/trigger-keys/catalog",{signal:e}));if(t.version!=2||!Array.isArray(t.definitions))return p();return t.definitions.map(Br)}async readCatalog(e,t,n){let r=new Headers;if(t)r.set("if-none-match",t);let o=await this.response(e.path,{headers:r,signal:n},!0),i=o.headers.get("etag")?.trim()||null;if(o.status==304)return{modified:!1,etag:i};return{modified:!0,data:e.decode(await o.json()),etag:i}}async getTriggerCatalog(e,t,n){let r=new Headers;if(t?.etag)r.set("if-none-match",t.etag);let o=await this.response(`/v1/trigger-keys/catalog?locale=${encodeURIComponent(e)}`,{headers:r,signal:n},!0);if(o.status==304){if(t==null)return p();return{...t,etag:o.headers.get("etag")?.trim()||t.etag}}return{data:pu(await o.json()),etag:o.headers.get("etag")?.trim()||null}}async getTriggerKey(e,t){let n=x(await this.request(`/v1/trigger-keys/${_(e)}`,{signal:t}));if(n.version!=1)return p();return Br(n.definition)}async listFlowTriggerBindings(e,t){let n=x(await this.request(`/v1/flows/${_(e)}/triggers`,{signal:t}));if(n.version!=1||f(n.flowId)!=e||!Array.isArray(n.bindings))return p();return n.bindings.map(Kr)}async getFlowTriggerBinding(e,t){return $y(await this.request(`/v1/flows/${_(e)}/triggers/${_(t)}`))}async listFlowTriggerActivities(e,t,n={}){let r=new URLSearchParams;if(n.cursor!=null)r.set("cursor",n.cursor);if(n.limit!=null)r.set("limit",String(n.limit));let o=r.size==0?"":`?${r}`;return Ny(await this.request(`/v1/flows/${_(e)}/triggers/${_(t)}/activities${o}`))}async testFlowPollTrigger(e,t){return zy(await this.request(`/v1/flows/${_(e)}/triggers/${_(t)}/test`,{body:JSON.stringify({version:1}),method:"POST"}))}async getEditor(e){let t=x(await this.request(`/v1/flows/${_(e)}/editor`));if(t.version!=1)return p();let n={flow:gt(t.flow),draft:Qr(t.draft),live:nu(t.live),presentation:Hi(t.presentation),version:1};if(n.flow.flowId!=e||n.draft.flowId!=e||n.live.flowId!=e||n.flow.draftRevisionId!=n.draft.revisionId)return p();return n}async getPublicationPresentation(e,t,n){let r=x(await this.request(`/v1/flows/${_(e)}/publications/${_(t)}/presentation`,{signal:n}));if(r.version!=1)return p();return{version:1,presentation:r.presentation===null?null:Hi(r.presentation)}}async getPresentation(e){return Hi(await this.request(`/v1/flows/${_(e)}/presentation`))}async getDraft(e){return Qr(await this.request(`/v1/flows/${_(e)}/draft`))}async syncDraft(e){return wb(await this.request(`/v1/flows/${_(e)}/draft/sync`))}async getRevision(e,t,n){return Qr(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}`,{signal:n}))}async listTriggerConfigOptions(e,t,n,r){let o=x(await this.request(`/v1/flows/${_(e)}/triggers/${_(t)}/options/${_(n)}`,{signal:r}));if(Q(o,["options","version"]),o.version!=1||!Array.isArray(o.options)||o.options.length>1000)return p();return o.options.map((i)=>{let s=x(i);Q(s,["value","label",...s.color==null?[]:["color"]]);let a=s.color==null?void 0:f(s.color);if(a!=null&&!/^#[0-9a-fA-F]{6}$/.test(a))return p();return a==null?{value:f(s.value),label:f(s.label)}:{value:f(s.value),label:f(s.label),color:a}})}async listConnectorTeams(e){let t=x(await this.request("/v1/connector/teams",{signal:e}));if(Q(t,["enabled","teams","version"]),t.version!=1||typeof t.enabled!="boolean"||!Array.isArray(t.teams))return p();return{enabled:t.enabled,teams:t.teams.map((n)=>{let r=x(n);if(Q(r,["id","name","systemCreated"]),typeof r.systemCreated!="boolean")return p();return{id:f(r.id),name:f(r.name),systemCreated:r.systemCreated}}),version:1}}async listConnectorProviders(e,t,n){let r=ub(t,n);return this.connectorRequest(r.path,"providers",e,r.decode)}async listLeinaBots(e,t){return Hy(await this.request(`/v1/connector/leina/bots?flowId=${_(e)}`,{signal:t}))}async removeConnectionUsage(e,t,n,r,o){return Yr(await this.request(`/v1/flows/${_(e)}/connection-usage/remove`,{method:"POST",headers:{"idempotency-key":o},body:JSON.stringify({connectionId:t,expectedRevisionId:n,expectedAccessRevision:r,version:1})}))}async getConnectorAccess(e,t){return zn(await this.request(`/v1/flows/${_(e)}/connector-access`,{signal:t}))}async getPublishedConnectorAccess(e,t,n){return lu(await this.request(`/v1/flows/${_(e)}/connector-access?publicationId=${_(t)}`,{signal:n}))}async listProviderAccessBindingCandidates(e,t,n){return Yy(await this.request(`/v1/flows/${_(e)}/connector-access/candidates/query`,{method:"POST",body:JSON.stringify({providerIds:t,version:1}),signal:n}),t)}async setConnectorService(e,t,n,r){return zn(await this.request(`/v1/flows/${_(e)}/connector-access/${_(t)}/service`,{body:JSON.stringify({expectedAccessRevision:r,version:1}),method:n?"PUT":"DELETE"}))}async addProviderAccessBinding(e,t,n,r){return zn(await this.request(`/v1/flows/${_(e)}/connector-access/${_(t)}`,{body:JSON.stringify({accessBindingId:n,expectedAccessRevision:r,version:1}),method:"PUT"}))}async removeProviderAccessBinding(e,t,n,r){return zn(await this.request(`/v1/flows/${_(e)}/connector-access/${_(t)}`,{body:JSON.stringify({accessBindingId:n,expectedAccessRevision:r,version:1}),method:"DELETE"}))}async listConnectorActions(e,t,n,r){return await this.connectorActions({...r==null?{}:{locale:r},...n==null?{}:{flowId:n},...e==null?{}:{service:e}},t)}async searchConnectorActions(e,t,n,r){return await this.connectorActions({...r==null?{}:{locale:r},...n==null?{}:{flowId:n},q:e.trim()},t)}async getConnectorAction(e,t,n,r,o=!1){let i=db(e,n,r);return this.connectorRequest(i.path,"actions",t,i.decode,o)}async listAllConnectorConnections(e,t,n=!1){let r=pb(t);return this.connectorRequest(r.path,"connections",e,r.decode,n)}async listConnectorConnections(e,t,n,r=!1){let o=fb(e,n);return this.connectorRequest(o.path,"connections",t,o.decode,r)}async createConnectorConnectionPage(e,t,n){let r=new URLSearchParams;if(t!=null)r.set("flowId",t);if(n!=null)r.set("teamId",n);let o=x(await this.request(`/v1/connector/connections/${_(e)}/page${r.size==0?"":`?${r}`}`,{body:JSON.stringify({version:1}),method:"POST"}));if(Q(o,["url","version"]),o.version!=1)return p();try{let i=new URL(f(o.url));if(i.protocol!="http:"&&i.protocol!="https:")return p();return i.href}catch{return p()}}async readAuthoring(e,t={}){return _y.parse(await this.request(`/v1/flows/${_(e)}/authoring/read`,{method:"POST",body:JSON.stringify(t)}))}async searchAuthoring(e,t){return Ry.parse(await this.request(`/v1/flows/${_(e)}/authoring/search`,{method:"POST",body:JSON.stringify(t)}))}async authoringSchema(e,t){return x(await this.request(`/v1/flows/${_(e)}/authoring/schema`,{method:"POST",body:JSON.stringify(t)}))}async editAuthoring(e,t){return jy.parse(await this.request(`/v1/flows/${_(e)}/authoring/edit`,{method:"POST",headers:{"idempotency-key":t.requestId},body:JSON.stringify(t)}))}async checkAuthoring(e,t){return Oy.parse(await this.request(`/v1/flows/${_(e)}/authoring/check`,{method:"POST",body:JSON.stringify({revisionId:t})}))}async changeDraft(e,t,n,r=nn("change")){return Yr(await this.request(`/v1/flows/${_(e)}/draft/changes`,{body:JSON.stringify({expectedRevisionId:t,operations:n,version:1}),headers:{"idempotency-key":r},method:"POST"}))}async repairDraft(e,t,n=nn("repair")){return Yr(await this.request(`/v1/flows/${_(e)}/draft/repair`,{body:JSON.stringify({expectedRevisionId:t,version:1}),headers:{"idempotency-key":n},method:"POST"}))}async upgradeDraft(e,t,n={}){return Yr(await this.request(`/v1/flows/${_(e)}/draft/upgrade`,{body:JSON.stringify({expectedRevisionId:t,version:1}),headers:{"idempotency-key":n.idempotencyKey??nn("upgrade")},method:"POST"}))}async checkFlow(e,t){return cb(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}/check`,{body:JSON.stringify({engineContract:cn,version:1}),method:"POST"}))}async getLiveDetails(e,t){let n=qy(await this.request(`/v1/flows/${_(e)}/live/details`,{signal:t}));if(n.flowId!=e)return p();return n}async getLive(e,t){return nu(await this.request(`/v1/flows/${_(e)}/live`,{signal:t}))}async listPublications(e,t={},n){let r=new URLSearchParams;if(t.cursor!=null)r.set("cursor",t.cursor);if(t.limit!=null)r.set("limit",String(t.limit));if(t.includeTotal!=null)r.set("includeTotal",String(t.includeTotal));let o=r.size==0?"":`?${r}`;return Py(await this.request(`/v1/flows/${_(e)}/publications${o}`,{signal:n}))}async createDraftRun(e,t,n){let r=Xi(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}/runs`,{body:JSON.stringify({engineContract:cn,inputs:n.inputs??{},trigger:n.trigger,version:2}),headers:{"idempotency-key":n.idempotencyKey??nn("run"),"x-open-flow-client":this.channel},method:"POST"}));return r.source=="draft"?r:p()}async createLiveRun(e,t){let n=Xi(await this.request("/v1/runs",{body:JSON.stringify({inputs:t.inputs??{},trigger:t.trigger,publicationId:e,version:2}),headers:{"idempotency-key":t.idempotencyKey??nn("run"),"x-open-flow-client":this.channel},method:"POST"}));return n.source=="live"?n:p()}async setFlowEnabled(e,t,n){return gt(await this.request(`/v1/flows/${_(e)}/enabled`,{method:"PUT",body:JSON.stringify({enabled:n,expectedPublicationId:t,version:1})}))}async publishFlow(e,t,n,r={}){return tu(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}/publications`,{body:JSON.stringify({engineContract:cn,expectedLivePublicationId:n,version:1}),headers:{"idempotency-key":r.idempotencyKey??nn("publication")},method:"POST"}))}async getPublishOperation(e,t,n){return tu(await this.request(`/v1/flows/${_(e)}/publish-operations/${_(t)}`,{signal:n}))}async rollbackFlow(e,t,n,r={}){return Nn(await this.request(`/v1/flows/${_(e)}/publications/${_(t)}/rollback`,{body:JSON.stringify({expectedLivePublicationId:n,version:1}),headers:{"idempotency-key":r.idempotencyKey??nn("publication")},method:"POST"}))}async getRun(e,t){return Xi(await this.request(`/v1/runs/${_(e)}`,{signal:t}))}async listRuns(e,t={}){let n=new URLSearchParams;if(t.cursor!=null)n.set("cursor",t.cursor);if(t.limit!=null)n.set("limit",String(t.limit));if(t.status!=null)n.set("status",t.status);if(t.pendingWait!=null)n.set("pendingWait",String(t.pendingWait));if(t.source!=null)n.set("source",t.source);if(t.createdFrom!=null)n.set("createdFrom",t.createdFrom);if(t.createdBefore!=null)n.set("createdBefore",t.createdBefore);if(t.runId!=null)n.set("runId",t.runId);let r=n.size==0?"":`?${n}`;return Sb(await this.request(`/v1/flows/${_(e)}/runs${r}`))}async getRunEvents(e,t={},n){let r=new URLSearchParams;if(t.after!=null)r.set("after",String(t.after));if(t.limit!=null)r.set("limit",String(t.limit));let o=r.size==0?"":`?${r}`;return aC(await this.request(`/v1/runs/${_(e)}/events${o}`,{signal:n}))}async listRunResults(e,t,n){return mu(await this.request(`/v1/runs/${_(e)}/results${t==null?"":`?after=${encodeURIComponent(t)}`}`,{signal:n}))}async readRunResult(e,t,n={},r){let o=new URLSearchParams(Object.entries(n).map(([i,s])=>[i,String(s)]));return gu(await this.request(`/v1/runs/${_(e)}/results/${_(t)}?${o}`,{signal:r}))}async downloadRunResult(e,t,n){return(await this.response(`/v1/runs/${_(e)}/results/${_(t)}/content`,{signal:n})).blob()}async getRunResult(e,t){return Eb(await this.request(`/v1/runs/${_(e)}/result`,{signal:t}))}async cancelRun(e){return Ib(await this.request(`/v1/runs/${_(e)}/cancel`,{body:JSON.stringify({version:1}),method:"POST"}))}async resolveRunWait(e,t,n,r){return Cb(await this.request(`/v1/runs/${_(e)}/waits/${_(t)}/resolve`,{body:JSON.stringify({action:n,comment:r,version:1}),method:"POST"}))}async connectorActions(e,t){let n=Object.entries(e).map(([o,i])=>`${_(o)}=${_(i)}`).join("&"),r=n==""?"":`?${n}`;return this.connectorRequest(`/v1/connector/actions${r}`,"actions",t,(o)=>{let i=x(o);if(Q(i,["actions","version"]),i.version!=1||!Array.isArray(i.actions))return p();return i.actions.map(Ki)})}async connectorRequest(e,t,n,r,o=!1){return r(await this.request(e,{signal:n}))}async response(e,t,n=!1){let r=new Headers(t.headers);if(t.body!=null)r.set("content-type","application/json");let o=await this.requestControl(e,{...t,headers:r});if(!o.ok&&!(n&&o.status==304)){let i;try{i=await o.json()}catch{return p()}let s=x(i).error,a=s==null?void 0:x(s);throw new Te(o.status,typeof a?.code=="string"?a.code:"request.failed",typeof a?.message=="string"?a.message:`Request failed with status ${o.status}.`,a?.details==null?void 0:x(a.details))}return o}async request(e,t={}){let n=await this.response(e,t);try{return await n.json()}catch{return p()}}}import{randomUUID as fC}from"crypto";class E extends Error{constructor(e,t,n){super(t);this.code=e,this.details=n,this.name="CliError"}}function ns(e,t){let n=e.trim();if(Gr(n)!=null)throw new E("cli.invalid-arguments",`${t} name must be between 1 and ${su} characters and use only letters, numbers, spaces, hyphens, or underscores.`);return n}var cC=100,bu=100,wu=100,lC=new Set(["canceled","completed","failed","indeterminate"]);async function uC(e){let t=[],n=new Set,r;do{let o=await e.listFlows({cursor:r,limit:cC});if(t.push(...o.flows),r=o.nextCursor,r!=null&&n.has(r))throw new E("page.invalid-cursor","The deployment returned a repeated Flow cursor.");if(r!=null)n.add(r)}while(r!=null);return t}function dC(e,t){let n=e.find((o)=>o.flowId==t);if(n!=null)return n;let r=e.filter((o)=>o.name==t);if(r.length==1)return r[0];if(r.length>1)throw new E("flow.ambiguous",`Flow name ${JSON.stringify(t)} is ambiguous.`,{candidates:r.map(({flowId:o,name:i})=>({flowId:o,name:i}))});throw new E("flow.not-found",`Flow ${JSON.stringify(t)} was not found.`)}async function ve(e,t){try{return await e.getFlow(t)}catch(n){if(!(n instanceof Te)||n.code!="flow.invalid"&&n.code!="flow.not-found")throw n}return dC(await uC(e),t)}async function Rb(e,t,n){if(n.expectedRevision!=null&&n.expectedRevision!=t.draftRevisionId&&!n.options.includes("idempotency-key"))throw new E("flow.revision-conflict","The Flow Draft changed. Inspect it before submitting a new mutation.",{expectedRevisionId:n.expectedRevision,actualRevisionId:t.draftRevisionId,flowId:t.flowId});let r=await e.getRevision(t.flowId,n.expectedRevision??t.draftRevisionId);return{draft:r,flow:t,graph:r.content.document.graph}}function pC(e,t){let n=e.find((o)=>o.actionId==t);if(n!=null)return n;let r=e.filter((o)=>o.name==t);if(r.length==1)return r[0];if(r.length>1)throw new E("connector.action-ambiguous",`Connector Action name ${JSON.stringify(t)} is ambiguous.`,{candidates:r.map(({actionId:o,name:i,serviceId:s})=>({actionId:o,name:i,serviceId:s}))});throw new E("connector.action-not-found",`Connector Action ${JSON.stringify(t)} was not found.`)}async function Ab(e,t,n){try{return await e.getConnectorAction(t,void 0,n)}catch(r){if(!(r instanceof Te)||r.status!=404)throw r}return pC(await e.searchConnectorActions(t,void 0,n),t)}function Pb(e,t){let n=Object.entries(e.document.graph.nodes).filter((i)=>!("inputs"in i[1])),r=n?.find(([i])=>i==t);if(r!=null)return{trigger:r[1],triggerId:r[0]};let o=n?.filter(([,i])=>i.name==t)??[];if(o.length==1)return{trigger:o[0][1],triggerId:o[0][0]};if(o.length>1)throw new E("trigger.ambiguous",`Trigger name ${JSON.stringify(t)} is ambiguous.`,{candidates:o.map(([i,s])=>({name:s.name,triggerId:i}))});throw new E("trigger.not-found",`Trigger ${JSON.stringify(t)} was not found.`)}function vu(e){return`${e.displayName} ${e.key} ${e.provider} ${e.type}`}async function Tb(e,t){try{return await e.getTriggerKey(t)}catch(o){if(!(o instanceof Te)||o.status!=404)throw o}let r=(await e.listTriggerKeys()).filter((o)=>o.name==t||o.displayName==t);if(r.length==1)return await e.getTriggerKey(r[0].key);if(r.length>1)throw new E("trigger-key.ambiguous",`Trigger Key name ${JSON.stringify(t)} is ambiguous.`,{candidates:r.map(({displayName:o,key:i,provider:s})=>({displayName:o,key:i,provider:s}))});throw new E("trigger-key.not-found",`Trigger Key ${JSON.stringify(t)} was not found.`)}function $b(e){return`${e.displayName} ${e.connectionId} ${e.serviceId} ${e.status}${e.isDefault?"\tdefault":""}`}function xu(e){return`${e.name} ${e.actionId} ${e.serviceName} ${e.serviceId}`}function le(e,t,n){if(e.length!=t)throw new E("cli.invalid-arguments",`Usage: ${n}`)}function M(e,t,n,r){e.stdout.write(t?`${JSON.stringify(n)}
|
|
62
62
|
`:`${r}
|
|
63
|
-
`)}function
|
|
64
|
-
${JSON.stringify(e.waits)}`}`}function Ib(e){return`${e.source} ${e.status} ${e.runId} ${e.revisionId}`}function Cb(e){return`${e.sequence} ${e.kind} ${JSON.stringify(e.payload)}`}async function In(e,n,t,r){try{if(e=="-")return await r.readStdin();if(!e.startsWith("@"))return e;let o=e.slice(1);if(o.length==0)throw new O("cli.invalid-arguments",`${n} @ requires a file path.`);return await r.readFile(o)}catch(o){if(o instanceof O)throw o;throw new O(t,o instanceof Error?o.message:String(o))}}async function Eb(e,n){if(e.input==null)return{};let t=await In(e.input,"--input","run.input-unreadable",n),r;try{r=JSON.parse(t)}catch{throw new O("run.input-invalid","Run input must be valid JSON.")}if(r==null||typeof r!="object"||Array.isArray(r))throw new O("run.input-invalid","Run input must be an object keyed by node ID.");for(let o of Object.values(r))if(o==null||typeof o!="object"||Array.isArray(o))throw new O("run.input-invalid","Each Run input node must contain an object keyed by input handle.");return r}async function Qr(e,n,t){let r=new Set,o;do{let i=await e.listPublications(n,{cursor:o,limit:du}),s=i.publications.find((a)=>a.publicationId==t);if(s!=null)return s;if(o=i.nextCursor,o!=null&&r.has(o))throw new O("page.invalid-cursor","The deployment returned a repeated Publication cursor.");if(o!=null)r.add(o)}while(o!=null);throw new O("publication.not-found",`Publication ${JSON.stringify(t)} was not found.`)}async function gu(e,n,t,r=60000){let o=Date.now()+r,i=n;while(!YI.has(i.status)&&i.waits.length==0){let s=o-Date.now();if(s<=0)return{run:i,timedOut:!0};if(await t.wait(Math.min(1000,s)),Date.now()>=o)return{run:i,timedOut:!0};try{i=await e.getRun(i.runId,AbortSignal.timeout(Math.max(1,o-Date.now())))}catch(a){if(Date.now()>=o||a instanceof Error&&a.name=="TimeoutError")return{run:i,timedOut:!0};throw new O("run.wait-failed",a instanceof Error?a.message:String(a),{runId:i.runId})}}return{run:i,timedOut:!1}}function Yr(e,n=!1){if(n)return 3;if(e.waits.length>0)return 2;return e.status=="failed"||e.status=="canceled"||e.status=="indeterminate"?1:0}function Ob(e){return new O(e.code,e.message,{status:e.status,...e.details})}async function hu(e,n,t,r,o=60000){let i=Date.now()+o,s=t;while(s.status=="pending"){let a=i-Date.now();if(a<=0)return{operation:s,timedOut:!0};if(await r.wait(Math.min(1000,a)),Date.now()>=i)return{operation:s,timedOut:!0};try{s=await e.getPublishOperation(n,s.operationId,AbortSignal.timeout(Math.max(1,i-Date.now())))}catch(c){if(Date.now()>=i||c instanceof Error&&c.name=="TimeoutError")return{operation:s,timedOut:!0};throw new O("publication.wait-failed",c instanceof Error?c.message:String(c),{flowId:n,operationId:s.operationId})}}return{operation:s,timedOut:!1}}var rC=new Set(Wi);function jb(e){let n=tC(),t,r=[],o=[],i,s,a,c,l,u,d,g,h,y,S,R,N,D,L,Oe,fe,ie,qe,rt=!1,ot,it=!1,st,Mt,no=[],_u="draft",rs,os,Ru=!1,is,ss,as,Au=[],Pu=!1,Tu=!1;for(let Ft=0;Ft<e.length;Ft+=1){let Zt=e[Ft],to=Zt.startsWith("--")?Zt.indexOf("="):-1,P=to<0?Zt:Zt.slice(0,to),ro=to<0?void 0:Zt.slice(to+1);if(ro!=null&&["--json","--follow","--wait","--yes","--full","--pending-wait"].includes(P))throw new O("cli.invalid-arguments",`${P} does not accept a value.`);if(P.startsWith("--")){let U=P.slice(2);if(o.includes(U)&&U!="set"&&U!="unset")throw new O("cli.invalid-arguments",`Duplicate option --${U}.`);o.push(U)}if(P=="--json")it=!0;else if(P=="--follow")rt=!0;else if(P=="--wait")Pu=!0;else if(P=="--yes")Tu=!0;else if(P=="--pending-wait")rs=!0;else if(P=="--full")Ru=!0;else if(P=="--idempotency-key"||P=="--expected-publication"||P=="--revision"||P=="--publication"||P=="--pointer"||P=="--offset"||P=="--max-bytes"||P=="--code"||P=="--connection"||P=="--cron"||P=="--description"||P=="--every"||P=="--expected-revision"||P=="--file"||P=="--flow"||P=="--name"||P=="--source"||P=="--input"||P=="--trigger"||P=="--outputs"||P=="--status"||P=="--cursor"||P=="--limit"||P=="--after"||P=="--comment"||P=="--timeout"||P=="--timezone"||P=="--set"||P=="--unset"){let U=ro??e[Ft+1];if(U==null||U.length==0||ro==null&&U.startsWith("-")&&U!="-")throw new O("cli.invalid-arguments",`${P} requires a value.`);if(ro==null)Ft++;if(P=="--idempotency-key")n=U;else if(P=="--expected-publication")t=U;else if(P=="--revision")a=U;else if(P=="--publication")c=U;else if(P=="--pointer")l=U;else if(P=="--after")h=U;else if(P=="--code")S=U;else if(P=="--connection")R=U;else if(P=="--cron")N=U;else if(P=="--description")L=U;else if(P=="--every")Oe=U;else if(P=="--expected-revision")fe=U;else if(P=="--file")ie=U;else if(P=="--flow")qe=U;else if(P=="--name")Mt=U;else if(P=="--comment")is=U;else if(P=="--input")ot=U;else if(P=="--trigger")i=U;else if(P=="--outputs")s=U;else if(P=="--cursor")D=U;else if(P=="--timezone")as=U;else if(P=="--set")no.push(U);else if(P=="--unset")Au.push(U);else if(P=="--source"){if(U!="draft"&&U!="live")throw new O("cli.invalid-arguments","--source must be draft or live.");_u=U}else if(P=="--status"){if(!rC.has(U))throw new O("cli.invalid-arguments",`Unknown Run status ${JSON.stringify(U)}.`);os=U}else{let Cn=Number(U),mw=P=="--offset"?0:1;if(!Number.isSafeInteger(Cn)||Cn<mw||P=="--limit"&&Cn>100||P=="--max-bytes"&&Cn>1048576)throw new O("cli.invalid-arguments",`${P} has an invalid value.`);if(P=="--limit")st=Cn;else if(P=="--offset")u=Cn;else if(P=="--max-bytes")d=Cn;else ss=Cn}}else if(P.startsWith("-"))throw new O("cli.invalid-arguments",`Unknown option ${JSON.stringify(P)}.`);else r.push(P)}if(h!=null){if(r[0]=="runs"&&r[1]=="results")g=h;else if(y=Number(h),!Number.isSafeInteger(y)||y<0)throw new O("cli.invalid-arguments","--after must be a non-negative event sequence.")}return{idempotencyKey:n,...g==null?{}:{resultAfter:g},...d==null?{}:{maxBytes:d},...u==null?{}:{offset:u},...l==null?{}:{pointer:l},...a==null?{}:{revision:a},...c==null?{}:{publication:c},...is==null?{}:{comment:is},...t==null?{}:{expectedPublication:t},...y==null?{}:{after:y},...S==null?{}:{code:S},...R==null?{}:{connection:R},...N==null?{}:{cron:N},...D==null?{}:{cursor:D},...L==null?{}:{description:L},...Oe==null?{}:{every:Oe},...fe==null?{}:{expectedRevision:fe},...ie==null?{}:{file:ie},...qe==null?{}:{flow:qe},follow:rt,...ot==null?{}:{input:ot},json:it,...st==null?{}:{limit:st},...Mt==null?{}:{name:Mt},positionals:r,options:o,...i==null?{}:{trigger:i},...s==null?{}:{outputs:s},sets:no,source:_u,...os==null?{}:{status:os},...rs==null?{}:{pendingWait:rs},full:Ru,...ss==null?{}:{timeoutMs:ss},...as==null?{}:{timezone:as},unsets:Au,wait:Pu,yes:Tu}}var oC=0.1,iC=3,tt=on("type",[v({type:w("focus"),nodeId:j().min(1)}),v({type:w("zoom"),zoom:ne().min(oC).max(iC)}),v({type:w("pan"),dx:ne(),dy:ne()}),v({type:w("fit")})]);var yu=j().trim().refine((e)=>[...e].length<=2000,"Wait comment must contain at most 2,000 Unicode code points.").nullable().optional();var Lt=j().min(1),vC=$e(),xC=v({kind:w("graph.trigger.create"),nodeId:Lt,key:Lt,connectionId:Lt.optional(),name:Lt.optional(),config:re(Lt,vC),schedule:Ln.readonly().optional()});function bu(e){return Hn(e),A(dn()).min(1).parse(e).map((n,t)=>{let{kind:r}=Fr(n,t,E({kind:Lt}).parse);return r=="graph.trigger.create"?Fr(n,t,xC.parse):ry(n,t)})}var _b=[{snapshot:{configInputs:[{handle:"baseId",jsonSchema:{type:"string",pattern:"^app[A-Za-z0-9]{14}$"},nullable:!1},{handle:"formula",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"tableIdOrName",jsonSchema:{type:"string",minLength:1,maxLength:255},nullable:!1},{handle:"triggerField",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^[^}]*$"},nullable:!1},{handle:"view",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"fields",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"maxRecordsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:1000},nullable:!1,value:200}],definitionVersion:2,description:"Polls an Airtable table and triggers when a record is created or updated, ordered by a time field.",displayName:"Record Created or Updated",key:"airtable.on_record_changed",name:"on_record_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{baseId:{type:"string"},createdTime:{type:"string"},fields:{type:"object"},recordId:{type:"string"},tableIdOrName:{type:"string"},triggerField:{type:"string"},triggerFieldValue:{type:"string"}},additionalProperties:!1,required:["baseId","tableIdOrName","recordId","createdTime","triggerField","triggerFieldValue","fields"]}},nullable:!1}],provider:"airtable",type:"poll"},options:!1},{snapshot:{key:"asana.on_task_event",provider:"asana",name:"on_task_event",displayName:"Project Task Event",description:"Receives tasks added to a project, completion changes, and selected custom field changes. Task details represent current state, not historical state.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!0},successStatus:200},configInputs:[{handle:"projectId",jsonSchema:{type:"string",minLength:1,title:"Project ID"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["task.added","task.completed","task.field_changed"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["task.added","task.completed"]},{handle:"customFieldId",jsonSchema:{type:"string",minLength:1,title:"Custom field ID"},nullable:!0}],outputs:[{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},task:{type:"object"},change:{type:"object"}},required:["event","task","change"]}},nullable:!1}]},callback:{headers:["x-hook-secret","x-hook-signature"],query:[]},options:!1},{snapshot:{key:"calendly.on_booking_event",provider:"calendly",name:"on_booking_event",displayName:"Booking Created or Canceled",description:"Receives bookings and cancellations, preserving reschedule links. Requires a Personal Access Token connection.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"scope",jsonSchema:{type:"string",enum:["user","organization"],title:"Scope"},nullable:!1,value:"user"},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["invitee.created","invitee.canceled"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["invitee.created","invitee.canceled"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["invitee.created","invitee.canceled"]},nullable:!1},{handle:"inviteeUri",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["calendly-webhook-signature"],query:[]},options:!1},{snapshot:{key:"clickup.on_task_event",provider:"clickup",name:"on_task_event",displayName:"Task Event",description:"Receives task creation, status changes, and new comments in a ClickUp Workspace or List.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"workspaceId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"Workspace ID"},nullable:!1},{handle:"listId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"List ID"},nullable:!0},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["taskCreated","taskStatusUpdated","taskCommentPosted"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},nullable:!1},{handle:"taskId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-signature"],query:[]},options:!1},{snapshot:{key:"feishu_app_bot.on_event",provider:"feishu_app_bot",name:"on_event",displayName:"Application Event",description:"Receives selected Feishu application events through a shared event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.]{0,127}$"},minItems:1,maxItems:200,uniqueItems:!0,title:"Event types"},nullable:!1},{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",minLength:1,maxLength:256},maxItems:100,uniqueItems:!0,title:"Chat IDs"},nullable:!0,description:"Leave empty to receive events from all chats available to the source."},{handle:"resource",jsonSchema:{type:"object",properties:{kind:{type:"string",enum:["document","calendar","approval"]},id:{type:"string",minLength:1,maxLength:256},documentType:{type:"string",enum:["doc","docx","sheet","bitable","file","folder"]}},additionalProperties:!1,required:["kind","id"],title:"Resource subscription"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"tenantKey",jsonSchema:{type:"string"},nullable:!1},{handle:"occurredAt",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"feishu"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},verificationToken:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},manageSubscriptions:{type:"boolean"}},required:["version","name","connectionId","teamId","verificationToken","encryptKey","eventTypes","manageSubscriptions"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"feishu",provider:"feishu_app_bot",triggerId:"feishu_app_bot.on_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"feishu"},{snapshot:{key:"fireflies.on_meeting_ready",provider:"fireflies",name:"on_meeting_ready",displayName:"Meeting Transcript or Summary Ready",description:"Receives separate transcript and summary readiness events through Fireflies Webhooks V2 after checking meeting access.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["meeting.transcribed","meeting.summarized"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"fireflies"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]}}},required:["kind","version","name","connectionId","teamId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"fireflies",provider:"fireflies",triggerId:"fireflies.on_meeting_ready",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"fireflies"},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["*","branch_protection_configuration","branch_protection_rule","check_run","check_suite","code_scanning_alert","commit_comment","create","custom_property_values","delete","dependabot_alert","deploy_key","deployment","deployment_status","discussion","discussion_comment","fork","gollum","issue_comment","issue_dependencies","issues","label","member","meta","milestone","package","page_build","project","project_card","project_column","public","pull_request","pull_request_review","pull_request_review_comment","pull_request_review_thread","push","registry_package","release","repository","repository_advisory","repository_import","repository_ruleset","repository_vulnerability_alert","secret_scanning_alert","secret_scanning_alert_location","secret_scanning_scan","security_and_analysis","star","status","sub_issues","team_add","watch","workflow_job","workflow_run"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1}],definitionVersion:2,description:"Triggers when selected GitHub webhook events occur in a repository.",displayName:"Repository Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.on_repo_event",name:"on_repo_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"github",type:"integration"},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1},{handle:"number",jsonSchema:{type:"integer",minimum:1},nullable:!1,description:"Number of the pull request to watch."}],definitionVersion:2,description:"Watches one pull request using notifications and periodic checks. Starts from its current state; reports observed changes, not every intermediate transition or review event.",displayName:"Watch Pull Request",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.watch_pull_request",name:"watch_pull_request",provider:"github",type:"integration",outputs:[{handle:"pullRequest",jsonSchema:{type:"object",properties:{id:{type:"integer"},number:{type:"integer"},title:{type:"string"},url:{type:"string"},state:{type:"string",enum:["open","closed"]},draft:{type:"boolean"},merged:{type:"boolean"},updatedAt:{type:"string"},headSha:{type:"string"},baseSha:{type:"string"}},additionalProperties:!1,required:["id","number","title","url","state","draft","merged","updatedAt","headSha","baseSha"]},nullable:!1},{handle:"version",jsonSchema:{type:"string"},nullable:!1}]},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["push","tag_push","issues","confidential_issues","note","confidential_note","merge_requests","job","pipeline","wiki_page","deployment","feature_flag","releases","milestone","emoji","resource_access_token","resource_deploy_token"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"project",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^(?:[0-9]+|(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*(?:/(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*)*)$"},nullable:!1},{handle:"pushBranchFilter",jsonSchema:{type:"string",maxLength:255},nullable:!1,value:""}],definitionVersion:2,description:"Triggers when selected GitLab webhook events occur in a project.",displayName:"Project Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"gitlab.on_project_event",name:"on_project_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"gitlabEvent",jsonSchema:{type:"string"},nullable:!1}],provider:"gitlab",type:"integration"},callback:{headers:["idempotency-key","x-gitlab-event","x-gitlab-token"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"labelNamesOrIds",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,description:"Only trigger on messages carrying all of these labels, referenced by name or ID.",value:[]},{handle:"readStatus",jsonSchema:{type:"string",enum:["Read","Unread","All"]},nullable:!1,value:"All"},{handle:"search",jsonSchema:{type:"string"},nullable:!1,description:"Gmail search-syntax query the message must match.",value:""},{handle:"sender",jsonSchema:{type:"string"},nullable:!1,description:"Only trigger on messages whose sender matches this address or name.",value:""},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on draft messages."},{handle:"includeSpamAndTrash",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages in SPAM and TRASH."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls the Gmail mailbox and triggers when a new message is received.",displayName:"New Message Received",key:"gmail.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{historyId:{type:["string","null"]},labelIds:{type:"array",items:{type:"string"}},messageId:{type:"string"},messageTimestamp:{type:"string"},sender:{type:"string"},subject:{type:"string"},threadId:{type:"string"},to:{type:"string"}},additionalProperties:!1,required:["messageId","threadId","historyId","labelIds","subject","sender","to","messageTimestamp"]}},nullable:!1}],provider:"gmail",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"calendarId",jsonSchema:{type:"string",minLength:1,maxLength:1024},nullable:!1},{handle:"changes",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","cancelled"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated","cancelled"]},{handle:"matchTerm",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxEventsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100}],definitionVersion:2,description:"Polls a Google Calendar and triggers when an event is created, updated or cancelled.",displayName:"Event Changed",key:"googlecalendar.on_event_changed",name:"on_event_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{attendeeEmails:{type:"array",items:{type:"string"}},calendarId:{type:"string"},changeType:{type:"string",enum:["created","updated","cancelled"]},created:{type:["string","null"]},creatorEmail:{type:["string","null"]},description:{type:["string","null"]},end:{type:["object","null"]},eventId:{type:"string"},eventType:{type:["string","null"]},htmlLink:{type:["string","null"]},isAllDay:{type:"boolean"},location:{type:["string","null"]},organizerEmail:{type:["string","null"]},recurringEventId:{type:["string","null"]},start:{type:["object","null"]},status:{type:"string"},summary:{type:["string","null"]},updated:{type:["string","null"]}},additionalProperties:!1,required:["changeType","calendarId","eventId","status","summary","description","location","htmlLink","start","end","isAllDay","organizerEmail","creatorEmail","attendeeEmails","recurringEventId","eventType","created","updated"]}},nullable:!1}],provider:"googlecalendar",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Uses a Google Drive changes.watch channel and triggers when Drive changes are available.",displayName:"Changes Detected",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.changes_detected",name:"changes_detected",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeId:{type:"string"},changeType:{type:["string","null"]},driveId:{type:["string","null"]},file:{type:["object","null"]},fileId:{type:["string","null"]},notification:{type:"object",properties:{changedTypes:{type:"array",items:{type:"string"}},messageNumber:{type:["string","null"]},resourceState:{type:"string"},resourceUri:{type:["string","null"]}},additionalProperties:!1,required:["resourceState","changedTypes","messageNumber","resourceUri"]},removed:{type:"boolean"},time:{type:["string","null"]}},additionalProperties:!1,required:["changeId","changeType","removed","time","fileId","driveId","file","notification"]}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"changeType",jsonSchema:{type:"string",enum:["created","updated"]},nullable:!1},{handle:"driveId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{0,512}$"},nullable:!1,value:""},{handle:"folderId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{2,512}$"},nullable:!1},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"mimeTypes",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"namePrefix",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxFilesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls one Google Drive folder and triggers when a file or folder directly inside it is created or updated.",displayName:"File or Folder Change in a Folder",key:"googledrive.on_file_change",name:"on_file_change",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdTime:{type:["string","null"]},driveId:{type:["string","null"]},eventType:{type:"string",enum:["file_created","file_updated","folder_created","folder_updated"]},fileId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifyingUser:{type:["object","null"]},mimeType:{type:"string"},modifiedTime:{type:["string","null"]},name:{type:"string"},parents:{type:"array",items:{type:"string"}},size:{type:"string"},webViewLink:{type:["string","null"]}},additionalProperties:!1,required:["eventType","itemType","fileId","name","mimeType","createdTime","modifiedTime","parents","webViewLink","driveId","lastModifyingUser"]}},nullable:!1}],provider:"googledrive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Monitors Drive changes using notifications and periodic scans of the same change stream.",displayName:"Watch Changes",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.watch_changes",name:"watch_changes",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object"}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"columnRange",jsonSchema:{type:"string",pattern:"^[A-Za-z]{1,3}(?::[A-Za-z]{1,3})?$"},nullable:!1,value:"A:ZZZ"},{handle:"sheet",jsonSchema:{type:"string",minLength:1},nullable:!1},{handle:"spreadsheetId",jsonSchema:{type:"string",minLength:1},nullable:!1},{group:"Advanced settings",collapsed:!0},{handle:"dateTimeRender",jsonSchema:{type:"string",enum:["FORMATTED_STRING","SERIAL_NUMBER"]},nullable:!1,value:"FORMATTED_STRING"},{handle:"firstDataRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:2},{handle:"headerRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:1},{handle:"maxRowsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100},{handle:"valueRender",jsonSchema:{type:"string",enum:["UNFORMATTED_VALUE","FORMATTED_VALUE","FORMULA"]},nullable:!1,value:"UNFORMATTED_VALUE"}],definitionVersion:2,description:"Polls a sheet and triggers once for every new row appended below the last row already seen.",displayName:"New Row Added",key:"googlesheets.on_row_added",name:"on_row_added",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{row:{type:"object"},rowNumber:{type:"integer"},sheetId:{type:"integer"},sheetTitle:{type:"string"},spreadsheetId:{type:"string"},values:{type:"array",items:{}}},additionalProperties:!1,required:["spreadsheetId","sheetId","sheetTitle","rowNumber","row","values"]}},nullable:!1}],provider:"googlesheets",type:"poll"},options:!1},{snapshot:{key:"intercom.on_conversation_event",provider:"intercom",name:"on_conversation_event",displayName:"Customer Conversation or Ticket",description:"Receives customer conversations, customer replies and new tickets from a verified Intercom application event source. Administrator replies are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["conversation.user.created","conversation.user.replied","ticket.created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"workspaceId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object",properties:{},additionalProperties:!0},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"intercom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"intercom",provider:"intercom",triggerId:"intercom.on_conversation_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"intercom"},{snapshot:{key:"jira.on_issue_event",provider:"jira",name:"on_issue_event",displayName:"Issue or Comment Event",description:"Receives Jira Cloud issue creation, issue updates and new comments through a shared project webhook with automatic renewal.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["jira:issue_created","jira:issue_updated","comment_created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"cloudId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"jira"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},project:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]}}},required:["kind","version","name","connectionId","teamId","project","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"jira",provider:"jira",triggerId:"jira.on_issue_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!0},options:!1,eventSource:"jira"},{snapshot:{configInputs:[{handle:"teamId",jsonSchema:{type:"string",pattern:"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",title:"Team ID"},nullable:!1,description:"Linear Team UUID. Use Copy model UUID in Linear to find it."},{handle:"stateIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"},maxItems:50,uniqueItems:!0,title:"Issue statuses"},nullable:!1,value:[],description:"Choose statuses from the selected Team. Empty means all statuses. Matches the current status, not every transition into it."}],definitionVersion:2,description:"Watches new and updated issues in a Linear team with periodic checks. Starts from now without running existing issues. Reports observed current states, not deletions or every intermediate status change.",displayName:"Issue Created or Updated",key:"linear.on_issue_changed",name:"on_issue_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{id:{type:"string"},identifier:{type:"string"},title:{type:"string"},url:{type:"string"},teamId:{type:"string"},createdAt:{type:"string"},updatedAt:{type:"string"},state:{type:"object",properties:{id:{type:"string"},name:{type:"string"},type:{type:"string"}},additionalProperties:!1,required:["id","name","type"]}},additionalProperties:!1,required:["id","identifier","title","url","teamId","createdAt","updatedAt","state"]}},nullable:!1}],provider:"linear",type:"poll"},options:!0},{snapshot:{configInputs:[{handle:"dataSourceId",jsonSchema:{type:"string",pattern:"^(?:|[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12})$"},nullable:!1,value:""},{handle:"databaseId",jsonSchema:{type:"string",pattern:"^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["page_added","page_updated"]},minItems:1,uniqueItems:!0},nullable:!1,value:["page_added"]},{group:"Advanced settings",collapsed:!0},{handle:"includeProperties",jsonSchema:{type:"boolean"},nullable:!1,value:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Notion database and triggers when a page is added to it or an existing page is edited.",displayName:"Database Page Added or Updated",key:"notion.on_database_page_event",name:"on_database_page_event",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdBy:{type:"object"},createdTime:{type:"string"},dataSourceId:{type:"string"},databaseId:{type:"string"},event:{type:"string",enum:["page_added","page_updated"]},lastEditedBy:{type:"object"},lastEditedTime:{type:"string"},pageId:{type:"string"},properties:{type:"object"},title:{type:"string"},url:{type:"string"}},additionalProperties:!1,required:["event","pageId","databaseId","dataSourceId","url","title","createdTime","lastEditedTime","createdBy","lastEditedBy"]}},nullable:!1}],provider:"notion",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","deleted"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated"]},{handle:"itemId",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"parentFolderId",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls the OneDrive change feed and triggers when a file or folder is created, updated or deleted.",displayName:"File or Folder Changed",key:"one_drive.on_item_changed",name:"on_item_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeType:{type:"string",enum:["created","updated","deleted"]},createdDateTime:{type:["string","null"]},driveId:{type:["string","null"]},eTag:{type:["string","null"]},itemId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifiedDateTime:{type:["string","null"]},mimeType:{type:["string","null"]},name:{type:"string"},parentFolderId:{type:["string","null"]},size:{type:["number","null"]},webUrl:{type:"string"}},additionalProperties:!1,required:["itemId","name","changeType","itemType","size","mimeType","webUrl","parentFolderId","driveId","createdDateTime","lastModifiedDateTime","eTag"]}},nullable:!1}],provider:"one_drive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"folder",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_=-]*$"},nullable:!1,value:"inbox",description:"A well-known mail folder name, folder ID, or an empty string for the whole mailbox."},{handle:"readStatus",jsonSchema:{type:"string",enum:["All","Read","Unread"]},nullable:!1,value:"All"},{handle:"senderAddress",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Exact sender address, or empty for any sender."},{handle:"subjectContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Case-insensitive subject text."},{handle:"withAttachmentsOnly",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Microsoft Outlook mail folder and triggers when a new message arrives.",displayName:"New Message Received",key:"outlook.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{bodyPreview:{type:"string"},categories:{type:"array",items:{type:"string"}},conversationId:{type:"string"},from:{type:"string"},fromName:{type:"string"},hasAttachments:{type:"boolean"},importance:{type:"string"},internetMessageId:{type:"string"},isDraft:{type:"boolean"},isRead:{type:"boolean"},messageId:{type:"string"},parentFolderId:{type:"string"},receivedDateTime:{type:"string"},subject:{type:"string"},to:{type:"array",items:{type:"string"}},webLink:{type:"string"}},additionalProperties:!1,required:["messageId","internetMessageId","conversationId","subject","bodyPreview","from","fromName","to","receivedDateTime","hasAttachments","isRead","isDraft","importance","categories","parentFolderId","webLink"]}},nullable:!1}],provider:"outlook",type:"poll"},options:!1},{snapshot:{key:"pandadoc.on_document_event",provider:"pandadoc",name:"on_document_event",displayName:"Document Status Changed",description:"Receives document status changes in the connected workspace, optionally only when the entire document is completed.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!0,allowEmpty:!1},successStatus:200},configInputs:[{handle:"completedOnly",jsonSchema:{type:"boolean",title:"Completed documents only"},nullable:!1,value:!0}],outputs:[{handle:"events",nullable:!1,jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},data:{type:"object"}},required:["event","data"]}}}]},callback:{headers:[],query:["signature"]},options:!1},{snapshot:{key:"pipedrive.on_crm_event",provider:"pipedrive",name:"on_crm_event",displayName:"Deal or Contact Event",description:"Receives new deals or contacts, or actual changes to a deal stage or status using Pipedrive Webhooks v2.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventType",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"],title:"Event"},nullable:!1,value:"deal.created"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["authorization"],query:[]},options:!1},{snapshot:{key:"resend.on_email_event",provider:"resend",name:"on_email_event",displayName:"Email Received, Bounced or Complained",description:"Receives inbound email, bounce, and complaint notifications. Read message bodies and attachments with Actions.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["email.received","email.bounced","email.complained"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["email.received","email.bounced","email.complained"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["email.received","email.bounced","email.complained"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"emailId",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["svix-id","svix-signature","svix-timestamp"],query:[]},options:!1},{snapshot:{key:"sentry.on_issue_alert",provider:"sentry",name:"on_issue_alert",displayName:"Issue Alert",description:"Receives Issue Alert Rule notifications from a verified Sentry Custom Integration installation.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"projectIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]+$"},uniqueItems:!0,title:"Project IDs"},nullable:!0},{handle:"ruleNames",jsonSchema:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0,title:"Alert rule names"},nullable:!0},{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["issue.alert"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["issue.alert"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"organizationId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"sentry"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},installationId:{type:"string",minLength:1,maxLength:256},organizationId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"issue.alert"}}},required:["kind","version","name","connectionId","teamId","appId","installationId","organizationId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"sentry",provider:"sentry",triggerId:"sentry.on_issue_alert",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"sentry"},{snapshot:{configInputs:[{handle:"topics",jsonSchema:{type:"array",items:{type:"string",enum:["app/scopes_update","app/uninstalled","app_purchases_one_time/update","app_subscriptions/approaching_capped_amount","app_subscriptions/update","bulk_operations/finish","carts/create","carts/update","channels/delete","checkout_and_accounts_configurations/update","checkouts/create","checkouts/delete","checkouts/update","collection_listings/add","collection_listings/remove","collection_listings/update","collection_publications/create","collection_publications/delete","collection_publications/update","collections/create","collections/delete","collections/update","companies/create","companies/delete","companies/update","company_contact_roles/assign","company_contact_roles/revoke","company_contacts/create","company_contacts/delete","company_contacts/update","company_locations/create","company_locations/delete","company_locations/update","customer.joined_segment","customer.left_segment","customer.tags_added","customer.tags_removed","customer_account_settings/update","customer_groups/create","customer_groups/delete","customer_groups/update","customers/create","customers/delete","customers/disable","customers/enable","customers/purchasing_summary","customers/update","customers_email_marketing_consent/update","customers_marketing_consent/update","delivery_promise_settings/update","disputes/create","disputes/update","domains/create","domains/destroy","domains/update","draft_orders/create","draft_orders/delete","draft_orders/update","fulfillment_events/create","fulfillment_events/delete","fulfillment_holds/added","fulfillment_holds/released","fulfillment_orders/cancellation_request_accepted","fulfillment_orders/cancellation_request_rejected","fulfillment_orders/cancellation_request_submitted","fulfillment_orders/cancelled","fulfillment_orders/fulfillment_request_accepted","fulfillment_orders/fulfillment_request_rejected","fulfillment_orders/fulfillment_request_submitted","fulfillment_orders/fulfillment_service_failed_to_complete","fulfillment_orders/hold_released","fulfillment_orders/line_items_prepared_for_local_delivery","fulfillment_orders/line_items_prepared_for_pickup","fulfillment_orders/manually_reported_progress_stopped","fulfillment_orders/merged","fulfillment_orders/moved","fulfillment_orders/order_routing_complete","fulfillment_orders/placed_on_hold","fulfillment_orders/progress_reported","fulfillment_orders/rescheduled","fulfillment_orders/scheduled_fulfillment_order_ready","fulfillment_orders/split","fulfillments/create","fulfillments/update","inventory_items/create","inventory_items/delete","inventory_items/update","inventory_levels/connect","inventory_levels/disconnect","inventory_levels/update","locales/create","locales/destroy","locales/update","locations/activate","locations/create","locations/deactivate","locations/delete","locations/update","machine_translation_batch/completed","metafield_definitions/create","metafield_definitions/delete","metafield_definitions/update","order_transactions/create","orders/cancelled","orders/create","orders/delete","orders/edited","orders/fulfilled","orders/link_requested","orders/paid","orders/partially_fulfilled","orders/risk_assessment_changed","orders/shopify_protect_eligibility_changed","orders/updated","payment_schedules/due","payment_terms/create","payment_terms/delete","payment_terms/update","product_feeds/create","product_feeds/full_sync","product_feeds/full_sync_finish","product_feeds/incremental_sync","product_feeds/update","product_listings/add","product_listings/remove","product_listings/update","product_publications/create","product_publications/delete","product_publications/update","products/create","products/delete","products/update","profiles/create","profiles/delete","profiles/update","publications/delete","refunds/create","returns/approve","returns/cancel","returns/close","returns/decline","returns/process","returns/reopen","returns/request","returns/update","reverse_deliveries/attach_deliverable","reverse_fulfillment_orders/dispose","scheduled_product_listings/add","scheduled_product_listings/remove","scheduled_product_listings/update","segments/create","segments/delete","segments/update","selling_plan_groups/create","selling_plan_groups/delete","selling_plan_groups/update","shop/update","subscription_billing_attempts/challenged","subscription_billing_attempts/failure","subscription_billing_attempts/success","subscription_billing_cycle_edits/create","subscription_billing_cycle_edits/delete","subscription_billing_cycle_edits/update","subscription_billing_cycles/skip","subscription_billing_cycles/unskip","subscription_contracts/activate","subscription_contracts/cancel","subscription_contracts/create","subscription_contracts/expire","subscription_contracts/fail","subscription_contracts/pause","subscription_contracts/update","tax_partners/update","tax_summaries/create","tender_transactions/create","themes/create","themes/delete","themes/publish","themes/update","variants/in_stock","variants/out_of_stock"]},minItems:1,maxItems:20,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when selected Shopify webhook topics occur in the connected store.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"shopify.on_shop_event",name:"on_shop_event",outputs:[{handle:"apiVersion",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"shopDomain",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"triggeredAt",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"shopify",type:"integration"},callback:{headers:["x-shopify-api-version","x-shopify-event-id","x-shopify-shop-domain","x-shopify-topic","x-shopify-triggered-at","x-shopify-webhook-id"],query:["open_flow_callback"]},options:!1},{snapshot:{configInputs:[{handle:"channelId",jsonSchema:{type:"string",pattern:"^[CDG][A-Z0-9]{2,31}$"},nullable:!1,description:"Slack conversation ID to watch, e.g. C0122KQ70S7E."},{handle:"fromUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Only trigger on messages written by these Slack user IDs. Empty means any author."},{handle:"ignoreUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Never trigger on messages written by these Slack user IDs."},{handle:"textContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Only trigger when message text contains this string, case-insensitively."},{group:"Advanced settings",collapsed:!0},{handle:"includeBotMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages posted by bots and apps."},{handle:"includeSystemMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on Slack system notices."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:15,description:"Maximum number of messages processed per poll."}],definitionVersion:2,description:"Polls one Slack conversation and triggers when a new message is posted to it.",displayName:"New Channel Message",key:"slack.on_message_posted",name:"on_message_posted",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{botId:{type:["string","null"]},channelId:{type:"string"},files:{type:"array",items:{type:"object",properties:{id:{type:"string"},mimetype:{type:"string"},name:{type:"string"}},additionalProperties:!1,required:["id","name","mimetype"]}},messageTs:{type:"string"},subtype:{type:["string","null"]},text:{type:"string"},threadTs:{type:["string","null"]},userId:{type:["string","null"]}},additionalProperties:!1,required:["channelId","messageTs","threadTs","userId","botId","subtype","text","files"]}},nullable:!1}],provider:"slack",type:"poll"},options:!1},{snapshot:{key:"slackbot.on_event",provider:"slackbot",name:"on_event",displayName:"Mention or Direct Message",description:"Receives user mentions and new direct messages through a shared Slack application event source. Slack Connect events are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["app_mention","message.im"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["app_mention","message.im"]},{handle:"channelIds",jsonSchema:{type:"array",items:{type:"string",minLength:1},maxItems:100,uniqueItems:!0,title:"Channel IDs"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"teamId",jsonSchema:{type:"string"},nullable:!1},{handle:"channel",jsonSchema:{type:"string"},nullable:!1},{handle:"user",jsonSchema:{type:"string"},nullable:!1},{handle:"text",jsonSchema:{type:"string"},nullable:!1},{handle:"ts",jsonSchema:{type:"string"},nullable:!1},{handle:"threadTs",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"slack"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",pattern:"^A[A-Z0-9]+$"},workspaceId:{type:"string",pattern:"^T[A-Z0-9]+$"},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["app_mention","message.im"]}}},required:["kind","version","name","connectionId","teamId","appId","workspaceId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"slack",provider:"slackbot",triggerId:"slackbot.on_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"slack"},{snapshot:{configInputs:[{handle:"apiVersion",jsonSchema:{type:"string",maxLength:40},nullable:!1,value:""},{handle:"events",jsonSchema:{type:"array",items:{type:"string",maxLength:120,pattern:"^(\\*|[a-z0-9_]+(?:\\.[a-z0-9_]+)+)$"},minItems:1,uniqueItems:!0},nullable:!1},{handle:"includeConnectedAccounts",jsonSchema:{type:"boolean"},nullable:!1,value:!1}],definitionVersion:2,description:"Triggers when selected Stripe events happen on the connected account.",displayName:"Account Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"stripe.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"livemode",jsonSchema:{type:"boolean"},nullable:!1}],provider:"stripe",type:"integration"},callback:{headers:["stripe-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form"},nullable:!1,description:"Choose a form accessible to this Connection."}],definitionVersion:2,description:"Receives new Tally form submissions through a signed, automatically managed webhook.",displayName:"Form Response",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"tally.on_form_response",name:"on_form_response",outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},createdAt:{type:"string"},formId:{type:"string"},submissionId:{type:"string"},responseId:{type:"string"},fields:{type:"array",items:{type:"object",properties:{key:{type:"string"},type:{type:"string"},label:{type:["string","null"]},value:{},options:{type:"array",items:{type:"object"}}},required:["key","type","label","value"]}}},required:["eventId","createdAt","formId","submissionId","responseId","fields"]}}],provider:"tally",type:"integration"},callback:{headers:["tally-signature"],query:[]},options:!0},{snapshot:{configInputs:[{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^-?[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram chat IDs. Empty means every chat."},{handle:"dropPendingUpdates",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Discard updates queued before the webhook is created or resumed."},{handle:"updates",jsonSchema:{type:"array",items:{enum:["*","message","edited_message","channel_post","edited_channel_post","business_connection","business_message","edited_business_message","deleted_business_messages","guest_message","message_reaction","message_reaction_count","inline_query","chosen_inline_result","callback_query","shipping_query","pre_checkout_query","purchased_paid_media","poll","poll_answer","my_chat_member","chat_member","chat_join_request","chat_boost","removed_chat_boost","managed_bot","subscription"]},minItems:1,uniqueItems:!0},nullable:!1,description:"Telegram update types that trigger a Run. Use * for the Telegram default set."},{handle:"userIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram user IDs. Empty means every user."}],definitionVersion:2,description:"Triggers when the connected Telegram bot receives a selected update.",displayName:"Bot Update",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"telegram.on_update",name:"on_update",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"telegram",type:"integration"},callback:{headers:["x-telegram-bot-api-secret-token"],query:[]},options:!1},{snapshot:{key:"typeform.on_form_response",provider:"typeform",name:"on_form_response",displayName:"Completed Form Response",description:"Receives complete Typeform submissions through an automatically managed signed webhook.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form ID"},nullable:!1}],outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},form_id:{type:"string"},token:{type:"string"},submitted_at:{type:"string"},answers:{type:"array",items:{type:"object"}},definition:{type:"object"}},required:["eventId","form_id","token","submitted_at","answers"]}}]},callback:{headers:["typeform-signature"],query:[]},options:!1},{snapshot:{key:"vercel.on_deployment_event",provider:"vercel",name:"on_deployment_event",displayName:"Deployment Ready or Failed",description:"Receives successful and failed deployments for a Vercel project.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"teamId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Team ID"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Project ID"},nullable:!1},{handle:"environment",jsonSchema:{type:"string",enum:["all","production","preview"],title:"Environment"},nullable:!1,value:"all"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deployment.ready","deployment.error"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"deploymentId",jsonSchema:{type:"string"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-vercel-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["coupon.created","coupon.updated","coupon.deleted","coupon.restored","customer.created","customer.updated","customer.deleted","order.created","order.updated","order.deleted","order.restored","product.created","product.updated","product.deleted","product.restored","product.published"]},minItems:1,maxItems:16,uniqueItems:!0},nullable:!1},{handle:"webhookName",jsonSchema:{type:"string",minLength:1,maxLength:120},nullable:!1,value:"OOMOL Trigger"}],definitionVersion:2,description:"Triggers when selected WooCommerce store events occur.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"woocommerce.on_store_event",name:"on_store_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"resource",jsonSchema:{type:"string"},nullable:!1},{handle:"source",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"woocommerce",type:"integration"},callback:{headers:["x-wc-webhook-delivery-id","x-wc-webhook-event","x-wc-webhook-id","x-wc-webhook-resource","x-wc-webhook-signature","x-wc-webhook-source","x-wc-webhook-topic"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["zen:event-type:ticket.agent_assignment_changed","zen:event-type:ticket.attachment_linked_to_comment","zen:event-type:ticket.attachment_redacted_from_comment","zen:event-type:ticket.brand_changed","zen:event-type:ticket.comment_added","zen:event-type:ticket.comment_made_private","zen:event-type:ticket.comment_redacted","zen:event-type:ticket.created","zen:event-type:ticket.csat_received","zen:event-type:ticket.csat_requested","zen:event-type:ticket.custom_field_changed","zen:event-type:ticket.custom_status_changed","zen:event-type:ticket.description_changed","zen:event-type:ticket.email_ccs_changed","zen:event-type:ticket.external_id_changed","zen:event-type:ticket.followers_changed","zen:event-type:ticket.form_changed","zen:event-type:ticket.group_assignment_changed","zen:event-type:ticket.marked_as_spam","zen:event-type:ticket.merged","zen:event-type:ticket.next_sla_breach_changed","zen:event-type:ticket.ola_policy_changed","zen:event-type:ticket.organization_changed","zen:event-type:ticket.permanently_deleted","zen:event-type:ticket.priority_changed","zen:event-type:ticket.problem_link_changed","zen:event-type:ticket.requester_changed","zen:event-type:ticket.schedule_changed","zen:event-type:ticket.sla_policy_changed","zen:event-type:ticket.soft_deleted","zen:event-type:ticket.status_changed","zen:event-type:ticket.subject_changed","zen:event-type:ticket.submitter_changed","zen:event-type:ticket.tags_changed","zen:event-type:ticket.task_due_at_changed","zen:event-type:ticket.type_changed","zen:event-type:ticket.undeleted","zen:event-type:organization.created","zen:event-type:organization.custom_field_changed","zen:event-type:organization.deleted","zen:event-type:organization.external_id_changed","zen:event-type:organization.name_changed","zen:event-type:organization.tags_changed","zen:event-type:user.active_changed","zen:event-type:user.alias_changed","zen:event-type:user.created","zen:event-type:user.custom_field_changed","zen:event-type:user.custom_role_changed","zen:event-type:user.default_group_changed","zen:event-type:user.deleted","zen:event-type:user.details_changed","zen:event-type:user.external_id_changed","zen:event-type:user.group_membership_created","zen:event-type:user.group_membership_deleted","zen:event-type:user.identity_changed","zen:event-type:user.identity_created","zen:event-type:user.identity_deleted","zen:event-type:user.last_login_changed","zen:event-type:user.merged","zen:event-type:user.name_changed","zen:event-type:user.notes_changed","zen:event-type:user.only_private_comments_changed","zen:event-type:user.organization_membership_created","zen:event-type:user.organization_membership_deleted","zen:event-type:user.password_changed","zen:event-type:user.photo_changed","zen:event-type:user.role_changed","zen:event-type:user.suspended_changed","zen:event-type:user.tags_changed","zen:event-type:user.time_zone_changed"]},minItems:1,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when one of the selected Zendesk account events occurs.",displayName:"Event Subscription",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"zendesk.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"subject",jsonSchema:{type:"string"},nullable:!1}],provider:"zendesk",type:"integration"},callback:{headers:["x-zendesk-webhook-signature","x-zendesk-webhook-signature-timestamp"],query:[]},options:!1},{snapshot:{key:"zoom.on_recording_ready",provider:"zoom",name:"on_recording_ready",displayName:"Cloud Recording Ready",description:"Receives completed cloud recordings hosted by the connected Zoom user through a verified application event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["recording.completed"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["recording.completed"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingUuid",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"zoom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"recording.completed"}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"zoom",provider:"zoom",triggerId:"zoom.on_recording_ready",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"zoom"}];function Rb(e){return Vg(e).extend({name:j().trim().min(1).max(128)})}var Ab=_b.flatMap((e)=>("source"in e)&&e.source!=null?[e.source]:[]),Pb=Q(Ab.map((e)=>Rb(e.createSchema))),Tb=Rb(Ab[0].updateSchema),$b=v({version:w(1),expectedRevision:we().positive()});var Nb={start:"A Start node with a required message parameter. Supply it through trigger.outputs.",error:"A Flow Error node. Select upstream Flows, then publish and enable this Flow to listen for failures in their automatic runs.",webhook:"A Webhook start node.","webhook-response":"An HTTP response node with body, statusCode and headers inputs. Select it from a reachable Webhook.",cron:"An hourly scheduled start node.",poll:"Gmail polling by key; replace CONNECTION_ID with an active Gmail connection.",integration:"Telegram webhook integration by key; replace CONNECTION_ID with an active Telegram connection.",decision:"AI Decision evaluates named questions against target and returns a complete answer object per output. Configure target before running.","http-request":"A single HTTP request. Bind url and request inputs; outputs are body, statusCode and headers.",openapi:"A fixed JSON API operation. Replace the example document and URL before running.",connector:"A Connector Task and its node. Replace ACTION_ID, CONNECTION_ID and port definitions using connector_get / connector show. Set connectionId to an empty string to defer account configuration; execution will require an account.",code:"A JavaScript module and its node. Use Code for custom computation; use Connector Tasks for existing actions.",condition:"A condition with true and false execution branches.",value:"A fixed value node.",approval:"An Approval with approve and reject decision branches and a built-in notification output.",wait:"A Wait with a continue action and a built-in notification output.",agent:"An Agent with code computation enabled. Configure a model available in the deployment.","llm-chat":"An LLM chat Task and its node; configure a model available in the deployment.","llm-json":"An LLM JSON Task and its node; configure a model available in the deployment.","poll-notification":"Gmail events \u2192 JavaScript text formatting \u2192 Connector notification. Replace connection/action IDs and match the notification input ports."},SC=Object.keys(Nb),IC=SC.map((e)=>({name:e,description:Nb[e]}));var i1=v({comment:yu}),Xr=$e(),Ie=j().min(1),xe=w(1),wu=Ie.refine((e)=>e==e.trim()&&Vi(e)==null,"Flow name is invalid."),zb=re(j(),re(j(),Xr)),Db=v({nodeId:Ie,outputs:re(j(),Xr)}),te={canvas:v({command:tt,version:xe}),authoringCheck:Bl,authoringEdit:Zr,authoringRead:Ni,authoringSearch:zi,authoringSchema:gy,loadOpenApiDocument:v({url:j().min(1).max(8192),version:xe}),createEventSource:Pb,updateEventSource:Tb,eventSourceRevision:$b,importFlow:v({file:Xr,name:wu.optional(),teamId:Ie.optional(),version:xe}),createFlow:v({name:wu,teamId:Ie.optional(),version:xe}),renameFlow:v({name:wu,version:xe}),changeDraft:v({expectedRevisionId:Ie,operations:A(Xr).min(1),version:xe}),repairDraft:v({expectedRevisionId:Ie,version:xe}),upgradeDraft:v({expectedRevisionId:Ie,version:xe}),setEnabled:v({enabled:me(),expectedPublicationId:Ie,version:xe}),updatePresentation:v({expectedRevision:we().positive(),value:re(j(),Xr),version:xe}),checkFlow:v({engineContract:Ie,version:xe}),publishFlow:v({engineContract:Ie,expectedLivePublicationId:Ie.nullable(),version:xe}),rollbackFlow:v({expectedLivePublicationId:Ie,version:xe}),createDraftRun:v({engineContract:Ie,inputs:zb,trigger:Db,version:w(2)}),createLiveRun:v({publicationId:Ie,inputs:zb,trigger:Db,version:w(2)}),resolveWait:v({action:W(["approve","continue","reject"]),comment:yu,version:xe}),putVariable:v({value:j().refine((e)=>new TextEncoder().encode(e).byteLength<=65536,"Variable value is too large.")}),queryConnectorAccessCandidates:v({providerIds:A(Ie.max(256)).min(1).refine((e)=>new Set(e).size==e.length,"Duplicate provider IDs."),version:xe}),removeConnectionUsage:v({connectionId:Ie,expectedRevisionId:Ie,expectedAccessRevision:we().nonnegative(),version:xe}),setConnectorService:v({expectedAccessRevision:we().nonnegative(),version:xe}),addProviderAccessBinding:v({accessBindingId:Ie,expectedAccessRevision:we().nonnegative(),version:xe}),removeProviderAccessBinding:v({accessBindingId:Ie,expectedAccessRevision:we().nonnegative(),version:xe}),versionOnly:v({version:xe})};function oe(e){return(n)=>e.parse(n)}var Xi={canvas:oe(te.canvas),authoringCheck:oe(te.authoringCheck),authoringEdit:oe(te.authoringEdit),authoringRead:oe(te.authoringRead),authoringSearch:oe(te.authoringSearch),authoringSchema:oe(te.authoringSchema),loadOpenApiDocument:oe(te.loadOpenApiDocument),createEventSource:oe(te.createEventSource),updateEventSource:oe(te.updateEventSource),eventSourceRevision:oe(te.eventSourceRevision),importFlow:oe(te.importFlow),createFlow:oe(te.createFlow),renameFlow:oe(te.renameFlow),changeDraft(e){let n=te.changeDraft.parse(e);return{...n,operations:bu(n.operations)}},repairDraft:oe(te.repairDraft),upgradeDraft:oe(te.upgradeDraft),setEnabled:oe(te.setEnabled),updatePresentation:oe(te.updatePresentation),checkFlow:oe(te.checkFlow),publishFlow:oe(te.publishFlow),rollbackFlow:oe(te.rollbackFlow),createDraftRun:oe(te.createDraftRun),createLiveRun:oe(te.createLiveRun),resolveWait:oe(te.resolveWait),putVariable:oe(te.putVariable),queryConnectorAccessCandidates:oe(te.queryConnectorAccessCandidates),removeConnectionUsage:oe(te.removeConnectionUsage),setConnectorService:oe(te.setConnectorService),addProviderAccessBinding:oe(te.addProviderAccessBinding),removeProviderAccessBinding:oe(te.removeProviderAccessBinding),versionOnly:oe(te.versionOnly)};var vu=["expected-revision","idempotency-key"],xu=["cursor","limit"],qb=[["canvas","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["read","<flow> [--input JSON|@file|- | --file path|-]",["input","file"]],["search","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["edit","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["list","[--cursor <cursor>] [--limit <count>]",xu],["export","<flow>",[]],["import","--file <path|->",["file","name","idempotency-key"]],["create","<name>",["idempotency-key"]],["show","<flow>",[]],["live","<flow>",[]],["rename","<flow> <new-name>",[]],["delete","<flow> --yes",["yes"]],["check","<flow> [--revision <revisionId>]",["revision"]],["enable","<flow> --expected-publication <publicationId>",["expected-publication"]],["disable","<flow> --expected-publication <publicationId>",["expected-publication"]],["connector code-access","<flow> [--publication <publicationId>]",["publication"]],["connector candidates","<flow> <provider> [provider ...]",[]],["connector code-allow","<flow> <provider> <binding> <access-revision>",[]],["connector code-remove","<flow> <provider> <binding> <access-revision>",[]],["connector remove-usage","<flow> <connection> <access-revision>",vu],["connector providers","[--flow <flow>]",["flow"]],["connector teams","",[]],["connector search","<query> [--flow <flow>]",["flow"]],["connector show","<action> [--flow <flow>]",["flow"]],["connector connections","<service> [--flow <flow>]",["flow"]],["event-source list","",[]],["trigger search","[query]",[]],["trigger show","<key>",[]],["run","<flow>",[...vu,"expected-publication","source","trigger","outputs","input","wait","timeout"]],["runs list","--flow <flow>",["flow","status","pending-wait",...xu]],["runs show","<run>",[]],["runs wait","<run>",["timeout"]],["runs resolve","<run> <wait> <continue|approve|reject>",["comment"]],["runs events","<run>",["after","limit","follow","timeout"]],["runs result","<run>",[]],["runs results","<run> [--after <resultId>]",["after"]],["runs read-result","<run> <result>",["pointer","offset","limit","max-bytes"]],["runs download-result","<run> <result>",[]],["runs cancel","<run>",[]],["publish","<flow>",[...vu,"expected-publication","timeout"]],["publications list","<flow>",xu],["publications show","<flow> <publication>",[]],["publications wait","<flow> <operation>",["timeout"]],["publications operation","<flow> <operation>",[]],["rollback","<flow> <publication>",["expected-publication","idempotency-key"]],["open","[flow]",[]],["workbench","[flow]",[]],["schema","[read|search|edit|check|node-type]",["flow","input"]]],EC={revision:{description:"Exact Revision to read or check; defaults to the current Draft.",type:"string"},publication:{description:"Exact Publication ID whose fixed Code connections are read; defaults to the Draft.",type:"string"},pointer:{description:"JSON Pointer within the stored result; defaults to the root.",type:"string"},offset:{description:"Page offset at the selected pointer.",type:"integer",minimum:0,default:0},"max-bytes":{description:"Maximum result page bytes.",type:"integer",minimum:1,maximum:1048576,default:15000},"expected-revision":{description:"Base Revision ID from read. Required with an explicit idempotency key for draft edits and draft runs.",type:"string"},"expected-publication":{description:"Fixed Publication ID. Use none when publishing without a Live Publication.",type:"string"},"idempotency-key":{description:"Stable identity of one mutation. Reuse only with the identical arguments and base identity.",type:"string"},source:{description:"Execution source.",type:"string",enum:["draft","live"],default:"draft"},trigger:{description:"Exact Trigger ID or unambiguous name. The Start node is selected automatically; a sole legacy Manual Trigger remains supported.",type:"string"},timeout:{description:"Wait budget in milliseconds; expiration does not cancel the operation. For node set, the node execution timeout.",type:"integer",minimum:1,default:60000},limit:{description:"Maximum items in one page.",type:"integer",minimum:1,maximum:100,default:100},after:{description:"Resume events after this sequence number; use nextAfter from the preceding response.",type:"integer",minimum:0,default:0},cursor:{description:"Opaque nextCursor from the preceding page; keep the same filters.",type:"string"},comment:{description:"Optional plain-text Wait decision comment (up to 2,000 Unicode code points).",type:"string"},"pending-wait":{description:"List runs with unresolved waits, including running and queued runs.",type:"boolean"},status:{description:"Filter runs by status.",type:"string",enum:["queued","starting","running","waiting","completed","failed","canceled","indeterminate"]},file:{description:"Authoring request or workflow JSON file path, or - for stdin.",type:"string"},code:{description:"JavaScript source, @file, or - for stdin.",type:"string"},input:{description:"Authoring request JSON; literal JSON, @file, or -. For run, node ID to input values.",type:"string"},outputs:{description:"Start parameters or other Trigger outputs: literal JSON, @file, or -. Defaults to {}.",type:"string"},set:{description:"handle=value; repeat for multiple fields. Values use port schemas, JSON, @file, or -.",type:"string"},unset:{description:"Input/config handle to remove; repeat for multiple fields.",type:"string"},connection:{description:"Exact active Connection ID, unambiguous display name, or default.",type:"string"},flow:{description:"Exact Flow ID or unambiguous name; fixes Connector Team scope.",type:"string"},name:{description:"Display name.",type:"string"},description:{description:"Trigger description.",type:"string"},cron:{description:"Cron expression; combine with --timezone. Mutually exclusive with --every.",type:"string"},timezone:{description:"IANA time zone for --cron.",type:"string"},every:{description:"Interval such as 5m, 1h, or 1d. Mutually exclusive with --cron.",type:"string"},wait:{description:"Wait until terminal, waiting for an action, or the wait budget expires."},follow:{description:"Stream event pages as NDJSON with --json; stop on terminal, Wait, or timeout."},full:{description:"Include complete Revision content, schemas, source code and revision metadata."},yes:{description:"Confirm the requested deletion."},json:{description:"Machine-readable JSON results and errors; NDJSON for followed events."},help:{description:"Show this command contract without contacting the host."}};function ku(e,n="oo flow"){let t=e.join(" ");return qb.filter(([r])=>t==""||r==t||r.startsWith(`${t} `)).map(([r,o,i])=>({command:r,usage:`${n} ${r} ${o} [--json]`,options:[...i,"json","help"].map((s)=>Object.assign({name:`--${s}`,value:!["json","help","wait","follow","full","yes","pending-wait"].includes(s),repeatable:s=="set"||s=="unset"},EC[s],r=="runs results"&&s=="after"?{type:"string",minimum:void 0,default:void 0,description:"Result ID from nextAfter on the preceding page."}:{},r=="runs read-result"&&s=="limit"?{default:20}:{}))}))}function Lb(e){return qb.find(([n])=>n==e.slice(0,n.split(" ").length).join(" "))?.[2]}function Vb(e="edits"){let n=Kl(e);if(n!=null)return n;if(e=="edits")return Wl();if(e=="outputs")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",description:"Named Start parameters or other Trigger outputs. Start uses the workflow inputDefs returned by flow read; other triggers define their own output contracts. Omitted nullable Start parameters become null; required parameters must be supplied."};if(Ti.includes(e))return Wl(e);if(e=="input")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",additionalProperties:{type:"object",additionalProperties:!0},description:"Node ID -> input handle -> JSON value."};return}function Su(e){if(e=="canvas")return{request:ht(tt,{io:"input"}),guidance:"Broadcast transient viewport commands; success does not confirm execution. No Presentation save, offline queue or replay. Pan uses screen pixels; zoom is an absolute ratio (0.1\u20133); fit includes all nodes. Repeating pan moves again; do not automatically retry an uncertain response.",examples:[{type:"focus",nodeId:"NODE_ID"},{type:"zoom",zoom:0.8},{type:"pan",dx:200,dy:-100},{type:"fit"}]};return Kl(e)}function Mb(e,n="oo flow"){if(e=="export")return[`${n} export FLOW_ID > template.openflow.json`];if(e=="import")return[`${n} import --file template.openflow.json --name "Imported workflow" --idempotency-key IMPORT_KEY --json`];if(e=="schema")return[`${n} schema read --json`,`${n} schema agent --json`,`${n} schema --flow FLOW_ID --input '{"action":"ACTION_ID"}' --json`];let t=Su(e);if(t==null)return OC(n);if(e=="check")return[`${n} check FLOW_ID --revision REVISION --json`];return t.examples.map((r)=>`${n} ${e} FLOW_ID${Object.keys(r).length==0?"":` --input '${JSON.stringify(r)}'`} --json`)}function OC(e){return[`${e} list --limit 20 --json`,`${e} read FLOW_ID --json`,`${e} live FLOW_ID --json`,`${e} schema code --json`,`${e} edit FLOW_ID --file edits.json --json`,`${e} connector search email --flow FLOW_ID --json`,`${e} run FLOW_ID --expected-revision REVISION_ID --idempotency-key RUN_KEY --wait --timeout 60000 --json`,`${e} runs wait RUN_ID --timeout 60000 --json`,`${e} runs resolve RUN_ID WAIT_ID approve --json`,`${e} runs events RUN_ID --after 0 --follow --timeout 60000 --json`]}import{basename as _C}from"path";async function Fb(e,n,t,r,o){let[i,s,a,...c]=t;switch(i){case"code-access":case"candidates":case"code-allow":case"code-remove":case"remove-usage":{let l=i=="code-access"?1:i=="candidates"?2:i=="remove-usage"?3:4;if(i=="candidates"?t.length<l+1:t.length!=l+1)throw new O("cli.invalid-arguments",`Invalid arguments for connector ${i}. See --help.`);let u=jC(n),d;if(i=="code-access")d=r.publication==null?await e.getConnectorAccess(u):await e.getPublishedConnectorAccess(u,r.publication);else if(i=="candidates")d=await e.listProviderAccessBindingCandidates(u,t.slice(2));else{let g=Number(t.at(-1));if(!Number.isSafeInteger(g)||g<0)throw new O("cli.invalid-arguments","Access revision must be a nonnegative integer.");if(i=="remove-usage"){let h=await wb(e,n,r);d=await e.removeConnectionUsage(u,a,h.draft.revisionId,g,r.idempotencyKey)}else if(i=="code-allow")d=await e.addProviderAccessBinding(u,a,c[0],g);else d=await e.removeProviderAccessBinding(u,a,c[0],g)}F(o,r.json,{...d,kind:`connector.${i}`},JSON.stringify(d,null,2));return}case"providers":{if(s!=null)throw new O("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector providers [--flow <flow>] [--json]`);let l=await e.listConnectorProviders(void 0,n?.flowId);F(o,r.json,{providers:l,kind:"connector.providers",version:1},l.map((u)=>`${u.serviceName} ${u.serviceId}`).join(`
|
|
65
|
-
`));return}case"teams":{if(s!=null)throw new
|
|
66
|
-
`));return}case"search":{if(s==null||a!=null)throw new
|
|
67
|
-
`));return}case"show":{if(s==null||a!=null)throw new
|
|
68
|
-
`));return}default:throw new
|
|
69
|
-
`));return}case"show":{if(i==null||s!=null)throw new
|
|
70
|
-
`)}async function
|
|
71
|
-
`));return}case"show":{
|
|
72
|
-
`)),!
|
|
73
|
-
`))}async function
|
|
74
|
-
`));return}if((o=="operation"||o=="wait")&&s!=null){let l=Date.now()+(
|
|
75
|
-
`);return}case"connector":{let a=["code-access","candidates","code-allow","code-remove","remove-usage"].includes(i[0]??"")?await
|
|
76
|
-
`));return}case"run":return await
|
|
77
|
-
`));return}case"export":{pe(i,1,`${r.commandPrefix??"oo flow"} export <flow>`);let s=await ve(e,i[0]);r.stdout.write(zy(await e.exportFlow(s.flowId)));return}case"import":{if(pe(i,0,`${r.commandPrefix??"oo flow"} import --file <path|-> [--name name] [--json]`),t.file==null)throw new O("cli.invalid-arguments","Import requires --file <path|->.");let s=Ny(await In(t.file=="-"?"-":`@${t.file}`,"file","flow.import-unreadable",r)),a=t.name??s.name??(t.file=="-"?Du(r.language??"en"):Dy(_C(t.file))),c=await e.importFlow(s,{name:Yi(a,"Flow"),idempotencyKey:t.idempotencyKey});F(r,t.json,{flow:c,idempotencyKey:t.idempotencyKey,kind:"flow.import",version:1},Mn(c));return}case"create":{pe(i,1,`${r.commandPrefix??"oo flow"} create <name> [--json]`);let s=await e.createFlow(Yi(i[0],"Flow"),t.idempotencyKey);F(r,t.json,{flow:s,idempotencyKey:t.idempotencyKey,kind:"flow.create",version:1},Mn(s));return}case"live":{pe(i,1,`${r.commandPrefix??"oo flow"} live <flow> [--json]`);let s=await ve(e,i[0]),a=await e.getLiveDetails(s.flowId);F(r,t.json,{kind:"flow.live",live:a,version:1},es(a));return}case"show":{pe(i,1,`${r.commandPrefix??"oo flow"} show <flow> [--json]`);let s=await ve(e,i[0]);F(r,t.json,{flow:s,kind:"flow.show",version:1},Mn(s));return}case"rename":{pe(i,2,`${r.commandPrefix??"oo flow"} rename <flow> <new-name> [--json]`);let s=await ve(e,i[0]),a=await e.renameFlow(s.flowId,Yi(i[1],"Flow"));F(r,t.json,{flow:a,kind:"flow.rename",version:1},Mn(a));return}case"delete":{if(pe(i,1,`${r.commandPrefix??"oo flow"} delete <flow> --yes [--json]`),!t.yes)throw new O("flow.confirmation-required","Flow deletion requires --yes.");let s=await ve(e,i[0]),a=await e.deleteFlow(s.flowId);F(r,t.json,{flow:a,kind:"flow.delete",version:1},Mn(a));return}case"enable":case"disable":{if(pe(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> --expected-publication <publicationId>`),t.expectedPublication==null||t.expectedPublication=="none")throw new O("cli.invalid-arguments","--expected-publication must identify the observed Live publication.");let s=await ve(e,i[0]),a=await e.setFlowEnabled(s.flowId,t.expectedPublication,o=="enable");F(r,t.json,{flow:a,kind:`flow.${o}`,version:1},Mn(a));return}case"check":{pe(i,1,`${r.commandPrefix??"oo flow"} check <flow> [--revision <revisionId>] [--json]`);let s=await ve(e,i[0]),a=t.revision??s.draftRevisionId,c=await e.checkAuthoring(s.flowId,a);return F(r,t.json,{check:c,valid:c.valid,revisionId:a,kind:"flow.check",scope:"revision",version:1},`${c.valid?"valid":"invalid"} revision ${s.name} ${s.flowId}`),c.valid?0:1}default:throw new O("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} <list|create|show|live|read|search|edit|canvas|schema|rename|delete|check|enable|disable|connector|event-source|trigger|run|runs|publish|publications|rollback|workbench>`)}}async function RC(e,n){let t=n[0];if(t==null)throw new O("cli.invalid-arguments","A Flow reference is required.");return await ve(e,t)}var Vt={};var Qb=(e)=>e,ns=Object.is,AC=(e,n)=>{if(ns(e,n))return!0;if(!Array.isArray(e)||!Array.isArray(n))return!1;let t=e.length;if(n.length!==t)return!1;for(let r=0;r<t;r++)if(!ns(e[r],n[r]))return!1;return!0},PC=(e)=>e.value,TC=(e)=>e.map(PC),$C=(e)=>e.$version,ts=(e,n)=>{try{e(n)}catch(t){console.error(t)}},Yb=(e,n)=>(e.set=n,e);var NC=Promise.resolve(),Iu=new Set,zC=new Set,eo=Iu,Cu,DC=()=>{let e=eo;eo=eo===Iu?zC:Iu,Cu=!1;for(let n of e)n.t();e.clear()},qC=(e)=>{eo.add(e),Cu=Cu||NC.then(DC)},LC=(e)=>eo.delete(e);var Hb=new FinalizationRegistry(ts),Xb=class{constructor(e,n,t){if(this.#r=e,this.q=(n?.equal??ns)||void 0,this.e=n?.eager,this.m=n?.name,this.#n=n?.onDisposeValue,t){let r=new WeakRef(this),o=()=>{if(i){let s=i;i=void 0,s()}},i=t(()=>{let s=r.deref();if(s)s.n();else o()});if(i)Hb.register(this,this.#e=o)}}g=this;b=new Map;s=4;v;c=Vt;q;e;m;u=()=>{if(this.s&4){this.s&=-5;let e=this.#r();if(this.c===Vt)this.w(e);else if(!this.q?.(e,this.c)){if(this.w(e),this.s&1)this.s|=2}}return this.c};n=()=>{if(this.#o)console.error(this.c,Error(`${this.m||""} disposed`));if(this.s|=4,this.b.size){if(this.s|=1,this[3])this.#t(3);if(this[2]){if(this.u(),this.s&2)this.#t(2)}if(this[1])qC(this);else this.s&=-4}};a(e,n){let t=this.b.get(e);if(t)this[t]--;return this.b.set(e,n),this[n]++,()=>this.r(e)}r(e){if(e){let n=this.b.get(e);if(n)this.b.delete(e),this[n]--}else this.b.clear(),this[1]=this[2]=this[3]=0,LC(this)}t(){if(this[1]){if(this.u(),this.s&2)this.#t(1)}this.s&=-4}d(){let e=this.c;if(this.r(),Hb.unregister(this),this.#e?.(),this.#o=!0,this.#n&&e!==Vt)this.#n(e)}w(e){this.w=this.q?.(e,e)?this.y:this.x,this.w(e)}x(e){let n=this.c;if(this.c=e,this.v=Symbol(),this.#n&&n!==Vt&&n!==e)this.#n(n)}y(e){let n=this.c;if(this.c=this.v=e,this.#n&&n!==Vt&&n!==e)this.#n(n)}[1]=0;[2]=0;[3]=0;#e;#n;#r;#t(e){for(let[n,t]of this.b)if(t===e)ts(n,this.c)}#o},VC=class{#e=new WeakSet;constructor(e){this.g=e.g,this.e=e.e,this.u=e.u,this.n=e.n,this.b=e.b}get v(){return this.g.v}g;b;e;u;n;a(e,n){return this.#e.add(e),this.g.a(e,n)}r(e){if(e){if(this.#e.has(e))this.#e.delete(e),this.g.r(e)}else for(let n of this.g.b.keys())this.r(n)}d(){this.r()}},Eu=class{#e;constructor(e){this.#e=e,this.get=e.u,e.u()}get name(){return this.#e.m}get $version(){return this.get(),this.#e.v}get value(){return this.get()}set value(e){this.set?.(e)}set;get;ref(e){let n=new Eu(new VC(this.#e));return e&&this.set?Yb(n,this.set):n}reaction(e,n=this.#e.e){return this.#e.a(e,n?2:1)}subscribe(e,n=this.#e.e){let t=this.reaction(e,n);return ts(e,this.get()),t}$valCompute(e){return this.#e.a(e,3)}unsubscribe(e){this.#e.r(e)}dispose(){this.#e.d()}toString(){return String(this.get())}toJSON(e){let n=this.get();return n&&n.toJSON?n.toJSON(e):n}},MC=(e,n)=>{let t=e,o=new Xb(()=>t,n),i=(a)=>{if(!o.q?.(a,t))t=a,o.n()};return[new Eu(o),i]},Ou=(e,n)=>Yb(...MC(e,n));var ew=(e,n,t)=>new Eu(new Xb(e,t,n)),nw=(e,n=Qb,t)=>{let r,o;return ew(()=>{let i=e.map($C);if(!o||!AC(i,o))o=i,r=n(TC(e));return r},(i)=>{let s=e.map((a)=>a.$valCompute(i));return()=>s.forEach(ts)},t)};var ju=(e,n=Qb,t)=>{let r,o=Vt;return ew(()=>{let i=e.$version;if(!ns(i,o))o=i,r=n(e.value);return r},(i)=>e.$valCompute(i),t)};var tw=(e,n={},t="")=>{for(let[r,o]of Object.entries(e))if(typeof o==="string")n[t+r]=o;else tw(o,n,t+r+".");return n},FC=(e)=>{let n=[],t=[],r=/{{(\S+?)}}/gi,o,i=0;while(o=r.exec(e))n.push(e.slice(i,o.index),""),t.push(o[1]),i=o.index+o[0].length;if(n.push(e.slice(i)),t.length<=0)return!1;return(s)=>{for(let a=t.length-1;a>=0;a--)n[a*2+1]=s[t[a]]??t[a];return n.join("")}},rw=class e{constructor(n,t,r){this.t=(i,s)=>this.t$.get()(i,s),this.fetcher=r?.fetcher;let o=new Map;this.locales$=Ou(t),this.lang$=Ou(n),this.locale$=nw([this.lang$,this.locales$],([i,s])=>s[i]||{}),this.a=ju(this.locale$,tw),this.t$=ju(this.a,(i)=>((s,a,c)=>{if(c){let l=c["@"];if(l!=null){let u=`${a}@${l}`;if(s[u])a=u}else{let u=c[":option"];if(u!=null){let d;a=s[d=`${a}.${u}`]||s[d=`${a}.other`]?d:a}}if(s[a]){let u=o.get(a);if(u??o.set(a,u=FC(s[a])),u)return u(c)}}return s[a]||a}).bind(o.clear(),i))}static async preload(n,t){return new e(n,{[n]:await t(n)},{fetcher:t})}get lang(){return this.lang$.value}get locales(){return this.locales$.value}get locale(){return this.locale$.value}async switchLang(n){if(!this.locales$.value[n]&&this.fetcher)this.addLocale(n,await this.fetcher(n));this.lang$.set(n)}hasKey(n){return!!this.a.value[n]}addLocale(n,t){this.locales$.set({...this.locales,[n]:t})}dispose(){this.lang$.dispose(),this.t$.dispose(),this.locales$.dispose(),this.locale$.dispose(),this.a.dispose()}};var ow={help:{usage:"Usage: {{command}}",title:"Open Flow commands",options:"Options: --json, --cursor <cursor>, --limit <count>"}};var iw={help:{usage:"Utilisation : {{command}}",title:"Commandes Open Flow",options:"Options : --json, --cursor <cursor>, --limit <count>"}};var sw={help:{usage:"\u4F7F\u3044\u65B9\uFF1A{{command}}",title:"Open Flow \u30B3\u30DE\u30F3\u30C9",options:"\u30AA\u30D7\u30B7\u30E7\u30F3\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var aw={help:{usage:"\uC0AC\uC6A9\uBC95: {{command}}",title:"Open Flow \uBA85\uB839\uC5B4",options:"\uC635\uC158: --json, --cursor <cursor>, --limit <count>"}};var cw={help:{usage:"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435: {{command}}",title:"\u041A\u043E\u043C\u0430\u043D\u0434\u044B Open Flow",options:"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B: --json, --cursor <cursor>, --limit <count>"}};var lw={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9009\u9879\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var uw={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9078\u9805\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var HC={en:ow,"zh-CN":lw,"zh-TW":uw,ja:sw,ko:aw,ru:cw,fr:iw},QC=Object.fromEntries(ls.map((e)=>[e,HC[e]]));function dw(e=Nu){return new rw(io([e]),QC)}function YC(e,n){let t=n.filter((i)=>!i.startsWith("-")),r=ku(t,e.commandPrefix);while(r.length==0&&t.length>0)t.pop(),r=ku(t,e.commandPrefix);let o=dw(e.language);try{let i=r.length==1?Su(r[0].command):void 0,s=Mb(r.length==1?r[0].command:"",e.commandPrefix),a={kind:"cli.help",version:1,commands:r.length==1?r:r.map(({command:c,usage:l})=>({command:c,usage:l})),...i==null?{}:{request:i.request},examples:s,exitCodes:{0:"Success or accepted asynchronous operation.",1:"Error or unsuccessful terminal Run.",2:"Run is waiting for an explicit action; inspect run.waits.",3:"Waiting timed out or publication is pending; the operation continues."},notes:i==null?[...e.scopeGuidance??["The oo host selects the team for the whole invocation with --team <name>; Flow commands use that authenticated scope."],"--timeout is a wait budget in milliseconds (default 60000).","--follow --json writes NDJSON pages immediately; resume from nextAfter.","Use read/search to locate nodes, schema read|search|edit|check for requests, and schema <type> for configuration and ports.","Use edit with baseRevision, requestId and an ordered edits array. Read selected text before an exact text.edit.","Retry mutations with the same idempotency key, fixed revision/publication and identical arguments."]:[i.guidance,...r[0].command=="check"?[]:["Use either --input (literal JSON, @file, or - for stdin) or --file (path or -), never both."]]};return n.includes("--json")?JSON.stringify(a):[o.t("help.title"),"",...r.map((c)=>r.length!=1?c.usage:`${c.usage}
|
|
63
|
+
`)}function Lt(e){return`${e.name} ${e.flowId} ${e.status}`}function Xr(e){return`${e.operation} ${e.publicationId} ${e.revisionId} ${e.createdAt}`}function eo(e){let t=e.source=="draft"?"":` ${e.publicationId}`;return`${e.source} ${e.status} ${e.runId} ${e.revisionId}${t}${e.waits.length==0?"":`
|
|
64
|
+
${JSON.stringify(e.waits)}`}`}function Nb(e){return`${e.source} ${e.status} ${e.runId} ${e.revisionId}`}function zb(e){return`${e.sequence} ${e.kind} ${JSON.stringify(e.payload)}`}async function St(e,t,n,r){try{if(e=="-")return await r.readStdin();if(!e.startsWith("@"))return e;let o=e.slice(1);if(o.length==0)throw new E("cli.invalid-arguments",`${t} @ requires a file path.`);return await r.readFile(o)}catch(o){if(o instanceof E)throw o;throw new E(n,o instanceof Error?o.message:String(o))}}async function Db(e,t){if(e.input==null)return{};let n=await St(e.input,"--input","run.input-unreadable",t),r;try{r=JSON.parse(n)}catch{throw new E("run.input-invalid","Run input must be valid JSON.")}if(r==null||typeof r!="object"||Array.isArray(r))throw new E("run.input-invalid","Run input must be an object keyed by node ID.");for(let o of Object.values(r))if(o==null||typeof o!="object"||Array.isArray(o))throw new E("run.input-invalid","Each Run input node must contain an object keyed by input handle.");return r}async function to(e,t,n){let r=new Set,o;do{let i=await e.listPublications(t,{cursor:o,limit:bu}),s=i.publications.find((a)=>a.publicationId==n);if(s!=null)return s;if(o=i.nextCursor,o!=null&&r.has(o))throw new E("page.invalid-cursor","The deployment returned a repeated Publication cursor.");if(o!=null)r.add(o)}while(o!=null);throw new E("publication.not-found",`Publication ${JSON.stringify(n)} was not found.`)}async function ku(e,t,n,r=60000){let o=Date.now()+r,i=t;while(!lC.has(i.status)&&i.waits.length==0){let s=o-Date.now();if(s<=0)return{run:i,timedOut:!0};if(await n.wait(Math.min(1000,s)),Date.now()>=o)return{run:i,timedOut:!0};try{i=await e.getRun(i.runId,AbortSignal.timeout(Math.max(1,o-Date.now())))}catch(a){if(Date.now()>=o||a instanceof Error&&a.name=="TimeoutError")return{run:i,timedOut:!0};throw new E("run.wait-failed",a instanceof Error?a.message:String(a),{runId:i.runId})}}return{run:i,timedOut:!1}}function no(e,t=!1){if(t)return 3;if(e.waits.length>0)return 2;return e.status=="failed"||e.status=="canceled"||e.status=="indeterminate"?1:0}function qb(e){return new E(e.code,e.message,{status:e.status,...e.details})}async function Su(e,t,n,r,o=60000){let i=Date.now()+o,s=n;while(s.status=="pending"){let a=i-Date.now();if(a<=0)return{operation:s,timedOut:!0};if(await r.wait(Math.min(1000,a)),Date.now()>=i)return{operation:s,timedOut:!0};try{s=await e.getPublishOperation(t,s.operationId,AbortSignal.timeout(Math.max(1,i-Date.now())))}catch(c){if(Date.now()>=i||c instanceof Error&&c.name=="TimeoutError")return{operation:s,timedOut:!0};throw new E("publication.wait-failed",c instanceof Error?c.message:String(c),{flowId:t,operationId:s.operationId})}}return{operation:s,timedOut:!1}}var mC=new Set(Qi);function Vb(e){let t,n,r,o=fC(),i,s=[],a=[],c,l,u,d,g,h,y,S,R,N,q,V,Oe,fe,se,qe,Mt,on,Ft,Zn=!1,Jn,so=!1,as,cs,Nu=[],zu="draft",ls,us,Du=!1,ds,ps,fs,qu=[],Vu=!1,Lu=!1;for(let sn=0;sn<e.length;sn+=1){let Un=e[sn],ao=Un.startsWith("--")?Un.indexOf("="):-1,P=ao<0?Un:Un.slice(0,ao),Bn=ao<0?void 0:Un.slice(ao+1);if(Bn!=null&&["--json","--follow","--wait","--yes","--full","--pending-wait"].includes(P))throw new E("cli.invalid-arguments",`${P} does not accept a value.`);if(P.startsWith("--")){let L=P.slice(2);if(a.includes(L)&&L!="set"&&L!="unset")throw new E("cli.invalid-arguments",`Duplicate option --${L}.`);a.push(L)}if(["--scope","--key","--space"].includes(P)){let L=Bn??e[++sn];if(L==null||L.startsWith("--"))throw new E("cli.invalid-arguments",`${P} requires a value.`);if(P==="--scope")t=L;else if(P==="--key")n=L;else r=L}else if(P=="--json")so=!0;else if(P=="--follow")Zn=!0;else if(P=="--wait")Vu=!0;else if(P=="--yes")Lu=!0;else if(P=="--pending-wait")ls=!0;else if(P=="--full")Du=!0;else if(P=="--idempotency-key"||P=="--expected-publication"||P=="--revision"||P=="--publication"||P=="--pointer"||P=="--offset"||P=="--max-bytes"||P=="--code"||P=="--connection"||P=="--cron"||P=="--description"||P=="--every"||P=="--expected-revision"||P=="--file"||P=="--flow"||P=="--name"||P=="--source"||P=="--input"||P=="--trigger"||P=="--outputs"||P=="--status"||P=="--cursor"||P=="--limit"||P=="--after"||P=="--comment"||P=="--timeout"||P=="--timezone"||P=="--set"||P=="--unset"){let L=Bn??e[sn+1];if(L==null||L.length==0||Bn==null&&L.startsWith("-")&&L!="-")throw new E("cli.invalid-arguments",`${P} requires a value.`);if(Bn==null)sn++;if(P=="--idempotency-key")o=L;else if(P=="--expected-publication")i=L;else if(P=="--revision")u=L;else if(P=="--publication")d=L;else if(P=="--pointer")g=L;else if(P=="--after")R=L;else if(P=="--code")q=L;else if(P=="--connection")V=L;else if(P=="--cron")Oe=L;else if(P=="--description")se=L;else if(P=="--every")qe=L;else if(P=="--expected-revision")Mt=L;else if(P=="--file")on=L;else if(P=="--flow")Ft=L;else if(P=="--name")cs=L;else if(P=="--comment")ds=L;else if(P=="--input")Jn=L;else if(P=="--trigger")c=L;else if(P=="--outputs")l=L;else if(P=="--cursor")fe=L;else if(P=="--timezone")fs=L;else if(P=="--set")Nu.push(L);else if(P=="--unset")qu.push(L);else if(P=="--source"){if(L!="draft"&&L!="live")throw new E("cli.invalid-arguments","--source must be draft or live.");zu=L}else if(P=="--status"){if(!mC.has(L))throw new E("cli.invalid-arguments",`Unknown Run status ${JSON.stringify(L)}.`);us=L}else{let It=Number(L),Cw=P=="--offset"?0:1;if(!Number.isSafeInteger(It)||It<Cw||P=="--limit"&&It>100||P=="--max-bytes"&&It>1048576)throw new E("cli.invalid-arguments",`${P} has an invalid value.`);if(P=="--limit")as=It;else if(P=="--offset")h=It;else if(P=="--max-bytes")y=It;else ps=It}}else if(P.startsWith("-"))throw new E("cli.invalid-arguments",`Unknown option ${JSON.stringify(P)}.`);else s.push(P)}if(R!=null){if(s[0]=="runs"&&s[1]=="results")S=R;else if(N=Number(R),!Number.isSafeInteger(N)||N<0)throw new E("cli.invalid-arguments","--after must be a non-negative event sequence.")}return{scope:t,key:n,space:r,idempotencyKey:o,...S==null?{}:{resultAfter:S},...y==null?{}:{maxBytes:y},...h==null?{}:{offset:h},...g==null?{}:{pointer:g},...u==null?{}:{revision:u},...d==null?{}:{publication:d},...ds==null?{}:{comment:ds},...i==null?{}:{expectedPublication:i},...N==null?{}:{after:N},...q==null?{}:{code:q},...V==null?{}:{connection:V},...Oe==null?{}:{cron:Oe},...fe==null?{}:{cursor:fe},...se==null?{}:{description:se},...qe==null?{}:{every:qe},...Mt==null?{}:{expectedRevision:Mt},...on==null?{}:{file:on},...Ft==null?{}:{flow:Ft},follow:Zn,...Jn==null?{}:{input:Jn},json:so,...as==null?{}:{limit:as},...cs==null?{}:{name:cs},positionals:s,options:a,...c==null?{}:{trigger:c},...l==null?{}:{outputs:l},sets:Nu,source:zu,...us==null?{}:{status:us},...ls==null?{}:{pendingWait:ls},full:Du,...ps==null?{}:{timeoutMs:ps},...fs==null?{}:{timezone:fs},unsets:qu,wait:Vu,yes:Lu}}var gC=0.1,hC=3,rn=ot("type",[v({type:w("focus"),nodeId:j().min(1)}),v({type:w("zoom"),zoom:U().min(gC).max(hC)}),v({type:w("pan"),dx:U(),dy:U()}),v({type:w("fit")})]);var Iu=j().trim().refine((e)=>[...e].length<=2000,"Wait comment must contain at most 2,000 Unicode code points.").nullable().optional();var Ln=j().min(1),PC=Ae(),TC=v({kind:w("graph.trigger.create"),nodeId:Ln,key:Ln,connectionId:Ln.optional(),name:Ln.optional(),config:oe(Ln,PC),schedule:qt.readonly().optional()});function Cu(e){return Qt(e),A(ut()).min(1).parse(e).map((t,n)=>{let{kind:r}=Jr(t,n,C({kind:Ln}).parse);return r=="graph.trigger.create"?Jr(t,n,TC.parse):fy(t,n)})}var Lb=[{snapshot:{configInputs:[{handle:"baseId",jsonSchema:{type:"string",pattern:"^app[A-Za-z0-9]{14}$"},nullable:!1},{handle:"formula",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"tableIdOrName",jsonSchema:{type:"string",minLength:1,maxLength:255},nullable:!1},{handle:"triggerField",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^[^}]*$"},nullable:!1},{handle:"view",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"fields",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"maxRecordsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:1000},nullable:!1,value:200}],definitionVersion:2,description:"Polls an Airtable table and triggers when a record is created or updated, ordered by a time field.",displayName:"Record Created or Updated",key:"airtable.on_record_changed",name:"on_record_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{baseId:{type:"string"},createdTime:{type:"string"},fields:{type:"object"},recordId:{type:"string"},tableIdOrName:{type:"string"},triggerField:{type:"string"},triggerFieldValue:{type:"string"}},additionalProperties:!1,required:["baseId","tableIdOrName","recordId","createdTime","triggerField","triggerFieldValue","fields"]}},nullable:!1}],provider:"airtable",type:"poll"},options:!1},{snapshot:{key:"asana.on_task_event",provider:"asana",name:"on_task_event",displayName:"Project Task Event",description:"Receives tasks added to a project, completion changes, and selected custom field changes. Task details represent current state, not historical state.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!0},successStatus:200},configInputs:[{handle:"projectId",jsonSchema:{type:"string",minLength:1,title:"Project ID"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["task.added","task.completed","task.field_changed"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["task.added","task.completed"]},{handle:"customFieldId",jsonSchema:{type:"string",minLength:1,title:"Custom field ID"},nullable:!0}],outputs:[{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},task:{type:"object"},change:{type:"object"}},required:["event","task","change"]}},nullable:!1}]},callback:{headers:["x-hook-secret","x-hook-signature"],query:[]},options:!1},{snapshot:{key:"calendly.on_booking_event",provider:"calendly",name:"on_booking_event",displayName:"Booking Created or Canceled",description:"Receives bookings and cancellations, preserving reschedule links. Requires a Personal Access Token connection.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"scope",jsonSchema:{type:"string",enum:["user","organization"],title:"Scope"},nullable:!1,value:"user"},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["invitee.created","invitee.canceled"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["invitee.created","invitee.canceled"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["invitee.created","invitee.canceled"]},nullable:!1},{handle:"inviteeUri",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["calendly-webhook-signature"],query:[]},options:!1},{snapshot:{key:"clickup.on_task_event",provider:"clickup",name:"on_task_event",displayName:"Task Event",description:"Receives task creation, status changes, and new comments in a ClickUp Workspace or List.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"workspaceId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"Workspace ID"},nullable:!1},{handle:"listId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"List ID"},nullable:!0},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["taskCreated","taskStatusUpdated","taskCommentPosted"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},nullable:!1},{handle:"taskId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-signature"],query:[]},options:!1},{snapshot:{key:"feishu_app_bot.on_event",provider:"feishu_app_bot",name:"on_event",displayName:"Application Event",description:"Receives selected Feishu application events through a shared event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.]{0,127}$"},minItems:1,maxItems:200,uniqueItems:!0,title:"Event types"},nullable:!1},{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",minLength:1,maxLength:256},maxItems:100,uniqueItems:!0,title:"Chat IDs"},nullable:!0,description:"Leave empty to receive events from all chats available to the source."},{handle:"resource",jsonSchema:{type:"object",properties:{kind:{type:"string",enum:["document","calendar","approval"]},id:{type:"string",minLength:1,maxLength:256},documentType:{type:"string",enum:["doc","docx","sheet","bitable","file","folder"]}},additionalProperties:!1,required:["kind","id"],title:"Resource subscription"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"tenantKey",jsonSchema:{type:"string"},nullable:!1},{handle:"occurredAt",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"feishu"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},verificationToken:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},manageSubscriptions:{type:"boolean"}},required:["version","name","connectionId","teamId","verificationToken","encryptKey","eventTypes","manageSubscriptions"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"feishu",provider:"feishu_app_bot",triggerId:"feishu_app_bot.on_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"feishu"},{snapshot:{key:"fireflies.on_meeting_ready",provider:"fireflies",name:"on_meeting_ready",displayName:"Meeting Transcript or Summary Ready",description:"Receives separate transcript and summary readiness events through Fireflies Webhooks V2 after checking meeting access.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["meeting.transcribed","meeting.summarized"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"fireflies"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]}}},required:["kind","version","name","connectionId","teamId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"fireflies",provider:"fireflies",triggerId:"fireflies.on_meeting_ready",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"fireflies"},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["*","branch_protection_configuration","branch_protection_rule","check_run","check_suite","code_scanning_alert","commit_comment","create","custom_property_values","delete","dependabot_alert","deploy_key","deployment","deployment_status","discussion","discussion_comment","fork","gollum","issue_comment","issue_dependencies","issues","label","member","meta","milestone","package","page_build","project","project_card","project_column","public","pull_request","pull_request_review","pull_request_review_comment","pull_request_review_thread","push","registry_package","release","repository","repository_advisory","repository_import","repository_ruleset","repository_vulnerability_alert","secret_scanning_alert","secret_scanning_alert_location","secret_scanning_scan","security_and_analysis","star","status","sub_issues","team_add","watch","workflow_job","workflow_run"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1}],definitionVersion:2,description:"Triggers when selected GitHub webhook events occur in a repository.",displayName:"Repository Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.on_repo_event",name:"on_repo_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"github",type:"integration"},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1},{handle:"number",jsonSchema:{type:"integer",minimum:1},nullable:!1,description:"Number of the pull request to watch."}],definitionVersion:2,description:"Watches one pull request using notifications and periodic checks. Starts from its current state; reports observed changes, not every intermediate transition or review event.",displayName:"Watch Pull Request",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.watch_pull_request",name:"watch_pull_request",provider:"github",type:"integration",outputs:[{handle:"pullRequest",jsonSchema:{type:"object",properties:{id:{type:"integer"},number:{type:"integer"},title:{type:"string"},url:{type:"string"},state:{type:"string",enum:["open","closed"]},draft:{type:"boolean"},merged:{type:"boolean"},updatedAt:{type:"string"},headSha:{type:"string"},baseSha:{type:"string"}},additionalProperties:!1,required:["id","number","title","url","state","draft","merged","updatedAt","headSha","baseSha"]},nullable:!1},{handle:"version",jsonSchema:{type:"string"},nullable:!1}]},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["push","tag_push","issues","confidential_issues","note","confidential_note","merge_requests","job","pipeline","wiki_page","deployment","feature_flag","releases","milestone","emoji","resource_access_token","resource_deploy_token"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"project",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^(?:[0-9]+|(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*(?:/(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*)*)$"},nullable:!1},{handle:"pushBranchFilter",jsonSchema:{type:"string",maxLength:255},nullable:!1,value:""}],definitionVersion:2,description:"Triggers when selected GitLab webhook events occur in a project.",displayName:"Project Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"gitlab.on_project_event",name:"on_project_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"gitlabEvent",jsonSchema:{type:"string"},nullable:!1}],provider:"gitlab",type:"integration"},callback:{headers:["idempotency-key","x-gitlab-event","x-gitlab-token"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"labelNamesOrIds",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,description:"Only trigger on messages carrying all of these labels, referenced by name or ID.",value:[]},{handle:"readStatus",jsonSchema:{type:"string",enum:["Read","Unread","All"]},nullable:!1,value:"All"},{handle:"search",jsonSchema:{type:"string"},nullable:!1,description:"Gmail search-syntax query the message must match.",value:""},{handle:"sender",jsonSchema:{type:"string"},nullable:!1,description:"Only trigger on messages whose sender matches this address or name.",value:""},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on draft messages."},{handle:"includeSpamAndTrash",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages in SPAM and TRASH."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls the Gmail mailbox and triggers when a new message is received.",displayName:"New Message Received",key:"gmail.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{historyId:{type:["string","null"]},labelIds:{type:"array",items:{type:"string"}},messageId:{type:"string"},messageTimestamp:{type:"string"},sender:{type:"string"},subject:{type:"string"},threadId:{type:"string"},to:{type:"string"}},additionalProperties:!1,required:["messageId","threadId","historyId","labelIds","subject","sender","to","messageTimestamp"]}},nullable:!1}],provider:"gmail",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"calendarId",jsonSchema:{type:"string",minLength:1,maxLength:1024},nullable:!1},{handle:"changes",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","cancelled"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated","cancelled"]},{handle:"matchTerm",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxEventsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100}],definitionVersion:2,description:"Polls a Google Calendar and triggers when an event is created, updated or cancelled.",displayName:"Event Changed",key:"googlecalendar.on_event_changed",name:"on_event_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{attendeeEmails:{type:"array",items:{type:"string"}},calendarId:{type:"string"},changeType:{type:"string",enum:["created","updated","cancelled"]},created:{type:["string","null"]},creatorEmail:{type:["string","null"]},description:{type:["string","null"]},end:{type:["object","null"]},eventId:{type:"string"},eventType:{type:["string","null"]},htmlLink:{type:["string","null"]},isAllDay:{type:"boolean"},location:{type:["string","null"]},organizerEmail:{type:["string","null"]},recurringEventId:{type:["string","null"]},start:{type:["object","null"]},status:{type:"string"},summary:{type:["string","null"]},updated:{type:["string","null"]}},additionalProperties:!1,required:["changeType","calendarId","eventId","status","summary","description","location","htmlLink","start","end","isAllDay","organizerEmail","creatorEmail","attendeeEmails","recurringEventId","eventType","created","updated"]}},nullable:!1}],provider:"googlecalendar",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Uses a Google Drive changes.watch channel and triggers when Drive changes are available.",displayName:"Changes Detected",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.changes_detected",name:"changes_detected",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeId:{type:"string"},changeType:{type:["string","null"]},driveId:{type:["string","null"]},file:{type:["object","null"]},fileId:{type:["string","null"]},notification:{type:"object",properties:{changedTypes:{type:"array",items:{type:"string"}},messageNumber:{type:["string","null"]},resourceState:{type:"string"},resourceUri:{type:["string","null"]}},additionalProperties:!1,required:["resourceState","changedTypes","messageNumber","resourceUri"]},removed:{type:"boolean"},time:{type:["string","null"]}},additionalProperties:!1,required:["changeId","changeType","removed","time","fileId","driveId","file","notification"]}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"changeType",jsonSchema:{type:"string",enum:["created","updated"]},nullable:!1},{handle:"driveId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{0,512}$"},nullable:!1,value:""},{handle:"folderId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{2,512}$"},nullable:!1},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"mimeTypes",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"namePrefix",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxFilesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls one Google Drive folder and triggers when a file or folder directly inside it is created or updated.",displayName:"File or Folder Change in a Folder",key:"googledrive.on_file_change",name:"on_file_change",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdTime:{type:["string","null"]},driveId:{type:["string","null"]},eventType:{type:"string",enum:["file_created","file_updated","folder_created","folder_updated"]},fileId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifyingUser:{type:["object","null"]},mimeType:{type:"string"},modifiedTime:{type:["string","null"]},name:{type:"string"},parents:{type:"array",items:{type:"string"}},size:{type:"string"},webViewLink:{type:["string","null"]}},additionalProperties:!1,required:["eventType","itemType","fileId","name","mimeType","createdTime","modifiedTime","parents","webViewLink","driveId","lastModifyingUser"]}},nullable:!1}],provider:"googledrive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Monitors Drive changes using notifications and periodic scans of the same change stream.",displayName:"Watch Changes",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.watch_changes",name:"watch_changes",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object"}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"columnRange",jsonSchema:{type:"string",pattern:"^[A-Za-z]{1,3}(?::[A-Za-z]{1,3})?$"},nullable:!1,value:"A:ZZZ"},{handle:"sheet",jsonSchema:{type:"string",minLength:1},nullable:!1},{handle:"spreadsheetId",jsonSchema:{type:"string",minLength:1},nullable:!1},{group:"Advanced settings",collapsed:!0},{handle:"dateTimeRender",jsonSchema:{type:"string",enum:["FORMATTED_STRING","SERIAL_NUMBER"]},nullable:!1,value:"FORMATTED_STRING"},{handle:"firstDataRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:2},{handle:"headerRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:1},{handle:"maxRowsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100},{handle:"valueRender",jsonSchema:{type:"string",enum:["UNFORMATTED_VALUE","FORMATTED_VALUE","FORMULA"]},nullable:!1,value:"UNFORMATTED_VALUE"}],definitionVersion:2,description:"Polls a sheet and triggers once for every new row appended below the last row already seen.",displayName:"New Row Added",key:"googlesheets.on_row_added",name:"on_row_added",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{row:{type:"object"},rowNumber:{type:"integer"},sheetId:{type:"integer"},sheetTitle:{type:"string"},spreadsheetId:{type:"string"},values:{type:"array",items:{}}},additionalProperties:!1,required:["spreadsheetId","sheetId","sheetTitle","rowNumber","row","values"]}},nullable:!1}],provider:"googlesheets",type:"poll"},options:!1},{snapshot:{key:"intercom.on_conversation_event",provider:"intercom",name:"on_conversation_event",displayName:"Customer Conversation or Ticket",description:"Receives customer conversations, customer replies and new tickets from a verified Intercom application event source. Administrator replies are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["conversation.user.created","conversation.user.replied","ticket.created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"workspaceId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object",properties:{},additionalProperties:!0},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"intercom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"intercom",provider:"intercom",triggerId:"intercom.on_conversation_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"intercom"},{snapshot:{key:"jira.on_issue_event",provider:"jira",name:"on_issue_event",displayName:"Issue or Comment Event",description:"Receives Jira Cloud issue creation, issue updates and new comments through a shared project webhook with automatic renewal.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["jira:issue_created","jira:issue_updated","comment_created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"cloudId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"jira"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},project:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]}}},required:["kind","version","name","connectionId","teamId","project","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"jira",provider:"jira",triggerId:"jira.on_issue_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!0},options:!1,eventSource:"jira"},{snapshot:{configInputs:[{handle:"teamId",jsonSchema:{type:"string",pattern:"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",title:"Team ID"},nullable:!1,description:"Linear Team UUID. Use Copy model UUID in Linear to find it."},{handle:"stateIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"},maxItems:50,uniqueItems:!0,title:"Issue statuses"},nullable:!1,value:[],description:"Choose statuses from the selected Team. Empty means all statuses. Matches the current status, not every transition into it."}],definitionVersion:2,description:"Watches new and updated issues in a Linear team with periodic checks. Starts from now without running existing issues. Reports observed current states, not deletions or every intermediate status change.",displayName:"Issue Created or Updated",key:"linear.on_issue_changed",name:"on_issue_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{id:{type:"string"},identifier:{type:"string"},title:{type:"string"},url:{type:"string"},teamId:{type:"string"},createdAt:{type:"string"},updatedAt:{type:"string"},state:{type:"object",properties:{id:{type:"string"},name:{type:"string"},type:{type:"string"}},additionalProperties:!1,required:["id","name","type"]}},additionalProperties:!1,required:["id","identifier","title","url","teamId","createdAt","updatedAt","state"]}},nullable:!1}],provider:"linear",type:"poll"},options:!0},{snapshot:{configInputs:[{handle:"dataSourceId",jsonSchema:{type:"string",pattern:"^(?:|[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12})$"},nullable:!1,value:""},{handle:"databaseId",jsonSchema:{type:"string",pattern:"^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["page_added","page_updated"]},minItems:1,uniqueItems:!0},nullable:!1,value:["page_added"]},{group:"Advanced settings",collapsed:!0},{handle:"includeProperties",jsonSchema:{type:"boolean"},nullable:!1,value:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Notion database and triggers when a page is added to it or an existing page is edited.",displayName:"Database Page Added or Updated",key:"notion.on_database_page_event",name:"on_database_page_event",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdBy:{type:"object"},createdTime:{type:"string"},dataSourceId:{type:"string"},databaseId:{type:"string"},event:{type:"string",enum:["page_added","page_updated"]},lastEditedBy:{type:"object"},lastEditedTime:{type:"string"},pageId:{type:"string"},properties:{type:"object"},title:{type:"string"},url:{type:"string"}},additionalProperties:!1,required:["event","pageId","databaseId","dataSourceId","url","title","createdTime","lastEditedTime","createdBy","lastEditedBy"]}},nullable:!1}],provider:"notion",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","deleted"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated"]},{handle:"itemId",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"parentFolderId",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls the OneDrive change feed and triggers when a file or folder is created, updated or deleted.",displayName:"File or Folder Changed",key:"one_drive.on_item_changed",name:"on_item_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeType:{type:"string",enum:["created","updated","deleted"]},createdDateTime:{type:["string","null"]},driveId:{type:["string","null"]},eTag:{type:["string","null"]},itemId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifiedDateTime:{type:["string","null"]},mimeType:{type:["string","null"]},name:{type:"string"},parentFolderId:{type:["string","null"]},size:{type:["number","null"]},webUrl:{type:"string"}},additionalProperties:!1,required:["itemId","name","changeType","itemType","size","mimeType","webUrl","parentFolderId","driveId","createdDateTime","lastModifiedDateTime","eTag"]}},nullable:!1}],provider:"one_drive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"folder",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_=-]*$"},nullable:!1,value:"inbox",description:"A well-known mail folder name, folder ID, or an empty string for the whole mailbox."},{handle:"readStatus",jsonSchema:{type:"string",enum:["All","Read","Unread"]},nullable:!1,value:"All"},{handle:"senderAddress",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Exact sender address, or empty for any sender."},{handle:"subjectContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Case-insensitive subject text."},{handle:"withAttachmentsOnly",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Microsoft Outlook mail folder and triggers when a new message arrives.",displayName:"New Message Received",key:"outlook.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{bodyPreview:{type:"string"},categories:{type:"array",items:{type:"string"}},conversationId:{type:"string"},from:{type:"string"},fromName:{type:"string"},hasAttachments:{type:"boolean"},importance:{type:"string"},internetMessageId:{type:"string"},isDraft:{type:"boolean"},isRead:{type:"boolean"},messageId:{type:"string"},parentFolderId:{type:"string"},receivedDateTime:{type:"string"},subject:{type:"string"},to:{type:"array",items:{type:"string"}},webLink:{type:"string"}},additionalProperties:!1,required:["messageId","internetMessageId","conversationId","subject","bodyPreview","from","fromName","to","receivedDateTime","hasAttachments","isRead","isDraft","importance","categories","parentFolderId","webLink"]}},nullable:!1}],provider:"outlook",type:"poll"},options:!1},{snapshot:{key:"pandadoc.on_document_event",provider:"pandadoc",name:"on_document_event",displayName:"Document Status Changed",description:"Receives document status changes in the connected workspace, optionally only when the entire document is completed.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!0,allowEmpty:!1},successStatus:200},configInputs:[{handle:"completedOnly",jsonSchema:{type:"boolean",title:"Completed documents only"},nullable:!1,value:!0}],outputs:[{handle:"events",nullable:!1,jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},data:{type:"object"}},required:["event","data"]}}}]},callback:{headers:[],query:["signature"]},options:!1},{snapshot:{key:"pipedrive.on_crm_event",provider:"pipedrive",name:"on_crm_event",displayName:"Deal or Contact Event",description:"Receives new deals or contacts, or actual changes to a deal stage or status using Pipedrive Webhooks v2.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventType",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"],title:"Event"},nullable:!1,value:"deal.created"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["authorization"],query:[]},options:!1},{snapshot:{key:"resend.on_email_event",provider:"resend",name:"on_email_event",displayName:"Email Received, Bounced or Complained",description:"Receives inbound email, bounce, and complaint notifications. Read message bodies and attachments with Actions.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["email.received","email.bounced","email.complained"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["email.received","email.bounced","email.complained"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["email.received","email.bounced","email.complained"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"emailId",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["svix-id","svix-signature","svix-timestamp"],query:[]},options:!1},{snapshot:{key:"sentry.on_issue_alert",provider:"sentry",name:"on_issue_alert",displayName:"Issue Alert",description:"Receives Issue Alert Rule notifications from a verified Sentry Custom Integration installation.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"projectIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]+$"},uniqueItems:!0,title:"Project IDs"},nullable:!0},{handle:"ruleNames",jsonSchema:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0,title:"Alert rule names"},nullable:!0},{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["issue.alert"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["issue.alert"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"organizationId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"sentry"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},installationId:{type:"string",minLength:1,maxLength:256},organizationId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"issue.alert"}}},required:["kind","version","name","connectionId","teamId","appId","installationId","organizationId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"sentry",provider:"sentry",triggerId:"sentry.on_issue_alert",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"sentry"},{snapshot:{configInputs:[{handle:"topics",jsonSchema:{type:"array",items:{type:"string",enum:["app/scopes_update","app/uninstalled","app_purchases_one_time/update","app_subscriptions/approaching_capped_amount","app_subscriptions/update","bulk_operations/finish","carts/create","carts/update","channels/delete","checkout_and_accounts_configurations/update","checkouts/create","checkouts/delete","checkouts/update","collection_listings/add","collection_listings/remove","collection_listings/update","collection_publications/create","collection_publications/delete","collection_publications/update","collections/create","collections/delete","collections/update","companies/create","companies/delete","companies/update","company_contact_roles/assign","company_contact_roles/revoke","company_contacts/create","company_contacts/delete","company_contacts/update","company_locations/create","company_locations/delete","company_locations/update","customer.joined_segment","customer.left_segment","customer.tags_added","customer.tags_removed","customer_account_settings/update","customer_groups/create","customer_groups/delete","customer_groups/update","customers/create","customers/delete","customers/disable","customers/enable","customers/purchasing_summary","customers/update","customers_email_marketing_consent/update","customers_marketing_consent/update","delivery_promise_settings/update","disputes/create","disputes/update","domains/create","domains/destroy","domains/update","draft_orders/create","draft_orders/delete","draft_orders/update","fulfillment_events/create","fulfillment_events/delete","fulfillment_holds/added","fulfillment_holds/released","fulfillment_orders/cancellation_request_accepted","fulfillment_orders/cancellation_request_rejected","fulfillment_orders/cancellation_request_submitted","fulfillment_orders/cancelled","fulfillment_orders/fulfillment_request_accepted","fulfillment_orders/fulfillment_request_rejected","fulfillment_orders/fulfillment_request_submitted","fulfillment_orders/fulfillment_service_failed_to_complete","fulfillment_orders/hold_released","fulfillment_orders/line_items_prepared_for_local_delivery","fulfillment_orders/line_items_prepared_for_pickup","fulfillment_orders/manually_reported_progress_stopped","fulfillment_orders/merged","fulfillment_orders/moved","fulfillment_orders/order_routing_complete","fulfillment_orders/placed_on_hold","fulfillment_orders/progress_reported","fulfillment_orders/rescheduled","fulfillment_orders/scheduled_fulfillment_order_ready","fulfillment_orders/split","fulfillments/create","fulfillments/update","inventory_items/create","inventory_items/delete","inventory_items/update","inventory_levels/connect","inventory_levels/disconnect","inventory_levels/update","locales/create","locales/destroy","locales/update","locations/activate","locations/create","locations/deactivate","locations/delete","locations/update","machine_translation_batch/completed","metafield_definitions/create","metafield_definitions/delete","metafield_definitions/update","order_transactions/create","orders/cancelled","orders/create","orders/delete","orders/edited","orders/fulfilled","orders/link_requested","orders/paid","orders/partially_fulfilled","orders/risk_assessment_changed","orders/shopify_protect_eligibility_changed","orders/updated","payment_schedules/due","payment_terms/create","payment_terms/delete","payment_terms/update","product_feeds/create","product_feeds/full_sync","product_feeds/full_sync_finish","product_feeds/incremental_sync","product_feeds/update","product_listings/add","product_listings/remove","product_listings/update","product_publications/create","product_publications/delete","product_publications/update","products/create","products/delete","products/update","profiles/create","profiles/delete","profiles/update","publications/delete","refunds/create","returns/approve","returns/cancel","returns/close","returns/decline","returns/process","returns/reopen","returns/request","returns/update","reverse_deliveries/attach_deliverable","reverse_fulfillment_orders/dispose","scheduled_product_listings/add","scheduled_product_listings/remove","scheduled_product_listings/update","segments/create","segments/delete","segments/update","selling_plan_groups/create","selling_plan_groups/delete","selling_plan_groups/update","shop/update","subscription_billing_attempts/challenged","subscription_billing_attempts/failure","subscription_billing_attempts/success","subscription_billing_cycle_edits/create","subscription_billing_cycle_edits/delete","subscription_billing_cycle_edits/update","subscription_billing_cycles/skip","subscription_billing_cycles/unskip","subscription_contracts/activate","subscription_contracts/cancel","subscription_contracts/create","subscription_contracts/expire","subscription_contracts/fail","subscription_contracts/pause","subscription_contracts/update","tax_partners/update","tax_summaries/create","tender_transactions/create","themes/create","themes/delete","themes/publish","themes/update","variants/in_stock","variants/out_of_stock"]},minItems:1,maxItems:20,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when selected Shopify webhook topics occur in the connected store.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"shopify.on_shop_event",name:"on_shop_event",outputs:[{handle:"apiVersion",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"shopDomain",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"triggeredAt",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"shopify",type:"integration"},callback:{headers:["x-shopify-api-version","x-shopify-event-id","x-shopify-shop-domain","x-shopify-topic","x-shopify-triggered-at","x-shopify-webhook-id"],query:["open_flow_callback"]},options:!1},{snapshot:{configInputs:[{handle:"channelId",jsonSchema:{type:"string",pattern:"^[CDG][A-Z0-9]{2,31}$"},nullable:!1,description:"Slack conversation ID to watch, e.g. C0122KQ70S7E."},{handle:"fromUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Only trigger on messages written by these Slack user IDs. Empty means any author."},{handle:"ignoreUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Never trigger on messages written by these Slack user IDs."},{handle:"textContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Only trigger when message text contains this string, case-insensitively."},{group:"Advanced settings",collapsed:!0},{handle:"includeBotMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages posted by bots and apps."},{handle:"includeSystemMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on Slack system notices."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:15,description:"Maximum number of messages processed per poll."}],definitionVersion:2,description:"Polls one Slack conversation and triggers when a new message is posted to it.",displayName:"New Channel Message",key:"slack.on_message_posted",name:"on_message_posted",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{botId:{type:["string","null"]},channelId:{type:"string"},files:{type:"array",items:{type:"object",properties:{id:{type:"string"},mimetype:{type:"string"},name:{type:"string"}},additionalProperties:!1,required:["id","name","mimetype"]}},messageTs:{type:"string"},subtype:{type:["string","null"]},text:{type:"string"},threadTs:{type:["string","null"]},userId:{type:["string","null"]}},additionalProperties:!1,required:["channelId","messageTs","threadTs","userId","botId","subtype","text","files"]}},nullable:!1}],provider:"slack",type:"poll"},options:!1},{snapshot:{key:"slackbot.on_event",provider:"slackbot",name:"on_event",displayName:"Mention or Direct Message",description:"Receives user mentions and new direct messages through a shared Slack application event source. Slack Connect events are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["app_mention","message.im"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["app_mention","message.im"]},{handle:"channelIds",jsonSchema:{type:"array",items:{type:"string",minLength:1},maxItems:100,uniqueItems:!0,title:"Channel IDs"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"teamId",jsonSchema:{type:"string"},nullable:!1},{handle:"channel",jsonSchema:{type:"string"},nullable:!1},{handle:"user",jsonSchema:{type:"string"},nullable:!1},{handle:"text",jsonSchema:{type:"string"},nullable:!1},{handle:"ts",jsonSchema:{type:"string"},nullable:!1},{handle:"threadTs",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"slack"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",pattern:"^A[A-Z0-9]+$"},workspaceId:{type:"string",pattern:"^T[A-Z0-9]+$"},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["app_mention","message.im"]}}},required:["kind","version","name","connectionId","teamId","appId","workspaceId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"slack",provider:"slackbot",triggerId:"slackbot.on_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"slack"},{snapshot:{configInputs:[{handle:"apiVersion",jsonSchema:{type:"string",maxLength:40},nullable:!1,value:""},{handle:"events",jsonSchema:{type:"array",items:{type:"string",maxLength:120,pattern:"^(\\*|[a-z0-9_]+(?:\\.[a-z0-9_]+)+)$"},minItems:1,uniqueItems:!0},nullable:!1},{handle:"includeConnectedAccounts",jsonSchema:{type:"boolean"},nullable:!1,value:!1}],definitionVersion:2,description:"Triggers when selected Stripe events happen on the connected account.",displayName:"Account Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"stripe.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"livemode",jsonSchema:{type:"boolean"},nullable:!1}],provider:"stripe",type:"integration"},callback:{headers:["stripe-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form"},nullable:!1,description:"Choose a form accessible to this Connection."}],definitionVersion:2,description:"Receives new Tally form submissions through a signed, automatically managed webhook.",displayName:"Form Response",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"tally.on_form_response",name:"on_form_response",outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},createdAt:{type:"string"},formId:{type:"string"},submissionId:{type:"string"},responseId:{type:"string"},fields:{type:"array",items:{type:"object",properties:{key:{type:"string"},type:{type:"string"},label:{type:["string","null"]},value:{},options:{type:"array",items:{type:"object"}}},required:["key","type","label","value"]}}},required:["eventId","createdAt","formId","submissionId","responseId","fields"]}}],provider:"tally",type:"integration"},callback:{headers:["tally-signature"],query:[]},options:!0},{snapshot:{configInputs:[{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^-?[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram chat IDs. Empty means every chat."},{handle:"dropPendingUpdates",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Discard updates queued before the webhook is created or resumed."},{handle:"updates",jsonSchema:{type:"array",items:{enum:["*","message","edited_message","channel_post","edited_channel_post","business_connection","business_message","edited_business_message","deleted_business_messages","guest_message","message_reaction","message_reaction_count","inline_query","chosen_inline_result","callback_query","shipping_query","pre_checkout_query","purchased_paid_media","poll","poll_answer","my_chat_member","chat_member","chat_join_request","chat_boost","removed_chat_boost","managed_bot","subscription"]},minItems:1,uniqueItems:!0},nullable:!1,description:"Telegram update types that trigger a Run. Use * for the Telegram default set."},{handle:"userIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram user IDs. Empty means every user."}],definitionVersion:2,description:"Triggers when the connected Telegram bot receives a selected update.",displayName:"Bot Update",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"telegram.on_update",name:"on_update",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"telegram",type:"integration"},callback:{headers:["x-telegram-bot-api-secret-token"],query:[]},options:!1},{snapshot:{key:"typeform.on_form_response",provider:"typeform",name:"on_form_response",displayName:"Completed Form Response",description:"Receives complete Typeform submissions through an automatically managed signed webhook.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form ID"},nullable:!1}],outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},form_id:{type:"string"},token:{type:"string"},submitted_at:{type:"string"},answers:{type:"array",items:{type:"object"}},definition:{type:"object"}},required:["eventId","form_id","token","submitted_at","answers"]}}]},callback:{headers:["typeform-signature"],query:[]},options:!1},{snapshot:{key:"vercel.on_deployment_event",provider:"vercel",name:"on_deployment_event",displayName:"Deployment Ready or Failed",description:"Receives successful and failed deployments for a Vercel project.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"teamId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Team ID"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Project ID"},nullable:!1},{handle:"environment",jsonSchema:{type:"string",enum:["all","production","preview"],title:"Environment"},nullable:!1,value:"all"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deployment.ready","deployment.error"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"deploymentId",jsonSchema:{type:"string"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-vercel-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["coupon.created","coupon.updated","coupon.deleted","coupon.restored","customer.created","customer.updated","customer.deleted","order.created","order.updated","order.deleted","order.restored","product.created","product.updated","product.deleted","product.restored","product.published"]},minItems:1,maxItems:16,uniqueItems:!0},nullable:!1},{handle:"webhookName",jsonSchema:{type:"string",minLength:1,maxLength:120},nullable:!1,value:"OOMOL Trigger"}],definitionVersion:2,description:"Triggers when selected WooCommerce store events occur.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"woocommerce.on_store_event",name:"on_store_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"resource",jsonSchema:{type:"string"},nullable:!1},{handle:"source",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"woocommerce",type:"integration"},callback:{headers:["x-wc-webhook-delivery-id","x-wc-webhook-event","x-wc-webhook-id","x-wc-webhook-resource","x-wc-webhook-signature","x-wc-webhook-source","x-wc-webhook-topic"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["zen:event-type:ticket.agent_assignment_changed","zen:event-type:ticket.attachment_linked_to_comment","zen:event-type:ticket.attachment_redacted_from_comment","zen:event-type:ticket.brand_changed","zen:event-type:ticket.comment_added","zen:event-type:ticket.comment_made_private","zen:event-type:ticket.comment_redacted","zen:event-type:ticket.created","zen:event-type:ticket.csat_received","zen:event-type:ticket.csat_requested","zen:event-type:ticket.custom_field_changed","zen:event-type:ticket.custom_status_changed","zen:event-type:ticket.description_changed","zen:event-type:ticket.email_ccs_changed","zen:event-type:ticket.external_id_changed","zen:event-type:ticket.followers_changed","zen:event-type:ticket.form_changed","zen:event-type:ticket.group_assignment_changed","zen:event-type:ticket.marked_as_spam","zen:event-type:ticket.merged","zen:event-type:ticket.next_sla_breach_changed","zen:event-type:ticket.ola_policy_changed","zen:event-type:ticket.organization_changed","zen:event-type:ticket.permanently_deleted","zen:event-type:ticket.priority_changed","zen:event-type:ticket.problem_link_changed","zen:event-type:ticket.requester_changed","zen:event-type:ticket.schedule_changed","zen:event-type:ticket.sla_policy_changed","zen:event-type:ticket.soft_deleted","zen:event-type:ticket.status_changed","zen:event-type:ticket.subject_changed","zen:event-type:ticket.submitter_changed","zen:event-type:ticket.tags_changed","zen:event-type:ticket.task_due_at_changed","zen:event-type:ticket.type_changed","zen:event-type:ticket.undeleted","zen:event-type:organization.created","zen:event-type:organization.custom_field_changed","zen:event-type:organization.deleted","zen:event-type:organization.external_id_changed","zen:event-type:organization.name_changed","zen:event-type:organization.tags_changed","zen:event-type:user.active_changed","zen:event-type:user.alias_changed","zen:event-type:user.created","zen:event-type:user.custom_field_changed","zen:event-type:user.custom_role_changed","zen:event-type:user.default_group_changed","zen:event-type:user.deleted","zen:event-type:user.details_changed","zen:event-type:user.external_id_changed","zen:event-type:user.group_membership_created","zen:event-type:user.group_membership_deleted","zen:event-type:user.identity_changed","zen:event-type:user.identity_created","zen:event-type:user.identity_deleted","zen:event-type:user.last_login_changed","zen:event-type:user.merged","zen:event-type:user.name_changed","zen:event-type:user.notes_changed","zen:event-type:user.only_private_comments_changed","zen:event-type:user.organization_membership_created","zen:event-type:user.organization_membership_deleted","zen:event-type:user.password_changed","zen:event-type:user.photo_changed","zen:event-type:user.role_changed","zen:event-type:user.suspended_changed","zen:event-type:user.tags_changed","zen:event-type:user.time_zone_changed"]},minItems:1,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when one of the selected Zendesk account events occurs.",displayName:"Event Subscription",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"zendesk.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"subject",jsonSchema:{type:"string"},nullable:!1}],provider:"zendesk",type:"integration"},callback:{headers:["x-zendesk-webhook-signature","x-zendesk-webhook-signature-timestamp"],query:[]},options:!1},{snapshot:{key:"zoom.on_recording_ready",provider:"zoom",name:"on_recording_ready",displayName:"Cloud Recording Ready",description:"Receives completed cloud recordings hosted by the connected Zoom user through a verified application event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["recording.completed"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["recording.completed"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingUuid",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"zoom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"recording.completed"}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"zoom",provider:"zoom",triggerId:"zoom.on_recording_ready",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"zoom"}];function Mb(e){return Kg(e).extend({name:j().trim().min(1).max(128)})}var Fb=Lb.flatMap((e)=>("source"in e)&&e.source!=null?[e.source]:[]),Zb=Y(Fb.map((e)=>Mb(e.createSchema))),Jb=Mb(Fb[0].updateSchema),Ub=v({version:w(1),expectedRevision:xe().positive()});var Bb={start:"A Start node with a required message parameter. Supply it through trigger.outputs.",error:"A Flow Error node. Select upstream Flows, then publish and enable this Flow to listen for failures in their automatic runs.",webhook:"A Webhook start node.","webhook-response":"An HTTP response node with body, statusCode and headers inputs. Select it from a reachable Webhook.",cron:"An hourly scheduled start node.",poll:"Gmail polling by key; replace CONNECTION_ID with an active Gmail connection.",integration:"Telegram webhook integration by key; replace CONNECTION_ID with an active Telegram connection.",decision:"AI Decision evaluates named questions against target and returns a complete answer object per output. Configure target before running.","skip-duplicates":"Skip items already recorded by successful Runs. Configure identity fields; an empty list uses each string or numeric item. History is private to the node and only commits after Run success.","http-request":"A single HTTP request. Bind url and request inputs; outputs are body, statusCode and headers.",openapi:"A fixed JSON API operation. Replace the example document and URL before running.",connector:"A Connector Task and its node. Replace ACTION_ID, CONNECTION_ID and port definitions using connector_get / connector show. Set connectionId to an empty string to defer account configuration; execution will require an account.",code:"A JavaScript module and its node. Use Code for custom computation; use Connector Tasks for existing actions.",condition:"A condition with true and false execution branches.",value:"A fixed value node.",approval:"An Approval with approve and reject decision branches and a built-in notification output.",wait:"A Wait with a continue action and a built-in notification output.",agent:"An Agent with code computation enabled. Configure a model available in the deployment.","llm-chat":"An LLM chat Task and its node; configure a model available in the deployment.","llm-json":"An LLM JSON Task and its node; configure a model available in the deployment.","poll-notification":"Gmail events \u2192 JavaScript text formatting \u2192 Connector notification. Replace connection/action IDs and match the notification input ports."},NC=Object.keys(Bb),zC=NC.map((e)=>({name:e,description:Bb[e]}));var z1=v({comment:Iu}),Mn=Ae(),ke=j().min(1),ye=w(1),ro=ke.refine((e)=>e==e.trim()&&Gr(e)==null,"Flow name is invalid."),oo=A(ke).transform((e)=>[...new Set(e)].toSorted()),qC=ke.transform((e)=>e.trim()).refine((e)=>Gr(e)==null,"Tag name is invalid."),Kb=oe(j(),oe(j(),Mn)),Wb=v({nodeId:ke,outputs:oe(j(),Mn)}),ee={canvas:v({command:rn,version:ye}),authoringCheck:Yl,authoringEdit:Ur,authoringRead:Li,authoringSearch:Mi,authoringSchema:Cy,loadOpenApiDocument:v({url:j().min(1).max(8192),version:ye}),createEventSource:Zb,updateEventSource:Jb,eventSourceRevision:Ub,importFlow:v({file:Mn,name:ro.optional(),teamId:ke.optional(),tagIds:oo.optional(),version:ye}),createFlow:v({name:ro,teamId:ke.optional(),tagIds:oo.optional(),presentation:oe(j(),Mn).optional(),version:ye}),saveTag:v({name:qC,version:ye}),setFlowTags:v({tagIds:oo,version:ye}),updateFlow:Y([v({name:ro,tagIds:oo.optional(),version:ye}),v({name:ro.optional(),tagIds:oo,version:ye})]),renameFlow:v({name:ro,version:ye}),changeDraft:v({expectedRevisionId:ke,operations:A(Mn).min(1),version:ye}),repairDraft:v({expectedRevisionId:ke,version:ye}),upgradeDraft:v({expectedRevisionId:ke,version:ye}),setEnabled:v({enabled:me(),expectedPublicationId:ke,version:ye}),updatePresentation:v({expectedRevision:xe().positive(),value:oe(j(),Mn),version:ye}),checkFlow:v({engineContract:ke,version:ye}),publishFlow:v({engineContract:ke,expectedLivePublicationId:ke.nullable(),version:ye}),rollbackFlow:v({expectedLivePublicationId:ke,version:ye}),createDraftRun:v({engineContract:ke,inputs:Kb,trigger:Wb,version:w(2)}),createLiveRun:v({publicationId:ke,inputs:Kb,trigger:Wb,version:w(2)}),resolveWait:v({action:B(["approve","continue","reject"]),comment:Iu,version:ye}),putVariable:v({value:j().refine((e)=>new TextEncoder().encode(e).byteLength<=65536,"Variable value is too large.")}),queryConnectorAccessCandidates:v({providerIds:A(ke.max(256)).min(1).refine((e)=>new Set(e).size==e.length,"Duplicate provider IDs."),version:ye}),removeConnectionUsage:v({connectionId:ke,expectedRevisionId:ke,expectedAccessRevision:xe().nonnegative(),version:ye}),setConnectorService:v({expectedAccessRevision:xe().nonnegative(),version:ye}),addProviderAccessBinding:v({accessBindingId:ke,expectedAccessRevision:xe().nonnegative(),version:ye}),removeProviderAccessBinding:v({accessBindingId:ke,expectedAccessRevision:xe().nonnegative(),version:ye}),versionOnly:v({version:ye})};function ne(e){return(t)=>e.parse(t)}var rs={canvas:ne(ee.canvas),authoringCheck:ne(ee.authoringCheck),authoringEdit:ne(ee.authoringEdit),authoringRead:ne(ee.authoringRead),authoringSearch:ne(ee.authoringSearch),authoringSchema:ne(ee.authoringSchema),loadOpenApiDocument:ne(ee.loadOpenApiDocument),createEventSource:ne(ee.createEventSource),updateEventSource:ne(ee.updateEventSource),eventSourceRevision:ne(ee.eventSourceRevision),importFlow:ne(ee.importFlow),createFlow:ne(ee.createFlow),saveTag:ne(ee.saveTag),setFlowTags:ne(ee.setFlowTags),updateFlow:ne(ee.updateFlow),renameFlow:ne(ee.renameFlow),changeDraft(e){let t=ee.changeDraft.parse(e);return{...t,operations:Cu(t.operations)}},repairDraft:ne(ee.repairDraft),upgradeDraft:ne(ee.upgradeDraft),setEnabled:ne(ee.setEnabled),updatePresentation:ne(ee.updatePresentation),checkFlow:ne(ee.checkFlow),publishFlow:ne(ee.publishFlow),rollbackFlow:ne(ee.rollbackFlow),createDraftRun:ne(ee.createDraftRun),createLiveRun:ne(ee.createLiveRun),resolveWait:ne(ee.resolveWait),putVariable:ne(ee.putVariable),queryConnectorAccessCandidates:ne(ee.queryConnectorAccessCandidates),removeConnectionUsage:ne(ee.removeConnectionUsage),setConnectorService:ne(ee.setConnectorService),addProviderAccessBinding:ne(ee.addProviderAccessBinding),removeProviderAccessBinding:ne(ee.removeProviderAccessBinding),versionOnly:ne(ee.versionOnly)};var Eu=["expected-revision","idempotency-key"],Ou=["cursor","limit"],Gb=[["state show","<flow> --scope <draft|live> [--full]",["scope","full"]],["state clear","<flow> --scope <draft|live> [--key <key>] --yes",["scope","key","yes"]],["dedupe clear","<flow> --scope <draft|live> --space <space> --yes",["scope","space","yes"]],["canvas","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["read","<flow> [--input JSON|@file|- | --file path|-]",["input","file"]],["search","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["edit","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["list","[--cursor <cursor>] [--limit <count>]",Ou],["export","<flow>",[]],["import","--file <path|->",["file","name","idempotency-key"]],["create","<name>",["idempotency-key"]],["show","<flow>",[]],["live","<flow>",[]],["rename","<flow> <new-name>",[]],["delete","<flow> --yes",["yes"]],["check","<flow> [--revision <revisionId>]",["revision"]],["enable","<flow> --expected-publication <publicationId>",["expected-publication"]],["disable","<flow> --expected-publication <publicationId>",["expected-publication"]],["connector code-access","<flow> [--publication <publicationId>]",["publication"]],["connector candidates","<flow> <provider> [provider ...]",[]],["connector code-allow","<flow> <provider> <binding> <access-revision>",[]],["connector code-remove","<flow> <provider> <binding> <access-revision>",[]],["connector remove-usage","<flow> <connection> <access-revision>",Eu],["connector providers","[--flow <flow>]",["flow"]],["connector teams","",[]],["connector search","<query> [--flow <flow>]",["flow"]],["connector show","<action> [--flow <flow>]",["flow"]],["connector connections","<service> [--flow <flow>]",["flow"]],["event-source list","",[]],["trigger search","[query]",[]],["trigger show","<key>",[]],["run","<flow>",[...Eu,"expected-publication","source","trigger","outputs","input","wait","timeout"]],["runs list","--flow <flow>",["flow","status","pending-wait",...Ou]],["runs show","<run>",[]],["runs wait","<run>",["timeout"]],["runs resolve","<run> <wait> <continue|approve|reject>",["comment"]],["runs events","<run>",["after","limit","follow","timeout"]],["runs result","<run>",[]],["runs results","<run> [--after <resultId>]",["after"]],["runs read-result","<run> <result>",["pointer","offset","limit","max-bytes"]],["runs download-result","<run> <result>",[]],["runs cancel","<run>",[]],["publish","<flow>",[...Eu,"expected-publication","timeout"]],["publications list","<flow>",Ou],["publications show","<flow> <publication>",[]],["publications wait","<flow> <operation>",["timeout"]],["publications operation","<flow> <operation>",[]],["rollback","<flow> <publication>",["expected-publication","idempotency-key"]],["open","[flow]",[]],["workbench","[flow]",[]],["schema","[read|search|edit|check|node-type]",["flow","input"]]],VC={scope:{description:"Required State scope; never defaults to live.",type:"string",enum:["draft","live"]},key:{description:"Business state key; omit to clear all business values.",type:"string"},space:{description:"Deduplication space: flow or node:<nodeId>.",type:"string"},revision:{description:"Exact Revision to read or check; defaults to the current Draft.",type:"string"},publication:{description:"Exact Publication ID whose fixed Code connections are read; defaults to the Draft.",type:"string"},pointer:{description:"JSON Pointer within the stored result; defaults to the root.",type:"string"},offset:{description:"Page offset at the selected pointer.",type:"integer",minimum:0,default:0},"max-bytes":{description:"Maximum result page bytes.",type:"integer",minimum:1,maximum:1048576,default:15000},"expected-revision":{description:"Base Revision ID from read. Required with an explicit idempotency key for draft edits and draft runs.",type:"string"},"expected-publication":{description:"Fixed Publication ID. Use none when publishing without a Live Publication.",type:"string"},"idempotency-key":{description:"Stable identity of one mutation. Reuse only with the identical arguments and base identity.",type:"string"},source:{description:"Execution source.",type:"string",enum:["draft","live"],default:"draft"},trigger:{description:"Exact Trigger ID or unambiguous name. The Start node is selected automatically; a sole legacy Manual Trigger remains supported.",type:"string"},timeout:{description:"Wait budget in milliseconds; expiration does not cancel the operation. For node set, the node execution timeout.",type:"integer",minimum:1,default:60000},limit:{description:"Maximum items in one page.",type:"integer",minimum:1,maximum:100,default:100},after:{description:"Resume events after this sequence number; use nextAfter from the preceding response.",type:"integer",minimum:0,default:0},cursor:{description:"Opaque nextCursor from the preceding page; keep the same filters.",type:"string"},comment:{description:"Optional plain-text Wait decision comment (up to 2,000 Unicode code points).",type:"string"},"pending-wait":{description:"List runs with unresolved waits, including running and queued runs.",type:"boolean"},status:{description:"Filter runs by status.",type:"string",enum:["queued","starting","running","waiting","completed","failed","canceled","indeterminate"]},file:{description:"Authoring request or workflow JSON file path, or - for stdin.",type:"string"},code:{description:"JavaScript source, @file, or - for stdin.",type:"string"},input:{description:"Authoring request JSON; literal JSON, @file, or -. For run, node ID to input values.",type:"string"},outputs:{description:"Start parameters or other Trigger outputs: literal JSON, @file, or -. Defaults to {}.",type:"string"},set:{description:"handle=value; repeat for multiple fields. Values use port schemas, JSON, @file, or -.",type:"string"},unset:{description:"Input/config handle to remove; repeat for multiple fields.",type:"string"},connection:{description:"Exact active Connection ID, unambiguous display name, or default.",type:"string"},flow:{description:"Exact Flow ID or unambiguous name; fixes Connector Team scope.",type:"string"},name:{description:"Display name.",type:"string"},description:{description:"Trigger description.",type:"string"},cron:{description:"Cron expression; combine with --timezone. Mutually exclusive with --every.",type:"string"},timezone:{description:"IANA time zone for --cron.",type:"string"},every:{description:"Interval such as 5m, 1h, or 1d. Mutually exclusive with --cron.",type:"string"},wait:{description:"Wait until terminal, waiting for an action, or the wait budget expires."},follow:{description:"Stream event pages as NDJSON with --json; stop on terminal, Wait, or timeout."},full:{description:"Include complete Revision content, schemas, source code and revision metadata."},yes:{description:"Confirm the requested deletion."},json:{description:"Machine-readable JSON results and errors; NDJSON for followed events."},help:{description:"Show this command contract without contacting the host."}};function ju(e,t="oo flow"){let n=e.join(" ");return Gb.filter(([r])=>n==""||r==n||r.startsWith(`${n} `)).map(([r,o,i])=>({command:r,usage:`${t} ${r} ${o} [--json]`,options:[...i,"json","help"].map((s)=>Object.assign({name:`--${s}`,value:!["json","help","wait","follow","full","yes","pending-wait"].includes(s),repeatable:s=="set"||s=="unset"},VC[s],r=="runs results"&&s=="after"?{type:"string",minimum:void 0,default:void 0,description:"Result ID from nextAfter on the preceding page."}:{},r=="runs read-result"&&s=="limit"?{default:20}:{}))}))}function Hb(e){return Gb.find(([t])=>t==e.slice(0,t.split(" ").length).join(" "))?.[2]}function Qb(e="edits"){let t=Xl(e);if(t!=null)return t;if(e=="edits")return eu();if(e=="outputs")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",description:"Named Start parameters or other Trigger outputs. Start uses the workflow inputDefs returned by flow read; other triggers define their own output contracts. Omitted nullable Start parameters become null; required parameters must be supplied."};if(qi.includes(e))return eu(e);if(e=="input")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",additionalProperties:{type:"object",additionalProperties:!0},description:"Node ID -> input handle -> JSON value."};return}function _u(e){if(e=="canvas")return{request:yn(rn,{io:"input"}),guidance:"Broadcast transient viewport commands; success does not confirm execution. No Presentation save, offline queue or replay. Pan uses screen pixels; zoom is an absolute ratio (0.1\u20133); fit includes all nodes. Repeating pan moves again; do not automatically retry an uncertain response.",examples:[{type:"focus",nodeId:"NODE_ID"},{type:"zoom",zoom:0.8},{type:"pan",dx:200,dy:-100},{type:"fit"}]};return Xl(e)}function Yb(e,t="oo flow"){if(e=="export")return[`${t} export FLOW_ID > template.openflow.json`];if(e=="import")return[`${t} import --file template.openflow.json --name "Imported workflow" --idempotency-key IMPORT_KEY --json`];if(e=="schema")return[`${t} schema read --json`,`${t} schema agent --json`,`${t} schema --flow FLOW_ID --input '{"action":"ACTION_ID"}' --json`];let n=_u(e);if(n==null)return LC(t);if(e=="check")return[`${t} check FLOW_ID --revision REVISION --json`];return n.examples.map((r)=>`${t} ${e} FLOW_ID${Object.keys(r).length==0?"":` --input '${JSON.stringify(r)}'`} --json`)}function LC(e){return[`${e} list --limit 20 --json`,`${e} read FLOW_ID --json`,`${e} live FLOW_ID --json`,`${e} schema code --json`,`${e} edit FLOW_ID --file edits.json --json`,`${e} connector search email --flow FLOW_ID --json`,`${e} run FLOW_ID --expected-revision REVISION_ID --idempotency-key RUN_KEY --wait --timeout 60000 --json`,`${e} runs wait RUN_ID --timeout 60000 --json`,`${e} runs resolve RUN_ID WAIT_ID approve --json`,`${e} runs events RUN_ID --after 0 --follow --timeout 60000 --json`]}import{basename as FC}from"path";async function Xb(e,t,n,r,o){let[i,s,a,...c]=n;switch(i){case"code-access":case"candidates":case"code-allow":case"code-remove":case"remove-usage":{let l=i=="code-access"?1:i=="candidates"?2:i=="remove-usage"?3:4;if(i=="candidates"?n.length<l+1:n.length!=l+1)throw new E("cli.invalid-arguments",`Invalid arguments for connector ${i}. See --help.`);let u=MC(t),d;if(i=="code-access")d=r.publication==null?await e.getConnectorAccess(u):await e.getPublishedConnectorAccess(u,r.publication);else if(i=="candidates")d=await e.listProviderAccessBindingCandidates(u,n.slice(2));else{let g=Number(n.at(-1));if(!Number.isSafeInteger(g)||g<0)throw new E("cli.invalid-arguments","Access revision must be a nonnegative integer.");if(i=="remove-usage"){let h=await Rb(e,t,r);d=await e.removeConnectionUsage(u,a,h.draft.revisionId,g,r.idempotencyKey)}else if(i=="code-allow")d=await e.addProviderAccessBinding(u,a,c[0],g);else d=await e.removeProviderAccessBinding(u,a,c[0],g)}M(o,r.json,{...d,kind:`connector.${i}`},JSON.stringify(d,null,2));return}case"providers":{if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector providers [--flow <flow>] [--json]`);let l=await e.listConnectorProviders(void 0,t?.flowId);M(o,r.json,{providers:l,kind:"connector.providers",version:1},l.map((u)=>`${u.serviceName} ${u.serviceId}`).join(`
|
|
65
|
+
`));return}case"teams":{if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector teams [--json]`);let l=await e.listConnectorTeams();M(o,r.json,{...l,kind:"connector.teams"},l.teams.map((u)=>`${u.name} ${u.id}`).join(`
|
|
66
|
+
`));return}case"search":{if(s==null||a!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector search <query> [--json]`);let l=s.trim();if(l.length==0||l.length>256)throw new E("cli.invalid-arguments","Connector search query must contain 1\u2013256 characters.");let u=await e.searchConnectorActions(l,void 0,t?.flowId);M(o,r.json,{actions:u.map(uu),kind:"connector.search",query:l,version:1},u.map(xu).join(`
|
|
67
|
+
`));return}case"show":{if(s==null||a!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector show <action> [--json]`);let l=await Ab(e,s,t?.flowId);M(o,r.json,{action:l,kind:"connector.show",version:1},xu(l));return}case"connections":{if(s==null||a!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector connections <service> [--json]`);let l=await e.listConnectorConnections(s,void 0,t?.flowId);M(o,r.json,{connections:l,kind:"connector.connections",serviceId:s,version:1},l.map($b).join(`
|
|
68
|
+
`));return}default:throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector <providers|teams|search|show|connections> ...`)}}async function ew(e,t,n,r){let[o,i,s]=t;switch(o){case"search":{if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger search [query] [--json]`);let a=i?.trim().toLowerCase();if(a!=null&&(a.length==0||a.length>256))throw new E("cli.invalid-arguments","Trigger search query must contain 1\u2013256 characters.");let c=fu(await e.listTriggerKeys(),a);M(r,n.json,{keys:c,kind:"trigger.search",query:a,version:1},c.map(vu).join(`
|
|
69
|
+
`));return}case"show":{if(i==null||s!=null)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger show <key> [--json]`);let a=await Tb(e,i);M(r,n.json,{definition:a,kind:"trigger.show",version:1},vu(a));return}default:throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger <search|show> ...`)}}function MC(e){if(e==null)throw new E("cli.invalid-arguments","A Flow reference is required.");return e.flowId}function os(e){if(e.publication==null)return`not-published ${e.flowId}`;return[`live ${e.flowId} ${e.publication.publicationId} ${e.publication.revisionId} ${e.status} enabled=${e.enabled}`,`inputDefs=${JSON.stringify(e.inputDefs)}`,...e.entries.flatMap((t)=>[`${t.type} ${t.nodeId} ${t.name}`,..."binding"in t?[` health=${t.binding.health}${t.binding.lastErrorCode==null?"":` error=${t.binding.lastErrorCode}`}`,...t.binding.listener==null?[]:[` listener=${JSON.stringify(t.binding.listener)}`],...t.binding.endpointUrl==null?[]:[` url=${t.binding.endpointUrl}`]]:[],..."provider"in t?[` provider=${t.provider} inputs=${JSON.stringify(t.inputs)}`]:[],` config=${JSON.stringify(t.config)}`])].join(`
|
|
70
|
+
`)}async function tw(e,t,n,r){le(t,1,`${r.commandPrefix??"oo flow"} run <flow> [--source draft|live] [--trigger <name|id>] [--outputs <json|@file|->] [--input <json|@file|->] [--wait] [--json]`);let o=await ve(e,t[0]),i=await Db(n,r),s=n.source=="live"?n.expectedPublication==null?await e.getLive(o.flowId):{publication:await to(e,o.flowId,n.expectedPublication)}:void 0;if(n.source=="live"&&s?.publication==null)throw new E("live.not-found",`Flow ${JSON.stringify(t[0])} has no Live Publication.`);let a=s?.publication?.revisionId??n.expectedRevision??o.draftRevisionId,c=await e.getRevision(o.flowId,a),l=Object.entries(c.content.document.graph.nodes).filter(([,q])=>!("inputs"in q)),u=l.filter(([,q])=>q.kind=="start"),d=u.length==1?u[0][0]:l.length==1&&l[0]?.[1].kind=="manual"?l[0][0]:void 0,g=n.trigger??d;if(g==null)throw new E("run.trigger-required","Choose a start node with --trigger <name|id>.",{candidates:l.map(([q,V])=>({triggerId:q,name:V.name}))});let h=Pb(c.content,g),y={};if(n.outputs!=null){let q=await St(n.outputs,"--outputs","run.input-unreadable",r);try{let V=JSON.parse(q);if(V==null||typeof V!=="object"||Array.isArray(V))throw Error("Expected output object.");y=V}catch{throw new E("run.input-invalid","Trigger outputs must be valid JSON.")}}let S={nodeId:h.triggerId,outputs:y},R;if(s?.publication!=null)R=await e.createLiveRun(s.publication.publicationId,{inputs:i,trigger:S,idempotencyKey:n.idempotencyKey});else R=await e.createDraftRun(o.flowId,a,{inputs:i,trigger:S,idempotencyKey:n.idempotencyKey});let N=n.wait?await ku(e,R,r,n.timeoutMs):{run:R,timedOut:!1};return M(r,n.json,{kind:"run.create",idempotencyKey:n.idempotencyKey,...N,version:1},eo(N.run)),no(N.run,N.timedOut)}async function nw(e,t,n,r){let[o,...i]=t;switch(o){case"list":{if(le(i,0,`${r.commandPrefix??"oo flow"} runs list --flow <flow> [--status <status>] [--pending-wait] [--cursor <cursor>] [--limit <count>] [--json]`),n.flow==null)throw new E("cli.invalid-arguments",`${r.commandPrefix??"oo flow"} runs list requires --flow <flow>.`);let s=await ve(e,n.flow),a=await e.listRuns(s.flowId,{...n.cursor==null?{}:{cursor:n.cursor},limit:n.limit??wu,...n.status==null?{}:{status:n.status},...n.pendingWait==null?{}:{pendingWait:n.pendingWait}});M(r,n.json,{kind:"run.list",...a,version:1},a.runs.map(Nb).join(`
|
|
71
|
+
`));return}case"show":{le(i,1,`${r.commandPrefix??"oo flow"} runs show <run> [--json]`);let s=await e.getRun(i[0]);M(r,n.json,{kind:"run.show",run:s,version:1},eo(s));return}case"wait":{le(i,1,`${r.commandPrefix??"oo flow"} runs wait <run> [--timeout <milliseconds>] [--json]`);let s=i[0],a=Date.now()+(n.timeoutMs??60000);try{let c=await e.getRun(s,AbortSignal.timeout(n.timeoutMs??60000)),l=await ku(e,c,r,Math.max(0,a-Date.now()));return M(r,n.json,{kind:"run.wait",runId:s,...l,version:1},eo(l.run)),no(l.run,l.timedOut)}catch(c){if(Date.now()>=a||c instanceof Error&&c.name=="TimeoutError")return M(r,n.json,{kind:"run.wait",runId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(c instanceof E)throw c;throw new E("run.wait-failed",c instanceof Error?c.message:String(c),{runId:s})}}case"resolve":{le(i,3,`${r.commandPrefix??"oo flow"} runs resolve <run> <wait> <continue|approve|reject> [--comment <text>] [--json]`);let[s,a,c]=i;if(c!="continue"&&c!="approve"&&c!="reject")throw new E("cli.invalid-arguments","Invalid Wait action.");let l=await e.resolveRunWait(s,a,c,n.comment);M(r,n.json,{kind:"run.resolve",resolution:l,version:1},JSON.stringify(l));return}case"events":{le(i,1,`${r.commandPrefix??"oo flow"} runs events <run> [--after <sequence>] [--limit <count>] [--follow] [--timeout <milliseconds>] [--json]`);let s=i[0],a=n.after??0,c=Date.now()+(n.timeoutMs??60000),l;try{do{if(n.follow&&Date.now()>=c)break;let u=await e.getRunEvents(s,{after:a,limit:n.limit??wu},n.follow?AbortSignal.timeout(Math.max(1,c-Date.now())):void 0);if(a=u.nextAfter,M(r,n.json,{...u,kind:"run.events",runId:s,version:1},u.events.map(zb).join(`
|
|
72
|
+
`)),!n.follow)return;if(l=await e.getRun(s,AbortSignal.timeout(Math.max(1,c-Date.now()))),_b(u.events.at(-1)))return no(l);if(n.after!=null&&u.events.length==0&&u.done)return no(l);if(l.waits.length>0)return M(r,n.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!1,version:1},eo(l)),2;let d=c-Date.now();if(d<=0)break;if(u.events.length==0)await r.wait(Math.min(1000,d))}while(n.follow)}catch(u){if(!n.follow||Date.now()<c&&!(u instanceof Error&&u.name=="TimeoutError"))throw new E("run.events-failed",u instanceof Error?u.message:String(u),{runId:s,nextAfter:a})}return M(r,n.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!0,version:1},`timeout ${s} ${a}`),3}case"results":{le(i,1,`${r.commandPrefix??"oo flow"} runs results <run> [--after <resultId>]`);let s=await e.listRunResults(i[0],n.resultAfter);M(r,n.json,{kind:"run.results",...s},JSON.stringify(s));return}case"read-result":{le(i,2,`${r.commandPrefix??"oo flow"} runs read-result <run> <result> [--pointer <pointer>] [--offset <offset>] [--limit <limit>] [--max-bytes <bytes>]`);let s=await e.readRunResult(i[0],i[1],{pointer:n.pointer??"",offset:n.offset??0,...n.limit==null?{}:{limit:n.limit},...n.maxBytes==null?{}:{maxBytes:n.maxBytes}});M(r,n.json,{kind:"run.result-page",...s},JSON.stringify(s));return}case"download-result":{le(i,2,`${r.commandPrefix??"oo flow"} runs download-result <run> <result>`);let s=await e.downloadRunResult(i[0],i[1]);r.stdout.write(await s.text());return}case"result":{le(i,1,`${r.commandPrefix??"oo flow"} runs result <run> [--json]`);let s=await e.getRunResult(i[0]);return M(r,n.json,{kind:"run.result",result:s,version:1},JSON.stringify(s)),s.status=="completed"?0:1}case"cancel":{le(i,1,`${r.commandPrefix??"oo flow"} runs cancel <run> [--json]`);let s=await e.cancelRun(i[0]);M(r,n.json,{cancellation:s,kind:"run.cancel",version:1},`${s.status} ${s.runId} ${s.cancelAccepted?"accepted":"already-terminal"}`);return}default:throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} runs <list|show|wait|resolve|events|result|results|read-result|download-result|cancel>`)}}async function rw(e,t,n,r){le(t,1,`${r.commandPrefix??"oo flow"} publish <flow> [--json]`);let o=await ve(e,t[0]),i=n.expectedPublication=="none"?null:n.expectedPublication??(await e.getLive(o.flowId)).publication?.publicationId??null,s=await e.publishFlow(o.flowId,n.expectedRevision??o.draftRevisionId,i,{idempotencyKey:n.idempotencyKey}),a=await Su(e,o.flowId,s,r,n.timeoutMs);if(s=a.operation,s.status=="pending")return M(r,n.json,{kind:"publication.publish",expectedPublicationId:i,idempotencyKey:n.idempotencyKey,flowId:o.flowId,...a,version:1},JSON.stringify(s)),3;if(s.status=="failed")throw new E(s.issue.code,s.issue.message,{...s.issue.nodeId==null?{}:{nodeId:s.issue.nodeId},operationId:s.operationId,flowId:o.flowId,idempotencyKey:n.idempotencyKey});let c=[],l=`${r.commandPrefix??"oo flow"} live ${o.flowId} --json`,u;try{if(u=await e.getLiveDetails(o.flowId),u.publication?.publicationId!=s.publicationId)c.push({code:"live.publication-changed",message:`Publication ${s.publicationId} succeeded. Current Live is ${u.publication?.publicationId??"not-published"}; the returned entries describe that current version.`})}catch{c.push({code:"live.details-read-failed",message:`Publication ${s.publicationId} succeeded, but its current online entries could not be read. Query ${l}.`})}let d=u?.publication?.publicationId==s.publicationId?u.publication:void 0;if(d==null)try{d=await to(e,o.flowId,s.publicationId)}catch{c.push({code:"publication.read-failed",message:`Publication ${s.publicationId} succeeded, but its metadata could not be read. Query ${l}.`})}M(r,n.json,{kind:"publication.publish",expectedPublicationId:i,idempotencyKey:n.idempotencyKey,operation:s,...d==null?{}:{publication:d},...u==null?{}:{live:u},...c.length==0?{}:{warnings:c},version:1},[d==null?`published ${s.publicationId} ${s.revisionId}`:Xr(d),...u==null?[]:[os(u)],...c.map((g)=>`Warning: ${g.message}`)].join(`
|
|
73
|
+
`))}async function ow(e,t,n,r){let[o,i,s,...a]=t;if(i==null||a.length>0)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`);let c=await ve(e,i);if(o=="list"){if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications list <flow> [--cursor <cursor>] [--limit <count>]`);let l=await e.listPublications(c.flowId,{...n.cursor==null?{}:{cursor:n.cursor},limit:n.limit??bu});M(r,n.json,{flow:c,kind:"publication.list",...l,version:1},l.publications.map(Xr).join(`
|
|
74
|
+
`));return}if((o=="operation"||o=="wait")&&s!=null){let l=Date.now()+(n.timeoutMs??60000);try{let u=await e.getPublishOperation(c.flowId,s,o=="wait"?AbortSignal.timeout(n.timeoutMs??60000):void 0),d=o=="wait"?await Su(e,c.flowId,u,r,Math.max(0,l-Date.now())):{operation:u,timedOut:!1};return M(r,n.json,{kind:`publication.${o}`,flowId:c.flowId,...d,version:1},JSON.stringify(d.operation)),d.operation.status=="failed"?1:d.operation.status=="pending"?3:0}catch(u){if(o=="wait"&&(Date.now()>=l||u instanceof Error&&u.name=="TimeoutError"))return M(r,n.json,{kind:"publication.wait",flowId:c.flowId,operationId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(u instanceof E)throw u;throw new E("publication.wait-failed",u instanceof Error?u.message:String(u),{flowId:c.flowId,operationId:s})}}if(o=="show"&&s!=null){let l=await to(e,c.flowId,s);M(r,n.json,{kind:"publication.show",publication:l,version:1},Xr(l));return}throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`)}async function iw(e,t,n,r){le(t,2,`${r.commandPrefix??"oo flow"} rollback <flow> <publication> [--json]`);let o=await ve(e,t[0]),i=await to(e,o.flowId,t[1]),s=n.expectedPublication??(await e.getLive(o.flowId)).publication?.publicationId;if(s==null)throw new E("live.not-found",`Flow ${JSON.stringify(t[0])} has no Live Publication.`);let a=await e.rollbackFlow(o.flowId,i.publicationId,s,{idempotencyKey:n.idempotencyKey});M(r,n.json,{kind:"publication.rollback",expectedPublicationId:s,idempotencyKey:n.idempotencyKey,publication:a,version:1},Xr(a))}async function sw(e,t,n,r){let[o,...i]=n.positionals;switch(o){case"state":case"dedupe":{if(le(i,2,`${r.commandPrefix??"oo flow"} ${o} <show|clear> <flow> --scope <draft|live>`),n.scope!=="draft"&&n.scope!=="live")throw new E("cli.invalid-arguments","Explicit --scope draft or --scope live is required.");let[s,a]=i;if(s!=="clear"&&!(o==="state"&&s==="show"))throw new E("cli.invalid-arguments","Unknown State operation.");if(s==="clear"&&!n.yes)throw new E("cli.invalid-arguments","Clearing State requires --yes.");let c=await ve(e,a);if(s==="show"){let l=await e.getFlowState(c.flowId,n.scope,n.full);M(r,n.json,{kind:"flow.state",...l},JSON.stringify(l,null,2))}else{if(o==="state")await e.clearFlowState(c.flowId,n.scope,n.key);else{if(n.space==null)throw new E("cli.invalid-arguments","--space is required.");await e.clearFlowDedupe(c.flowId,n.scope,n.space)}M(r,n.json,{kind:"flow.state.cleared",scope:n.scope},`Cleared ${n.scope} ${o}.`)}return}case"canvas":{if(le(i,1,`${r.commandPrefix??"oo flow"} canvas <flow> (--input JSON|@file|- | --file path|-) [--json]`),n.file!=null&&n.input!=null)throw new E("cli.invalid-arguments","Choose --input or --file.");let s=n.file==null?n.input:n.file=="-"?"-":`@${n.file}`;if(s==null)throw new E("cli.invalid-arguments","Canvas requires --input or --file.");let a=rn.safeParse(JSON.parse(await St(s,"input","flow.authoring-unreadable",r)));if(!a.success)throw new E("cli.invalid-arguments",a.error.message);let c=await ve(e,i[0]),l=await e.broadcastCanvas(c.flowId,a.data);M(r,n.json,{...l,kind:"flow.canvas"},`Broadcast canvas ${a.data.type} for ${c.flowId}; execution is not confirmed.`);return}case"read":case"search":case"edit":{le(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> [--input JSON|@file|-] [--file path|-] --json`);let s=await ve(e,i[0]);if(n.file!=null&&n.input!=null)throw new E("cli.invalid-arguments","Choose --input or --file.");let a=n.file==null?n.input:n.file=="-"?"-":`@${n.file}`,c=a==null?{}:JSON.parse(await St(a,"input","flow.authoring-unreadable",r)),l=o=="read"?await e.readAuthoring(s.flowId,rs.authoringRead(c)):o=="search"?await e.searchAuthoring(s.flowId,rs.authoringSearch(c)):await e.editAuthoring(s.flowId,rs.authoringEdit(c));r.stdout.write(`${JSON.stringify(l)}
|
|
75
|
+
`);return}case"connector":{let a=["code-access","candidates","code-allow","code-remove","remove-usage"].includes(i[0]??"")?await ZC(e,i.slice(1)):n.flow==null?void 0:await ve(e,n.flow);return await Xb(e,a,i,n,r)}case"event-source":{if(i.length!=1||i[0]!="list")throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} event-source list [--json]`);let s=await e.listEventSources(),a=`No event sources are visible to this identity. Run "${r.commandPrefix??"oo flow"} workbench" to create and verify a Feishu event source, then list again.`;M(r,n.json,{...s,kind:"event-source.list",...s.sources.length==0?{guidance:a}:{}},s.sources.length==0?a:s.sources.map((c)=>[c.sourceId,c.name,c.teamId??"-",c.connectionId,!c.enabled?"disabled":c.verifiedAt==null?"unverified":"verified",c.eventTypes.join(",")].join("\t")).join(`
|
|
76
|
+
`));return}case"run":return await tw(e,i,n,r);case"runs":return await nw(e,i,n,r);case"publish":return await rw(e,i,n,r);case"publications":return await ow(e,i,n,r);case"rollback":return await iw(e,i,n,r);case"trigger":return await ew(e,i,n,r);case"open":case"workbench":{if(i.length>1)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} ${o} [flow] [--json]`);if(t.getWorkbenchUrl==null)throw new E("workbench.unavailable","This CLI host cannot provide a Workbench URL.");let s=i[0]==null?void 0:await ve(e,i[0]),a=await t.getWorkbenchUrl(s?.flowId);if(o=="open")await r.openUrl(a);M(r,n.json,{...s==null?{}:{flow:s},kind:`flow.${o}`,url:a,version:1},a);return}case"list":{le(i,0,`${r.commandPrefix??"oo flow"} list [--json]`);let s=await e.listFlows({cursor:n.cursor,limit:n.limit??100});M(r,n.json,{...s,kind:"flow.list",version:1},s.flows.map(Lt).join(`
|
|
77
|
+
`));return}case"export":{le(i,1,`${r.commandPrefix??"oo flow"} export <flow>`);let s=await ve(e,i[0]);r.stdout.write(By(await e.exportFlow(s.flowId)));return}case"import":{if(le(i,0,`${r.commandPrefix??"oo flow"} import --file <path|-> [--name name] [--json]`),n.file==null)throw new E("cli.invalid-arguments","Import requires --file <path|->.");let s=Uy(await St(n.file=="-"?"-":`@${n.file}`,"file","flow.import-unreadable",r)),a=n.name??s.name??(n.file=="-"?Ju(r.language??"en"):Ky(FC(n.file))),c=await e.importFlow(s,{name:ns(a,"Flow"),idempotencyKey:n.idempotencyKey});M(r,n.json,{flow:c,idempotencyKey:n.idempotencyKey,kind:"flow.import",version:1},Lt(c));return}case"create":{le(i,1,`${r.commandPrefix??"oo flow"} create <name> [--json]`);let s=await e.createFlow(ns(i[0],"Flow"),n.idempotencyKey);M(r,n.json,{flow:s,idempotencyKey:n.idempotencyKey,kind:"flow.create",version:1},Lt(s));return}case"live":{le(i,1,`${r.commandPrefix??"oo flow"} live <flow> [--json]`);let s=await ve(e,i[0]),a=await e.getLiveDetails(s.flowId);M(r,n.json,{kind:"flow.live",live:a,version:1},os(a));return}case"show":{le(i,1,`${r.commandPrefix??"oo flow"} show <flow> [--json]`);let s=await ve(e,i[0]);M(r,n.json,{flow:s,kind:"flow.show",version:1},Lt(s));return}case"rename":{le(i,2,`${r.commandPrefix??"oo flow"} rename <flow> <new-name> [--json]`);let s=await ve(e,i[0]),a=await e.renameFlow(s.flowId,ns(i[1],"Flow"));M(r,n.json,{flow:a,kind:"flow.rename",version:1},Lt(a));return}case"delete":{if(le(i,1,`${r.commandPrefix??"oo flow"} delete <flow> --yes [--json]`),!n.yes)throw new E("flow.confirmation-required","Flow deletion requires --yes.");let s=await ve(e,i[0]),a=await e.deleteFlow(s.flowId);M(r,n.json,{flow:a,kind:"flow.delete",version:1},Lt(a));return}case"enable":case"disable":{if(le(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> --expected-publication <publicationId>`),n.expectedPublication==null||n.expectedPublication=="none")throw new E("cli.invalid-arguments","--expected-publication must identify the observed Live publication.");let s=await ve(e,i[0]),a=await e.setFlowEnabled(s.flowId,n.expectedPublication,o=="enable");M(r,n.json,{flow:a,kind:`flow.${o}`,version:1},Lt(a));return}case"check":{le(i,1,`${r.commandPrefix??"oo flow"} check <flow> [--revision <revisionId>] [--json]`);let s=await ve(e,i[0]),a=n.revision??s.draftRevisionId,c=await e.checkAuthoring(s.flowId,a);return M(r,n.json,{check:c,valid:c.valid,revisionId:a,kind:"flow.check",scope:"revision",version:1},`${c.valid?"valid":"invalid"} revision ${s.name} ${s.flowId}`),c.valid?0:1}default:throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} <list|create|show|live|read|search|edit|canvas|schema|rename|delete|check|enable|disable|connector|event-source|trigger|run|runs|publish|publications|rollback|workbench>`)}}async function ZC(e,t){let n=t[0];if(n==null)throw new E("cli.invalid-arguments","A Flow reference is required.");return await ve(e,n)}var Fn={};var cw=(e)=>e,is=Object.is,JC=(e,t)=>{if(is(e,t))return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let n=e.length;if(t.length!==n)return!1;for(let r=0;r<n;r++)if(!is(e[r],t[r]))return!1;return!0},UC=(e)=>e.value,BC=(e)=>e.map(UC),KC=(e)=>e.$version,ss=(e,t)=>{try{e(t)}catch(n){console.error(n)}},lw=(e,t)=>(e.set=t,e);var WC=Promise.resolve(),Ru=new Set,GC=new Set,io=Ru,Au,HC=()=>{let e=io;io=io===Ru?GC:Ru,Au=!1;for(let t of e)t.t();e.clear()},QC=(e)=>{io.add(e),Au=Au||WC.then(HC)},YC=(e)=>io.delete(e);var aw=new FinalizationRegistry(ss),uw=class{constructor(e,t,n){if(this.#r=e,this.q=(t?.equal??is)||void 0,this.e=t?.eager,this.m=t?.name,this.#t=t?.onDisposeValue,n){let r=new WeakRef(this),o=()=>{if(i){let s=i;i=void 0,s()}},i=n(()=>{let s=r.deref();if(s)s.n();else o()});if(i)aw.register(this,this.#e=o)}}g=this;b=new Map;s=4;v;c=Fn;q;e;m;u=()=>{if(this.s&4){this.s&=-5;let e=this.#r();if(this.c===Fn)this.w(e);else if(!this.q?.(e,this.c)){if(this.w(e),this.s&1)this.s|=2}}return this.c};n=()=>{if(this.#o)console.error(this.c,Error(`${this.m||""} disposed`));if(this.s|=4,this.b.size){if(this.s|=1,this[3])this.#n(3);if(this[2]){if(this.u(),this.s&2)this.#n(2)}if(this[1])QC(this);else this.s&=-4}};a(e,t){let n=this.b.get(e);if(n)this[n]--;return this.b.set(e,t),this[t]++,()=>this.r(e)}r(e){if(e){let t=this.b.get(e);if(t)this.b.delete(e),this[t]--}else this.b.clear(),this[1]=this[2]=this[3]=0,YC(this)}t(){if(this[1]){if(this.u(),this.s&2)this.#n(1)}this.s&=-4}d(){let e=this.c;if(this.r(),aw.unregister(this),this.#e?.(),this.#o=!0,this.#t&&e!==Fn)this.#t(e)}w(e){this.w=this.q?.(e,e)?this.y:this.x,this.w(e)}x(e){let t=this.c;if(this.c=e,this.v=Symbol(),this.#t&&t!==Fn&&t!==e)this.#t(t)}y(e){let t=this.c;if(this.c=this.v=e,this.#t&&t!==Fn&&t!==e)this.#t(t)}[1]=0;[2]=0;[3]=0;#e;#t;#r;#n(e){for(let[t,n]of this.b)if(n===e)ss(t,this.c)}#o},XC=class{#e=new WeakSet;constructor(e){this.g=e.g,this.e=e.e,this.u=e.u,this.n=e.n,this.b=e.b}get v(){return this.g.v}g;b;e;u;n;a(e,t){return this.#e.add(e),this.g.a(e,t)}r(e){if(e){if(this.#e.has(e))this.#e.delete(e),this.g.r(e)}else for(let t of this.g.b.keys())this.r(t)}d(){this.r()}},Pu=class{#e;constructor(e){this.#e=e,this.get=e.u,e.u()}get name(){return this.#e.m}get $version(){return this.get(),this.#e.v}get value(){return this.get()}set value(e){this.set?.(e)}set;get;ref(e){let t=new Pu(new XC(this.#e));return e&&this.set?lw(t,this.set):t}reaction(e,t=this.#e.e){return this.#e.a(e,t?2:1)}subscribe(e,t=this.#e.e){let n=this.reaction(e,t);return ss(e,this.get()),n}$valCompute(e){return this.#e.a(e,3)}unsubscribe(e){this.#e.r(e)}dispose(){this.#e.d()}toString(){return String(this.get())}toJSON(e){let t=this.get();return t&&t.toJSON?t.toJSON(e):t}},eE=(e,t)=>{let n=e,o=new uw(()=>n,t),i=(a)=>{if(!o.q?.(a,n))n=a,o.n()};return[new Pu(o),i]},Tu=(e,t)=>lw(...eE(e,t));var dw=(e,t,n)=>new Pu(new uw(e,n,t)),pw=(e,t=cw,n)=>{let r,o;return dw(()=>{let i=e.map(KC);if(!o||!JC(i,o))o=i,r=t(BC(e));return r},(i)=>{let s=e.map((a)=>a.$valCompute(i));return()=>s.forEach(ss)},n)};var $u=(e,t=cw,n)=>{let r,o=Fn;return dw(()=>{let i=e.$version;if(!is(i,o))o=i,r=t(e.value);return r},(i)=>e.$valCompute(i),n)};var fw=(e,t={},n="")=>{for(let[r,o]of Object.entries(e))if(typeof o==="string")t[n+r]=o;else fw(o,t,n+r+".");return t},tE=(e)=>{let t=[],n=[],r=/{{(\S+?)}}/gi,o,i=0;while(o=r.exec(e))t.push(e.slice(i,o.index),""),n.push(o[1]),i=o.index+o[0].length;if(t.push(e.slice(i)),n.length<=0)return!1;return(s)=>{for(let a=n.length-1;a>=0;a--)t[a*2+1]=s[n[a]]??n[a];return t.join("")}},mw=class e{constructor(t,n,r){this.t=(i,s)=>this.t$.get()(i,s),this.fetcher=r?.fetcher;let o=new Map;this.locales$=Tu(n),this.lang$=Tu(t),this.locale$=pw([this.lang$,this.locales$],([i,s])=>s[i]||{}),this.a=$u(this.locale$,fw),this.t$=$u(this.a,(i)=>((s,a,c)=>{if(c){let l=c["@"];if(l!=null){let u=`${a}@${l}`;if(s[u])a=u}else{let u=c[":option"];if(u!=null){let d;a=s[d=`${a}.${u}`]||s[d=`${a}.other`]?d:a}}if(s[a]){let u=o.get(a);if(u??o.set(a,u=tE(s[a])),u)return u(c)}}return s[a]||a}).bind(o.clear(),i))}static async preload(t,n){return new e(t,{[t]:await n(t)},{fetcher:n})}get lang(){return this.lang$.value}get locales(){return this.locales$.value}get locale(){return this.locale$.value}async switchLang(t){if(!this.locales$.value[t]&&this.fetcher)this.addLocale(t,await this.fetcher(t));this.lang$.set(t)}hasKey(t){return!!this.a.value[t]}addLocale(t,n){this.locales$.set({...this.locales,[t]:n})}dispose(){this.lang$.dispose(),this.t$.dispose(),this.locales$.dispose(),this.locale$.dispose(),this.a.dispose()}};var gw={help:{usage:"Usage: {{command}}",title:"Open Flow commands",options:"Options: --json, --cursor <cursor>, --limit <count>"}};var hw={help:{usage:"Utilisation : {{command}}",title:"Commandes Open Flow",options:"Options : --json, --cursor <cursor>, --limit <count>"}};var yw={help:{usage:"\u4F7F\u3044\u65B9\uFF1A{{command}}",title:"Open Flow \u30B3\u30DE\u30F3\u30C9",options:"\u30AA\u30D7\u30B7\u30E7\u30F3\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var bw={help:{usage:"\uC0AC\uC6A9\uBC95: {{command}}",title:"Open Flow \uBA85\uB839\uC5B4",options:"\uC635\uC158: --json, --cursor <cursor>, --limit <count>"}};var ww={help:{usage:"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435: {{command}}",title:"\u041A\u043E\u043C\u0430\u043D\u0434\u044B Open Flow",options:"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B: --json, --cursor <cursor>, --limit <count>"}};var vw={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9009\u9879\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var xw={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9078\u9805\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var lE={en:gw,"zh-CN":vw,"zh-TW":xw,ja:yw,ko:bw,ru:ww,fr:hw},uE=Object.fromEntries(gs.map((e)=>[e,lE[e]]));function kw(e=Fu){return new mw(lo([e]),uE)}function dE(e,t){let n=t.filter((i)=>!i.startsWith("-")),r=ju(n,e.commandPrefix);while(r.length==0&&n.length>0)n.pop(),r=ju(n,e.commandPrefix);let o=kw(e.language);try{let i=r.length==1?_u(r[0].command):void 0,s=Yb(r.length==1?r[0].command:"",e.commandPrefix),a={kind:"cli.help",version:1,commands:r.length==1?r:r.map(({command:c,usage:l})=>({command:c,usage:l})),...i==null?{}:{request:i.request},examples:s,exitCodes:{0:"Success or accepted asynchronous operation.",1:"Error or unsuccessful terminal Run.",2:"Run is waiting for an explicit action; inspect run.waits.",3:"Waiting timed out or publication is pending; the operation continues."},notes:i==null?[...e.scopeGuidance??["The oo host selects the team for the whole invocation with --team <name>; Flow commands use that authenticated scope."],"--timeout is a wait budget in milliseconds (default 60000).","--follow --json writes NDJSON pages immediately; resume from nextAfter.","Use read/search to locate nodes, schema read|search|edit|check for requests, and schema <type> for configuration and ports.","Use edit with baseRevision, requestId and an ordered edits array. Read selected text before an exact text.edit.","Retry mutations with the same idempotency key, fixed revision/publication and identical arguments."]:[i.guidance,...r[0].command=="check"?[]:["Use either --input (literal JSON, @file, or - for stdin) or --file (path or -), never both."]]};return t.includes("--json")?JSON.stringify(a):[o.t("help.title"),"",...r.map((c)=>r.length!=1?c.usage:`${c.usage}
|
|
78
78
|
Options: ${c.options.map((l)=>l.name+(l.value?" <value>":"")+(l.description==null?"":`: ${l.description}`)).join(`
|
|
79
79
|
`)}`),"",o.t("help.options"),"",...a.notes,"",...s].join(`
|
|
80
|
-
`)}finally{o.dispose()}}function
|
|
81
|
-
`),0;r=
|
|
82
|
-
`),0}let s=new
|
|
83
|
-
`),0}return await
|
|
84
|
-
`);else
|
|
85
|
-
`);return 1}}async function
|
|
86
|
-
`:`${
|
|
87
|
-
`),0;return await
|
|
80
|
+
`)}finally{o.dispose()}}function pE(e){return e.length==0||e.includes("--help")||e.includes("-h")}function fE(e){return e.positionals[0]=="schema"&&e.flow==null}async function Sw(e,t,n){let r,o;try{if(pE(e))return n.stdout.write(`${dE(n,e)}
|
|
81
|
+
`),0;r=Vb(e);let i=Hb(r.positionals);if(i==null)throw new E("cli.invalid-arguments",`Unknown command. Use ${n.commandPrefix??"oo flow"} --help.`);for(let a of r.options)if(a!="json"&&!i.includes(a))throw new E("cli.invalid-arguments",`Option --${a} is not supported by this command.`);if(r.options.includes("idempotency-key")){let a=r.positionals[0]=="run"&&r.source=="live";if(i.includes("expected-revision")&&!a&&r.expectedRevision==null)throw new E("cli.invalid-arguments","An explicit idempotency key requires --expected-revision for a repeatable mutation.");if((a||r.positionals[0]=="publish"||r.positionals[0]=="rollback")&&r.expectedPublication==null)throw new E("cli.invalid-arguments","An explicit idempotency key requires --expected-publication (use none for the first publication).")}if(r.timeoutMs!=null&&r.positionals[0]=="run"&&!r.wait)throw new E("cli.invalid-arguments","--timeout requires --wait for run.");if(r.timeoutMs!=null&&r.positionals[0]=="runs"&&r.positionals[1]=="events"&&!r.follow)throw new E("cli.invalid-arguments","--timeout requires --follow for events.");if(r.positionals[0]=="run"&&(r.source=="live"&&r.expectedRevision!=null||r.source=="draft"&&r.expectedPublication!=null))throw new E("cli.invalid-arguments","Use --expected-revision for draft runs and --expected-publication for live runs.");if(fE(r)){if(r.positionals.length>2)throw new E("cli.invalid-arguments",`Usage: ${n.commandPrefix??"oo flow"} schema [read|search|edit|check|edits|node-type|input|outputs]`);let a=Qb(r.positionals[1]);if(a==null)throw new E("cli.invalid-arguments","Unknown schema. Use read, search, edit, check, or a node type such as agent or code.");return n.stdout.write(`${JSON.stringify(a)}
|
|
82
|
+
`),0}let s=new yu(async(a,c)=>{let l=new Headers(c?.headers).get("idempotency-key");return o=l==null?void 0:{path:a,idempotencyKey:l,...typeof c?.body=="string"?{request:JSON.parse(c.body)}:{}},await t.request(a,c)},"cli");if(r.positionals[0]=="schema"&&r.flow!=null){let a=r.input==null?{type:r.positionals[1]}:JSON.parse(await St(r.input,"input","flow.authoring-unreadable",n)),c=await ve(s,r.flow);return n.stdout.write(`${JSON.stringify(await s.authoringSchema(c.flowId,a))}
|
|
83
|
+
`),0}return await sw(s,t,r,n)??0}catch(i){let s;if(i instanceof E)s=i;else if(i instanceof Te)s=qb(i);else s=new E("flow.unexpected",i instanceof Error?i.message:String(i));if(o!=null&&(!(i instanceof Te)&&!(i instanceof E)||i instanceof Te&&i.code=="response.invalid"))s=new E("flow.mutation-outcome-unknown","The mutation outcome is unknown. Retry the exact request with the same idempotency key.",o);if(e.includes("--json"))n.stderr.write(`${JSON.stringify({error:{code:s.code,...s.details==null?{}:{details:s.details},message:s.message},version:1})}
|
|
84
|
+
`);else n.stderr.write(`${s.code}: ${s.message}
|
|
85
|
+
`);return 1}}async function yE(e){let t=process.platform=="darwin"?["open",e]:process.platform=="win32"?["rundll32","url.dll,FileProtocolHandler",e]:["xdg-open",e],n=mE(t[0],t.slice(1),{stdio:"ignore"});if(await new Promise((o,i)=>{n.once("error",i),n.once("exit",o)})!=0)throw Error("The system browser could not be opened.")}async function Iw(e,t,n){if(e.includes("--version")||e.includes("-v"))return process.stdout.write(e.includes("--json")?`${JSON.stringify({version:n.version})}
|
|
86
|
+
`:`${n.version}
|
|
87
|
+
`),0;return await Sw(e,{request:t.cloudRequest??(async()=>{throw new E("host.unavailable","Open Flow Control API is not configured in this CLI host.")}),getWorkbenchUrl:t.getWorkbenchUrl},{commandPrefix:n.commandPrefix,scopeGuidance:n.scopeGuidance,env:process.env,language:lo([t.language]),openUrl:yE,readFile:async(r)=>await gE(r,"utf8"),readStdin:async()=>{let r="";for await(let o of process.stdin)r+=String(o);return r},stderr:process.stderr,stdout:process.stdout,wait:async(r)=>await hE(r)})}async function Gz(e,t={}){return await Iw(e,t,{version:Mu})}export{Gz as runOpenFlowCommand};
|