@oomol-lab/open-flow 0.1.0-beta.81 → 0.1.0-beta.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +35 -0
  2. package/dist/browser/{FlowCanvas-CrsiDHK8.js → FlowCanvas-Dew2fmoT.js} +55 -274
  3. package/dist/browser/{createResourceDialog-CS3u9ga9.js → createResourceDialog-bdOJa5Zk.js} +2 -1
  4. package/dist/browser/{exportPng-BOPfjeEi.js → exportPng-Cjdb6COo.js} +2 -2
  5. package/dist/browser/{flowChanges-CFj5pL4Y.js → flowChanges-URBEd4DI.js} +2583 -71
  6. package/dist/browser/{flowWorkspace-BeQaeJ3e.js → flowWorkspace-BlXx-yAn.js} +440 -2578
  7. package/dist/browser/{markdownContent-CAG_CQfH.js → markdownContent-D8G_oNOe.js} +18 -41
  8. package/dist/browser/{markdownContent-frwDfQQU.js → markdownContent-IS8xXDoc.js} +18 -40
  9. package/dist/browser/preview.css +88 -80
  10. package/dist/browser/preview.js +150 -60
  11. package/dist/browser/ui.css +8 -0
  12. package/dist/browser/{dist-CHwj9BhV.js → videoLink-NAWDmBtf.js} +35 -1
  13. package/dist/browser/workbench-contract.d.ts +6 -0
  14. package/dist/browser/workbench.css +259 -251
  15. package/dist/browser/workbench.d.ts +2 -0
  16. package/dist/browser/workbench.js +289 -137
  17. package/dist/browser/{ContentIcon-CMn0c-kl.js → wrapLayout-DZvW9dBs.js} +4397 -4152
  18. package/dist/command/index.js +43 -41
  19. package/dist/common/authoring.d.ts +1 -1
  20. package/dist/common/control-api-conformance.js +306 -2
  21. package/dist/common/control-api.d.ts +20 -0
  22. package/dist/common/control-api.js +306 -4
  23. package/dist/common/control-requests.d.ts +3 -5
  24. package/dist/common/control-requests.js +5 -7
  25. package/dist/common/flow-encoding.d.ts +1 -0
  26. package/dist/common/flow-encoding.js +167 -1
  27. package/dist/common/flow-semantics.js +20 -0
  28. package/dist/common/flow-workflowBundle.d.ts +27 -0
  29. package/dist/common/flow-workflowFile.d.ts +2 -0
  30. package/dist/common/flow-workflowReferences.d.ts +4 -0
  31. package/dist/common/mcp.d.ts +2 -0
  32. package/dist/common/mcp.js +312 -4
  33. package/dist/render/browser/licenses.md +4047 -0
  34. package/dist/render/browser/runtime.css +14877 -0
  35. package/dist/render/browser/runtime.js +266765 -0
  36. package/dist/render/common/png.d.ts +24 -0
  37. package/dist/render/node/index.d.ts +11 -0
  38. package/dist/render/node/index.js +9491 -0
  39. package/dist/render/node/licenses.md +75 -0
  40. package/package.json +12 -2
  41. package/src/control/common/api.ts +50 -0
  42. package/src/control/common/flowDecoders.ts +2 -0
  43. package/src/control/common/mcp.ts +4 -4
  44. package/src/control/common/requests.ts +12 -1
  45. package/src/flow/common/encoding.ts +1 -0
  46. package/src/flow/common/workflowBundle.ts +117 -0
  47. package/src/flow/common/workflowFile.ts +4 -0
  48. package/src/flow/common/workflowReferences.ts +20 -0
@@ -1,25 +1,25 @@
1
1
  // @bun
2
- var Rw=Object.defineProperty;var Aw=(e)=>e;function Pw(e,t){this[e]=Aw.bind(null,t)}var co=(e,t)=>{for(var n in t)Rw(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Pw.bind(t,n)})};var Ct={};co(Ct,{anyString:()=>na,base64:()=>Ks,base64url:()=>Ws,bigint:()=>oa,boolean:()=>ia,browserEmail:()=>pv,cidrv4:()=>Us,cidrv6:()=>Bs,creditCard:()=>Io,cuid:()=>As,cuid2:()=>Ps,currencyCode:()=>Ys,date:()=>Xs,datetime:()=>ta,domain:()=>Gs,duration:()=>qs,e164:()=>Qs,email:()=>Ls,emoji:()=>Ms,extendedDuration:()=>iv,guid:()=>Vs,hex:()=>ua,hostname:()=>Hs,html5Email:()=>lv,httpProtocol:()=>Xn,iban:()=>Co,idnEmail:()=>dv,integer:()=>er,ipv4:()=>Fs,ipv6:()=>Zs,ksuid:()=>Ns,lowercase:()=>ca,mac:()=>Js,md5_base64:()=>hv,md5_base64url:()=>yv,md5_hex:()=>gv,nanoid:()=>zs,nanoidOfLength:()=>Ds,null:()=>sa,number:()=>Jt,rfc5322Email:()=>uv,sha1_base64:()=>wv,sha1_base64url:()=>vv,sha1_hex:()=>bv,sha256_base64:()=>kv,sha256_base64url:()=>Sv,sha256_hex:()=>xv,sha384_base64:()=>Cv,sha384_base64url:()=>Ev,sha384_hex:()=>Iv,sha512_base64:()=>jv,sha512_base64url:()=>_v,sha512_hex:()=>Ov,string:()=>ra,time:()=>ea,ulid:()=>Ts,undefined:()=>aa,unicodeEmail:()=>jd,uppercase:()=>la,uuid:()=>Zt,uuid4:()=>sv,uuid6:()=>av,uuid7:()=>cv,xid:()=>$s});var ll={};co(ll,{ZodAny:()=>ig,ZodArray:()=>ug,ZodBase64:()=>Yc,ZodBase64URL:()=>Xc,ZodBigInt:()=>ol,ZodBigIntFormat:()=>il,ZodBoolean:()=>rl,ZodCIDRv4:()=>Gc,ZodCIDRv6:()=>Qc,ZodCUID:()=>Zc,ZodCUID2:()=>Jc,ZodCatch:()=>Rg,ZodCodec:()=>hi,ZodCreditCard:()=>Xm,ZodCustom:()=>yi,ZodCustomStringFormat:()=>wn,ZodDate:()=>lg,ZodDefault:()=>Ig,ZodDiscriminatedUnion:()=>pg,ZodE164:()=>el,ZodEmail:()=>Vc,ZodEmoji:()=>Mc,ZodEnum:()=>yr,ZodExactOptional:()=>al,ZodFile:()=>vg,ZodFunction:()=>Lg,ZodGUID:()=>Lc,ZodIBAN:()=>eg,ZodIPv4:()=>Wc,ZodIPv6:()=>Hc,ZodISODate:()=>hn,ZodISODateTime:()=>gn,ZodISODuration:()=>bn,ZodISOTime:()=>yn,ZodInstanceOf:()=>Zg,ZodIntersection:()=>fg,ZodJWT:()=>tl,ZodKSUID:()=>Kc,ZodLazy:()=>Dg,ZodLiteral:()=>wg,ZodMAC:()=>Ym,ZodMap:()=>yg,ZodNaN:()=>Pg,ZodNanoID:()=>Fc,ZodNever:()=>ag,ZodNonOptional:()=>cl,ZodNull:()=>rg,ZodNullable:()=>Sg,ZodNumber:()=>nl,ZodNumberFormat:()=>vn,ZodObject:()=>pi,ZodOptional:()=>mi,ZodPipe:()=>gi,ZodPrefault:()=>Eg,ZodPreprocess:()=>Tg,ZodPromise:()=>Vg,ZodReadonly:()=>$g,ZodRecord:()=>hr,ZodSet:()=>bg,ZodString:()=>qc,ZodStringFormat:()=>ce,ZodSuccess:()=>_g,ZodSymbol:()=>tg,ZodTemplateLiteral:()=>zg,ZodTransform:()=>xg,ZodTuple:()=>gg,ZodType:()=>K,ZodULID:()=>Uc,ZodURL:()=>di,ZodUUID:()=>wt,ZodUndefined:()=>ng,ZodUnion:()=>fi,ZodUnknown:()=>sg,ZodVoid:()=>cg,ZodXID:()=>Bc,ZodXor:()=>dg,_ZodString:()=>Dc,_default:()=>Cg,_function:()=>wk,any:()=>ek,array:()=>R,base64:()=>$x,base64url:()=>Nx,bigint:()=>Hx,boolean:()=>ye,catch:()=>Ag,check:()=>vk,cidrv4:()=>Px,cidrv6:()=>Tx,codec:()=>gk,creditCard:()=>Dx,cuid:()=>Ix,cuid2:()=>Cx,currencyCode:()=>Zx,custom:()=>xk,date:()=>nk,describe:()=>kk,discriminatedUnion:()=>rt,e164:()=>zx,email:()=>mx,emoji:()=>kx,enum:()=>F,exactOptional:()=>kg,file:()=>dk,float32:()=>Ux,float64:()=>Bx,function:()=>wk,guid:()=>gx,hash:()=>Jx,hex:()=>Fx,hostname:()=>Mx,httpUrl:()=>xx,iban:()=>qx,instanceof:()=>Ik,int:()=>ke,int32:()=>Kx,int64:()=>Gx,intersection:()=>mg,invertCodec:()=>hk,ipv4:()=>_x,ipv6:()=>Ax,json:()=>Ae,jwt:()=>Vx,keyof:()=>rk,ksuid:()=>jx,lazy:()=>qg,literal:()=>w,looseObject:()=>ok,looseRecord:()=>ak,mac:()=>Rx,map:()=>ck,meta:()=>Sk,nan:()=>mk,nanoid:()=>Sx,nativeEnum:()=>uk,never:()=>nt,nonoptional:()=>jg,null:()=>og,nullable:()=>ui,nullish:()=>pk,number:()=>U,object:()=>E,optional:()=>li,partialRecord:()=>sk,pipe:()=>zc,prefault:()=>Og,preprocess:()=>Jg,promise:()=>bk,readonly:()=>Ng,record:()=>oe,refine:()=>Mg,set:()=>lk,strictObject:()=>x,string:()=>_,stringFormat:()=>Lx,stringbool:()=>Ck,success:()=>fk,superRefine:()=>Fg,symbol:()=>Yx,templateLiteral:()=>yk,transform:()=>sl,tuple:()=>hg,uint32:()=>Wx,uint64:()=>Qx,ulid:()=>Ex,undefined:()=>Xx,union:()=>Y,unknown:()=>lt,url:()=>vx,uuid:()=>hx,uuidv4:()=>yx,uuidv6:()=>bx,uuidv7:()=>wx,void:()=>tk,xid:()=>Ox,xor:()=>ik});var ai={};co(ai,{endsWith:()=>Qo,gt:()=>Ot,gte:()=>tt,includes:()=>Ho,length:()=>cr,lowercase:()=>Ko,lt:()=>Et,lte:()=>et,maxLength:()=>ar,maxSize:()=>un,mime:()=>Xo,minLength:()=>Ut,minSize:()=>jt,multipleOf:()=>ln,negative:()=>lm,nonnegative:()=>dm,nonpositive:()=>um,normalize:()=>ei,overwrite:()=>bt,positive:()=>cm,properties:()=>Yo,property:()=>pm,regex:()=>Bo,size:()=>sr,slugify:()=>oi,startsWith:()=>Go,toLowerCase:()=>ni,toUpperCase:()=>ri,trim:()=>ti,uppercase:()=>Wo});var br={};co(br,{ZodISODate:()=>hn,ZodISODateTime:()=>gn,ZodISODuration:()=>bn,ZodISOTime:()=>yn,date:()=>Ok,datetime:()=>Ek,duration:()=>_k,time:()=>jk});var Zu="0.1.0-beta.81";var ms=["en","zh-CN","zh-TW","ja","ko","ru","fr"],Ju="en";var fs=new Map(ms.map((e)=>[e.toLowerCase(),e])),$w=new Set(["hk","mo","tw"]);function Uu(e){return typeof e=="string"&&fs.get(e.toLowerCase())==e}function lo(e,t="en"){for(let n of e){let r=n==null?void 0:Nw(n);if(r!=null)return r}return t}function Nw(e){let t=e.trim().toLowerCase();if(t.length==0)return;let n=fs.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)=>$w.has(o))?"zh-TW":"zh-CN"}return fs.get(r[0])}function Bu(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 wE}from"child_process";import{readFile as vE}from"fs/promises";import{setTimeout as xE}from"timers/promises";var on="open-flow-engine/v10";var rn=(e)=>`export const engineContract = ${JSON.stringify(e)}
2
+ var Fw=Object.defineProperty;var Mw=(e)=>e;function Zw(e,t){this[e]=Mw.bind(null,t)}var co=(e,t)=>{for(var n in t)Fw(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Zw.bind(t,n)})};var Ot={};co(Ot,{anyString:()=>ra,base64:()=>Ws,base64url:()=>Gs,bigint:()=>ia,boolean:()=>sa,browserEmail:()=>Sv,cidrv4:()=>Us,cidrv6:()=>Ks,creditCard:()=>Io,cuid:()=>Ps,cuid2:()=>Ts,currencyCode:()=>Xs,date:()=>ea,datetime:()=>na,domain:()=>Qs,duration:()=>Vs,e164:()=>Ys,email:()=>Fs,emoji:()=>Ms,extendedDuration:()=>hv,guid:()=>Ls,hex:()=>da,hostname:()=>Hs,html5Email:()=>vv,httpProtocol:()=>er,iban:()=>Co,idnEmail:()=>xv,integer:()=>tr,ipv4:()=>Zs,ipv6:()=>Js,ksuid:()=>zs,lowercase:()=>la,mac:()=>Bs,md5_base64:()=>Ov,md5_base64url:()=>jv,md5_hex:()=>Ev,nanoid:()=>Ds,nanoidOfLength:()=>qs,null:()=>aa,number:()=>Bt,rfc5322Email:()=>kv,sha1_base64:()=>Rv,sha1_base64url:()=>Av,sha1_hex:()=>_v,sha256_base64:()=>Tv,sha256_base64url:()=>$v,sha256_hex:()=>Pv,sha384_base64:()=>zv,sha384_base64url:()=>Dv,sha384_hex:()=>Nv,sha512_base64:()=>Vv,sha512_base64url:()=>Lv,sha512_hex:()=>qv,string:()=>oa,time:()=>ta,ulid:()=>$s,undefined:()=>ca,unicodeEmail:()=>Pd,uppercase:()=>ua,uuid:()=>Jt,uuid4:()=>yv,uuid6:()=>bv,uuid7:()=>wv,xid:()=>Ns});var ul={};co(ul,{ZodAny:()=>lg,ZodArray:()=>mg,ZodBase64:()=>Xc,ZodBase64URL:()=>el,ZodBigInt:()=>il,ZodBigIntFormat:()=>sl,ZodBoolean:()=>ol,ZodCIDRv4:()=>Qc,ZodCIDRv6:()=>Yc,ZodCUID:()=>Jc,ZodCUID2:()=>Bc,ZodCatch:()=>$g,ZodCodec:()=>hi,ZodCreditCard:()=>rg,ZodCustom:()=>yi,ZodCustomStringFormat:()=>vn,ZodDate:()=>fg,ZodDefault:()=>jg,ZodDiscriminatedUnion:()=>hg,ZodE164:()=>tl,ZodEmail:()=>Lc,ZodEmoji:()=>Mc,ZodEnum:()=>br,ZodExactOptional:()=>cl,ZodFile:()=>Ig,ZodFunction:()=>Jg,ZodGUID:()=>Fc,ZodIBAN:()=>og,ZodIPv4:()=>Gc,ZodIPv6:()=>Hc,ZodISODate:()=>yn,ZodISODateTime:()=>hn,ZodISODuration:()=>wn,ZodISOTime:()=>bn,ZodInstanceOf:()=>Kg,ZodIntersection:()=>yg,ZodJWT:()=>nl,ZodKSUID:()=>Wc,ZodLazy:()=>Fg,ZodLiteral:()=>Sg,ZodMAC:()=>ng,ZodMap:()=>kg,ZodNaN:()=>zg,ZodNanoID:()=>Zc,ZodNever:()=>dg,ZodNonOptional:()=>ll,ZodNull:()=>ag,ZodNullable:()=>Og,ZodNumber:()=>rl,ZodNumberFormat:()=>kn,ZodObject:()=>pi,ZodOptional:()=>mi,ZodPipe:()=>gi,ZodPrefault:()=>Rg,ZodPreprocess:()=>Dg,ZodPromise:()=>Zg,ZodReadonly:()=>qg,ZodRecord:()=>yr,ZodSet:()=>xg,ZodString:()=>Vc,ZodStringFormat:()=>ce,ZodSuccess:()=>Tg,ZodSymbol:()=>ig,ZodTemplateLiteral:()=>Lg,ZodTransform:()=>Cg,ZodTuple:()=>wg,ZodType:()=>K,ZodULID:()=>Uc,ZodURL:()=>di,ZodUUID:()=>vt,ZodUndefined:()=>sg,ZodUnion:()=>fi,ZodUnknown:()=>ug,ZodVoid:()=>pg,ZodXID:()=>Kc,ZodXor:()=>gg,_ZodString:()=>qc,_default:()=>_g,_function:()=>Rx,any:()=>dx,array:()=>R,base64:()=>Bk,base64url:()=>Uk,bigint:()=>sx,boolean:()=>he,catch:()=>Ng,check:()=>Ax,cidrv4:()=>Zk,cidrv6:()=>Jk,codec:()=>Ex,creditCard:()=>Wk,cuid:()=>Nk,cuid2:()=>zk,currencyCode:()=>ex,custom:()=>Px,date:()=>fx,describe:()=>Tx,discriminatedUnion:()=>it,e164:()=>Kk,email:()=>Ck,emoji:()=>Tk,enum:()=>Z,exactOptional:()=>Eg,file:()=>xx,float32:()=>nx,float64:()=>rx,function:()=>Rx,guid:()=>Ek,hash:()=>tx,hex:()=>Xk,hostname:()=>Yk,httpUrl:()=>Pk,iban:()=>Gk,instanceof:()=>Nx,int:()=>xe,int32:()=>ox,int64:()=>ax,intersection:()=>bg,invertCodec:()=>Ox,ipv4:()=>Lk,ipv6:()=>Mk,json:()=>Pe,jwt:()=>Hk,keyof:()=>mx,ksuid:()=>Vk,lazy:()=>Mg,literal:()=>b,looseObject:()=>gx,looseRecord:()=>bx,mac:()=>Fk,map:()=>wx,meta:()=>$x,nan:()=>Cx,nanoid:()=>$k,nativeEnum:()=>kx,never:()=>ot,nonoptional:()=>Pg,null:()=>cg,nullable:()=>ui,nullish:()=>Sx,number:()=>B,object:()=>O,optional:()=>li,partialRecord:()=>yx,pipe:()=>Dc,prefault:()=>Ag,preprocess:()=>Wg,promise:()=>_x,readonly:()=>Vg,record:()=>oe,refine:()=>Bg,set:()=>vx,strictObject:()=>v,string:()=>C,stringFormat:()=>Qk,stringbool:()=>zx,success:()=>Ix,superRefine:()=>Ug,symbol:()=>lx,templateLiteral:()=>jx,transform:()=>al,tuple:()=>vg,uint32:()=>ix,uint64:()=>cx,ulid:()=>Dk,undefined:()=>ux,union:()=>Y,unknown:()=>rt,url:()=>Ak,uuid:()=>Ok,uuidv4:()=>jk,uuidv6:()=>_k,uuidv7:()=>Rk,void:()=>px,xid:()=>qk,xor:()=>hx});var ai={};co(ai,{endsWith:()=>Qo,gt:()=>_t,gte:()=>nt,includes:()=>Go,length:()=>lr,lowercase:()=>Ko,lt:()=>jt,lte:()=>tt,maxLength:()=>cr,maxSize:()=>dn,mime:()=>Xo,minLength:()=>Ut,minSize:()=>Rt,multipleOf:()=>un,negative:()=>fm,nonnegative:()=>gm,nonpositive:()=>mm,normalize:()=>ei,overwrite:()=>wt,positive:()=>pm,properties:()=>Yo,property:()=>hm,regex:()=>Uo,size:()=>ar,slugify:()=>oi,startsWith:()=>Ho,toLowerCase:()=>ni,toUpperCase:()=>ri,trim:()=>ti,uppercase:()=>Wo});var wr={};co(wr,{ZodISODate:()=>yn,ZodISODateTime:()=>hn,ZodISODuration:()=>wn,ZodISOTime:()=>bn,date:()=>qx,datetime:()=>Dx,duration:()=>Lx,time:()=>Vx});var Ku="0.1.0-beta.82";var gs=["en","zh-CN","zh-TW","ja","ko","ru","fr"],Wu="en";var ms=new Map(gs.map((e)=>[e.toLowerCase(),e])),Bw=new Set(["hk","mo","tw"]);function Gu(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:Uw(n);if(r!=null)return r}return t}function Uw(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)=>Bw.has(o))?"zh-TW":"zh-CN"}return ms.get(r[0])}function Hu(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 PE}from"child_process";import{readFile as TE}from"fs/promises";import{setTimeout as $E}from"timers/promises";var sn="open-flow-engine/v10";var on=(e)=>`export const engineContract = ${JSON.stringify(e)}
3
3
  export function identity(value) { return value }
4
- `,uo={workflowTools:!0,httpRequests:!0,waitAutoContinue:!0,webhookResponses:!0,platformExports:new Set(["engineContract","identity"]),platformModule:"open-flow:platform",platformSource:rn("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:rn("open-flow-engine/v8/nodejs-compat-v1")},Ku={...po,codeFetch:!0,platformSource:rn("open-flow-engine/v9")},zw={...Ku,flowState:!0,platformSource:rn("open-flow-engine/v10")};function Wu(e){if(e=="open-flow-engine/v10")return zw;if(e=="open-flow-engine/v9")return Ku;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:rn(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:rn(e)};return}function Bn(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 hs(e,t="|"){return e.map((n)=>vs(n)).join(t)}function Kn(e,t){if(typeof t==="bigint")return t.toString();return t}class Gu{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 Wn(e){return new Gu(e)}function ys(e){return e===null||e===void 0}function It(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Qu(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 Hu=Symbol("evaluating");function Yu(e,t,n){let r=void 0;Object.defineProperty(e,t,{get(){if(r===Hu)return;if(r===void 0)r=Hu,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 Hn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function gt(e){return Hn(e._zod.def)??e._zod.def.shape}function Xu(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return _e(this,t,r),r},enumerable:!0,configurable:!0})}function ed(e,t,n){if(t in e)_e(e,t,n);else e[t]=n}function Mt(e,t,n,r){let o=gt(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)Xu(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a});else ed(e,i,r?r(s.value,i):s.value)}}function Dw(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);if(!r.enumerable)continue;if(r.get)Xu(e,n,()=>t[n]);else ed(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 td(e){return JSON.stringify(e)}function nd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var bs="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function sn(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var rd=Wn(()=>{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 yt(e){if(sn(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(sn(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function ws(e){if(yt(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"]),od=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function at(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 vs(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function id(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 qw(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 Mt(i,e,ho(e,t)),at(e,Je(n,{shape:i,checks:[]}))}function ho(e,t){let n=gt(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 Vw(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 Mt(s,e,Reflect.ownKeys(gt(e)).filter((a)=>!i.has(a))),at(e,Je(n,{shape:s,checks:[]}))}function Lw(e,t){if(!yt(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=gt(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 at(e,Je(e._zod.def,{shape:sd(e,t)}))}function sd(e,t){let n={};return Mt(n,e,Reflect.ownKeys(gt(e))),Dw(n,t),n}function Mw(e,t){if(!yt(t))throw Error("Invalid input to safeExtend: expected a plain object");return at(e,Je(e._zod.def,{shape:sd(e,t)}))}function Fw(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={};Mt(n,e,Reflect.ownKeys(gt(e))),Mt(n,t,Reflect.ownKeys(gt(t)));let r=Je(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return at(e,r)}function ad(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 Mt(c,t,Reflect.ownKeys(gt(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),at(t,Je(t._zod.def,{shape:c,checks:[]}))}function Zw(e,t,n){let r=n?new Set(ho(t,n)):void 0,o={};return Mt(o,t,Reflect.ownKeys(gt(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),at(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 cd(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 Un(e){return typeof e==="string"?e:e?.message}function xs(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:Un(e.inst?._zod.def?.error?.(e))??Un(i?.(e))??Un(t?.error?.(e))??Un(n.customError?.(e))??Un(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 Jw=/[\uD800-\uDBFF]/;function bo(e){let t=e.length;if(!Jw.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 ld(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 Ft(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function ud(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else Uw(e,n,r.value)}}function ht(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Gn(e,t,n){return ht(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 ht(this,n,r(this))},set(o){ht(this,n,o)}})}return t}function Uw(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:ht(this,t,n.bind(this))},set(r){ht(this,t,r)}})}function Bw(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var gs,St=!1,Kw={configurable:!0,get(){St=!0;return}};function H(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&gs!==e._zod){gs=void 0;return}gs=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Kw);let o=St;St=!1;try{let i=n(this);if(St)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return St=St||o,i}catch(i){throw delete this[t],St=St||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Ww(e,t,n,r){let o=Bw(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 Hw="~constantCatch";function dd(e){let t=()=>e;return t[Hw]=!0,t}var pd;var ks={value:void 0,enumerable:!1},fd="captureStackTrace"in Error?Error:null;function Gw(e){let t=fd;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return fd=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function m(e,t,n,r){let o={};function i(h){this.def=h,this.constr=d,this.traits=new Set}i.prototype=o;let s=n,a=s&&new WeakSet;function c(h,g){if(!h._zod){ks.value=new i(g);try{Object.defineProperty(h,"_zod",ks)}finally{ks.value=void 0}}else if(h._zod.traits.has(e))return;if(h._zod.traits.add(e),t(h,g),a){let S=Object.getPrototypeOf(h),A=h._zod.constr.prototype,N=S;while(N&&N!==A)N=Object.getPrototypeOf(N);let M=N??S;if(!a.has(M))a.add(M),ud(M,s)}let y=d.prototype;for(let S in y){if(!Object.prototype.hasOwnProperty.call(y,S))continue;if(!(S in h))h[S]=y[S].bind(h)}}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(h){let g=r?.Parent?Gw(u):this;c(g,h);let y=g._zod.deferred;if(y){for(let A of y)A();g._zod.deferred=void 0}let S=globalThis.__zod_globalConfig?.postProcessor;if(S)S(g);return g}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(h)=>{if(r?.Parent&&h instanceof r.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class ct extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class an extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(pd=globalThis).__zod_globalConfig??(pd.__zod_globalConfig={});var je=globalThis.__zod_globalConfig;function Re(e){if(e)Object.assign(je,e);return je}function Qw(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Kn,2)),e.message}function Yw(e){this._zod.message=e}var Xw={get:Qw,set:Yw,enumerable:!0,configurable:!0},Is={value:void 0,enumerable:!1},md=new WeakSet([Object.prototype,Error.prototype]),gd=(e,t)=>{e.name="$ZodError",Is.value=t,Object.defineProperty(e,"issues",Is),Is.value=void 0,Object.defineProperty(e,"message",Xw);let n=Object.getPrototypeOf(e);if(!md.has(n))md.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})}})},hd=m("$ZodError",gd),Cs=m("$ZodError",gd,void 0,{Parent:Error});function ev(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 yd(e,t=(n)=>n.message){let n={},r=[];for(let o of e.issues)if(o.path.length>0)ev(n,o.path[0],()=>[]).push(t(o));else r.push(t(o));return{formErrors:r,fieldErrors:n}}function bd(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 h=c[u];if(d)h._errors.push(t(s));c=h,l++}}}};return r(e),n}function xo(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Qn=(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 ct;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Be(l,s,Re())));throw bs(c,i?.callee??t),c}return a.value};return t},Es=Qn(Cs),Yn=(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 bs(c,i?.callee??t),c}return a.value};return t},Os=Yn(Cs),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 ct;return i.issues.length?wd(e,i.issues,o):{success:!0,data:i.value}};function wd(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?wd(e,i.issues,o):{success:!0,data:i.value}};var nv=Symbol.for("zod.compile.invalid"),rv=Symbol.for("zod.compile.fallback"),js=(e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==nv)return!0;if(r.definite===!0&&n===void 0)return!1}return ov(e,t,n)};function ov(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[rv]=!0,i=o({value:t,issues:[]},r);else i=e._zod.run({value:t,issues:[]},r);if(i instanceof Promise)throw new ct;return i.issues.length===0}var _s=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},vd=(e)=>{let t=Qn(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 xd=(e)=>{let t=Qn(e),n=(r,o,i,s)=>t(r,o,i,xo(n,s));return n};var kd=(e)=>{let t=Yn(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 Sd=(e)=>{let t=Yn(e),n=async(r,o,i,s)=>await t(r,o,i,xo(n,s));return n};var Id=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return ko(e)(t,n,o)};var Cd=(e)=>(t,n,r)=>ko(e)(t,n,r);var Ed=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return So(e)(t,n,o)};var Od=(e)=>async(t,n,r)=>So(e)(t,n,r);var As=/^[cC][0-9a-z]{6,}$/,Ps=/^[0-9a-z]+$/,Ts=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,$s=/^[0-9a-vA-V]{20}$/,Ns=/^[A-Za-z0-9]{27}$/,zs=/^[a-zA-Z0-9_-]{21}$/;function Ds(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var qs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,iv=/^[-+]?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)?)??$/,Vs=/^([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})$/,Zt=(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})$`)},sv=Zt(4),av=Zt(6),cv=Zt(7),Ls=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,lv=/^[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])?)*$/,uv=/^(([^<>()\[\]\\.,;:\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,}))$/,jd=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,dv=jd,pv=/^[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])?)*$/,fv="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ms(){return new RegExp(fv,"u")}var Fs=/^(?:(?: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])$/,Zs=/^(([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}|:))$/,Js=(e)=>{let t=Xe(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Us=/^((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])$/,Bs=/^(([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])$/,Ks=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ws=/^(?:[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])?)*\.?$/,Gs=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Xn=/^https?$/,Qs=/^\+[1-9]\d{6,14}$/,Io=/^\d(?:[ -]?\d){11,18}$/,Ys=/^(?: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}$/,_d="(?:(?:\\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 mv(e){return new RegExp(`^${e}$`)}var Xs=mv(_d);function Rs(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 ea(e){return new RegExp(`^${Rs(e)}$`)}function ta(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${Rs({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${Rs({precision:e.precision})}`:n;return new RegExp(`^${_d}T(?:${r})$`)}var na=/^[\s\S]{0,}$/,ra=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},oa=/^-?\d+n?$/,er=/^-?\d+$/,Jt=/^-?\d+(?:\.\d+)?$/,ia=/^(?:true|false)$/i,sa=/^null$/i;var aa=/^undefined$/i;var ca=/^[^A-Z]*$/,la=/^[^a-z]*$/,ua=/^[0-9a-fA-F]*$/;function tr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function nr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var gv=/^[0-9a-fA-F]{32}$/,hv=tr(22,"=="),yv=nr(22),bv=/^[0-9a-fA-F]{40}$/,wv=tr(27,"="),vv=nr(27),xv=/^[0-9a-fA-F]{64}$/,kv=tr(43,"="),Sv=nr(43),Iv=/^[0-9a-fA-F]{96}$/,Cv=tr(64,""),Ev=nr(64),Ov=/^[0-9a-fA-F]{128}$/,jv=tr(86,"=="),_v=nr(86);var ue=m("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),da=(e)=>{let t=e.value;return!ys(t)&&t.size!==void 0},pa=(e)=>{let t=e.value;return!ys(t)&&t.length!==void 0},Eo={number:"number",bigint:"bigint",object:"date"},fa=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})}}),ma=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})}}),Rd=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):Qu(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})}}),Ad=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})}}),Pd=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})}}),Td=m("$ZodCheckMaxSize",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=da),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})}}),$d=m("$ZodCheckMinSize",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=da),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})}}),Nd=m("$ZodCheckSizeEquals",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=da),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})}}),zd=m("$ZodCheckMaxLength",(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.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})}}),Dd=m("$ZodCheckMinLength",(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.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})}}),qd=m("$ZodCheckLengthEquals",(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.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})}}),rr=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=()=>{})}),Vd=m("$ZodCheckRegex",(e,t)=>{rr.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})}}),Ld=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ca),rr.init(e,t)}),Md=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=la),rr.init(e,t)}),Fd=m("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);let n=Xe(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})}}),Zd=m("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);let n=new RegExp(`^${Xe(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})}}),Jd=m("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);let n=new RegExp(`.*${Xe(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 Ud=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}}),Bd=m("$ZodCheckProperties",(e,t)=>{ue.init(e,t),Gn(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}}),Kd=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})}}),Wd=m("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class ga{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(`
4
+ `,uo={workflowTools:!0,httpRequests:!0,waitAutoContinue:!0,webhookResponses:!0,platformExports:new Set(["engineContract","identity"]),platformModule:"open-flow:platform",platformSource:on("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:on("open-flow-engine/v8/nodejs-compat-v1")},Qu={...po,codeFetch:!0,platformSource:on("open-flow-engine/v9")},Kw={...Qu,flowState:!0,platformSource:on("open-flow-engine/v10")};function Yu(e){if(e=="open-flow-engine/v10")return Kw;if(e=="open-flow-engine/v9")return Qu;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:on(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:on(e)};return}function Kn(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)=>ks(n)).join(t)}function Wn(e,t){if(typeof t==="bigint")return t.toString();return t}class ed{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 Gn(e){return new ed(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 td(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 Xu=Symbol("evaluating");function nd(e,t,n){let r=void 0;Object.defineProperty(e,t,{get(){if(r===Xu)return;if(r===void 0)r=Xu,r=n();return r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Re(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Hn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ht(e){return Hn(e._zod.def)??e._zod.def.shape}function rd(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return Re(this,t,r),r},enumerable:!0,configurable:!0})}function od(e,t,n){if(t in e)Re(e,t,n);else e[t]=n}function Mt(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)rd(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a});else od(e,i,r?r(s.value,i):s.value)}}function Ww(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);if(!r.enumerable)continue;if(r.get)rd(e,n,()=>t[n]);else od(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 id(e){return JSON.stringify(e)}function sd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ws="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function an(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var ad=Gn(()=>{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(an(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(an(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"]),cd=new Set(["string","number","bigint","boolean","symbol","undefined"]);function et(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lt(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function j(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 ks(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ld(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 Gw(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 Mt(i,e,ho(e,t)),lt(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 Hw(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 Mt(s,e,Reflect.ownKeys(ht(e)).filter((a)=>!i.has(a))),lt(e,Je(n,{shape:s,checks:[]}))}function Qw(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 lt(e,Je(e._zod.def,{shape:ud(e,t)}))}function ud(e,t){let n={};return Mt(n,e,Reflect.ownKeys(ht(e))),Ww(n,t),n}function Yw(e,t){if(!bt(t))throw Error("Invalid input to safeExtend: expected a plain object");return lt(e,Je(e._zod.def,{shape:ud(e,t)}))}function Xw(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={};Mt(n,e,Reflect.ownKeys(ht(e))),Mt(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 lt(e,r)}function dd(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 Mt(c,t,Reflect.ownKeys(ht(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),lt(t,Je(t._zod.def,{shape:c,checks:[]}))}function ev(e,t,n){let r=n?new Set(ho(t,n)):void 0,o={};return Mt(o,t,Reflect.ownKeys(ht(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),lt(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 pd(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 Be(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Un(e){return typeof e==="string"?e:e?.message}function xs(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function Ue(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:Un(e.inst?._zod.def?.error?.(e))??Un(i?.(e))??Un(t?.error?.(e))??Un(n.customError?.(e))??Un(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 tv=/[\uD800-\uDBFF]/;function bo(e){let t=e.length;if(!tv.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 fd(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 Zt(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function md(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else nv(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 Qn(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 nv(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 rv(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var hs,Ct=!1,ov={configurable:!0,get(){Ct=!0;return}};function G(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,ov);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 iv(e,t,n,r){let o=rv(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 sv="~constantCatch";function gd(e){let t=()=>e;return t[sv]=!0,t}var hd;var Ss={value:void 0,enumerable:!1},yd="captureStackTrace"in Error?Error:null;function av(e){let t=yd;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return yd=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function m(e,t,n,r){let o={};function i(h){this.def=h,this.constr=d,this.traits=new Set}i.prototype=o;let s=n,a=s&&new WeakSet;function c(h,g){if(!h._zod){Ss.value=new i(g);try{Object.defineProperty(h,"_zod",Ss)}finally{Ss.value=void 0}}else if(h._zod.traits.has(e))return;if(h._zod.traits.add(e),t(h,g),a){let S=Object.getPrototypeOf(h),A=h._zod.constr.prototype,N=S;while(N&&N!==A)N=Object.getPrototypeOf(N);let L=N??S;if(!a.has(L))a.add(L),md(L,s)}let y=d.prototype;for(let S in y){if(!Object.prototype.hasOwnProperty.call(y,S))continue;if(!(S in h))h[S]=y[S].bind(h)}}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(h){let g=r?.Parent?av(u):this;c(g,h);let y=g._zod.deferred;if(y){for(let A of y)A();g._zod.deferred=void 0}let S=globalThis.__zod_globalConfig?.postProcessor;if(S)S(g);return g}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(h)=>{if(r?.Parent&&h instanceof r.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class ut extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class cn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(hd=globalThis).__zod_globalConfig??(hd.__zod_globalConfig={});var je=globalThis.__zod_globalConfig;function Ae(e){if(e)Object.assign(je,e);return je}function cv(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Wn,2)),e.message}function lv(e){this._zod.message=e}var uv={get:cv,set:lv,enumerable:!0,configurable:!0},Cs={value:void 0,enumerable:!1},bd=new WeakSet([Object.prototype,Error.prototype]),wd=(e,t)=>{e.name="$ZodError",Cs.value=t,Object.defineProperty(e,"issues",Cs),Cs.value=void 0,Object.defineProperty(e,"message",uv);let n=Object.getPrototypeOf(e);if(!bd.has(n))bd.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})}})},vd=m("$ZodError",wd),Es=m("$ZodError",wd,void 0,{Parent:Error});function dv(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 kd(e,t=(n)=>n.message){let n={},r=[];for(let o of e.issues)if(o.path.length>0)dv(n,o.path[0],()=>[]).push(t(o));else r.push(t(o));return{formErrors:r,fieldErrors:n}}function xd(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 h=c[u];if(d)h._errors.push(t(s));c=h,l++}}}};return r(e),n}function ko(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Yn=(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 ut;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Ue(l,s,Ae())));throw ws(c,i?.callee??t),c}return a.value};return t},Os=Yn(Es),Xn=(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)=>Ue(l,s,Ae())));throw ws(c,i?.callee??t),c}return a.value};return t},js=Xn(Es),xo=(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 ut;return i.issues.length?Sd(e,i.issues,o):{success:!0,data:i.value}};function Sd(e,t,n){let r;return{success:!1,get error(){if(!r)r=new e(t.map((o)=>Ue(o,n,Ae()))),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?Sd(e,i.issues,o):{success:!0,data:i.value}};var fv=Symbol.for("zod.compile.invalid"),mv=Symbol.for("zod.compile.fallback"),_s=(e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==fv)return!0;if(r.definite===!0&&n===void 0)return!1}return gv(e,t,n)};function gv(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[mv]=!0,i=o({value:t,issues:[]},r);else i=e._zod.run({value:t,issues:[]},r);if(i instanceof Promise)throw new ut;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},Id=(e)=>{let t=Yn(e),n=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,ko(n,s))};return n};var Cd=(e)=>{let t=Yn(e),n=(r,o,i,s)=>t(r,o,i,ko(n,s));return n};var Ed=(e)=>{let t=Xn(e),n=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,ko(n,s))};return n};var Od=(e)=>{let t=Xn(e),n=async(r,o,i,s)=>await t(r,o,i,ko(n,s));return n};var jd=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return xo(e)(t,n,o)};var _d=(e)=>(t,n,r)=>xo(e)(t,n,r);var Rd=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return So(e)(t,n,o)};var Ad=(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)?)?)$/,hv=/^[-+]?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})$/,Jt=(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})$`)},yv=Jt(4),bv=Jt(6),wv=Jt(7),Fs=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vv=/^[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])?)*$/,kv=/^(([^<>()\[\]\\.,;:\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,}))$/,Pd=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,xv=Pd,Sv=/^[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])?)*$/,Iv="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ms(){return new RegExp(Iv,"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}|:))$/,Bs=(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}$`)},Us=/^((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}$/,er=/^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}$/,Td="(?:(?:\\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 Cv(e){return new RegExp(`^${e}$`)}var ea=Cv(Td);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(`^${Td}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?$/,tr=/^-?\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 nr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function rr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Ev=/^[0-9a-fA-F]{32}$/,Ov=nr(22,"=="),jv=rr(22),_v=/^[0-9a-fA-F]{40}$/,Rv=nr(27,"="),Av=rr(27),Pv=/^[0-9a-fA-F]{64}$/,Tv=nr(43,"="),$v=rr(43),Nv=/^[0-9a-fA-F]{96}$/,zv=nr(64,""),Dv=rr(64),qv=/^[0-9a-fA-F]{128}$/,Vv=nr(86,"=="),Lv=rr(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})}}),$d=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):td(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})}}),Nd=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})}}),zd=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})}}),Dd=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})}}),qd=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})}}),Vd=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})}}),Ld=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})}}),Fd=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})}}),Md=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})}}),or=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=()=>{})}),Zd=m("$ZodCheckRegex",(e,t)=>{or.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})}}),Jd=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=la),or.init(e,t)}),Bd=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ua),or.init(e,t)}),Ud=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})}}),Kd=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})}}),Wd=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(...Be(n,e.issues))}var Gd=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}}),Hd=m("$ZodCheckProperties",(e,t)=>{ue.init(e,t),Qn(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}}),Qd=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})}}),Yd=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
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
6
  ${t.join(`
7
7
  `)}
8
- };`)(...Object.values(this.closed))}}var Gd={major:4,minor:6,patch:5};var J=m("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Gd;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 h of c){if(h._zod.def.when){if(cd(a))continue;if(!h._zod.def.when(a))continue}else if(u)continue;let g=a.issues.length,y=h._zod.check(a);if(y instanceof Promise&&l?.async===!1)throw new ct;if(d||y instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await y,a.issues.length===g)return;if(xs(a.issues,g,e),!u)u=Ve(a,g)});else{if(a.issues.length===g)continue;if(xs(a.issues,g,e),!u)u=Ve(a,g)}}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 ct;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 ct;return l.then((u)=>i(u,o,c))}return i(l,o,c)}}},{get "~standard"(){return Gn(this,"~standard",ba(this))},set "~standard"(e){ht(this,"~standard",e)}}),fp=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>Be(n,t,Re()))}:{value:e.value};async function Rv(e,t){let n={async:!0};return fp(await e._zod.run({value:t,issues:[]},n),n)}function ba(e){return{validate:(t)=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return fp(r,n)}catch(r){}return Rv(e,t)},vendor:"zod",version:1}}var cn=m("$ZodString",(e,t)=>{J.init(e,t),e._zod.pattern=t.pattern??na,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)=>{rr.init(e,t),cn.init(e,t)}),mp=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Vs),ae.init(e,t)}),gp=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=Zt(r))}else t.pattern??(t.pattern=Zt());ae.init(e,t)}),hp=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ls),ae.init(e,t)}),yp=1,Ao=2;function bp(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Av(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return bp(e)||Ao;return Pv(e,t)}function Pv(e,t){if(!t.normalize&&t.protocol?.source===Xn.source&&!/^https?:\/\//i.test(e))return yp;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 Tv=/[\t\n\r]/g;function Qd(e){return e.replace(Tv,"")}function $v(e,t){return t.lastIndex=0,t.test(e.hostname)}function Nv(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var wp=m("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim(),o=Av(r,t);if(o===yp){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=Qd(r);return}if(t.hostname&&!$v(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&&!Nv(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:Qd(r);return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),vp=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ms()),ae.init(e,t)}),xp=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?zs:Ds(t.length)),ae.init(e,t)}),kp=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=As),ae.init(e,t)}),Sp=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ps),ae.init(e,t)}),Ip=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ts),ae.init(e,t)}),Cp=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=$s),ae.init(e,t)}),Ep=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ns),ae.init(e,t)}),Op=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ta(t)),ae.init(e,t)}),jp=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Xs),ae.init(e,t)}),_p=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ea(t)),ae.init(e,t)}),Rp=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=qs),ae.init(e,t)}),Ap=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Fs),ae.init(e,t)}),zv=/^[0-9a-fA-F:.]+$/;function Pp(e){if(!zv.test(e))return!1;return bp(`http://[${e}]`)}var Tp=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Zs),ae.init(e,t),e._zod.check=(n)=>{if(!Pp(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),$p=m("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Js(t.delimiter)),ae.init(e,t)}),Np=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Us),ae.init(e,t)});function Dv(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 Pp(n)}var zp=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Bs),ae.init(e,t),e._zod.check=(n)=>{if(!Dv(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Dp(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 wa=/^[0-9a-zA-Z+/]*={0,2}$/,qp=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=wa),ae.init(e,t),e._zod.check=(n)=>{if(Dp(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 qv(e){if(!To.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Dp(n)}var Vp=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=To),ae.init(e,t),e._zod.check=(n)=>{if(qv(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Lp=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Qs),ae.init(e,t)}),Vv=/[- ]/g;function Lv(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 Mv(e){if(!Io.test(e))return!1;return Lv(e.replace(Vv,""))}var Mp=m("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Io),ae.init(e,t),e._zod.check=(n)=>{if(Mv(n.value))return;n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function Fv(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 Zv(e){if(!Co.test(e))return!1;return Fv(e)}var Fp=m("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Co),ae.init(e,t),e._zod.check=(n)=>{if(Zv(n.value))return;n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function Jv(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 Zp=m("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=(n)=>{if(Jv(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Jp=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})}}),va=m("$ZodNumber",(e,t)=>{J.init(e,t),e._zod.pattern=Jt,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}}),Up=m("$ZodNumberFormat",(e,t)=>{Ad.init(e,t),va.init(e,t)}),$o=m("$ZodBoolean",(e,t)=>{J.init(e,t),e._zod.pattern=ia,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}}),xa=m("$ZodBigInt",(e,t)=>{J.init(e,t),e._zod.pattern=oa,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}}),Bp=m("$ZodBigIntFormat",(e,t)=>{Pd.init(e,t),xa.init(e,t)}),Kp=m("$ZodSymbol",(e,t)=>{J.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}}),Wp=m("$ZodUndefined",(e,t)=>{J.init(e,t),e._zod.pattern=aa,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}}),Hp=m("$ZodNull",(e,t)=>{J.init(e,t),e._zod.pattern=sa,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}}),Gp=m("$ZodAny",(e,t)=>{J.init(e,t),e._zod.parse=(n)=>n}),Qp=m("$ZodUnknown",(e,t)=>{J.init(e,t),e._zod.parse=(n)=>n}),Yp=m("$ZodNever",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Xp=m("$ZodVoid",(e,t)=>{J.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}}),ef=m("$ZodDate",(e,t)=>{J.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 Yd(e,t,n){if(e.issues.length)t.issues.push(...Ue(n,e.issues));t.value[n]=e.value}var tf=m("$ZodArray",(e,t)=>{J.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)=>Yd(d,r,c)));else if(Yd(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 Uv=[];function nf(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Uv,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=id(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function rf(e,t,n,r,o,i,s){let a=[],c=o.keySet,l=o.catchall._zod,u=l.def.type,{optin:d,optout:h}=l,g=0;for(let y in t){if(s&&n.issues.length!==g){if(Ve(n,g))break;g=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((A)=>Po(A,n,y,t,d,h)));else Po(S,n,y,t,d,h)}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 Bv=m("$ZodObject",(e,t)=>{J.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=Wn(()=>nf(t));H(e,"propValues",(l)=>{let u=l.def.shape,d={};for(let h in u){let g=u[h]._zod;if(g.values){if(!Object.prototype.hasOwnProperty.call(d,h))_e(d,h,new Set);for(let y of g.values)d[h].add(y);if(g.optin!==void 0)d[h].add(void 0)}}return d});let i=sn,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 h=[],g=a.shape,y=u?.abortEarly,S=l.issues.length;for(let A of a.allKeys){if(y&&l.issues.length!==S){if(Ve(l,S))break;S=l.issues.length}if(A==="__proto__")continue;let N=g[A],M=N._zod.optin,D=N._zod.optout,fe=N._zod.run({value:d[A],issues:[]},u);if(fe instanceof Promise)h.push(fe.then((me)=>Po(me,l,A,d,M,D)));else Po(fe,l,A,d,M,D)}if(!s)return h.length?Promise.all(h).then(()=>l):l;return rf(h,d,l,u,o.value,e,y===!0)}}),of=m("$ZodObjectJIT",(e,t)=>{Bv.init(e,t);let n=e._zod.parse,r=Wn(()=>nf(t)),o=je.memoizer,i=(g)=>{let y=r.value,S=y.symbolKeys,A=new ga(["payload","ctx"],{shape:g,inst:e,memo:o,syms:S}),N=(me)=>`shape[${me}]._zod.run({ value: input[${me}], issues: [] }, ctx)`,M=(me,se)=>`
9
- let ${me}_ab = false;
10
- for (let i = 0; i < ${me}.issues.length; i++) {
11
- const iss = ${me}.issues[i];
8
+ };`)(...Object.values(this.closed))}}var ep={major:4,minor:6,patch:5};var J=m("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ep;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 h of c){if(h._zod.def.when){if(pd(a))continue;if(!h._zod.def.when(a))continue}else if(u)continue;let g=a.issues.length,y=h._zod.check(a);if(y instanceof Promise&&l?.async===!1)throw new ut;if(d||y instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await y,a.issues.length===g)return;if(xs(a.issues,g,e),!u)u=Ve(a,g)});else{if(a.issues.length===g)continue;if(xs(a.issues,g,e),!u)u=Ve(a,g)}}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 ut;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 ut;return l.then((u)=>i(u,o,c))}return i(l,o,c)}}},{get "~standard"(){return Qn(this,"~standard",wa(this))},set "~standard"(e){yt(this,"~standard",e)}}),yp=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>Ue(n,t,Ae()))}:{value:e.value};async function Fv(e,t){let n={async:!0};return yp(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 yp(r,n)}catch(r){}return Fv(e,t)},vendor:"zod",version:1}}var ln=m("$ZodString",(e,t)=>{J.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)=>{or.init(e,t),ln.init(e,t)}),bp=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ls),ae.init(e,t)}),wp=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=Jt(r))}else t.pattern??(t.pattern=Jt());ae.init(e,t)}),vp=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Fs),ae.init(e,t)}),kp=1,Ao=2;function xp(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Mv(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return xp(e)||Ao;return Zv(e,t)}function Zv(e,t){if(!t.normalize&&t.protocol?.source===er.source&&!/^https?:\/\//i.test(e))return kp;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 Jv=/[\t\n\r]/g;function tp(e){return e.replace(Jv,"")}function Bv(e,t){return t.lastIndex=0,t.test(e.hostname)}function Uv(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Sp=m("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim(),o=Mv(r,t);if(o===kp){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=tp(r);return}if(t.hostname&&!Bv(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&&!Uv(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:tp(r);return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ip=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ms()),ae.init(e,t)}),Cp=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)}),Ep=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ps),ae.init(e,t)}),Op=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ts),ae.init(e,t)}),jp=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=$s),ae.init(e,t)}),_p=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ns),ae.init(e,t)}),Rp=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=zs),ae.init(e,t)}),Ap=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=na(t)),ae.init(e,t)}),Pp=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ea),ae.init(e,t)}),Tp=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ta(t)),ae.init(e,t)}),$p=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Vs),ae.init(e,t)}),Np=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Zs),ae.init(e,t)}),Kv=/^[0-9a-fA-F:.]+$/;function zp(e){if(!Kv.test(e))return!1;return xp(`http://[${e}]`)}var Dp=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Js),ae.init(e,t),e._zod.check=(n)=>{if(!zp(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),qp=m("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Bs(t.delimiter)),ae.init(e,t)}),Vp=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Us),ae.init(e,t)});function Wv(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 zp(n)}var Lp=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ks),ae.init(e,t),e._zod.check=(n)=>{if(!Wv(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Fp(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}$/,Mp=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=va),ae.init(e,t),e._zod.check=(n)=>{if(Fp(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 Gv(e){if(!To.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Fp(n)}var Zp=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=To),ae.init(e,t),e._zod.check=(n)=>{if(Gv(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Jp=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ys),ae.init(e,t)}),Hv=/[- ]/g;function Qv(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 Yv(e){if(!Io.test(e))return!1;return Qv(e.replace(Hv,""))}var Bp=m("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Io),ae.init(e,t),e._zod.check=(n)=>{if(Yv(n.value))return;n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function Xv(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 ek(e){if(!Co.test(e))return!1;return Xv(e)}var Up=m("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Co),ae.init(e,t),e._zod.check=(n)=>{if(ek(n.value))return;n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function tk(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 Kp=m("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=(n)=>{if(tk(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Wp=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})}}),ka=m("$ZodNumber",(e,t)=>{J.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}}),Gp=m("$ZodNumberFormat",(e,t)=>{Nd.init(e,t),ka.init(e,t)}),$o=m("$ZodBoolean",(e,t)=>{J.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}}),xa=m("$ZodBigInt",(e,t)=>{J.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}}),Hp=m("$ZodBigIntFormat",(e,t)=>{zd.init(e,t),xa.init(e,t)}),Qp=m("$ZodSymbol",(e,t)=>{J.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}}),Yp=m("$ZodUndefined",(e,t)=>{J.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}}),Xp=m("$ZodNull",(e,t)=>{J.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}}),ef=m("$ZodAny",(e,t)=>{J.init(e,t),e._zod.parse=(n)=>n}),tf=m("$ZodUnknown",(e,t)=>{J.init(e,t),e._zod.parse=(n)=>n}),nf=m("$ZodNever",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),rf=m("$ZodVoid",(e,t)=>{J.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}}),of=m("$ZodDate",(e,t)=>{J.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 np(e,t,n){if(e.issues.length)t.issues.push(...Be(n,e.issues));t.value[n]=e.value}var sf=m("$ZodArray",(e,t)=>{J.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)=>np(d,r,c)));else if(np(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(...Be(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 nk=[];function af(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:nk,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=ld(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function cf(e,t,n,r,o,i,s){let a=[],c=o.keySet,l=o.catchall._zod,u=l.def.type,{optin:d,optout:h}=l,g=0;for(let y in t){if(s&&n.issues.length!==g){if(Ve(n,g))break;g=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((A)=>Po(A,n,y,t,d,h)));else Po(S,n,y,t,d,h)}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 rk=m("$ZodObject",(e,t)=>{J.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=Gn(()=>af(t));G(e,"propValues",(l)=>{let u=l.def.shape,d={};for(let h in u){let g=u[h]._zod;if(g.values){if(!Object.prototype.hasOwnProperty.call(d,h))Re(d,h,new Set);for(let y of g.values)d[h].add(y);if(g.optin!==void 0)d[h].add(void 0)}}return d});let i=an,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 h=[],g=a.shape,y=u?.abortEarly,S=l.issues.length;for(let A of a.allKeys){if(y&&l.issues.length!==S){if(Ve(l,S))break;S=l.issues.length}if(A==="__proto__")continue;let N=g[A],L=N._zod.optin,D=N._zod.optout,fe=N._zod.run({value:d[A],issues:[]},u);if(fe instanceof Promise)h.push(fe.then((ge)=>Po(ge,l,A,d,L,D)));else Po(fe,l,A,d,L,D)}if(!s)return h.length?Promise.all(h).then(()=>l):l;return cf(h,d,l,u,o.value,e,y===!0)}}),lf=m("$ZodObjectJIT",(e,t)=>{rk.init(e,t);let n=e._zod.parse,r=Gn(()=>af(t)),o=je.memoizer,i=(g)=>{let y=r.value,S=y.symbolKeys,A=new ha(["payload","ctx"],{shape:g,inst:e,memo:o,syms:S}),N=(ge)=>`shape[${ge}]._zod.run({ value: input[${ge}], issues: [] }, ctx)`,L=(ge,se)=>`
9
+ let ${ge}_ab = false;
10
+ for (let i = 0; i < ${ge}.issues.length; i++) {
11
+ const iss = ${ge}.issues[i];
12
12
  iss.path = iss.path ? [${se}, ...iss.path] : [${se}];
13
13
  payload.issues.push(iss);
14
- if (iss.continue !== true) ${me}_ab = true;
14
+ if (iss.continue !== true) ${ge}_ab = true;
15
15
  }
16
- if (${me}_ab && ctx && ctx.abortEarly) {
16
+ if (${ge}_ab && ctx && ctx.abortEarly) {
17
17
  payload.value = newResult;
18
18
  return payload;
19
- }`;A.write("const input = payload.value;");let D=Object.create(null),fe=0;for(let me of y.allKeys)D[me]=`key_${fe++}`;A.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let me of y.allKeys){if(me==="__proto__")continue;let se=D[me],qe=typeof me==="symbol"?`syms[${S.indexOf(me)}]`:td(me),Vt=`${qe} in input`,tn=g[me],Lt=tn?._zod?.optin,Mn=Lt!==void 0,Fn=tn?._zod?.optout==="optional";if(A.write(`const ${se} = ${N(qe)};`),Mn&&Fn){let so=Lt==="optional"?`${se}_present`:`${se}.value !== undefined || ${se}_present`;A.write(`
20
- const ${se}_present = ${Vt};
19
+ }`;A.write("const input = payload.value;");let D=Object.create(null),fe=0;for(let ge of y.allKeys)D[ge]=`key_${fe++}`;A.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let ge of y.allKeys){if(ge==="__proto__")continue;let se=D[ge],qe=typeof ge==="symbol"?`syms[${S.indexOf(ge)}]`:id(ge),Lt=`${qe} in input`,tn=g[ge],Ft=tn?._zod?.optin,nn=Ft!==void 0,Zn=tn?._zod?.optout==="optional";if(A.write(`const ${se} = ${N(qe)};`),nn&&Zn){let so=Ft==="optional"?`${se}_present`:`${se}.value !== undefined || ${se}_present`;A.write(`
20
+ const ${se}_present = ${Lt};
21
21
  if (!${se}.issues.length || ${se}_present) {
22
- if (${se}.issues.length) {${M(se,qe)}
22
+ if (${se}.issues.length) {${L(se,qe)}
23
23
  }
24
24
 
25
25
  if (${so}) {
@@ -27,9 +27,9 @@ ${t.join(`
27
27
  }
28
28
  }
29
29
 
30
- `)}else if(!Mn)A.write(`
31
- const ${se}_present = ${Vt};
32
- if (${se}.issues.length) {${M(se,qe)}
30
+ `)}else if(!nn)A.write(`
31
+ const ${se}_present = ${Lt};
32
+ if (${se}.issues.length) {${L(se,qe)}
33
33
  }
34
34
  if (!${se}_present && !${se}.issues.length) {
35
35
  payload.issues.push({
@@ -49,39 +49,41 @@ ${t.join(`
49
49
  }
50
50
 
51
51
  `);else if(A.write(`
52
- if (${se}.issues.length) {${M(se,qe)}
52
+ if (${se}.issues.length) {${L(se,qe)}
53
53
  }
54
- `),Lt==="defaulted")A.write(`newResult[${qe}] = ${se}.value;`);else A.write(`
55
- if (${se}.value !== undefined || ${Vt}) {
54
+ `),Ft==="defaulted")A.write(`newResult[${qe}] = ${se}.value;`);else A.write(`
55
+ if (${se}.value !== undefined || ${Lt}) {
56
56
  newResult[${qe}] = ${se}.value;
57
57
  }
58
- `)}return A.write("payload.value = newResult;"),A.write("return payload;"),A.compile()},s,a=sn,c=!je.jitless,u=c&&rd.value,d=t.catchall,h;e._zod.parse=(g,y)=>{h??(h=r.value);let S=g.value;if(!a(S))return g.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),g;if(c&&u&&y?.async===!1&&y.jitless!==!0){if(!s)s=i(t.shape);if(g=s(g,y),!d)return g;return rf([],S,g,y,h,e,y?.abortEarly===!0)}return n(g,y)}});function Xd(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)=>{J.init(e,t),H(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),H(e,"optout",(r)=>r.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),H(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}),H(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)=>It(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 Xd(s,r,e,o);return Promise.all(s).then((a)=>Xd(a,r,e,o))}});function ep(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 sf=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 ep(s,r,e,o);return Promise.all(s).then((a)=>ep(a,r,e,o))}});function Kv(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 af=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,No.init(e,t);let n=e._zod.parse;H(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=Hn(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let r=Wn(()=>Kv(t));e._zod.parse=(o,i)=>{let s=o.value;if(!sn(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}}),cf=m("$ZodIntersection",(e,t)=>{J.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])=>tp(n,c,l));return tp(n,i,s)}});function ha(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(yt(e)&&yt(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=ha(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=ha(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 tp(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 h=String(l.path[0]);if(!i.has(h))i.set(h,l);d=[h]}else return!1;for(let h of d){if(!r.has(h))r.set(h,{});r.get(h)[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=ha(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 ka=m("$ZodTuple",(e,t)=>{J.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=np(n,"optin"),l=np(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,h=!1;for(let g=0;g<n.length;g++){let y=n[g]._zod.run({value:s[g],issues:[]},i);if(y instanceof Promise)a.push(y.then((S)=>{u[g]=S}));else if(u[g]=y,d&&!h&&y.issues.length)h=Ve(y)}if(t.rest&&!h){let g=n.length-1,y=s.slice(n.length),S=o.issues.length;for(let A of y){if(d&&o.issues.length!==S){if(Ve(o,S))break;S=o.issues.length}g++;let N=t.rest._zod.run({value:A,issues:[]},i);if(N instanceof Promise)a.push(N.then((M)=>rp(M,o,g)));else rp(N,o,g)}}if(a.length)return Promise.all(a).then(()=>op(u,o,n,s,l));return op(u,o,n,s,l)}});function np(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 rp(e,t,n){if(e.issues.length)t.issues.push(...Ue(n,e.issues));t.value[n]=e.value}function op(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 lf=m("$ZodRecord",(e,t)=>{J.init(e,t);let n=je.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!yt(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 h=d.value;if(h==="__proto__")continue;let g=t.valueType._zod.run({value:i[u],issues:[]},o);if(g instanceof Promise)s.push(g.then((y)=>{if(y.issues.length)r.issues.push(...Ue(u,y.issues));r.value[h]=y.value}));else{if(g.issues.length)r.issues.push(...Ue(u,g.issues));r.value[h]=g.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"&&Jt.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 h=u.value;if(h==="__proto__")continue;let g=t.valueType._zod.run({value:i[l],issues:[]},o);if(g instanceof Promise)s.push(g.then((y)=>{if(y.issues.length)r.issues.push(...Ue(l,y.issues));r.value[h]=y.value}));else{if(g.issues.length)r.issues.push(...Ue(l,g.issues));r.value[h]=g.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}}),uf=m("$ZodMap",(e,t)=>{J.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),h=t.valueType._zod.run({value:u,issues:[]},o);if(d instanceof Promise||h instanceof Promise)s.push(Promise.all([d,h]).then(([g,y])=>{ip(g,y,r,l,i,e,o)}));else ip(d,h,r,l,i,e,o)}if(s.length)return Promise.all(s).then(()=>r);return r}});function ip(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 df=m("$ZodSet",(e,t)=>{J.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)=>sp(d,r)));else sp(u,r)}if(s.length)return Promise.all(s).then(()=>r);return r}});function sp(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var pf=m("$ZodEnum",(e,t)=>{J.init(e,t);let n=Bn(t.entries),r=new Set(n);e._zod.values=r,H(e,"pattern",(o)=>{let i=Bn(o.def.entries).filter((s)=>fo.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>Xe(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}}),ff=m("$ZodLiteral",(e,t)=>{J.init(e,t);let n=new Set(t.values);e._zod.values=n,H(e,"pattern",(r)=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?Xe(i):i?Xe(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}}),mf=m("$ZodFile",(e,t)=>{J.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}}),gf=m("$ZodTransform",(e,t)=>{J.init(e,t),e._zod.optin="optional",je.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new an(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 ct;return n.value=o,n}});function ap(e,t){return e.value=t.issues.length?void 0:t.value,e}var Sa=m("$ZodOptional",(e,t)=>{J.init(e,t),H(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",H(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),H(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${It(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)=>ap(n,i));return ap(n,o)}return t.innerType._zod.run(n,r)}}),hf=m("$ZodExactOptional",(e,t)=>{Sa.init(e,t),H(e,"values",(n)=>n.def.innerType._zod.values),H(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),yf=m("$ZodNullable",(e,t)=>{J.init(e,t),H(e,"optin",(n)=>n.def.innerType._zod.optin),H(e,"optout",(n)=>n.def.innerType._zod.optout),H(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${It(r.source)}|null)$`):void 0}),H(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)}}),bf=m("$ZodDefault",(e,t)=>{J.init(e,t),e._zod.optin="defaulted",H(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)=>cp(i,t));return cp(o,t)}});function cp(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var wf=m("$ZodPrefault",(e,t)=>{J.init(e,t),e._zod.optin="defaulted",H(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)}}),vf=m("$ZodNonOptional",(e,t)=>{J.init(e,t),H(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)=>lp(i,e));return lp(o,e)}});function lp(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 xf=m("$ZodSuccess",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new an("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 up(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 kf=m("$ZodCatch",(e,t)=>{J.init(e,t),H(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),H(e,"optout",(n)=>n.def.innerType._zod.optout),H(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)=>up(n,i,t,r));return up(n,o,t,r)}}),Sf=m("$ZodNaN",(e,t)=>{J.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}}),Ia=m("$ZodPipe",(e,t)=>{J.init(e,t),H(e,"values",(n)=>n.def.in._zod.values),H(e,"optin",(n)=>n.def.in._zod.optin),H(e,"optout",(n)=>n.def.out._zod.optout),H(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)=>{J.init(e,t),H(e,"values",(n)=>n.def.in._zod.values),H(e,"optin",(n)=>n.def.in._zod.optin),H(e,"optout",(n)=>n.def.out._zod.optout),H(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 If=m("$ZodPreprocess",(e,t)=>{Ia.init(e,t)}),Cf=m("$ZodReadonly",(e,t)=>{J.init(e,t),H(e,"propValues",(n)=>n.def.innerType._zod.propValues),H(e,"values",(n)=>n.def.innerType._zod.values),H(e,"optin",(n)=>n.def.innerType?._zod?.optin),H(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(dp);return dp(o)}});function dp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}function Wv(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 ra({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===Jt?er:s)?.source}function ya(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=ya(r);if(n&&o&&i&&i!==o)return n.replace(It(o),()=>It(i));return n}if(t.options){let o=t.options.map(ya);if(o.every(Boolean))return`^(${o.map((i)=>It(i)).join("|")})$`}return Wv(e)}var Ef=m("$ZodTemplateLiteral",(e,t)=>{J.init(e,t);let n=[];for(let r of t.parts)if(typeof r==="object"&&r!==null){let o=ya(r);if(!o)throw Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(It(o))}else if(r===null||od.has(typeof r))n.push(Xe(`${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}}),Of=m("$ZodFunction",(e,t)=>(J.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?Es(e._def.input,r):r,i=Reflect.apply(n,this,o);if(e._def.output)return Es(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 Os(e._def.input,r):r,i=await Reflect.apply(n,this,o);if(e._def.output)return await Os(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 ka({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)),jf=m("$ZodPromise",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then((o)=>t.innerType._zod.run({value:o,issues:[]},r))}),_f=m("$ZodLazy",(e,t)=>{J.init(e,t),Yu(e._zod,"innerType",()=>{let n=t;if(!n._cachedInner)n._cachedInner=t.getter();return n._cachedInner}),H(e,"pattern",(n)=>n.innerType?._zod?.pattern),H(e,"propValues",(n)=>n.innerType?._zod?.propValues),H(e,"optin",(n)=>n.innerType?._zod?.optin??void 0),H(e,"optout",(n)=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Rf=m("$ZodCustom",(e,t)=>{ue.init(e,t),J.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)=>pp(i,n,r,e));pp(o,n,r,e);return}});function pp(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(Ft(o))}}class Pf extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Ea="~memo",Af=[];function Tf(e){return e!==null&&typeof e==="object"}function Ca(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var $f=new WeakMap,or=0,Vo=1,ir=2;function Lo(e,t,n){let r=$f.get(e);if(r!==void 0)return r?ir:or;if(t.has(e))return ir;t.add(e);let o=or,i=(u)=>{if(o!==ir&&u?._zod){let d=Lo(u,t,n);if(d>o)o=d}},s=(u,d)=>{let h=or;for(let g of Reflect.ownKeys(u)){let y=Object.getOwnPropertyDescriptor(u,g);if(d&&!y.enumerable)continue;let S=y.get?Vo:y.value?._zod?Lo(y.value,t,n):or;if(S>h)h=S}return h},a=(u)=>{if(u>o)o=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=Hn(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 h=d.value;if(!h||typeof h!=="object")continue;if(h._zod)i(h);else if(Array.isArray(h))for(let g of h)i(g)}}return t.delete(e),Gv(e,o)}function Gv(e,t){if(t!==Vo)$f.set(e,t===ir);return t}function Qv(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var Do,qo=[],Yv={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"&&Xv(i,o.value))throw new Pf;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===or){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(N===ir||r)n=!0;else r=!0}let u=c.value;if(!Tf(u))return s(c,l);let d=l[Ea];if(!d)d={buckets:new WeakMap,backEdges:void 0},l[Ea]=d;let h;if(o===l)h=i;else h=Qv(d,e),o=l,i=h;let g=h.get(u);if(g){if(c.value=g.value,g.issues){if(g.issues.length)c.issues.push(...Ca(g.issues))}else c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(g.value);return c}Do=h;let y=qo.length,S=s(c,l);Do=void 0;let A=qo.length>y?qo.pop():void 0;if(S instanceof Promise)return S.then((N)=>{if(A)A.issues=N.issues.length?Ca(N.issues):Af;return N});if(A)A.issues=S.issues.length?Ca(S.issues):Af;return S};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function Nf(){return Yv}function Xv(e,t){let n=e[Ea]?.backEdges;return n!==void 0&&Tf(t)&&n.has(t)}var ex=()=>{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=ld(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 ${vs(i.values[0])}`;return`Invalid option: expected one of ${hs(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":""}: ${hs(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 Oa(){return{localeError:ex()}}var zf;class Df{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 tx(){return new Df}(zf=globalThis).__zod_globalRegistry??(zf.__zod_globalRegistry=tx());var Le=globalThis.__zod_globalRegistry;function qf(e){if(e.checks)e.checks=[...e.checks];return e}function Vf(e,t){return new e(qf({type:"string",...O(t)}))}function ja(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function _a(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function Ra(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Aa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Pa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function Ta(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 $a(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Na(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function za(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function Da(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function qa(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function Va(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function La(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Ma(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Fa(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function Lf(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...O(t)})}function Za(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function Ja(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function Ua(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function Ba(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function Ka(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function Mf(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...O(t)})}function Ff(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...O(t)})}function Wa(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 Zf(e,t){return new e(qf({type:"number",checks:[],...O(t)}))}function Jf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function Uf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...O(t)})}function Bf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...O(t)})}function Kf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...O(t)})}function Wf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...O(t)})}function Hf(e,t){return new e({type:"boolean",...O(t)})}function Gf(e,t){return new e({type:"bigint",...O(t)})}function Qf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...O(t)})}function Yf(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...O(t)})}function Xf(e,t){return new e({type:"symbol",...O(t)})}function em(e,t){return new e({type:"undefined",...O(t)})}function tm(e,t){return new e({type:"null",...O(t)})}function nm(e){return new e({type:"any"})}function rm(e){return new e({type:"unknown"})}function om(e,t){return new e({type:"never",...O(t)})}function im(e,t){return new e({type:"void",...O(t)})}function sm(e,t){return new e({type:"date",...O(t)})}function am(e,t){return new e({type:"nan",...O(t)})}function Et(e,t){return new fa({check:"less_than",...O(t),value:e,inclusive:!1})}function et(e,t){return new fa({check:"less_than",...O(t),value:e,inclusive:!0})}function Ot(e,t){return new ma({check:"greater_than",...O(t),value:e,inclusive:!1})}function tt(e,t){return new ma({check:"greater_than",...O(t),value:e,inclusive:!0})}function cm(e){return Ot(0,e)}function lm(e){return Et(0,e)}function um(e){return et(0,e)}function dm(e){return tt(0,e)}function ln(e,t){return new Rd({check:"multiple_of",...O(t),value:e})}function un(e,t){return new Td({check:"max_size",...O(t),maximum:e})}function jt(e,t){return new $d({check:"min_size",...O(t),minimum:e})}function sr(e,t){return new Nd({check:"size_equals",...O(t),size:e})}function ar(e,t){return new zd({check:"max_length",...O(t),maximum:e})}function Ut(e,t){return new Dd({check:"min_length",...O(t),minimum:e})}function cr(e,t){return new qd({check:"length_equals",...O(t),length:e})}function Bo(e,t){return new Vd({check:"string_format",format:"regex",...O(t),pattern:e})}function Ko(e){return new Ld({check:"string_format",format:"lowercase",...O(e)})}function Wo(e){return new Md({check:"string_format",format:"uppercase",...O(e)})}function Ho(e,t){return new Fd({check:"string_format",format:"includes",...O(t),includes:e})}function Go(e,t){return new Zd({check:"string_format",format:"starts_with",...O(t),prefix:e})}function Qo(e,t){return new Jd({check:"string_format",format:"ends_with",...O(t),suffix:e})}function pm(e,t,n){return new Ud({check:"property",property:e,schema:t,...O(n)})}function Yo(e,t){return new Bd({check:"properties",shape:e,...O(t)})}function Xo(e,t){return new Kd({check:"mime_type",mime:e,...O(t)})}function bt(e){return new Wd({check:"overwrite",tx:e})}function ei(e){return bt((t)=>t.normalize(e))}function ti(){return bt((e)=>e.trim())}function ni(){return bt((e)=>e.toLowerCase())}function ri(){return bt((e)=>e.toUpperCase())}function oi(){return bt((e)=>nd(e))}function fm(e,t,n){return new e({type:"array",element:t,...O(n)})}function mm(e,t){return new e({type:"file",...O(t)})}function gm(e,t,n){let r=O(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function hm(e,t,n){return new e({type:"custom",check:"custom",fn:t,...O(n)})}function ym(e,t){let n=rx((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Ft(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(Ft(i))}},e(r.value,r)),t);return n}function rx(e,t){let n=new ue({check:"custom",...O(t)});return n._zod.check=e,n}function bm(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 wm(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 vm(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((g)=>typeof g==="string"?g.toLowerCase():g),o=o.map((g)=>typeof g==="string"?g.toLowerCase():g);let i=new Set(r),s=new Set(o),a=e.Codec??zo,c=e.Boolean??$o,u=new(e.String??cn)({type:"string",error:n.error}),d=new c({type:"boolean",error:n.error}),h=new a({type:"pipe",in:u,out:d,transform:(g,y)=>{let S=g;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:h,continue:!1}),{}},reverseTransform:(g,y)=>{if(g===!0)return r[0]||"true";else return o[0]||"false"},error:n.error});return h._zod.bag.truthy=r,h._zod.bag.falsy=o,h._zod.bag.case=n.case??"insensitive",h}function dn(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 lr(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 dr(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 Ee(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 h=s.schema,g=t.processors[o.type];if(!g)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);g(e,t,h,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)lr(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 xm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function pr(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,h=e.external.uri??((y)=>y);if(d)return{ref:h(d)};let g=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=g,{defId:g,ref:`${h("__shared")}#/${a}/${xm(g)}`}}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+xm(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 A.write("payload.value = newResult;"),A.write("return payload;"),A.compile()},s,a=an,c=!je.jitless,u=c&&ad.value,d=t.catchall,h;e._zod.parse=(g,y)=>{h??(h=r.value);let S=g.value;if(!a(S))return g.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),g;if(c&&u&&y?.async===!1&&y.jitless!==!0){if(!s)s=i(t.shape);if(g=s(g,y),!d)return g;return cf([],S,g,y,h,e,y?.abortEarly===!0)}return n(g,y)}});function rp(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)=>Ue(s,r,Ae())))}),t}var No=m("$ZodUnion",(e,t)=>{J.init(e,t),G(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),G(e,"optout",(r)=>r.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),G(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}),G(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 rp(s,r,e,o);return Promise.all(s).then((a)=>rp(a,r,e,o))}});function op(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)=>Ue(s,r,Ae())))});else t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o});return t}var uf=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 op(s,r,e,o);return Promise.all(s).then((a)=>op(a,r,e,o))}});function ok(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 df=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,No.init(e,t);let n=e._zod.parse;G(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))Re(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=Hn(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let r=Gn(()=>ok(t));e._zod.parse=(o,i)=>{let s=o.value;if(!an(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}}),pf=m("$ZodIntersection",(e,t)=>{J.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])=>ip(n,c,l));return ip(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 ip(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 h=String(l.path[0]);if(!i.has(h))i.set(h,l);d=[h]}else return!1;for(let h of d){if(!r.has(h))r.set(h,{});r.get(h)[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)=>{J.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=sp(n,"optin"),l=sp(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,h=!1;for(let g=0;g<n.length;g++){let y=n[g]._zod.run({value:s[g],issues:[]},i);if(y instanceof Promise)a.push(y.then((S)=>{u[g]=S}));else if(u[g]=y,d&&!h&&y.issues.length)h=Ve(y)}if(t.rest&&!h){let g=n.length-1,y=s.slice(n.length),S=o.issues.length;for(let A of y){if(d&&o.issues.length!==S){if(Ve(o,S))break;S=o.issues.length}g++;let N=t.rest._zod.run({value:A,issues:[]},i);if(N instanceof Promise)a.push(N.then((L)=>ap(L,o,g)));else ap(N,o,g)}}if(a.length)return Promise.all(a).then(()=>cp(u,o,n,s,l));return cp(u,o,n,s,l)}});function sp(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 ap(e,t,n){if(e.issues.length)t.issues.push(...Be(n,e.issues));t.value[n]=e.value}function cp(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(...Be(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 ff=m("$ZodRecord",(e,t)=>{J.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)=>Ue(y,o,Ae())),input:u,path:[u],inst:e});continue}let h=d.value;if(h==="__proto__")continue;let g=t.valueType._zod.run({value:i[u],issues:[]},o);if(g instanceof Promise)s.push(g.then((y)=>{if(y.issues.length)r.issues.push(...Be(u,y.issues));r.value[h]=y.value}));else{if(g.issues.length)r.issues.push(...Be(u,g.issues));r.value[h]=g.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)=>Ue(y,o,Ae())),input:l,path:[l],inst:e});continue}let h=u.value;if(h==="__proto__")continue;let g=t.valueType._zod.run({value:i[l],issues:[]},o);if(g instanceof Promise)s.push(g.then((y)=>{if(y.issues.length)r.issues.push(...Be(l,y.issues));r.value[h]=y.value}));else{if(g.issues.length)r.issues.push(...Be(l,g.issues));r.value[h]=g.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}}),mf=m("$ZodMap",(e,t)=>{J.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),h=t.valueType._zod.run({value:u,issues:[]},o);if(d instanceof Promise||h instanceof Promise)s.push(Promise.all([d,h]).then(([g,y])=>{lp(g,y,r,l,i,e,o)}));else lp(d,h,r,l,i,e,o)}if(s.length)return Promise.all(s).then(()=>r);return r}});function lp(e,t,n,r,o,i,s){if(e.issues.length)if(fo.has(typeof r))n.issues.push(...Be(r,e.issues));else n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map((a)=>Ue(a,s,Ae()))});if(t.issues.length)if(fo.has(typeof r))n.issues.push(...Be(r,t.issues));else n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map((a)=>Ue(a,s,Ae()))});n.value.set(e.value,t.value)}var gf=m("$ZodSet",(e,t)=>{J.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)=>up(d,r)));else up(u,r)}if(s.length)return Promise.all(s).then(()=>r);return r}});function up(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var hf=m("$ZodEnum",(e,t)=>{J.init(e,t);let n=Kn(t.entries),r=new Set(n);e._zod.values=r,G(e,"pattern",(o)=>{let i=Kn(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}}),yf=m("$ZodLiteral",(e,t)=>{J.init(e,t);let n=new Set(t.values);e._zod.values=n,G(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}}),bf=m("$ZodFile",(e,t)=>{J.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}}),wf=m("$ZodTransform",(e,t)=>{J.init(e,t),e._zod.optin="optional",je.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new cn(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 ut;return n.value=o,n}});function dp(e,t){return e.value=t.issues.length?void 0:t.value,e}var Ia=m("$ZodOptional",(e,t)=>{J.init(e,t),G(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",G(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),G(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)=>dp(n,i));return dp(n,o)}return t.innerType._zod.run(n,r)}}),vf=m("$ZodExactOptional",(e,t)=>{Ia.init(e,t),G(e,"values",(n)=>n.def.innerType._zod.values),G(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),kf=m("$ZodNullable",(e,t)=>{J.init(e,t),G(e,"optin",(n)=>n.def.innerType._zod.optin),G(e,"optout",(n)=>n.def.innerType._zod.optout),G(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Et(r.source)}|null)$`):void 0}),G(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)}}),xf=m("$ZodDefault",(e,t)=>{J.init(e,t),e._zod.optin="defaulted",G(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)=>pp(i,t));return pp(o,t)}});function pp(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Sf=m("$ZodPrefault",(e,t)=>{J.init(e,t),e._zod.optin="defaulted",G(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)}}),If=m("$ZodNonOptional",(e,t)=>{J.init(e,t),G(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)=>fp(i,e));return fp(o,e)}});function fp(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 Cf=m("$ZodSuccess",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new cn("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 mp(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)=>Ue(o,r,Ae()))},input:e.value}),e}var Ef=m("$ZodCatch",(e,t)=>{J.init(e,t),G(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),G(e,"optout",(n)=>n.def.innerType._zod.optout),G(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)=>mp(n,i,t,r));return mp(n,o,t,r)}}),Of=m("$ZodNaN",(e,t)=>{J.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)=>{J.init(e,t),G(e,"values",(n)=>n.def.in._zod.values),G(e,"optin",(n)=>n.def.in._zod.optin),G(e,"optout",(n)=>n.def.out._zod.optout),G(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)=>{J.init(e,t),G(e,"values",(n)=>n.def.in._zod.values),G(e,"optin",(n)=>n.def.in._zod.optin),G(e,"optout",(n)=>n.def.out._zod.optout),G(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 jf=m("$ZodPreprocess",(e,t)=>{Ca.init(e,t)}),_f=m("$ZodReadonly",(e,t)=>{J.init(e,t),G(e,"propValues",(n)=>n.def.innerType._zod.propValues),G(e,"values",(n)=>n.def.innerType._zod.values),G(e,"optin",(n)=>n.def.innerType?._zod?.optin),G(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(gp);return gp(o)}});function gp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}function ik(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?tr: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 ik(e)}var Rf=m("$ZodTemplateLiteral",(e,t)=>{J.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||cd.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}}),Af=m("$ZodFunction",(e,t)=>(J.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)),Pf=m("$ZodPromise",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then((o)=>t.innerType._zod.run({value:o,issues:[]},r))}),Tf=m("$ZodLazy",(e,t)=>{J.init(e,t),nd(e._zod,"innerType",()=>{let n=t;if(!n._cachedInner)n._cachedInner=t.getter();return n._cachedInner}),G(e,"pattern",(n)=>n.innerType?._zod?.pattern),G(e,"propValues",(n)=>n.innerType?._zod?.propValues),G(e,"optin",(n)=>n.innerType?._zod?.optin??void 0),G(e,"optout",(n)=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),$f=m("$ZodCustom",(e,t)=>{ue.init(e,t),J.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)=>hp(i,n,r,e));hp(o,n,r,e);return}});function hp(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(Zt(o))}}class zf extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Oa="~memo",Nf=[];function Df(e){return e!==null&&typeof e==="object"}function Ea(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var qf=new WeakMap,ir=0,Vo=1,sr=2;function Lo(e,t,n){let r=qf.get(e);if(r!==void 0)return r?sr:ir;if(t.has(e))return sr;t.add(e);let o=ir,i=(u)=>{if(o!==sr&&u?._zod){let d=Lo(u,t,n);if(d>o)o=d}},s=(u,d)=>{let h=ir;for(let g of Reflect.ownKeys(u)){let y=Object.getOwnPropertyDescriptor(u,g);if(d&&!y.enumerable)continue;let S=y.get?Vo:y.value?._zod?Lo(y.value,t,n):ir;if(S>h)h=S}return h},a=(u)=>{if(u>o)o=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=Hn(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 h=d.value;if(!h||typeof h!=="object")continue;if(h._zod)i(h);else if(Array.isArray(h))for(let g of h)i(g)}}return t.delete(e),ak(e,o)}function ak(e,t){if(t!==Vo)qf.set(e,t===sr);return t}function ck(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var Do,qo=[],lk={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"&&uk(i,o.value))throw new zf;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===ir){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(N===sr||r)n=!0;else r=!0}let u=c.value;if(!Df(u))return s(c,l);let d=l[Oa];if(!d)d={buckets:new WeakMap,backEdges:void 0},l[Oa]=d;let h;if(o===l)h=i;else h=ck(d,e),o=l,i=h;let g=h.get(u);if(g){if(c.value=g.value,g.issues){if(g.issues.length)c.issues.push(...Ea(g.issues))}else c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(g.value);return c}Do=h;let y=qo.length,S=s(c,l);Do=void 0;let A=qo.length>y?qo.pop():void 0;if(S instanceof Promise)return S.then((N)=>{if(A)A.issues=N.issues.length?Ea(N.issues):Nf;return N});if(A)A.issues=S.issues.length?Ea(S.issues):Nf;return S};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function Vf(){return lk}function uk(e,t){let n=e[Oa]?.backEdges;return n!==void 0&&Df(t)&&n.has(t)}var dk=()=>{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=fd(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 ${ks(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:dk()}}var Lf;class Ff{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 pk(){return new Ff}(Lf=globalThis).__zod_globalRegistry??(Lf.__zod_globalRegistry=pk());var Le=globalThis.__zod_globalRegistry;function Mf(e){if(e.checks)e.checks=[...e.checks];return e}function Zf(e,t){return new e(Mf({type:"string",...j(t)}))}function _a(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...j(t)})}function Ra(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...j(t)})}function Aa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...j(t)})}function Pa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...j(t)})}function Ta(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...j(t)})}function $a(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...j(t)})}function Fo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...j(t)})}function Na(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...j(t)})}function za(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...j(t)})}function Da(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...j(t)})}function qa(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...j(t)})}function Va(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...j(t)})}function La(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...j(t)})}function Fa(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...j(t)})}function Ma(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...j(t)})}function Za(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...j(t)})}function Jf(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...j(t)})}function Ja(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...j(t)})}function Ba(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...j(t)})}function Ua(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...j(t)})}function Ka(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...j(t)})}function Wa(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...j(t)})}function Bf(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...j(t)})}function Uf(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...j(t)})}function Ga(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...j(t)})}function Mo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...j(t)})}function Zo(e,t){return new e({type:"string",format:"date",check:"string_format",...j(t)})}function Jo(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...j(t)})}function Bo(e,t){return new e({type:"string",format:"duration",check:"string_format",...j(t)})}function Kf(e,t){return new e(Mf({type:"number",checks:[],...j(t)}))}function Wf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...j(t)})}function Gf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...j(t)})}function Hf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...j(t)})}function Qf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...j(t)})}function Yf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...j(t)})}function Xf(e,t){return new e({type:"boolean",...j(t)})}function em(e,t){return new e({type:"bigint",...j(t)})}function tm(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...j(t)})}function nm(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...j(t)})}function rm(e,t){return new e({type:"symbol",...j(t)})}function om(e,t){return new e({type:"undefined",...j(t)})}function im(e,t){return new e({type:"null",...j(t)})}function sm(e){return new e({type:"any"})}function am(e){return new e({type:"unknown"})}function cm(e,t){return new e({type:"never",...j(t)})}function lm(e,t){return new e({type:"void",...j(t)})}function um(e,t){return new e({type:"date",...j(t)})}function dm(e,t){return new e({type:"nan",...j(t)})}function jt(e,t){return new ma({check:"less_than",...j(t),value:e,inclusive:!1})}function tt(e,t){return new ma({check:"less_than",...j(t),value:e,inclusive:!0})}function _t(e,t){return new ga({check:"greater_than",...j(t),value:e,inclusive:!1})}function nt(e,t){return new ga({check:"greater_than",...j(t),value:e,inclusive:!0})}function pm(e){return _t(0,e)}function fm(e){return jt(0,e)}function mm(e){return tt(0,e)}function gm(e){return nt(0,e)}function un(e,t){return new $d({check:"multiple_of",...j(t),value:e})}function dn(e,t){return new Dd({check:"max_size",...j(t),maximum:e})}function Rt(e,t){return new qd({check:"min_size",...j(t),minimum:e})}function ar(e,t){return new Vd({check:"size_equals",...j(t),size:e})}function cr(e,t){return new Ld({check:"max_length",...j(t),maximum:e})}function Ut(e,t){return new Fd({check:"min_length",...j(t),minimum:e})}function lr(e,t){return new Md({check:"length_equals",...j(t),length:e})}function Uo(e,t){return new Zd({check:"string_format",format:"regex",...j(t),pattern:e})}function Ko(e){return new Jd({check:"string_format",format:"lowercase",...j(e)})}function Wo(e){return new Bd({check:"string_format",format:"uppercase",...j(e)})}function Go(e,t){return new Ud({check:"string_format",format:"includes",...j(t),includes:e})}function Ho(e,t){return new Kd({check:"string_format",format:"starts_with",...j(t),prefix:e})}function Qo(e,t){return new Wd({check:"string_format",format:"ends_with",...j(t),suffix:e})}function hm(e,t,n){return new Gd({check:"property",property:e,schema:t,...j(n)})}function Yo(e,t){return new Hd({check:"properties",shape:e,...j(t)})}function Xo(e,t){return new Qd({check:"mime_type",mime:e,...j(t)})}function wt(e){return new Yd({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)=>sd(e))}function ym(e,t,n){return new e({type:"array",element:t,...j(n)})}function bm(e,t){return new e({type:"file",...j(t)})}function wm(e,t,n){let r=j(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function vm(e,t,n){return new e({type:"custom",check:"custom",fn:t,...j(n)})}function km(e,t){let n=mk((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Zt(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(Zt(i))}},e(r.value,r)),t);return n}function mk(e,t){let n=new ue({check:"custom",...j(t)});return n._zod.check=e,n}function xm(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 Sm(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 Im(e,t){let n=j(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((g)=>typeof g==="string"?g.toLowerCase():g),o=o.map((g)=>typeof g==="string"?g.toLowerCase():g);let i=new Set(r),s=new Set(o),a=e.Codec??zo,c=e.Boolean??$o,u=new(e.String??ln)({type:"string",error:n.error}),d=new c({type:"boolean",error:n.error}),h=new a({type:"pipe",in:u,out:d,transform:(g,y)=>{let S=g;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:h,continue:!1}),{}},reverseTransform:(g,y)=>{if(g===!0)return r[0]||"true";else return o[0]||"false"},error:n.error});return h._zod.bag.truthy=r,h._zod.bag.falsy=o,h._zod.bag.case=n.case??"insensitive",h}function pn(e,t,n,r={}){let o=j(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 ur(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,r))Re(e,r,n[r]);return e}function pr(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 Ee(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 h=s.schema,g=t.processors[o.type];if(!g)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);g(e,t,h,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)ur(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 Cm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function fr(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,h=e.external.uri??((y)=>y);if(d)return{ref:h(d)};let g=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=g,{defId:g,ref:`${h("__shared")}#/${a}/${Cm(g)}`}}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+Cm(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(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 Im(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;Im(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 Cm=new Set(["type","properties","required","additionalProperties"]),km=["oneOf","anyOf"];function Sm(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(!Cm.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]??Sm(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=Sm(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 ox(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Cm)if(o in e)return;let n=t.filter((o)=>km.some((i)=>Array.isArray(o[i]))),r=null;if(!n.length)r=Ha(t);else{let o=n[0],i=km.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,lr(e,r)}function fr(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 g=e.seen.get(d),y=g.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 A in l){if(A==="$ref"||A==="allOf")continue;if(!(A in u))delete l[A]}if(y.$ref&&g.def)for(let A in l){if(A==="$ref"||A==="allOf")continue;if(A in g.def&&JSON.stringify(l[A])===JSON.stringify(g.def[A]))delete l[A]}}let h=a._zod.parent;if(h&&h!==d){r(h);let g=e.seen.get(h);if(g?.schema.$ref){if(l.$ref=g.schema.$ref,g.def)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(y in g.def&&JSON.stringify(l[y])===JSON.stringify(g.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())Im(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)??[])ox(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)}lr(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:ur(t,"input",e.processors),output:ur(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 Em=(e,t={})=>(n)=>{let r=dr({...n,processors:t});return de(e,r),pr(r,e),fr(r,e)},ur=(e,t,n={})=>(r)=>{let{libraryOptions:o,target:i}=r??{},s=dr({...o??{},target:i,io:t,processors:n});return de(e,s),pr(s,e),fr(s,e)};var pn=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},fn=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},Om=(e,t)=>{pn(e,"minimum",t),fn(e,"maximum",t)},Pm=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Tm=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},$m=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},Nm=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},jm=(e,t)=>pn(e,"minimum",t.minimum),_m=(e,t)=>fn(e,"maximum",t.maximum),Rm=(e)=>(t,n)=>{Nm(t,n.format);let[r,o]=e[n.format];pn(t,"minimum",r),fn(t,"maximum",o)},ix={greater_than:(e,t)=>pn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>fn(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Pm(e,t.value),number_format:Rm(mo),bigint_format:Rm(go),min_length:jm,max_length:_m,length_equals:(e,t)=>Om(e,t.length),min_size:jm,max_size:_m,size_equals:(e,t)=>Om(e,t.size),string_format:(e,t)=>{if(Nm(e,t.format),t.pattern)Tm(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)=>$m(e,t.mime)};function Ce(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)ix[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)pn(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)pn(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)fn(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)fn(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Pm(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)$m(t,o.mime);for(let i of o.patterns??[])Tm(t,i);return t}var sx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ax=new Map([[wa,Ks],[To,Ws]]),zm=(e)=>ax.get(e)??e,Ya=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Ce(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=sx[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(zm);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((h)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}},Xa=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Ce(e);o.type=u?"integer":"number";let d=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),h=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(g)o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;else if(typeof i==="number")o.minimum=i;if(h)if(g)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 Ee(e,t,o,r,`A multipleOf divisor of ${N} cannot be represented in JSON Schema`);let[S,...A]=y;if(S!==void 0)o.multipleOf=S;if(A.length)o.allOf=[...o.allOf??[],...A.map((N)=>({multipleOf:N}))]}},ec=(e,t,n,r)=>{n.type="boolean"},tc=(e,t,n,r)=>{Ee(e,t,n,r,"BigInt cannot be represented in JSON Schema")},nc=(e,t,n,r)=>{Ee(e,t,n,r,"Symbols cannot be represented in JSON Schema")},rc=(e,t,n,r)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},oc=(e,t,n,r)=>{Ee(e,t,n,r,"Undefined cannot be represented in JSON Schema")},ic=(e,t,n,r)=>{Ee(e,t,n,r,"Void cannot be represented in JSON Schema")},sc=(e,t,n,r)=>{n.not={}},ac=(e,t,n,r)=>{},cc=(e,t,n,r)=>{},lc=(e,t,n,r)=>{Ee(e,t,n,r,"Date cannot be represented in JSON Schema")},uc=(e,t,n,r)=>{let o=e._zod.def,i=Bn(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},dc=(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(Ee(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(Ee(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}},pc=(e,t,n,r)=>{Ee(e,t,n,r,"NaN cannot be represented in JSON Schema")},fc=(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},mc=(e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=Ce(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}))},gc=(e,t,n,r)=>{n.type="boolean"},hc=(e,t,n,r)=>{Ee(e,t,n,r,"Custom types cannot be represented in JSON Schema")},yc=(e,t,n,r)=>{Ee(e,t,n,r,"Function types cannot be represented in JSON Schema")},bc=(e,t,n,r)=>{Ee(e,t,n,r,"Transforms cannot be represented in JSON Schema")},wc=(e,t,n,r)=>{Ee(e,t,n,r,"Map cannot be represented in JSON Schema")},vc=(e,t,n,r)=>{Ee(e,t,n,r,"Set cannot be represented in JSON Schema")},xc=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:a}=Ce(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 mr(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return mr(t.out);if(t.type==="catch")return mr(t.innerType);return e._zod.optin}var kc=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Ee(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"?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(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},Sc=(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)},Ic=(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,A)=>de(S,t,{...r,path:[...r.path,s,A]})),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"?mr(S)!==void 0:S._zod.optout==="optional"))break;u--}let d=i.items.length,h=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=c,h)o.items=!1;else if(l)o.items=l;if(u>0)o.minItems=u;if(h)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(h)o.maxItems=d}else{if(o.items=c,h)o.additionalItems=!1;else if(l)o.additionalItems=l;if(u>0)o.minItems=u;if(h)o.maxItems=d}let{minimum:g,maximum:y}=Ce(e);if(typeof g==="number")o.minItems=g;if(typeof y==="number")o.maxItems=y};function Ga(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=Ga(e,y,n);return S===y?t:S}for(let y of["anyOf","oneOf"]){let S=t[y];if(!Array.isArray(S))continue;let A=S.map((N)=>Ga(e,N,n));if(A.some((N,M)=>N!==S[M]))t={...t,[y]:A}}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:h,...g}=t;if(g.enum)g.enum=g.enum.map((y)=>typeof y==="number"?String(y):y);else if(typeof g.const==="number")g.const=String(g.const);if(!o)return g;if(g.type="string",!i)g.pattern=(r.includes("number")?Jt:er).source;return g}var Qa=new WeakMap;function cx(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 Qa.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Ga(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 Cc=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,a=Ce(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,zm(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=Qa.get(t);if(!u)u=[],Qa.set(t,u),t.deferred.push(()=>cx(t));u.push(e)}o.additionalProperties=de(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,l=t.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)}},Ec=(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"}]},Oc=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},jc=Symbol();function Dm(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 Ee(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),jc}var _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;let s=Dm(o.defaultValue,e,t,n,r);if(s!==jc)n.default=s},Rc=(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=Dm(o.defaultValue,e,t,n,r);if(s!==jc)n._prefault=s},Ac=(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{Ee(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},Pc=(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},Tc=(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},$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},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},Nc=(e,t,n,r)=>{let o=e._zod.innerType;de(o,t,r);let i=t.seen.get(e);i.ref=o},Am={string:Ya,number:Xa,boolean:ec,bigint:tc,symbol:nc,null:rc,undefined:oc,void:ic,never:sc,any:ac,unknown:cc,date:lc,enum:uc,literal:dc,nan:pc,template_literal:fc,file:mc,success:gc,custom:hc,function:yc,transform:bc,map:wc,set:vc,array:xc,object:kc,union:ii,intersection:Sc,tuple:Ic,record:Cc,nullable:Ec,nonoptional:Oc,default:_c,prefault:Rc,catch:Ac,pipe:Pc,readonly:Tc,promise:$c,optional:si,lazy:Nc};function mn(e,t){if("_idmap"in e){let r=e,o=dr({...t,processors:Am}),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;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 n=dr({...t,processors:Am});return de(e,n),pr(n,e),fr(n,e)}var qm=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 Vm=(e,t)=>{hd.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(qm.has(n))return;qm.add(n),ci(n,"format",(r)=>(o)=>bd(r,o)),ci(n,"flatten",(r)=>(o)=>yd(r,o)),ci(n,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Kn,2)}),ci(n,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Kn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},dx=m("ZodError",Vm),Ke=m("ZodError",Vm,void 0,{Parent:Error});var Lm=Qn(Ke),Mm=Yn(Ke),Fm=ko(Ke),Zm=So(Ke),Jm=vd(Ke),Um=xd(Ke),Bm=kd(Ke),Km=Sd(Ke),Wm=Id(Ke),Hm=Cd(Ke),Gm=Ed(Ke),Qm=Od(Ke);function fx(){if(!je.localeError)Re(Oa())}function Bt(){if(!je.memoizer)Re({memoizer:Nf()})}var K=m("ZodType",(e,t)=>(fx(),J.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 at(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Mg(e,t))},superRefine(e,t){return this.check(Fg(e,t))},overwrite(e){return this.check(bt(e))},optional(){return li(this)},exactOptional(){return kg(this)},nullable(){return ui(this)},nullish(){return li(ui(this))},nonoptional(e){return jg(this,e)},array(){return R(this)},or(e){return Y([this,e])},and(e){return mg(this,e)},transform(e){return zc(this,sl(e))},default(e){return Cg(this,e)},prefault(e){return Og(this,e)},catch(e){return Ag(this,e)},pipe(e){return zc(this,e)},readonly(){return Ng(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 Gn(this,"~standard",{...ba(this),jsonSchema:{input:ur(this,"input"),output:ur(this,"output")}})},set "~standard"(e){ht(this,"~standard",e)},parse:function e(t,n){return Lm(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Mm(this,t,n,{callee:e})},safeParse(e,t){return Fm(this,e,t)},async safeParseAsync(e,t){return Zm(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ht(this,"spa",e)},validate(e,t){return js(this,e,t)},validateAsync(e,t){return _s(this,e,t)},encode:function e(t,n){return Jm(this,t,n,{callee:e})},decode:function e(t,n){return Um(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Bm(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Km(this,t,n,{callee:e})},safeEncode(e,t){return Wm(this,e,t)},safeDecode(e,t){return Hm(this,e,t)},async safeEncodeAsync(e,t){return Gm(this,e,t)},async safeDecodeAsync(e,t){return Qm(this,e,t)},toJSONSchema(e){return Em(this,{})(e)},get description(){return Le.get(this)?.description},get _def(){return this._zod.def}}),Dc=m("_ZodString",(e,t)=>{cn.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ya(e,n,r,o)},vo({format:(e)=>Ce(e).format??null,minLength:(e)=>Ce(e).minimum??null,maxLength:(e)=>Ce(e).maximum??null},{regex(...e){return this.check(Bo(...e))},includes(...e){return this.check(Ho(...e))},startsWith(...e){return this.check(Go(...e))},endsWith(...e){return this.check(Qo(...e))},min(...e){return this.check(Ut(...e))},max(...e){return this.check(ar(...e))},length(...e){return this.check(cr(...e))},nonempty(...e){return this.check(Ut(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())}})),qc=m("ZodString",(e,t)=>{cn.init(e,t),Dc.init(e,t)},{email(e){return this.check(ja(Vc,e))},url(e){return this.check(Mo(di,e))},jwt(e){return this.check(Wa(tl,e))},emoji(e){return this.check($a(Mc,e))},guid(e){return this.check(_a(Lc,e))},uuid(e){return this.check(Ra(wt,e))},uuidv4(e){return this.check(Aa(wt,e))},uuidv6(e){return this.check(Pa(wt,e))},uuidv7(e){return this.check(Ta(wt,e))},nanoid(e){return this.check(Na(Fc,e))},cuid(e){return this.check(za(Zc,e))},cuid2(e){return this.check(Da(Jc,e))},ulid(e){return this.check(qa(Uc,e))},base64(e){return this.check(Ua(Yc,e))},base64url(e){return this.check(Ba(Xc,e))},xid(e){return this.check(Va(Bc,e))},ksuid(e){return this.check(La(Kc,e))},ipv4(e){return this.check(Ma(Wc,e))},ipv6(e){return this.check(Fa(Hc,e))},cidrv4(e){return this.check(Za(Gc,e))},cidrv6(e){return this.check(Ja(Qc,e))},e164(e){return this.check(Ka(el,e))},datetime(e){return this.check(Fo(gn,e))},date(e){return this.check(Zo(hn,e))},time(e){return this.check(Jo(yn,e))},duration(e){return this.check(Uo(bn,e))}});function _(e){return Vf(qc,e)}var ce=m("ZodStringFormat",(e,t)=>{ae.init(e,t),Dc.init(e,t)}),gn=m("ZodISODateTime",(e,t)=>{Op.init(e,t),ce.init(e,t)}),hn=m("ZodISODate",(e,t)=>{jp.init(e,t),ce.init(e,t)}),yn=m("ZodISOTime",(e,t)=>{_p.init(e,t),ce.init(e,t)}),bn=m("ZodISODuration",(e,t)=>{Rp.init(e,t),ce.init(e,t)}),Vc=m("ZodEmail",(e,t)=>{hp.init(e,t),ce.init(e,t)});function mx(e){return ja(Vc,e)}var Lc=m("ZodGUID",(e,t)=>{mp.init(e,t),ce.init(e,t)});function gx(e){return _a(Lc,e)}var wt=m("ZodUUID",(e,t)=>{gp.init(e,t),ce.init(e,t)});function hx(e){return Ra(wt,e)}function yx(e){return Aa(wt,e)}function bx(e){return Pa(wt,e)}function wx(e){return Ta(wt,e)}var di=m("ZodURL",(e,t)=>{wp.init(e,t),ce.init(e,t)});function vx(e){return Mo(di,e)}function xx(e){return Mo(di,{protocol:Xn,hostname:Gs,...O(e)})}var Mc=m("ZodEmoji",(e,t)=>{vp.init(e,t),ce.init(e,t)});function kx(e){return $a(Mc,e)}var Fc=m("ZodNanoID",(e,t)=>{xp.init(e,t),ce.init(e,t)});function Sx(e){return Na(Fc,e)}var Zc=m("ZodCUID",(e,t)=>{kp.init(e,t),ce.init(e,t)});function Ix(e){return za(Zc,e)}var Jc=m("ZodCUID2",(e,t)=>{Sp.init(e,t),ce.init(e,t)});function Cx(e){return Da(Jc,e)}var Uc=m("ZodULID",(e,t)=>{Ip.init(e,t),ce.init(e,t)});function Ex(e){return qa(Uc,e)}var Bc=m("ZodXID",(e,t)=>{Cp.init(e,t),ce.init(e,t)});function Ox(e){return Va(Bc,e)}var Kc=m("ZodKSUID",(e,t)=>{Ep.init(e,t),ce.init(e,t)});function jx(e){return La(Kc,e)}var Wc=m("ZodIPv4",(e,t)=>{Ap.init(e,t),ce.init(e,t)});function _x(e){return Ma(Wc,e)}var Ym=m("ZodMAC",(e,t)=>{$p.init(e,t),ce.init(e,t)});function Rx(e){return Lf(Ym,e)}var Hc=m("ZodIPv6",(e,t)=>{Tp.init(e,t),ce.init(e,t)});function Ax(e){return Fa(Hc,e)}var Gc=m("ZodCIDRv4",(e,t)=>{Np.init(e,t),ce.init(e,t)});function Px(e){return Za(Gc,e)}var Qc=m("ZodCIDRv6",(e,t)=>{zp.init(e,t),ce.init(e,t)});function Tx(e){return Ja(Qc,e)}var Yc=m("ZodBase64",(e,t)=>{qp.init(e,t),ce.init(e,t)});function $x(e){return Ua(Yc,e)}var Xc=m("ZodBase64URL",(e,t)=>{Vp.init(e,t),ce.init(e,t)});function Nx(e){return Ba(Xc,e)}var el=m("ZodE164",(e,t)=>{Lp.init(e,t),ce.init(e,t)});function zx(e){return Ka(el,e)}var Xm=m("ZodCreditCard",(e,t)=>{Mp.init(e,t),ce.init(e,t)});function Dx(e){return Mf(Xm,e)}var eg=m("ZodIBAN",(e,t)=>{Fp.init(e,t),ce.init(e,t)});function qx(e){return Ff(eg,e)}var tl=m("ZodJWT",(e,t)=>{Zp.init(e,t),ce.init(e,t)});function Vx(e){return Wa(tl,e)}var wn=m("ZodCustomStringFormat",(e,t)=>{Jp.init(e,t),ce.init(e,t)});function Lx(e,t,n={}){return dn(wn,e,t,n)}function Mx(e){return dn(wn,"hostname",Hs,e)}function Fx(e){return dn(wn,"hex",ua,e)}function Zx(e){return dn(wn,"currency_code",Ys,e)}function Jx(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,o=Ct[r];if(!o)throw Error(`Unrecognized hash format: ${r}`);return dn(wn,r,o,t)}var nl=m("ZodNumber",(e,t)=>{va.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xa(e,n,r,o),e.isFinite=!0},vo({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=Ce(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=Ce(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=Ce(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>Ce(e).format??null},{gt(e,t){return this.check(Ot(e,t))},gte(e,t){return this.check(tt(e,t))},min(e,t){return this.check(tt(e,t))},lt(e,t){return this.check(Et(e,t))},lte(e,t){return this.check(et(e,t))},max(e,t){return this.check(et(e,t))},int(e){return this.check(ke(e))},safe(e){return this.check(ke(e))},positive(e){return this.check(Ot(0,e))},nonnegative(e){return this.check(tt(0,e))},negative(e){return this.check(Et(0,e))},nonpositive(e){return this.check(et(0,e))},multipleOf(e,t){return this.check(ln(e,t))},step(e,t){return this.check(ln(e,t))},finite(){return this}}));function U(e){return Zf(nl,e)}var vn=m("ZodNumberFormat",(e,t)=>{Up.init(e,t),nl.init(e,t)});function ke(e){return Jf(vn,e)}function Ux(e){return Uf(vn,e)}function Bx(e){return Bf(vn,e)}function Kx(e){return Kf(vn,e)}function Wx(e){return Wf(vn,e)}var rl=m("ZodBoolean",(e,t)=>{$o.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ec(e,n,r,o)});function ye(e){return Hf(rl,e)}var ol=m("ZodBigInt",(e,t)=>{xa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tc(e,n,r,o)},vo({minValue:(e)=>Ce(e).minimum??null,maxValue:(e)=>Ce(e).maximum??null,format:(e)=>Ce(e).format??null},{gte(e,t){return this.check(tt(e,t))},min(e,t){return this.check(tt(e,t))},gt(e,t){return this.check(Ot(e,t))},lt(e,t){return this.check(Et(e,t))},lte(e,t){return this.check(et(e,t))},max(e,t){return this.check(et(e,t))},positive(e){return this.check(Ot(BigInt(0),e))},negative(e){return this.check(Et(BigInt(0),e))},nonpositive(e){return this.check(et(BigInt(0),e))},nonnegative(e){return this.check(tt(BigInt(0),e))},multipleOf(e,t){return this.check(ln(e,t))}}));function Hx(e){return Gf(ol,e)}var il=m("ZodBigIntFormat",(e,t)=>{Bp.init(e,t),ol.init(e,t)});function Gx(e){return Qf(il,e)}function Qx(e){return Yf(il,e)}var tg=m("ZodSymbol",(e,t)=>{Kp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nc(e,n,r,o)});function Yx(e){return Xf(tg,e)}var ng=m("ZodUndefined",(e,t)=>{Wp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oc(e,n,r,o)});function Xx(e){return em(ng,e)}var rg=m("ZodNull",(e,t)=>{Hp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rc(e,n,r,o)});function og(e){return tm(rg,e)}var ig=m("ZodAny",(e,t)=>{Gp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ac(e,n,r,o)});function ek(){return nm(ig)}var sg=m("ZodUnknown",(e,t)=>{Qp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cc(e,n,r,o)});function lt(){return rm(sg)}var ag=m("ZodNever",(e,t)=>{Yp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sc(e,n,r,o)});function nt(e){return om(ag,e)}var cg=m("ZodVoid",(e,t)=>{Xp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ic(e,n,r,o)});function tk(e){return im(cg,e)}var lg=m("ZodDate",(e,t)=>{ef.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lc(e,n,r,o),e.min=(n,r)=>e.check(tt(n,r)),e.max=(n,r)=>e.check(et(n,r))},vo({minDate:(e)=>{let{minimum:t}=Ce(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=Ce(e);return t?new Date(t):null}},{}));function nk(e){return sm(lg,e)}var ug=m("ZodArray",(e,t)=>{Bt(),tf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xc(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Ut(e,t))},nonempty(e){return this.check(Ut(1,e))},max(e,t){return this.check(ar(e,t))},length(e,t){return this.check(cr(e,t))},unwrap(){return this.element}});function R(e,t){return fm(ug,e,t)}function rk(e){let t=e._zod.def.shape;return F(Object.keys(t))}var pi=m("ZodObject",(e,t)=>{Bt(),of.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kc(e,n,r,o),Ww(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return F(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:lt()}))},loose(){return this.clone(Je(this._zod.def,{catchall:lt()}))},strict(){return this.clone(Je(this._zod.def,{catchall:nt()}))},strip(){return this.clone(Je(this._zod.def,{catchall:void 0}))},extend(e){return Lw(this,e)},safeExtend(e){return Mw(this,e)},merge(e){return Fw(this,e)},pick(e){return qw(this,e)},omit(e){return Vw(this,e)},partial(...e){return ad(mi,this,e[0])},exactPartial(...e){return ad(al,this,e[0],"exactPartial")},required(...e){return Zw(cl,this,e[0])}});function E(e,t){let n={type:"object",shape:e??{},...O(t)};return new pi(n)}function x(e,t){return new pi({type:"object",shape:e,catchall:nt(),...O(t)})}function ok(e,t){return new pi({type:"object",shape:e,catchall:lt(),...O(t)})}var fi=m("ZodUnion",(e,t)=>{No.init(e,t),K.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 dg=m("ZodXor",(e,t)=>{fi.init(e,t),sf.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ii(e,n,r,o),e.options=t.options});function ik(e,t){return new dg({type:"union",options:e,inclusive:!1,...O(t)})}var pg=m("ZodDiscriminatedUnion",(e,t)=>{fi.init(e,t),af.init(e,t)});function rt(e,t,n){return new pg({type:"union",options:t,discriminator:e,...O(n)})}var fg=m("ZodIntersection",(e,t)=>{cf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sc(e,n,r,o)});function mg(e,t){return new fg({type:"intersection",left:e,right:t})}var gg=m("ZodTuple",(e,t)=>{Bt(),ka.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ic(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 hg(e,t,n){let r=t instanceof J,o=r?n:t;return new gg({type:"tuple",items:e,rest:r?t:null,...O(o)})}var hr=m("ZodRecord",(e,t)=>{Bt(),lf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cc(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function oe(e,t,n){if(!t||!t._zod)return new hr({type:"record",keyType:_(),valueType:e,...O(t)});return new hr({type:"record",keyType:e,valueType:t,...O(n)})}function sk(e,t,n){return new hr({type:"record",keyType:e,valueType:t,...O(n),partial:!0})}function ak(e,t,n){return new hr({type:"record",keyType:e,valueType:t,mode:"loose",...O(n)})}var yg=m("ZodMap",(e,t)=>{Bt(),uf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wc(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(jt(...n)),e.nonempty=(n)=>e.check(jt(1,n)),e.max=(...n)=>e.check(un(...n)),e.size=(...n)=>e.check(sr(...n))});function ck(e,t,n){return new yg({type:"map",keyType:e,valueType:t,...O(n)})}var bg=m("ZodSet",(e,t)=>{Bt(),df.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vc(e,n,r,o),e.min=(...n)=>e.check(jt(...n)),e.nonempty=(n)=>e.check(jt(1,n)),e.max=(...n)=>e.check(un(...n)),e.size=(...n)=>e.check(sr(...n))});function lk(e,t){return new bg({type:"set",valueType:e,...O(t)})}var yr=m("ZodEnum",(e,t)=>{pf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,o,i)=>uc(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 yr({...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 yr({...t,checks:[],...O(o),entries:i})}});function F(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new yr({type:"enum",entries:n,...O(t)})}function uk(e,t){return new yr({type:"enum",entries:e,...O(t)})}var wg=m("ZodLiteral",(e,t)=>{ff.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dc(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 wg({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}var vg=m("ZodFile",(e,t)=>{mf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mc(e,n,r,o),e.min=(n,r)=>e.check(jt(n,r)),e.max=(n,r)=>e.check(un(n,r)),e.mime=(n,r)=>e.check(Xo(Array.isArray(n)?n:[n],r))});function dk(e){return mm(vg,e)}var xg=m("ZodTransform",(e,t)=>{Bt(),gf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bc(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new an(e.constructor.name);n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(Ft(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(Ft(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 sl(e){return new xg({type:"transform",transform:e})}var mi=m("ZodOptional",(e,t)=>{Sa.init(e,t),K.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 al=m("ZodExactOptional",(e,t)=>{hf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>si(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function kg(e){return new al({type:"optional",innerType:e})}var Sg=m("ZodNullable",(e,t)=>{yf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ec(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ui(e){return new Sg({type:"nullable",innerType:e})}function pk(e){return li(ui(e))}var Ig=m("ZodDefault",(e,t)=>{bf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Cg(e,t){return new Ig({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ws(t)}})}var Eg=m("ZodPrefault",(e,t)=>{wf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Og(e,t){return new Eg({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ws(t)}})}var cl=m("ZodNonOptional",(e,t)=>{vf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Oc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function jg(e,t){return new cl({type:"nonoptional",innerType:e,...O(t)})}var _g=m("ZodSuccess",(e,t)=>{xf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function fk(e){return new _g({type:"success",innerType:e})}var Rg=m("ZodCatch",(e,t)=>{kf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ac(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ag(e,t){return new Rg({type:"catch",innerType:e,catchValue:typeof t==="function"?t:dd(t)})}var Pg=m("ZodNaN",(e,t)=>{Sf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pc(e,n,r,o)});function mk(e){return am(Pg,e)}var gi=m("ZodPipe",(e,t)=>{Ia.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pc(e,n,r,o),e.in=t.in,e.out=t.out});function zc(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 gk(e,t,n){return new hi({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function hk(e){let t=e._zod.def;return new hi({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Tg=m("ZodPreprocess",(e,t)=>{gi.init(e,t),If.init(e,t)}),$g=m("ZodReadonly",(e,t)=>{Cf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ng(e){return new $g({type:"readonly",innerType:e})}var zg=m("ZodTemplateLiteral",(e,t)=>{Ef.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fc(e,n,r,o)});function yk(e,t){return new zg({type:"template_literal",parts:e,...O(t)})}var Dg=m("ZodLazy",(e,t)=>{_f.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nc(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function qg(e){return new Dg({type:"lazy",getter:e})}var Vg=m("ZodPromise",(e,t)=>{jf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function bk(e){return new Vg({type:"promise",innerType:e})}var Lg=m("ZodFunction",(e,t)=>{Of.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yc(e,n,r,o)});function wk(e){return new Lg({type:"function",input:Array.isArray(e?.input)?hg(e?.input):e?.input??R(lt()),output:e?.output??lt()})}var yi=m("ZodCustom",(e,t)=>{Rf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hc(e,n,r,o)});function vk(e){let t=new ue({check:"custom"});return t._zod.check=e,t}function xk(e,t){return gm(yi,e??(()=>!0),t)}function Mg(e,t={}){return hm(yi,e,t)}function Fg(e,t){return ym(e,t)}var kk=bm,Sk=wm,Zg=m("ZodInstanceOf",(e,t)=>{yi.init(e,t)},{properties(e,t){return this.check(Yo(e,t))}});function Ik(e,t={}){let n=new Zg({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 Ck=(...e)=>vm({Codec:hi,Boolean:rl,String:qc},...e);function Ae(e){let t=qg(()=>Y([_(e),U(),ye(),og(),R(t),oe(_(),t)]));return t}function Jg(e,t){return new Tg({type:"pipe",in:sl(e),out:t})}function Ek(e){return Fo(gn,e)}function Ok(e){return Zo(hn,e)}function jk(e){return Jo(yn,e)}function _k(e){return Uo(bn,e)}var T={...ll,...ai,iso:br},Rk=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 Ak(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 Ug(e,t){return e.map((n,r)=>r<t?n:n.optional())}function Pk(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Tk(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:Pk(n[1]);if(!o||!t.defs[o])throw Error(`Reference not found: ${e}`);return t.defs[o]}throw Error(`Reference not found: ${e}`)}function $k(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 ul(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=ul(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=ul(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 Nk=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),zk=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(([t,n])=>{if(Nk.has(t))return wr(n);if(!zk.has(t)||typeof n!=="object"||n===null)return!1;return Object.values(n).some(wr)})}function Bg(e){return e===1?"element":"elements"}function Dk(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=ul(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 ${Bg(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 ${Bg(t.maxContains)}`,input:o,continue:!0})}}).pipe(e)}function Kg(e,t){if(e===!1)return;if(e===void 0||e===!0)return T.any();return Ne(e,t)}var qk=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Wg(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=Tk(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 Wg(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(qk));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,h]of Object.entries(i)){let g=Ne(h,t);_e(o,d,s.has(d)?g:g.optional())}if(e.patternProperties){let d=e.patternProperties,h=Object.keys(d),g=[];for(let S of h){let A=Ne(d[S],t),N=T.string().regex(new RegExp(S));g.push(T.looseRecord(N,A))}let y=[];if(Object.keys(o).length>0)y.push(T.object(o).passthrough());if(y.push(...g),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 A=2;A<y.length;A++)S=T.intersection(S,y[A]);r=S}if(e.additionalProperties===!1){let S=Object.keys(o),A=h.map((M)=>new RegExp(M)),N=r;r=r.check((M)=>{if(!yt(M.value))return;let D=[];for(let fe of Object.keys(M.value)){if(S.includes(fe))continue;if(A.some((me)=>me.test(fe)))continue;D.push(fe)}if(D.length)M.issues.push({code:"unrecognized_keys",keys:D,input:M.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 h=typeof e.propertyNames==="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Ne(h,t)}r=$k(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=Ug(a,s),l=!Array.isArray(i)?Kg(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=Ug(a,s),l=Kg(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=Dk(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=Wg(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&&!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(!Rk.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 Hg(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=Ak(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 Gg=Object.prototype.hasOwnProperty;function Ie(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--&&Ie(e[r],t[r]));return r===-1}if(!n||typeof e==="object"){r=0;for(n in e){if(Gg.call(e,n)&&++r&&!Gg.call(t,n))return!1;if(!(n in t)||!Ie(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!==e&&t!==t}var dl={maxKeys:16,maxBytes:1048576},pl=_().min(1).refine((e)=>new TextEncoder().encode(e).length<=256),Vk=x({scope:F(["draft","live"]),values:w(!1).optional()}),TO=Vk.omit({values:!0}),Qg=x({scope:F(["draft","live"]),keys:R(pl).min(1).max(dl.maxKeys).refine((e)=>new Set(e).size===e.length,"State keys must be distinct.")}),$O=x({scope:F(["draft","live"]),key:pl.optional()}),NO=x({scope:F(["draft","live"]),space:_().regex(/^(flow|node:.+)$/)}),zO=x({scope:F(["draft","live"])}),bi=x({fields:R(_().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([])}),Yg=bi.extend({kind:w("skip-duplicates")});var fl=E({version:w(1),scope:F(["draft","live"]),limits:E({maxValueBytes:U().positive(),maxValues:U().int().positive(),maxSpaces:U().int().positive(),maxIdentities:U().positive(),maxRunWrites:U().positive()}),values:R(x({key:_(),size:U().nonnegative(),updatedAt:U()})),spaces:R(E({space:_(),count:U().nonnegative(),pendingCount:U().nonnegative(),reservedCount:U().nonnegative(),updatedAt:U()}))}),Xg=fl.extend({values:x({count:U().int().nonnegative(),updatedAt:U().nullable()})}),eh=E({version:w(1),scope:F(["draft","live"]),values:R(x({key:pl,value:Ae()})).min(1).max(dl.maxKeys)}).refine((e)=>{let t=new TextEncoder;return e.values.reduce((n,r)=>n+(r.value===null?0:t.encode(JSON.stringify(r.value)).byteLength),0)<=dl.maxBytes},"State values exceed the 1 MiB read limit.");var th=0;function _t(){let e=th;return th+=1,e}function kn(e){if(typeof e==="object"&&e!==null&&!Object.isFrozen(e)){for(let t of Object.getOwnPropertyNames(e)){let n=Reflect.get(e,t);kn(n)}Object.freeze(e)}return e}function ml(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 xn(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(!xn(r,t[n]))return!1}else{if(Array.isArray(t))return!1;for(let n in e){if(!(n in t))return!1;if(!xn(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=Rt(b.Equals),B=Rt(b.Containing),W=Rt(b.ContainedBy),Q=Rt(b.Rejection),ne=Rt(b.Intersection),vt=kn([[b.Equals,G],[b.Containing,B],[b.ContainedBy,W],[b.Rejection,Q],[b.Intersection,ne]]),pe=0,We=(()=>{let e=pe;for(let[t,n]of vt)e|=n;return e})();function vr(e){return!!(e&G)}function xr(e){return!!(e&B)}function kr(e){return!!(e&W)}function Sr(e){return!!(e&Q)}function Ir(e){return!!(e&ne)}function Rt(e){return 1<<e}function gl(e){let t=pe,n=0,r={push:(o)=>{if(n===0)t=o;else t=Lk(t,o,e);return n+=1,t}};return Object.defineProperties(r,{result:{get:()=>t},count:{get:()=>n}}),r}function Lk(e,t,n){let r=pe;for(let[o,i]of vt)if(i&e){for(let[s,a]of vt)if(a&t){if(r|=n(o,s),r===We)return r}}return r}var be=Object.freeze({Save:0,OneOf:1,AllOf:2,AnyOf:3,Not:4,Swap:5});function nh(e,t){switch(e){case be.Save:return t[0];case be.OneOf:return Mk(t);case be.AllOf:case be.AnyOf:return Cr(e,t);case be.Not:case be.Swap:return hl(e,t[0])}}function At(e){return hl(be.Swap,e)}function Mk(e){if(e.length===1)return e[0];let t=Cr(be.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=Cr(be.AllOf,[a,c]);n.push(l)}let r=Cr(be.AnyOf,n),o=hl(be.Not,r);return Cr(be.AllOf,[t,o])}function Cr(e,t){if(t.length<0)throw Error("invalid expressions: empty array");let n;switch(e){case be.AllOf:{n=gl(Fk);break}case be.AnyOf:{n=gl(Zk);break}default:throw Error(`invalid operator ${e}`)}for(let r of t)n.push(r);return n.result}function hl(e,t){let n,r=pe;switch(e){case be.Not:{n=Jk;break}case be.Swap:{n=Uk;break}default:throw Error(`invalid operator ${e}`)}for(let[o,i]of vt)if(i&t)r|=n(o);return r}function Fk(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=W;break}case b.Rejection:{n=pe;break}case b.Intersection:{n=W;break}}break}case b.Containing:{switch(t){case b.Equals:{n=G;break}case b.Containing:{n=G|B;break}case b.ContainedBy:{n=W;break}case b.Rejection:{n=Q;break}case b.Intersection:{n=ne|W;break}}break}case b.ContainedBy:{switch(t){case b.Equals:{n=W;break}case b.Containing:{n=W;break}case b.ContainedBy:{n=W;break}case b.Rejection:{n=pe;break}case b.Intersection:{n=W;break}}break}case b.Rejection:{switch(t){case b.Equals:{n=pe;break}case b.Containing:{n=Q;break}case b.ContainedBy:{n=pe;break}case b.Rejection:{n=Q;break}case b.Intersection:{n=Q;break}}break}case b.Intersection:{switch(t){case b.Equals:{n=W;break}case b.Containing:{n=ne|W;break}case b.ContainedBy:{n=W;break}case b.Rejection:{n=Q;break}case b.Intersection:{n=W|Q|ne;break}}break}}return n}function Zk(e,t){let n=pe;switch(e){case b.Equals:{switch(t){case b.Equals:{n=G;break}case b.Containing:{n=B;break}case b.ContainedBy:{n=G;break}case b.Rejection:{n=B;break}case b.Intersection:{n=B;break}}break}case b.Containing:{switch(t){case b.Equals:{n=B;break}case b.Containing:{n=B;break}case b.ContainedBy:{n=B;break}case b.Rejection:{n=B;break}case b.Intersection:{n=B;break}}break}case b.ContainedBy:{switch(t){case b.Equals:{n=G;break}case b.Containing:{n=B;break}case b.ContainedBy:{n=G|W;break}case b.Rejection:{n=ne;break}case b.Intersection:{n=B|ne;break}}break}case b.Rejection:{switch(t){case b.Equals:{n=B;break}case b.Containing:{n=B;break}case b.ContainedBy:{n=ne;break}case b.Rejection:{n=Q;break}case b.Intersection:{n=ne;break}}break}case b.Intersection:{switch(t){case b.Equals:{n=B;break}case b.Containing:{n=B;break}case b.ContainedBy:{n=B|ne;break}case b.Rejection:{n=ne;break}case b.Intersection:{n=B|ne;break}}break}}return n}function Jk(e){let t=pe;switch(e){case b.Equals:{t=Q;break}case b.Containing:{t=Q;break}case b.ContainedBy:{t=ne;break}case b.Rejection:{t=G|B;break}case b.Intersection:{t=W|ne;break}}return t}function Uk(e){let t=pe;switch(e){case b.Equals:{t=G;break}case b.Containing:{t=W;break}case b.ContainedBy:{t=B;break}case b.Rejection:{t=Q;break}case b.Intersection:{t=ne;break}}return t}var Me=Object.freeze({Leaf:0,Not:1,AllOf:2,AnyOf:3,OneOf:4});var yl=(e)=>(t,n)=>{let r={parent:null,swapped:!1,expressions:null,calculation:{operator:be.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,[h,g]=u.expressions;if(!e.equals(h,g)){let y=e.describe(h);if(y.kind!==Me.Leaf){let[N,M]=a(y,!1);u.expressions=null,u.calculation=N;for(let[D,fe]of M.entries())o.push({parent:{node:u,index:D},swapped:u.swapped,expressions:[fe,g],calculation:null});return}let S=e.describe(g);if(S.kind!==Me.Leaf){let[N,M]=a(S,!0);u.expressions=null,u.calculation=N;for(let[D,fe]of M.entries())o.push({parent:{node:u,index:D},swapped:!u.swapped,expressions:[fe,h],calculation:null});return}if(d=e.calculate(h,g),e.observeCalculation?.(h,g,d,u.swapped),d===pe)throw Error("cannot response expression as none")}u.expressions=null,u.calculation={operator:be.Save,results:[d],willSwap:!1,count:0},i.push(u)}function a(u,d){let h=be.Save,g;switch(u.kind){case Me.Not:{h=be.Not,g=[u.expression];break}case Me.AllOf:{h=be.AllOf,g=[...u.expressions];break}case Me.AnyOf:{h=be.AnyOf,g=[...u.expressions];break}case Me.OneOf:{h=be.OneOf,g=[...u.expressions];break}default:throw Error(`invalid kind ${u.kind}`)}return[{operator:h,willSwap:d,count:0,results:Array(g.length).fill(-1)},g]}function c(u){let{calculation:d,parent:h}=u,g=nh(d.operator,d.results);if(g===pe)g=W;if(d.willSwap)g=At(g);if(h){let y=h.node.calculation,S=y.results;if(S[h.index]=g,y.count+=1,y.count>=S.length)i.push(h.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(Bk(e));this.name="SchemaError",this.items=e}}var Sn=Object.freeze({Compiled:0,External:1});function In(e){switch(e.kind){case Sn.Compiled:{let{message:t,path:n}=e;return`${t} (at ${n.length>0?n.join("."):"$root"})`}case Sn.External:return String(e.error)}}function Bk(e){switch(e.length){case 0:return"without any items";case 1:return In(e[0]);default:return`${In(e[0])} ... omit the rest ${e.length-1} items`}}var Kk=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 ut(e){return Kk.has(e)}function rh(e){for(let t in e)if(ut(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 Pt({path:e,errors:t},n,...r){t.push(oh(e,r,n))}function re({path:e,warns:t},n,...r){t.push(oh(e,r,n))}function oh(e,t,n){return{kind:Sn.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(Wk(n))delete e[t]}}return e}function Wk(e){for(let t in e)return!1;return!0}var Er=Symbol("compiledId"),bl=Symbol("compiledKind"),wl=Symbol("compiledPath"),ih=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}),Tt=kn(ki(I.Any,_t(),{},()=>()=>!0)),Or=kn(ki(I.Never,_t(),{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&&bl in e}function ee(e){if(Ze(e))return e[bl];else return I.Extends}function Kt(e){if(Ze(e)||jr(e))return e[Er];else return e.id}function vl(e){return Ze(e)?e[wl]:void 0}function xl(e){if(e===null||typeof e!=="object")return e;return Object.defineProperty(e,Er,{value:_t(),configurable:!1,writable:!1,enumerable:!1}),e}function we(e,t,n,r=[]){return ki(e,_t(),t,n&&(()=>n.compile(t)),r)}function _r(e){return ki(I.Never,_t(),{...e},e[ih],e[wl])}function ki(e,t,n,r,o=[]){let i=null;return Object.defineProperties(n,{[bl]:{value:e,configurable:!1,writable:!1,enumerable:!1},[Er]:{value:t,configurable:!1,writable:!1,enumerable:!1},[wl]:{value:o,configurable:!1,writable:!1,enumerable:!1},[ih]:{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 ch(e,t){let n=Hk(e,t),r=sh(e,"maxItems",t),o=sh(e,"minItems",t),i=Gk(e,t),s=t.uniqueItems,a;if(Array.isArray(n))a=Qk(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=ah(a,e.delegate);let h=n.findIndex((g)=>ee(g)===I.Never);if(h!==-1){if(n=n.splice(h),a=ah(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&&ee(a)===I.Never)c=!0}else if(ee(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 we(u,d,e.delegate,e.path)}function Hk(e,{items:t}){if(!t)return we(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 sh(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,{contains:t}){if(!t)return we(I.Any,{},e.delegate,e.path);let n=ze(e,"contains"),r=Fe(t);return De(n,r)}function Qk(e,{additionalItems:t}){switch(typeof t){case"boolean":if(t)return we(I.Any,{},e.delegate,e.path);else return!1;case"object":{let n=ze(e,"additionalItems");return De(n,t)}default:return we(I.Any,{},e.delegate,e.path)}}function ah(e,t){if(e===void 0)return we(I.Never,{type:"string",maxLength:0,minLength:1},t);else if(Ze(e))return ee(e)===I.Never?e:_r(e);else return e}var lh=Object.freeze(["allOf","anyOf","oneOf"]);function kl(e,t,n,r){if(n.length===0)return Pt(e,"disable empty list",t),null;let o=[];for(let[c,l]of n.entries()){let u=ze(e,t,c),d=Fe(l),h=De(u,d);if(h)o.push(h)}if(o.length<n.length)return null;let i=0,s=0;for(let c of o)switch(ee(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(!Yk(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 we(a,{[t]:o},r,e.path)}function Yk(e){let t=null;for(let n of e){let r=ee(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 dt(e,t){let n=e.isValid;if(n)if(n(t)===!0)return Pe.Valid;else return Pe.Invalid;else return Pe.Unknown}function uh(e,t,n,r){let o,i=!1;if(t){if(t.length===0)return Pt(e,"disable empty list","enum"),null;o=[];for(let[c,l]of t.entries())switch(dt(r,l)){case Pe.Valid:{o.push(xl(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&&dt(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(xn(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=xl(wi(n));return we(s,a,e.delegate,e.path)}var Xk=new Set(["type","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames"]);function ph(e,t){let n=Object.keys(t).filter((y)=>!Xk.has(y)&&ut(y));if(n.length>0)re(e,`type="object" will exclude other keys: ${n.toSorted().join(", ")}`);let r=dh(e,"maxProperties",t),o=dh(e,"minProperties",t),i=eS(e,t),s=tS(e,t),a=nS(e,t),c=oS(e,t);if(!i||!s||!a||!c)return null;let l=rS(e,s,a,t);if(!l)return null;let u=iS(i,s,a,l),d=sS(e,u,c,t),h=aS(e,i,l,d,r,o)?I.Never:I.Object,g=xi({type:"object",required:d,properties:l,minProperties:o,maxProperties:r,additionalProperties:i,patternProperties:uS(s),dependencies:dS(c,t),propertyNames:a});return we(h,g,e.delegate,e.path)}function dh(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 eS(e,{additionalProperties:t}){if(t===!1)return we(I.Never,{type:"string",maxLength:0,minLength:1},e.delegate,e.path);if(typeof t!=="object")return we(I.Any,{},e.delegate,e.path);let n=ze(e,"additionalProperties"),r=Fe(t);return De(n,r)}function tS(e,{patternProperties:t}){let n=!1,r={};for(let o in t){let i=lS(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 nS(e,{propertyNames:t}){if(!t)return we(I.Any,{},e.delegate,e.path);t=Fe(t);let n=ze(e,"propertyNames"),r=De(n,t);if(!r)return null;let o=ee(r);if(o!==I.String&&o!==I.Any)return _r(r);return r}function rS(e,t,n,{properties:r}){let o=!1;if(!r)return{};let i={};for(let s in r){if(dt(n,s)===Pe.Invalid){re(e,`key ${JSON.stringify(s)} cannot pass JSON schema from propertyNames`,"properties");continue}let a=mh(t,s);if(a&&ee(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 oS(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}=fh(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=ee(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[n,r]}function iS(e,t,n,r){return(o)=>{if(dt(n,o)===Pe.Invalid)return!0;let i=mh(t,o);if(i&&ee(i)===I.Never)return!0;let s=r[o]??e;if(ee(s)===I.Never)return!0;return!1}}function sS(e,t,n,{required:r}){if(!r)return[];let o=fh(r);if(o.duplicated)re(e,`found duplicated required keys: ${o.duplicated.join(", ")}`,"required");let i=[],s=[];for(let a of o.keys)if(cS(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 aS(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(ee(t)!==I.Never)return!1;for(let s in n){let a=n[s];if(ee(a)!==I.Never)return!1}return!0}function cS([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(ee(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 fh(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 mh(e,t){for(let n in e){let[r,o]=e[n];if(o.test(t))return r}return null}function lS(e){try{return new RegExp(e,"i")}catch(t){if(t instanceof SyntaxError)return t;else throw t}}function uS(e){let t={};for(let n in e)t[n]=e[n][0];return t}function dS([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 Sl=new Set(["type","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum"]),gh=new Set(["type","format","maxLength","minLength","pattern"]);function yh(e,t){let{type:n}=t;switch(n){case"number":case"integer":return pS(e,t);case"string":return mS(e,t);case"boolean":case"null":{let r=Object.keys(t).filter((s)=>ut(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 we(o,{type:n},e.delegate,e.path)}default:return Pt(e,`invalid type ${JSON.stringify(n)}`),null}}function pS(e,t){let n=Object.keys(t).filter((u)=>!Sl.has(u)&&ut(u));if(n.length>0)re(e,`type=${JSON.stringify(t.type)} will exclude other keys: ${n.toSorted().join(", ")}`);let r=ml(t,Sl);for(let u of Sl){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(!fS(r))l=I.Never;return we(l,r,e.delegate,e.path)}function fS(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 mS(e,t){let n=Object.keys(t).filter((a)=>!gh.has(a)&&ut(a));if(n.length>0)re(e,`type="string" will exclude other keys: ${n.toSorted().join(", ")}`);let r=ml(t,gh);hh(e,r,"maxLength"),hh(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 we(s,r,e.delegate,e.path)}function hh(e,t,n){let r=t[n];if(r!==void 0){if(Number.isNaN(r))re(e,"found NaN",n),delete t[n]}}var bh=Object.freeze([]);function Si(e,t,n,r){if(Ze(e))return{schema:e,warns:bh};if(t.isExtendsSchema(e))return{schema:e,warns:bh};if(r){let s=r.isSchema(e);if(typeof s==="object"){let a=[];for(let c of s)a.push({kind:Sn.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)wh(o.errors.length===0,"found errors (it should be empty)");else return wh(o.errors.length>0,"cannot found any errors"),o.errors;return{schema:i,warns:o.warns}}function wh(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=gS(e,r);if(a&&o)a=uh(e,i,s,a);if(!a)return null;return a}function gS(e,t){for(let n of lh){let r=t[n];if(r){let o=Object.keys(t).filter((s)=>ut(s)&&s!==n);if(o.length>0)re(e,`composition key ${JSON.stringify(n)} will exclude other keys: ${o.toSorted().join(", ")}`);let i=kl(e,n,r);if(!i)return null;return i}}{let n=Fe(t.not);if(n){let r=Object.keys(t).filter((a)=>ut(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(ee(i)){case I.Never:{s=I.Any;break}case I.Any:{s=I.Never;break}}return we(s,{not:i},e.delegate,e.path)}}if(t.type){let{type:n}=t;if(Array.isArray(n)){let{type:r,...o}=t;return kl(e,"anyOf",n.map((i)=>({...o,type:i})))}switch(n){case"object":return ph(e,t);case"array":return ch(e,t);default:return yh(e,t)}}if(rh(t))return we(I.Any,{},e.delegate,e.path);return Pt(e,"unrecognized"),null}class Il{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 vh{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 vh{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 xh(e)}class xh{constructor(e){this.description=new Il(e)}get keys(){return this.description.keys}variable(e){let t;if(e)t=this.description.toBundle(e).toInt32();return new kh(this.description,t)}}class kh{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 vt)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 $t(e,t){let[n]=e,[r]=t;if(n.num<r.num)return hS(e,t);else if(n.num>r.num)return yS(e,t);else return bS(e,t)}function hS(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:[Ge(r),i]};return{left:{fromLeft:!0,range:[n,Ge(o)]},center:[o,r],right:c}}}return{left:{fromLeft:!0,range:[n,Ge(o)]},center:[o,i],right:{fromLeft:!0,range:[Ge(i),r]}}}function yS(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:[Ge(i),r]};return{left:{fromLeft:!1,range:[o,Ge(n)]},center:[n,i],right:c}}}return{left:{fromLeft:!1,range:[o,Ge(n)]},center:[n,r],right:{fromLeft:!1,range:[Ge(r),i]}}}function bS(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,Ge(o)]};else if(s&&!a)c={fromLeft:!1,range:[o,Ge(n)]};if(r.num<=i.num){let u=!0,d=!1;if(r.num===i.num){let h=r.exclusive,g=i.exclusive;u=h!==g,d=!h&&g}if(!d){let h;if(u)h={fromLeft:!1,range:[Ge(r),i]};return{left:c,center:[l,r],right:h}}}return{left:c,center:[l,i],right:{fromLeft:!0,range:[Ge(i),r]}}}function Ge(e){return{num:e.num,exclusive:!e.exclusive}}var Cn=(e)=>(t=e,n=Number.POSITIVE_INFINITY,r=e,o=Number.POSITIVE_INFINITY)=>{let{left:i,center:s,right:a}=$t([{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 En({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 wS=Cn(0),vS=Ii(["hasCommon","hasExtra1","hasExtra2","hasRejection","hasCommonBroken"]);function Ih({calculate:e},t,n){let r=wS(t.minItems,t.maxItems,n.minItems,n.maxItems),o=En(r);if(o===b.Rejection)return Q;let[i,s]=Sh(t),[a,c]=Sh(n),l=Math.max(i.length,a.length)+1,u=Math.min(l,r.intersection.max),d=vS.variable({}),h=Math.min(t.minItems??0,n.minItems??0);for(let y=0;y<u;y++){let S=i[y]??s,A=a[y]??c,N=e(S,A);d.push(N,(M,D)=>{switch(M){case b.Equals:{if(!D.hasRejection)D.hasCommon=!0;break}case b.Containing:{if(!D.hasRejection)D.hasCommon=!0;D.hasExtra1=!0;break}case b.ContainedBy:{if(!D.hasRejection)D.hasCommon=!0;D.hasExtra2=!0;break}case b.Intersection:{if(!D.hasRejection)D.hasCommon=!0;D.hasExtra1=!0,D.hasExtra2=!0;break}case b.Rejection:{if(y<h)D.hasCommonBroken=!0;D.hasRejection=!0,D.hasExtra1=!0,D.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 g=pe;for(let{hasExtra1:y,hasExtra2:S,hasCommon:A,hasCommonBroken:N}of d){let M=A;if(N)M=!1;if(!M)g|=Q;else if(y&&S)g|=ne;else if(y)g|=B;else if(S)g|=W;else g|=G}return g}function Sh({items:e,additionalItems:t}){if(Array.isArray(e))return[e,t??Tt];else return[[],e??Tt]}function Ch(e){let t=new Map;return(n,r)=>{let o=jr(n),i=jr(r);if(o!==i)return!1;if(!o)return n===r;return Oh(t,n,r,e)}}function Eh(e){let t=new Map;return(n,r)=>Oh(t,n,r,e)}function Oh(e,t,n,r){let o=Kt(t),i=Kt(n),s=`${o}/${i}`,a=e.get(s);if(a===void 0)e.set(s,a=r(t,n));return a}function _h(e,t,n){let r=Cl(t),o=Cl(n),i=!1,s=!1,a=!1;for(let c of r){if(jh(e,o,c))a=!0;else i=!0;if(i&&a)break}for(let c of o){if(jh(e,r,c))a=!0;else s=!0;if(s&&a)break}if(!a)return Q;if(i&&s)return ne;if(i)return B;if(s)return W;return G}function El(e,t){let n=!1,r=!1;for(let o of Cl(e)){switch(dt(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 ne;if(n)return G|W;if(r)return Q;if(ee(t)===I.Never)return G;return W}function Cl({const:e,enum:t}){if(e!==void 0)return[e];if(t)return t;throw Error("invalid branch")}function jh({isEquals:e},t,n){for(let r of t)if(e(r,n))return!0;return!1}function Rh(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=Kt(s),l=Kt(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 Rr(e){let t=Ar(e),n=e.multipleOf??1,r=ot(t,n);if(!r)return null;return{multipleOf:n,range:r}}function Ah([e,t]){if(e.num!==t.num)return!1;if(e.exclusive)return!1;if(t.exclusive)return!1;return!0}function ot(e,t){if(!e)return;let[n,r]=e,o=xS(n.num,t),i=kS(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 xS(e,t){return Math.ceil(e/t)*t}function kS(e,t){return Math.floor(e/t)*t}function Th(e,t){let n=Ar(e),r=Ar(t),{left:o,right:i,center:s}=$t(n,r);if(!s)return Q;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 ne;if(a)return B;if(c)return W;return G}function Ol(e,t){let n=Ar(e),r=Rr(t);if(!r)return B;let o=$t(n,r.range),i=ot(o.center,r.multipleOf),s=Ph(o.left,r.multipleOf),a=Ph(o.right,r.multipleOf);if(!o.center)return Q;let c=!1,l=!1;if(o.left?.fromLeft)c=!0;if(o.right?.fromLeft)c=!0;if(!i||!Ah(o.center))c=!0;if(s)l=!0;if(a)l=!0;if(c&&l)return ne;if(c)return B;if(l)return W;return G}function Ar(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 Ph(e,t){if(!e)return;if(e.fromLeft)return;return ot(e.range,t)}function zh(e,t){let n=Rr(e),r=Rr(t);if(!n&&!r)return G;if(!n)return W;if(!r)return B;let{range:o,multipleOf:i}=n,{range:s,multipleOf:a}=r,c=$t(o,s),l,u=0;if(c.center)u=SS(i,a),l=ot(c.center,u);if(!l)return Q;let d=!1,h=!1,{left:g,right:y}=c;if(g&&ot(g.range,g.fromLeft?i:a))if(g.fromLeft)d=!0;else h=!0;if(y&&ot(y.range,y.fromLeft?i:a))if(y.fromLeft)d=!0;else h=!0;if(d=d||$h(n,l,u),h=h||$h(r,l,u),d&&h)return ne;if(d)return B;if(h)return W;return G}function $h({range:e,multipleOf:t},n,r){let o=$t(e,n);if(ot(o.left?.range,t))return!0;if(ot(o.right?.range,t))return!0;let i=ot(o.center,t);if(!i)return!1;let s=Nh(n);if(Nh(i)>s)return!0;if(s===1)return!1;if(t<r)return!0;return!1}function SS(e,t){return e*t/Dh(e,t)}function Dh(e,t){if(e===0)return t;return Dh(t%e,e)}function Nh(e){if(!e)return 0;let[t,n]=e;return n.num-t.num+1}function jl(e,t){if(qh(e)||qh(t))return We;let n=Vh(e),r=Vh(t);if(n&&r)return Th(e,t);else if(n)return Ol(e,t);else if(r)return At(Ol(t,e));else return zh(e,t)}function qh(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 Vh(e){let{multipleOf:t}=e;if(t!==void 0&&Number.isInteger(t))return!1;if(e.type==="integer")return!1;return!0}var IS=Cn(0),CS=Ii(["hasCommonInRequired","hasCommonOutRequired","hasExtra1","hasExtra2","hasRejection"]);function Fh(e,t,n){if(ES(t,n))return Q;let r=OS(t,n);if(!r)return Q;let o=Lh(t),i=Lh(n),s=(S)=>{let A=o(S),N=i(S);if(Mh(A,N))return e.calculate(A,N);else return pe},{commonRequired:a,extraRequired1:c,extraRequired2:l}=r,u=CS.variable({});for(let S of[...a].toSorted())u.push(s(S),_S);for(let S of[...c].toSorted())u.push(s(S),RS);for(let S of[...l].toSorted())u.push(s(S),AS);let{hasOptional1:d,hasOptional2:h}=r;if(d||h){let S=PS(d,h);for(let M of[...jS(t,n)].toSorted()){let D=s(M);if(D!==pe)u.push(D,S)}let A=t.additionalProperties??Tt,N=n.additionalProperties??Tt;if(Mh(A,N)){let M=e.calculate(A,N);u.push(M,S)}}u.update((S)=>{if(!S.hasRejection){if(c.size>0)S.hasExtra2=!0;if(l.size>0)S.hasExtra1=!0}});let{requiredKeysCount:g}=r,y=pe;for(let{hasExtra1:S,hasExtra2:A,hasCommonInRequired:N,hasCommonOutRequired:M,hasRejection:D}of u)if(!N&&g>0)y|=Q;else if(!M&&g===0)y|=Q;else if(D)y|=Q;else if(S&&A)y|=ne;else if(S)y|=B;else if(A)y|=W;else y|=G;return y}function ES(e,t){let n=IS(e.minProperties,e.maxProperties,t.minProperties,t.maxProperties);return En(n)===b.Rejection}function OS(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 jS(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 _S=(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}}},RS=(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}}},AS=(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}}},PS=(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 Lh(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&&dt(n,i)===Pe.Invalid)return Or;for(let{pattern:a,schema:c}of o)if(a.test(i))return c;let s=(t&&t[i])??r;if(!s)return Tt;return s}}function Mh(e,t){let n=ee(e),r=ee(t);return n!==I.Never||r!==I.Never}var TS=Cn(0);function Zh(e,t){if(t.format&&!e.format)return B;if(e.format&&t.format&&e.format!==t.format)return We;let n=TS(e.minLength,e.maxLength,t.minLength,t.maxLength),r=En(n),o=!!e.pattern,i=!!t.pattern;switch(r){case b.Rejection:return Q;case b.Containing:return o?We:B;case b.ContainedBy:return i?We:W;case b.Equals:{if(o&&i)return e.pattern===t.pattern?G:We;if(o)return G|W;if(i)return G|B;return G}case b.Intersection:{if(o&&i)return We;if(o)return ne|Q|W;if(i)return ne|Q|B;return ne}}}function Uh(e,t,n){let r={},o=[],i=Eh(NS(e,r)),s=$S(),a=Rh(e);r.isEquals=Ch(xn),r.calculate=yl({describe:s,equals:a,calculate:i,observeCalculation:(l,u,d,h)=>{let g=h?At(d):d;if(!zS(g))return;let y=h?Jh(u,l):Jh(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(ee(e)){case I.Not:{t={kind:Me.Not,expression:e.not};break}case I.Combination:{if("allOf"in e)t={kind:Me.AllOf,expressions:_l(e.allOf,I.Any)};else if("anyOf"in e)t={kind:Me.AnyOf,expressions:_l(e.anyOf,I.Never)};else if("oneOf"in e)t={kind:Me.OneOf,expressions:_l(e.oneOf,I.Never)};else throw Error(`invalid combination JSON Schema: ${JSON.stringify(e)}`);break}default:{t={kind:Me.Leaf};break}}return t},NS=(e,t)=>(n,r)=>{let o=ee(n),i=ee(r);if(o===I.Extends||i===I.Extends)return e.calculate(n,r);switch(o){case I.Any:return i===I.Any?G:B;case I.Never:return i===I.Never?G:W}switch(i){case I.Any:return W;case I.Never:return B}if(o===I.EnumOrConst&&i===I.EnumOrConst)return _h(t,n,r);if(o===I.EnumOrConst)return El(n,r);if(i===I.EnumOrConst)return At(El(r,n));if(o!==i)return Q;switch(o){case I.Null:return G;case I.Numeric:return jl(n,r);case I.String:return Zh(n,r);case I.Boolean:return G;case I.Object:return Fh(t,n,r);case I.Array:return Ih(t,n,r);default:throw Error(`invalid kind ${o}`)}};function _l(e,t){return e.filter((n)=>ee(n)!==t)}function zS(e){return!vr(e)&&!kr(e)&&(xr(e)||Ir(e)||Sr(e))}function Jh(e,t){let n=vl(t);if(!n)return;let r=ee(e),o=ee(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 Pr{constructor(e=[]){this.extendsSchemaClasses=Object.freeze([...e])}tryCompiledExtendsSchema(e,t){for(let n of this.extendsSchemaClasses)if(n.isMatch(e))return new n(_t(),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=Pr.swap(s);o|=Rt(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 Bh(e,t,n=!1){let r=t(e);if(Array.isArray(r)){let s=[];throw Rl(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(In(s))}return o}function Kh(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))Rl(u,o,"$1");if(Array.isArray(i))Rl(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(In(u));if(l.length>0)console.warn(`found ${l.length} warns after compile subSchema`);for(let u of l)console.warn(In(u))}return[s,c]}function Rl(e,t,n){for(let r of t){let o={...r,path:[n,...r.path]};e.push(o)}}var Tr=Object.freeze({True:0,False:1,Unknown:2});function Al({extendsSchemaClasses:e,delegate:t}={}){let n=new Pr(e);return Object.freeze({compile:(o,i,s)=>Bh(o,(c)=>Si(c,n,i,t),s),isSubset:(o,i,s=!1)=>{let a=(y)=>Si(y,n,void 0,t),[c,l]=Kh(o,i,a,s),{errorPath:u,expression:d}=Uh(n,c,l),h=vr(d)||kr(d),g=xr(d)||Ir(d)||Sr(d);if(h&&!g)return{result:Tr.True};if(!h&&g)return{errorPath:u,result:Tr.False};return{result:Tr.Unknown}}})}var Ci=(e)=>typeof e==="string";var DS=Array.isArray;var qS=(e)=>e!==null&&typeof e==="object";var VS=(e)=>qS(e)&&!DS(e),Wt=(e)=>VS(e)?e:void 0;function LS(e){return Wt(e)?.type==="string"}function MS(e){let t=Wt(e),n=Wt(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 FS(e){if(e==null)return{error:{}};return MS(e),e}class Nt{static setError(e,t,n){if(e instanceof Nt)e.context.error.message=n;else if(t instanceof Nt)t.context.error.message=n}constructor(e,t,n){this.id=e,this.value=t,this.context=FS(n)}compare(e){if(Ze(e)&&ee(e)===I.Any)return[b.ContainedBy];return this.compareImpl(e)}}class $r extends Nt{static isMatch(e){let t=Wt(e)?.enum;return Array.isArray(t)&&t.every((n)=>Ci(n))}constructor(e,t,n){if(!$r.isMatch(t))throw TypeError("Invalid single-select schema.");super(e,t,n)}compareImpl(e){if(LS(e))return[b.ContainedBy];if(e instanceof $r){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 $r){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 Nr extends Nt{static isMatch(e){return Wt(e)?.contentMediaType==="oomol/bin"}constructor(e,t,n){if(!Nr.isMatch(t))throw TypeError("Invalid binary schema.");super(e,t,n)}compareImpl(e){if(e instanceof Nr)return[b.Equals];else return Nt.setError(this,e,"edgeError.binDiffType"),[b.Rejection]}equals(e){return e instanceof Nr}}class zr extends Nt{static isMatch(e){return Wt(e)?.contentMediaType==="oomol/artifact"}constructor(e,t,n){if(!zr.isMatch(t))throw TypeError("Invalid Artifact schema.");super(e,t,n)}compareImpl(e){if(e instanceof zr)return[b.Equals];return Nt.setError(this,e,"edgeError.artifactDiffType"),[b.Rejection]}equals(e){return e instanceof zr}}function Wh(){return Al({extendsSchemaClasses:[$r,Nr,zr]})}var OR=Wh();var ZS=new Set(["const","enum","exclusiveMaximum","exclusiveMinimum","maximum","maxItems","maxLength","maxProperties","minimum","minItems","minLength","minProperties","multipleOf","pattern","required","type"]);function Ei(e){return ZS.has(e)}var Oi=E({handle:_().min(1),jsonSchema:Ae(),nullable:ye(),description:_().optional()}),LR=x({inputs:R(Oi).nullable(),outputs:R(Oi).nullable()});var Hh=E({version:w(1),flowId:_().min(1),name:_(),revisionId:_().min(1),publicationId:_().min(1),inputs:R(Oi),outputs:R(Oi).nullable()});var Gh=E({version:w(1),direction:F(["incoming","outgoing"]),total:ke().nonnegative(),nextOffset:ke().nonnegative().optional(),references:R(E({flowId:_(),name:_().nullable(),available:ye(),draft:ye(),live:E({publicationId:_(),enabled:ye()}).nullable()}))});var Pl=["GET","POST","PUT","PATCH","DELETE"];function ji(e){return e!=="GET"}function US(e){return e.kind==="decision"}var Tl={choice:255,score:10};function Qh(e){if(e.type==="noul"||e.criteria.length<=Tl[e.type])return e;if(e.type==="choice")return{...e,criteria:e.criteria.slice(0,Tl.choice)};return{...e,criteria:e.criteria.slice(0,Tl.score)}}function BS(e){let t=e.map(Qh);return t.every((n,r)=>n===e[r])?e:t}function Yh(e){if(!US(e.executor))return e;let t=e.executor.questions,n=BS(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]||!Ie(o.jsonSchema,Xh(t[i])))return o;return{...o,jsonSchema:KS(n[i])}});return{...e,executor:{...e.executor,questions:n},outputs:r}}var $l={type:"number",minimum:0,maximum:1};function KS(e){return Xh(Qh(e))}function Xh(e){let t={type:{const:e.type}};if(e.type==="noul")t.noul=$l;else{let n=e.type==="choice"?e.criteria.map((r)=>r.name):e.criteria.map((r,o)=>String(o));if(t.confidence=$l,t.probabilities={type:"object",properties:Object.fromEntries(n.map((r)=>[r,$l])),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 ey(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 WS=/^(?:\*\.)?(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,Nl=20;function zl(e){return WS.test(e)&&(!e.startsWith("*.")||e.slice(2).includes("."))}var ty=x({mode:F(["fields","object"]).default("fields"),names:R(_()).default([])}),_i=x({method:F(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]).default("GET"),query:ty.default({mode:"fields",names:[]}),headers:ty.default({mode:"fields",names:[]}),bodyFormat:F(["none","json","text","form"]).default("none"),authentication:Y([x({type:w("none")}),x({type:F(["bearer","basic"])}),x({type:w("apiKey"),name:_(),in:F(["header","query"])})]).default({type:"none"}),responseFormat:F(["auto","json","text"]).default("auto"),statusPolicy:F(["success","all"]).default("success")}),ry=_i.extend({kind:w("http-request")});function Ht(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))Ht(n,t+1)}var Dl=["code","connector","openapi","http-request","llm","decision"],Ri={maxRetries:5,minIntervalMs:1000,maxIntervalMs:60000,intervalStepMs:1000};var pt=x({maxRetries:U().int().min(0).max(Ri.maxRetries),intervalMs:U().int().min(Ri.minIntervalMs).max(Ri.maxIntervalMs).multipleOf(Ri.intervalStepMs)});var zt=R(Y([E({type:w("cron"),expression:_(),timezone:_()}),E({type:w("every"),unit:F(["day","hour","minute","month","week"]),value:U()})]));function oy(e){try{return Intl.DateTimeFormat("en",{timeZone:e}),!0}catch{return!1}}var On=rt("kind",[x({kind:w("after"),durationMs:U().nullable()}),x({kind:w("at"),at:_(),timezone:_().optional()})]),ql=rt("kind",[On.options[0].extend({durationMs:U().int().positive().max(Number.MAX_SAFE_INTEGER)}),On.options[1].extend({at:br.datetime({offset:!0}),timezone:_().refine(oy,"Select a valid IANA timezone.").optional()})]);var qr={defaultMs:30000,minMs:1000,maxMs:60000};var iy={jsonSchema:{type:"object",additionalProperties:{type:["string","number","boolean"]}},nullable:!0};var QS=[{handle:"body",jsonSchema:{},nullable:!0,value:""},{handle:"statusCode",jsonSchema:{type:"number"},nullable:!1,value:200},{handle:"headers",jsonSchema:iy.jsonSchema,nullable:!1,value:{}}];var zi=13,k=_(),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.'),Yt=Ae(),Vr=R(k),Dt=E({description:k.optional(),jsonSchema:Yt,nullable:ye(),handle:k}),YS=R(Dt.strict()),Qe=Dt.extend({value:Yt.optional()}),sy=E({collapsed:ye().optional(),group:k}),XS=E({kind:w("node"),nodeId:k,output:k,system:w(!0).optional(),field:k.optional()}),ly=Y([XS,E({kind:w("binding"),bindingId:k})]),Lr=Y([E({kind:w("unset")}),E({kind:w("value"),value:Yt})]),Vl=Y([Lr,E({kind:w("sources"),sources:R(ly)})]),uy=oe(k,Vl),_n={inputs:R(Y([Qe,sy])),outputs:R(Y([Dt,sy]))},eI=x({kind:w("connector"),action:k,connectionId:k.optional(),connections:R(x({connectionId:k,alias:k.optional()}))}),Jl=Y([eI,x({kind:w("connector"),mode:w("shared")}),x({kind:w("connector"),mode:w("independent"),actions:R(x({action:k,connectionId:Pi.optional()}))}),x({kind:w("connector"),actionHints:R(k).optional(),connectionHints:R(x({action:k,connectionId:k,alias:k.optional()})).optional()})]),dy=x({kind:w("workflow"),name:k,flowId:k,revisionId:k,inputs:R(Dt),outputs:R(Dt).nullable()}),Ul=x({kind:w("http"),hosts:R(k.refine(zl,'Use a lowercase host name or IPv4 address, optionally prefixed by "*." for subdomains.')).min(1).max(Nl).describe('Hosts Code may call with context.fetch. "*.example.com" matches subdomains only.')}),Ti=Y([Jl,dy,Ul]),Ll=E({..._n,name:k,moduleId:k,capabilities:R(Ti).optional()}),py=Y([E({kind:w("value"),value:Yt}),E({kind:w("input"),input:k})]),tI=Y([py,E({kind:w("model")})]),Di={id:k,name:k,description:k,approval:ye(),inputs:R(Qe.extend({source:tI}))},Bl=E({...Di,kind:w("connector").optional(),action:k,connectionId:Pi.optional()}),Kl=dy.extend(Di),nI=rt("type",[x({name:k,instructions:k,type:w("noul"),criteria:x({true:k.optional(),false:k.optional()}).optional()}),x({name:k,instructions:k,type:w("choice"),criteria:R(x({name:k,description:k}))}),x({name:k,instructions:k,type:w("score"),criteria:Vr})]),jn=E({..._n,name:k,executor:Y([E({kind:w("connector"),action:k,connectionId:Pi.optional(),outputMode:w("value").optional()}),E({kind:w("openapi"),sourceUrl:k,method:k,path:k,serverUrl:k,document:Yt,auth:R(E({id:k,type:F(["bearer","basic","apiKey"]),name:k.optional(),in:F(["header","query"]).optional()}))}),x({kind:w("decision"),questions:R(nI)}),E({kind:w("llm"),mode:F(["chat","json"])}),E({kind:w("agent"),code:ye().optional(),model:k,prompt:k,maxRounds:U(),tools:R(Y([Kl,Bl])),notification:E({action:k,connectionId:Pi.optional(),inputDefinitions:R(Qe),messageHandle:k,inputs:oe(k,py)}).optional()}),x({kind:w("workflow"),flowId:k,revisionId:k}),ry,Yg])}),Ml=jn.transform(Yh),ay=Y([E({kind:w("value"),value:Yt.optional(),jsonSchema:Yt.optional()}),E({kind:w("source"),source:ly})]),$i={matchMode:F(["first","all"]),cases:R(E({description:k.optional(),output:k,groups:R(E({expressions:R(E({left:ay,operator:F(["!=","<","<=","==",">",">=","contains","endsWith","hasKey","hasValue","isEmpty","isFalse","isNotEmpty","isNotNull","isNull","isTrue","notContains","notHasKey","notHasValue","startsWith"]),right:ay.optional()}))}))}))},Mr={inputDefinitions:R(Qe),prompt:k},rI=E({allowedMethods:nt().optional(),allowedOrigins:Vr.optional(),noResponseBody:nt().optional(),responseBody:rt("kind",[x({kind:w("workflow-outputs"),output:k.optional(),timeoutMs:U().int().min(qr.minMs).max(qr.maxMs).optional()}),x({kind:w("webhook-response"),nodeId:k.optional(),timeoutMs:U().int().min(qr.minMs).max(qr.maxMs).optional()})]).optional(),responseData:k.optional(),responseHeaders:oe(k,k).optional(),responseHeadersSource:x({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:R(Qe),method:F(Pl),options:rI.optional()},cy={configInputs:_n.inputs,definitionVersion:w(2),description:k,displayName:k,key:k,name:k,outputs:R(Dt).refine((e)=>new Set(e.map((t)=>t.handle)).size===e.length,"Duplicate Trigger output handle."),provider:k},oI=E({body:E({allowArray:ye(),allowEmpty:ye(),formats:R(F(["form","json","multipart","text"]))}),methods:R(F(["DELETE","GET","HEAD","PATCH","POST","PUT"])),successStatus:U()}),Fl=R(k.min(1)).refine((e)=>new Set(e).size===e.length,"Duplicate source Flow ID."),Gt={name:k,description:k.optional(),icon:k.optional()},Qt={maxExecutions:U().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),inputs:uy,name:k.optional(),description:k.optional(),icon:k.optional(),timeoutMs:U().optional(),retry:pt.optional(),onError:F(["stop","error"]).optional()},Ai=Y([x({...Qt,kind:w("webhook-response"),retry:nt().optional(),onError:nt().optional()}),x({...Qt,kind:w("outputs"),outputDefs:R(Dt.strict()),outputMappings:uy}).omit({inputs:!0}),E({...Qt,inputs:oe(k,nt()),kind:w("condition"),...$i}),E({...Qt,inputs:lt().transform(()=>({})).default({}),kind:w("value"),values:R(Qe)}),E({...Qt,kind:w("task"),task:Y([Ll,Ml]),additionalInputs:R(Qe).optional()}),x({...Qt,kind:w("approval"),...Mr}).omit({timeoutMs:!0}),x({...Qt,kind:w("wait"),...Mr,autoContinue:On.optional()}).omit({timeoutMs:!0}),E({...Gt,kind:w("manual")}),x({...Gt,kind:w("start"),inputDefs:YS}),x({...Gt,kind:w("error"),sourceFlowIds:Fl.optional()}),E({...Gt,kind:w("webhook"),...Ni}),E({...Gt,kind:w("cron"),cronTimes:zt}),E({...Gt,kind:w("poll"),connectionId:k.min(1).optional(),config:oe(k,Lr),definition:E({...cy,type:w("poll")}),pollTimes:zt}),E({...Gt,kind:w("integration"),connectionId:k.min(1).optional(),config:oe(k,Lr),definition:E({...cy,type:w("integration"),endpoint:oI})})]),st={input:Qe,port:Dt,ports:_n,condition:x($i),wait:x(Mr),waitAutoContinue:ql,webhook:x(Ni),schedule:zt,capabilities:R(Ti),connector:jn.shape.executor.options[0].omit({kind:!0}).strict(),openapi:jn.shape.executor.options[1].omit({kind:!0}).strict(),decision:jn.shape.executor.options[2].omit({kind:!0}).strict(),llm:jn.shape.executor.options[3].omit({kind:!0}).strict(),agent:jn.shape.executor.options[4].omit({kind:!0,notification:!0}).strict()},Zl=E({source:k,target:k,sourceHandle:k.optional()}),Oe={nodeId:k,target:nt().optional()},iI=E({nodes:oe(k,Ai),edges:R(Zl).default([])}),fy=E({kind:w("variable"),target:k}),my=E({name:k,imports:Vr,source:k}),sI=Jg(aI,E({bindings:oe(k,fy),graph:iI})),gy=E({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:sI,modules:oe(k,my)}),jA=gy.extend({kind:w("open-flow-flow-revision"),version:w(1)});function aI(e){let t=it(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(it(it(t.graph).nodes)).some((r)=>Object.hasOwn(it(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(it(it(t.graph).nodes)).some((r)=>it(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(it(it(t.graph).nodes)).some((r)=>it(r).kind=="start"&&Object.hasOwn(it(r),"parameters")))throw TypeError("Legacy Start.parameters is unsupported; configure node.inputDefs.");return e}function it(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Rn(e){Ht(e);let t=gy.parse(e);return lI(t),by(t.document),t}var cI={"graph.trigger.sources.set":{nodeId:k,before:Fl.optional(),value:Fl.optional()},"binding.create":{bindingId:k,binding:fy},"binding.delete":{bindingId:k},"binding.target.set":{bindingId:k,before:k,value:k},"graph.edge.connect":{edge:Zl,target:nt().optional()},"graph.edge.disconnect":{edge:Zl,target:nt().optional()},"graph.node.create":{...Oe,node:Ai},"graph.node.replace":{...Oe,before:Ai,node:Ai},"graph.node.delete":Oe,"graph.node.field.set":Y([E({...Oe,kind:w("graph.node.field.set"),field:w("retry"),before:pt.optional(),value:pt.optional()}),E({...Oe,kind:w("graph.node.field.set"),field:w("connectionId"),before:k.min(1).optional(),value:k.min(1).optional()}),E({...Oe,kind:w("graph.node.field.set"),field:F(["description","icon","name","onError"]),before:k.optional(),value:k.optional()}),E({...Oe,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()}),E({...Oe,kind:w("graph.node.field.set"),field:w("timeoutMs"),before:U().optional(),value:U().optional()})]),"graph.node.input.set":{...Oe,handle:k,before:Vl.optional(),value:Vl.optional()},"graph.node.additional-inputs.set":{...Oe,before:R(Qe).optional(),value:R(Qe).optional()},"graph.node.condition.set":{...Oe,before:E($i),value:E($i)},"graph.node.values.set":{...Oe,before:R(Qe),value:R(Qe)},"graph.node.resolution.set":{...Oe,before:x({...Mr,autoContinue:On.optional()}),value:x({...Mr,autoContinue:On.optional()})},"graph.node.webhook.set":{...Oe,before:E(Ni),value:E(Ni)},"graph.node.task.ports.set":{...Oe,before:E(_n),value:E(_n)},"graph.node.task.name.set":{...Oe,before:k,value:k},"graph.node.task.capabilities.set":{...Oe,before:R(Ti).optional(),value:R(Ti).optional()},"graph.trigger.config.set":{nodeId:k,name:k,before:Lr.optional(),value:Lr.optional()},"graph.trigger.schedule.set":{nodeId:k,before:zt,value:zt},"module.create":{moduleId:k,module:my},"module.delete":{moduleId:k},"module.rename":{moduleId:k,before:k,name:k},"module.source.replace":{moduleId:k,beforeImports:Vr,beforeSource:k,imports:Vr,source:k},"graph.node.task.set":{...Oe,before:Y([Ll,Ml]),value:Y([Ll,Ml])}},hy=new Map(Object.entries(cI).map(([e,t])=>[e,t instanceof K?t:E({kind:w(e),...t})])),_A=R(Y([...hy.values()])).min(1);function Fr(e,t,n){try{return n(e)}catch(r){if(!(r instanceof dx))throw r;throw TypeError(`operations[${t}]: ${r.issues.map((o)=>`${o.path.join(".")}: ${o.message}`).join("; ")}`,{cause:r})}}function yy(e,t){let{kind:n}=Fr(e,t,E({kind:k}).parse),r=hy.get(n);if(r==null)throw TypeError(`operations[${t}]: Unknown operation ${JSON.stringify(n)}.`);return Fr(e,t,r.parse)}function lI(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 by(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))ey(t.inputs)}var wy=x({mode:F(["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 pI=Y([x({schemes:R(_().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.")}),x({type:F(["bearer","basic"])}),x({type:w("apiKey"),name:_().min(1),in:F(["header","query"])})]),vy=x({sourceUrl:_().min(1),path:_().min(1),method:_().min(1),serverUrl:_().optional(),authentication:pI.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")});var z=_().min(1),Ye=Ae(),Yl=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"],Xl=F(qi),ft=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.'),Wl=x({kind:w("output"),node:ft,port:z.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),field:_().optional()}),Hl=x({kind:w("system"),node:ft,port:w("error"),field:_().optional()}),Gl=x({kind:w("variable"),name:z}),xy=Y([Wl,Hl,Gl,x({kind:w("value"),value:Ye}),x({kind:w("unset")}),x({kind:w("default")}),x({kind:w("sources"),sources:R(Y([Wl,Hl,Gl])).min(1)})]),ky=Y([x({kind:w("value"),value:Ye.optional(),schema:Ye.optional()}),Wl,Hl,Gl]),Sy=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."),fI=Y([Kl.omit({id:!0,inputs:!0,outputs:!0,revisionId:!0}).extend({inputs:Sy}).strict(),Bl.omit({id:!0,inputs:!0}).extend({inputs:Sy}).strict()]),mI=R(Y([Jl,x({kind:w("workflow"),name:z,flowId:z}),Ul])),gI=x({...st.connector.shape,messageHandle:z,inputs:oe(z,Y([x({kind:w("value"),value:Ye}),x({kind:w("input"),input:z})]))}),Vi=x({schema:Ye.optional(),nullable:ye().optional(),description:_().optional()}),An=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."),Oy=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."),hI=Oy.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."),jy=oe(z,Vi.extend({schema:Ye,nullable:ye()})),Iy=oe(z,Vi).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true."),Ql=x({left:ky,operator:st.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,right:ky.optional()}),Cy=x({all:R(Ql)}),yI=Y([Ql,Cy,x({any:R(Y([Ql,Cy]))})]),xt={"webhook-response":x({}),workflow:x({flowId:z}),start:x({inputDefs:Oy.default({})}),outputs:x({outputDefs:hI.default({})}),error:x({sourceFlowIds:R(z).optional()}),webhook:st.webhook.omit({bodyFields:!0}).extend({body:An}).strict(),cron:x({schedule:st.schedule}),poll:x({key:z,connectionId:z.optional(),schedule:st.schedule}),integration:x({key:z,connectionId:z.optional()}),code:x({inputs:An,outputs:Iy,capabilities:mI.optional()}),connector:st.connector.omit({outputMode:!0}).strict(),openapi:vy,"http-request":_i,"skip-duplicates":bi,agent:st.agent.omit({prompt:!0,tools:!0}).extend({inputs:An,resultSchema:Ye.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),tools:R(fI),notification:gI.optional()}).strict(),llm:wy.extend({inputs:An}),decision:st.decision,condition:x({match:F(["first","all"]),branches:R(x({name:z,description:_().optional(),when:yI}))}),value:x({values:Yl,outputs:Iy}),wait:x({inputs:An,autoContinue:st.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:x({inputs:An})},bI={onError:F(["stop","error"]).optional(),name:z.optional(),description:_().optional(),icon:_().optional(),maxExecutions:ke().positive().optional(),timeoutMs:U().nonnegative().optional(),retry:pt.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.')},wI=x({...bI,config:Yl.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"].')}),vI=rt("op",[x({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:Xl,name:z,onError:F(["stop","error"]).optional(),retry:pt.optional(),config:Yl.optional(),inputs:oe(z,xy).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),code:_().optional(),prompt:_().optional()}),x({op:w("node.update"),node:ft,set:wI.optional(),clear:R(R(z).min(1)).optional()}),x({op:w("node.refresh"),node:ft,tool:z.optional().describe("Name of a workflow tool on an Agent or Code node. Omit for a Call Workflow node.")}),x({op:w("node.remove"),node:ft}),x({op:w("input.set"),node:ft,input:z,source:xy}),x({op:F(["edge.connect","edge.disconnect"]),source:ft,target:ft,branch:z.optional()}),x({op:w("text.edit"),node:ft,field:F(["code","prompt"]),oldText:z,newText:_()}),x({op:w("text.set"),node:ft,field:F(["code","prompt"]),text:_()})]),Zr=x({baseRevision:z,requestId:z.max(256),edits:R(vI).min(1).max(1000)}),Li=x({revision:z.optional().describe("Fixed revision from a previous read; omit to read the current draft."),nodes:R(z).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),text:x({node:z,field:F(["code","prompt"]),start:ke().positive().default(1),lines:ke().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."}),eu=x({revisionId:z}),Mi=x({revision:z.optional(),query:z.max(1000),type:Xl.optional(),offset:ke().nonnegative().default(0),limit:ke().min(1).max(100).default(20)}),_y=x({type:Xl.optional(),action:z.optional()}).refine((e)=>e.type==null||e.action==null,"Choose type or action."),Ey={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: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:eu,guidance:"Check a fixed revision. In the CLI, pass this identity with --revision REVISION.",examples:[{revisionId:"REVISION"}]}},xI=[...Wu(on).builtinModules].filter((e)=>!e.startsWith("node:")),kI=`Code is an ES module whose default export receives (inputs, context) and returns the business outputs. It may import the Node builtins ${xI.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 tu(e){if(!Object.hasOwn(Ey,e))return;let t=Ey[e];return{request:mn(t.schema,{io:"input"}),guidance:t.guidance,examples:t.examples}}function nu(e){return e==null?{types:qi,request:mn(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:e=="skip-duplicates"||Dl.some((t)=>t==e)?{enum:["stop","error"]}:!1,retry:Dl.some((t)=>t==e)?mn(pt):!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"?kI:"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:mn(xt[e].partial()),texts:e=="code"?["code"]:["agent","wait","approval"].includes(e)?["prompt"]:[]}}var Ry=E({code:z,message:_(),nodes:R(z),field:_().optional(),line:U().optional(),column:U().optional()}),Ay=E({flowId:z,revisionId:z,valid:ye(),diagnostics:R(Ry),version:w(1)}),Py=E({flowId:z,saved:w(!0),revision:z,nodes:oe(z,z),changes:R(E({index:ke(),op:z,node:z.optional()})),validation:E({status:F(["valid","invalid","unavailable"]),diagnostics:R(Ry).optional()}),version:w(1)}),Ty=E({flowId:z,revision:z,data:E({nodes:R(oe(_(),Ye)).optional(),edges:R(Ye).optional(),text:oe(_(),Ye).optional()}),version:w(1)}),$y=E({flowId:z,revision:z,data:E({matches:R(E({node:z.optional(),field:z,line:ke().optional(),excerpt:_()})),total:ke(),nextOffset:ke().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",tagInvalid:"tag.invalid",tagConflict:"tag.conflict",tagNotFound:"tag.not-found",variableInvalid:"variable.invalid",variableLimitReached:"variable.limit-reached",variableNotFound:"variable.not-found"},II={[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.tagInvalid]:{status:400},[q.tagConflict]:{status:409},[q.tagNotFound]:{status:404},[q.variableInvalid]:{status:400},[q.variableLimitReached]:{status:409},[q.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 Ny 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 Ny(e)}function v(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 L(e,t){let n=t.filter((r)=>!Object.hasOwn(e,r));if(n.length>0)p(`Missing fields: ${n.join(", ")}.`)}function zy(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 ve(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(ve);let t=v(e);return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,ve(r)]))}function Fi(e){if(e==null)return;return f(e)}function Pn(e){let t=v(e),n=t.liveEnd==null?void 0:v(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 ru(e){let t=v(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 L(t,["createdAt","flowId","operationId","revisionId","status","updatedAt","version"]),{...r,status:n};case"succeeded":return L(t,["createdAt","flowId","operationId","publicationId","revisionId","status","updatedAt","version"]),{...r,publicationId:f(t.publicationId),status:n};case"failed":{L(t,["createdAt","flowId","issue","operationId","revisionId","status","updatedAt","version"]);let o=v(t.issue),i=o.nodeId;return L(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 ou(e){let t=v(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:Pn(r),revision:ie(t.revision),status:n,version:1}}function Dy(e){let t=v(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(Pn),...r==null?{}:{total:r},version:1}}var qy=R(Y([x({handle:_().min(1),description:_().optional(),jsonSchema:Ae(),nullable:ye(),value:Ae().optional()}),x({group:_(),collapsed:ye().optional()})]));function iu(e){let t=v(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 Jr(e){let t=v(e),n=iu(t),r={configInputs:qy.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=v(l);return Object.assign({handle:f(u.handle),jsonSchema:ve(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=v(t.endpoint),i=v(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 CI=new Set(["error","cron","integration","poll","webhook"]),EI=new Set(["failed","healthy","initializing","needs_reauth","suspended"]),OI=new Set(["delivery.failed","health.failed","health.needs_reauth","health.recovered","health.suspended","operator.paused","operator.resumed"]);function Ur(e){let t=v(e),n=t.health,r=t.listener==null?void 0:v(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"||!EI.has(n))return p();if(typeof o!="string"||!CI.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 Vy(e){let t=v(e);if(t.version!=1)return p();return{binding:Ur(t.binding),version:1}}function jI(e){let t=v(e),n=t.kind;if(typeof n!="string"||!OI.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 Ly(e){let t=v(e),n=Fi(t.nextCursor);if(t.version!=1||!Array.isArray(t.activities))return p();return{activities:t.activities.map(jI),...n==null?{}:{nextCursor:n},version:1}}function My(e){let t=v(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=v(r);return Object.fromEntries(Object.entries(o).map(([i,s])=>[i,ve(s)]))}),filtered:n,hasMore:t.hasMore,version:1}}var Xt={nodeId:_().min(1),name:_(),description:_().optional()},Br=lt().transform(Ur),Fy={provider:_().min(1),inputs:oe(_(),rt("kind",[E({kind:w("value"),value:Ae()}),E({kind:w("unset")})]))},RI=rt("type",[E({...Xt,type:w("start"),config:xt.start}),E({...Xt,type:w("manual"),config:E({})}),E({...Xt,type:w("webhook"),config:xt.webhook,binding:Br}),E({...Xt,type:w("cron"),config:xt.cron,binding:Br}),E({...Xt,type:w("error"),config:xt.error,binding:Br}),E({...Xt,...Fy,type:w("poll"),config:xt.poll,binding:Br}),E({...Xt,...Fy,type:w("integration"),config:xt.integration,binding:Br})]);function Zy(e){let t=v(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=Pn(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=jy.safeParse(t.inputDefs);if(!i.success)return p();return{flowId:n,inputDefs:i.data,publication:r,status:o,enabled:t.enabled,entries:AI(t.entries,r),version:1}}function AI(e,t){let n=R(RI).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 Jy(e){return e.kind=="source"&&e.source.kind=="binding"?{kind:"value"}:e}function Uy(e){return{...e,cases:e.cases.map((t)=>({...t,groups:t.groups.map((n)=>({...n,expressions:n.expressions.map((r)=>({...r,left:Jy(r.left),...r.right==null?{}:{right:Jy(r.right)}}))}))}))}}var cu=80;function Kr(e){let t=e.trim();if(t.length==0)return"empty";if(t.length>cu)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 Ky(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 Wy(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 qI=x({kind:w("open-flow-workflow"),version:w(1),name:_().optional(),content:lt(),presentation:oe(_(),Ae()).optional()});function Ui(e){Ht(e,-1);let t=qI.parse(e);return{...t,content:Rn(t.content)}}function Gy(e){return Ui(JSON.parse(e))}function Hy(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 VI(e){let t=Ui(e),n=t.content.document.graph,r=Wy(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,Hy(l)]))};if(a.kind=="outputs")a={...a,outputMappings:Object.fromEntries(Object.entries(a.outputMappings).map(([c,l])=>[c,Hy(l)]))};if(a.kind=="condition")a=Uy(a);if(a.kind=="error"&&a.sourceFlowIds!=null)a={...a,sourceFlowIds:[]};if(a.kind=="poll"||a.kind=="integration")a={...a,config:Ky(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)=>!Ie(o[i],n.nodes[i])),removedBindings:Object.keys(t.content.document.bindings).length}}}function Qy(e){return`${JSON.stringify(VI(e).file,null,2)}
61
- `}function Yy(e){return e.replace(/(?:\.openflow)?\.json$/i,"")}var MI=rt("kind",[x({kind:w("admin-delegation")}),x({kind:w("policy"),ruleId:_().min(1).nullable()})]);function Bi(e){return MI.parse(e)}function tb(e){let t=v(e);if(!Array.isArray(t.bots))return p("Leina bots: expected an array.");let n=t.bots.map((r)=>{let o=v(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 FI(e){let t=v(e);if(L(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 nb(e,t){let n=v(e),{policyRevision:r,status:o,isDefault:i}=n,s=Object.hasOwn(n,"displayName")&&!Object.hasOwn(n,"connectionDisplayName"),a=t&&Object.hasOwn(n,"permissions")?FI(n.permissions):void 0,c=n.permissionGroupName;if(L(n,["accessBindingId","connectionId","source",s?"displayName":"connectionDisplayName","providerId",...t?[]:["status"]]),r!==void 0&&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 uu(e){if(e!="implicit"&&e!="selectable")return p("mode: expected implicit or selectable.");return e}function Tn(e){let t=v(e);L(t,["accessRevision","bindings","mode","sharedAccessDigest","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(nb(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:uu(t.mode),sharedAccessDigest:f(t.sharedAccessDigest),version:1}}function Xy(e){if(!Array.isArray(e))return p();let t=e.map((n)=>{let r=v(n);L(r,["accessBindingId","connectionId","providerId","source","connectionDisplayName"]);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 du(e){let t=v(e);if(L(t,["mode","sharedAccessDigest","sharedBindings","selectedBindings","version"]),t.version!=2)return p();let n=uu(t.mode),r=Xy(t.sharedBindings),o=Xy(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 ZI(e,t){let n=v(e);if(L(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)=>nb(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:uu(n.mode),providerId:t,version:1}}function rb(e,t){let n=v(e);if(L(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=v(i),a=f(s.providerId);if(!r.delete(a))return p("results[].providerId: duplicate or unrequested provider.");if(!Object.hasOwn(s,"error"))return ZI(s,a);L(s,["providerId","error"]);let c=v(s.error);return L(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 $n(e){let t=v(e);if(L(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 ob(e,t=!1){let n=v(e),r=n.description,o=t&&Object.hasOwn(n,"value");if(L(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:ve(n.jsonSchema),nullable:n.nullable,...o?{value:ve(n.value)}:{}}}function JI(e){return ob(e,!0)}function eb(e,t){return Object.fromEntries(Object.entries(v(e)).map(([n,r])=>[n,t(r)]))}function UI(e){let t=v(e),{homepageUrl:n,icon:r}=t;if(L(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:ve(t.inputSchema)},...t.outputSchema===void 0?{}:{outputSchema:ve(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:eb(t.inputs,JI),name:f(t.name),outputs:eb(t.outputs,ob),serviceId:f(t.serviceId),serviceName:f(t.serviceName)}}function Ki(e){let{defaultConnection:t,...n}=v(e),r=UI(n);if(t==null)return r;let o=$n(t);if(o.serviceId!=r.serviceId||o.status!="active")return p();return{...r,defaultConnection:o}}function ib(e){let t=v(e),{homepageUrl:n,icon:r}=t;if(t.noSetup!==void 0&&typeof t.noSetup!="boolean")return p();if(L(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 pu(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 Nn=_().min(1).max(256),ab=E({appId:Nn.nullable(),workspaceId:Nn.optional(),installationId:Nn.optional(),organizationId:Nn.optional(),projectId:Nn.optional(),projectKey:Nn.optional(),subscriptionStatus:F(["idle","pending","ready","error"]).optional(),lastError:_().optional(),signingSecretConfigured:ye().optional(),manageSubscriptions:ye().nullable(),verificationTokenConfigured:ye().nullable(),encryptKeyConfigured:ye().nullable(),verifiedAt:_().nullable()});var zn=_().min(1).max(256),WI=_().regex(/^[a-z][a-z0-9_.:]{0,127}$/),HI=_().trim().min(1).max(128),cb=E({version:w(1),sourceId:zn,revision:ke().positive(),name:HI,provider:F(["feishu","feishu_app_bot","slackbot","intercom","sentry","zoom","fireflies","jira"]),...ab.shape,connectionId:zn,teamId:zn.nullable(),enabled:ye(),eventTypes:R(WI),endpointUrl:_().nullable(),lastReceivedAt:_().nullable(),updatedAt:_(),consumers:R(E({flowId:zn,flowName:_(),triggerNodeId:zn}))});function Wi(e){return cb.parse(e)}function fu(e){return E({version:w(1),sources:R(cb),teamId:zn.nullable().optional()}).parse(e)}function mu(e){let t=v(e);if(L(t,["version","locale","definitions","display"]),t.version!=3||!Uu(t.locale)||!Array.isArray(t.definitions))return p();let n=t.definitions.map(Jr),r=v(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=v(r[a]);return L(c,["configInputs","configInputLabels","displayName","description","outputs"]),[a,{configInputs:lb(c.configInputs,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),configInputLabels:GI(c.configInputLabels,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),displayName:f(c.displayName),description:f(c.description),outputs:lb(c.outputs,s.outputs.map((l)=>l.handle))}]}));return{version:3,locale:t.locale,definitions:n,display:i}}function lb(e,t){let n=v(e);return zy(n,t),Object.fromEntries(Object.entries(n).map(([r,o])=>[r,f(o)]))}function GI(e,t){let n=v(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 gu(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 QI=x({pointer:_().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 YI=Ae(),ub=E({pointer:_(),type:F(["object","array","string","number","boolean","null"]),length:U().int().nonnegative().optional(),complete:ye(),value:YI.optional()}),XI=ub.extend({offset:U().int().nonnegative(),nextOffset:U().int().positive().optional(),entries:R(ub).optional()}),db=E({resultId:_().min(1),callId:_().min(1),toolId:_().min(1),source:rt("kind",[E({kind:w("connector"),action:_().min(1)}),E({kind:w("code")}),E({kind:w("workflow"),flowId:_().min(1)})]),bytes:U().int().nonnegative(),digest:_().regex(/^[a-f0-9]{64}$/),createdAt:_().datetime()}),eC=E({version:w(1),runId:_(),results:R(db),nextAfter:_().optional()}),tC=E({version:w(1),runId:_(),result:db,page:XI});function hu(e){return eC.parse(e)}function yu(e){return tC.parse(e)}function pb(e){if(!Array.isArray(e))return p();return e.map((t)=>typeof t=="string"||Number.isSafeInteger(t)?t:p())}function nC(e){let t=v(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:pb(t.path)};if(n!="keyword"||typeof t.keyword!="string"||!Ei(t.keyword))return p();return{kind:n,keyword:t.keyword,path:pb(t.path),source:t.source===void 0?void 0:ve(t.source),target:t.target===void 0?void 0:ve(t.target)}}function rC(e){let t=v(e),n=t.values==null?void 0:v(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:nC(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 fb(e){let t=v(e);if(t.version!=1||typeof t.valid!="boolean"||!Array.isArray(t.diagnostics))return p();return{closureDigest:f(t.closureDigest),diagnostics:t.diagnostics.map(rC),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 mb=(e)=>e==null?"":`?flowId=${encodeURIComponent(e)}`;function gb(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=v(r);if(L(o,["providers","version"]),o.version!=1||!Array.isArray(o.providers))return p();return o.providers.map(ib)}}}function hb(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=v(o);if(L(i,["action","version"]),i.version!=1)return p();return Ki(i.action)}}}function yb(e){return{path:`/v1/connector/connections${mb(e)}`,decode:(t)=>{let n=v(t);if(L(n,["connections","version"]),n.version!=1||!Array.isArray(n.connections))return p();return n.connections.map($n)}}}function bb(e,t){return{path:`/v1/connector/connections/${encodeURIComponent(e)}${mb(t)}`,decode:(n)=>{let r=v(n);if(L(r,["connections","serviceId","version"]),r.version!=1||f(r.serviceId)!=e||!Array.isArray(r.connections))return p();return r.connections.map($n)}}}function Wr(e){return Array.isArray(e)?e.map(f):p()}function oC(e){let t=v(e),n=t.draft===null?null:v(t.draft),r=v(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:Wr(n.calledFlowIds)},variableNames:Wr(n.variableNames),errorSourceFlowIds:Wr(n.errorSourceFlowIds),connections:n.connections.map((i)=>{let s=v(i);return{providerId:f(s.providerId),connectionId:f(s.connectionId)}})},sharedAccess:{accessRevision:o,providerIds:Wr(r.providerIds),bindings:r.bindings.map((i)=>{let s=v(i);return{providerId:f(s.providerId),connectionId:s.connectionId===null?null:f(s.connectionId),accessBindingId:f(s.accessBindingId)}})}}}function mt(e){let t=v(e),n=t.status;if(t.version!=1)return p();if(n!="active"&&n!="retiring")return p();let r=t.live==null?void 0:v(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?[]:Wr(t.tagIds),createdAt:f(t.createdAt),...t.connectorTeamId==null?{}:{connectorTeamId:f(t.connectorTeamId)},draftRevisionId:f(t.draftRevisionId),resourceReferences:oC(t.resourceReferences),flowId:f(t.flowId),name:f(t.name),status:n,updatedAt:f(t.updatedAt),version:1}}function iC(e){let t=v(e),n=ie(t.referenceCount);if(n<0)return p();return{...mt(t),referenceCount:n}}function wb(e){let t=v(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(iC),...r==null?{}:{total:r},version:1}}function Hi(e){let t=v(e);if(L(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 vb(e){let t=v(e),{referenceCount:n,...r}=t,o=ie(n);if(o<0)return p();return{...Hi(r),referenceCount:o}}function xb(e){let t=v(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 kb(e){let t=v(e);if(L(t,["version","references"]),t.version!=1||!Array.isArray(t.references))return p();return{version:1,references:t.references.map((n)=>{let r=v(n);if(L(r,["flowId","flowName","draft","live"]),typeof r.draft!="boolean")return p();let o=r.live===null?null:v(r.live);if(o!=null){if(L(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 bu(e){let t=v(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 Hr(e){let t=v(e);try{return{...bu(t),content:Rn(t.content)}}catch{return p()}}function Sb(e){let t=v(e),n=v(t.content),r=v(v(n.document).graph),o=Object.entries(v(r.nodes)).flatMap(([i,s])=>{let a=v(s);if(a.kind=="outputs"||Object.hasOwn(a,"inputs"))return[];let c=f(a.kind);if(a.name!==void 0&&typeof a.name!="string")return p();return[{triggerId:f(i),kind:c,...a.name===void 0?{}:{name:a.name}}]});return{...bu(t),triggers:o}}function Gi(e){let t=v(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(v(t.value)).map(([n,r])=>[n,ve(r)])),version:1}}function Gr(e){let t=v(e);if(t.version!=1)return p();return{revision:bu(t.revision),version:1}}function Ib(e){let t=v(e);if(t.version!=1||t.kind!="snapshot")return p();return{draft:Hr(t.draft),kind:"snapshot",version:1}}var sC=["canceled","completed","failed","indeterminate"],Qi=[...sC,"queued","running","starting","waiting"];var aC=new Set(Qi);function Yi(e){return typeof e=="string"&&aC.has(e)?e:p()}function Ob(e){let t=v(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 cC(e){let t=v(e);L(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 Cb(e){let t=v(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 lC(e){let t=v(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=v(e),n=Ob(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(cC);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:lC(t.initiator)},...uC(t),...t.triggerNodeId===void 0?{}:{triggerNodeId:f(t.triggerNodeId)},...t.caller===void 0?{}:{caller:Cb(t.caller)},...t.calls===void 0?{}:{calls:t.calls.map((a)=>Object.assign(Cb(a),{status:v(a).status===null?null:Yi(v(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 jb(e){let t=v(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(Ob),version:1}}function _b(e){let t=v(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 Rb(e){let t=v(e);L(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 Ab(e){let t=v(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=v(t.error);return{...r,error:Eb(o),status:"failed"}}if(n=="indeterminate"){let o=v(t.error);return{...r,error:Eb(o),status:"indeterminate"}}return p()}function uC(e){let t=e.errorSource==null?void 0:v(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=v(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 Eb(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 wu(e={}){return{query:e.query?.trim().toLowerCase()??"",tagIds:[...new Set(e.tagIds??[])].toSorted(),untagged:e.untagged??!1}}function ts(e){let t=v(e);if(t.version!=1)return p();return{tagId:f(t.tagId),name:f(t.name),version:1}}function Pb(e){let t=v(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 dC(e){let t=v(e),n=ie(t.sequence);if(n<0)return p();let r={createdAt:f(t.createdAt),sequence:n},o=v(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:Tb(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:ve(o.result)}};case"run.events-truncated":return{...r,kind:i,payload:Object.fromEntries(Object.entries(o).map(([s,a])=>[s,ve(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(v(o.systemOutputs)).map(([a,c])=>[a,ve(c)]))},outputs:Object.fromEntries(Object.entries(v(o.outputs)).map(([a,c])=>[a,ve(c)]))}};case"node.failed":{let a=v(o.error);return{...r,kind:i,payload:{...s,...o.handled===!0?{handled:!0}:{},...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(v(o.systemOutputs)).map(([c,l])=>[c,ve(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:Tb(o.progress)}};case"node.artifact":{let a=v(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 Tb(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=100?e:p()}function pC(e){let t=v(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(dC),...n==null?{}:{eventsExpiresAt:n},historyComplete:t.historyComplete,nextAfter:r,runId:f(t.runId),version:1}}var j=encodeURIComponent;function en(e){return`${e}-${es()}`}class vu{constructor(e,t="api"){this.channel=t,this.requestControl=e}async loadOpenApiDocument(e,t){let n=v(await this.request("/v1/openapi/document",{method:"POST",body:JSON.stringify({url:e,version:1}),signal:t}));if(n.version!=1)return p();return ve(n.document)}async listFlows(e={}){let t=new URLSearchParams,n=wu(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 wb(await this.request(`/v1/flows${r}`,e.signal==null?void 0:{signal:e.signal}))}async listEventSources(e,t){return fu(await this.request("/v1/event-sources"+(e==null?"":`?flowId=${j(e)}`),{signal:t}))}async listEventSourceConnections(e,t,n="feishu"){let r=v(await this.request(`/v1/event-sources/connections?kind=${n}${e==null?"":`&teamId=${j(e)}`}`,{signal:t}));if(L(r,["version","connections"]),r.version!=1||!Array.isArray(r.connections))return p();return r.connections.map($n)}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/${j(e)}`,{method:"PUT",body:JSON.stringify(t)}))}async deleteEventSource(e,t){await this.request(`/v1/event-sources/${j(e)}`,{method:"DELETE",body:JSON.stringify({version:1,expectedRevision:t})})}async listVariables(){let e=v(await this.request("/v1/variables"));if(L(e,["variables","version"]),e.version!=1||!Array.isArray(e.variables))return p();return{variables:e.variables.map(vb),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 Gh.parse(await this.request(`/v1/flows/${j(e)}/references?${n}`,{signal:t.signal}))}async getWorkflowContract(e,t){return Hh.parse(await this.request(`/v1/flows/${j(e)}/call-contract`,{signal:t}))}async getVariableReferences(e,t){return kb(await this.request(`/v1/variables/${j(e)}/references`,{signal:t}))}async getVariable(e){return Hi(await this.request(`/v1/variables/${j(e)}`))}async putVariable(e,t){return Hi(await this.request(`/v1/variables/${j(e)}`,{body:JSON.stringify({value:t}),method:"PUT"}))}async deleteVariable(e){let t=v(await this.request(`/v1/variables/${j(e)}`,{method:"DELETE"}));if(L(t,["version"]),t.version!=1)return p()}async exportFlow(e){let t=await this.request(`/v1/flows/${j(e)}/export`);try{return Ui(t)}catch{return p()}}async importFlow(e,t={}){return mt(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 mt(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=v(await this.request(`/v1/flows/${j(e)}/canvas`,{method:"POST",body:JSON.stringify({version:1,command:t})}));if(L(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 mt(await this.request(`/v1/flows/${j(e)}`))}async getErrorListeners(e,t){let n=v(await this.request(`/v1/flows/${j(e)}/error-listeners`,{signal:t}));if(n.version!=1||!Array.isArray(n.listeners))return p();return n.listeners.map(xb)}async listTags(e){let t=v(await this.request("/v1/tags",{signal:e}));if(t.version!=1||!Array.isArray(t.tags))return p();return{tags:t.tags.map(Pb),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/${j(e)}`,{method:"PATCH",body:JSON.stringify({name:t,version:1})}))}async deleteTag(e){if(v(await this.request(`/v1/tags/${j(e)}`,{method:"DELETE"})).version!=1)p()}async setFlowTags(e,t){return mt(await this.request(`/v1/flows/${j(e)}/tags`,{method:"PUT",body:JSON.stringify({tagIds:t,version:1})}))}async updateFlow(e,t){return mt(await this.request(`/v1/flows/${j(e)}`,{method:"PATCH",body:JSON.stringify({...t,version:1})}))}async getFlowState(e,t){let n=fl.safeParse(await this.request(`/v1/flows/${j(e)}/state?scope=${t}`));return n.success&&n.data.scope===t?n.data:p()}async getFlowStateSummary(e,t,n){let r=Xg.safeParse(await this.request(`/v1/flows/${j(e)}/state/summary?scope=${t}`,{signal:n}));return r.success&&r.data.scope===t?r.data:p()}async getFlowStateValues(e,t,n,r){let o=eh.safeParse(await this.request(`/v1/flows/${j(e)}/state/read`,{method:"POST",body:JSON.stringify({version:1,scope:t,keys:n}),signal:r}));return o.success&&o.data.scope===t&&o.data.values.length===n.length&&o.data.values.every((i,s)=>i.key===n[s])?o.data:p()}async clearFlowState(e,t,n){let r=v(await this.request(`/v1/flows/${j(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=v(await this.request(`/v1/flows/${j(e)}/dedupe?scope=${t}&space=${encodeURIComponent(n)}`,{method:"DELETE"}));if(r.version!==1||r.cleared!==!0)p()}async clearAllFlowDedupe(e,t){let n=v(await this.request(`/v1/flows/${j(e)}/dedupe/all?scope=${t}`,{method:"DELETE"}));if(n.version!==1||n.cleared!==!0)p()}async renameFlow(e,t){return this.updateFlow(e,{name:t})}async deleteFlow(e){return mt(await this.request(`/v1/flows/${j(e)}`,{method:"DELETE"}))}async listTriggerKeys(e,t){let n=v(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(iu)}async listTriggerDefinitions(e){let t=v(await this.request("/v1/trigger-keys/catalog",{signal:e}));if(t.version!=2||!Array.isArray(t.definitions))return p();return t.definitions.map(Jr)}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:mu(await o.json()),etag:o.headers.get("etag")?.trim()||null}}async getTriggerKey(e,t){let n=v(await this.request(`/v1/trigger-keys/${j(e)}`,{signal:t}));if(n.version!=1)return p();return Jr(n.definition)}async listFlowTriggerBindings(e,t){let n=v(await this.request(`/v1/flows/${j(e)}/triggers`,{signal:t}));if(n.version!=1||f(n.flowId)!=e||!Array.isArray(n.bindings))return p();return n.bindings.map(Ur)}async getFlowTriggerBinding(e,t){return Vy(await this.request(`/v1/flows/${j(e)}/triggers/${j(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 Ly(await this.request(`/v1/flows/${j(e)}/triggers/${j(t)}/activities${o}`))}async testFlowPollTrigger(e,t){return My(await this.request(`/v1/flows/${j(e)}/triggers/${j(t)}/test`,{body:JSON.stringify({version:1}),method:"POST"}))}async getEditor(e){let t=v(await this.request(`/v1/flows/${j(e)}/editor`));if(t.version!=1)return p();let n={flow:mt(t.flow),draft:Hr(t.draft),live:ou(t.live),presentation:Gi(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=v(await this.request(`/v1/flows/${j(e)}/publications/${j(t)}/presentation`,{signal:n}));if(r.version!=1)return p();return{version:1,presentation:r.presentation===null?null:Gi(r.presentation)}}async getPresentation(e){return Gi(await this.request(`/v1/flows/${j(e)}/presentation`))}async getDraft(e){return Hr(await this.request(`/v1/flows/${j(e)}/draft`))}async syncDraft(e){return Ib(await this.request(`/v1/flows/${j(e)}/draft/sync`))}async getRevision(e,t,n){return Hr(await this.request(`/v1/flows/${j(e)}/revisions/${j(t)}`,{signal:n}))}async getRevisionTriggers(e,t,n){let r=Sb(await this.request(`/v1/flows/${j(e)}/revisions/${j(t)}`,{signal:n}));if(r.flowId!=e||r.revisionId!=t)return p();return r}async listTriggerConfigOptions(e,t,n,r){let o=v(await this.request(`/v1/flows/${j(e)}/triggers/${j(t)}/options/${j(n)}`,{signal:r}));if(L(o,["options","version"]),o.version!=1||!Array.isArray(o.options)||o.options.length>1000)return p();return o.options.map((i)=>{let s=v(i);L(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=v(await this.request("/v1/connector/teams",{signal:e}));if(L(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=v(n);if(L(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=gb(t,n);return this.connectorRequest(r.path,"providers",e,r.decode)}async listLeinaBots(e,t){return tb(await this.request(`/v1/connector/leina/bots?flowId=${j(e)}`,{signal:t}))}async removeConnectionUsage(e,t,n,r,o){return Gr(await this.request(`/v1/flows/${j(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 Tn(await this.request(`/v1/flows/${j(e)}/connector-access`,{signal:t}))}async getPublishedConnectorAccess(e,t,n){return du(await this.request(`/v1/flows/${j(e)}/connector-access?publicationId=${j(t)}`,{signal:n}))}async listProviderAccessBindingCandidates(e,t,n){return rb(await this.request(`/v1/flows/${j(e)}/connector-access/candidates/query`,{method:"POST",body:JSON.stringify({providerIds:t,version:1}),signal:n}),t)}async setConnectorService(e,t,n,r){return Tn(await this.request(`/v1/flows/${j(e)}/connector-access/${j(t)}/service`,{body:JSON.stringify({expectedAccessRevision:r,version:1}),method:n?"PUT":"DELETE"}))}async addProviderAccessBinding(e,t,n,r){return Tn(await this.request(`/v1/flows/${j(e)}/connector-access/${j(t)}`,{body:JSON.stringify({accessBindingId:n,expectedAccessRevision:r,version:1}),method:"PUT"}))}async removeProviderAccessBinding(e,t,n,r){return Tn(await this.request(`/v1/flows/${j(e)}/connector-access/${j(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=hb(e,n,r);return this.connectorRequest(i.path,"actions",t,i.decode,o)}async listAllConnectorConnections(e,t,n=!1){let r=yb(t);return this.connectorRequest(r.path,"connections",e,r.decode,n)}async listConnectorConnections(e,t,n,r=!1){let o=bb(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=v(await this.request(`/v1/connector/connections/${j(e)}/page${r.size==0?"":`?${r}`}`,{body:JSON.stringify({version:1}),method:"POST"}));if(L(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 Ty.parse(await this.request(`/v1/flows/${j(e)}/authoring/read`,{method:"POST",body:JSON.stringify(t)}))}async searchAuthoring(e,t){return $y.parse(await this.request(`/v1/flows/${j(e)}/authoring/search`,{method:"POST",body:JSON.stringify(t)}))}async authoringSchema(e,t){return v(await this.request(`/v1/flows/${j(e)}/authoring/schema`,{method:"POST",body:JSON.stringify(t)}))}async editAuthoring(e,t){return Py.parse(await this.request(`/v1/flows/${j(e)}/authoring/edit`,{method:"POST",headers:{"idempotency-key":t.requestId},body:JSON.stringify(t)}))}async checkAuthoring(e,t){return Ay.parse(await this.request(`/v1/flows/${j(e)}/authoring/check`,{method:"POST",body:JSON.stringify({revisionId:t})}))}async changeDraft(e,t,n,r=en("change")){return Gr(await this.request(`/v1/flows/${j(e)}/draft/changes`,{body:JSON.stringify({expectedRevisionId:t,operations:n,version:1}),headers:{"idempotency-key":r},method:"POST"}))}async repairDraft(e,t,n=en("repair")){return Gr(await this.request(`/v1/flows/${j(e)}/draft/repair`,{body:JSON.stringify({expectedRevisionId:t,version:1}),headers:{"idempotency-key":n},method:"POST"}))}async upgradeDraft(e,t,n={}){return Gr(await this.request(`/v1/flows/${j(e)}/draft/upgrade`,{body:JSON.stringify({expectedRevisionId:t,version:1}),headers:{"idempotency-key":n.idempotencyKey??en("upgrade")},method:"POST"}))}async checkFlow(e,t){return fb(await this.request(`/v1/flows/${j(e)}/revisions/${j(t)}/check`,{body:JSON.stringify({engineContract:on,version:1}),method:"POST"}))}async getLiveDetails(e,t){let n=Zy(await this.request(`/v1/flows/${j(e)}/live/details`,{signal:t}));if(n.flowId!=e)return p();return n}async getLive(e,t){return ou(await this.request(`/v1/flows/${j(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 Dy(await this.request(`/v1/flows/${j(e)}/publications${o}`,{signal:n}))}async createDraftRun(e,t,n){let r=Xi(await this.request(`/v1/flows/${j(e)}/revisions/${j(t)}/runs`,{body:JSON.stringify({engineContract:on,inputs:n.inputs??{},trigger:n.trigger,version:2}),headers:{"idempotency-key":n.idempotencyKey??en("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??en("run"),"x-open-flow-client":this.channel},method:"POST"}));return n.source=="live"?n:p()}async setFlowEnabled(e,t,n){return mt(await this.request(`/v1/flows/${j(e)}/enabled`,{method:"PUT",body:JSON.stringify({enabled:n,expectedPublicationId:t,version:1})}))}async publishFlow(e,t,n,r={}){return ru(await this.request(`/v1/flows/${j(e)}/revisions/${j(t)}/publications`,{body:JSON.stringify({engineContract:on,expectedLivePublicationId:n,version:1}),headers:{"idempotency-key":r.idempotencyKey??en("publication")},method:"POST"}))}async getPublishOperation(e,t,n){return ru(await this.request(`/v1/flows/${j(e)}/publish-operations/${j(t)}`,{signal:n}))}async rollbackFlow(e,t,n,r={}){return Pn(await this.request(`/v1/flows/${j(e)}/publications/${j(t)}/rollback`,{body:JSON.stringify({expectedLivePublicationId:n,version:1}),headers:{"idempotency-key":r.idempotencyKey??en("publication")},method:"POST"}))}async getRun(e,t){return Xi(await this.request(`/v1/runs/${j(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 jb(await this.request(`/v1/flows/${j(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 pC(await this.request(`/v1/runs/${j(e)}/events${o}`,{signal:n}))}async listRunResults(e,t,n){return hu(await this.request(`/v1/runs/${j(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 yu(await this.request(`/v1/runs/${j(e)}/results/${j(t)}?${o}`,{signal:r}))}async downloadRunResult(e,t,n){return(await this.response(`/v1/runs/${j(e)}/results/${j(t)}/content`,{signal:n})).blob()}async getRunResult(e,t){return Ab(await this.request(`/v1/runs/${j(e)}/result`,{signal:t}))}async cancelRun(e){return _b(await this.request(`/v1/runs/${j(e)}/cancel`,{body:JSON.stringify({version:1}),method:"POST"}))}async resolveRunWait(e,t,n,r){return Rb(await this.request(`/v1/runs/${j(e)}/waits/${j(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])=>`${j(o)}=${j(i)}`).join("&"),r=n==""?"":`?${n}`;return this.connectorRequest(`/v1/connector/actions${r}`,"actions",t,(o)=>{let i=v(o);if(L(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=v(i).error,a=s==null?void 0:v(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:v(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 bC}from"crypto";class C 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(Kr(n)!=null)throw new C("cli.invalid-arguments",`${t} name must be between 1 and ${cu} characters and use only letters, numbers, spaces, hyphens, or underscores.`);return n}var fC=100,xu=100,ku=100,mC=new Set(["canceled","completed","failed","indeterminate"]);async function gC(e){let t=[],n=new Set,r;do{let o=await e.listFlows({cursor:r,limit:fC});if(t.push(...o.flows),r=o.nextCursor,r!=null&&n.has(r))throw new C("page.invalid-cursor","The deployment returned a repeated Flow cursor.");if(r!=null)n.add(r)}while(r!=null);return t}function hC(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 C("flow.ambiguous",`Flow name ${JSON.stringify(t)} is ambiguous.`,{candidates:r.map(({flowId:o,name:i})=>({flowId:o,name:i}))});throw new C("flow.not-found",`Flow ${JSON.stringify(t)} was not found.`)}async function xe(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 hC(await gC(e),t)}async function Nb(e,t,n){if(n.expectedRevision!=null&&n.expectedRevision!=t.draftRevisionId&&!n.options.includes("idempotency-key"))throw new C("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 yC(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 C("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 C("connector.action-not-found",`Connector Action ${JSON.stringify(t)} was not found.`)}async function zb(e,t,n){try{return await e.getConnectorAction(t,void 0,n)}catch(r){if(!(r instanceof Te)||r.status!=404)throw r}return yC(await e.searchConnectorActions(t,void 0,n),t)}function Su(e){return`${e.displayName} ${e.key} ${e.provider} ${e.type}`}async function Db(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 C("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 C("trigger-key.not-found",`Trigger Key ${JSON.stringify(t)} was not found.`)}function qb(e){return`${e.displayName} ${e.connectionId} ${e.serviceId} ${e.status}${e.isDefault?"\tdefault":""}`}function Iu(e){return`${e.name} ${e.actionId} ${e.serviceName} ${e.serviceId}`}function le(e,t,n){if(e.length!=t)throw new C("cli.invalid-arguments",`Usage: ${n}`)}function Z(e,t,n,r){e.stdout.write(t?`${JSON.stringify(n)}
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 jm(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;jm(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 _m=new Set(["type","properties","required","additionalProperties"]),Em=["oneOf","anyOf"];function Om(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(!_m.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]??Om(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};Re(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=Om(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 gk(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of _m)if(o in e)return;let n=t.filter((o)=>Em.some((i)=>Array.isArray(o[i]))),r=null;if(!n.length)r=Ha(t);else{let o=n[0],i=Em.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,ur(e,r)}function mr(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 g=e.seen.get(d),y=g.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 ur(l,y);if(ur(l,u),a._zod.parent===d)for(let A in l){if(A==="$ref"||A==="allOf")continue;if(!(A in u))delete l[A]}if(y.$ref&&g.def)for(let A in l){if(A==="$ref"||A==="allOf")continue;if(A in g.def&&JSON.stringify(l[A])===JSON.stringify(g.def[A]))delete l[A]}}let h=a._zod.parent;if(h&&h!==d){r(h);let g=e.seen.get(h);if(g?.schema.$ref){if(l.$ref=g.schema.$ref,g.def)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(y in g.def&&JSON.stringify(l[y])===JSON.stringify(g.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())jm(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)??[])gk(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)}ur(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;Re(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:dr(t,"input",e.processors),output:dr(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 Rm=(e,t={})=>(n)=>{let r=pr({...n,processors:t});return de(e,r),fr(r,e),mr(r,e)},dr=(e,t,n={})=>(r)=>{let{libraryOptions:o,target:i}=r??{},s=pr({...o??{},target:i,io:t,processors:n});return de(e,s),fr(s,e),mr(s,e)};var fn=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},mn=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},Am=(e,t)=>{fn(e,"minimum",t),mn(e,"maximum",t)},zm=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Dm=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},qm=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},Vm=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Pm=(e,t)=>fn(e,"minimum",t.minimum),Tm=(e,t)=>mn(e,"maximum",t.maximum),$m=(e)=>(t,n)=>{Vm(t,n.format);let[r,o]=e[n.format];fn(t,"minimum",r),mn(t,"maximum",o)},hk={greater_than:(e,t)=>fn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>mn(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>zm(e,t.value),number_format:$m(mo),bigint_format:$m(go),min_length:Pm,max_length:Tm,length_equals:(e,t)=>Am(e,t.length),min_size:Pm,max_size:Tm,size_equals:(e,t)=>Am(e,t.size),string_format:(e,t)=>{if(Vm(e,t.format),t.pattern)Dm(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)=>qm(e,t.mime)};function Ce(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)hk[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)fn(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)fn(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)mn(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)mn(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)zm(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)qm(t,o.mime);for(let i of o.patterns??[])Dm(t,i);return t}var yk={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bk=new Map([[va,Ws],[To,Gs]]),Lm=(e)=>bk.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}=Ce(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=yk[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(Lm);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((h)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}},ec=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Ce(e);o.type=u?"integer":"number";let d=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),h=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(g)o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;else if(typeof i==="number")o.minimum=i;if(h)if(g)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 Ee(e,t,o,r,`A multipleOf divisor of ${N} cannot be represented in JSON Schema`);let[S,...A]=y;if(S!==void 0)o.multipleOf=S;if(A.length)o.allOf=[...o.allOf??[],...A.map((N)=>({multipleOf:N}))]}},tc=(e,t,n,r)=>{n.type="boolean"},nc=(e,t,n,r)=>{Ee(e,t,n,r,"BigInt cannot be represented in JSON Schema")},rc=(e,t,n,r)=>{Ee(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)=>{Ee(e,t,n,r,"Undefined cannot be represented in JSON Schema")},sc=(e,t,n,r)=>{Ee(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)=>{Ee(e,t,n,r,"Date cannot be represented in JSON Schema")},dc=(e,t,n,r)=>{let o=e._zod.def,i=Kn(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(Ee(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(Ee(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)=>{Ee(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}=Ce(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)=>{Ee(e,t,n,r,"Custom types cannot be represented in JSON Schema")},bc=(e,t,n,r)=>{Ee(e,t,n,r,"Function types cannot be represented in JSON Schema")},wc=(e,t,n,r)=>{Ee(e,t,n,r,"Transforms cannot be represented in JSON Schema")},vc=(e,t,n,r)=>{Ee(e,t,n,r,"Map cannot be represented in JSON Schema")},kc=(e,t,n,r)=>{Ee(e,t,n,r,"Set cannot be represented in JSON Schema")},xc=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:a}=Ce(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 gr(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return gr(t.out);if(t.type==="catch")return gr(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&&Ee(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)Re(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"?gr(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,A)=>de(S,t,{...r,path:[...r.path,s,A]})),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"?gr(S)!==void 0:S._zod.optout==="optional"))break;u--}let d=i.items.length,h=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=c,h)o.items=!1;else if(l)o.items=l;if(u>0)o.minItems=u;if(h)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(h)o.maxItems=d}else{if(o.items=c,h)o.additionalItems=!1;else if(l)o.additionalItems=l;if(u>0)o.minItems=u;if(h)o.maxItems=d}let{minimum:g,maximum:y}=Ce(e);if(typeof g==="number")o.minItems=g;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 A=S.map((N)=>Qa(e,N,n));if(A.some((N,L)=>N!==S[L]))t={...t,[y]:A}}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:h,...g}=t;if(g.enum)g.enum=g.enum.map((y)=>typeof y==="number"?String(y):y);else if(typeof g.const==="number")g.const=String(g.const);if(!o)return g;if(g.type="string",!i)g.pattern=(r.includes("number")?Bt:tr).source;return g}var Ya=new WeakMap;function wk(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=Ce(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)Re(o.patternProperties,Lm(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(()=>wk(t));u.push(e)}o.additionalProperties=de(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,l=t.io==="input"&&gr(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 Fm(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 Ee(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=Fm(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=Fm(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{Ee(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},Nm={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:kc,array:xc,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 gn(e,t){if("_idmap"in e){let r=e,o=pr({...t,processors:Nm}),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;fr(o,u),Re(s,l,mr(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=pr({...t,processors:Nm});return de(e,n),fr(n,e),mr(n,e)}var Mm=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 Zm=(e,t)=>{vd.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(Mm.has(n))return;Mm.add(n),ci(n,"format",(r)=>(o)=>xd(r,o)),ci(n,"flatten",(r)=>(o)=>kd(r,o)),ci(n,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Wn,2)}),ci(n,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Wn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},xk=m("ZodError",Zm),Ke=m("ZodError",Zm,void 0,{Parent:Error});var Jm=Yn(Ke),Bm=Xn(Ke),Um=xo(Ke),Km=So(Ke),Wm=Id(Ke),Gm=Cd(Ke),Hm=Ed(Ke),Qm=Od(Ke),Ym=jd(Ke),Xm=_d(Ke),eg=Rd(Ke),tg=Ad(Ke);function Ik(){if(!je.localeError)Ae(ja())}function Kt(){if(!je.memoizer)Ae({memoizer:Vf()})}var K=m("ZodType",(e,t)=>(Ik(),J.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 lt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Bg(e,t))},superRefine(e,t){return this.check(Ug(e,t))},overwrite(e){return this.check(wt(e))},optional(){return li(this)},exactOptional(){return Eg(this)},nullable(){return ui(this)},nullish(){return li(ui(this))},nonoptional(e){return Pg(this,e)},array(){return R(this)},or(e){return Y([this,e])},and(e){return bg(this,e)},transform(e){return Dc(this,al(e))},default(e){return _g(this,e)},prefault(e){return Ag(this,e)},catch(e){return Ng(this,e)},pipe(e){return Dc(this,e)},readonly(){return Vg(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 Qn(this,"~standard",{...wa(this),jsonSchema:{input:dr(this,"input"),output:dr(this,"output")}})},set "~standard"(e){yt(this,"~standard",e)},parse:function e(t,n){return Jm(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Bm(this,t,n,{callee:e})},safeParse(e,t){return Um(this,e,t)},async safeParseAsync(e,t){return Km(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 Wm(this,t,n,{callee:e})},decode:function e(t,n){return Gm(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Hm(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Qm(this,t,n,{callee:e})},safeEncode(e,t){return Ym(this,e,t)},safeDecode(e,t){return Xm(this,e,t)},async safeEncodeAsync(e,t){return eg(this,e,t)},async safeDecodeAsync(e,t){return tg(this,e,t)},toJSONSchema(e){return Rm(this,{})(e)},get description(){return Le.get(this)?.description},get _def(){return this._zod.def}}),qc=m("_ZodString",(e,t)=>{ln.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xa(e,n,r,o)},vo({format:(e)=>Ce(e).format??null,minLength:(e)=>Ce(e).minimum??null,maxLength:(e)=>Ce(e).maximum??null},{regex(...e){return this.check(Uo(...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(Ut(...e))},max(...e){return this.check(cr(...e))},length(...e){return this.check(lr(...e))},nonempty(...e){return this.check(Ut(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)=>{ln.init(e,t),qc.init(e,t)},{email(e){return this.check(_a(Lc,e))},url(e){return this.check(Fo(di,e))},jwt(e){return this.check(Ga(nl,e))},emoji(e){return this.check(Na(Mc,e))},guid(e){return this.check(Ra(Fc,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(Bc,e))},ulid(e){return this.check(Va(Uc,e))},base64(e){return this.check(Ua(Xc,e))},base64url(e){return this.check(Ka(el,e))},xid(e){return this.check(La(Kc,e))},ksuid(e){return this.check(Fa(Wc,e))},ipv4(e){return this.check(Ma(Gc,e))},ipv6(e){return this.check(Za(Hc,e))},cidrv4(e){return this.check(Ja(Qc,e))},cidrv6(e){return this.check(Ba(Yc,e))},e164(e){return this.check(Wa(tl,e))},datetime(e){return this.check(Mo(hn,e))},date(e){return this.check(Zo(yn,e))},time(e){return this.check(Jo(bn,e))},duration(e){return this.check(Bo(wn,e))}});function C(e){return Zf(Vc,e)}var ce=m("ZodStringFormat",(e,t)=>{ae.init(e,t),qc.init(e,t)}),hn=m("ZodISODateTime",(e,t)=>{Ap.init(e,t),ce.init(e,t)}),yn=m("ZodISODate",(e,t)=>{Pp.init(e,t),ce.init(e,t)}),bn=m("ZodISOTime",(e,t)=>{Tp.init(e,t),ce.init(e,t)}),wn=m("ZodISODuration",(e,t)=>{$p.init(e,t),ce.init(e,t)}),Lc=m("ZodEmail",(e,t)=>{vp.init(e,t),ce.init(e,t)});function Ck(e){return _a(Lc,e)}var Fc=m("ZodGUID",(e,t)=>{bp.init(e,t),ce.init(e,t)});function Ek(e){return Ra(Fc,e)}var vt=m("ZodUUID",(e,t)=>{wp.init(e,t),ce.init(e,t)});function Ok(e){return Aa(vt,e)}function jk(e){return Pa(vt,e)}function _k(e){return Ta(vt,e)}function Rk(e){return $a(vt,e)}var di=m("ZodURL",(e,t)=>{Sp.init(e,t),ce.init(e,t)});function Ak(e){return Fo(di,e)}function Pk(e){return Fo(di,{protocol:er,hostname:Qs,...j(e)})}var Mc=m("ZodEmoji",(e,t)=>{Ip.init(e,t),ce.init(e,t)});function Tk(e){return Na(Mc,e)}var Zc=m("ZodNanoID",(e,t)=>{Cp.init(e,t),ce.init(e,t)});function $k(e){return za(Zc,e)}var Jc=m("ZodCUID",(e,t)=>{Ep.init(e,t),ce.init(e,t)});function Nk(e){return Da(Jc,e)}var Bc=m("ZodCUID2",(e,t)=>{Op.init(e,t),ce.init(e,t)});function zk(e){return qa(Bc,e)}var Uc=m("ZodULID",(e,t)=>{jp.init(e,t),ce.init(e,t)});function Dk(e){return Va(Uc,e)}var Kc=m("ZodXID",(e,t)=>{_p.init(e,t),ce.init(e,t)});function qk(e){return La(Kc,e)}var Wc=m("ZodKSUID",(e,t)=>{Rp.init(e,t),ce.init(e,t)});function Vk(e){return Fa(Wc,e)}var Gc=m("ZodIPv4",(e,t)=>{Np.init(e,t),ce.init(e,t)});function Lk(e){return Ma(Gc,e)}var ng=m("ZodMAC",(e,t)=>{qp.init(e,t),ce.init(e,t)});function Fk(e){return Jf(ng,e)}var Hc=m("ZodIPv6",(e,t)=>{Dp.init(e,t),ce.init(e,t)});function Mk(e){return Za(Hc,e)}var Qc=m("ZodCIDRv4",(e,t)=>{Vp.init(e,t),ce.init(e,t)});function Zk(e){return Ja(Qc,e)}var Yc=m("ZodCIDRv6",(e,t)=>{Lp.init(e,t),ce.init(e,t)});function Jk(e){return Ba(Yc,e)}var Xc=m("ZodBase64",(e,t)=>{Mp.init(e,t),ce.init(e,t)});function Bk(e){return Ua(Xc,e)}var el=m("ZodBase64URL",(e,t)=>{Zp.init(e,t),ce.init(e,t)});function Uk(e){return Ka(el,e)}var tl=m("ZodE164",(e,t)=>{Jp.init(e,t),ce.init(e,t)});function Kk(e){return Wa(tl,e)}var rg=m("ZodCreditCard",(e,t)=>{Bp.init(e,t),ce.init(e,t)});function Wk(e){return Bf(rg,e)}var og=m("ZodIBAN",(e,t)=>{Up.init(e,t),ce.init(e,t)});function Gk(e){return Uf(og,e)}var nl=m("ZodJWT",(e,t)=>{Kp.init(e,t),ce.init(e,t)});function Hk(e){return Ga(nl,e)}var vn=m("ZodCustomStringFormat",(e,t)=>{Wp.init(e,t),ce.init(e,t)});function Qk(e,t,n={}){return pn(vn,e,t,n)}function Yk(e){return pn(vn,"hostname",Hs,e)}function Xk(e){return pn(vn,"hex",da,e)}function ex(e){return pn(vn,"currency_code",Xs,e)}function tx(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,o=Ot[r];if(!o)throw Error(`Unrecognized hash format: ${r}`);return pn(vn,r,o,t)}var rl=m("ZodNumber",(e,t)=>{ka.init(e,t),K.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}=Ce(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=Ce(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=Ce(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>Ce(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(un(e,t))},step(e,t){return this.check(un(e,t))},finite(){return this}}));function B(e){return Kf(rl,e)}var kn=m("ZodNumberFormat",(e,t)=>{Gp.init(e,t),rl.init(e,t)});function xe(e){return Wf(kn,e)}function nx(e){return Gf(kn,e)}function rx(e){return Hf(kn,e)}function ox(e){return Qf(kn,e)}function ix(e){return Yf(kn,e)}var ol=m("ZodBoolean",(e,t)=>{$o.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tc(e,n,r,o)});function he(e){return Xf(ol,e)}var il=m("ZodBigInt",(e,t)=>{xa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nc(e,n,r,o)},vo({minValue:(e)=>Ce(e).minimum??null,maxValue:(e)=>Ce(e).maximum??null,format:(e)=>Ce(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(un(e,t))}}));function sx(e){return em(il,e)}var sl=m("ZodBigIntFormat",(e,t)=>{Hp.init(e,t),il.init(e,t)});function ax(e){return tm(sl,e)}function cx(e){return nm(sl,e)}var ig=m("ZodSymbol",(e,t)=>{Qp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rc(e,n,r,o)});function lx(e){return rm(ig,e)}var sg=m("ZodUndefined",(e,t)=>{Yp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ic(e,n,r,o)});function ux(e){return om(sg,e)}var ag=m("ZodNull",(e,t)=>{Xp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oc(e,n,r,o)});function cg(e){return im(ag,e)}var lg=m("ZodAny",(e,t)=>{ef.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cc(e,n,r,o)});function dx(){return sm(lg)}var ug=m("ZodUnknown",(e,t)=>{tf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lc(e,n,r,o)});function rt(){return am(ug)}var dg=m("ZodNever",(e,t)=>{nf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ac(e,n,r,o)});function ot(e){return cm(dg,e)}var pg=m("ZodVoid",(e,t)=>{rf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sc(e,n,r,o)});function px(e){return lm(pg,e)}var fg=m("ZodDate",(e,t)=>{of.init(e,t),K.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}=Ce(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=Ce(e);return t?new Date(t):null}},{}));function fx(e){return um(fg,e)}var mg=m("ZodArray",(e,t)=>{Kt(),sf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xc(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Ut(e,t))},nonempty(e){return this.check(Ut(1,e))},max(e,t){return this.check(cr(e,t))},length(e,t){return this.check(lr(e,t))},unwrap(){return this.element}});function R(e,t){return ym(mg,e,t)}function mx(e){let t=e._zod.def.shape;return Z(Object.keys(t))}var pi=m("ZodObject",(e,t)=>{Kt(),lf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sc(e,n,r,o),iv(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return Z(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:rt()}))},loose(){return this.clone(Je(this._zod.def,{catchall:rt()}))},strict(){return this.clone(Je(this._zod.def,{catchall:ot()}))},strip(){return this.clone(Je(this._zod.def,{catchall:void 0}))},extend(e){return Qw(this,e)},safeExtend(e){return Yw(this,e)},merge(e){return Xw(this,e)},pick(e){return Gw(this,e)},omit(e){return Hw(this,e)},partial(...e){return dd(mi,this,e[0])},exactPartial(...e){return dd(cl,this,e[0],"exactPartial")},required(...e){return ev(ll,this,e[0])}});function O(e,t){let n={type:"object",shape:e??{},...j(t)};return new pi(n)}function v(e,t){return new pi({type:"object",shape:e,catchall:ot(),...j(t)})}function gx(e,t){return new pi({type:"object",shape:e,catchall:rt(),...j(t)})}var fi=m("ZodUnion",(e,t)=>{No.init(e,t),K.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,...j(t)})}var gg=m("ZodXor",(e,t)=>{fi.init(e,t),uf.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ii(e,n,r,o),e.options=t.options});function hx(e,t){return new gg({type:"union",options:e,inclusive:!1,...j(t)})}var hg=m("ZodDiscriminatedUnion",(e,t)=>{fi.init(e,t),df.init(e,t)});function it(e,t,n){return new hg({type:"union",options:t,discriminator:e,...j(n)})}var yg=m("ZodIntersection",(e,t)=>{pf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ic(e,n,r,o)});function bg(e,t){return new yg({type:"intersection",left:e,right:t})}var wg=m("ZodTuple",(e,t)=>{Kt(),Sa.init(e,t),K.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 vg(e,t,n){let r=t instanceof J,o=r?n:t;return new wg({type:"tuple",items:e,rest:r?t:null,...j(o)})}var yr=m("ZodRecord",(e,t)=>{Kt(),ff.init(e,t),K.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 yr({type:"record",keyType:C(),valueType:e,...j(t)});return new yr({type:"record",keyType:e,valueType:t,...j(n)})}function yx(e,t,n){return new yr({type:"record",keyType:e,valueType:t,...j(n),partial:!0})}function bx(e,t,n){return new yr({type:"record",keyType:e,valueType:t,mode:"loose",...j(n)})}var kg=m("ZodMap",(e,t)=>{Kt(),mf.init(e,t),K.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(dn(...n)),e.size=(...n)=>e.check(ar(...n))});function wx(e,t,n){return new kg({type:"map",keyType:e,valueType:t,...j(n)})}var xg=m("ZodSet",(e,t)=>{Kt(),gf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kc(e,n,r,o),e.min=(...n)=>e.check(Rt(...n)),e.nonempty=(n)=>e.check(Rt(1,n)),e.max=(...n)=>e.check(dn(...n)),e.size=(...n)=>e.check(ar(...n))});function vx(e,t){return new xg({type:"set",valueType:e,...j(t)})}var br=m("ZodEnum",(e,t)=>{hf.init(e,t),K.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 br({...t,checks:[],...j(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 br({...t,checks:[],...j(o),entries:i})}});function Z(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new br({type:"enum",entries:n,...j(t)})}function kx(e,t){return new br({type:"enum",entries:e,...j(t)})}var Sg=m("ZodLiteral",(e,t)=>{yf.init(e,t),K.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 b(e,t){return new Sg({type:"literal",values:Array.isArray(e)?e:[e],...j(t)})}var Ig=m("ZodFile",(e,t)=>{bf.init(e,t),K.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(dn(n,r)),e.mime=(n,r)=>e.check(Xo(Array.isArray(n)?n:[n],r))});function xx(e){return bm(Ig,e)}var Cg=m("ZodTransform",(e,t)=>{Kt(),wf.init(e,t),K.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 cn(e.constructor.name);n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(Zt(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(Zt(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 Cg({type:"transform",transform:e})}var mi=m("ZodOptional",(e,t)=>{Ia.init(e,t),K.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)=>{vf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>si(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Eg(e){return new cl({type:"optional",innerType:e})}var Og=m("ZodNullable",(e,t)=>{kf.init(e,t),K.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 Og({type:"nullable",innerType:e})}function Sx(e){return li(ui(e))}var jg=m("ZodDefault",(e,t)=>{xf.init(e,t),K.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 _g(e,t){return new jg({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():vs(t)}})}var Rg=m("ZodPrefault",(e,t)=>{Sf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ac(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ag(e,t){return new Rg({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():vs(t)}})}var ll=m("ZodNonOptional",(e,t)=>{If.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Pg(e,t){return new ll({type:"nonoptional",innerType:e,...j(t)})}var Tg=m("ZodSuccess",(e,t)=>{Cf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ix(e){return new Tg({type:"success",innerType:e})}var $g=m("ZodCatch",(e,t)=>{Ef.init(e,t),K.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 Ng(e,t){return new $g({type:"catch",innerType:e,catchValue:typeof t==="function"?t:gd(t)})}var zg=m("ZodNaN",(e,t)=>{Of.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fc(e,n,r,o)});function Cx(e){return dm(zg,e)}var gi=m("ZodPipe",(e,t)=>{Ca.init(e,t),K.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 Ex(e,t,n){return new hi({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function Ox(e){let t=e._zod.def;return new hi({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Dg=m("ZodPreprocess",(e,t)=>{gi.init(e,t),jf.init(e,t)}),qg=m("ZodReadonly",(e,t)=>{_f.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Vg(e){return new qg({type:"readonly",innerType:e})}var Lg=m("ZodTemplateLiteral",(e,t)=>{Rf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mc(e,n,r,o)});function jx(e,t){return new Lg({type:"template_literal",parts:e,...j(t)})}var Fg=m("ZodLazy",(e,t)=>{Tf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zc(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function Mg(e){return new Fg({type:"lazy",getter:e})}var Zg=m("ZodPromise",(e,t)=>{Pf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function _x(e){return new Zg({type:"promise",innerType:e})}var Jg=m("ZodFunction",(e,t)=>{Af.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bc(e,n,r,o)});function Rx(e){return new Jg({type:"function",input:Array.isArray(e?.input)?vg(e?.input):e?.input??R(rt()),output:e?.output??rt()})}var yi=m("ZodCustom",(e,t)=>{$f.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yc(e,n,r,o)});function Ax(e){let t=new ue({check:"custom"});return t._zod.check=e,t}function Px(e,t){return wm(yi,e??(()=>!0),t)}function Bg(e,t={}){return vm(yi,e,t)}function Ug(e,t){return km(e,t)}var Tx=xm,$x=Sm,Kg=m("ZodInstanceOf",(e,t)=>{yi.init(e,t)},{properties(e,t){return this.check(Yo(e,t))}});function Nx(e,t={}){let n=new Kg({type:"custom",check:"custom",fn:(r)=>r instanceof e,abort:!0,...j(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 zx=(...e)=>Im({Codec:hi,Boolean:ol,String:Vc},...e);function Pe(e){let t=Mg(()=>Y([C(e),B(),he(),cg(),R(t),oe(C(),t)]));return t}function Wg(e,t){return new Dg({type:"pipe",in:al(e),out:t})}function Dx(e){return Mo(hn,e)}function qx(e){return Zo(yn,e)}function Vx(e){return Jo(bn,e)}function Lx(e){return Bo(wn,e)}var T={...ul,...ai,iso:wr},Fx=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 Mx(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 Gg(e,t){return e.map((n,r)=>r<t?n:n.optional())}function Zx(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Jx(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:Zx(n[1]);if(!o||!t.defs[o])throw Error(`Reference not found: ${e}`);return t.defs[o]}throw Error(`Reference not found: ${e}`)}function Bx(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 Ux=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Kx=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function vr(e){if(typeof e!=="object"||e===null)return!1;if(Array.isArray(e))return e.some(vr);if(typeof e.$ref==="string")return!0;return Object.entries(e).some(([t,n])=>{if(Ux.has(t))return vr(n);if(!Kx.has(t)||typeof n!=="object"||n===null)return!1;return Object.values(n).some(vr)})}function Hg(e){return e===1?"element":"elements"}function Wx(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 ${Hg(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 ${Hg(t.maxContains)}`,input:o,continue:!0})}}).pipe(e)}function Qg(e,t){if(e===!1)return;if(e===void 0||e===!0)return T.any();return Ne(e,t)}var Gx=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Yg(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=Jx(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 Yg(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(Gx));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,h]of Object.entries(i)){let g=Ne(h,t);Re(o,d,s.has(d)?g:g.optional())}if(e.patternProperties){let d=e.patternProperties,h=Object.keys(d),g=[];for(let S of h){let A=Ne(d[S],t),N=T.string().regex(new RegExp(S));g.push(T.looseRecord(N,A))}let y=[];if(Object.keys(o).length>0)y.push(T.object(o).passthrough());if(y.push(...g),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 A=2;A<y.length;A++)S=T.intersection(S,y[A]);r=S}if(e.additionalProperties===!1){let S=Object.keys(o),A=h.map((L)=>new RegExp(L)),N=r;r=r.check((L)=>{if(!bt(L.value))return;let D=[];for(let fe of Object.keys(L.value)){if(S.includes(fe))continue;if(A.some((ge)=>ge.test(fe)))continue;D.push(fe)}if(D.length)L.issues.push({code:"unrecognized_keys",keys:D,input:L.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 h=typeof e.propertyNames==="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Ne(h,t)}r=Bx(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=Gg(a,s),l=!Array.isArray(i)?Qg(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=Gg(a,s),l=Qg(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=Wx(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=Yg(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&&!vr(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&&!vr(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(!Fx.has(a))Re(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 Xg(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=Mx(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 eh=Object.prototype.hasOwnProperty;function Ie(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--&&Ie(e[r],t[r]));return r===-1}if(!n||typeof e==="object"){r=0;for(n in e){if(eh.call(e,n)&&++r&&!eh.call(t,n))return!1;if(!(n in t)||!Ie(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!==e&&t!==t}var pl={maxKeys:16,maxBytes:1048576},fl=C().min(1).refine((e)=>new TextEncoder().encode(e).length<=256),Hx=v({scope:Z(["draft","live"]),values:b(!1).optional()}),UO=Hx.omit({values:!0}),th=v({scope:Z(["draft","live"]),keys:R(fl).min(1).max(pl.maxKeys).refine((e)=>new Set(e).size===e.length,"State keys must be distinct.")}),KO=v({scope:Z(["draft","live"]),key:fl.optional()}),WO=v({scope:Z(["draft","live"]),space:C().regex(/^(flow|node:.+)$/)}),GO=v({scope:Z(["draft","live"])}),bi=v({fields:R(C().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([])}),nh=bi.extend({kind:b("skip-duplicates")});var ml=O({version:b(1),scope:Z(["draft","live"]),limits:O({maxValueBytes:B().positive(),maxValues:B().int().positive(),maxSpaces:B().int().positive(),maxIdentities:B().positive(),maxRunWrites:B().positive()}),values:R(v({key:C(),size:B().nonnegative(),updatedAt:B()})),spaces:R(O({space:C(),count:B().nonnegative(),pendingCount:B().nonnegative(),reservedCount:B().nonnegative(),updatedAt:B()}))}),rh=ml.extend({values:v({count:B().int().nonnegative(),updatedAt:B().nullable()})}),oh=O({version:b(1),scope:Z(["draft","live"]),values:R(v({key:fl,value:Pe()})).min(1).max(pl.maxKeys)}).refine((e)=>{let t=new TextEncoder;return e.values.reduce((n,r)=>n+(r.value===null?0:t.encode(JSON.stringify(r.value)).byteLength),0)<=pl.maxBytes},"State values exceed the 1 MiB read limit.");var ih=0;function At(){let e=ih;return ih+=1,e}function Sn(e){if(typeof e==="object"&&e!==null&&!Object.isFrozen(e)){for(let t of Object.getOwnPropertyNames(e)){let n=Reflect.get(e,t);Sn(n)}Object.freeze(e)}return e}function gl(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 xn(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(!xn(r,t[n]))return!1}else{if(Array.isArray(t))return!1;for(let n in e){if(!(n in t))return!1;if(!xn(e[n],t[n]))return!1}for(let n in t)if(!(n in e))return!1}return!0}var w=Object.freeze({Equals:0,Containing:1,ContainedBy:2,Rejection:3,Intersection:4}),H=Pt(w.Equals),U=Pt(w.Containing),W=Pt(w.ContainedBy),Q=Pt(w.Rejection),ne=Pt(w.Intersection),kt=Sn([[w.Equals,H],[w.Containing,U],[w.ContainedBy,W],[w.Rejection,Q],[w.Intersection,ne]]),pe=0,We=(()=>{let e=pe;for(let[t,n]of kt)e|=n;return e})();function kr(e){return!!(e&H)}function xr(e){return!!(e&U)}function Sr(e){return!!(e&W)}function Ir(e){return!!(e&Q)}function Cr(e){return!!(e&ne)}function Pt(e){return 1<<e}function hl(e){let t=pe,n=0,r={push:(o)=>{if(n===0)t=o;else t=Qx(t,o,e);return n+=1,t}};return Object.defineProperties(r,{result:{get:()=>t},count:{get:()=>n}}),r}function Qx(e,t,n){let r=pe;for(let[o,i]of kt)if(i&e){for(let[s,a]of kt)if(a&t){if(r|=n(o,s),r===We)return r}}return r}var ye=Object.freeze({Save:0,OneOf:1,AllOf:2,AnyOf:3,Not:4,Swap:5});function sh(e,t){switch(e){case ye.Save:return t[0];case ye.OneOf:return Yx(t);case ye.AllOf:case ye.AnyOf:return Er(e,t);case ye.Not:case ye.Swap:return yl(e,t[0])}}function Tt(e){return yl(ye.Swap,e)}function Yx(e){if(e.length===1)return e[0];let t=Er(ye.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=Er(ye.AllOf,[a,c]);n.push(l)}let r=Er(ye.AnyOf,n),o=yl(ye.Not,r);return Er(ye.AllOf,[t,o])}function Er(e,t){if(t.length<0)throw Error("invalid expressions: empty array");let n;switch(e){case ye.AllOf:{n=hl(Xx);break}case ye.AnyOf:{n=hl(eS);break}default:throw Error(`invalid operator ${e}`)}for(let r of t)n.push(r);return n.result}function yl(e,t){let n,r=pe;switch(e){case ye.Not:{n=tS;break}case ye.Swap:{n=nS;break}default:throw Error(`invalid operator ${e}`)}for(let[o,i]of kt)if(i&t)r|=n(o);return r}function Xx(e,t){let n=pe;switch(e){case w.Equals:{switch(t){case w.Equals:{n=H;break}case w.Containing:{n=H;break}case w.ContainedBy:{n=W;break}case w.Rejection:{n=pe;break}case w.Intersection:{n=W;break}}break}case w.Containing:{switch(t){case w.Equals:{n=H;break}case w.Containing:{n=H|U;break}case w.ContainedBy:{n=W;break}case w.Rejection:{n=Q;break}case w.Intersection:{n=ne|W;break}}break}case w.ContainedBy:{switch(t){case w.Equals:{n=W;break}case w.Containing:{n=W;break}case w.ContainedBy:{n=W;break}case w.Rejection:{n=pe;break}case w.Intersection:{n=W;break}}break}case w.Rejection:{switch(t){case w.Equals:{n=pe;break}case w.Containing:{n=Q;break}case w.ContainedBy:{n=pe;break}case w.Rejection:{n=Q;break}case w.Intersection:{n=Q;break}}break}case w.Intersection:{switch(t){case w.Equals:{n=W;break}case w.Containing:{n=ne|W;break}case w.ContainedBy:{n=W;break}case w.Rejection:{n=Q;break}case w.Intersection:{n=W|Q|ne;break}}break}}return n}function eS(e,t){let n=pe;switch(e){case w.Equals:{switch(t){case w.Equals:{n=H;break}case w.Containing:{n=U;break}case w.ContainedBy:{n=H;break}case w.Rejection:{n=U;break}case w.Intersection:{n=U;break}}break}case w.Containing:{switch(t){case w.Equals:{n=U;break}case w.Containing:{n=U;break}case w.ContainedBy:{n=U;break}case w.Rejection:{n=U;break}case w.Intersection:{n=U;break}}break}case w.ContainedBy:{switch(t){case w.Equals:{n=H;break}case w.Containing:{n=U;break}case w.ContainedBy:{n=H|W;break}case w.Rejection:{n=ne;break}case w.Intersection:{n=U|ne;break}}break}case w.Rejection:{switch(t){case w.Equals:{n=U;break}case w.Containing:{n=U;break}case w.ContainedBy:{n=ne;break}case w.Rejection:{n=Q;break}case w.Intersection:{n=ne;break}}break}case w.Intersection:{switch(t){case w.Equals:{n=U;break}case w.Containing:{n=U;break}case w.ContainedBy:{n=U|ne;break}case w.Rejection:{n=ne;break}case w.Intersection:{n=U|ne;break}}break}}return n}function tS(e){let t=pe;switch(e){case w.Equals:{t=Q;break}case w.Containing:{t=Q;break}case w.ContainedBy:{t=ne;break}case w.Rejection:{t=H|U;break}case w.Intersection:{t=W|ne;break}}return t}function nS(e){let t=pe;switch(e){case w.Equals:{t=H;break}case w.Containing:{t=W;break}case w.ContainedBy:{t=U;break}case w.Rejection:{t=Q;break}case w.Intersection:{t=ne;break}}return t}var Fe=Object.freeze({Leaf:0,Not:1,AllOf:2,AnyOf:3,OneOf:4});var bl=(e)=>(t,n)=>{let r={parent:null,swapped:!1,expressions:null,calculation:{operator:ye.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=H,[h,g]=u.expressions;if(!e.equals(h,g)){let y=e.describe(h);if(y.kind!==Fe.Leaf){let[N,L]=a(y,!1);u.expressions=null,u.calculation=N;for(let[D,fe]of L.entries())o.push({parent:{node:u,index:D},swapped:u.swapped,expressions:[fe,g],calculation:null});return}let S=e.describe(g);if(S.kind!==Fe.Leaf){let[N,L]=a(S,!0);u.expressions=null,u.calculation=N;for(let[D,fe]of L.entries())o.push({parent:{node:u,index:D},swapped:!u.swapped,expressions:[fe,h],calculation:null});return}if(d=e.calculate(h,g),e.observeCalculation?.(h,g,d,u.swapped),d===pe)throw Error("cannot response expression as none")}u.expressions=null,u.calculation={operator:ye.Save,results:[d],willSwap:!1,count:0},i.push(u)}function a(u,d){let h=ye.Save,g;switch(u.kind){case Fe.Not:{h=ye.Not,g=[u.expression];break}case Fe.AllOf:{h=ye.AllOf,g=[...u.expressions];break}case Fe.AnyOf:{h=ye.AnyOf,g=[...u.expressions];break}case Fe.OneOf:{h=ye.OneOf,g=[...u.expressions];break}default:throw Error(`invalid kind ${u.kind}`)}return[{operator:h,willSwap:d,count:0,results:Array(g.length).fill(-1)},g]}function c(u){let{calculation:d,parent:h}=u,g=sh(d.operator,d.results);if(g===pe)g=W;if(d.willSwap)g=Tt(g);if(h){let y=h.node.calculation,S=y.results;if(S[h.index]=g,y.count+=1,y.count>=S.length)i.push(h.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(rS(e));this.name="SchemaError",this.items=e}}var In=Object.freeze({Compiled:0,External:1});function Cn(e){switch(e.kind){case In.Compiled:{let{message:t,path:n}=e;return`${t} (at ${n.length>0?n.join("."):"$root"})`}case In.External:return String(e.error)}}function rS(e){switch(e.length){case 0:return"without any items";case 1:return Cn(e[0]);default:return`${Cn(e[0])} ... omit the rest ${e.length-1} items`}}var oS=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 oS.has(e)}function ah(e){for(let t in e)if(dt(t))return!1;return!0}function ze(e,...t){return{...e,path:[...e.path,...t]}}function Me(e){if(typeof e==="boolean")throw Error("JSONSchema7Definition cannot be boolean");return e}function $t({path:e,errors:t},n,...r){t.push(ch(e,r,n))}function re({path:e,warns:t},n,...r){t.push(ch(e,r,n))}function ch(e,t,n){return{kind:In.Compiled,message:n,path:[...e,...t]}}function ki(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(iS(n))delete e[t]}}return e}function iS(e){for(let t in e)return!1;return!0}var Or=Symbol("compiledId"),wl=Symbol("compiledKind"),vl=Symbol("compiledPath"),lh=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=Sn(xi(I.Any,At(),{},()=>()=>!0)),jr=Sn(xi(I.Never,At(),{type:"string",maxLength:0,minLength:1},()=>()=>!1));function _r(e){if(e===null||typeof e!=="object")return!1;return Or in e}function Ze(e){if(e===null||typeof e!=="object")return!1;return Or in e&&wl in e}function ee(e){if(Ze(e))return e[wl];else return I.Extends}function Wt(e){if(Ze(e)||_r(e))return e[Or];else return e.id}function kl(e){return Ze(e)?e[vl]:void 0}function xl(e){if(e===null||typeof e!=="object")return e;return Object.defineProperty(e,Or,{value:At(),configurable:!1,writable:!1,enumerable:!1}),e}function we(e,t,n,r=[]){return xi(e,At(),t,n&&(()=>n.compile(t)),r)}function Rr(e){return xi(I.Never,At(),{...e},e[lh],e[vl])}function xi(e,t,n,r,o=[]){let i=null;return Object.defineProperties(n,{[wl]:{value:e,configurable:!1,writable:!1,enumerable:!1},[Or]:{value:t,configurable:!1,writable:!1,enumerable:!1},[vl]:{value:o,configurable:!1,writable:!1,enumerable:!1},[lh]:{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 ph(e,t){let n=sS(e,t),r=uh(e,"maxItems",t),o=uh(e,"minItems",t),i=aS(e,t),s=t.uniqueItems,a;if(Array.isArray(n))a=cS(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=dh(a,e.delegate);let h=n.findIndex((g)=>ee(g)===I.Never);if(h!==-1){if(n=n.splice(h),a=dh(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&&ee(a)===I.Never)c=!0}else if(ee(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=ki({type:"array",items:n,contains:i,uniqueItems:s,maxItems:r,minItems:o,additionalItems:a});return we(u,d,e.delegate,e.path)}function sS(e,{items:t}){if(!t)return we(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,Me(i));if(!a){r=!0;continue}n.push(a)}if(r)return null;return n}else{let n=ze(e,"items"),r=Me(t);return De(n,r)}}function uh(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 aS(e,{contains:t}){if(!t)return we(I.Any,{},e.delegate,e.path);let n=ze(e,"contains"),r=Me(t);return De(n,r)}function cS(e,{additionalItems:t}){switch(typeof t){case"boolean":if(t)return we(I.Any,{},e.delegate,e.path);else return!1;case"object":{let n=ze(e,"additionalItems");return De(n,t)}default:return we(I.Any,{},e.delegate,e.path)}}function dh(e,t){if(e===void 0)return we(I.Never,{type:"string",maxLength:0,minLength:1},t);else if(Ze(e))return ee(e)===I.Never?e:Rr(e);else return e}var fh=Object.freeze(["allOf","anyOf","oneOf"]);function Sl(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=Me(l),h=De(u,d);if(h)o.push(h)}if(o.length<n.length)return null;let i=0,s=0;for(let c of o)switch(ee(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(!lS(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 we(a,{[t]:o},r,e.path)}function lS(e){let t=null;for(let n of e){let r=ee(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 Te=Object.freeze({Valid:0,Invalid:1,Unknown:2});function pt(e,t){let n=e.isValid;if(n)if(n(t)===!0)return Te.Valid;else return Te.Invalid;else return Te.Unknown}function mh(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 Te.Valid:{o.push(xl(l));break}case Te.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)===Te.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(xn(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=xl(wi(n));return we(s,a,e.delegate,e.path)}var uS=new Set(["type","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames"]);function hh(e,t){let n=Object.keys(t).filter((y)=>!uS.has(y)&&dt(y));if(n.length>0)re(e,`type="object" will exclude other keys: ${n.toSorted().join(", ")}`);let r=gh(e,"maxProperties",t),o=gh(e,"minProperties",t),i=dS(e,t),s=pS(e,t),a=fS(e,t),c=gS(e,t);if(!i||!s||!a||!c)return null;let l=mS(e,s,a,t);if(!l)return null;let u=hS(i,s,a,l),d=yS(e,u,c,t),h=bS(e,i,l,d,r,o)?I.Never:I.Object,g=ki({type:"object",required:d,properties:l,minProperties:o,maxProperties:r,additionalProperties:i,patternProperties:kS(s),dependencies:xS(c,t),propertyNames:a});return we(h,g,e.delegate,e.path)}function gh(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 dS(e,{additionalProperties:t}){if(t===!1)return we(I.Never,{type:"string",maxLength:0,minLength:1},e.delegate,e.path);if(typeof t!=="object")return we(I.Any,{},e.delegate,e.path);let n=ze(e,"additionalProperties"),r=Me(t);return De(n,r)}function pS(e,{patternProperties:t}){let n=!1,r={};for(let o in t){let i=vS(o);if(i instanceof Error){re(e,`property name invalid. ${o}`,"patternProperties",o);continue}let s=Me(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 fS(e,{propertyNames:t}){if(!t)return we(I.Any,{},e.delegate,e.path);t=Me(t);let n=ze(e,"propertyNames"),r=De(n,t);if(!r)return null;let o=ee(r);if(o!==I.String&&o!==I.Any)return Rr(r);return r}function mS(e,t,n,{properties:r}){let o=!1;if(!r)return{};let i={};for(let s in r){if(pt(n,s)===Te.Invalid){re(e,`key ${JSON.stringify(s)} cannot pass JSON schema from propertyNames`,"properties");continue}let a=bh(t,s);if(a&&ee(a)===I.Never){re(e,`key ${JSON.stringify(s)} matches a pattern that has a impossible(never) schema`,"properties");continue}let c=Me(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 gS(e,{dependencies:t}){if(!t)return[{},{}];let n={},r={};for(let o in t){let i=Me(t[o]);if(Array.isArray(i)){let{keys:s,duplicated:a}=yh(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=ee(a);if(c===I.Object||c===I.Any)r[o]=a;else if(c===I.Extends)r[o]=jr;else r[o]=Rr(a)}}}return[n,r]}function hS(e,t,n,r){return(o)=>{if(pt(n,o)===Te.Invalid)return!0;let i=bh(t,o);if(i&&ee(i)===I.Never)return!0;let s=r[o]??e;if(ee(s)===I.Never)return!0;return!1}}function yS(e,t,n,{required:r}){if(!r)return[];let o=yh(r);if(o.duplicated)re(e,`found duplicated required keys: ${o.duplicated.join(", ")}`,"required");let i=[],s=[];for(let a of o.keys)if(wS(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 bS(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(ee(t)!==I.Never)return!1;for(let s in n){let a=n[s];if(ee(a)!==I.Never)return!1}return!0}function wS([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(ee(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 yh(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 bh(e,t){for(let n in e){let[r,o]=e[n];if(o.test(t))return r}return null}function vS(e){try{return new RegExp(e,"i")}catch(t){if(t instanceof SyntaxError)return t;else throw t}}function kS(e){let t={};for(let n in e)t[n]=e[n][0];return t}function xS([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 Il=new Set(["type","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum"]),wh=new Set(["type","format","maxLength","minLength","pattern"]);function kh(e,t){let{type:n}=t;switch(n){case"number":case"integer":return SS(e,t);case"string":return CS(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 we(o,{type:n},e.delegate,e.path)}default:return $t(e,`invalid type ${JSON.stringify(n)}`),null}}function SS(e,t){let n=Object.keys(t).filter((u)=>!Il.has(u)&&dt(u));if(n.length>0)re(e,`type=${JSON.stringify(t.type)} will exclude other keys: ${n.toSorted().join(", ")}`);let r=gl(t,Il);for(let u of Il){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(!IS(r))l=I.Never;return we(l,r,e.delegate,e.path)}function IS(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 CS(e,t){let n=Object.keys(t).filter((a)=>!wh.has(a)&&dt(a));if(n.length>0)re(e,`type="string" will exclude other keys: ${n.toSorted().join(", ")}`);let r=gl(t,wh);vh(e,r,"maxLength"),vh(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 we(s,r,e.delegate,e.path)}function vh(e,t,n){let r=t[n];if(r!==void 0){if(Number.isNaN(r))re(e,"found NaN",n),delete t[n]}}var xh=Object.freeze([]);function Si(e,t,n,r){if(Ze(e))return{schema:e,warns:xh};if(t.isExtendsSchema(e))return{schema:e,warns:xh};if(r){let s=r.isSchema(e);if(typeof s==="object"){let a=[];for(let c of s)a.push({kind:In.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)Sh(o.errors.length===0,"found errors (it should be empty)");else return Sh(o.errors.length>0,"cannot found any errors"),o.errors;return{schema:i,warns:o.warns}}function Sh(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=ES(e,r);if(a&&o)a=mh(e,i,s,a);if(!a)return null;return a}function ES(e,t){for(let n of fh){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=Sl(e,n,r);if(!i)return null;return i}}{let n=Me(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(ee(i)){case I.Never:{s=I.Any;break}case I.Any:{s=I.Never;break}}return we(s,{not:i},e.delegate,e.path)}}if(t.type){let{type:n}=t;if(Array.isArray(n)){let{type:r,...o}=t;return Sl(e,"anyOf",n.map((i)=>({...o,type:i})))}switch(n){case"object":return hh(e,t);case"array":return ph(e,t);default:return kh(e,t)}}if(ah(t))return we(I.Any,{},e.delegate,e.path);return $t(e,"unrecognized"),null}class Cl{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 Ih{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 Ih{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 Ch(e)}class Ch{constructor(e){this.description=new Cl(e)}get keys(){return this.description.keys}variable(e){let t;if(e)t=this.description.toBundle(e).toInt32();return new Eh(this.description,t)}}class Eh{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 kt)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 OS(e,t);else if(n.num>r.num)return jS(e,t);else return _S(e,t)}function OS(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 jS(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 _S(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 h=r.exclusive,g=i.exclusive;u=h!==g,d=!h&&g}if(!d){let h;if(u)h={fromLeft:!1,range:[He(r),i]};return{left:c,center:[l,r],right:h}}}return{left:c,center:[l,i],right:{fromLeft:!0,range:[He(i),r]}}}function He(e){return{num:e.num,exclusive:!e.exclusive}}var En=(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 On({left:e,right:t,intersection:n}){if(!n)return w.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 w.Intersection;if(r)return w.Containing;if(o)return w.ContainedBy;return w.Equals}var RS=En(0),AS=Ii(["hasCommon","hasExtra1","hasExtra2","hasRejection","hasCommonBroken"]);function jh({calculate:e},t,n){let r=RS(t.minItems,t.maxItems,n.minItems,n.maxItems),o=On(r);if(o===w.Rejection)return Q;let[i,s]=Oh(t),[a,c]=Oh(n),l=Math.max(i.length,a.length)+1,u=Math.min(l,r.intersection.max),d=AS.variable({}),h=Math.min(t.minItems??0,n.minItems??0);for(let y=0;y<u;y++){let S=i[y]??s,A=a[y]??c,N=e(S,A);d.push(N,(L,D)=>{switch(L){case w.Equals:{if(!D.hasRejection)D.hasCommon=!0;break}case w.Containing:{if(!D.hasRejection)D.hasCommon=!0;D.hasExtra1=!0;break}case w.ContainedBy:{if(!D.hasRejection)D.hasCommon=!0;D.hasExtra2=!0;break}case w.Intersection:{if(!D.hasRejection)D.hasCommon=!0;D.hasExtra1=!0,D.hasExtra2=!0;break}case w.Rejection:{if(y<h)D.hasCommonBroken=!0;D.hasRejection=!0,D.hasExtra1=!0,D.hasExtra2=!0;break}}})}d.update((y)=>{switch(o){case w.Containing:{y.hasExtra1=!0;break}case w.ContainedBy:{y.hasExtra2=!0;break}case w.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 g=pe;for(let{hasExtra1:y,hasExtra2:S,hasCommon:A,hasCommonBroken:N}of d){let L=A;if(N)L=!1;if(!L)g|=Q;else if(y&&S)g|=ne;else if(y)g|=U;else if(S)g|=W;else g|=H}return g}function Oh({items:e,additionalItems:t}){if(Array.isArray(e))return[e,t??Nt];else return[[],e??Nt]}function _h(e){let t=new Map;return(n,r)=>{let o=_r(n),i=_r(r);if(o!==i)return!1;if(!o)return n===r;return Ah(t,n,r,e)}}function Rh(e){let t=new Map;return(n,r)=>Ah(t,n,r,e)}function Ah(e,t,n,r){let o=Wt(t),i=Wt(n),s=`${o}/${i}`,a=e.get(s);if(a===void 0)e.set(s,a=r(t,n));return a}function Th(e,t,n){let r=El(t),o=El(n),i=!1,s=!1,a=!1;for(let c of r){if(Ph(e,o,c))a=!0;else i=!0;if(i&&a)break}for(let c of o){if(Ph(e,r,c))a=!0;else s=!0;if(s&&a)break}if(!a)return Q;if(i&&s)return ne;if(i)return U;if(s)return W;return H}function Ol(e,t){let n=!1,r=!1;for(let o of El(e)){switch(pt(t,o)){case Te.Valid:{n=!0;break}case Te.Invalid:{r=!0;break}case Te.Unknown:return We}if(n&&r)break}if(n&&r)return ne;if(n)return H|W;if(r)return Q;if(ee(t)===I.Never)return H;return W}function El({const:e,enum:t}){if(e!==void 0)return[e];if(t)return t;throw Error("invalid branch")}function Ph({isEquals:e},t,n){for(let r of t)if(e(r,n))return!0;return!1}function $h(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=Wt(s),l=Wt(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 Ar(e){let t=Pr(e),n=e.multipleOf??1,r=st(t,n);if(!r)return null;return{multipleOf:n,range:r}}function Nh([e,t]){if(e.num!==t.num)return!1;if(e.exclusive)return!1;if(t.exclusive)return!1;return!0}function st(e,t){if(!e)return;let[n,r]=e,o=PS(n.num,t),i=TS(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 PS(e,t){return Math.ceil(e/t)*t}function TS(e,t){return Math.floor(e/t)*t}function Dh(e,t){let n=Pr(e),r=Pr(t),{left:o,right:i,center:s}=zt(n,r);if(!s)return Q;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 ne;if(a)return U;if(c)return W;return H}function jl(e,t){let n=Pr(e),r=Ar(t);if(!r)return U;let o=zt(n,r.range),i=st(o.center,r.multipleOf),s=zh(o.left,r.multipleOf),a=zh(o.right,r.multipleOf);if(!o.center)return Q;let c=!1,l=!1;if(o.left?.fromLeft)c=!0;if(o.right?.fromLeft)c=!0;if(!i||!Nh(o.center))c=!0;if(s)l=!0;if(a)l=!0;if(c&&l)return ne;if(c)return U;if(l)return W;return H}function Pr(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 zh(e,t){if(!e)return;if(e.fromLeft)return;return st(e.range,t)}function Lh(e,t){let n=Ar(e),r=Ar(t);if(!n&&!r)return H;if(!n)return W;if(!r)return U;let{range:o,multipleOf:i}=n,{range:s,multipleOf:a}=r,c=zt(o,s),l,u=0;if(c.center)u=$S(i,a),l=st(c.center,u);if(!l)return Q;let d=!1,h=!1,{left:g,right:y}=c;if(g&&st(g.range,g.fromLeft?i:a))if(g.fromLeft)d=!0;else h=!0;if(y&&st(y.range,y.fromLeft?i:a))if(y.fromLeft)d=!0;else h=!0;if(d=d||qh(n,l,u),h=h||qh(r,l,u),d&&h)return ne;if(d)return U;if(h)return W;return H}function qh({range:e,multipleOf:t},n,r){let o=zt(e,n);if(st(o.left?.range,t))return!0;if(st(o.right?.range,t))return!0;let i=st(o.center,t);if(!i)return!1;let s=Vh(n);if(Vh(i)>s)return!0;if(s===1)return!1;if(t<r)return!0;return!1}function $S(e,t){return e*t/Fh(e,t)}function Fh(e,t){if(e===0)return t;return Fh(t%e,e)}function Vh(e){if(!e)return 0;let[t,n]=e;return n.num-t.num+1}function _l(e,t){if(Mh(e)||Mh(t))return We;let n=Zh(e),r=Zh(t);if(n&&r)return Dh(e,t);else if(n)return jl(e,t);else if(r)return Tt(jl(t,e));else return Lh(e,t)}function Mh(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 Zh(e){let{multipleOf:t}=e;if(t!==void 0&&Number.isInteger(t))return!1;if(e.type==="integer")return!1;return!0}var NS=En(0),zS=Ii(["hasCommonInRequired","hasCommonOutRequired","hasExtra1","hasExtra2","hasRejection"]);function Uh(e,t,n){if(DS(t,n))return Q;let r=qS(t,n);if(!r)return Q;let o=Jh(t),i=Jh(n),s=(S)=>{let A=o(S),N=i(S);if(Bh(A,N))return e.calculate(A,N);else return pe},{commonRequired:a,extraRequired1:c,extraRequired2:l}=r,u=zS.variable({});for(let S of[...a].toSorted())u.push(s(S),LS);for(let S of[...c].toSorted())u.push(s(S),FS);for(let S of[...l].toSorted())u.push(s(S),MS);let{hasOptional1:d,hasOptional2:h}=r;if(d||h){let S=ZS(d,h);for(let L of[...VS(t,n)].toSorted()){let D=s(L);if(D!==pe)u.push(D,S)}let A=t.additionalProperties??Nt,N=n.additionalProperties??Nt;if(Bh(A,N)){let L=e.calculate(A,N);u.push(L,S)}}u.update((S)=>{if(!S.hasRejection){if(c.size>0)S.hasExtra2=!0;if(l.size>0)S.hasExtra1=!0}});let{requiredKeysCount:g}=r,y=pe;for(let{hasExtra1:S,hasExtra2:A,hasCommonInRequired:N,hasCommonOutRequired:L,hasRejection:D}of u)if(!N&&g>0)y|=Q;else if(!L&&g===0)y|=Q;else if(D)y|=Q;else if(S&&A)y|=ne;else if(S)y|=U;else if(A)y|=W;else y|=H;return y}function DS(e,t){let n=NS(e.minProperties,e.maxProperties,t.minProperties,t.maxProperties);return On(n)===w.Rejection}function qS(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 VS(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 LS=(e,t)=>{switch(e){case w.Equals:{t.hasCommonInRequired=!0;break}case w.Containing:{t.hasExtra1=!0,t.hasCommonInRequired=!0;break}case w.ContainedBy:{t.hasExtra2=!0,t.hasCommonInRequired=!0;break}case w.Intersection:{t.hasExtra1=!0,t.hasExtra2=!0,t.hasCommonInRequired=!0;break}case w.Rejection:{t.hasRejection=!0;break}}},FS=(e,t)=>{switch(e){case w.Equals:case w.ContainedBy:{t.hasCommonInRequired=!0;break}case w.Intersection:case w.Containing:{t.hasExtra1=!0,t.hasCommonInRequired=!0;break}case w.Rejection:{t.hasRejection=!0;break}}},MS=(e,t)=>{switch(e){case w.Equals:case w.Containing:{t.hasCommonInRequired=!0;break}case w.Intersection:case w.ContainedBy:{t.hasExtra2=!0,t.hasCommonInRequired=!0;break}case w.Rejection:{t.hasRejection=!0;break}}},ZS=(e,t)=>(n,r)=>{if(r.hasRejection)return;let o=!1,i=!1,s=!1;switch(n){case w.Equals:{s=!0;break}case w.Containing:{o=!0,s=!0;break}case w.ContainedBy:{i=!0,s=!0;break}case w.Intersection:{o=!0,i=!0,s=!0;break}case w.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 Jh(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)===Te.Invalid)return jr;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 Bh(e,t){let n=ee(e),r=ee(t);return n!==I.Never||r!==I.Never}var JS=En(0);function Kh(e,t){if(t.format&&!e.format)return U;if(e.format&&t.format&&e.format!==t.format)return We;let n=JS(e.minLength,e.maxLength,t.minLength,t.maxLength),r=On(n),o=!!e.pattern,i=!!t.pattern;switch(r){case w.Rejection:return Q;case w.Containing:return o?We:U;case w.ContainedBy:return i?We:W;case w.Equals:{if(o&&i)return e.pattern===t.pattern?H:We;if(o)return H|W;if(i)return H|U;return H}case w.Intersection:{if(o&&i)return We;if(o)return ne|Q|W;if(i)return ne|Q|U;return ne}}}function Gh(e,t,n){let r={},o=[],i=Rh(US(e,r)),s=BS(),a=$h(e);r.isEquals=_h(xn),r.calculate=bl({describe:s,equals:a,calculate:i,observeCalculation:(l,u,d,h)=>{let g=h?Tt(d):d;if(!KS(g))return;let y=h?Wh(u,l):Wh(l,u);if(y)o.push(y)}}),Object.freeze(r);let c=r.calculate(t,n);return{errorPath:o[0],expression:c}}var BS=()=>(e)=>{let t;switch(ee(e)){case I.Not:{t={kind:Fe.Not,expression:e.not};break}case I.Combination:{if("allOf"in e)t={kind:Fe.AllOf,expressions:Rl(e.allOf,I.Any)};else if("anyOf"in e)t={kind:Fe.AnyOf,expressions:Rl(e.anyOf,I.Never)};else if("oneOf"in e)t={kind:Fe.OneOf,expressions:Rl(e.oneOf,I.Never)};else throw Error(`invalid combination JSON Schema: ${JSON.stringify(e)}`);break}default:{t={kind:Fe.Leaf};break}}return t},US=(e,t)=>(n,r)=>{let o=ee(n),i=ee(r);if(o===I.Extends||i===I.Extends)return e.calculate(n,r);switch(o){case I.Any:return i===I.Any?H:U;case I.Never:return i===I.Never?H:W}switch(i){case I.Any:return W;case I.Never:return U}if(o===I.EnumOrConst&&i===I.EnumOrConst)return Th(t,n,r);if(o===I.EnumOrConst)return Ol(n,r);if(i===I.EnumOrConst)return Tt(Ol(r,n));if(o!==i)return Q;switch(o){case I.Null:return H;case I.Numeric:return _l(n,r);case I.String:return Kh(n,r);case I.Boolean:return H;case I.Object:return Uh(t,n,r);case I.Array:return jh(t,n,r);default:throw Error(`invalid kind ${o}`)}};function Rl(e,t){return e.filter((n)=>ee(n)!==t)}function KS(e){return!kr(e)&&!Sr(e)&&(xr(e)||Cr(e)||Ir(e))}function Wh(e,t){let n=kl(t);if(!n)return;let r=ee(e),o=ee(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 Tr{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=Tr.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 w.Containing:return w.ContainedBy;case w.ContainedBy:return w.Containing;default:return e}}}function Hh(e,t,n=!1){let r=t(e);if(Array.isArray(r)){let s=[];throw Al(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(Cn(s))}return o}function Qh(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))Al(u,o,"$1");if(Array.isArray(i))Al(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(Cn(u));if(l.length>0)console.warn(`found ${l.length} warns after compile subSchema`);for(let u of l)console.warn(Cn(u))}return[s,c]}function Al(e,t,n){for(let r of t){let o={...r,path:[n,...r.path]};e.push(o)}}var $r=Object.freeze({True:0,False:1,Unknown:2});function Pl({extendsSchemaClasses:e,delegate:t}={}){let n=new Tr(e);return Object.freeze({compile:(o,i,s)=>Hh(o,(c)=>Si(c,n,i,t),s),isSubset:(o,i,s=!1)=>{let a=(y)=>Si(y,n,void 0,t),[c,l]=Qh(o,i,a,s),{errorPath:u,expression:d}=Gh(n,c,l),h=kr(d)||Sr(d),g=xr(d)||Cr(d)||Ir(d);if(h&&!g)return{result:$r.True};if(!h&&g)return{errorPath:u,result:$r.False};return{result:$r.Unknown}}})}var Ci=(e)=>typeof e==="string";var WS=Array.isArray;var GS=(e)=>e!==null&&typeof e==="object";var HS=(e)=>GS(e)&&!WS(e),Gt=(e)=>HS(e)?e:void 0;function QS(e){return Gt(e)?.type==="string"}function YS(e){let t=Gt(e),n=Gt(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 XS(e){if(e==null)return{error:{}};return YS(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=XS(n)}compare(e){if(Ze(e)&&ee(e)===I.Any)return[w.ContainedBy];return this.compareImpl(e)}}class Nr extends Dt{static isMatch(e){let t=Gt(e)?.enum;return Array.isArray(t)&&t.every((n)=>Ci(n))}constructor(e,t,n){if(!Nr.isMatch(t))throw TypeError("Invalid single-select schema.");super(e,t,n)}compareImpl(e){if(QS(e))return[w.ContainedBy];if(e instanceof Nr){let t=new Set(this.value.enum),n=w.Equals;for(let r of e.value.enum){if(!t.has(r))n=w.ContainedBy;t.delete(r)}if(t.size===0)return[n];if(t.size===this.value.enum.length)return[w.Rejection];return[w.Intersection]}return[w.Rejection]}equals(e){if(e instanceof Nr){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 zr extends Dt{static isMatch(e){return Gt(e)?.contentMediaType==="oomol/bin"}constructor(e,t,n){if(!zr.isMatch(t))throw TypeError("Invalid binary schema.");super(e,t,n)}compareImpl(e){if(e instanceof zr)return[w.Equals];else return Dt.setError(this,e,"edgeError.binDiffType"),[w.Rejection]}equals(e){return e instanceof zr}}class Dr extends Dt{static isMatch(e){return Gt(e)?.contentMediaType==="oomol/artifact"}constructor(e,t,n){if(!Dr.isMatch(t))throw TypeError("Invalid Artifact schema.");super(e,t,n)}compareImpl(e){if(e instanceof Dr)return[w.Equals];return Dt.setError(this,e,"edgeError.artifactDiffType"),[w.Rejection]}equals(e){return e instanceof Dr}}function Yh(){return Pl({extendsSchemaClasses:[Nr,zr,Dr]})}var LR=Yh();var eI=new Set(["const","enum","exclusiveMaximum","exclusiveMinimum","maximum","maxItems","maxLength","maxProperties","minimum","minItems","minLength","minProperties","multipleOf","pattern","required","type"]);function Ei(e){return eI.has(e)}function Tl(e){if(e.kind!="task")return[];if("moduleId"in e.task)return(e.task.capabilities??[]).flatMap((t,n)=>t.kind=="workflow"?[{target:t,path:`task/capabilities/${n}`,tool:t.name}]:[]);if(e.task.executor.kind=="workflow")return[{target:{...e.task.executor,inputs:e.task.inputs.filter((t)=>("handle"in t)),outputs:e.task.outputs.filter((t)=>("handle"in t))},path:"task/executor"}];if(e.task.executor.kind=="agent")return e.task.executor.tools.flatMap((t,n)=>t.kind=="workflow"?[{target:t,path:`task/executor/tools/${n}`,tool:t.name}]:[]);return[]}var Oi=O({handle:C().min(1),jsonSchema:Pe(),nullable:he(),description:C().optional()}),YR=v({inputs:R(Oi).nullable(),outputs:R(Oi).nullable()});var Xh=O({version:b(1),flowId:C().min(1),name:C(),revisionId:C().min(1),publicationId:C().min(1),inputs:R(Oi),outputs:R(Oi).nullable()});var ey=O({version:b(1),direction:Z(["incoming","outgoing"]),total:xe().nonnegative(),nextOffset:xe().nonnegative().optional(),references:R(O({flowId:C(),name:C().nullable(),available:he(),draft:he(),live:O({publicationId:C(),enabled:he()}).nullable()}))});var $l=["GET","POST","PUT","PATCH","DELETE"];function ji(e){return e!=="GET"}function nI(e){return e.kind==="decision"}var Nl={choice:255,score:10};function ty(e){if(e.type==="noul"||e.criteria.length<=Nl[e.type])return e;if(e.type==="choice")return{...e,criteria:e.criteria.slice(0,Nl.choice)};return{...e,criteria:e.criteria.slice(0,Nl.score)}}function rI(e){let t=e.map(ty);return t.every((n,r)=>n===e[r])?e:t}function ny(e){if(!nI(e.executor))return e;let t=e.executor.questions,n=rI(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]||!Ie(o.jsonSchema,ry(t[i])))return o;return{...o,jsonSchema:oI(n[i])}});return{...e,executor:{...e.executor,questions:n},outputs:r}}var zl={type:"number",minimum:0,maximum:1};function oI(e){return ry(ty(e))}function ry(e){let t={type:{const:e.type}};if(e.type==="noul")t.noul=zl;else{let n=e.type==="choice"?e.criteria.map((r)=>r.name):e.criteria.map((r,o)=>String(o));if(t.confidence=zl,t.probabilities={type:"object",properties:Object.fromEntries(n.map((r)=>[r,zl])),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 oy(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 iI=/^(?:\*\.)?(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,Dl=20;function ql(e){return iI.test(e)&&(!e.startsWith("*.")||e.slice(2).includes("."))}var iy=v({mode:Z(["fields","object"]).default("fields"),names:R(C()).default([])}),_i=v({method:Z(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]).default("GET"),query:iy.default({mode:"fields",names:[]}),headers:iy.default({mode:"fields",names:[]}),bodyFormat:Z(["none","json","text","form"]).default("none"),authentication:Y([v({type:b("none")}),v({type:Z(["bearer","basic"])}),v({type:b("apiKey"),name:C(),in:Z(["header","query"])})]).default({type:"none"}),responseFormat:Z(["auto","json","text"]).default("auto"),statusPolicy:Z(["success","all"]).default("success")}),ay=_i.extend({kind:b("http-request")});function ft(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))ft(n,t+1)}var Vl=["code","connector","openapi","http-request","llm","decision"],Ri={maxRetries:5,minIntervalMs:1000,maxIntervalMs:60000,intervalStepMs:1000};var mt=v({maxRetries:B().int().min(0).max(Ri.maxRetries),intervalMs:B().int().min(Ri.minIntervalMs).max(Ri.maxIntervalMs).multipleOf(Ri.intervalStepMs)});var qt=R(Y([O({type:b("cron"),expression:C(),timezone:C()}),O({type:b("every"),unit:Z(["day","hour","minute","month","week"]),value:B()})]));function cy(e){try{return Intl.DateTimeFormat("en",{timeZone:e}),!0}catch{return!1}}var jn=it("kind",[v({kind:b("after"),durationMs:B().nullable()}),v({kind:b("at"),at:C(),timezone:C().optional()})]),Ll=it("kind",[jn.options[0].extend({durationMs:B().int().positive().max(Number.MAX_SAFE_INTEGER)}),jn.options[1].extend({at:wr.datetime({offset:!0}),timezone:C().refine(cy,"Select a valid IANA timezone.").optional()})]);var Vr={defaultMs:30000,minMs:1000,maxMs:60000};var ly={jsonSchema:{type:"object",additionalProperties:{type:["string","number","boolean"]}},nullable:!0};var cI=[{handle:"body",jsonSchema:{},nullable:!0,value:""},{handle:"statusCode",jsonSchema:{type:"number"},nullable:!1,value:200},{handle:"headers",jsonSchema:ly.jsonSchema,nullable:!1,value:{}}];var zi=13,x=C(),Pi=x.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.'),Yt=Pe(),Lr=R(x),Vt=O({description:x.optional(),jsonSchema:Yt,nullable:he(),handle:x}),lI=R(Vt.strict()),Qe=Vt.extend({value:Yt.optional()}),uy=O({collapsed:he().optional(),group:x}),uI=O({kind:b("node"),nodeId:x,output:x,system:b(!0).optional(),field:x.optional()}),fy=Y([uI,O({kind:b("binding"),bindingId:x})]),Fr=Y([O({kind:b("unset")}),O({kind:b("value"),value:Yt})]),Fl=Y([Fr,O({kind:b("sources"),sources:R(fy)})]),my=oe(x,Fl),Rn={inputs:R(Y([Qe,uy])),outputs:R(Y([Vt,uy]))},dI=v({kind:b("connector"),action:x,connectionId:x.optional(),connections:R(v({connectionId:x,alias:x.optional()}))}),Ul=Y([dI,v({kind:b("connector"),mode:b("shared")}),v({kind:b("connector"),mode:b("independent"),actions:R(v({action:x,connectionId:Pi.optional()}))}),v({kind:b("connector"),actionHints:R(x).optional(),connectionHints:R(v({action:x,connectionId:x,alias:x.optional()})).optional()})]),gy=v({kind:b("workflow"),name:x,flowId:x,revisionId:x,inputs:R(Vt),outputs:R(Vt).nullable()}),Kl=v({kind:b("http"),hosts:R(x.refine(ql,'Use a lowercase host name or IPv4 address, optionally prefixed by "*." for subdomains.')).min(1).max(Dl).describe('Hosts Code may call with context.fetch. "*.example.com" matches subdomains only.')}),Ti=Y([Ul,gy,Kl]),Ml=O({...Rn,name:x,moduleId:x,capabilities:R(Ti).optional()}),hy=Y([O({kind:b("value"),value:Yt}),O({kind:b("input"),input:x})]),pI=Y([hy,O({kind:b("model")})]),Di={id:x,name:x,description:x,approval:he(),inputs:R(Qe.extend({source:pI}))},Wl=O({...Di,kind:b("connector").optional(),action:x,connectionId:Pi.optional()}),Gl=gy.extend(Di),fI=it("type",[v({name:x,instructions:x,type:b("noul"),criteria:v({true:x.optional(),false:x.optional()}).optional()}),v({name:x,instructions:x,type:b("choice"),criteria:R(v({name:x,description:x}))}),v({name:x,instructions:x,type:b("score"),criteria:Lr})]),_n=O({...Rn,name:x,executor:Y([O({kind:b("connector"),action:x,connectionId:Pi.optional(),outputMode:b("value").optional()}),O({kind:b("openapi"),sourceUrl:x,method:x,path:x,serverUrl:x,document:Yt,auth:R(O({id:x,type:Z(["bearer","basic","apiKey"]),name:x.optional(),in:Z(["header","query"]).optional()}))}),v({kind:b("decision"),questions:R(fI)}),O({kind:b("llm"),mode:Z(["chat","json"])}),O({kind:b("agent"),code:he().optional(),model:x,prompt:x,maxRounds:B(),tools:R(Y([Gl,Wl])),notification:O({action:x,connectionId:Pi.optional(),inputDefinitions:R(Qe),messageHandle:x,inputs:oe(x,hy)}).optional()}),v({kind:b("workflow"),flowId:x,revisionId:x}),ay,nh])}),Zl=_n.transform(ny),dy=Y([O({kind:b("value"),value:Yt.optional(),jsonSchema:Yt.optional()}),O({kind:b("source"),source:fy})]),$i={matchMode:Z(["first","all"]),cases:R(O({description:x.optional(),output:x,groups:R(O({expressions:R(O({left:dy,operator:Z(["!=","<","<=","==",">",">=","contains","endsWith","hasKey","hasValue","isEmpty","isFalse","isNotEmpty","isNotNull","isNull","isTrue","notContains","notHasKey","notHasValue","startsWith"]),right:dy.optional()}))}))}))},Mr={inputDefinitions:R(Qe),prompt:x},mI=O({allowedMethods:ot().optional(),allowedOrigins:Lr.optional(),noResponseBody:ot().optional(),responseBody:it("kind",[v({kind:b("workflow-outputs"),output:x.optional(),timeoutMs:B().int().min(Vr.minMs).max(Vr.maxMs).optional()}),v({kind:b("webhook-response"),nodeId:x.optional(),timeoutMs:B().int().min(Vr.minMs).max(Vr.maxMs).optional()})]).optional(),responseData:x.optional(),responseHeaders:oe(x,x).optional(),responseHeadersSource:v({kind:b("workflow-outputs"),output:x.optional()}).optional(),responseHeaderOutputs:oe(x,x).optional(),responseStatusCode:B().int().min(200).max(599).optional(),responseStatusCodeOutput:x.optional()}),Ni={bodyFields:R(Qe),method:Z($l),options:mI.optional()},py={configInputs:Rn.inputs,definitionVersion:b(2),description:x,displayName:x,key:x,name:x,outputs:R(Vt).refine((e)=>new Set(e.map((t)=>t.handle)).size===e.length,"Duplicate Trigger output handle."),provider:x},gI=O({body:O({allowArray:he(),allowEmpty:he(),formats:R(Z(["form","json","multipart","text"]))}),methods:R(Z(["DELETE","GET","HEAD","PATCH","POST","PUT"])),successStatus:B()}),Jl=R(x.min(1)).refine((e)=>new Set(e).size===e.length,"Duplicate source Flow ID."),Ht={name:x,description:x.optional(),icon:x.optional()},Qt={maxExecutions:B().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),inputs:my,name:x.optional(),description:x.optional(),icon:x.optional(),timeoutMs:B().optional(),retry:mt.optional(),onError:Z(["stop","error"]).optional()},Ai=Y([v({...Qt,kind:b("webhook-response"),retry:ot().optional(),onError:ot().optional()}),v({...Qt,kind:b("outputs"),outputDefs:R(Vt.strict()),outputMappings:my}).omit({inputs:!0}),O({...Qt,inputs:oe(x,ot()),kind:b("condition"),...$i}),O({...Qt,inputs:rt().transform(()=>({})).default({}),kind:b("value"),values:R(Qe)}),O({...Qt,kind:b("task"),task:Y([Ml,Zl]),additionalInputs:R(Qe).optional()}),v({...Qt,kind:b("approval"),...Mr}).omit({timeoutMs:!0}),v({...Qt,kind:b("wait"),...Mr,autoContinue:jn.optional()}).omit({timeoutMs:!0}),O({...Ht,kind:b("manual")}),v({...Ht,kind:b("start"),inputDefs:lI}),v({...Ht,kind:b("error"),sourceFlowIds:Jl.optional()}),O({...Ht,kind:b("webhook"),...Ni}),O({...Ht,kind:b("cron"),cronTimes:qt}),O({...Ht,kind:b("poll"),connectionId:x.min(1).optional(),config:oe(x,Fr),definition:O({...py,type:b("poll")}),pollTimes:qt}),O({...Ht,kind:b("integration"),connectionId:x.min(1).optional(),config:oe(x,Fr),definition:O({...py,type:b("integration"),endpoint:gI})})]),ct={input:Qe,port:Vt,ports:Rn,condition:v($i),wait:v(Mr),waitAutoContinue:Ll,webhook:v(Ni),schedule:qt,capabilities:R(Ti),connector:_n.shape.executor.options[0].omit({kind:!0}).strict(),openapi:_n.shape.executor.options[1].omit({kind:!0}).strict(),decision:_n.shape.executor.options[2].omit({kind:!0}).strict(),llm:_n.shape.executor.options[3].omit({kind:!0}).strict(),agent:_n.shape.executor.options[4].omit({kind:!0,notification:!0}).strict()},Bl=O({source:x,target:x,sourceHandle:x.optional()}),Oe={nodeId:x,target:ot().optional()},hI=O({nodes:oe(x,Ai),edges:R(Bl).default([])}),yy=O({kind:b("variable"),target:x}),by=O({name:x,imports:Lr,source:x}),yI=Wg(bI,O({bindings:oe(x,yy),graph:hI})),wy=O({modelVersion:Y([b(2),b(4),b(5),b(6),b(7),b(8),b(9),b(10),b(11),b(12),b(zi)]),document:yI,modules:oe(x,by)}),LA=wy.extend({kind:b("open-flow-flow-revision"),version:b(1)});function bI(e){let t=at(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(at(at(t.graph).nodes)).some((r)=>Object.hasOwn(at(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(at(at(t.graph).nodes)).some((r)=>at(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(at(at(t.graph).nodes)).some((r)=>at(r).kind=="start"&&Object.hasOwn(at(r),"parameters")))throw TypeError("Legacy Start.parameters is unsupported; configure node.inputDefs.");return e}function at(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function An(e){ft(e);let t=wy.parse(e);return vI(t),xy(t.document),t}var wI={"graph.trigger.sources.set":{nodeId:x,before:Jl.optional(),value:Jl.optional()},"binding.create":{bindingId:x,binding:yy},"binding.delete":{bindingId:x},"binding.target.set":{bindingId:x,before:x,value:x},"graph.edge.connect":{edge:Bl,target:ot().optional()},"graph.edge.disconnect":{edge:Bl,target:ot().optional()},"graph.node.create":{...Oe,node:Ai},"graph.node.replace":{...Oe,before:Ai,node:Ai},"graph.node.delete":Oe,"graph.node.field.set":Y([O({...Oe,kind:b("graph.node.field.set"),field:b("retry"),before:mt.optional(),value:mt.optional()}),O({...Oe,kind:b("graph.node.field.set"),field:b("connectionId"),before:x.min(1).optional(),value:x.min(1).optional()}),O({...Oe,kind:b("graph.node.field.set"),field:Z(["description","icon","name","onError"]),before:x.optional(),value:x.optional()}),O({...Oe,kind:b("graph.node.field.set"),field:b("maxExecutions"),before:B().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),value:B().int().positive().max(Number.MAX_SAFE_INTEGER).optional()}),O({...Oe,kind:b("graph.node.field.set"),field:b("timeoutMs"),before:B().optional(),value:B().optional()})]),"graph.node.input.set":{...Oe,handle:x,before:Fl.optional(),value:Fl.optional()},"graph.node.additional-inputs.set":{...Oe,before:R(Qe).optional(),value:R(Qe).optional()},"graph.node.condition.set":{...Oe,before:O($i),value:O($i)},"graph.node.values.set":{...Oe,before:R(Qe),value:R(Qe)},"graph.node.resolution.set":{...Oe,before:v({...Mr,autoContinue:jn.optional()}),value:v({...Mr,autoContinue:jn.optional()})},"graph.node.webhook.set":{...Oe,before:O(Ni),value:O(Ni)},"graph.node.task.ports.set":{...Oe,before:O(Rn),value:O(Rn)},"graph.node.task.name.set":{...Oe,before:x,value:x},"graph.node.task.capabilities.set":{...Oe,before:R(Ti).optional(),value:R(Ti).optional()},"graph.trigger.config.set":{nodeId:x,name:x,before:Fr.optional(),value:Fr.optional()},"graph.trigger.schedule.set":{nodeId:x,before:qt,value:qt},"module.create":{moduleId:x,module:by},"module.delete":{moduleId:x},"module.rename":{moduleId:x,before:x,name:x},"module.source.replace":{moduleId:x,beforeImports:Lr,beforeSource:x,imports:Lr,source:x},"graph.node.task.set":{...Oe,before:Y([Ml,Zl]),value:Y([Ml,Zl])}},vy=new Map(Object.entries(wI).map(([e,t])=>[e,t instanceof K?t:O({kind:b(e),...t})])),FA=R(Y([...vy.values()])).min(1);function Zr(e,t,n){try{return n(e)}catch(r){if(!(r instanceof xk))throw r;throw TypeError(`operations[${t}]: ${r.issues.map((o)=>`${o.path.join(".")}: ${o.message}`).join("; ")}`,{cause:r})}}function ky(e,t){let{kind:n}=Zr(e,t,O({kind:x}).parse),r=vy.get(n);if(r==null)throw TypeError(`operations[${t}]: Unknown operation ${JSON.stringify(n)}.`);return Zr(e,t,r.parse)}function vI(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 xy(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))oy(t.inputs)}var Sy=v({mode:Z(["chat","json"]),resultSchema:Pe(),model:Pe().optional().describe("Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence."),template:Pe().optional().describe('Default message templates: [{role: "system" | "user" | "assistant", content: "Text with {{namedInput}}"}].'),messages:Pe().optional().describe("Default conversation history, prepended without template interpolation; an array of {role, content} or null.")});var SI=Y([v({schemes:R(C().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.")}),v({type:Z(["bearer","basic"])}),v({type:b("apiKey"),name:C().min(1),in:Z(["header","query"])})]),Iy=v({sourceUrl:C().min(1),path:C().min(1),method:C().min(1),serverUrl:C().optional(),authentication:SI.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")});var z=C().min(1),Ye=Pe(),eu=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"],tu=Z(qi),gt=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.'),Hl=v({kind:b("output"),node:gt,port:z.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),field:C().optional()}),Ql=v({kind:b("system"),node:gt,port:b("error"),field:C().optional()}),Yl=v({kind:b("variable"),name:z}),Cy=Y([Hl,Ql,Yl,v({kind:b("value"),value:Ye}),v({kind:b("unset")}),v({kind:b("default")}),v({kind:b("sources"),sources:R(Y([Hl,Ql,Yl])).min(1)})]),Ey=Y([v({kind:b("value"),value:Ye.optional(),schema:Ye.optional()}),Hl,Ql,Yl]),Oy=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."),II=Y([Gl.omit({id:!0,inputs:!0,outputs:!0,revisionId:!0}).extend({inputs:Oy}).strict(),Wl.omit({id:!0,inputs:!0}).extend({inputs:Oy}).strict()]),CI=R(Y([Ul,v({kind:b("workflow"),name:z,flowId:z}),Kl])),EI=v({...ct.connector.shape,messageHandle:z,inputs:oe(z,Y([v({kind:b("value"),value:Ye}),v({kind:b("input"),input:z})]))}),Vi=v({schema:Ye.optional(),nullable:he().optional(),description:C().optional()}),Pn=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."),Ay=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."),OI=Ay.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."),Py=oe(z,Vi.extend({schema:Ye,nullable:he()})),jy=oe(z,Vi).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true."),Xl=v({left:Ey,operator:ct.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,right:Ey.optional()}),_y=v({all:R(Xl)}),jI=Y([Xl,_y,v({any:R(Y([Xl,_y]))})]),xt={"webhook-response":v({}),workflow:v({flowId:z}),start:v({inputDefs:Ay.default({})}),outputs:v({outputDefs:OI.default({})}),error:v({sourceFlowIds:R(z).optional()}),webhook:ct.webhook.omit({bodyFields:!0}).extend({body:Pn}).strict(),cron:v({schedule:ct.schedule}),poll:v({key:z,connectionId:z.optional(),schedule:ct.schedule}),integration:v({key:z,connectionId:z.optional()}),code:v({inputs:Pn,outputs:jy,capabilities:CI.optional()}),connector:ct.connector.omit({outputMode:!0}).strict(),openapi:Iy,"http-request":_i,"skip-duplicates":bi,agent:ct.agent.omit({prompt:!0,tools:!0}).extend({inputs:Pn,resultSchema:Ye.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),tools:R(II),notification:EI.optional()}).strict(),llm:Sy.extend({inputs:Pn}),decision:ct.decision,condition:v({match:Z(["first","all"]),branches:R(v({name:z,description:C().optional(),when:jI}))}),value:v({values:eu,outputs:jy}),wait:v({inputs:Pn,autoContinue:ct.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:Pn})},_I={onError:Z(["stop","error"]).optional(),name:z.optional(),description:C().optional(),icon:C().optional(),maxExecutions:xe().positive().optional(),timeoutMs:B().nonnegative().optional(),retry:mt.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({..._I,config:eu.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"].')}),AI=it("op",[v({op:b("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:tu,name:z,onError:Z(["stop","error"]).optional(),retry:mt.optional(),config:eu.optional(),inputs:oe(z,Cy).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),code:C().optional(),prompt:C().optional()}),v({op:b("node.update"),node:gt,set:RI.optional(),clear:R(R(z).min(1)).optional()}),v({op:b("node.refresh"),node:gt,tool:z.optional().describe("Name of a workflow tool on an Agent or Code node. Omit for a Call Workflow node.")}),v({op:b("node.remove"),node:gt}),v({op:b("input.set"),node:gt,input:z,source:Cy}),v({op:Z(["edge.connect","edge.disconnect"]),source:gt,target:gt,branch:z.optional()}),v({op:b("text.edit"),node:gt,field:Z(["code","prompt"]),oldText:z,newText:C()}),v({op:b("text.set"),node:gt,field:Z(["code","prompt"]),text:C()})]),Jr=v({baseRevision:z,requestId:z.max(256),edits:R(AI).min(1).max(1000)}),Li=v({revision:z.optional().describe("Fixed revision from a previous read; omit to read the current draft."),nodes:R(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:Z(["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."}),nu=v({revisionId:z}),Fi=v({revision:z.optional(),query:z.max(1000),type:tu.optional(),offset:xe().nonnegative().default(0),limit:xe().min(1).max(100).default(20)}),Ty=v({type:tu.optional(),action:z.optional()}).refine((e)=>e.type==null||e.action==null,"Choose type or action."),Ry={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:Fi,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:Jr,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:nu,guidance:"Check a fixed revision. In the CLI, pass this identity with --revision REVISION.",examples:[{revisionId:"REVISION"}]}},PI=[...Yu(sn).builtinModules].filter((e)=>!e.startsWith("node:")),TI=`Code is an ES module whose default export receives (inputs, context) and returns the business outputs. It may import the Node builtins ${PI.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 ru(e){if(!Object.hasOwn(Ry,e))return;let t=Ry[e];return{request:gn(t.schema,{io:"input"}),guidance:t.guidance,examples:t.examples}}function ou(e){return e==null?{types:qi,request:gn(Jr),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"||Vl.some((t)=>t==e)?{enum:["stop","error"]}:!1,retry:Vl.some((t)=>t==e)?gn(mt):!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"?TI:"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:gn(xt[e].partial()),texts:e=="code"?["code"]:["agent","wait","approval"].includes(e)?["prompt"]:[]}}var $y=O({code:z,message:C(),nodes:R(z),field:C().optional(),line:B().optional(),column:B().optional()}),Ny=O({flowId:z,revisionId:z,valid:he(),diagnostics:R($y),version:b(1)}),zy=O({flowId:z,saved:b(!0),revision:z,nodes:oe(z,z),changes:R(O({index:xe(),op:z,node:z.optional()})),validation:O({status:Z(["valid","invalid","unavailable"]),diagnostics:R($y).optional()}),version:b(1)}),Dy=O({flowId:z,revision:z,data:O({nodes:R(oe(C(),Ye)).optional(),edges:R(Ye).optional(),text:oe(C(),Ye).optional()}),version:b(1)}),qy=O({flowId:z,revision:z,data:O({matches:R(O({node:z.optional(),field:z,line:xe().optional(),excerpt:C()})),total:xe(),nextOffset:xe().optional()}),version:b(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",tagInvalid:"tag.invalid",tagConflict:"tag.conflict",tagNotFound:"tag.not-found",variableInvalid:"variable.invalid",variableLimitReached:"variable.limit-reached",variableNotFound:"variable.not-found"},NI={[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.tagInvalid]:{status:400},[q.tagConflict]:{status:409},[q.tagNotFound]:{status:404},[q.variableInvalid]:{status:400},[q.variableLimitReached]:{status:409},[q.variableNotFound]:{status:404}};class _e extends Error{constructor(e,t,n,r){super(n);this.code=t,this.details=r,this.name="ApiError",this.status=e}}class Vy extends _e{constructor(e){super(502,"response.invalid",`The Control API returned an invalid response.${e==null?"":` ${e}`}`);this.detail=e}}function p(e){throw new Vy(e)}function k(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 F(e,t){let n=t.filter((r)=>!Object.hasOwn(e,r));if(n.length>0)p(`Missing fields: ${n.join(", ")}.`)}function Ly(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 ve(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(ve);let t=k(e);return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,ve(r)]))}function Mi(e){if(e==null)return;return f(e)}function Tn(e){let t=k(e),n=t.liveEnd==null?void 0:k(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 iu(e){let t=k(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 F(t,["createdAt","flowId","operationId","revisionId","status","updatedAt","version"]),{...r,status:n};case"succeeded":return F(t,["createdAt","flowId","operationId","publicationId","revisionId","status","updatedAt","version"]),{...r,publicationId:f(t.publicationId),status:n};case"failed":{F(t,["createdAt","flowId","issue","operationId","revisionId","status","updatedAt","version"]);let o=k(t.issue),i=o.nodeId;return F(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 su(e){let t=k(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:Tn(r),revision:ie(t.revision),status:n,version:1}}function Fy(e){let t=k(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(Tn),...r==null?{}:{total:r},version:1}}var My=R(Y([v({handle:C().min(1),description:C().optional(),jsonSchema:Pe(),nullable:he(),value:Pe().optional()}),v({group:C(),collapsed:he().optional()})]));function au(e){let t=k(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=k(e),n=au(t),r={configInputs:My.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=k(l);return Object.assign({handle:f(u.handle),jsonSchema:ve(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=k(t.endpoint),i=k(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 zI=new Set(["error","cron","integration","poll","webhook"]),DI=new Set(["failed","healthy","initializing","needs_reauth","suspended"]),qI=new Set(["delivery.failed","health.failed","health.needs_reauth","health.recovered","health.suspended","operator.paused","operator.resumed"]);function Ur(e){let t=k(e),n=t.health,r=t.listener==null?void 0:k(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"||!DI.has(n))return p();if(typeof o!="string"||!zI.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 Zy(e){let t=k(e);if(t.version!=1)return p();return{binding:Ur(t.binding),version:1}}function VI(e){let t=k(e),n=t.kind;if(typeof n!="string"||!qI.has(n))return p();let r=Mi(t.errorCode),o=Mi(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 Jy(e){let t=k(e),n=Mi(t.nextCursor);if(t.version!=1||!Array.isArray(t.activities))return p();return{activities:t.activities.map(VI),...n==null?{}:{nextCursor:n},version:1}}function By(e){let t=k(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=k(r);return Object.fromEntries(Object.entries(o).map(([i,s])=>[i,ve(s)]))}),filtered:n,hasMore:t.hasMore,version:1}}var Xt={nodeId:C().min(1),name:C(),description:C().optional()},Kr=rt().transform(Ur),Uy={provider:C().min(1),inputs:oe(C(),it("kind",[O({kind:b("value"),value:Pe()}),O({kind:b("unset")})]))},FI=it("type",[O({...Xt,type:b("start"),config:xt.start}),O({...Xt,type:b("manual"),config:O({})}),O({...Xt,type:b("webhook"),config:xt.webhook,binding:Kr}),O({...Xt,type:b("cron"),config:xt.cron,binding:Kr}),O({...Xt,type:b("error"),config:xt.error,binding:Kr}),O({...Xt,...Uy,type:b("poll"),config:xt.poll,binding:Kr}),O({...Xt,...Uy,type:b("integration"),config:xt.integration,binding:Kr})]);function Ky(e){let t=k(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=Tn(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=Py.safeParse(t.inputDefs);if(!i.success)return p();return{flowId:n,inputDefs:i.data,publication:r,status:o,enabled:t.enabled,entries:MI(t.entries,r),version:1}}function MI(e,t){let n=R(FI).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 Wy(e){return e.kind=="source"&&e.source.kind=="binding"?{kind:"value"}:e}function Gy(e){return{...e,cases:e.cases.map((t)=>({...t,groups:t.groups.map((n)=>({...n,expressions:n.expressions.map((r)=>({...r,left:Wy(r.left),...r.right==null?{}:{right:Wy(r.right)}}))}))}))}}var uu=80;function Wr(e){let t=e.trim();if(t.length==0)return"empty";if(t.length>uu)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 Qy(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 Yy(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 GI=v({kind:b("open-flow-workflow"),version:b(1),name:C().optional(),icon:C().optional(),description:C().optional(),content:rt(),presentation:oe(C(),Pe()).optional()});function $n(e){ft(e,-1);let t=GI.parse(e);return{...t,content:An(t.content)}}function Xy(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 du(e){let t=$n(e),n=t.content.document.graph,r=Yy(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,Xy(l)]))};if(a.kind=="outputs")a={...a,outputMappings:Object.fromEntries(Object.entries(a.outputMappings).map(([c,l])=>[c,Xy(l)]))};if(a.kind=="condition")a=Gy(a);if(a.kind=="error"&&a.sourceFlowIds!=null)a={...a,sourceFlowIds:[]};if(a.kind=="poll"||a.kind=="integration")a={...a,config:Qy(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)=>!Ie(o[i],n.nodes[i])),removedBindings:Object.keys(t.content.document.bindings).length}}}function eb(e){return`${JSON.stringify(du(e).file,null,2)}
61
+ `}function tb(e){return e.replace(/(?:\.openflow)?\.json$/i,"")}var nb=R(v({flowId:C().min(1),file:rt()})).min(1),HI=v({kind:b("open-flow-workflow-bundle"),version:b(1),entryFlowId:C().min(1),workflows:nb}),QI=v({version:b(1),entryFlowId:C().min(1),workflows:nb,unavailableFlowIds:R(C().min(1))});function rb(e,t,n=[]){let r=e.map(({flowId:s,file:a})=>({flowId:s,file:$n(a)})),o=new Set(r.map(({flowId:s})=>s));if(o.size!=r.length||!o.has(t))throw TypeError("Workflow identities must be unique and include the entry workflow.");let i=new Set(n);if(i.size!=n.length||n.some((s)=>o.has(s)))throw TypeError("Invalid unavailable workflow identities.");for(let{file:s}of r)for(let a of Object.values(s.content.document.graph.nodes))for(let{target:c}of Tl(a))if(c.flowId&&!o.has(c.flowId)&&!i.has(c.flowId))throw TypeError("A referenced workflow is missing from the bundle.");return r}function ob(e){ft(e,-4);let t=HI.parse(e);return{...t,workflows:rb(t.workflows,t.entryFlowId)}}function ib(e){ft(e,-4);let t=QI.parse(e);return{...t,workflows:rb(t.workflows,t.entryFlowId,t.unavailableFlowIds)}}function sb(e){let t=ob(e);return{...t,workflows:t.workflows.map(({flowId:n,file:r})=>({flowId:n,file:du(r).file}))}}function ab(e){if(e.unavailableFlowIds.length)throw TypeError("Some referenced workflows are unavailable.");return sb({kind:"open-flow-workflow-bundle",version:1,entryFlowId:e.entryFlowId,workflows:e.workflows})}function cb(e){return`${JSON.stringify(sb(e),null,2)}
62
+ `}function lb(e){let t=JSON.parse(e);return t!=null&&typeof t=="object"&&"kind"in t&&t.kind=="open-flow-workflow-bundle"?ob(t):$n(t)}var XI=it("kind",[v({kind:b("admin-delegation")}),v({kind:b("policy"),ruleId:C().min(1).nullable()})]);function Bi(e){return XI.parse(e)}function pb(e){let t=k(e);if(!Array.isArray(t.bots))return p("Leina bots: expected an array.");let n=t.bots.map((r)=>{let o=k(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 eC(e){let t=k(e);if(F(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 fb(e,t){let n=k(e),{policyRevision:r,status:o,isDefault:i}=n,s=Object.hasOwn(n,"displayName")&&!Object.hasOwn(n,"connectionDisplayName"),a=t&&Object.hasOwn(n,"permissions")?eC(n.permissions):void 0,c=n.permissionGroupName;if(F(n,["accessBindingId","connectionId","source",s?"displayName":"connectionDisplayName","providerId",...t?[]:["status"]]),r!==void 0&&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 fu(e){if(e!="implicit"&&e!="selectable")return p("mode: expected implicit or selectable.");return e}function Nn(e){let t=k(e);F(t,["accessRevision","bindings","mode","sharedAccessDigest","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(fb(s,!1))}catch(a){if(!(a instanceof _e)||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:fu(t.mode),sharedAccessDigest:f(t.sharedAccessDigest),version:1}}function ub(e){if(!Array.isArray(e))return p();let t=e.map((n)=>{let r=k(n);F(r,["accessBindingId","connectionId","providerId","source","connectionDisplayName"]);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 mu(e){let t=k(e);if(F(t,["mode","sharedAccessDigest","sharedBindings","selectedBindings","version"]),t.version!=2)return p();let n=fu(t.mode),r=ub(t.sharedBindings),o=ub(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 tC(e,t){let n=k(e);if(F(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)=>fb(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:fu(n.mode),providerId:t,version:1}}function mb(e,t){let n=k(e);if(F(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=k(i),a=f(s.providerId);if(!r.delete(a))return p("results[].providerId: duplicate or unrequested provider.");if(!Object.hasOwn(s,"error"))return tC(s,a);F(s,["providerId","error"]);let c=k(s.error);return F(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 zn(e){let t=k(e);if(F(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 gb(e,t=!1){let n=k(e),r=n.description,o=t&&Object.hasOwn(n,"value");if(F(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:ve(n.jsonSchema),nullable:n.nullable,...o?{value:ve(n.value)}:{}}}function nC(e){return gb(e,!0)}function db(e,t){return Object.fromEntries(Object.entries(k(e)).map(([n,r])=>[n,t(r)]))}function rC(e){let t=k(e),{homepageUrl:n,icon:r}=t;if(F(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:ve(t.inputSchema)},...t.outputSchema===void 0?{}:{outputSchema:ve(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:db(t.inputs,nC),name:f(t.name),outputs:db(t.outputs,gb),serviceId:f(t.serviceId),serviceName:f(t.serviceName)}}function Ui(e){let{defaultConnection:t,...n}=k(e),r=rC(n);if(t==null)return r;let o=zn(t);if(o.serviceId!=r.serviceId||o.status!="active")return p();return{...r,defaultConnection:o}}function hb(e){let t=k(e),{homepageUrl:n,icon:r}=t;if(t.noSetup!==void 0&&typeof t.noSetup!="boolean")return p();if(F(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 gu(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 Dn=C().min(1).max(256),bb=O({appId:Dn.nullable(),workspaceId:Dn.optional(),installationId:Dn.optional(),organizationId:Dn.optional(),projectId:Dn.optional(),projectKey:Dn.optional(),subscriptionStatus:Z(["idle","pending","ready","error"]).optional(),lastError:C().optional(),signingSecretConfigured:he().optional(),manageSubscriptions:he().nullable(),verificationTokenConfigured:he().nullable(),encryptKeyConfigured:he().nullable(),verifiedAt:C().nullable()});var qn=C().min(1).max(256),sC=C().regex(/^[a-z][a-z0-9_.:]{0,127}$/),aC=C().trim().min(1).max(128),wb=O({version:b(1),sourceId:qn,revision:xe().positive(),name:aC,provider:Z(["feishu","feishu_app_bot","slackbot","intercom","sentry","zoom","fireflies","jira"]),...bb.shape,connectionId:qn,teamId:qn.nullable(),enabled:he(),eventTypes:R(sC),endpointUrl:C().nullable(),lastReceivedAt:C().nullable(),updatedAt:C(),consumers:R(O({flowId:qn,flowName:C(),triggerNodeId:qn}))});function Ki(e){return wb.parse(e)}function hu(e){return O({version:b(1),sources:R(wb),teamId:qn.nullable().optional()}).parse(e)}function yu(e){let t=k(e);if(F(t,["version","locale","definitions","display"]),t.version!=3||!Gu(t.locale)||!Array.isArray(t.definitions))return p();let n=t.definitions.map(Br),r=k(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=k(r[a]);return F(c,["configInputs","configInputLabels","displayName","description","outputs"]),[a,{configInputs:vb(c.configInputs,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),configInputLabels:cC(c.configInputLabels,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),displayName:f(c.displayName),description:f(c.description),outputs:vb(c.outputs,s.outputs.map((l)=>l.handle))}]}));return{version:3,locale:t.locale,definitions:n,display:i}}function vb(e,t){let n=k(e);return Ly(n,t),Object.fromEntries(Object.entries(n).map(([r,o])=>[r,f(o)]))}function cC(e,t){let n=k(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 bu(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 lC=v({pointer:C().max(4096).default(""),offset:B().int().nonnegative().default(0),limit:B().int().min(1).max(100).default(20),maxBytes:B().int().min(1).max(1048576).default(15000)});var uC=Pe(),kb=O({pointer:C(),type:Z(["object","array","string","number","boolean","null"]),length:B().int().nonnegative().optional(),complete:he(),value:uC.optional()}),dC=kb.extend({offset:B().int().nonnegative(),nextOffset:B().int().positive().optional(),entries:R(kb).optional()}),xb=O({resultId:C().min(1),callId:C().min(1),toolId:C().min(1),source:it("kind",[O({kind:b("connector"),action:C().min(1)}),O({kind:b("code")}),O({kind:b("workflow"),flowId:C().min(1)})]),bytes:B().int().nonnegative(),digest:C().regex(/^[a-f0-9]{64}$/),createdAt:C().datetime()}),pC=O({version:b(1),runId:C(),results:R(xb),nextAfter:C().optional()}),fC=O({version:b(1),runId:C(),result:xb,page:dC});function wu(e){return pC.parse(e)}function vu(e){return fC.parse(e)}function Sb(e){if(!Array.isArray(e))return p();return e.map((t)=>typeof t=="string"||Number.isSafeInteger(t)?t:p())}function mC(e){let t=k(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:Sb(t.path)};if(n!="keyword"||typeof t.keyword!="string"||!Ei(t.keyword))return p();return{kind:n,keyword:t.keyword,path:Sb(t.path),source:t.source===void 0?void 0:ve(t.source),target:t.target===void 0?void 0:ve(t.target)}}function gC(e){let t=k(e),n=t.values==null?void 0:k(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:mC(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 Ib(e){let t=k(e);if(t.version!=1||typeof t.valid!="boolean"||!Array.isArray(t.diagnostics))return p();return{closureDigest:f(t.closureDigest),diagnostics:t.diagnostics.map(gC),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 Cb=(e)=>e==null?"":`?flowId=${encodeURIComponent(e)}`;function Eb(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=k(r);if(F(o,["providers","version"]),o.version!=1||!Array.isArray(o.providers))return p();return o.providers.map(hb)}}}function Ob(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=k(o);if(F(i,["action","version"]),i.version!=1)return p();return Ui(i.action)}}}function jb(e){return{path:`/v1/connector/connections${Cb(e)}`,decode:(t)=>{let n=k(t);if(F(n,["connections","version"]),n.version!=1||!Array.isArray(n.connections))return p();return n.connections.map(zn)}}}function _b(e,t){return{path:`/v1/connector/connections/${encodeURIComponent(e)}${Cb(t)}`,decode:(n)=>{let r=k(n);if(F(r,["connections","serviceId","version"]),r.version!=1||f(r.serviceId)!=e||!Array.isArray(r.connections))return p();return r.connections.map(zn)}}}function Gr(e){return Array.isArray(e)?e.map(f):p()}function hC(e){let t=k(e),n=t.draft===null?null:k(t.draft),r=k(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:Gr(n.calledFlowIds)},variableNames:Gr(n.variableNames),errorSourceFlowIds:Gr(n.errorSourceFlowIds),connections:n.connections.map((i)=>{let s=k(i);return{providerId:f(s.providerId),connectionId:f(s.connectionId)}})},sharedAccess:{accessRevision:o,providerIds:Gr(r.providerIds),bindings:r.bindings.map((i)=>{let s=k(i);return{providerId:f(s.providerId),connectionId:s.connectionId===null?null:f(s.connectionId),accessBindingId:f(s.accessBindingId)}})}}}function Xe(e){let t=k(e),n=t.status;if(t.version!=1)return p();if(n!="active"&&n!="retiring")return p();let r=t.live==null?void 0:k(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?[]:Gr(t.tagIds),createdAt:f(t.createdAt),...t.connectorTeamId==null?{}:{connectorTeamId:f(t.connectorTeamId)},draftRevisionId:f(t.draftRevisionId),resourceReferences:hC(t.resourceReferences),flowId:f(t.flowId),name:f(t.name),...t.icon===void 0?{}:{icon:f(t.icon)},...t.description===void 0?{}:{description:f(t.description)},status:n,updatedAt:f(t.updatedAt),version:1}}function yC(e){let t=k(e),n=ie(t.referenceCount);if(n<0)return p();return{...Xe(t),referenceCount:n}}function Rb(e){let t=k(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(yC),...r==null?{}:{total:r},version:1}}function Wi(e){let t=k(e);if(F(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 Ab(e){let t=k(e),{referenceCount:n,...r}=t,o=ie(n);if(o<0)return p();return{...Wi(r),referenceCount:o}}function Pb(e){let t=k(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 Tb(e){let t=k(e);if(F(t,["version","references"]),t.version!=1||!Array.isArray(t.references))return p();return{version:1,references:t.references.map((n)=>{let r=k(n);if(F(r,["flowId","flowName","draft","live"]),typeof r.draft!="boolean")return p();let o=r.live===null?null:k(r.live);if(o!=null){if(F(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 ku(e){let t=k(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 Hr(e){let t=k(e);try{return{...ku(t),content:An(t.content)}}catch{return p()}}function $b(e){let t=k(e),n=k(t.content),r=k(k(n.document).graph),o=Object.entries(k(r.nodes)).flatMap(([i,s])=>{let a=k(s);if(a.kind=="outputs"||Object.hasOwn(a,"inputs"))return[];let c=f(a.kind);if(a.name!==void 0&&typeof a.name!="string")return p();return[{triggerId:f(i),kind:c,...a.name===void 0?{}:{name:a.name}}]});return{...ku(t),triggers:o}}function Gi(e){let t=k(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(k(t.value)).map(([n,r])=>[n,ve(r)])),version:1}}function Qr(e){let t=k(e);if(t.version!=1)return p();return{revision:ku(t.revision),version:1}}function Nb(e){let t=k(e);if(t.version!=1||t.kind!="snapshot")return p();return{draft:Hr(t.draft),kind:"snapshot",version:1}}var bC=["canceled","completed","failed","indeterminate"],Hi=[...bC,"queued","running","starting","waiting"];var wC=new Set(Hi);function Qi(e){return typeof e=="string"&&wC.has(e)?e:p()}function qb(e){let t=k(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:Qi(t.status),version:1}}function vC(e){let t=k(e);F(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 zb(e){let t=k(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 kC(e){let t=k(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 Yi(e){let t=k(e),n=qb(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(vC);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:kC(t.initiator)},...xC(t),...t.triggerNodeId===void 0?{}:{triggerNodeId:f(t.triggerNodeId)},...t.caller===void 0?{}:{caller:zb(t.caller)},...t.calls===void 0?{}:{calls:t.calls.map((a)=>Object.assign(zb(a),{status:k(a).status===null?null:Qi(k(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 Vb(e){let t=k(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(qb),version:1}}function Lb(e){let t=k(e),n=Qi(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 Fb(e){let t=k(e);F(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:Qi(t.status),version:1,waitId:f(t.waitId)}}function Mb(e){let t=k(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=k(t.error);return{...r,error:Db(o),status:"failed"}}if(n=="indeterminate"){let o=k(t.error);return{...r,error:Db(o),status:"indeterminate"}}return p()}function xC(e){let t=e.errorSource==null?void 0:k(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=k(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 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 Yr(){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 xu(e={}){return{query:e.query?.trim().toLowerCase()??"",tagIds:[...new Set(e.tagIds??[])].toSorted(),untagged:e.untagged??!1}}function Xi(e){let t=k(e);if(t.version!=1)return p();return{tagId:f(t.tagId),name:f(t.name),version:1}}function Zb(e){let t=k(e),n=ie(t.referenceCount);if(n<0)return p();return{...Xi(t),referenceCount:n}}function SC(e){let t=k(e);if(t.version!=1||!Array.isArray(t.flows)||t.flows.length==0)return p();let n=Xe(t.flow),r=t.flows.map(Xe);if(new Set(r.map((o)=>o.flowId)).size!=r.length||!r.some((o)=>o.flowId==n.flowId))return p();return{version:1,flow:n,flows:r}}function Bb(e){return e?.kind=="run.completed"||e?.kind=="run.failed"||e?.kind=="run.canceled"||e?.kind=="run.indeterminate"}function IC(e){let t=k(e),n=ie(t.sequence);if(n<0)return p();let r={createdAt:f(t.createdAt),sequence:n},o=k(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:ve(o.result)}};case"run.events-truncated":return{...r,kind:i,payload:Object.fromEntries(Object.entries(o).map(([s,a])=>[s,ve(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(k(o.systemOutputs)).map(([a,c])=>[a,ve(c)]))},outputs:Object.fromEntries(Object.entries(k(o.outputs)).map(([a,c])=>[a,ve(c)]))}};case"node.failed":{let a=k(o.error);return{...r,kind:i,payload:{...s,...o.handled===!0?{handled:!0}:{},...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(k(o.systemOutputs)).map(([c,l])=>[c,ve(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=k(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 CC(e){let t=k(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(IC),...n==null?{}:{eventsExpiresAt:n},historyComplete:t.historyComplete,nextAfter:r,runId:f(t.runId),version:1}}var _=encodeURIComponent;function en(e){return`${e}-${Yr()}`}class Su{constructor(e,t="api"){this.channel=t,this.requestControl=e}async loadOpenApiDocument(e,t){let n=k(await this.request("/v1/openapi/document",{method:"POST",body:JSON.stringify({url:e,version:1}),signal:t}));if(n.version!=1)return p();return ve(n.document)}async listFlows(e={}){let t=new URLSearchParams,n=xu(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 Rb(await this.request(`/v1/flows${r}`,e.signal==null?void 0:{signal:e.signal}))}async listEventSources(e,t){return hu(await this.request("/v1/event-sources"+(e==null?"":`?flowId=${_(e)}`),{signal:t}))}async listEventSourceConnections(e,t,n="feishu"){let r=k(await this.request(`/v1/event-sources/connections?kind=${n}${e==null?"":`&teamId=${_(e)}`}`,{signal:t}));if(F(r,["version","connections"]),r.version!=1||!Array.isArray(r.connections))return p();return r.connections.map(zn)}async createEventSource(e){return Ki(await this.request("/v1/event-sources",{method:"POST",body:JSON.stringify(e)}))}async updateEventSource(e,t){return Ki(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=k(await this.request("/v1/variables"));if(F(e,["variables","version"]),e.version!=1||!Array.isArray(e.variables))return p();return{variables:e.variables.map(Ab),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 ey.parse(await this.request(`/v1/flows/${_(e)}/references?${n}`,{signal:t.signal}))}async getWorkflowContract(e,t){return Xh.parse(await this.request(`/v1/flows/${_(e)}/call-contract`,{signal:t}))}async getVariableReferences(e,t){return Tb(await this.request(`/v1/variables/${_(e)}/references`,{signal:t}))}async getVariable(e){return Wi(await this.request(`/v1/variables/${_(e)}`))}async putVariable(e,t){return Wi(await this.request(`/v1/variables/${_(e)}`,{body:JSON.stringify({value:t}),method:"PUT"}))}async deleteVariable(e){let t=k(await this.request(`/v1/variables/${_(e)}`,{method:"DELETE"}));if(F(t,["version"]),t.version!=1)return p()}async exportFlow(e){let t=await this.request(`/v1/flows/${_(e)}/export`);try{return $n(t)}catch{return p()}}async getFlowExportPreview(e){let t=await this.request(`/v1/flows/${_(e)}/export-preview`);try{return ib(t)}catch{return p()}}async exportFlowBundle(e){let t=await this.getFlowExportPreview(e);if(t.unavailableFlowIds.length)throw new _e(400,"flow.invalid","Some referenced workflows are unavailable.");return ab(t)}async importFlowBundle(e,t={}){return SC(await this.request("/v1/flows/import-bundle",{method:"POST",headers:{"Idempotency-Key":t.idempotencyKey??`flow-${Yr()}`},body:JSON.stringify({file:e,name:t.name,teamId:t.teamId,tagIds:t.tagIds,version:1})}))}async importFlow(e,t={}){return Xe(await this.request("/v1/flows/import",{method:"POST",headers:{"Idempotency-Key":t.idempotencyKey??`flow-${Yr()}`},body:JSON.stringify({file:e,name:t.name,teamId:t.teamId,tagIds:t.tagIds,version:1})}))}async createFlow(e,t=`flow-${Yr()}`,n,r,o){return Xe(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=k(await this.request(`/v1/flows/${_(e)}/canvas`,{method:"POST",body:JSON.stringify({version:1,command:t})}));if(F(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 Xe(await this.request(`/v1/flows/${_(e)}`))}async getErrorListeners(e,t){let n=k(await this.request(`/v1/flows/${_(e)}/error-listeners`,{signal:t}));if(n.version!=1||!Array.isArray(n.listeners))return p();return n.listeners.map(Pb)}async listTags(e){let t=k(await this.request("/v1/tags",{signal:e}));if(t.version!=1||!Array.isArray(t.tags))return p();return{tags:t.tags.map(Zb),version:1}}async createTag(e){return Xi(await this.request("/v1/tags",{method:"POST",body:JSON.stringify({name:e,version:1})}))}async renameTag(e,t){return Xi(await this.request(`/v1/tags/${_(e)}`,{method:"PATCH",body:JSON.stringify({name:t,version:1})}))}async deleteTag(e){if(k(await this.request(`/v1/tags/${_(e)}`,{method:"DELETE"})).version!=1)p()}async setFlowTags(e,t){return Xe(await this.request(`/v1/flows/${_(e)}/tags`,{method:"PUT",body:JSON.stringify({tagIds:t,version:1})}))}async updateFlow(e,t){return Xe(await this.request(`/v1/flows/${_(e)}`,{method:"PATCH",body:JSON.stringify({...t,version:1})}))}async getFlowState(e,t){let n=ml.safeParse(await this.request(`/v1/flows/${_(e)}/state?scope=${t}`));return n.success&&n.data.scope===t?n.data:p()}async getFlowStateSummary(e,t,n){let r=rh.safeParse(await this.request(`/v1/flows/${_(e)}/state/summary?scope=${t}`,{signal:n}));return r.success&&r.data.scope===t?r.data:p()}async getFlowStateValues(e,t,n,r){let o=oh.safeParse(await this.request(`/v1/flows/${_(e)}/state/read`,{method:"POST",body:JSON.stringify({version:1,scope:t,keys:n}),signal:r}));return o.success&&o.data.scope===t&&o.data.values.length===n.length&&o.data.values.every((i,s)=>i.key===n[s])?o.data:p()}async clearFlowState(e,t,n){let r=k(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=k(await this.request(`/v1/flows/${_(e)}/dedupe?scope=${t}&space=${encodeURIComponent(n)}`,{method:"DELETE"}));if(r.version!==1||r.cleared!==!0)p()}async clearAllFlowDedupe(e,t){let n=k(await this.request(`/v1/flows/${_(e)}/dedupe/all?scope=${t}`,{method:"DELETE"}));if(n.version!==1||n.cleared!==!0)p()}async renameFlow(e,t){return this.updateFlow(e,{name:t})}async deleteFlow(e){return Xe(await this.request(`/v1/flows/${_(e)}`,{method:"DELETE"}))}async listTriggerKeys(e,t){let n=k(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(au)}async listTriggerDefinitions(e){let t=k(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:yu(await o.json()),etag:o.headers.get("etag")?.trim()||null}}async getTriggerKey(e,t){let n=k(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=k(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(Ur)}async getFlowTriggerBinding(e,t){return Zy(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 Jy(await this.request(`/v1/flows/${_(e)}/triggers/${_(t)}/activities${o}`))}async testFlowPollTrigger(e,t){return By(await this.request(`/v1/flows/${_(e)}/triggers/${_(t)}/test`,{body:JSON.stringify({version:1}),method:"POST"}))}async getEditor(e){let t=k(await this.request(`/v1/flows/${_(e)}/editor`));if(t.version!=1)return p();let n={flow:Xe(t.flow),draft:Hr(t.draft),live:su(t.live),presentation:Gi(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=k(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:Gi(r.presentation)}}async getPresentation(e){return Gi(await this.request(`/v1/flows/${_(e)}/presentation`))}async getDraft(e){return Hr(await this.request(`/v1/flows/${_(e)}/draft`))}async syncDraft(e){return Nb(await this.request(`/v1/flows/${_(e)}/draft/sync`))}async getRevision(e,t,n){return Hr(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}`,{signal:n}))}async getRevisionTriggers(e,t,n){let r=$b(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}`,{signal:n}));if(r.flowId!=e||r.revisionId!=t)return p();return r}async listTriggerConfigOptions(e,t,n,r){let o=k(await this.request(`/v1/flows/${_(e)}/triggers/${_(t)}/options/${_(n)}`,{signal:r}));if(F(o,["options","version"]),o.version!=1||!Array.isArray(o.options)||o.options.length>1000)return p();return o.options.map((i)=>{let s=k(i);F(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=k(await this.request("/v1/connector/teams",{signal:e}));if(F(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=k(n);if(F(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=Eb(t,n);return this.connectorRequest(r.path,"providers",e,r.decode)}async listLeinaBots(e,t){return pb(await this.request(`/v1/connector/leina/bots?flowId=${_(e)}`,{signal:t}))}async removeConnectionUsage(e,t,n,r,o){return Qr(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 Nn(await this.request(`/v1/flows/${_(e)}/connector-access`,{signal:t}))}async getPublishedConnectorAccess(e,t,n){return mu(await this.request(`/v1/flows/${_(e)}/connector-access?publicationId=${_(t)}`,{signal:n}))}async listProviderAccessBindingCandidates(e,t,n){return mb(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 Nn(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 Nn(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 Nn(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=Ob(e,n,r);return this.connectorRequest(i.path,"actions",t,i.decode,o)}async listAllConnectorConnections(e,t,n=!1){let r=jb(t);return this.connectorRequest(r.path,"connections",e,r.decode,n)}async listConnectorConnections(e,t,n,r=!1){let o=_b(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=k(await this.request(`/v1/connector/connections/${_(e)}/page${r.size==0?"":`?${r}`}`,{body:JSON.stringify({version:1}),method:"POST"}));if(F(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 Dy.parse(await this.request(`/v1/flows/${_(e)}/authoring/read`,{method:"POST",body:JSON.stringify(t)}))}async searchAuthoring(e,t){return qy.parse(await this.request(`/v1/flows/${_(e)}/authoring/search`,{method:"POST",body:JSON.stringify(t)}))}async authoringSchema(e,t){return k(await this.request(`/v1/flows/${_(e)}/authoring/schema`,{method:"POST",body:JSON.stringify(t)}))}async editAuthoring(e,t){return zy.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 Ny.parse(await this.request(`/v1/flows/${_(e)}/authoring/check`,{method:"POST",body:JSON.stringify({revisionId:t})}))}async changeDraft(e,t,n,r=en("change")){return Qr(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=en("repair")){return Qr(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 Qr(await this.request(`/v1/flows/${_(e)}/draft/upgrade`,{body:JSON.stringify({expectedRevisionId:t,version:1}),headers:{"idempotency-key":n.idempotencyKey??en("upgrade")},method:"POST"}))}async checkFlow(e,t){return Ib(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}/check`,{body:JSON.stringify({engineContract:sn,version:1}),method:"POST"}))}async getLiveDetails(e,t){let n=Ky(await this.request(`/v1/flows/${_(e)}/live/details`,{signal:t}));if(n.flowId!=e)return p();return n}async getLive(e,t){return su(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 Fy(await this.request(`/v1/flows/${_(e)}/publications${o}`,{signal:n}))}async createDraftRun(e,t,n){let r=Yi(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}/runs`,{body:JSON.stringify({engineContract:sn,inputs:n.inputs??{},trigger:n.trigger,version:2}),headers:{"idempotency-key":n.idempotencyKey??en("run"),"x-open-flow-client":this.channel},method:"POST"}));return r.source=="draft"?r:p()}async createLiveRun(e,t){let n=Yi(await this.request("/v1/runs",{body:JSON.stringify({inputs:t.inputs??{},trigger:t.trigger,publicationId:e,version:2}),headers:{"idempotency-key":t.idempotencyKey??en("run"),"x-open-flow-client":this.channel},method:"POST"}));return n.source=="live"?n:p()}async setFlowEnabled(e,t,n){return Xe(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 iu(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}/publications`,{body:JSON.stringify({engineContract:sn,expectedLivePublicationId:n,version:1}),headers:{"idempotency-key":r.idempotencyKey??en("publication")},method:"POST"}))}async getPublishOperation(e,t,n){return iu(await this.request(`/v1/flows/${_(e)}/publish-operations/${_(t)}`,{signal:n}))}async rollbackFlow(e,t,n,r={}){return Tn(await this.request(`/v1/flows/${_(e)}/publications/${_(t)}/rollback`,{body:JSON.stringify({expectedLivePublicationId:n,version:1}),headers:{"idempotency-key":r.idempotencyKey??en("publication")},method:"POST"}))}async getRun(e,t){return Yi(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 Vb(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 CC(await this.request(`/v1/runs/${_(e)}/events${o}`,{signal:n}))}async listRunResults(e,t,n){return wu(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 vu(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 Mb(await this.request(`/v1/runs/${_(e)}/result`,{signal:t}))}async cancelRun(e){return Lb(await this.request(`/v1/runs/${_(e)}/cancel`,{body:JSON.stringify({version:1}),method:"POST"}))}async resolveRunWait(e,t,n,r){return Fb(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=k(o);if(F(i,["actions","version"]),i.version!=1||!Array.isArray(i.actions))return p();return i.actions.map(Ui)})}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=k(i).error,a=s==null?void 0:k(s);throw new _e(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:k(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 AC}from"crypto";class E extends Error{constructor(e,t,n){super(t);this.code=e,this.details=n,this.name="CliError"}}function es(e,t){let n=e.trim();if(Wr(n)!=null)throw new E("cli.invalid-arguments",`${t} name must be between 1 and ${uu} characters and use only letters, numbers, spaces, hyphens, or underscores.`);return n}var EC=100,Iu=100,Cu=100,OC=new Set(["canceled","completed","failed","indeterminate"]);async function jC(e){let t=[],n=new Set,r;do{let o=await e.listFlows({cursor:r,limit:EC});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 _C(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 ke(e,t){try{return await e.getFlow(t)}catch(n){if(!(n instanceof _e)||n.code!="flow.invalid"&&n.code!="flow.not-found")throw n}return _C(await jC(e),t)}async function Ub(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 RC(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 Kb(e,t,n){try{return await e.getConnectorAction(t,void 0,n)}catch(r){if(!(r instanceof _e)||r.status!=404)throw r}return RC(await e.searchConnectorActions(t,void 0,n),t)}function Eu(e){return`${e.displayName} ${e.key} ${e.provider} ${e.type}`}async function Wb(e,t){try{return await e.getTriggerKey(t)}catch(o){if(!(o instanceof _e)||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 Gb(e){return`${e.displayName} ${e.connectionId} ${e.serviceId} ${e.status}${e.isDefault?"\tdefault":""}`}function Ou(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
63
  `:`${r}
63
- `)}function qt(e){return`${e.name} ${e.flowId} ${e.status}`}function Qr(e){return`${e.operation} ${e.publicationId} ${e.revisionId} ${e.createdAt}`}function Yr(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 Vb(e){return`${e.source} ${e.status} ${e.runId} ${e.revisionId}`}function Lb(e){return`${e.sequence} ${e.kind} ${JSON.stringify(e.payload)}`}async function Dn(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 C("cli.invalid-arguments",`${t} @ requires a file path.`);return await r.readFile(o)}catch(o){if(o instanceof C)throw o;throw new C(n,o instanceof Error?o.message:String(o))}}async function Xr(e,t){if(e==null)return{};let n=await Dn(e,"input","flow.authoring-unreadable",t),r;try{r=JSON.parse(n)}catch{throw new C("cli.invalid-arguments","Input must be valid JSON.")}if(r==null||typeof r!="object"||Array.isArray(r))throw new C("cli.invalid-arguments","Input must be a JSON object.");return r}async function Mb(e,t){if(e.input==null)return{};let n=await Dn(e.input,"--input","run.input-unreadable",t),r;try{r=JSON.parse(n)}catch{throw new C("run.input-invalid","Run input must be valid JSON.")}if(r==null||typeof r!="object"||Array.isArray(r))throw new C("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 C("run.input-invalid","Each Run input node must contain an object keyed by input handle.");return r}async function eo(e,t,n){let r=new Set,o;do{let i=await e.listPublications(t,{cursor:o,limit:xu}),s=i.publications.find((a)=>a.publicationId==n);if(s!=null)return s;if(o=i.nextCursor,o!=null&&r.has(o))throw new C("page.invalid-cursor","The deployment returned a repeated Publication cursor.");if(o!=null)r.add(o)}while(o!=null);throw new C("publication.not-found",`Publication ${JSON.stringify(n)} was not found.`)}async function Cu(e,t,n,r=60000){let o=Date.now()+r,i=t;while(!mC.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 C("run.wait-failed",a instanceof Error?a.message:String(a),{runId:i.runId})}}return{run:i,timedOut:!1}}function to(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 Fb(e){return new C(e.code,e.message,{status:e.status,...e.details})}async function Eu(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 C("publication.wait-failed",c instanceof Error?c.message:String(c),{flowId:t,operationId:s.operationId})}}return{operation:s,timedOut:!1}}var wC=new Set(Qi);function Zb(e){let t,n,r,o=bC(),i,s=[],a=[],c,l,u,d,h,g,y,S,A,N,M,D,fe,me,se,qe,Vt,tn,Lt,Mn=!1,Fn,so=!1,ss,as,qu=[],Vu="draft",cs,ls,us,ds,ps,Lu=[],Mu=!1,Fu=!1;for(let nn=0;nn<e.length;nn+=1){let Zn=e[nn],ao=Zn.startsWith("--")?Zn.indexOf("="):-1,P=ao<0?Zn:Zn.slice(0,ao),Jn=ao<0?void 0:Zn.slice(ao+1);if(Jn!=null&&["--json","--follow","--wait","--yes","--pending-wait"].includes(P))throw new C("cli.invalid-arguments",`${P} does not accept a value.`);if(P.startsWith("--")){let V=P.slice(2);if(a.includes(V)&&V!="set"&&V!="unset")throw new C("cli.invalid-arguments",`Duplicate option --${V}.`);a.push(V)}if(["--scope","--key","--space"].includes(P)){let V=Jn??e[++nn];if(V==null||V.startsWith("--"))throw new C("cli.invalid-arguments",`${P} requires a value.`);if(P==="--scope")t=V;else if(P==="--key")n=V;else r=V}else if(P=="--json")so=!0;else if(P=="--follow")Mn=!0;else if(P=="--wait")Mu=!0;else if(P=="--yes")Fu=!0;else if(P=="--pending-wait")cs=!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 V=Jn??e[nn+1];if(V==null||V.length==0||Jn==null&&V.startsWith("-")&&V!="-")throw new C("cli.invalid-arguments",`${P} requires a value.`);if(Jn==null)nn++;if(P=="--idempotency-key")o=V;else if(P=="--expected-publication")i=V;else if(P=="--revision")u=V;else if(P=="--publication")d=V;else if(P=="--pointer")h=V;else if(P=="--after")A=V;else if(P=="--code")M=V;else if(P=="--connection")D=V;else if(P=="--cron")fe=V;else if(P=="--description")se=V;else if(P=="--every")qe=V;else if(P=="--expected-revision")Vt=V;else if(P=="--file")tn=V;else if(P=="--flow")Lt=V;else if(P=="--name")as=V;else if(P=="--comment")us=V;else if(P=="--input")Fn=V;else if(P=="--trigger")c=V;else if(P=="--outputs")l=V;else if(P=="--cursor")me=V;else if(P=="--timezone")ps=V;else if(P=="--set")qu.push(V);else if(P=="--unset")Lu.push(V);else if(P=="--source"){if(V!="draft"&&V!="live")throw new C("cli.invalid-arguments","--source must be draft or live.");Vu=V}else if(P=="--status"){if(!wC.has(V))throw new C("cli.invalid-arguments",`Unknown Run status ${JSON.stringify(V)}.`);ls=V}else{let kt=Number(V),_w=P=="--offset"?0:1;if(!Number.isSafeInteger(kt)||kt<_w||P=="--limit"&&kt>100||P=="--max-bytes"&&kt>1048576)throw new C("cli.invalid-arguments",`${P} has an invalid value.`);if(P=="--limit")ss=kt;else if(P=="--offset")g=kt;else if(P=="--max-bytes")y=kt;else ds=kt}}else if(P.startsWith("-"))throw new C("cli.invalid-arguments",`Unknown option ${JSON.stringify(P)}.`);else s.push(P)}if(A!=null){if(s[0]=="runs"&&s[1]=="results")S=A;else if(N=Number(A),!Number.isSafeInteger(N)||N<0)throw new C("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},...g==null?{}:{offset:g},...h==null?{}:{pointer:h},...u==null?{}:{revision:u},...d==null?{}:{publication:d},...us==null?{}:{comment:us},...i==null?{}:{expectedPublication:i},...N==null?{}:{after:N},...M==null?{}:{code:M},...D==null?{}:{connection:D},...fe==null?{}:{cron:fe},...me==null?{}:{cursor:me},...se==null?{}:{description:se},...qe==null?{}:{every:qe},...Vt==null?{}:{expectedRevision:Vt},...tn==null?{}:{file:tn},...Lt==null?{}:{flow:Lt},follow:Mn,...Fn==null?{}:{input:Fn},json:so,...ss==null?{}:{limit:ss},...as==null?{}:{name:as},positionals:s,options:a,...c==null?{}:{trigger:c},...l==null?{}:{outputs:l},sets:qu,source:Vu,...ls==null?{}:{status:ls},...cs==null?{}:{pendingWait:cs},...ds==null?{}:{timeoutMs:ds},...ps==null?{}:{timezone:ps},unsets:Lu,wait:Mu,yes:Fu}}var vC=0.1,xC=3,no=rt("type",[x({type:w("focus"),nodeId:_().min(1)}),x({type:w("zoom"),zoom:U().min(vC).max(xC)}),x({type:w("pan"),dx:U(),dy:U()}),x({type:w("fit")})]);var Ou=_().trim().refine((e)=>[...e].length<=2000,"Wait comment must contain at most 2,000 Unicode code points.").nullable().optional();var qn=_().min(1),DC=Ae(),qC=x({kind:w("graph.trigger.create"),nodeId:qn,key:qn,connectionId:qn.optional(),name:qn.optional(),config:oe(qn,DC),schedule:zt.readonly().optional()});function ju(e){return Ht(e),R(lt()).min(1).parse(e).map((t,n)=>{let{kind:r}=Fr(t,n,E({kind:qn}).parse);return r=="graph.trigger.create"?Fr(t,n,qC.parse):yy(t,n)})}var Jb=[{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 Ub(e){return Hg(e).extend({name:_().trim().min(1).max(128)})}var Bb=Jb.flatMap((e)=>("source"in e)&&e.source!=null?[e.source]:[]),Kb=Y(Bb.map((e)=>Ub(e.createSchema))),Wb=Ub(Bb[0].updateSchema),Hb=x({version:w(1),expectedRevision:ke().positive()});var Gb={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."},LC=Object.keys(Gb),MC=LC.map((e)=>({name:e,description:Gb[e]}));var B1=x({comment:Ou}),Vn=Ae(),Se=_().min(1),he=w(1),ro=Se.refine((e)=>e==e.trim()&&Kr(e)==null,"Flow name is invalid."),oo=R(Se).transform((e)=>[...new Set(e)].toSorted()),ZC=Se.transform((e)=>e.trim()).refine((e)=>Kr(e)==null,"Tag name is invalid."),Qb=oe(_(),oe(_(),Vn)),Yb=x({nodeId:Se,outputs:oe(_(),Vn)}),X={readFlowState:Qg.extend({version:he}),canvas:x({command:no,version:he}),authoringCheck:eu,authoringEdit:Zr,authoringRead:Li,authoringSearch:Mi,authoringSchema:_y,loadOpenApiDocument:x({url:_().min(1).max(8192),version:he}),createEventSource:Kb,updateEventSource:Wb,eventSourceRevision:Hb,importFlow:x({file:Vn,name:ro.optional(),teamId:Se.optional(),tagIds:oo.optional(),version:he}),createFlow:x({name:ro,teamId:Se.optional(),tagIds:oo.optional(),presentation:oe(_(),Vn).optional(),version:he}),saveTag:x({name:ZC,version:he}),setFlowTags:x({tagIds:oo,version:he}),updateFlow:Y([x({name:ro,tagIds:oo.optional(),version:he}),x({name:ro.optional(),tagIds:oo,version:he})]),renameFlow:x({name:ro,version:he}),changeDraft:x({expectedRevisionId:Se,operations:R(Vn).min(1),version:he}),repairDraft:x({expectedRevisionId:Se,version:he}),upgradeDraft:x({expectedRevisionId:Se,version:he}),setEnabled:x({enabled:ye(),expectedPublicationId:Se,version:he}),updatePresentation:x({expectedRevision:ke().positive(),value:oe(_(),Vn),version:he}),checkFlow:x({engineContract:Se,version:he}),publishFlow:x({engineContract:Se,expectedLivePublicationId:Se.nullable(),version:he}),rollbackFlow:x({expectedLivePublicationId:Se,version:he}),createDraftRun:x({engineContract:Se,inputs:Qb,trigger:Yb,version:w(2)}),createLiveRun:x({publicationId:Se,inputs:Qb,trigger:Yb,version:w(2)}),resolveWait:x({action:F(["approve","continue","reject"]),comment:Ou,version:he}),putVariable:x({value:_().refine((e)=>new TextEncoder().encode(e).byteLength<=65536,"Variable value is too large.")}),queryConnectorAccessCandidates:x({providerIds:R(Se.max(256)).min(1).refine((e)=>new Set(e).size==e.length,"Duplicate provider IDs."),version:he}),removeConnectionUsage:x({connectionId:Se,expectedRevisionId:Se,expectedAccessRevision:ke().nonnegative(),version:he}),setConnectorService:x({expectedAccessRevision:ke().nonnegative(),version:he}),addProviderAccessBinding:x({accessBindingId:Se,expectedAccessRevision:ke().nonnegative(),version:he}),removeProviderAccessBinding:x({accessBindingId:Se,expectedAccessRevision:ke().nonnegative(),version:he}),versionOnly:x({version:he})};function te(e){return(t)=>e.parse(t)}var K1={readFlowState:te(X.readFlowState),canvas:te(X.canvas),authoringCheck:te(X.authoringCheck),authoringEdit:te(X.authoringEdit),authoringRead:te(X.authoringRead),authoringSearch:te(X.authoringSearch),authoringSchema:te(X.authoringSchema),loadOpenApiDocument:te(X.loadOpenApiDocument),createEventSource:te(X.createEventSource),updateEventSource:te(X.updateEventSource),eventSourceRevision:te(X.eventSourceRevision),importFlow:te(X.importFlow),createFlow:te(X.createFlow),saveTag:te(X.saveTag),setFlowTags:te(X.setFlowTags),updateFlow:te(X.updateFlow),renameFlow:te(X.renameFlow),changeDraft(e){let t=X.changeDraft.parse(e);return{...t,operations:ju(t.operations)}},repairDraft:te(X.repairDraft),upgradeDraft:te(X.upgradeDraft),setEnabled:te(X.setEnabled),updatePresentation:te(X.updatePresentation),checkFlow:te(X.checkFlow),publishFlow:te(X.publishFlow),rollbackFlow:te(X.rollbackFlow),createDraftRun:te(X.createDraftRun),createLiveRun:te(X.createLiveRun),resolveWait:te(X.resolveWait),putVariable:te(X.putVariable),queryConnectorAccessCandidates:te(X.queryConnectorAccessCandidates),removeConnectionUsage:te(X.removeConnectionUsage),setConnectorService:te(X.setConnectorService),addProviderAccessBinding:te(X.addProviderAccessBinding),removeProviderAccessBinding:te(X.removeProviderAccessBinding),versionOnly:te(X.versionOnly)};var _u=["expected-revision","idempotency-key"],Ru=["cursor","limit"],Xb=[["state show","<flow> --scope <draft|live> [--key <key>]",["scope","key"]],["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>]",Ru],["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>",_u],["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>",[..._u,"expected-publication","source","trigger","outputs","input","wait","timeout"]],["runs list","--flow <flow>",["flow","status","pending-wait",...Ru]],["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>",[..._u,"expected-publication","timeout"]],["publications list","<flow>",Ru],["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"]]],JC={scope:{description:"Required State scope; never defaults to live.",type:"string",enum:["draft","live"]},key:{description:"Business state key to read or clear; omit to inspect metadata or 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."},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 Au(e,t="oo flow"){let n=e.join(" ");return Xb.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","yes","pending-wait"].includes(s),repeatable:s=="set"||s=="unset"},JC[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 ew(e){return Xb.find(([t])=>t==e.slice(0,t.split(" ").length).join(" "))?.[2]}function tw(e="edits"){let t=tu(e);if(t!=null)return t;if(e=="edits")return nu();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 nu(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 Pu(e){if(e=="canvas")return{request:mn(no,{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 tu(e)}function nw(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=Pu(e);if(n==null)return UC(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 UC(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 KC}from"path";async function rw(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 C("cli.invalid-arguments",`Invalid arguments for connector ${i}. See --help.`);let u=BC(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 h=Number(n.at(-1));if(!Number.isSafeInteger(h)||h<0)throw new C("cli.invalid-arguments","Access revision must be a nonnegative integer.");if(i=="remove-usage"){let g=await Nb(e,t,r);d=await e.removeConnectionUsage(u,a,g.draft.revisionId,h,r.idempotencyKey)}else if(i=="code-allow")d=await e.addProviderAccessBinding(u,a,c[0],h);else d=await e.removeProviderAccessBinding(u,a,c[0],h)}Z(o,r.json,{...d,kind:`connector.${i}`},JSON.stringify(d,null,2));return}case"providers":{if(s!=null)throw new C("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector providers [--flow <flow>] [--json]`);let l=await e.listConnectorProviders(void 0,t?.flowId);Z(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 C("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector teams [--json]`);let l=await e.listConnectorTeams();Z(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 C("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 C("cli.invalid-arguments","Connector search query must contain 1\u2013256 characters.");let u=await e.searchConnectorActions(l,void 0,t?.flowId);Z(o,r.json,{actions:u.map(pu),kind:"connector.search",query:l,version:1},u.map(Iu).join(`
67
- `));return}case"show":{if(s==null||a!=null)throw new C("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector show <action> [--json]`);let l=await zb(e,s,t?.flowId);Z(o,r.json,{action:l,kind:"connector.show",version:1},Iu(l));return}case"connections":{if(s==null||a!=null)throw new C("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector connections <service> [--json]`);let l=await e.listConnectorConnections(s,void 0,t?.flowId);Z(o,r.json,{connections:l,kind:"connector.connections",serviceId:s,version:1},l.map(qb).join(`
68
- `));return}default:throw new C("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector <providers|teams|search|show|connections> ...`)}}async function ow(e,t,n,r){let[o,i,s]=t;switch(o){case"search":{if(s!=null)throw new C("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 C("cli.invalid-arguments","Trigger search query must contain 1\u2013256 characters.");let c=gu(await e.listTriggerKeys(),a);Z(r,n.json,{keys:c,kind:"trigger.search",query:a,version:1},c.map(Su).join(`
69
- `));return}case"show":{if(i==null||s!=null)throw new C("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger show <key> [--json]`);let a=await Db(e,i);Z(r,n.json,{definition:a,kind:"trigger.show",version:1},Su(a));return}default:throw new C("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger <search|show> ...`)}}function BC(e){if(e==null)throw new C("cli.invalid-arguments","A Flow reference is required.");return e.flowId}function rs(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 iw(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 xe(e,t[0]),i=await Mb(n,r),s=n.source=="live"?n.expectedPublication==null?await e.getLive(o.flowId):{publication:await eo(e,o.flowId,n.expectedPublication)}:void 0;if(n.source=="live"&&s?.publication==null)throw new C("live.not-found",`Flow ${JSON.stringify(t[0])} has no Live Publication.`);let a=s?.publication?.revisionId??n.expectedRevision??o.draftRevisionId,{triggers:c}=await e.getRevisionTriggers(o.flowId,a),l=c.filter((D)=>D.kind=="start"),u=l.length==1?l[0].triggerId:c.length==1&&c[0]?.kind=="manual"?c[0].triggerId:void 0,d=n.trigger??u;if(d==null)throw new C("run.trigger-required","Choose a start node with --trigger <name|id>.",{candidates:c.map(({triggerId:D,name:fe})=>({triggerId:D,name:fe}))});let h=c.find((D)=>D.triggerId==d),g=c.filter((D)=>D.name==d);if(h==null&&g.length>1)throw new C("trigger.ambiguous",`Trigger name ${JSON.stringify(d)} is ambiguous.`,{candidates:g.map(({triggerId:D,name:fe})=>({triggerId:D,name:fe}))});let y=h??g[0];if(y==null)throw new C("trigger.not-found",`Trigger ${JSON.stringify(d)} was not found.`);let S={};if(n.outputs!=null){let D=await Dn(n.outputs,"--outputs","run.input-unreadable",r);try{let fe=JSON.parse(D);if(fe==null||typeof fe!=="object"||Array.isArray(fe))throw Error("Expected output object.");S=fe}catch{throw new C("run.input-invalid","Trigger outputs must be valid JSON.")}}let A={nodeId:y.triggerId,outputs:S},N;if(s?.publication!=null)N=await e.createLiveRun(s.publication.publicationId,{inputs:i,trigger:A,idempotencyKey:n.idempotencyKey});else N=await e.createDraftRun(o.flowId,a,{inputs:i,trigger:A,idempotencyKey:n.idempotencyKey});let M=n.wait?await Cu(e,N,r,n.timeoutMs):{run:N,timedOut:!1};return Z(r,n.json,{kind:"run.create",idempotencyKey:n.idempotencyKey,...M,version:1},Yr(M.run)),to(M.run,M.timedOut)}async function sw(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 C("cli.invalid-arguments",`${r.commandPrefix??"oo flow"} runs list requires --flow <flow>.`);let s=await xe(e,n.flow),a=await e.listRuns(s.flowId,{...n.cursor==null?{}:{cursor:n.cursor},limit:n.limit??ku,...n.status==null?{}:{status:n.status},...n.pendingWait==null?{}:{pendingWait:n.pendingWait}});Z(r,n.json,{kind:"run.list",...a,version:1},a.runs.map(Vb).join(`
71
- `));return}case"show":{le(i,1,`${r.commandPrefix??"oo flow"} runs show <run> [--json]`);let s=await e.getRun(i[0]);Z(r,n.json,{kind:"run.show",run:s,version:1},Yr(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 Cu(e,c,r,Math.max(0,a-Date.now()));return Z(r,n.json,{kind:"run.wait",runId:s,...l,version:1},Yr(l.run)),to(l.run,l.timedOut)}catch(c){if(Date.now()>=a||c instanceof Error&&c.name=="TimeoutError")return Z(r,n.json,{kind:"run.wait",runId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(c instanceof C)throw c;throw new C("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 C("cli.invalid-arguments","Invalid Wait action.");let l=await e.resolveRunWait(s,a,c,n.comment);Z(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??ku},n.follow?AbortSignal.timeout(Math.max(1,c-Date.now())):void 0);if(a=u.nextAfter,Z(r,n.json,{...u,kind:"run.events",runId:s,version:1},u.events.map(Lb).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 to(l);if(n.after!=null&&u.events.length==0&&u.done)return to(l);if(l.waits.length>0)return Z(r,n.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!1,version:1},Yr(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 C("run.events-failed",u instanceof Error?u.message:String(u),{runId:s,nextAfter:a})}return Z(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);Z(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}});Z(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 Z(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]);Z(r,n.json,{cancellation:s,kind:"run.cancel",version:1},`${s.status} ${s.runId} ${s.cancelAccepted?"accepted":"already-terminal"}`);return}default:throw new C("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} runs <list|show|wait|resolve|events|result|results|read-result|download-result|cancel>`)}}async function aw(e,t,n,r){le(t,1,`${r.commandPrefix??"oo flow"} publish <flow> [--json]`);let o=await xe(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 Eu(e,o.flowId,s,r,n.timeoutMs);if(s=a.operation,s.status=="pending")return Z(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 C(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 eo(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}.`})}Z(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}`:Qr(d),...u==null?[]:[rs(u)],...c.map((h)=>`Warning: ${h.message}`)].join(`
73
- `))}async function cw(e,t,n,r){let[o,i,s,...a]=t;if(i==null||a.length>0)throw new C("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`);let c=await xe(e,i);if(o=="list"){if(s!=null)throw new C("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??xu});Z(r,n.json,{flow:c,kind:"publication.list",...l,version:1},l.publications.map(Qr).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 Eu(e,c.flowId,u,r,Math.max(0,l-Date.now())):{operation:u,timedOut:!1};return Z(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 Z(r,n.json,{kind:"publication.wait",flowId:c.flowId,operationId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(u instanceof C)throw u;throw new C("publication.wait-failed",u instanceof Error?u.message:String(u),{flowId:c.flowId,operationId:s})}}if(o=="show"&&s!=null){let l=await eo(e,c.flowId,s);Z(r,n.json,{kind:"publication.show",publication:l,version:1},Qr(l));return}throw new C("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`)}async function lw(e,t,n,r){le(t,2,`${r.commandPrefix??"oo flow"} rollback <flow> <publication> [--json]`);let o=await xe(e,t[0]),i=await eo(e,o.flowId,t[1]),s=n.expectedPublication??(await e.getLive(o.flowId)).publication?.publicationId;if(s==null)throw new C("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});Z(r,n.json,{kind:"publication.rollback",expectedPublicationId:s,idempotencyKey:n.idempotencyKey,publication:a,version:1},Qr(a))}async function uw(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 C("cli.invalid-arguments","Explicit --scope draft or --scope live is required.");let[s,a]=i;if(s!=="clear"&&!(o==="state"&&s==="show"))throw new C("cli.invalid-arguments","Unknown State operation.");if(s==="clear"&&!n.yes)throw new C("cli.invalid-arguments","Clearing State requires --yes.");let c=await xe(e,a);if(s==="show"){let l=n.key==null?await e.getFlowState(c.flowId,n.scope):await e.getFlowStateValues(c.flowId,n.scope,[n.key]);Z(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 C("cli.invalid-arguments","--space is required.");await e.clearFlowDedupe(c.flowId,n.scope,n.space)}Z(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 C("cli.invalid-arguments","Choose --input or --file.");let s=n.file==null?n.input:n.file=="-"?"-":`@${n.file}`;if(s==null)throw new C("cli.invalid-arguments","Canvas requires --input or --file.");let a=await Xr(s,r),c=await xe(e,i[0]),l=await e.broadcastCanvas(c.flowId,a);Z(r,n.json,{...l,kind:"flow.canvas"},`Broadcast canvas ${a.type} for ${c.flowId}; execution is not confirmed.`);return}case"read":case"search":case"edit":{if(le(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> [--input JSON|@file|-] [--file path|-] --json`),n.file!=null&&n.input!=null)throw new C("cli.invalid-arguments","Choose --input or --file.");let s=n.file==null?n.input:n.file=="-"?"-":`@${n.file}`,a=await Xr(s,r),c=a.requestId;if(o=="edit"&&(typeof c!="string"||c.length==0))throw new C("cli.invalid-arguments","Edit requires a non-empty requestId.");let l=await xe(e,i[0]),u=o=="read"?await e.readAuthoring(l.flowId,a):o=="search"?await e.searchAuthoring(l.flowId,a):await e.editAuthoring(l.flowId,a);r.stdout.write(`${JSON.stringify(u)}
75
- `);return}case"connector":{let a=["code-access","candidates","code-allow","code-remove","remove-usage"].includes(i[0]??"")?await WC(e,i.slice(1)):n.flow==null?void 0:await xe(e,n.flow);return await rw(e,a,i,n,r)}case"event-source":{if(i.length!=1||i[0]!="list")throw new C("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.`;Z(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 iw(e,i,n,r);case"runs":return await sw(e,i,n,r);case"publish":return await aw(e,i,n,r);case"publications":return await cw(e,i,n,r);case"rollback":return await lw(e,i,n,r);case"trigger":return await ow(e,i,n,r);case"open":case"workbench":{if(i.length>1)throw new C("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} ${o} [flow] [--json]`);if(t.getWorkbenchUrl==null)throw new C("workbench.unavailable","This CLI host cannot provide a Workbench URL.");let s=i[0]==null?void 0:await xe(e,i[0]),a=await t.getWorkbenchUrl(s?.flowId);if(o=="open")await r.openUrl(a);Z(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});Z(r,n.json,{...s,kind:"flow.list",version:1},s.flows.map(qt).join(`
77
- `));return}case"export":{le(i,1,`${r.commandPrefix??"oo flow"} export <flow>`);let s=await xe(e,i[0]);r.stdout.write(Qy(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 C("cli.invalid-arguments","Import requires --file <path|->.");let s=Gy(await Dn(n.file=="-"?"-":`@${n.file}`,"file","flow.import-unreadable",r)),a=n.name??s.name??(n.file=="-"?Bu(r.language??"en"):Yy(KC(n.file))),c=await e.importFlow(s,{name:ns(a,"Flow"),idempotencyKey:n.idempotencyKey});Z(r,n.json,{flow:c,idempotencyKey:n.idempotencyKey,kind:"flow.import",version:1},qt(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);Z(r,n.json,{flow:s,idempotencyKey:n.idempotencyKey,kind:"flow.create",version:1},qt(s));return}case"live":{le(i,1,`${r.commandPrefix??"oo flow"} live <flow> [--json]`);let s=await xe(e,i[0]),a=await e.getLiveDetails(s.flowId);Z(r,n.json,{kind:"flow.live",live:a,version:1},rs(a));return}case"show":{le(i,1,`${r.commandPrefix??"oo flow"} show <flow> [--json]`);let s=await xe(e,i[0]);Z(r,n.json,{flow:s,kind:"flow.show",version:1},qt(s));return}case"rename":{le(i,2,`${r.commandPrefix??"oo flow"} rename <flow> <new-name> [--json]`);let s=await xe(e,i[0]),a=await e.renameFlow(s.flowId,ns(i[1],"Flow"));Z(r,n.json,{flow:a,kind:"flow.rename",version:1},qt(a));return}case"delete":{if(le(i,1,`${r.commandPrefix??"oo flow"} delete <flow> --yes [--json]`),!n.yes)throw new C("flow.confirmation-required","Flow deletion requires --yes.");let s=await xe(e,i[0]),a=await e.deleteFlow(s.flowId);Z(r,n.json,{flow:a,kind:"flow.delete",version:1},qt(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 C("cli.invalid-arguments","--expected-publication must identify the observed Live publication.");let s=await xe(e,i[0]),a=await e.setFlowEnabled(s.flowId,n.expectedPublication,o=="enable");Z(r,n.json,{flow:a,kind:`flow.${o}`,version:1},qt(a));return}case"check":{le(i,1,`${r.commandPrefix??"oo flow"} check <flow> [--revision <revisionId>] [--json]`);let s=await xe(e,i[0]),a=n.revision??s.draftRevisionId,c=await e.checkAuthoring(s.flowId,a);return Z(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 C("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 WC(e,t){let n=t[0];if(n==null)throw new C("cli.invalid-arguments","A Flow reference is required.");return await xe(e,n)}var Ln={};var pw=(e)=>e,os=Object.is,HC=(e,t)=>{if(os(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(!os(e[r],t[r]))return!1;return!0},GC=(e)=>e.value,QC=(e)=>e.map(GC),YC=(e)=>e.$version,is=(e,t)=>{try{e(t)}catch(n){console.error(n)}},fw=(e,t)=>(e.set=t,e);var XC=Promise.resolve(),Tu=new Set,eE=new Set,io=Tu,$u,tE=()=>{let e=io;io=io===Tu?eE:Tu,$u=!1;for(let t of e)t.t();e.clear()},nE=(e)=>{io.add(e),$u=$u||XC.then(tE)},rE=(e)=>io.delete(e);var dw=new FinalizationRegistry(is),mw=class{constructor(e,t,n){if(this.#r=e,this.q=(t?.equal??os)||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)dw.register(this,this.#e=o)}}g=this;b=new Map;s=4;v;c=Ln;q;e;m;u=()=>{if(this.s&4){this.s&=-5;let e=this.#r();if(this.c===Ln)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])nE(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,rE(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(),dw.unregister(this),this.#e?.(),this.#o=!0,this.#t&&e!==Ln)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!==Ln&&t!==e)this.#t(t)}y(e){let t=this.c;if(this.c=this.v=e,this.#t&&t!==Ln&&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)is(t,this.c)}#o},oE=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()}},Nu=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 Nu(new oE(this.#e));return e&&this.set?fw(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 is(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}},iE=(e,t)=>{let n=e,o=new mw(()=>n,t),i=(a)=>{if(!o.q?.(a,n))n=a,o.n()};return[new Nu(o),i]},zu=(e,t)=>fw(...iE(e,t));var gw=(e,t,n)=>new Nu(new mw(e,n,t)),hw=(e,t=pw,n)=>{let r,o;return gw(()=>{let i=e.map(YC);if(!o||!HC(i,o))o=i,r=t(QC(e));return r},(i)=>{let s=e.map((a)=>a.$valCompute(i));return()=>s.forEach(is)},n)};var Du=(e,t=pw,n)=>{let r,o=Ln;return gw(()=>{let i=e.$version;if(!os(i,o))o=i,r=t(e.value);return r},(i)=>e.$valCompute(i),n)};var yw=(e,t={},n="")=>{for(let[r,o]of Object.entries(e))if(typeof o==="string")t[n+r]=o;else yw(o,t,n+r+".");return t},sE=(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("")}},bw=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$=zu(n),this.lang$=zu(t),this.locale$=hw([this.lang$,this.locales$],([i,s])=>s[i]||{}),this.a=Du(this.locale$,yw),this.t$=Du(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=sE(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 ww={help:{usage:"Usage: {{command}}",title:"Open Flow commands",options:"Options: --json, --cursor <cursor>, --limit <count>"}};var vw={help:{usage:"Utilisation : {{command}}",title:"Commandes Open Flow",options:"Options : --json, --cursor <cursor>, --limit <count>"}};var xw={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 kw={help:{usage:"\uC0AC\uC6A9\uBC95: {{command}}",title:"Open Flow \uBA85\uB839\uC5B4",options:"\uC635\uC158: --json, --cursor <cursor>, --limit <count>"}};var Sw={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 Iw={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9009\u9879\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var Cw={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9078\u9805\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var mE={en:ww,"zh-CN":Iw,"zh-TW":Cw,ja:xw,ko:kw,ru:Sw,fr:vw},gE=Object.fromEntries(ms.map((e)=>[e,mE[e]]));function Ew(e=Ju){return new bw(lo([e]),gE)}function hE(e,t){let n=t.filter((i)=>!i.startsWith("-")),r=Au(n,e.commandPrefix);while(r.length==0&&n.length>0)n.pop(),r=Au(n,e.commandPrefix);let o=Ew(e.language);try{let i=r.length==1?Pu(r[0].command):void 0,s=nw(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}
64
+ `)}function St(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?"":`
65
+ ${JSON.stringify(e.waits)}`}`}function Hb(e){return`${e.source} ${e.status} ${e.runId} ${e.revisionId}`}function Qb(e){return`${e.sequence} ${e.kind} ${JSON.stringify(e.payload)}`}async function Vn(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 to(e,t){if(e==null)return{};let n=await Vn(e,"input","flow.authoring-unreadable",t),r;try{r=JSON.parse(n)}catch{throw new E("cli.invalid-arguments","Input must be valid JSON.")}if(r==null||typeof r!="object"||Array.isArray(r))throw new E("cli.invalid-arguments","Input must be a JSON object.");return r}async function Yb(e,t){if(e.input==null)return{};let n=await Vn(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 no(e,t,n){let r=new Set,o;do{let i=await e.listPublications(t,{cursor:o,limit:Iu}),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 ju(e,t,n,r=60000){let o=Date.now()+r,i=t;while(!OC.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 ro(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 Xb(e){return new E(e.code,e.message,{status:e.status,...e.details})}async function _u(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 PC=new Set(Hi);function ew(e){let t=!1,n=[],r,o,i,s=AC(),a,c=[],l=[],u,d,h,g,y,S,A,N,L,D,fe,ge,se,qe,Lt,tn,Ft,nn,Zn,so=!1,ss,Fu=!1,as,cs,Mu=[],Zu="draft",ls,us,ds,ps,fs,Ju=[],Bu=!1,Uu=!1;for(let rn=0;rn<e.length;rn+=1){let Jn=e[rn],ao=Jn.startsWith("--")?Jn.indexOf("="):-1,P=ao<0?Jn:Jn.slice(0,ao),Bn=ao<0?void 0:Jn.slice(ao+1);if(Bn!=null&&["--json","--follow","--wait","--yes","--pending-wait","--include-dependencies"].includes(P))throw new E("cli.invalid-arguments",`${P} does not accept a value.`);if(P.startsWith("--")){let V=P.slice(2);if(l.includes(V)&&V!="set"&&V!="unset"&&V!="tag")throw new E("cli.invalid-arguments",`Duplicate option --${V}.`);l.push(V)}if(["--scope","--key","--space"].includes(P)){let V=Bn??e[++rn];if(V==null||V.startsWith("--"))throw new E("cli.invalid-arguments",`${P} requires a value.`);if(P==="--scope")r=V;else if(P==="--key")o=V;else i=V}else if(P=="--json")Fu=!0;else if(P=="--include-dependencies")t=!0;else if(P=="--follow")so=!0;else if(P=="--wait")Bu=!0;else if(P=="--yes")Uu=!0;else if(P=="--pending-wait")ls=!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=="--tag"||P=="--set"||P=="--unset"){let V=Bn??e[rn+1];if(V==null||V.length==0||Bn==null&&V.startsWith("-")&&V!="-")throw new E("cli.invalid-arguments",`${P} requires a value.`);if(Bn==null)rn++;if(P=="--idempotency-key")s=V;else if(P=="--expected-publication")a=V;else if(P=="--revision")h=V;else if(P=="--publication")g=V;else if(P=="--pointer")y=V;else if(P=="--after")L=V;else if(P=="--code")fe=V;else if(P=="--connection")ge=V;else if(P=="--cron")se=V;else if(P=="--description")Lt=V;else if(P=="--every")tn=V;else if(P=="--expected-revision")Ft=V;else if(P=="--file")nn=V;else if(P=="--flow")Zn=V;else if(P=="--name")cs=V;else if(P=="--comment")ds=V;else if(P=="--input")ss=V;else if(P=="--trigger")u=V;else if(P=="--outputs")d=V;else if(P=="--cursor")qe=V;else if(P=="--timezone")fs=V;else if(P=="--tag")n.push(V);else if(P=="--set")Mu.push(V);else if(P=="--unset")Ju.push(V);else if(P=="--source"){if(V!="draft"&&V!="live")throw new E("cli.invalid-arguments","--source must be draft or live.");Zu=V}else if(P=="--status"){if(!PC.has(V))throw new E("cli.invalid-arguments",`Unknown Run status ${JSON.stringify(V)}.`);us=V}else{let It=Number(V),Lw=P=="--offset"?0:1;if(!Number.isSafeInteger(It)||It<Lw||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")S=It;else if(P=="--max-bytes")A=It;else ps=It}}else if(P.startsWith("-"))throw new E("cli.invalid-arguments",`Unknown option ${JSON.stringify(P)}.`);else c.push(P)}if(L!=null){if(c[0]=="runs"&&c[1]=="results")N=L;else if(D=Number(L),!Number.isSafeInteger(D)||D<0)throw new E("cli.invalid-arguments","--after must be a non-negative event sequence.")}return{includeDependencies:t,tags:n,scope:r,key:o,space:i,idempotencyKey:s,...N==null?{}:{resultAfter:N},...A==null?{}:{maxBytes:A},...S==null?{}:{offset:S},...y==null?{}:{pointer:y},...h==null?{}:{revision:h},...g==null?{}:{publication:g},...ds==null?{}:{comment:ds},...a==null?{}:{expectedPublication:a},...D==null?{}:{after:D},...fe==null?{}:{code:fe},...ge==null?{}:{connection:ge},...se==null?{}:{cron:se},...qe==null?{}:{cursor:qe},...Lt==null?{}:{description:Lt},...tn==null?{}:{every:tn},...Ft==null?{}:{expectedRevision:Ft},...nn==null?{}:{file:nn},...Zn==null?{}:{flow:Zn},follow:so,...ss==null?{}:{input:ss},json:Fu,...as==null?{}:{limit:as},...cs==null?{}:{name:cs},positionals:c,options:l,...u==null?{}:{trigger:u},...d==null?{}:{outputs:d},sets:Mu,source:Zu,...us==null?{}:{status:us},...ls==null?{}:{pendingWait:ls},...ps==null?{}:{timeoutMs:ps},...fs==null?{}:{timezone:fs},unsets:Ju,wait:Bu,yes:Uu}}var TC=0.1,$C=3,oo=it("type",[v({type:b("focus"),nodeId:C().min(1)}),v({type:b("zoom"),zoom:B().min(TC).max($C)}),v({type:b("pan"),dx:B(),dy:B()}),v({type:b("fit")})]);var Ru=C().trim().refine((e)=>[...e].length<=2000,"Wait comment must contain at most 2,000 Unicode code points.").nullable().optional();var Ln=C().min(1),HC=Pe(),QC=v({kind:b("graph.trigger.create"),nodeId:Ln,key:Ln,connectionId:Ln.optional(),name:Ln.optional(),config:oe(Ln,HC),schedule:qt.readonly().optional()});function Au(e){return ft(e),R(rt()).min(1).parse(e).map((t,n)=>{let{kind:r}=Zr(t,n,O({kind:Ln}).parse);return r=="graph.trigger.create"?Zr(t,n,QC.parse):ky(t,n)})}var tw=[{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 nw(e){return Xg(e).extend({name:C().trim().min(1).max(128)})}var rw=tw.flatMap((e)=>("source"in e)&&e.source!=null?[e.source]:[]),ow=Y(rw.map((e)=>nw(e.createSchema))),iw=nw(rw[0].updateSchema),sw=v({version:b(1),expectedRevision:xe().positive()});var aw={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."},XC=Object.keys(aw),eE=XC.map((e)=>({name:e,description:aw[e]}));var pz=v({comment:Ru}),Fn=Pe(),Se=C().min(1),be=b(1),ts=Se.refine((e)=>e==e.trim()&&Wr(e)==null,"Flow name is invalid."),ns=R(Se).transform((e)=>[...new Set(e)].toSorted()),nE=Se.transform((e)=>e.trim()).refine((e)=>Wr(e)==null,"Tag name is invalid."),cw=oe(C(),oe(C(),Fn)),lw=v({nodeId:Se,outputs:oe(C(),Fn)}),X={readFlowState:th.extend({version:be}),canvas:v({command:oo,version:be}),authoringCheck:nu,authoringEdit:Jr,authoringRead:Li,authoringSearch:Fi,authoringSchema:Ty,loadOpenApiDocument:v({url:C().min(1).max(8192),version:be}),createEventSource:ow,updateEventSource:iw,eventSourceRevision:sw,importFlow:v({file:Fn,name:ts.optional(),teamId:Se.optional(),tagIds:ns.optional(),version:be}),createFlow:v({name:ts,teamId:Se.optional(),tagIds:ns.optional(),presentation:oe(C(),Fn).optional(),version:be}),saveTag:v({name:nE,version:be}),setFlowTags:v({tagIds:ns,version:be}),updateFlow:v({name:ts.optional(),icon:C().nullable().optional(),description:C().nullable().optional(),tagIds:ns.optional(),version:be}).refine((e)=>e.name!==void 0||e.icon!==void 0||e.description!==void 0||e.tagIds!==void 0,"Flow settings are empty."),renameFlow:v({name:ts,version:be}),changeDraft:v({expectedRevisionId:Se,operations:R(Fn).min(1),version:be}),repairDraft:v({expectedRevisionId:Se,version:be}),upgradeDraft:v({expectedRevisionId:Se,version:be}),setEnabled:v({enabled:he(),expectedPublicationId:Se,version:be}),updatePresentation:v({expectedRevision:xe().positive(),value:oe(C(),Fn),version:be}),checkFlow:v({engineContract:Se,version:be}),publishFlow:v({engineContract:Se,expectedLivePublicationId:Se.nullable(),version:be}),rollbackFlow:v({expectedLivePublicationId:Se,version:be}),createDraftRun:v({engineContract:Se,inputs:cw,trigger:lw,version:b(2)}),createLiveRun:v({publicationId:Se,inputs:cw,trigger:lw,version:b(2)}),resolveWait:v({action:Z(["approve","continue","reject"]),comment:Ru,version:be}),putVariable:v({value:C().refine((e)=>new TextEncoder().encode(e).byteLength<=65536,"Variable value is too large.")}),queryConnectorAccessCandidates:v({providerIds:R(Se.max(256)).min(1).refine((e)=>new Set(e).size==e.length,"Duplicate provider IDs."),version:be}),removeConnectionUsage:v({connectionId:Se,expectedRevisionId:Se,expectedAccessRevision:xe().nonnegative(),version:be}),setConnectorService:v({expectedAccessRevision:xe().nonnegative(),version:be}),addProviderAccessBinding:v({accessBindingId:Se,expectedAccessRevision:xe().nonnegative(),version:be}),removeProviderAccessBinding:v({accessBindingId:Se,expectedAccessRevision:xe().nonnegative(),version:be}),versionOnly:v({version:be})};function te(e){return(t)=>e.parse(t)}var fz={readFlowState:te(X.readFlowState),canvas:te(X.canvas),authoringCheck:te(X.authoringCheck),authoringEdit:te(X.authoringEdit),authoringRead:te(X.authoringRead),authoringSearch:te(X.authoringSearch),authoringSchema:te(X.authoringSchema),loadOpenApiDocument:te(X.loadOpenApiDocument),createEventSource:te(X.createEventSource),updateEventSource:te(X.updateEventSource),eventSourceRevision:te(X.eventSourceRevision),importFlow:te(X.importFlow),createFlow:te(X.createFlow),saveTag:te(X.saveTag),setFlowTags:te(X.setFlowTags),updateFlow:te(X.updateFlow),renameFlow:te(X.renameFlow),changeDraft(e){let t=X.changeDraft.parse(e);return{...t,operations:Au(t.operations)}},repairDraft:te(X.repairDraft),upgradeDraft:te(X.upgradeDraft),setEnabled:te(X.setEnabled),updatePresentation:te(X.updatePresentation),checkFlow:te(X.checkFlow),publishFlow:te(X.publishFlow),rollbackFlow:te(X.rollbackFlow),createDraftRun:te(X.createDraftRun),createLiveRun:te(X.createLiveRun),resolveWait:te(X.resolveWait),putVariable:te(X.putVariable),queryConnectorAccessCandidates:te(X.queryConnectorAccessCandidates),removeConnectionUsage:te(X.removeConnectionUsage),setConnectorService:te(X.setConnectorService),addProviderAccessBinding:te(X.addProviderAccessBinding),removeProviderAccessBinding:te(X.removeProviderAccessBinding),versionOnly:te(X.versionOnly)};var Pu=["expected-revision","idempotency-key"],Tu=["cursor","limit"],uw=[["state show","<flow> --scope <draft|live> [--key <key>]",["scope","key"]],["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>]",Tu],["export","<flow>",["include-dependencies"]],["import","--file <path|->",["file","name","idempotency-key","tag"]],["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>",Pu],["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>",[...Pu,"expected-publication","source","trigger","outputs","input","wait","timeout"]],["runs list","--flow <flow>",["flow","status","pending-wait",...Tu]],["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>",[...Pu,"expected-publication","timeout"]],["publications list","<flow>",Tu],["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"]]],rE={scope:{description:"Required State scope; never defaults to live.",type:"string",enum:["draft","live"]},key:{description:"Business state key to read or clear; omit to inspect metadata or 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"]},"include-dependencies":{description:"Include all referenced workflow drafts in one JSON bundle.",type:"boolean"},tag:{description:"Tag ID applied to every imported workflow; repeat to select multiple tags.",type:"string"},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."},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 $u(e,t="oo flow"){let n=e.join(" ");return uw.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","yes","pending-wait","include-dependencies"].includes(s),repeatable:s=="set"||s=="unset"||s=="tag"},rE[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 dw(e){return uw.find(([t])=>t==e.slice(0,t.split(" ").length).join(" "))?.[2]}function pw(e="edits"){let t=ru(e);if(t!=null)return t;if(e=="edits")return ou();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 ou(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 Nu(e){if(e=="canvas")return{request:gn(oo,{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 ru(e)}function fw(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=Nu(e);if(n==null)return oE(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 oE(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 sE}from"path";async function mw(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=iE(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 h=Number(n.at(-1));if(!Number.isSafeInteger(h)||h<0)throw new E("cli.invalid-arguments","Access revision must be a nonnegative integer.");if(i=="remove-usage"){let g=await Ub(e,t,r);d=await e.removeConnectionUsage(u,a,g.draft.revisionId,h,r.idempotencyKey)}else if(i=="code-allow")d=await e.addProviderAccessBinding(u,a,c[0],h);else d=await e.removeProviderAccessBinding(u,a,c[0],h)}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(`
66
+ `));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(`
67
+ `));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(gu),kind:"connector.search",query:l,version:1},u.map(Ou).join(`
68
+ `));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 Kb(e,s,t?.flowId);M(o,r.json,{action:l,kind:"connector.show",version:1},Ou(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(Gb).join(`
69
+ `));return}default:throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector <providers|teams|search|show|connections> ...`)}}async function gw(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=bu(await e.listTriggerKeys(),a);M(r,n.json,{keys:c,kind:"trigger.search",query:a,version:1},c.map(Eu).join(`
70
+ `));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 Wb(e,i);M(r,n.json,{definition:a,kind:"trigger.show",version:1},Eu(a));return}default:throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger <search|show> ...`)}}function iE(e){if(e==null)throw new E("cli.invalid-arguments","A Flow reference is required.");return e.flowId}function rs(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(`
71
+ `)}async function hw(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 ke(e,t[0]),i=await Yb(n,r),s=n.source=="live"?n.expectedPublication==null?await e.getLive(o.flowId):{publication:await no(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,{triggers:c}=await e.getRevisionTriggers(o.flowId,a),l=c.filter((D)=>D.kind=="start"),u=l.length==1?l[0].triggerId:c.length==1&&c[0]?.kind=="manual"?c[0].triggerId:void 0,d=n.trigger??u;if(d==null)throw new E("run.trigger-required","Choose a start node with --trigger <name|id>.",{candidates:c.map(({triggerId:D,name:fe})=>({triggerId:D,name:fe}))});let h=c.find((D)=>D.triggerId==d),g=c.filter((D)=>D.name==d);if(h==null&&g.length>1)throw new E("trigger.ambiguous",`Trigger name ${JSON.stringify(d)} is ambiguous.`,{candidates:g.map(({triggerId:D,name:fe})=>({triggerId:D,name:fe}))});let y=h??g[0];if(y==null)throw new E("trigger.not-found",`Trigger ${JSON.stringify(d)} was not found.`);let S={};if(n.outputs!=null){let D=await Vn(n.outputs,"--outputs","run.input-unreadable",r);try{let fe=JSON.parse(D);if(fe==null||typeof fe!=="object"||Array.isArray(fe))throw Error("Expected output object.");S=fe}catch{throw new E("run.input-invalid","Trigger outputs must be valid JSON.")}}let A={nodeId:y.triggerId,outputs:S},N;if(s?.publication!=null)N=await e.createLiveRun(s.publication.publicationId,{inputs:i,trigger:A,idempotencyKey:n.idempotencyKey});else N=await e.createDraftRun(o.flowId,a,{inputs:i,trigger:A,idempotencyKey:n.idempotencyKey});let L=n.wait?await ju(e,N,r,n.timeoutMs):{run:N,timedOut:!1};return M(r,n.json,{kind:"run.create",idempotencyKey:n.idempotencyKey,...L,version:1},eo(L.run)),ro(L.run,L.timedOut)}async function yw(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 ke(e,n.flow),a=await e.listRuns(s.flowId,{...n.cursor==null?{}:{cursor:n.cursor},limit:n.limit??Cu,...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(Hb).join(`
72
+ `));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 ju(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)),ro(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??Cu},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(Qb).join(`
73
+ `)),!n.follow)return;if(l=await e.getRun(s,AbortSignal.timeout(Math.max(1,c-Date.now()))),Bb(u.events.at(-1)))return ro(l);if(n.after!=null&&u.events.length==0&&u.done)return ro(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 bw(e,t,n,r){le(t,1,`${r.commandPrefix??"oo flow"} publish <flow> [--json]`);let o=await ke(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 _u(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 no(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?[]:[rs(u)],...c.map((h)=>`Warning: ${h.message}`)].join(`
74
+ `))}async function ww(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 ke(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??Iu});M(r,n.json,{flow:c,kind:"publication.list",...l,version:1},l.publications.map(Xr).join(`
75
+ `));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 _u(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 no(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 vw(e,t,n,r){le(t,2,`${r.commandPrefix??"oo flow"} rollback <flow> <publication> [--json]`);let o=await ke(e,t[0]),i=await no(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 kw(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 ke(e,a);if(s==="show"){let l=n.key==null?await e.getFlowState(c.flowId,n.scope):await e.getFlowStateValues(c.flowId,n.scope,[n.key]);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=await to(s,r),c=await ke(e,i[0]),l=await e.broadcastCanvas(c.flowId,a);M(r,n.json,{...l,kind:"flow.canvas"},`Broadcast canvas ${a.type} for ${c.flowId}; execution is not confirmed.`);return}case"read":case"search":case"edit":{if(le(i,1,`${r.commandPrefix??"oo flow"} ${o} <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}`,a=await to(s,r),c=a.requestId;if(o=="edit"&&(typeof c!="string"||c.length==0))throw new E("cli.invalid-arguments","Edit requires a non-empty requestId.");let l=await ke(e,i[0]),u=o=="read"?await e.readAuthoring(l.flowId,a):o=="search"?await e.searchAuthoring(l.flowId,a):await e.editAuthoring(l.flowId,a);r.stdout.write(`${JSON.stringify(u)}
76
+ `);return}case"connector":{let a=["code-access","candidates","code-allow","code-remove","remove-usage"].includes(i[0]??"")?await aE(e,i.slice(1)):n.flow==null?void 0:await ke(e,n.flow);return await mw(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(`
77
+ `));return}case"run":return await hw(e,i,n,r);case"runs":return await yw(e,i,n,r);case"publish":return await bw(e,i,n,r);case"publications":return await ww(e,i,n,r);case"rollback":return await vw(e,i,n,r);case"trigger":return await gw(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 ke(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(St).join(`
78
+ `));return}case"export":{le(i,1,`${r.commandPrefix??"oo flow"} export <flow>`);let s=await ke(e,i[0]);r.stdout.write(n.includeDependencies?cb(await e.exportFlowBundle(s.flowId)):eb(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=lb(await Vn(n.file=="-"?"-":`@${n.file}`,"file","flow.import-unreadable",r)),a=s.kind=="open-flow-workflow-bundle"?s.workflows.find((d)=>d.flowId==s.entryFlowId).file:s,c=n.name??a.name??(n.file=="-"?Hu(r.language??"en"):tb(sE(n.file))),l={name:es(c,"Flow"),idempotencyKey:n.idempotencyKey,...n.tags.length?{tagIds:n.tags}:{}};if(s.kind=="open-flow-workflow-bundle"){let d=await e.importFlowBundle(s,l);M(r,n.json,{...d,idempotencyKey:n.idempotencyKey,kind:"flow.import"},d.flows.map(St).join(`
79
+ `));return}let u=await e.importFlow(s,l);M(r,n.json,{flow:u,idempotencyKey:n.idempotencyKey,kind:"flow.import",version:1},St(u));return}case"create":{le(i,1,`${r.commandPrefix??"oo flow"} create <name> [--json]`);let s=await e.createFlow(es(i[0],"Flow"),n.idempotencyKey);M(r,n.json,{flow:s,idempotencyKey:n.idempotencyKey,kind:"flow.create",version:1},St(s));return}case"live":{le(i,1,`${r.commandPrefix??"oo flow"} live <flow> [--json]`);let s=await ke(e,i[0]),a=await e.getLiveDetails(s.flowId);M(r,n.json,{kind:"flow.live",live:a,version:1},rs(a));return}case"show":{le(i,1,`${r.commandPrefix??"oo flow"} show <flow> [--json]`);let s=await ke(e,i[0]);M(r,n.json,{flow:s,kind:"flow.show",version:1},St(s));return}case"rename":{le(i,2,`${r.commandPrefix??"oo flow"} rename <flow> <new-name> [--json]`);let s=await ke(e,i[0]),a=await e.renameFlow(s.flowId,es(i[1],"Flow"));M(r,n.json,{flow:a,kind:"flow.rename",version:1},St(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 ke(e,i[0]),a=await e.deleteFlow(s.flowId);M(r,n.json,{flow:a,kind:"flow.delete",version:1},St(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 ke(e,i[0]),a=await e.setFlowEnabled(s.flowId,n.expectedPublication,o=="enable");M(r,n.json,{flow:a,kind:`flow.${o}`,version:1},St(a));return}case"check":{le(i,1,`${r.commandPrefix??"oo flow"} check <flow> [--revision <revisionId>] [--json]`);let s=await ke(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 aE(e,t){let n=t[0];if(n==null)throw new E("cli.invalid-arguments","A Flow reference is required.");return await ke(e,n)}var Mn={};var Sw=(e)=>e,os=Object.is,cE=(e,t)=>{if(os(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(!os(e[r],t[r]))return!1;return!0},lE=(e)=>e.value,uE=(e)=>e.map(lE),dE=(e)=>e.$version,is=(e,t)=>{try{e(t)}catch(n){console.error(n)}},Iw=(e,t)=>(e.set=t,e);var pE=Promise.resolve(),zu=new Set,fE=new Set,io=zu,Du,mE=()=>{let e=io;io=io===zu?fE:zu,Du=!1;for(let t of e)t.t();e.clear()},gE=(e)=>{io.add(e),Du=Du||pE.then(mE)},hE=(e)=>io.delete(e);var xw=new FinalizationRegistry(is),Cw=class{constructor(e,t,n){if(this.#r=e,this.q=(t?.equal??os)||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)xw.register(this,this.#e=o)}}g=this;b=new Map;s=4;v;c=Mn;q;e;m;u=()=>{if(this.s&4){this.s&=-5;let e=this.#r();if(this.c===Mn)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])gE(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,hE(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(),xw.unregister(this),this.#e?.(),this.#o=!0,this.#t&&e!==Mn)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!==Mn&&t!==e)this.#t(t)}y(e){let t=this.c;if(this.c=this.v=e,this.#t&&t!==Mn&&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)is(t,this.c)}#o},yE=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()}},qu=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 qu(new yE(this.#e));return e&&this.set?Iw(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 is(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}},bE=(e,t)=>{let n=e,o=new Cw(()=>n,t),i=(a)=>{if(!o.q?.(a,n))n=a,o.n()};return[new qu(o),i]},Vu=(e,t)=>Iw(...bE(e,t));var Ew=(e,t,n)=>new qu(new Cw(e,n,t)),Ow=(e,t=Sw,n)=>{let r,o;return Ew(()=>{let i=e.map(dE);if(!o||!cE(i,o))o=i,r=t(uE(e));return r},(i)=>{let s=e.map((a)=>a.$valCompute(i));return()=>s.forEach(is)},n)};var Lu=(e,t=Sw,n)=>{let r,o=Mn;return Ew(()=>{let i=e.$version;if(!os(i,o))o=i,r=t(e.value);return r},(i)=>e.$valCompute(i),n)};var jw=(e,t={},n="")=>{for(let[r,o]of Object.entries(e))if(typeof o==="string")t[n+r]=o;else jw(o,t,n+r+".");return t},wE=(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("")}},_w=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$=Vu(n),this.lang$=Vu(t),this.locale$=Ow([this.lang$,this.locales$],([i,s])=>s[i]||{}),this.a=Lu(this.locale$,jw),this.t$=Lu(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=wE(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 Rw={help:{usage:"Usage: {{command}}",title:"Open Flow commands",options:"Options: --json, --cursor <cursor>, --limit <count>"}};var Aw={help:{usage:"Utilisation : {{command}}",title:"Commandes Open Flow",options:"Options : --json, --cursor <cursor>, --limit <count>"}};var Pw={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 Tw={help:{usage:"\uC0AC\uC6A9\uBC95: {{command}}",title:"Open Flow \uBA85\uB839\uC5B4",options:"\uC635\uC158: --json, --cursor <cursor>, --limit <count>"}};var $w={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 Nw={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9009\u9879\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var zw={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9078\u9805\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var OE={en:Rw,"zh-CN":Nw,"zh-TW":zw,ja:Pw,ko:Tw,ru:$w,fr:Aw},jE=Object.fromEntries(gs.map((e)=>[e,OE[e]]));function Dw(e=Wu){return new _w(lo([e]),jE)}function _E(e,t){let n=t.filter((i)=>!i.startsWith("-")),r=$u(n,e.commandPrefix);while(r.length==0&&n.length>0)n.pop(),r=$u(n,e.commandPrefix);let o=Dw(e.language);try{let i=r.length==1?Nu(r[0].command):void 0,s=fw(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
80
  Options: ${c.options.map((l)=>l.name+(l.value?" <value>":"")+(l.description==null?"":`: ${l.description}`)).join(`
79
81
  `)}`),"",o.t("help.options"),"",...a.notes,"",...s].join(`
80
- `)}finally{o.dispose()}}function yE(e){return e.length==0||e.includes("--help")||e.includes("-h")}function bE(e){return e.positionals[0]=="schema"&&e.flow==null}async function Ow(e,t,n){let r,o;try{if(yE(e))return n.stdout.write(`${hE(n,e)}
81
- `),0;r=Zb(e);let i=ew(r.positionals);if(i==null)throw new C("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 C("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 C("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 C("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 C("cli.invalid-arguments","--timeout requires --wait for run.");if(r.timeoutMs!=null&&r.positionals[0]=="runs"&&r.positionals[1]=="events"&&!r.follow)throw new C("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 C("cli.invalid-arguments","Use --expected-revision for draft runs and --expected-publication for live runs.");if(bE(r)){if(r.positionals.length>2)throw new C("cli.invalid-arguments",`Usage: ${n.commandPrefix??"oo flow"} schema [read|search|edit|check|edits|node-type|input|outputs]`);let a=tw(r.positionals[1]);if(a==null)throw new C("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 vu(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]}:await Xr(r.input,n),c=await xe(s,r.flow);return n.stdout.write(`${JSON.stringify(await s.authoringSchema(c.flowId,a))}
83
- `),0}return await uw(s,t,r,n)??0}catch(i){let s;if(i instanceof C)s=i;else if(i instanceof Te)s=Fb(i);else s=new C("flow.unexpected",i instanceof Error?i.message:String(i));if(o!=null&&(!(i instanceof Te)&&!(i instanceof C)||i instanceof Te&&i.code=="response.invalid"))s=new C("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})}
82
+ `)}finally{o.dispose()}}function RE(e){return e.length==0||e.includes("--help")||e.includes("-h")}function AE(e){return e.positionals[0]=="schema"&&e.flow==null}async function qw(e,t,n){let r,o;try{if(RE(e))return n.stdout.write(`${_E(n,e)}
83
+ `),0;r=ew(e);let i=dw(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(AE(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=pw(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)}
84
+ `),0}let s=new Su(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]}:await to(r.input,n),c=await ke(s,r.flow);return n.stdout.write(`${JSON.stringify(await s.authoringSchema(c.flowId,a))}
85
+ `),0}return await kw(s,t,r,n)??0}catch(i){let s;if(i instanceof E)s=i;else if(i instanceof _e)s=Xb(i);else s=new E("flow.unexpected",i instanceof Error?i.message:String(i));if(o!=null&&(!(i instanceof _e)&&!(i instanceof E)||i instanceof _e&&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
86
  `);else n.stderr.write(`${s.code}: ${s.message}
85
- `);return 1}}async function kE(e){let t=process.platform=="darwin"?["open",e]:process.platform=="win32"?["rundll32","url.dll,FileProtocolHandler",e]:["xdg-open",e],n=wE(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 jw(e,t,n){if(e.includes("--version")||e.includes("-v"))return process.stdout.write(e.includes("--json")?`${JSON.stringify({version:n.version})}
87
+ `);return 1}}async function NE(e){let t=process.platform=="darwin"?["open",e]:process.platform=="win32"?["rundll32","url.dll,FileProtocolHandler",e]:["xdg-open",e],n=PE(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 Vw(e,t,n){if(e.includes("--version")||e.includes("-v"))return process.stdout.write(e.includes("--json")?`${JSON.stringify({version:n.version})}
86
88
  `:`${n.version}
87
- `),0;return await Ow(e,{request:t.cloudRequest??(async()=>{throw new C("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:kE,readFile:async(r)=>await vE(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 xE(r)})}async function iD(e,t={}){return await jw(e,t,{version:Zu})}export{iD as runOpenFlowCommand};
89
+ `),0;return await qw(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:NE,readFile:async(r)=>await TE(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 $E(r)})}async function CD(e,t={}){return await Vw(e,t,{version:Ku})}export{CD as runOpenFlowCommand};