@npayload/sdk 0.0.0-stage → 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +156 -2
- package/dist/chunk-22PYMXSS.mjs +1 -0
- package/dist/chunk-26BFOUGE.mjs +1 -0
- package/dist/chunk-2N25V56J.mjs +20 -0
- package/dist/chunk-2OCUKD3K.mjs +1 -0
- package/dist/chunk-2PCG57PX.mjs +1 -0
- package/dist/chunk-2XQXDEXA.mjs +1 -0
- package/dist/chunk-455C67EN.mjs +1 -0
- package/dist/chunk-4HVQZC7R.mjs +1 -0
- package/dist/chunk-4NWQCPI4.mjs +1 -0
- package/dist/chunk-52ZB3ZAG.mjs +1 -0
- package/dist/chunk-5SMWYS7Z.mjs +1 -0
- package/dist/chunk-5YK2JKKH.mjs +17 -0
- package/dist/chunk-6NCRQ746.mjs +9 -0
- package/dist/chunk-6RMN6EHY.mjs +1 -0
- package/dist/chunk-6ZOPXG44.mjs +64 -0
- package/dist/chunk-76OM2ZBO.mjs +5 -0
- package/dist/chunk-A7HA64P6.mjs +1 -0
- package/dist/chunk-APBVAT7F.mjs +1 -0
- package/dist/chunk-BBHWYMQA.mjs +1 -0
- package/dist/chunk-BMMAZIUY.mjs +1 -0
- package/dist/chunk-CJDCY2NH.mjs +1 -0
- package/dist/chunk-EL7XOWA4.mjs +1 -0
- package/dist/chunk-EXNCOEHS.mjs +1 -0
- package/dist/chunk-FAO3QJC5.mjs +1 -0
- package/dist/chunk-FNAZW7X3.mjs +3 -0
- package/dist/chunk-GEJT7NMK.mjs +1 -0
- package/dist/chunk-GGXNXM73.mjs +1 -0
- package/dist/chunk-GKDZ7663.mjs +1 -0
- package/dist/chunk-HTQLUO4J.mjs +1 -0
- package/dist/chunk-II74EBLQ.mjs +1 -0
- package/dist/chunk-JBAV2AQK.mjs +1 -0
- package/dist/chunk-KUJJYP3K.mjs +22 -0
- package/dist/chunk-LJNU5QHZ.mjs +1 -0
- package/dist/chunk-LT2DQLXJ.mjs +1 -0
- package/dist/chunk-MDW42OG6.mjs +8 -0
- package/dist/chunk-MPYL6HQR.mjs +1 -0
- package/dist/chunk-OA73YMB6.mjs +6 -0
- package/dist/chunk-PKG2R6XN.mjs +1 -0
- package/dist/chunk-QUJ2IZXU.mjs +1 -0
- package/dist/chunk-RIBBVOCC.mjs +1 -0
- package/dist/chunk-TQFAYJEP.mjs +4 -0
- package/dist/chunk-UMQ2SWSM.mjs +5 -0
- package/dist/chunk-WE3NRBO6.mjs +1 -0
- package/dist/chunk-XLK55DEY.mjs +1 -0
- package/dist/chunk-YHY7Y4HD.mjs +4 -0
- package/dist/chunk-YQVQTVHK.mjs +2 -0
- package/dist/cli/index.d.mts +54 -0
- package/dist/cli/index.d.ts +54 -0
- package/dist/cli/index.js +852 -0
- package/dist/cli/index.mjs +696 -0
- package/dist/events/index.d.mts +10 -0
- package/dist/events/index.d.ts +10 -0
- package/dist/events/index.js +1 -0
- package/dist/events/index.mjs +1 -0
- package/dist/index.d.mts +49687 -0
- package/dist/index.d.ts +49687 -0
- package/dist/index.js +2 -0
- package/dist/index.mjs +2 -0
- package/package.json +120 -4
|
@@ -0,0 +1,696 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as Pn,b as on,c as bh,d as wh,e as xh,f as cn,g as Pt,h as Jh,i as yc,j as Sr,k as Cn,m as Kh}from"../chunk-5YK2JKKH.mjs";import{a as vc,b as Ir,c as bc,g as Wh}from"../chunk-2N25V56J.mjs";import"../chunk-MDW42OG6.mjs";import{a as ei,b as Ch,c as Rh,d as Oh}from"../chunk-MPYL6HQR.mjs";import"../chunk-6RMN6EHY.mjs";import"../chunk-RIBBVOCC.mjs";import{b as Zh,c as Gh}from"../chunk-76OM2ZBO.mjs";import"../chunk-2OCUKD3K.mjs";import{A as Fh,B as An,C as mc,D as $r,E as qh,F as Ke,G as le,I as It,J as Vh,Q as gc,R as dt,S as hc,X as Bh,Y as xe,Z as We,a as Y,b as ph,c as mh,d as ut,e as yh,h as Xo,i as kh,j as _h,l as Nh,m as Dh,n as jh,o as En,p as Uh,q as ti,r as _r,s as un,t as Tn,u as dc,v as ni,w as Lh,x as zh,y as pc,z as Mh}from"../chunk-6ZOPXG44.mjs";import{a as lc,c as kr}from"../chunk-TQFAYJEP.mjs";import"../chunk-4NWQCPI4.mjs";import{c as fc}from"../chunk-KUJJYP3K.mjs";import"../chunk-FAO3QJC5.mjs";import{a as we}from"../chunk-455C67EN.mjs";import{a as ac,b as Yg,c as Qg,e as Xg,f as eh,g as th,h as cc,i as nh,j as rh,l as ih}from"../chunk-II74EBLQ.mjs";import"../chunk-CJDCY2NH.mjs";import{a as sh,c as ah,f as ch}from"../chunk-2XQXDEXA.mjs";import{d as uh,e as Yo,h as lh,k as dh}from"../chunk-XLK55DEY.mjs";import{a as fh,b as C,c as gh,e as Ie,f as se,h as hh,i as de}from"../chunk-UMQ2SWSM.mjs";import{a as sn,b as uc,c as vh,d as an,e as Qo,f as xr,g as Th,h as lt,j as Me,l as Ah}from"../chunk-FNAZW7X3.mjs";import{a as ne,b as $h,c as Sh,d as Ih,e as ze,f as wr,g as Ph}from"../chunk-YQVQTVHK.mjs";import{e as Eh}from"../chunk-OA73YMB6.mjs";import{a as oh}from"../chunk-GKDZ7663.mjs";import"../chunk-BMMAZIUY.mjs";import{b as Nt,c as In,d as Hg,e as rn,f as Ho,g as F}from"../chunk-WE3NRBO6.mjs";import{B as Bg,O as ic,Q as Jg,R as Ko,Z as sc,a as Go,c as Dg,d as Vo,da as be,e as jg,g as Ug,ga as Kg,h as Lg,ha as Wo,i as zg,ia as Wg,j as Mg,k as Fg,m as rc,n as oc,o as Bo,p as Jo,t as qg,v as Zg,x as Gg,z as Vg}from"../chunk-YHY7Y4HD.mjs";import"../chunk-GGXNXM73.mjs";import{a,c as St}from"../chunk-LJNU5QHZ.mjs";import{Command as cA}from"commander";import{realpathSync as uA}from"fs";import{pathToFileURL as lA}from"url";var Hh={"POST /v1/subscriptions/:subscriptionId/queue/purge":{confirm:"Purge ALL buffered messages in this queue? This cannot be undone."},"POST /v1/dlq/:dlqEntryId/discard":{confirm:"Discard this DLQ entry? The message will not be redelivered."},"POST /v1/dlq/discard":{confirm:"Bulk-discard DLQ entries? Discarded messages will not be redelivered."}};function Yh(e){return Hh[e]}a(Yh,"getOverride");var hA=Object.keys(Hh);var ge={OK:0,USER_ERROR:1,AUTH_ERROR:2,SERVER_ERROR:3,NETWORK_ERROR:4,PROTOCOL_ERROR:5},ck={auth:ge.AUTH_ERROR,deferred:ge.SERVER_ERROR,admission:ge.USER_ERROR,protocol:ge.PROTOCOL_ERROR},ey=`
|
|
3
|
+
Exit codes
|
|
4
|
+
0 ok
|
|
5
|
+
1 user error (bad args, missing file, a 4xx refusal of the request as issued)
|
|
6
|
+
2 auth error (no token, expired, scope missing \u2014 401 / 403)
|
|
7
|
+
3 server error (5xx, 429/408 after the kernel's retries)
|
|
8
|
+
4 network error (DNS, connection refused, TLS, timeout)
|
|
9
|
+
5 protocol error (an NPP answer that breaks the protocol: a malformed frame, an unsupported version or QoS, a code no registry holds)
|
|
10
|
+
`,Qh=new Set(["ECONNREFUSED","ECONNRESET","ENOTFOUND","EAI_AGAIN","ETIMEDOUT","EHOSTUNREACH","ENETUNREACH","EPIPE","UND_ERR_CONNECT_TIMEOUT","UND_ERR_SOCKET","UND_ERR_HEADERS_TIMEOUT"]),uk=new Set(["AuthError","AuthenticationError","InsufficientScopeError","AuthScopeError"]),lk=/^(?:UNAUTHENTICATED|UNAUTHORIZED|FORBIDDEN|FORBIDDEN_SCOPE|INSUFFICIENT_SCOPE|TOKEN_EXPIRED|INVALID_TOKEN|MISSING_TOKEN|DPOP_[A-Z_]+|AUTHENTICATION_ERROR|SCOPE_[A-Z_]+)$/i,Xh=a(e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,"asNumber"),wc=a(e=>typeof e=="string"?e:void 0,"asString");function Dt(e){if(e instanceof Y)return ge.USER_ERROR;if(e instanceof Wo)return ge.PROTOCOL_ERROR;if(e instanceof Kg)return ck[Ko(e.refusal.name)];if(e instanceof Mg||e instanceof Fg||e instanceof qg)return ge.NETWORK_ERROR;if(e instanceof Vo||e instanceof jg||e instanceof Bo||e instanceof Jo)return ge.AUTH_ERROR;if(e instanceof Dg)return e.isRetryable()?ge.SERVER_ERROR:ge.USER_ERROR;let t=e??{},r=wc(t.code),o=wc(t.cause?.code);if(r&&Qh.has(r)||o&&Qh.has(o))return ge.NETWORK_ERROR;let n=wc(t.name);if(n&&uk.has(n))return ge.AUTH_ERROR;let i=Xh(t.status)??Xh(t.statusCode);return i!==void 0?i===401||i===403?ge.AUTH_ERROR:i>=500&&i<600?ge.SERVER_ERROR:ge.USER_ERROR:r&&lk.test(r)?ge.AUTH_ERROR:ge.USER_ERROR}a(Dt,"exitCodeFor");var ty="Settings > Security > Networks",dk="Developers > API keys";function ri(e,t){if(e===null||typeof e!="object")return;let r=e;if(t(r.code))return r.code;if(t(r.upstreamCode))return r.upstreamCode}a(ri,"ruleCodeOf");function xc(e){return e instanceof Bo?!0:ri(e,rc)!==void 0}a(xc,"isSourceRefusal");function kc(e){return e instanceof Jo?!0:ri(e,oc)!==void 0}a(kc,"isFingerprintRefusal");async function ny(e,t,r=3e3,o){let n;try{n=new URL("/cdn-cgi/trace",e).toString()}catch{return}try{let s=await Nt(t,o)(n,{method:"GET",signal:AbortSignal.timeout(r)});if(!s.ok)return;let c=await s.text();for(let u of c.split(/\r?\n/)){if(!u.startsWith("ip="))continue;let l=u.slice(3).trim();return pk(l)?l:void 0}return}catch{return}}a(ny,"addressThisMachineReachesNpayloadFrom");function pk(e){return/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/.test(e)?!0:/^[0-9a-f:]+$/i.test(e)&&e.includes(":")&&e.length<=39}a(pk,"isAddress");function mk(e){return e.includes(":")?`${e}/128`:`${e}/32`}a(mk,"hostNetworkOf");function _c(e,t){let r=ri(e,rc)??"source_network_not_allowed",o=r.toLowerCase()==="source_network_not_declared",n=t!==void 0?`this machine reaches npayload from ${t}, which`:"the network this call came from",i=o?`npayload refused this request: this app environment has no network yet, so its keys cannot be used${t!==void 0?` (this machine reaches npayload from ${t})`:""}.`:`npayload refused this request: ${n} is not a network of this app environment.`,s=t!==void 0?`Add ${mk(t)} in the dashboard under ${ty}, then run the command again.`:`Add the network this machine uses in the dashboard under ${ty}, then run the command again. Open the API host's /cdn-cgi/trace page on this machine to see the address npayload sees.`;return new C(i,{code:r,hint:s,cause:e})}a(_c,"sourceRefusalCliError");function $c(e){let t=ri(e,oc)??"thumbprint_not_bound",r=e.fingerprint,o=typeof r=="string"&&r.length>0?` (${r})`:"";return new C(`npayload refused this request: the key fingerprint this machine presents${o} is not enrolled for this API key.`,{code:t,hint:`Open the API key's enrollment window in the dashboard under ${dk}, then run the command again from a network of this app environment.`,cause:e})}a($c,"fingerprintRefusalCliError");async function ry(e,t){if(xc(e)){let r=t!==void 0?await t().catch(()=>{}):void 0;return _c(e,r)}if(kc(e))return $c(e)}a(ry,"callerRefusalCliError");var Sc={LIMIT_EXCEEDED:{message:"You've reached your plan's limit for this resource.",hint:"Upgrade your plan in the dashboard (Settings \u2192 Billing) to raise the limit."},TIER_LIMIT_EXCEEDED:{message:"You've reached your plan's limit for this resource.",hint:"Archive an unused one to free a slot, or upgrade your plan in the dashboard (Settings \u2192 Billing) to raise the limit."},PER_RUN_LIMIT_EXCEEDED:{message:"This request is too large for a single run.",hint:"Shorten the message, or split the task into smaller steps."},CAPABILITY_REQUIRED:{message:"This feature isn't included in your current plan.",hint:"Upgrade your plan in the dashboard (Settings \u2192 Billing) to unlock it."},BILLING_LIMIT:{message:"You've used your plan's monthly allowance.",hint:"Upgrade your plan, or wait for the next billing cycle."},BUDGET_EXCEEDED:{message:"Your AI budget for this period has been used.",hint:"Raise the budget in the dashboard, or upgrade your plan."},BUDGET_CAP_EXCEEDED:{message:"Your organization's daily AI spending cap has been reached.",hint:"Try again tomorrow, or raise the cap in the dashboard."},RATE_LIMITED:{message:"Too many requests right now.",hint:"Wait a moment and try again."},SECURITY_BLOCKED:{message:"This input was blocked by safety checks.",hint:"Rephrase the request and try again."},NOT_FOUND:{message:"We couldn't find that. It may have been moved or removed."},FORBIDDEN:{message:"You don't have permission to do that.",hint:"Ask an organization admin to grant access if you think you should have it."},PERMISSION_DENIED:{message:"You don't have permission to do that.",hint:"Ask an organization admin to grant access if you think you should have it."},INSUFFICIENT_SCOPE:{message:"This credential doesn't have the scope needed for that.",hint:"Re-provision the credential with the required scope."},UNAUTHORIZED:{message:"You're not signed in.",hint:"Run: np login"},UNAUTHENTICATED:{message:"Your session has expired.",hint:"Run: np login"},INVALID_ARGUMENT:{message:"Some of the provided values weren't valid. Check the flags and try again."},VALIDATION_ERROR:{message:"Some of the provided values weren't valid. Check the flags and try again."},INVALID_STATE:{message:"That action isn't possible right now \u2014 the item may have changed. Re-fetch and try again."},CONFLICT:{message:"That change conflicts with the current state. Re-fetch and try again."},EXPIRED:{message:"This item or link has expired. Request a new one and try again."},RUN_START_TIMEOUT:{message:"The agent didn't start in time.",hint:"Try again \u2014 if this keeps happening, contact support."},INTERNAL:{message:"Something went wrong on our side. Please try again \u2014 the error has been logged."},INTERNAL_ERROR:{message:"Something went wrong on our side. Please try again \u2014 the error has been logged."}};function oi(e){if(e instanceof C)return e;if(xc(e))return _c(e,void 0);if(kc(e))return $c(e);let t=ih(e);if(t)return new C(t.reason??"This request was refused by your plan's current state.",{code:t.code,hint:"Upgrade your plan to continue",docs:t.upgradeUrl,cause:e});let r=e?.code;if(typeof r=="string"){let o=Sc[r]??Sc[r.toUpperCase()];if(o)return new C(o.message,{code:r,hint:o.hint,docs:o.docs,cause:e})}return e}a(oi,"toFriendlyCliError");function oy(e){let t=e.kind??e.code,r=t?Sc[t]:void 0;return r||{message:e.message??"The agent run failed. Please try again."}}a(oy,"friendlyStreamErrorLine");function Ic(e,t){let r=e.commands;if(Array.isArray(r))return r.find(o=>{let n=typeof o.name=="function"?o.name():void 0;if(n!==void 0&&t.has(n))return!0;let i=typeof o.aliases=="function"?o.aliases():void 0;return Array.isArray(i)&&i.some(s=>t.has(s))})}a(Ic,"findChild");var fk=/token|secret|password|passphrase|apikey|api_key|credential|privatekey/i;function iy(e){return fk.test(e)}a(iy,"isSecretFlag");async function gk(e,t,r){let o=e.flags.filter(i=>i.name!=="idempotencyKey"&&t[i.name]===void 0),n=[...o.filter(i=>!i.optional),...o.filter(i=>i.optional)];for(let i of n){let s=`--${ii(i.name)}`,c=i.optional?" (optional, blank to skip)":"",u=i.coerce==="json"?" [JSON]":"",l;if(i.choices&&i.choices.length>0){let d=i.choices.map(m=>({name:m,value:m}));i.optional&&d.push({name:"(skip)",value:""}),l=await r.select(`${s}${u}`,d)}else iy(i.name)?l=await r.secret(`${s}${c}`,{optional:i.optional}):l=await r.text(`${s}${u}${c}`,{optional:i.optional});l!==""&&(t[i.name]=l)}}a(gk,"fillFlagsInteractively");function hk(e,t){if(t.size===0)return e;let r=a(o=>{if(typeof o=="string")return t.has(o)?"[redacted \u2014 same value you supplied]":o;if(Array.isArray(o))return o.map(r);if(o&&typeof o=="object"){let n={};for(let[i,s]of Object.entries(o))n[i]=r(s);return n}return o},"walk");return r(e)}a(hk,"redactEchoedSecrets");var yk={channels:["events","channels"],messages:["events","messages"],subscriptions:["events","subscriptions"],dlq:["events","dlq"],streams:["events","streams"]};function ii(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}a(ii,"kebab");var vk={connectAccess:"grants",connectBridges:"bridges",connectExplore:"explore",connectProfile:"profile",connectPartner:"partner",connectTenantApproval:"approvals"},bk={"connect.connect.requestAccess":{group:["connect","grants"],leaf:"request"},"connect.connect.approveAccess":{group:["connect","grants"],leaf:"approve"},"connect.connect.rejectAccess":{group:["connect","grants"],leaf:"reject",aliases:["decline"]},"connect.connect.revokeGrant":{group:["connect","grants"],leaf:"revoke"},"connect.connectAccess.listMyGrants":{group:["connect","grants"],leaf:"list"},"connect.connectAccess.getGrant":{group:["connect","grants"],leaf:"get"}};function sy(e){return`--${ii(e.name)} <value>`}a(sy,"optionSpec");function wk(e){let t=e.choices!==void 0&&e.choices.length>0?`, one of: ${e.choices.join(", ")}`:"";return`${e.coerce??"string"}${t}${e.optional?"":" (required)"}`}a(wk,"optionHelp");function xk(e,t){let r=[`np ${t}`,...e.pathParams.map(i=>`<${i.key}>`)];for(let i of e.flags)i.name==="idempotencyKey"||i.optional||r.push(sy(i));let o=[],n="";for(let i of r)n===""?n=i:`${n} ${i}`.length>78?(o.push(`${n} \\`),n=` ${i}`):n=`${n} ${i}`;return o.push(n),o}a(xk,"exampleLines");var kk="wickfeed/lit",_k="wickfeed.lit",$k=a(e=>e.split("/").filter(t=>t.length>0),"pathSegments"),Sk=a(e=>e.startsWith(":")||e.startsWith("{")&&e.endsWith("}"),"isPathParam");function Ik(e){let t=$k(e.pattern);if(!t.some(o=>o==="feeds"||o==="feed-listings"))return;let r=t[t.length-1]??"";if(e.method==="POST"&&(r==="subscribe"||r.startsWith("subscribe-")))return"subscribe";if(e.method==="DELETE"&&t[t.length-2]==="subscriptions"&&Sk(r)||r==="unsubscribe")return"unsubscribe"}a(Ik,"feedRefVerb");function Pk(e,t){let r=t==="subscribe"?"Subscribe":"Unsubscribe",o=`${kk} (or its alias ${_k})`;return Ic(e,new Set([t]))!==void 0?`${r} by ref: np ${t} ${o}`:`${r} by the ref form, ${o}, never a gid`}a(Pk,"feedRefLine");function ay(e,t,r){let o=new Map,n=a(c=>{let u=e,l="";for(let d of c){let m=ii(d),p=vk[d]??m;l=l?`${l} ${p}`:p;let f=new Set;d!==p&&f.add(d),m!==p&&f.add(m);let g=o.get(l);if(g){u=g.node;let v=u.alias;if(typeof v=="function")for(let h of f)g.aliases.has(h)||(v.call(u,h),g.aliases.add(h))}else{let v=Ic(u,new Set([p,...f]));if(v){let h=new Set(typeof v.aliases=="function"?v.aliases():[]),x=v.alias;if(typeof x=="function")for(let E of f)h.has(E)||(x.call(v,E),h.add(E));o.set(l,{node:v,aliases:h}),u=v}else{let h=u.command(p),x=h.alias,E=new Set;if(typeof x=="function")for(let k of f)x.call(h,k),E.add(k);o.set(l,{node:h,aliases:E}),u=h}}}return{node:u,path:l}},"groupNode"),i=new Map,s=a((c,u,l)=>{let d=c.commandPath[c.commandPath.length-1],{node:m,path:p}=n(u),f=l?.leaf??ii(d),g=p?`${p} ${f}`:f,v=i.get(g);if(v!==void 0)throw new Error(`CLI command table conflict: rows '${v}' and '${c.key}' both map to 'np ${g}'. This release of @npayload/sdk spells two commands alike; it is a defect of the package, not of your project. Upgrade @npayload/sdk, or contact support if the newest release fails the same way.`);if(i.set(g,c.key),Ic(m,new Set([f])))return;let h=c.pathParams.map(k=>`<${k.key}>`).join(" "),x=m.command(h?`${f} ${h}`:f),E=x.alias;if(typeof E=="function")for(let k of l?.aliases??[])E.call(x,k);x.description(c.summary);for(let k of c.flags)k.name!=="idempotencyKey"&&x.option(sy(k),wk(k));if(ph(c.method)&&(c.idempotent||c.flags.some(k=>k.name==="idempotencyKey"))&&x.option("--idempotency-key <key>","Idempotency key (UUIDv7 auto-generated when omitted)"),c.flags.some(k=>k.name!=="idempotencyKey")&&x.option("-i, --interactive","prompt step-by-step for any flag not passed on the command line"),typeof x.addHelpText=="function"){let k=Ik(c);x.addHelpText("after",k===void 0?`
|
|
11
|
+
Example:
|
|
12
|
+
${xk(c,g).join(`
|
|
13
|
+
`)}`:`
|
|
14
|
+
${Pk(e,k)}`)}x.action(async(...k)=>{let O,A=k.slice(0,c.pathParams.length),j=k[c.pathParams.length],U=j&&typeof j=="object"?j:{},K=U.interactive===!0,V={};for(let[D,B]of Object.entries(U))B===void 0||typeof B=="function"||D!=="interactive"&&(D==="idempotencyKey"?V["idempotency-key"]=String(B):V[D]=String(B));try{if(K){if(!r.prompt)throw new Y("--interactive is not available in this environment");if(r.isInteractive&&!r.isInteractive())throw new Y("--interactive requires a TTY; pass the values as flags instead (see --help for the full list)");await gk(c,V,r.prompt)}let D=Yh(c.opId);if(D?.confirm&&r.confirm&&!await r.confirm(D.confirm)){r.printError("aborted"),r.exit(1);return}let B=ut({row:c,positionals:A,flags:V,newIdempotencyKey:r.newIdempotencyKey});O=B;let fe=await r.send(B),ie=new Set(Object.entries(V).filter(([T,M])=>iy(T)&&M!=="").map(([,T])=>T)),b=dh(hk(fe,ie));D?.render?r.print(D.render(b)):r.print(b),r.exit(0)}catch(D){if(D instanceof Y){r.printError(D.message),r.exit(D.exitCode);return}let B=r.whereAmI,fe=await ry(D,B!==void 0?()=>B(O):void 0)??oi(D),ie=fe instanceof C?fe:D,b=fe instanceof C?gh(fe):D instanceof Error?D.message:String(D);r.printError(Ie(b,ie)),r.exit(Dt(D))}})},"registerRow");for(let c of t){s(c,c.commandPath.slice(0,-1));let u=Ak(c.commandPath);u&&s(c,u);let l=bk[c.key];l&&s(c,l.group,l)}}a(ay,"registerGeneratedCommands");function Pc(e){for(let t of e.commands??[])Pc(t),(t.commands??[]).length!==0&&Ek(t)===""&&t.description(Tk(t))}a(Pc,"describeUndescribedGroups");function Ek(e){let t=e.description,r=typeof t=="function"?t.call(e):void 0;return typeof r=="string"?r:""}a(Ek,"currentDescription");function cy(e){let t=e.commands??[];return t.length===0?1:t.reduce((r,o)=>r+cy(o),0)}a(cy,"leafCount");function Tk(e){let t=(e.commands??[]).map((i,s)=>({name:typeof i.name=="function"?i.name():"",n:cy(i),i:s})).filter(i=>i.name!=="").sort((i,s)=>s.n-i.n||i.i-s.i),r=t.reduce((i,s)=>i+s.n,0),o=t.slice(0,5).map(i=>i.name),n=t.length-o.length;return`${o.join(", ")}${n>0?` and ${n} more`:""} (${r} ${r===1?"command":"commands"})`}a(Tk,"groupSummary");function Ak(e){for(let[t,r]of Object.entries(yk))if(e.length>=3&&e[0]===r[0]&&e[1]===r[1])return[t,...e.slice(2,-1)];return null}a(Ak,"rootAliasPath");import{input as Ck,select as Rk,confirm as Ok,password as VA,checkbox as Nk}from"@inquirer/prompts";import Rn from"chalk";var Ec=class extends Error{static{a(this,"NonInteractiveError")}constructor(){super("Interactive mode required. Use --skip-auth and set NPAYLOAD_CLIENT_ID + NPAYLOAD_HMAC_SECRET env vars for non-interactive environments."),this.name="NonInteractiveError"}};function je(){return!!(process.stdin.isTTY&&process.stdout.isTTY)}a(je,"isInteractive");function si(){if(!je())throw new Ec}a(si,"ensureTTY");async function Pr(e,t){return si(),Ck({message:e,default:t?.default,validate:t?.validate})}a(Pr,"askText");async function He(e,t){return si(),Rk({message:e,choices:t})}a(He,"askSelect");async function ly(e,t=!1){return si(),Ok({message:e,default:t})}a(ly,"askConfirm");async function dy(e,t){return si(),Nk({message:e,choices:t,loop:!1,pageSize:15})}a(dy,"askCheckbox");function Er(e){console.log(),console.log(Rn.bold(e)),console.log(Rn.dim("\u2500".repeat(60)))}a(Er,"sectionHeader");function uy(e){return e.replace(/\x1b\[[0-9;]*m/g,"").length}a(uy,"visibleWidth");function ai(e){let t=Math.max(...e.map(o=>uy(o))),r="\u2500".repeat(t+4);console.log(),console.log(Rn.dim(`\u250C${r}\u2510`));for(let o of e){let n=" ".repeat(Math.max(0,t-uy(o)));console.log(Rn.dim("\u2502 ")+o+n+Rn.dim(" \u2502"))}console.log(Rn.dim(`\u2514${r}\u2518`)),console.log()}a(ai,"printBox");import L from"chalk";import{readdirSync as Oy,existsSync as k_}from"fs";import{join as Ny}from"path";import{existsSync as Cr,mkdirSync as Fk,writeFileSync as di,readFileSync as Dc,appendFileSync as qk}from"fs";import{join as ln}from"path";import{createHash as Dk,generateKeyPairSync as jk}from"crypto";import{existsSync as Uk,readFileSync as Lk}from"fs";import{join as zk}from"path";function ci(){let{publicKey:e,privateKey:t}=jk("ec",{namedCurve:"P-256"}),r=t.export({format:"jwk"}),o=e.export({format:"jwk"}),n=JSON.stringify({crv:o.crv,kty:o.kty,x:o.x,y:o.y});return{kid:Dk("sha256").update(n).digest("base64url").slice(0,12),alg:"ES256",publicJwk:o,privateJwk:r,createdAt:Date.now()}}a(ci,"provisionDpopKeypair");function Tr(e){let t=zk(e,".npayload.json");if(!Uk(t))return null;try{let r=JSON.parse(Lk(t,"utf8"));if(r.dpopKid&&r.dpopPrivateJwk&&r.dpopPublicJwk)return{kid:r.dpopKid,alg:"ES256",privateJwk:r.dpopPrivateJwk,publicJwk:r.dpopPublicJwk,createdAt:Date.now()}}catch{}return null}a(Tr,"readExistingDpop");function py(e,t){return["# managed by npayload \u2014 environments + access scopes as code","# docs: https://npayload.com/docs/manifest","","[app]",`slug = "${e.appSlug}"`,...e.appName&&e.appName!==e.appSlug?[`name = "${e.appName}"`]:[],"",`# Development environments (N per app). \`np env use ${t}\` targets it;`,"# add more with `np env create` (each maps onto the shared sandbox pool).",`[env.${t}]`,'kind = "development"',"","# The production environment (exactly ONE per app \u2014 the production","# singleton). Only `np deploy` writes here; the branch guard requires","# main/master (or this env's deploy_branch).","[env.production]",'kind = "production"',"","# Scopes-as-code: the concrete <resource>:<action>","# grants this app's machine credential holds. `np scopes fix` fills the","# projected floor from your config; wildcards are rejected.","[access_scopes]","scopes = []","","# Embedded components. Name the components you","# MOUNT \u2014 never their scopes. `np scopes fix` derives the scopes those","# components need, plus the embed/tenant scopes your own backend needs to","# mint a session, from the component map. Adding an id here is the ONLY","# edit required; an unknown id fails the parse.",'# e.g. components = ["primus", "connect"]',`# valid ids: ${yh.join(", ")}`,"[embed]","components = []",""].join(`
|
|
15
|
+
`)}a(py,"renderManifest");function Tc(e){return`import { defineEventsConfig } from "@npayload/sdk";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Declare your Events topology here, then:
|
|
19
|
+
* npayload validate check it against the contract
|
|
20
|
+
* npayload deploy reconcile it to npayload (idempotent)
|
|
21
|
+
*
|
|
22
|
+
* Tip: ask your coding agent \u2014 "set up npayload Events for this app" \u2014 and it
|
|
23
|
+
* will fill this in from your schema using the npayload MCP server. Resources are
|
|
24
|
+
* keyed by their natural identity (a channel by its slug, a subscription by its
|
|
25
|
+
* name). Publish from your code with: np.events.publish("<channel-slug>", payload).
|
|
26
|
+
*/
|
|
27
|
+
export default defineEventsConfig({
|
|
28
|
+
channels: {
|
|
29
|
+
// orders: { name: "Orders", type: "queue" },
|
|
30
|
+
},
|
|
31
|
+
// eventTypes: { ... },
|
|
32
|
+
// subscriptions: { ... },
|
|
33
|
+
});
|
|
34
|
+
`}a(Tc,"renderEventsConfig");function Ac(e){return`import { definePrimusConfig } from "@npayload/sdk";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Declare your Primus (AI) topology here, then:
|
|
38
|
+
* npayload dev watch + sync this (and events.config.ts) live
|
|
39
|
+
* npayload deploy reconcile to npayload (idempotent: create + update)
|
|
40
|
+
*
|
|
41
|
+
* Tip: ask your coding agent \u2014 "set up npayload Primus for this app" \u2014 and it
|
|
42
|
+
* will fill this in using the npayload MCP server. Secrets (LLM keys) NEVER go
|
|
43
|
+
* in this file \u2014 store them as credentials from the dashboard and reference them.
|
|
44
|
+
*/
|
|
45
|
+
export default definePrimusConfig({
|
|
46
|
+
// \u2500\u2500 Agents \u2014 your autonomous workers (keyed by slug) \u2500\u2500
|
|
47
|
+
agents: {
|
|
48
|
+
// support_bot: { // \u2190 the slug (stable identity)
|
|
49
|
+
// name: "Support Bot", // \u2190 display name (rename freely)
|
|
50
|
+
// description: "Answers customer questions from the docs.",
|
|
51
|
+
// systemPrompt: "You are a helpful support agent. Be concise and cite sources.",
|
|
52
|
+
// personality: "friendly",
|
|
53
|
+
// language: "en",
|
|
54
|
+
// skills: ["summarize"], // skill SLUGS declared below (reconciled)
|
|
55
|
+
// },
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
// \u2500\u2500 Skills \u2014 reusable capabilities an agent can call (keyed by slug) \u2500\u2500
|
|
59
|
+
// Slugs must match /^[a-z][a-z0-9_]*$/ (lowercase, digits, underscore \u2014 no hyphens).
|
|
60
|
+
skills: {
|
|
61
|
+
// summarize: { // \u2190 the slug
|
|
62
|
+
// name: "Summarize", // \u2190 display name
|
|
63
|
+
// description: "Summarize a block of text into 3 bullet points.",
|
|
64
|
+
// category: "text",
|
|
65
|
+
// executor: "inline", // "inline" | "cloud_run" | "fly_machines"
|
|
66
|
+
// definition: {
|
|
67
|
+
// systemPrompt: "Summarize the input into exactly 3 concise bullet points.",
|
|
68
|
+
// tools: ["fetch_url"], // tool SLUGS this skill may use
|
|
69
|
+
// },
|
|
70
|
+
// },
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
// \u2500\u2500 Tools \u2014 actions agents/skills can invoke (keyed by slug) \u2500\u2500
|
|
74
|
+
// Slugs must match /^[a-z][a-z0-9_]*$/ (no hyphens). riskLevel is REQUIRED and
|
|
75
|
+
// must be "safe" | "moderate" | "dangerous". An "inline" tool needs no endpoint;
|
|
76
|
+
// a "webhook" tool requires an HTTPS \`endpoint\`.
|
|
77
|
+
tools: {
|
|
78
|
+
// fetch_url: { // \u2190 the slug
|
|
79
|
+
// name: "Fetch URL", // \u2190 display name
|
|
80
|
+
// description: "Fetch a URL and return the response body.",
|
|
81
|
+
// riskLevel: "safe", // "safe" | "moderate" | "dangerous"
|
|
82
|
+
// executor: "inline", // omit endpoint for inline tools
|
|
83
|
+
// timeout: 10000,
|
|
84
|
+
// },
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
// \u2500\u2500 Triggers \u2014 fire an agent on an event/schedule (keyed by slug) \u2500\u2500
|
|
88
|
+
// Requires the \`triggers:read\`/\`triggers:write\` scopes on your OAuth client.
|
|
89
|
+
// triggers: {
|
|
90
|
+
// on_new_order: { // \u2190 the slug
|
|
91
|
+
// name: "On New Order", // \u2190 display name
|
|
92
|
+
// description: "Run support-bot when an order is created.",
|
|
93
|
+
// agentGid: "support_bot", // an agent SLUG above (resolved to its gid)
|
|
94
|
+
// type: "event", // "cron" | "event" | "webhook" | "message"
|
|
95
|
+
// config: { eventType: "orders.created" },
|
|
96
|
+
// action: { goal: "Summarize the new order and notify the team." },
|
|
97
|
+
// },
|
|
98
|
+
// },
|
|
99
|
+
});
|
|
100
|
+
`}a(Ac,"renderPrimusConfig");function Cc(e){return`import { definePipesConfig } from "@npayload/sdk";
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Declare your Pipes (automation) topology here, then:
|
|
104
|
+
* npayload dev watch + sync this (and events/primus) live
|
|
105
|
+
* npayload deploy reconcile to npayload (idempotent: create + update)
|
|
106
|
+
*
|
|
107
|
+
* Tip: ask your coding agent \u2014 "set up a npayload workflow for this app" \u2014 and it
|
|
108
|
+
* will fill this in using the npayload MCP server (call \`pipes_contract\` for the
|
|
109
|
+
* schema). Secrets (connector API keys) NEVER go in this file \u2014 store them as
|
|
110
|
+
* credentials from the dashboard and point the connector at the stored credential.
|
|
111
|
+
*/
|
|
112
|
+
export default definePipesConfig({
|
|
113
|
+
// \u2500\u2500 Workflows \u2014 your automations (keyed by name) \u2500\u2500
|
|
114
|
+
// A workflow is a node graph (nodes reference connectors) + a trigger.
|
|
115
|
+
// Config \`update\` changes name/description only; edit the node graph in the editor.
|
|
116
|
+
workflows: {
|
|
117
|
+
// "daily-digest": {
|
|
118
|
+
// description: "Summarize yesterday's orders and post to the team.",
|
|
119
|
+
// definition: {
|
|
120
|
+
// nodes: [
|
|
121
|
+
// { id: "start", type: "trigger", position: { x: 0, y: 0 }, data: {} },
|
|
122
|
+
// ],
|
|
123
|
+
// edges: [],
|
|
124
|
+
// },
|
|
125
|
+
// // type: "event" | "schedule" | "webhook" | "manual" | "form"
|
|
126
|
+
// triggerConfig: { type: "schedule", config: { cron: "0 9 * * *" } },
|
|
127
|
+
// },
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
// \u2500\u2500 Credentials \u2014 connector auth (keyed by name) \u2500\u2500
|
|
131
|
+
// NEVER put a plaintext key here. Store it as a credential from the dashboard
|
|
132
|
+
// in the vault (AES-256-GCM), then reference it via auth.vaultSecretId.
|
|
133
|
+
credentials: {
|
|
134
|
+
// "openai-key": {
|
|
135
|
+
// connectorId: "openai",
|
|
136
|
+
// auth: { type: "api_key", vaultSecretId: "<the stored credential's id>" },
|
|
137
|
+
// },
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
`}a(Cc,"renderPipesConfig");function Rc(e){return`import { defineConnectConfig } from "@npayload/sdk";
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Declare cross-org identity BRIDGES here, then:
|
|
144
|
+
* npayload validate check it against the Connect contract
|
|
145
|
+
* npayload deploy reconcile it to npayload (admin is the source of truth)
|
|
146
|
+
*
|
|
147
|
+
* A bridge maps the same real entity across two orgs that use different ids
|
|
148
|
+
* (e.g. a customer that is "customer_123" in your org and "contact_XYZ" in the
|
|
149
|
+
* other). Each entry is keyed by the TARGET org's GID. Declaring a bridge is an
|
|
150
|
+
* OFFER: it stays pending until the TARGET org confirms it in its own config.
|
|
151
|
+
*
|
|
152
|
+
* Everything else in Connect (profile, access grants, tenant approvals) is
|
|
153
|
+
* imperative \u2014 ask your coding agent and call connect_usage for the np.connect.*
|
|
154
|
+
* snippets.
|
|
155
|
+
*/
|
|
156
|
+
export default defineConnectConfig({
|
|
157
|
+
bridges: {
|
|
158
|
+
// "<target-org-gid>": { entityTypeSlug: "customer" },
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
`}a(Rc,"renderConnectConfig");function Ar(e){return JSON.stringify({version:oh,hash:sh,note:"Pinned npayload contract. Bump by installing a newer npayload version."},null,2)+`
|
|
162
|
+
`}a(Ar,"renderContractLock");function Oc(e){return JSON.stringify({mcpServers:{npayload:{command:"npx",args:[Qo(),"mcp","serve"]}}},null,2)+`
|
|
163
|
+
`}a(Oc,"renderMcpConfig");function ui(e,t={}){let r=e.apiUrl?`
|
|
164
|
+
# API URL
|
|
165
|
+
NPAYLOAD_API_URL=${e.apiUrl}
|
|
166
|
+
`:"",o=e.transport??"npp",n=e.edgeUrl?`NPAYLOAD_EDGE_URL=${e.edgeUrl}
|
|
167
|
+
`:t.namesEdge?"":`# NPAYLOAD_EDGE_URL=<edge URL> (optional on npayload's production API, whose edge is the default; required for any other API)
|
|
168
|
+
`,i=e.dpop?`
|
|
169
|
+
# Signing key for the secure transport (provisioned by \`npayload init\`).
|
|
170
|
+
NPAYLOAD_DPOP_KID=${e.dpop.kid}
|
|
171
|
+
NPAYLOAD_DPOP_PRIVATE_JWK=${JSON.stringify(e.dpop.privateJwk)}
|
|
172
|
+
`:"",s=o==="http"?`
|
|
173
|
+
# Transport: HTTP/JSON (opted in via --http). Re-run \`npayload init\` for the default secure transport.
|
|
174
|
+
NPAYLOAD_TRANSPORT=http
|
|
175
|
+
`:`
|
|
176
|
+
# Transport: the default secure binary wire. The SDK provisions and registers a
|
|
177
|
+
# signing key automatically on first use \u2014 nothing for you to manage.
|
|
178
|
+
NPAYLOAD_TRANSPORT=npp
|
|
179
|
+
${n}`;return`# npayload credentials
|
|
180
|
+
# Created by: npayload init
|
|
181
|
+
${cn(e.clientId)?`# Not connected yet. These are PLACEHOLDERS \u2014 run \`npayload login\` to fill in
|
|
182
|
+
# your real app credentials. The project is safe to import; only the first
|
|
183
|
+
# network call needs real credentials.
|
|
184
|
+
`:""}
|
|
185
|
+
NPAYLOAD_CLIENT_ID=${e.clientId}
|
|
186
|
+
NPAYLOAD_HMAC_SECRET=${e.hmacSecret}
|
|
187
|
+
NPAYLOAD_APP_ID=${e.appId}
|
|
188
|
+
${r}${s}${i}`}a(ui,"renderEnvFile");var li=["","# npayload \u2014 credentials (never commit)",".env",".npayload.json","# npayload \u2014 local machine state (regenerated; like .next/)",".npayload/"],Nc=["npayload/_generated/","npayload/_generated"];var my=[{step:1,do:"Check the project state: credentials, endpoint reachability, generated artifacts.",mcpTool:"npayload_status",cli:"npayload doctor",expect:"ok:true with a credential source present. If not, stop and show the user the remediation lines."},{step:2,do:"Fetch the config contract for the product you are wiring \u2014 Events (channels/eventTypes/subscriptions), Pipes (workflows/credentials), or Primus AI agents (agents/skills/tools/triggers). Each returns JSON Schema + capability catalog + guidance: the ONLY source for what that config may contain \u2014 never guess fields.",mcpTool:"events_contract / pipes_contract / primus_contract",cli:null,expect:"The schema you will author npayload/<product>.config.ts against."},{step:3,do:"Study the app's own data model (its schema/models/types) and design the topology in the product config(s): npayload/events.config.ts (channels, typed eventTypes, subscriptions), npayload/pipes.config.ts (workflows, vault-referenced credentials), npayload/primus.config.ts (agents, skills, tools, triggers).",mcpTool:null,cli:null,expect:"One default-exported define<Product>Config({...}) per product the app uses, reflecting its real domain."},{step:4,do:"Validate each config offline against its contract.",mcpTool:"events_validate / pipes_validate / primus_validate",cli:"npayload validate",expect:"ok:true per product. Fix every issue it returns before going further."},{step:5,do:"Preview the plan \u2014 nothing is applied.",mcpTool:"events_deploy / pipes_deploy / primus_deploy (check:true)",cli:"npayload diff",expect:"A plan of creates/updates/no-ops (and orphans). Review it; surprises here mean the config is wrong."},{step:6,do:"Apply to the sandbox. This also regenerates npayload/permissions.generated.ts (the per-object scope union across EVERY product config present) and npayload/_generated/events.d.ts (typed payloads).",mcpTool:"events_deploy / pipes_deploy / primus_deploy",cli:"npayload push",expect:"Resources reconciled; generated files updated. A second run is all no-ops (idempotent)."},{step:7,do:'Wire the app code: np.events.publish("<channel-slug>", payload) \u2014 payloads are typed by _generated/events.d.ts after the push; np.pipes.* / np.primus.* for the other products. Use events_usage for copy-ready runtime recipes; one-off operations on ANY product go through npayload_catalog \u2192 npayload_invoke.',mcpTool:"events_usage",cli:null,expect:"App code compiles against the generated payload types."},{step:8,do:"Prove it end to end: publish one real event from the app, watch it arrive.",mcpTool:null,cli:"npayload tail <channel-slug>",expect:"The published event printed live in the terminal."}],fy=["Never guess config fields or operations. The config schema comes from the product's contract tool (`events_contract` / `pipes_contract` / `primus_contract`, or `npayload validate`); the full operation surface comes from `npayload_catalog`. If it is not there, it does not exist.","Never edit anything under npayload/_generated/ or npayload/permissions.generated.ts \u2014 they are generated on push and committed; hand edits are overwritten and fail drift checks.","Never read, print, or edit .env or .npayload.json \u2014 credentials are already wired; tools and the CLI resolve them automatically.","Config references take the NATURAL identity, never an id: channel refs take the channel's SLUG (subscriptions[].channelGid, eventTypes[].channels, consumerGroups[].channelGid); a Primus trigger's agentGid and an agent's skills[] take the NAMES declared in the same config \u2014 all resolved to ids at push. Do not invent ids.","Event payload schemas (eventTypes[].schema) are append-only: changing one registers a NEW catalogue version on push; it never mutates the old version.","Primus naming rule: skill and tool names are lowercase + digits + underscores \u2014 a hyphenated name is rejected by the platform. Agent and trigger names may use hyphens.","Pipes lifecycle: a config-declared workflow is created as a DRAFT; activation is deliberate (dashboard, CLI, or pipes_create's activate flag for imperative builds). NEVER put a plaintext secret in pipes.config.ts \u2014 credentials carry a vault REFERENCE only.","`npayload push` / the *_deploy tools target the SANDBOX. Production is only `npayload deploy`, run deliberately by a human \u2014 never call it as an agent.","The .npayload/ directory (dot-prefixed) is local machine state written by `npayload pull`; its absence is normal. The committed workspace is npayload/ (no dot).","If a call fails, run npayload_status / `npayload doctor` first and act on its remediation \u2014 do not retry blindly or invent workarounds."],gy=[{path:"npayload/events.config.ts",what:"Events topology you author: channels, typed eventTypes, subscriptions. Committed."},{path:"npayload/pipes.config.ts",what:"Pipes topology you author: workflows + vault-referenced credentials. Committed."},{path:"npayload/primus.config.ts",what:"Primus (AI agents) topology you author: agents, skills, tools, triggers. Committed."},{path:"npayload/permissions.generated.ts",what:"Per-object permission model \u2014 the union across every product config present, generated on push. Committed, never hand-edited."},{path:"npayload/_generated/",what:"contract.lock + events.d.ts (typed payloads), generated on push. Committed, never hand-edited."},{path:"npayload/AGENTS.md",what:"This guide. Regenerated by `npx @npayload/sdk init`."},{path:".npayload/",what:"Local machine state (pull snapshots). Gitignored; absent until `npayload pull` runs."},{path:".env + .npayload.json",what:"Credentials. Gitignored; never read or edit them."},{path:".mcp.json",what:"Connects your editor's agent to the npayload MCP server."}];function hy(e){let t=["# npayload \u2014 guide for coding agents","",`<!-- Generated by \`npx @npayload/sdk init\` (@npayload/sdk@${e}). Re-run init to refresh. -->`,"","npayload is communication infrastructure for autonomous systems, and it is","configuration-driven: you author the product configs under `npayload/`","(`events.config.ts`, `pipes.config.ts`, `primus.config.ts`), validate them,","push them, and the platform reconciles everything else. There is nothing to","reverse-engineer \u2014 follow the loop below exactly. The npayload MCP server","(already wired via `.mcp.json`) serves the same loop as tools; start with","the `npayload_overview` tool when connected.","","## The workspace","","| Path | What it is |","|------|------------|",...gy.map(r=>`| \`${r.path}\` | ${r.what} |`),"","## The loop \u2014 do these steps in order",""];for(let r of my){let o=[r.mcpTool?`MCP \`${r.mcpTool}\``:null,r.cli?`CLI \`${r.cli}\``:null].filter(Boolean).join(" \xB7 ");t.push(`${r.step}. ${r.do}${o?` (${o})`:""}`),t.push(` Expect: ${r.expect}`)}return t.push("","## Hard rules","",...fy.map(r=>`- ${r}`),"","## Where facts come from (never from memory)","","- Config schema + capabilities: the product's contract tool \u2014 `events_contract` / `pipes_contract` / `primus_contract` \u2014 or `npayload validate` offline.","- Full operation surface (every product, incl. AI `primus.*` ops): `npayload_catalog` tool (invoke via `npayload_invoke`).","- Runtime code recipes: `events_usage` tool; imperative workflow building: `pipes_catalog` \u2192 `pipes_build` \u2192 `pipes_create` \u2192 `pipes_run` \u2192 `pipes_get_execution`.","- Project/stack health: `npayload_status` tool, or `npayload doctor`.",""),t.join(`
|
|
189
|
+
`)}a(hy,"renderAgentsMd");function yy(){return{workflow:my,rules:fy,workspace:gy}}a(yy,"overviewRails");import*as Mk from"fs";function Ye(e,t,r={}){let o=r.fs??Mk;if(o.existsSync(e)){try{o.chmodSync(e,384)}catch{}r.append?o.appendFileSync(e,t,"utf8"):o.writeFileSync(e,t,"utf8");return}o.writeFileSync(e,t,{encoding:"utf8",mode:384})}a(Ye,"writeSecretFile");function vy(e,t,r={}){let o=ln(e,"npayload"),n=[],i=[],s=[],c=[];t.dpop||(t.dpop=Tr(e)??ci());let u=[o,ln(o,"_generated")];for(let m of u)r.dryRun||Fk(m,{recursive:!0}),c.push(m.replace(e+"/",""));let l=[["npayload.toml",py(t,r.firstEnv??"sandbox")],["npayload/events.config.ts",Tc(t)],["npayload/primus.config.ts",Ac(t)],["npayload/pipes.config.ts",Cc(t)],["npayload/connect.config.ts",Rc(t)],["npayload/_generated/contract.lock",Ar(t)],["npayload/AGENTS.md",hy(an())],[".mcp.json",Oc(t)]],d=new Set(["npayload/AGENTS.md"]);for(let[m,p]of l){let f=ln(e,m);if(n.push(m),Cr(f)&&!r.force&&!d.has(m)){s.push(m);continue}r.dryRun||di(f,p,"utf8"),i.push(m)}return n.push(".env",".npayload.json"),r.dryRun?n.push():(Zk(e,t,r.force)?i.push(".env"):s.push(".env"),Gk(e,t,r.force)?i.push(".npayload.json"):s.push(".npayload.json"),Vk(e)&&i.push("package.json"),jc(e)),{files:n,written:i,skipped:s,directories:c}}a(vy,"scaffold");function Zk(e,t,r){let o=ln(e,".env");if(Cr(o)){let n=Dc(o,"utf8");if(n.includes("NPAYLOAD_CLIENT_ID")&&!r||n.includes("NPAYLOAD_CLIENT_ID")&&r)return!1;let i=Yo(n),s=ui(t,{namesEdge:!!i.NPAYLOAD_EDGE_URL?.trim()});return Ye(o,`
|
|
190
|
+
`+s,{append:!0}),!0}return Ye(o,ui(t)),!0}a(Zk,"writeEnvFile");function Gk(e,t,r){let o=ln(e,".npayload.json");if(Cr(o)&&!r)return!1;let n={clientId:t.clientId,hmacSecret:t.hmacSecret,...t.targetEnv?{targetEnv:t.targetEnv}:{}};return t.dpop&&(n.dpopKid=t.dpop.kid,n.dpopPrivateJwk=t.dpop.privateJwk,n.dpopPublicJwk=t.dpop.publicJwk),Ye(o,JSON.stringify(n,null,2)+`
|
|
191
|
+
`),!0}a(Gk,"writeProjectCredentials");function Vk(e){let t=ln(e,"package.json");if(!Cr(t))return!1;let r=vh();if(!r)return!1;let o=Dc(t,"utf8"),n;try{n=JSON.parse(o)}catch{return!1}let i=!1;for(let c of["dependencies","devDependencies"]){let u=n[c];if(!u||typeof u!="object")continue;let l=u;if(uc.some(d=>typeof l[d]=="string")){let d={};for(let[m,p]of Object.entries(l))uc.includes(m)&&typeof p=="string"?!(sn in d)&&!(sn in l)&&(d[sn]=r):d[m]=p;n[c]=l=d,i=!0}typeof l[sn]=="string"&&l[sn]!==r&&(l[sn]=r,i=!0)}if(!i)return!1;let s=/^(\s+)"/m.exec(o)?.[1]??" ";return di(t,JSON.stringify(n,null,s)+(o.endsWith(`
|
|
192
|
+
`)?`
|
|
193
|
+
`:""),"utf8"),!0}a(Vk,"healPackageJsonPin");function jc(e){let t=ln(e,".gitignore");if(!Cr(t)){di(t,li.join(`
|
|
194
|
+
`)+`
|
|
195
|
+
`,"utf8");return}let r=Dc(t,"utf8"),o=new Set,n=r.split(/\r?\n/).filter(s=>{let c=s.trim();if(Nc.includes(c))return!1;if(c.startsWith("# npayload")){if(o.has(c))return!1;o.add(c)}return!0}).join(`
|
|
196
|
+
`);n!==r&&(r=n.endsWith(`
|
|
197
|
+
`)?n:n+`
|
|
198
|
+
`,di(t,r,"utf8"));let i=[];for(let s of li)s&&!r.includes(s)&&i.push(s);if(i.length>0){let s=r.endsWith(`
|
|
199
|
+
`)?"":`
|
|
200
|
+
`;qk(t,s+`
|
|
201
|
+
# npayload
|
|
202
|
+
`+i.join(`
|
|
203
|
+
`)+`
|
|
204
|
+
`,"utf8")}}a(jc,"updateGitignore");import{existsSync as Nr,readFileSync as Dr,writeFileSync as d_}from"fs";function pi(e,t,r){let o=ze([["the edge this run names",t.edgeUrl]],e);if(o.production)return;let n=Ih(e).NPAYLOAD_EDGE_URL,i=t.edgeUrl?.trim()?t.edgeUrl:n,s=i===void 0?void 0:sc(o.estate,i);if(s!==void 0){let u=t.edgeUrl?.trim()?"":" (the production edge is the one this project's .env names)";throw new be(`This run mixes two estates${u}: ${s}. ${r.edge}`)}let c=t.signIn===void 0?void 0:sc(o.estate,t.signIn);if(c!==void 0)throw new be(`This run's sign-in would mix two estates: ${c}. ${r.signIn}`)}a(pi,"refuseMixedEstate");import{join as jr}from"path";import $y from"chalk";import Qe from"chalk";import{spawn as Bk}from"child_process";function Jk(e,t){return e==="darwin"?["open",[t]]:e==="win32"?["rundll32",["url.dll,FileProtocolHandler",t]]:["xdg-open",[t]]}a(Jk,"browserLauncher");function Kk(e){try{let[t,r]=Jk(process.platform,e),o=Bk(t,r,{stdio:"ignore",detached:!0});o.on("error",()=>{}),o.unref()}catch{}}a(Kk,"openBrowser");async function by(e={}){Er("Sign in");let t=await Me(e.authServerUrl);if(t)try{return await t.listOrgs(),console.log(Qe.green("\u2713")+" Already signed in"),t}catch(i){F(i),console.log(Qe.dim(" Your session expired. Signing in again."))}if(!je()&&!process.env.NPAYLOAD_AUTH_URL)throw new C("Cannot sign in: this is a non-interactive terminal.",{code:"NO_TTY",hint:"For CI, provision an app in the dashboard and pass NPAYLOAD_CLIENT_ID + NPAYLOAD_HMAC_SECRET with --skip-auth.",docs:"https://docs.npayload.com/docs/start/initialize"});console.log(Qe.dim(" Sign in to npayload to continue."));let r=e.authServerUrl??"",o=null,n=0;try{let i=await Ah({authUrl:e.authServerUrl,onStart:a(s=>{r=s,console.log(" "+Qe.cyan("\u2192")+" requesting a device code from "+Qe.dim(s)+" \u2026")},"onStart"),onPrompt:a(s=>{let c=s.verificationUriComplete||s.verificationUri;console.log(),console.log(" "+Qe.cyan("\u2197")+" Opening your browser to approve this device\u2026"),console.log(" "+Qe.dim(c)),Kk(c),console.log(" Verification code: "+Qe.bold(s.userCode)+Qe.dim(" (already filled in)")),console.log(Qe.dim(" Didn't open? Paste the URL above.")),n=Date.now(),o=on("Waiting for browser approval\u2026")},"onPrompt"),onPoll:a(()=>{if(!o)return;let s=Math.round((Date.now()-n)/1e3);o.text=`Waiting for browser approval\u2026 (${s}s)`},"onPoll")});return o?o.succeed("Signed in"):console.log(Qe.green("\u2713")+" Signed in"),i}catch(i){o&&o.fail("Sign in failed"),F(i);let s=i instanceof Error?i.message:"Please run the command again.";throw new C("Sign in failed.",{code:"AUTH_FAILED",hint:r&&!s.includes(r)?`${s} (endpoint: ${r})`:s,docs:"https://docs.npayload.com/docs/start/initialize",cause:i})}}a(by,"authFlow");import Fe from"chalk";function mi(){let e=process.env.NPAYLOAD_PORTAL_URL?.trim();return e&&e.length>0?e.replace(/\/+$/,""):ze().production?"https://admin.npayload.com":void 0}a(mi,"portalHost");var Wk=["events","pipes","ai","primus","credentials","keys","feed"];function Hk(e){return/^[a-z][a-z0-9_]{0,40}:[a-z][a-z0-9_]{0,40}$/.test(e)&&!e.includes("*")}a(Hk,"isWellFormedScope");function wy(e=[]){let t=new Set;for(let r of[...we.commands,...e]){let o=r.key.split(".")[0];if(Wk.includes(o))for(let n of r.scopes??[])Hk(n)&&t.add(n)}return[...t].sort()}a(wy,"projectedCeiling");async function Rr(e,t,r){let o=on(e);try{let n=await t();return o.succeed(r?r(n):e),n}catch(n){throw o.fail(`${e} \u2014 failed`),n}}a(Rr,"withSpin");var Yk=[{name:"No tenants \u2014 my own services publish and consume",value:"none",description:"Every event belongs to your org directly. No customers-of-customers."},{name:"Tenanted \u2014 my customers' tenants are first-class",value:"tenanted",description:"Every event row carries a tenantId (org > app > env > tenant). Pick this when you serve your customers' customers."}],Qk=[{name:"Internal \u2014 events within your org",value:"internal",description:"Private event bus for your own services. The ESB replacement."},{name:"Connect \u2014 share events with other orgs",value:"connect",description:"Cross-org event sharing. Discoverable in Explore. You'll pick a subtype next (platform / device / mobile) \u2014 at parity with the dashboard."},{name:"Feed \u2014 sell event data",value:"feed",description:"Commercial data distribution with Stripe billing."}],Xk=[{name:"None \u2014 standard connect app",value:"none",description:"Cross-org sharing without platform/device/mobile specialization."},{name:"Platform \u2014 multi-tenant platform (Shopify, HubSpot, \u2026)",value:"platform",description:"Per-tenant events, tenant approvals, Entity NAT, identity bridges. Needs a platform slug."},{name:"Device \u2014 a device-class connect app",value:"device",description:"For a physical / edge device integration."},{name:"Mobile \u2014 a mobile-class connect app",value:"mobile",description:"For a mobile app integration."}];function e_(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}a(e_,"slugify");async function xy(e,t={}){let r=await t_(e,t.org),o=await n_(e,r,t.app),{loadExtraCommandRows:n}=await import("../chunk-APBVAT7F.mjs"),i=wy(await n()),s=await Rr("Provisioning credentials\u2026",()=>e.provisionOac(r,o.appId,t.rotate,i));if(s.alreadyProvisioned&&!s.hmacSecret&&t.needSecret&&!t.rotate)throw new C(`This app already has CLI credentials (${s.clientId}) and this project holds none saved; the existing secret was left untouched.`,{code:"CREDENTIALS_EXIST",hint:"Copy the team's .env and .npayload.json into this project, or pass --rotate to issue a fresh secret (the previous one stops working immediately)."});return s.alreadyProvisioned&&!s.hmacSecret?(console.log(Fe.green("\u2713")+` Using existing credentials (${Fe.dim(s.clientId)}). Your previous secret is kept.`),console.log(Fe.dim(" Lost the secret? Re-run with --rotate to issue a new one (this invalidates the old)."))):s.hmacSecret&&console.log(Fe.green("\u2713")+` Credentials ${t.rotate?"rotated":"provisioned"} (${Fe.dim(s.clientId)})`),{orgId:r,...o,clientId:s.clientId,hmacSecret:s.hmacSecret}}a(xy,"selectTarget");async function t_(e,t){Er("Organization");let r=await Rr("Loading your organizations\u2026",()=>e.listOrgs(),o=>o.length===1?o[0].name:`${o.length} organizations`);if(t!==void 0&&t.trim()!==""){let o=t.trim().toLowerCase(),n=r.find(i=>i.orgId.toLowerCase()===o||i.slug.toLowerCase()===o||i.name.toLowerCase()===o);if(!n){let i=r.length>0?r.map(s=>s.slug).join(", "):"(none \u2014 the session can access no organizations)";throw new Error(`No organization matching "${t}" is accessible to this session. Available: ${i}.`)}return console.log(Fe.green("\u2713")+` ${n.name} (${n.slug})`),n.orgId}for(;r.length===0;){console.log(Fe.yellow(" You're not in any organization yet."));let o=mi();console.log(o!==void 0?" Create one at "+Fe.cyan(`${o}/organization-list`)+", then press Enter.":" Create one in your npayload dashboard, then press Enter."),await Pr(" Press Enter when your organization is ready",{default:""}),r=await Rr("Checking for your organization\u2026",()=>e.listOrgs(),n=>`${n.length} found`)}if(r.length===1)return r[0].orgId;if(!je())throw new Error(`This session can access ${r.length} organizations; a non-interactive login must choose one. Pass --org <slug|gid> (or set NPAYLOAD_ORG). Available: ${r.map(o=>o.slug).join(", ")}.`);return He("Select an organization",r.map(o=>({name:`${o.name} (${o.slug})`,value:o.orgId})))}a(t_,"selectOrg");async function n_(e,t,r){Er("App");let o=await Rr("Loading your apps\u2026",()=>e.listApps(t),s=>s.length?`${s.length} app${s.length===1?"":"s"}`:"no apps yet"),n="__create__";if(r!==void 0&&r.trim()!==""){let s=r.trim().toLowerCase(),c=o.find(u=>u.gid.toLowerCase()===s||u.slug.toLowerCase()===s||u.name.toLowerCase()===s);if(!c){let u=o.length>0?o.map(l=>l.slug).join(", "):"(none \u2014 create one in the dashboard or run `np login` interactively)";throw new Error(`No app matching "${r}" exists in this organization. Available: ${u}.`)}return console.log(Fe.green("\u2713")+` ${c.name} (${c.slug})`),{appId:c.gid,appName:c.name,appSlug:c.slug,appType:c.appType,subtype:c.subtype,platformSlug:c.platformSlug}}if(!je()){let s=o.length>0?`Pass --app <slug|gid> (or set NPAYLOAD_APP). Available: ${o.map(c=>c.slug).join(", ")}.`:"This organization has no apps yet; create one in the dashboard, then pass --app <slug|gid>.";throw new Error(`A non-interactive login must choose an existing app. ${s}`)}let i=n;if(o.length>0&&(i=await He("Select an app or create a new one",[...o.map(s=>({name:`${s.name} (${s.slug}) \u2014 ${s.appType}`,value:s.gid})),{name:Fe.green("\uFF0B")+" Create a new app",value:n}])),i!==n){let s=o.find(c=>c.gid===i);return console.log(Fe.green("\u2713")+` ${s.name}`),{appId:s.gid,appName:s.name,appSlug:s.slug,appType:s.appType,subtype:s.subtype,platformSlug:s.platformSlug}}return r_(e,t)}a(n_,"selectOrCreateApp");async function r_(e,t){let o=await Pr("App name:",{validate:a(u=>u.trim().length>0?!0:"App name is required","validate")}),n=await He("What kind of app?",Qk),i=n==="feed"?void 0:await He("Who does this app serve?",Yk),s,c;if(n==="connect"){let u=await He("What kind of connect app?",Xk);u!=="none"&&(s=u),s==="platform"&&(c=(await Pr("Platform slug (e.g. shopify, hubspot):",{validate:a(l=>/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(l.trim())?!0:"Platform slug must be lowercase alphanumeric with hyphens","validate")})).trim())}for(let u=0;u<5;u++){let l=await Pr("Slug:",{default:u===0?e_(o):"",validate:a(d=>d.trim()?/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(d.trim())?!0:"Slug must be lowercase alphanumeric with hyphens, no leading/trailing hyphens":"Slug is required","validate")});try{let d=await Rr(`Creating app ${o.trim()}\u2026`,()=>e.createApp(t,{name:o.trim(),slug:l.trim(),appType:n,...i!==void 0?{tenancyMode:i}:{},subtype:s,platformSlug:c}),()=>`App created: ${o.trim()}`);return{appId:d.gid,appName:o.trim(),appSlug:d.slug,appType:n,subtype:s,platformSlug:c}}catch(d){F(d);let m=d instanceof Error?d.message:"";if(m.toLowerCase().includes("slug")||m.toLowerCase().includes("taken")){console.log(Fe.red(` ${m} Choose another.`));continue}throw d}}throw new Error("Could not create the app after several attempts.")}a(r_,"createApp");import{existsSync as o_,readFileSync as i_,writeFileSync as s_}from"fs";import{join as a_}from"path";function fi(e){let t=!1;for(let r=0;r<e.length;r++){let o=e[r];if(t){if(o==="\\"&&t==='"'){r++;continue}o===t&&(t=!1);continue}if(o==='"'||o==="'")t=o;else if(o==="#")return e.slice(0,r).trim()}return e.trim()}a(fi,"codePart");function c_(e){return e.startsWith("[")}a(c_,"isHeaderLine");function Or(e,t){for(let r=0;r<e.length;r++)if(fi(e[r])===t)return r;return-1}a(Or,"findHeader");function _y(e,t){for(let r=t+1;r<e.length;r++)if(c_(fi(e[r])))return r;return e.length}a(_y,"sectionEnd");function ky(e,t,r,o){let n=_y(e,t),i=`${r} = "${o}"`;for(let s=t+1;s<n;s++){let c=fi(e[s]);if(c.startsWith(`${r} =`)||c.startsWith(`${r}=`)){if(c===i)return;e[s]=i;return}}e.splice(t+1,0,i)}a(ky,"setKeyInSection");function u_(e,t){let r=e.includes(`\r
|
|
205
|
+
`)?`\r
|
|
206
|
+
`:`
|
|
207
|
+
`,o=e.split(/\r?\n/),n=Or(o,"[app]");if(n===-1){let i=0;for(;i<o.length;){if(fi(o[i])===""||o[i].trim().startsWith("#")){i++;continue}break}o.splice(i,0,"[app]",`slug = "${t.slug}"`,""),n=i}else ky(o,n,"slug",t.slug);return t.name&&t.name!==t.slug&&ky(o,n,"name",t.name),o.join(r)}a(u_,"setAppIdentity");function l_(e,t){let r=e.includes(`\r
|
|
208
|
+
`)?`\r
|
|
209
|
+
`:`
|
|
210
|
+
`,o=e.split(/\r?\n/);for(let n of t){if(Or(o,`[env.${n.slug}]`)!==-1)continue;let i=[`[env.${n.slug}]`,`kind = "${n.kind}"`,...n.name&&n.name!==n.slug?[`name = "${n.name}"`]:[],""],s=Or(o,"[access_scopes]");if(s!==-1){let c=s;for(;c>0;){let u=o[c-1].trim();if(u===""||u.startsWith("#"))c--;else break}o.splice(c,0,...i)}else o.length>0&&o[o.length-1].trim()!==""&&o.push(""),o=[...o,...i]}return o.join(r)}a(l_,"ensureEnvSections");var Uc={changed:!1,addedEnvSections:[],appUpdated:!1};function gi(e,t){let r=a_(e,Dh);if(!o_(r))return Uc;let o=i_(r,"utf8"),n=o;t.app&&(n=u_(n,t.app));let i=[];if(t.envs&&t.envs.length>0){for(let c of t.envs)Or(n.split(/\r?\n/),`[env.${c.slug}]`)!==-1||i.push(c.slug);n=l_(n,t.envs)}if(n===o)return Uc;try{jh(n)}catch{return Uc}let s=a(c=>{let u=c.split(/\r?\n/),l=Or(u,"[app]");return l===-1?"":u.slice(l,_y(u,l)).join(`
|
|
211
|
+
`)},"appSection");return s_(r,n,"utf8"),{changed:!0,addedEnvSections:i,appUpdated:t.app!==void 0&&s(o)!==s(n)}}a(gi,"reconcileManifestFile");function Sy(e,t,r){try{gi(e,{app:{slug:t,name:r}}).appUpdated&&console.log($y.green("\u2713")+` npayload.toml updated (app ${$y.bold(t)})`)}catch{}}a(Sy,"reconcileManifestIdentity");async function hi(e,t={}){let{base:r}=Ph(t.authUrl);pi(e,{edgeUrl:t.edgeUrl,signIn:`${r}/oauth/cli/code`},{edge:"Name the edge of that estate with NPAYLOAD_EDGE_URL, or name nothing outside npayload's production hosts to use its production estate.",signIn:"Name that estate's auth host with NPAYLOAD_AUTH_URL or its API with NPAYLOAD_API_URL (export what the project's .env names), so the sign-in goes there, or name nothing outside npayload's production hosts."});let o=p_(e),n=await by({authServerUrl:r,debug:t.debug}),i=await xy(n,{rotate:t.rotate,needSecret:!o,...t.org?{org:t.org}:{},...t.app?{app:t.app}:{}}),s=i.hmacSecret;if(o&&(s===void 0||s===""))return t.env&&Iy(e,t.env),Sy(e,i.appSlug,i.appName),{appName:i.appName,appSlug:i.appSlug,appId:i.appId,appType:i.appType,subtype:i.subtype,platformSlug:i.platformSlug,clientId:i.clientId,dpopKid:Tr(e)?.kid??"",filled:!1};let c=Tr(e)??ci();return jc(e),f_(e,{clientId:i.clientId,hmacSecret:s??"",appId:i.appId,apiUrl:t.apiUrl,edgeUrl:t.edgeUrl,dpop:c}),g_(e,{clientId:i.clientId,hmacSecret:s??"",appId:i.appId,appSlug:i.appSlug,dpop:c}),t.env&&Iy(e,t.env),Sy(e,i.appSlug,i.appName),{appName:i.appName,appSlug:i.appSlug,appId:i.appId,appType:i.appType,subtype:i.subtype,platformSlug:i.platformSlug,clientId:i.clientId,dpopKid:c.kid,filled:!0}}a(hi,"connectProject");function yi(e){return[`App: ${e.appName} (${e.appSlug})`,`Client: ${e.clientId}`,`DPoP key: ${e.dpopKid||"(none registered)"}`,e.filled?"Real credentials written to .env + .npayload.json.":"Credentials already present \u2014 reconciled to the same state."]}a(yi,"connectedSummaryLines");function Iy(e,t){let r=t.trim();if(!r)return;let o=jr(e,".npayload.json"),n={};if(Nr(o))try{n=JSON.parse(Dr(o,"utf8"))}catch{n={}}n.targetEnv!==r&&d_(o,JSON.stringify({...n,targetEnv:r},null,2)+`
|
|
212
|
+
`,{encoding:"utf8",mode:384})}a(Iy,"persistTargetEnv");function p_(e){let t=jr(e,".npayload.json");if(Nr(t))try{let o=JSON.parse(Dr(t,"utf8"));if(!cn(o.clientId)&&!cn(o.hmacSecret))return!0}catch{}let r=jr(e,".env");if(Nr(r)){let o=m_(Dr(r,"utf8"));if(!cn(o.NPAYLOAD_CLIENT_ID)&&!cn(o.NPAYLOAD_HMAC_SECRET))return!0}return!1}a(p_,"projectHasRealCredentials");function m_(e){let t={};for(let r of e.split(`
|
|
213
|
+
`)){let o=r.trim();if(!o||o.startsWith("#"))continue;let n=o.indexOf("=");n<=0||(t[o.slice(0,n).trim()]=o.slice(n+1))}return t}a(m_,"readEnvVars");function f_(e,t){let r=jr(e,".env"),o=Nr(r)?Dr(r,"utf8"):void 0,n={NPAYLOAD_CLIENT_ID:t.clientId,NPAYLOAD_HMAC_SECRET:t.hmacSecret,NPAYLOAD_APP_ID:t.appId,NPAYLOAD_DPOP_KID:t.dpop.kid,NPAYLOAD_DPOP_PRIVATE_JWK:JSON.stringify(t.dpop.privateJwk)};if(t.apiUrl&&(n.NPAYLOAD_API_URL=t.apiUrl),t.edgeUrl&&(n.NPAYLOAD_EDGE_URL=t.edgeUrl),o===void 0){let d=Object.entries(n).map(([m,p])=>`${m}=${p}`).join(`
|
|
214
|
+
`);Ye(r,d+`
|
|
215
|
+
`);return}let i=o.split(`
|
|
216
|
+
`),s=new Set,c=i.map(d=>{let m=d.indexOf("=");if(m<=0||d.trim().startsWith("#"))return d;let p=d.slice(0,m).trim();return p in n?(s.add(p),`${p}=${n[p]}`):d}),u=Object.entries(n).filter(([d])=>!s.has(d)),l=c.join(`
|
|
217
|
+
`);u.length>0&&(l.endsWith(`
|
|
218
|
+
`)||(l+=`
|
|
219
|
+
`),l+=u.map(([d,m])=>`${d}=${m}`).join(`
|
|
220
|
+
`)+`
|
|
221
|
+
`),Ye(r,l)}a(f_,"fillEnv");function g_(e,t){let r=jr(e,".npayload.json"),o={};if(Nr(r))try{o=JSON.parse(Dr(r,"utf8"))}catch{o={}}let n={...o,clientId:t.clientId,hmacSecret:t.hmacSecret,...t.appId?{appId:t.appId}:{},...t.appSlug?{appSlug:t.appSlug}:{},dpopKid:t.dpop.kid,dpopPrivateJwk:t.dpop.privateJwk,dpopPublicJwk:t.dpop.publicJwk};Ye(r,JSON.stringify(n,null,2)+`
|
|
222
|
+
`)}a(g_,"fillProjectCredentials");import{existsSync as Xe,readFileSync as h_}from"fs";import{join as et}from"path";function Py(e=process.cwd()){let t=et(e,"package.json");if(!Xe(t))return"node";let r={};try{let o=JSON.parse(h_(t,"utf8"));r={...o.dependencies,...o.devDependencies}}catch{return"node"}return r.next?"nextjs":r["@remix-run/react"]||r["@remix-run/node"]||r["@remix-run/server-runtime"]?"remix":r.hono?"hono":r.express?"express":r.react?"react":"node"}a(Py,"detectFramework");function Ey(e=process.cwd()){let t=process.env.npm_config_user_agent??"";return t.startsWith("bun")?"bun":t.startsWith("pnpm")?"pnpm":t.startsWith("yarn")?"yarn":Xe(et(e,"bun.lock"))||Xe(et(e,"bun.lockb"))?"bun":Xe(et(e,"pnpm-lock.yaml"))?"pnpm":Xe(et(e,"yarn.lock"))?"yarn":"npm"}a(Ey,"detectPackageManager");function Ty(e=process.cwd()){return Xe(et(e,"package.json"))}a(Ty,"hasPackageJson");function vi(e=process.cwd()){return{hasNpayloadDir:Xe(et(e,"npayload")),hasConfig:Xe(et(e,"npayload.config.ts"))||Xe(et(e,"npayload.config.js")),hasProjectCreds:Xe(et(e,".npayload.json")),hasEnv:Xe(et(e,".env"))}}a(vi,"detectExistingSetup");function Ay(e,t){switch(e){case"bun":return`bun add ${t}`;case"pnpm":return`pnpm add ${t}`;case"yarn":return`yarn add ${t}`;default:return`npm install ${t} --no-audit --no-fund --loglevel=error`}}a(Ay,"getInstallCommand");import{spawn as y_}from"child_process";import{readFileSync as v_,writeFileSync as b_}from"fs";import{join as w_}from"path";var x_={"npayload:listen":"npayload listen","npayload:promote":"npayload promote create"};async function Cy(e,t,r,o,n){let i=Ay(e,t.join(" ")),s={...process.env};if(o)for(let c of Object.keys(s))/^npm_config_.*registry$/i.test(c)&&delete s[c];await new Promise((c,u)=>{let l=y_(i,{cwd:r,env:s,shell:!0,stdio:["ignore","pipe","pipe"]}),d=a(m=>{if(n)for(let p of m.toString().split(/\r?\n/)){let f=p.trim();f&&n(f)}},"feed");l.stdout?.on("data",d),l.stderr?.on("data",d),l.on("error",u),l.on("close",m=>m===0?c():u(new Error(`${e} install exited with code ${m}`)))})}a(Cy,"installDependencies");function Ry(e){let t=w_(e,"package.json"),r=v_(t,"utf8"),o=JSON.parse(r),n=o.scripts??{},i=[];for(let[c,u]of Object.entries(x_))c in n||(n[c]=u,i.push(c));o.scripts=n,o.type===void 0&&(o.type="module",i.push('type: "module"'));let s=r.startsWith(`{
|
|
223
|
+
`)?2:r.startsWith(`{
|
|
224
|
+
`)?" ":2;return b_(t,JSON.stringify(o,null,s)+`
|
|
225
|
+
`,"utf8"),i}a(Ry,"addScripts");function __(e){try{let t=Ny(e,"node_modules");if(!k_(t))return 0;let r=0;for(let o of Oy(t))if(!o.startsWith("."))if(o.startsWith("@"))try{r+=Oy(Ny(t,o)).filter(n=>!n.startsWith(".")).length}catch{}else r++;return r}catch{return 0}}a(__,"countInstalledPackages");async function Dy(e){let t=process.cwd();if(console.log(_h()),!Ty(t))throw new C("No package.json found in this directory.",{code:"NO_PACKAGE_JSON",hint:"Run `npm init -y` first, then re-run `npx @npayload/sdk init` from your project root.",docs:"https://docs.npayload.com/docs/start/initialize"});e.http||pi(t,{edgeUrl:e.edgeUrl},{edge:"Name the edge of that estate with --edge-url or NPAYLOAD_EDGE_URL, or name nothing outside npayload's production hosts to use its production estate.",signIn:""});let r=vi(t);(r.hasNpayloadDir||r.hasConfig)&&!e.dryRun&&(e.force?console.log(L.yellow(" npayload already set up \u2014 overwriting existing files (--force).")):(console.log(L.dim(" npayload already set up \u2014 adding missing files, existing files are preserved.")),console.log(L.dim(" Re-run with --force to overwrite, or --dry-run to preview."))));let o=Py(t),n=Sh(),i=void 0,s={appName:process.env.NPAYLOAD_APP_NAME??"my-app",appSlug:process.env.NPAYLOAD_APP_SLUG??"my-app",appId:xh,appType:process.env.NPAYLOAD_APP_TYPE??"internal",subtype:process.env.NPAYLOAD_APP_SUBTYPE,platformSlug:process.env.NPAYLOAD_PLATFORM_SLUG,framework:o,clientId:bh,hmacSecret:wh,apiUrl:e.apiUrl,targetEnv:n,transport:e.http?"http":"npp",edgeUrl:e.edgeUrl},c=(process.env.NPAYLOAD_FIRST_ENV??"").trim()||"sandbox",u=on(e.dryRun?"Previewing scaffold (dry run)...":"Scaffolding npayload/..."),l=vy(t,s,{force:e.force,dryRun:e.dryRun,firstEnv:c});u.succeed(e.dryRun?`Dry run: ${l.written.length} to write, ${l.skipped.length} preserved`:`Scaffolded ${l.written.length} files`+(l.skipped.length?`, ${l.skipped.length} preserved`:"")),console.log();for(let x of l.written)console.log(L.dim(` ${L.green("+")} ${x}`));for(let x of l.skipped)console.log(L.dim(` ${L.yellow("=")} ${x} ${L.dim("(exists, preserved)")}`));if(e.dryRun){console.log(),console.log(L.bold(" Dry run complete \u2014 no files were written.")),console.log(L.dim(" Re-run without --dry-run to apply, or with --force to overwrite existing files."));return}let d=s.appName,m=s.appSlug,p=s.appType,f=!1,g=[];if(e.skipAuth)console.log(),console.log(L.dim(" Auth skipped (--skip-auth). Credentials left as placeholders.")),console.log(L.dim(" Run `npayload login` to connect this project."));else{console.log();try{let x=await hi(t,{authUrl:e.authUrl,apiUrl:e.apiUrl,edgeUrl:e.edgeUrl,rotate:e.rotate,debug:e.debug});d=x.appName,m=x.appSlug,p=x.appType,f=!0,g=yi(x)}catch(x){let E=x instanceof Error?x.message:String(x);console.log(L.yellow(" Could not connect this project right now.")),console.log(L.dim(` ${se(E,x)}`)),console.log(),console.log(" "+L.bold("Run `npayload login` to connect this project.")+L.dim(" (your files are already scaffolded)"))}}if(e.skipInstall)console.log(L.dim(`
|
|
226
|
+
Install skipped (--skip-install)`));else{console.log();let x=e.packageManager??Ey(t),E=void 0,k=E?.pkgs??[Qo()];k.push("dotenv");let O=E?.label??"npayload",A=on(`Installing ${O} (${x})\u2026`),j=Date.now(),U="",K=setInterval(()=>{let V=Math.round((Date.now()-j)/1e3);A.text=`Installing ${O} (${x})\u2026 ${V}s`+(U?` \u2014 ${U}`:"")},500);try{await Cy(x,k,t,i,D=>{/added|packages|resolv|reify|fetch|download|link|progress/i.test(D)&&(U=D.length>48?D.slice(0,47)+"\u2026":D)}),clearInterval(K);let V=__(t);A.succeed(V>0?`${O} + dotenv installed (${V} packages)`:`${O} + dotenv installed`)}catch{clearInterval(K),A.warn(`Failed to install packages. Run manually: ${x} install ${k.join(" ")}`)}try{let V=Ry(t);V.length>0&&console.log(L.dim(` Added scripts: ${V.join(", ")}`))}catch{console.log(L.dim(" Could not update package.json scripts."))}}let v={internal:"Internal",connect:"Connect",platform:"Platform",feed:"Feed"},h={nextjs:"Next.js",remix:"Remix",express:"Express",hono:"Hono",react:"React",node:"Node.js"};if(f){let x=a(k=>` ${L.dim("\u2500\u2500")} ${L.bold(k)} ${L.dim("\u2500".repeat(Math.max(2,56-k.length)))}`,"rule"),E=a((k,O)=>` ${L.green(k.padEnd(24))}${L.dim(O)}`,"cmd");console.log(["",` ${kh()} ${Xo("Connected.")}`,"",` ${L.dim("app")} ${L.cyan(d)} ${L.dim(`(${m}) \xB7 ${v[p]} \xB7 ${h[o]}`)}`,` ${L.dim("credential")} ${L.dim("machine identity with generated per-object permissions \u2014 no keys to manage")}`,...g.map(k=>` ${L.dim(k)}`),` ${L.dim("workspace")} ${L.cyan("npayload/")} ${L.dim("config + generated types (commit it) \xB7 secrets stay in .env")}`,"",x("The loop"),"",E("npayload validate","check your config against the contract (offline)"),E("npayload diff","see exactly what would change \u2014 nothing applied"),E("npayload push","apply to your sandbox + regenerate typed payloads"),E("npayload tail <channel>","watch events arrive, live, in this terminal"),E("npayload doctor","one-line diagnosis when anything feels off"),E("npayload deploy","the one deliberate path to production"),"",x("Hand it to your AI agent"),"",` ${L.dim("Your editor's agent is already wired to npayload (.mcp.json). Paste this:")}`,"",` ${L.cyan('"Set up npayload Events for this app end to end: study my data model,')}`,` ${L.cyan(" design the channels and typed event schemas in npayload/events.config.ts,")}`,` ${L.cyan(" validate, push, wire my code to publish, then prove it \u2014 publish a")}`,` ${L.cyan(' test event and tail the channel."')}`,"",` ${L.dim("Publish from code:")} ${L.white('np.events.publish("<channel>", payload)')} ${L.dim("\u2014 typed after your first push")}`,""].join(`
|
|
227
|
+
`))}else ai([L.bold("npayload scaffolded."),"",`Framework: ${L.cyan(h[o])}`,"Dir: npayload/",`Target: ${n}`,"",L.yellow("Not connected yet \u2014 credentials are placeholders."),"",L.bold("Connect, then let your agent build it:"),"",` ${L.green("npayload login")} sign in + provision + fill credentials`,"",L.dim(' Then ask your coding agent: "set up npayload Events for this app" \u2014 it uses the'),L.dim(" npayload MCP (start with the npayload_overview tool).")])}a(Dy,"runInit");function $_(e){if(e.transport&&e.transport!=="http"&&e.transport!=="npp")throw new C(`Unknown transport "${e.transport}". Use npp (default) or http.`,{code:"INVALID_TRANSPORT",hint:"Run `npx @npayload/sdk init` for the default NPP wire, or `--transport http` for HTTP/JSON."});return e.http===!0||e.transport==="http"?"http":"npp"}a($_,"resolveInitTransport");function jy(e){e.command("init").description("set up npayload in your project (device-flow auth + scaffold)").option("--skip-install","skip dependency installation").option("--skip-auth","skip authentication (use existing credentials)").option("--package-manager <pm>","force package manager: npm | pnpm | yarn | bun").option("--force","overwrite existing scaffold files (default: preserve them)").option("--rotate","issue a fresh app secret on re-run (invalidates the previous one)").option("--dry-run","preview what init would do without writing any files").option("--http","scaffold the HTTP/JSON transport instead of the NPP default").option("--transport <npp|http>","wire transport to scaffold (default: npp) \u2014 `--transport http` is the long form of `--http`").option("--edge-url <url>","override the edge the secure (NPP) transport connects to (default for the production API: https://npp.npayload.com), written into .env as NPAYLOAD_EDGE_URL").action(async r=>{try{let o=$_({http:r.http,transport:r.transport})==="http";await Dy({skipInstall:r.skipInstall??!1,skipAuth:r.skipAuth??!1,packageManager:r.packageManager,force:r.force??!1,rotate:r.rotate??!1,dryRun:r.dryRun??!1,apiUrl:ne(process.env.NPAYLOAD_API_URL,"apiUrl"),authUrl:ne(process.env.NPAYLOAD_AUTH_URL,"authUrl"),debug:process.env.NPAYLOAD_DEBUG==="1",http:o,edgeUrl:ne(r.edgeUrl??process.env.NPAYLOAD_EDGE_URL,"edgeUrl")})}catch(o){de(o)}})}a(jy,"registerInit");var Uy={org:"NPAYLOAD_ORG",app:"NPAYLOAD_APP",env:"NPAYLOAD_TARGET_ENV"};function Ly(e,t=process.env){let r={};for(let o of Object.keys(Uy)){let i=e[o]?.trim()||t[Uy[o]]?.trim();i&&(r[o]=i)}return r}a(Ly,"resolveLoginTargets");import On from"chalk";function zy(e){let t=a(async(o,n)=>{try{let i=process.cwd(),s=vi(i);if(!s.hasNpayloadDir&&!s.hasConfig&&!s.hasEnv)throw new C("No npayload project found in this directory.",{code:"NO_SCAFFOLD",hint:"Run `npx @npayload/sdk init` first to scaffold the project, then `npayload login` to connect it.",docs:"https://docs.npayload.com/docs/start/initialize"});console.log(),console.log(On.bold(" npayload login")+On.dim(" \u2014 connect this project."));let{org:c,app:u,env:l}=Ly({org:o.org,app:o.app,env:dt({env:o.env},n)}),d=await hi(i,{authUrl:ne(process.env.NPAYLOAD_AUTH_URL,"authUrl"),apiUrl:ne(process.env.NPAYLOAD_API_URL,"apiUrl"),edgeUrl:ne(process.env.NPAYLOAD_EDGE_URL,"edgeUrl"),rotate:o.rotate??!1,debug:process.env.NPAYLOAD_DEBUG==="1",...c?{org:c}:{},...u?{app:u}:{},...l?{env:l}:{}}),m=mi();ai([On.bold(d.filled?"Connected!":"Already connected."),"",...yi(d).map(p=>On.dim(p)),...m!==void 0?[`Dashboard: ${On.cyan(`${m}/apps/${d.appSlug}/sandbox`)}`]:[],"",` ${On.green("npx tsx npayload/events/publish.ts")} publish your first signal`])}catch(i){de(i)}},"handler"),r=a(o=>o.description("connect an already-scaffolded project (device-flow auth + provision + fill credentials)").option("--rotate","issue a fresh app secret (invalidates the previous one)").option("--org <slug|gid>","select this organization without prompting (env: NPAYLOAD_ORG)").option("--app <slug|gid>","select this existing app without prompting (env: NPAYLOAD_APP)").option("--env <slug>","record this logical environment as the project target (env: NPAYLOAD_TARGET_ENV)").action(t),"defineLogin");r(e.command("login")),r(Lc(e).command("login"))}a(zy,"registerLogin");function Lc(e){return e.commands.find(t=>t.name()==="auth")??e.command("auth").description("The credential the CLI signs in with (login, status)")}a(Lc,"authGroup");import{spawn as S_}from"child_process";var dn={stderr:a(e=>{process.stderr.write(e)},"stderr"),forward:a(e=>new Promise(t=>{let r=S_(process.argv[0]??"node",[process.argv[1]??"",...e],{stdio:"inherit",env:process.env});r.on("close",o=>t(o??0)),r.on("error",o=>{process.stderr.write(`Forward failed: ${o.message}
|
|
228
|
+
`),t(1)})}),"forward"),exit:a(e=>{process.exitCode=e},"exit")},I_=new Set(["grants","consents"]),My="Migration: use `np connect grants` for every grant and consent command.";function P_(e){let t=[...e],r=[];t.length>0&&I_.has(t[0])&&r.push(t.shift());let o=t[0];return o===void 0||o.startsWith("-")?{unknown:`[deprecated] 'np federation${r.length?` ${r.join(" ")}`:""}' names no verb; the surface moved to 'np connect grants' \u2014 run 'np connect grants --help' for the supported verbs.
|
|
229
|
+
`}:(r.push(o),{v2Args:["connect","grants",o,...t.slice(1)],invoked:`np federation ${r.join(" ")}`,target:`np connect grants ${o}`})}a(P_,"federationForward");function E_(){let e=(process.env.NPAYLOAD_FEDERATION_HARD_FAIL??"").trim().toLowerCase();return e==="1"||e==="true"||e==="yes"}a(E_,"isHardFailMode");function Fy(e){e.command("federation",{hidden:!0}).description("DEPRECATED \u2014 use 'np connect grants' (V1 federation retired)").argument("[tokens...]","the V1 verb and its arguments").allowUnknownOption(!0).allowExcessArguments(!0).action(async(t,r,o)=>{let n=P_(o.args);if("unknown"in n){dn.stderr(n.unknown),dn.exit(2);return}if(E_()){dn.stderr(`[deprecated] '${n.invoked}' has been retired: run '${n.target}' instead. ${My}
|
|
230
|
+
`),dn.exit(2);return}dn.stderr(`[deprecated] '${n.invoked}' is deprecated. Forwarding to '${n.target}'.
|
|
231
|
+
After 6 months post-GA this command exits non-zero; set NPAYLOAD_FEDERATION_HARD_FAIL=1 to opt in early. ${My}
|
|
232
|
+
`),dn.exit(await dn.forward(n.v2Args))})}a(Fy,"registerFederation");var Re="1.36.1";var pt=[],qe=[],T_=Uint8Array,zc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pn=0,qy=zc.length;pn<qy;++pn)pt[pn]=zc[pn],qe[zc.charCodeAt(pn)]=pn;var pn,qy;qe[45]=62;qe[95]=63;function A_(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var o=r===t?0:4-r%4;return[r,o]}a(A_,"getLens");function C_(e,t,r){return(t+r)*3/4-r}a(C_,"_byteLength");function Ur(e){var t,r=A_(e),o=r[0],n=r[1],i=new T_(C_(e,o,n)),s=0,c=n>0?o-4:o,u;for(u=0;u<c;u+=4)t=qe[e.charCodeAt(u)]<<18|qe[e.charCodeAt(u+1)]<<12|qe[e.charCodeAt(u+2)]<<6|qe[e.charCodeAt(u+3)],i[s++]=t>>16&255,i[s++]=t>>8&255,i[s++]=t&255;return n===2&&(t=qe[e.charCodeAt(u)]<<2|qe[e.charCodeAt(u+1)]>>4,i[s++]=t&255),n===1&&(t=qe[e.charCodeAt(u)]<<10|qe[e.charCodeAt(u+1)]<<4|qe[e.charCodeAt(u+2)]>>2,i[s++]=t>>8&255,i[s++]=t&255),i}a(Ur,"toByteArray");function R_(e){return pt[e>>18&63]+pt[e>>12&63]+pt[e>>6&63]+pt[e&63]}a(R_,"tripletToBase64");function O_(e,t,r){for(var o,n=[],i=t;i<r;i+=3)o=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),n.push(R_(o));return n.join("")}a(O_,"encodeChunk");function Lr(e){for(var t,r=e.length,o=r%3,n=[],i=16383,s=0,c=r-o;s<c;s+=i)n.push(O_(e,s,s+i>c?c:s+i));return o===1?(t=e[r-1],n.push(pt[t>>2]+pt[t<<4&63]+"==")):o===2&&(t=(e[r-2]<<8)+e[r-1],n.push(pt[t>>10]+pt[t>>4&63]+pt[t<<2&63]+"=")),n.join("")}a(Lr,"fromByteArray");function Ze(e){if(e===void 0)return{};if(!bi(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}a(Ze,"parseArgs");function Nn(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}a(Nn,"validateDeploymentUrl");function bi(e){let t=typeof e=="object",r=Object.getPrototypeOf(e),o=r===null||r===Object.prototype||r?.constructor?.name==="Object";return t&&o}a(bi,"isSimpleObject");var Vy=!0,Dn=BigInt("-9223372036854775808"),Gc=BigInt("9223372036854775807"),qc=BigInt("0"),N_=BigInt("8"),D_=BigInt("256");function By(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}a(By,"isSpecial");function j_(e){e<qc&&(e-=Dn+Dn);let t=e.toString(16);t.length%2===1&&(t="0"+t);let r=new Uint8Array(new ArrayBuffer(8)),o=0;for(let n of t.match(/.{2}/g).reverse())r.set([parseInt(n,16)],o++),e>>=N_;return Lr(r)}a(j_,"slowBigIntToBase64");function U_(e){let t=Ur(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let r=qc,o=qc;for(let n of t)r+=BigInt(n)*D_**o,o++;return r>Gc&&(r+=Dn+Dn),r}a(U_,"slowBase64ToBigInt");function L_(e){if(e<Dn||Gc<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);let t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),Lr(new Uint8Array(t))}a(L_,"modernBigIntToBase64");function z_(e){let t=Ur(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}a(z_,"modernBase64ToBigInt");var M_=DataView.prototype.setBigInt64?L_:j_,F_=DataView.prototype.getBigInt64?z_:U_,Zy=1024;function Zc(e){if(e.length>Zy)throw new Error(`Field name ${e} exceeds maximum field name length ${Zy}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){let r=e.charCodeAt(t);if(r<32||r>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}a(Zc,"validateObjectField");function he(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(o=>he(o));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);let t=Object.entries(e);if(t.length===1){let o=t[0][0];if(o==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return Ur(e.$bytes).buffer}if(o==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return F_(e.$integer)}if(o==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);let n=Ur(e.$float);if(n.byteLength!==8)throw new Error(`Received ${n.byteLength} bytes, expected 8 for $float`);let s=new DataView(n.buffer).getFloat64(0,Vy);if(!By(s))throw new Error(`Float ${s} should be encoded as a number`);return s}if(o==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(o==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}let r={};for(let[o,n]of Object.entries(e))Zc(o),r[o]=he(n);return r}a(he,"jsonToConvex");var Gy=16384;function mn(e){let t=JSON.stringify(e,(r,o)=>o===void 0?"undefined":typeof o=="bigint"?`${o.toString()}n`:o);if(t.length>Gy){let r="[...truncated]",o=Gy-r.length,n=t.codePointAt(o-1);return n!==void 0&&n>65535&&(o-=1),t.substring(0,o)+r}return t}a(mn,"stringifyValueForError");function wi(e,t,r,o){if(e===void 0){let s=r&&` (present at path ${r} in original object ${mn(t)})`;throw new Error(`undefined is not a valid Convex value${s}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<Dn||Gc<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:M_(e)}}if(typeof e=="number")if(By(e)){let s=new ArrayBuffer(8);return new DataView(s).setFloat64(0,e,Vy),{$float:Lr(new Uint8Array(s))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:Lr(new Uint8Array(e))};if(Array.isArray(e))return e.map((s,c)=>wi(s,t,r+`[${c}]`,!1));if(e instanceof Set)throw new Error(Fc(r,"Set",[...e],t));if(e instanceof Map)throw new Error(Fc(r,"Map",[...e],t));if(!bi(e)){let s=e?.constructor?.name,c=s?`${s} `:"";throw new Error(Fc(r,c,e,t))}let n={},i=Object.entries(e);i.sort(([s,c],[u,l])=>s===u?0:s<u?-1:1);for(let[s,c]of i)c!==void 0?(Zc(s),n[s]=wi(c,t,r+`.${s}`,!1)):o&&(Zc(s),n[s]=q_(c,t,r+`.${s}`));return n}a(wi,"convexToJsonInternal");function Fc(e,t,r,o){return e?`${t}${mn(r)} is not a supported Convex type (present at path ${e} in original object ${mn(o)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${mn(r)} is not a supported Convex type.`}a(Fc,"errorMessageForUnsupportedType");function q_(e,t,r){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${mn(e)} but original value is undefined`);return wi(e,t,r,!1)}a(q_,"convexOrUndefinedToJsonInternal");function ye(e){return wi(e,e,"",!1)}a(ye,"convexToJson");var Z_=Object.defineProperty,G_=a((e,t,r)=>t in e?Z_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),oe=a((e,t,r)=>G_(e,typeof t!="symbol"?t+"":t,r),"__publicField"),V_="https://docs.convex.dev/error#undefined-validator";function zr(e,t){let r=t!==void 0?` for field "${t}"`:"";throw new Error(`A validator is undefined${r} in ${e}. This is often caused by circular imports. See ${V_} for details.`)}a(zr,"throwUndefinedValidatorError");var Pe=class{static{a(this,"BaseValidator")}constructor({isOptional:t}){oe(this,"type"),oe(this,"fieldPaths"),oe(this,"isOptional"),oe(this,"isConvexValidator"),this.isOptional=t,this.isConvexValidator=!0}},xi=class e extends Pe{static{a(this,"VId")}constructor({isOptional:t,tableName:r}){if(super({isOptional:t}),oe(this,"tableName"),oe(this,"kind","id"),typeof r!="string")throw new Error("v.id(tableName) requires a string");this.tableName=r}get json(){return{type:"id",tableName:this.tableName}}asOptional(){return new e({isOptional:"optional",tableName:this.tableName})}},Mr=class e extends Pe{static{a(this,"VFloat64")}constructor(){super(...arguments),oe(this,"kind","float64")}get json(){return{type:"number"}}asOptional(){return new e({isOptional:"optional"})}},Fr=class e extends Pe{static{a(this,"VInt64")}constructor(){super(...arguments),oe(this,"kind","int64")}get json(){return{type:"bigint"}}asOptional(){return new e({isOptional:"optional"})}},ki=class e extends Pe{static{a(this,"VBoolean")}constructor(){super(...arguments),oe(this,"kind","boolean")}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:"optional"})}},_i=class e extends Pe{static{a(this,"VBytes")}constructor(){super(...arguments),oe(this,"kind","bytes")}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:"optional"})}},$i=class e extends Pe{static{a(this,"VString")}constructor(){super(...arguments),oe(this,"kind","string")}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:"optional"})}},Si=class e extends Pe{static{a(this,"VNull")}constructor(){super(...arguments),oe(this,"kind","null")}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:"optional"})}},Ii=class e extends Pe{static{a(this,"VAny")}constructor(){super(...arguments),oe(this,"kind","any")}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:"optional"})}},Pi=class e extends Pe{static{a(this,"VObject")}constructor({isOptional:t,fields:r}){super({isOptional:t}),oe(this,"fields"),oe(this,"kind","object"),globalThis.Object.entries(r).forEach(([o,n])=>{if(n===void 0&&zr("v.object()",o),!n.isConvexValidator)throw new Error("v.object() entries must be validators")}),this.fields=r}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([t,r])=>[t,{fieldType:r.json,optional:r.isOptional==="optional"}]))}}asOptional(){return new e({isOptional:"optional",fields:this.fields})}omit(...t){let r={...this.fields};for(let o of t)delete r[o];return new e({isOptional:this.isOptional,fields:r})}pick(...t){let r={};for(let o of t)r[o]=this.fields[o];return new e({isOptional:this.isOptional,fields:r})}partial(){let t={};for(let[r,o]of globalThis.Object.entries(this.fields))t[r]=o.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},Ei=class e extends Pe{static{a(this,"VLiteral")}constructor({isOptional:t,value:r}){if(super({isOptional:t}),oe(this,"value"),oe(this,"kind","literal"),typeof r!="string"&&typeof r!="boolean"&&typeof r!="number"&&typeof r!="bigint")throw new Error("v.literal(value) must be a string, number, or boolean");this.value=r}get json(){return{type:this.kind,value:ye(this.value)}}asOptional(){return new e({isOptional:"optional",value:this.value})}},Ti=class e extends Pe{static{a(this,"VArray")}constructor({isOptional:t,element:r}){super({isOptional:t}),oe(this,"element"),oe(this,"kind","array"),r===void 0&&zr("v.array()"),this.element=r}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:"optional",element:this.element})}},Ai=class e extends Pe{static{a(this,"VRecord")}constructor({isOptional:t,key:r,value:o}){if(super({isOptional:t}),oe(this,"key"),oe(this,"value"),oe(this,"kind","record"),r===void 0&&zr("v.record()","key"),o===void 0&&zr("v.record()","value"),r.isOptional==="optional")throw new Error("Record validator cannot have optional keys");if(o.isOptional==="optional")throw new Error("Record validator cannot have optional values");if(!r.isConvexValidator||!o.isConvexValidator)throw new Error("Key and value of v.record() but be validators");this.key=r,this.value=o}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:"optional",key:this.key,value:this.value})}},Ci=class e extends Pe{static{a(this,"VUnion")}constructor({isOptional:t,members:r}){super({isOptional:t}),oe(this,"members"),oe(this,"kind","union"),r.forEach((o,n)=>{if(o===void 0&&zr("v.union()",`member at index ${n}`),!o.isConvexValidator)throw new Error("All members of v.union() must be validators")}),this.members=r}get json(){return{type:this.kind,value:this.members.map(t=>t.json)}}asOptional(){return new e({isOptional:"optional",members:this.members})}};function Jy(e){return!!e.isConvexValidator}a(Jy,"isValidator");var q={id:a(e=>new xi({isOptional:"required",tableName:e}),"id"),null:a(()=>new Si({isOptional:"required"}),"null"),number:a(()=>new Mr({isOptional:"required"}),"number"),float64:a(()=>new Mr({isOptional:"required"}),"float64"),bigint:a(()=>new Fr({isOptional:"required"}),"bigint"),int64:a(()=>new Fr({isOptional:"required"}),"int64"),boolean:a(()=>new ki({isOptional:"required"}),"boolean"),string:a(()=>new $i({isOptional:"required"}),"string"),bytes:a(()=>new _i({isOptional:"required"}),"bytes"),literal:a(e=>new Ei({isOptional:"required",value:e}),"literal"),array:a(e=>new Ti({isOptional:"required",element:e}),"array"),object:a(e=>new Pi({isOptional:"required",fields:e}),"object"),record:a((e,t)=>new Ai({isOptional:"required",key:e,value:t}),"record"),union:a((...e)=>new Ci({isOptional:"required",members:e}),"union"),any:a(()=>new Ii({isOptional:"required"}),"any"),optional:a(e=>e.asOptional(),"optional"),nullable:a(e=>q.union(e,q.null()),"nullable")};var B_=Object.defineProperty,J_=a((e,t,r)=>t in e?B_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),Vc=a((e,t,r)=>J_(e,typeof t!="symbol"?t+"":t,r),"__publicField"),Ky,Wy,K_=Symbol.for("ConvexError"),mt=class extends(Wy=Error,Ky=K_,Wy){static{a(this,"ConvexError")}constructor(t){super(typeof t=="string"?t:mn(t)),Vc(this,"name","ConvexError"),Vc(this,"data"),Vc(this,Ky,!0),this.data=t}};var Hy=a(()=>Array.from({length:4},()=>0),"arr"),rN=Hy(),oN=Hy();var H_=Object.defineProperty,Y_=a((e,t,r)=>t in e?H_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),Yy=a((e,t,r)=>Y_(e,typeof t!="symbol"?t+"":t,r),"__publicField"),Q_="color:rgb(0, 145, 255)";function X_(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}a(X_,"prefix_for_source");var Ri=class{static{a(this,"DefaultLogger")}constructor(t){Yy(this,"_onLogLineFuncs"),Yy(this,"_verbose"),this._onLogLineFuncs={},this._verbose=t.verbose}addLogLineListener(t){let r=Math.random().toString(36).substring(2,15);for(let o=0;o<10&&this._onLogLineFuncs[r]!==void 0;o++)r=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[r]=t,()=>{delete this._onLogLineFuncs[r]}}logVerbose(...t){if(this._verbose)for(let r of Object.values(this._onLogLineFuncs))r("debug",`${new Date().toISOString()}`,...t)}log(...t){for(let r of Object.values(this._onLogLineFuncs))r("info",...t)}warn(...t){for(let r of Object.values(this._onLogLineFuncs))r("warn",...t)}error(...t){for(let r of Object.values(this._onLogLineFuncs))r("error",...t)}};function Bc(e){let t=new Ri(e);return t.addLogLineListener((r,...o)=>{switch(r){case"debug":console.debug(...o);break;case"info":console.log(...o);break;case"warn":console.warn(...o);break;case"error":console.error(...o);break;default:console.log(...o)}}),t}a(Bc,"instantiateDefaultLogger");function Jc(e){return new Ri(e)}a(Jc,"instantiateNoopLogger");function fn(e,t,r,o,n){let i=X_(r);if(typeof n=="object"&&(n=`ConvexError ${JSON.stringify(n.errorData,null,2)}`),t==="info"){let s=n.match(/^\[.*?\] /);if(s===null){e.error(`[CONVEX ${i}(${o})] Could not parse console.log`);return}let c=n.slice(1,s[0].length-2),u=n.slice(s[0].length);e.log(`%c[CONVEX ${i}(${o})] [${c}]`,Q_,u)}else e.error(`[CONVEX ${i}(${o})] ${n}`)}a(fn,"logForFunction");var gn=Symbol.for("functionName");var ev=Symbol.for("toReferencePath");function e$(e){return e[ev]??null}a(e$,"extractReferencePath");function t$(e){return e.startsWith("function://")}a(t$,"isFunctionHandle");function jt(e){let t;if(typeof e=="string")t$(e)?t={functionHandle:e}:t={name:e};else if(e[gn])t={name:e[gn]};else{let r=e$(e);if(!r)throw new Error(`${e} is not a functionReference`);t={reference:r}}return t}a(jt,"getFunctionAddress");function ft(e){let t=jt(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;let r=e[gn];if(!r)throw new Error(`${e} is not a functionReference`);return r}a(ft,"getFunctionName");function qr(e){return{[gn]:e}}a(qr,"makeFunctionReference");function tv(e=[]){let t={get(r,o){if(typeof o=="string"){let n=[...e,o];return tv(n)}else if(o===gn){if(e.length<2){let s=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${s}\``)}let n=e.slice(0,-1).join("/"),i=e[e.length-1];return i==="default"?n:n+":"+i}else return o===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},t)}a(tv,"createApi");var n$=tv();var i$=Object.defineProperty,s$=a((e,t,r)=>t in e?i$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),Kc=a((e,t,r)=>s$(e,typeof t!="symbol"?t+"":t,r),"__publicField"),hn=class e{static{a(this,"Long")}constructor(t,r){Kc(this,"low"),Kc(this,"high"),Kc(this,"__isUnsignedLong__"),this.low=t|0,this.high=r|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new e(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){let t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?nv:t>=a$?c$:new e(t%Zr|0,t/Zr|0)}toString(){return(BigInt(this.high)*BigInt(Zr)+BigInt(this.low)).toString()}equals(t){return e.isLong(t)||(t=e.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return e.isLong(t)||(t=e.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?e.fromNumber(t):new e(t.low,t.high)}},nv=new hn(0,0),rv=65536,Zr=rv*rv,a$=Zr*Zr,c$=new hn(-1,-1);var Wc=class extends Error{static{a(this,"InvalidTokenError")}};Wc.prototype.name="InvalidTokenError";var vD=480*60*60*1e3;var d$=Object.defineProperty,p$=a((e,t,r)=>t in e?d$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),gt=a((e,t,r)=>p$(e,typeof t!="symbol"?t+"":t,r),"__publicField");var Oi=560,Gr;var Vr=class{static{a(this,"ConvexHttpClient")}constructor(t,r){if(gt(this,"address"),gt(this,"auth"),gt(this,"adminAuth"),gt(this,"encodedTsPromise"),gt(this,"debug"),gt(this,"fetchOptions"),gt(this,"fetch"),gt(this,"logger"),gt(this,"mutationQueue",[]),gt(this,"isProcessingQueue",!1),typeof r=="boolean")throw new Error("skipConvexDeploymentUrlCheck as the second argument is no longer supported. Please pass an options object, `{ skipConvexDeploymentUrlCheck: true }`.");(r??{}).skipConvexDeploymentUrlCheck!==!0&&Nn(t),this.logger=r?.logger===!1?Jc({verbose:!1}):r?.logger!==!0&&r?.logger?r.logger:Bc({verbose:!1}),this.address=t,this.debug=!0,this.auth=void 0,this.adminAuth=void 0,this.fetch=r?.fetch,r?.auth&&this.setAuth(r.auth)}backendUrl(){return`${this.address}/api`}get url(){return this.address}setAuth(t){this.clearAuth(),this.auth=t}setAdminAuth(t,r){if(this.clearAuth(),r!==void 0){let o=new TextEncoder().encode(JSON.stringify(r)),n=btoa(String.fromCodePoint(...o));this.adminAuth=`${t}:${n}`}else this.adminAuth=t}clearAuth(){this.auth=void 0,this.adminAuth=void 0}setDebug(t){this.debug=t}setFetchOptions(t){this.fetchOptions=t}async consistentQuery(t,...r){let o=Ze(r[0]),n=this.getTimestamp();return await this.queryInner(t,o,{timestampPromise:n})}async getTimestamp(){return this.encodedTsPromise?this.encodedTsPromise:this.encodedTsPromise=this.getTimestampInner()}async getTimestampInner(){let t=this.fetch||Gr||fetch,r={"Content-Type":"application/json","Convex-Client":`npm-${Re}`},o=await t(`${this.address}/api/query_ts`,{...this.fetchOptions,method:"POST",headers:r});if(!o.ok)throw new Error(await o.text());let{ts:n}=await o.json();return n}async query(t,...r){let o=Ze(r[0]);return await this.queryInner(t,o,{})}async queryInner(t,r,o){let n=ft(t),i=[ye(r)],s={"Content-Type":"application/json","Convex-Client":`npm-${Re}`};this.adminAuth?s.Authorization=`Convex ${this.adminAuth}`:this.auth&&(s.Authorization=`Bearer ${this.auth}`);let c=this.fetch||Gr||fetch,u=o.timestampPromise?await o.timestampPromise:void 0,l=JSON.stringify({path:n,format:"convex_encoded_json",args:i,...u?{ts:u}:{}}),d=u?`${this.address}/api/query_at_ts`:`${this.address}/api/query`,m=await c(d,{...this.fetchOptions,body:l,method:"POST",headers:s});if(!m.ok&&m.status!==Oi)throw new Error(await m.text());let p=await m.json();if(this.debug)for(let f of p.logLines??[])fn(this.logger,"info","query",n,f);switch(p.status){case"success":return he(p.value);case"error":throw p.errorData!==void 0?Ni(p.errorData,new mt(p.errorMessage)):new Error(p.errorMessage);default:throw new Error(`Invalid response: ${JSON.stringify(p)}`)}}async mutationInner(t,r){let o=ft(t),n=JSON.stringify({path:o,format:"convex_encoded_json",args:[ye(r)]}),i={"Content-Type":"application/json","Convex-Client":`npm-${Re}`};this.adminAuth?i.Authorization=`Convex ${this.adminAuth}`:this.auth&&(i.Authorization=`Bearer ${this.auth}`);let c=await(this.fetch||Gr||fetch)(`${this.address}/api/mutation`,{...this.fetchOptions,body:n,method:"POST",headers:i});if(!c.ok&&c.status!==Oi)throw new Error(await c.text());let u=await c.json();if(this.debug)for(let l of u.logLines??[])fn(this.logger,"info","mutation",o,l);switch(u.status){case"success":return he(u.value);case"error":throw u.errorData!==void 0?Ni(u.errorData,new mt(u.errorMessage)):new Error(u.errorMessage);default:throw new Error(`Invalid response: ${JSON.stringify(u)}`)}}async processMutationQueue(){if(!this.isProcessingQueue){for(this.isProcessingQueue=!0;this.mutationQueue.length>0;){let{mutation:t,args:r,resolve:o,reject:n}=this.mutationQueue.shift();try{let i=await this.mutationInner(t,r);o(i)}catch(i){n(i)}}this.isProcessingQueue=!1}}enqueueMutation(t,r){return new Promise((o,n)=>{this.mutationQueue.push({mutation:t,args:r,resolve:o,reject:n}),this.processMutationQueue()})}async mutation(t,...r){let[o,n]=r,i=Ze(o);return n?.skipQueue?await this.mutationInner(t,i):await this.enqueueMutation(t,i)}async action(t,...r){let o=Ze(r[0]),n=ft(t),i=JSON.stringify({path:n,format:"convex_encoded_json",args:[ye(o)]}),s={"Content-Type":"application/json","Convex-Client":`npm-${Re}`};this.adminAuth?s.Authorization=`Convex ${this.adminAuth}`:this.auth&&(s.Authorization=`Bearer ${this.auth}`);let u=await(this.fetch||Gr||fetch)(`${this.address}/api/action`,{...this.fetchOptions,body:i,method:"POST",headers:s});if(!u.ok&&u.status!==Oi)throw new Error(await u.text());let l=await u.json();if(this.debug)for(let d of l.logLines??[])fn(this.logger,"info","action",n,d);switch(l.status){case"success":return he(l.value);case"error":throw l.errorData!==void 0?Ni(l.errorData,new mt(l.errorMessage)):new Error(l.errorMessage);default:throw new Error(`Invalid response: ${JSON.stringify(l)}`)}}async function(t,r,...o){let n=Ze(o[0]),i=typeof t=="string"?t:ft(t),s=JSON.stringify({componentPath:r,path:i,format:"convex_encoded_json",args:ye(n)}),c={"Content-Type":"application/json","Convex-Client":`npm-${Re}`};this.adminAuth?c.Authorization=`Convex ${this.adminAuth}`:this.auth&&(c.Authorization=`Bearer ${this.auth}`);let l=await(this.fetch||Gr||fetch)(`${this.address}/api/function`,{...this.fetchOptions,body:s,method:"POST",headers:c});if(!l.ok&&l.status!==Oi)throw new Error(await l.text());let d=await l.json();if(this.debug)for(let m of d.logLines??[])fn(this.logger,"info","any",i,m);switch(d.status){case"success":return he(d.value);case"error":throw d.errorData!==void 0?Ni(d.errorData,new mt(d.errorMessage)):new Error(d.errorMessage);default:throw new Error(`Invalid response: ${JSON.stringify(d)}`)}}};function Ni(e,t){return t.data=he(e),t}a(Ni,"forwardErrorData");var MU=q.object({numItems:q.number(),cursor:q.union(q.string(),q.null()),endCursor:q.optional(q.union(q.string(),q.null())),id:q.optional(q.number()),maximumRowsRead:q.optional(q.number()),maximumBytesRead:q.optional(q.number())});var h$=Object.defineProperty,y$=a((e,t,r)=>t in e?h$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"__defNormalProp"),ht=a((e,t,r)=>y$(e,typeof t!="symbol"?t+"":t,r),"__publicField"),Di=class{static{a(this,"TableDefinition")}constructor(t){ht(this,"indexes"),ht(this,"stagedDbIndexes"),ht(this,"searchIndexes"),ht(this,"stagedSearchIndexes"),ht(this,"vectorIndexes"),ht(this,"stagedVectorIndexes"),ht(this,"validator"),this.indexes=[],this.stagedDbIndexes=[],this.searchIndexes=[],this.stagedSearchIndexes=[],this.vectorIndexes=[],this.stagedVectorIndexes=[],this.validator=t}" indexes"(){return this.indexes}index(t,r){return Array.isArray(r)?this.indexes.push({indexDescriptor:t,fields:r}):r.staged?this.stagedDbIndexes.push({indexDescriptor:t,fields:r.fields}):this.indexes.push({indexDescriptor:t,fields:r.fields}),this}searchIndex(t,r){return r.staged?this.stagedSearchIndexes.push({indexDescriptor:t,searchField:r.searchField,filterFields:r.filterFields||[]}):this.searchIndexes.push({indexDescriptor:t,searchField:r.searchField,filterFields:r.filterFields||[]}),this}vectorIndex(t,r){return r.staged?this.stagedVectorIndexes.push({indexDescriptor:t,vectorField:r.vectorField,dimensions:r.dimensions,filterFields:r.filterFields||[]}):this.vectorIndexes.push({indexDescriptor:t,vectorField:r.vectorField,dimensions:r.dimensions,filterFields:r.filterFields||[]}),this}self(){return this}export(){let t=this.validator.json;if(typeof t!="object")throw new Error("Invalid validator: please make sure that the parameter of `defineTable` is valid (see https://docs.convex.dev/database/schemas)");return{indexes:this.indexes,stagedDbIndexes:this.stagedDbIndexes,searchIndexes:this.searchIndexes,stagedSearchIndexes:this.stagedSearchIndexes,vectorIndexes:this.vectorIndexes,stagedVectorIndexes:this.stagedVectorIndexes,documentType:t}}};function Yc(e){return Jy(e)?new Di(e):new Di(q.object(e))}a(Yc,"defineTable");var Qc=class{static{a(this,"SchemaDefinition")}constructor(t,r){ht(this,"tables"),ht(this,"strictTableNameTypes"),ht(this,"schemaValidation"),this.tables=t,this.schemaValidation=r?.schemaValidation===void 0?!0:r.schemaValidation}export(){return JSON.stringify({tables:Object.entries(this.tables).map(([t,r])=>{let{indexes:o,stagedDbIndexes:n,searchIndexes:i,stagedSearchIndexes:s,vectorIndexes:c,stagedVectorIndexes:u,documentType:l}=r.export();return{tableName:t,indexes:o,stagedDbIndexes:n,searchIndexes:i,stagedSearchIndexes:s,vectorIndexes:c,stagedVectorIndexes:u,documentType:l}}),schemaValidation:this.schemaValidation})}};function ov(e,t){return new Qc(e,t)}a(ov,"defineSchema");var sL=ov({_scheduled_functions:Yc({name:q.string(),args:q.array(q.any()),scheduledTime:q.float64(),completedTime:q.optional(q.float64()),state:q.union(q.object({kind:q.literal("pending")}),q.object({kind:q.literal("inProgress")}),q.object({kind:q.literal("success")}),q.object({kind:q.literal("failed"),error:q.string()}),q.object({kind:q.literal("canceled")}))}),_storage:Yc({sha256:q.string(),size:q.float64(),contentType:q.optional(q.string())})});async function iv(e,...t){let[r,o]=t;return Xc(o??{}).query(e,r||{})}a(iv,"fetchQuery");async function sv(e,...t){let[r,o]=t;return Xc(o??{}).mutation(e,r||{})}a(sv,"fetchMutation");async function av(e,...t){let[r,o]=t;return Xc(o??{}).action(e,r||{})}a(av,"fetchAction");function Xc(e){"url"in e&&e.url===void 0&&console.error("deploymentUrl is undefined, are your environment variables set? In the future explicitly passing undefined will cause an error. To explicitly use the default, pass `process.env.NEXT_PUBLIC_CONVEX_URL`.");let t=new Vr(v$(e.url,e.skipConvexDeploymentUrlCheck??!1));return e.token!==void 0&&t.setAuth(e.token),e.adminToken!==void 0&&t.setAdminAuth(e.adminToken),t.setFetchOptions({cache:"no-store"}),t}a(Xc,"setupClient");function v$(e,t){let r=e??process.env.NEXT_PUBLIC_CONVEX_URL,o=e===void 0;if(typeof r!="string")throw new Error(o?"Environment variable NEXT_PUBLIC_CONVEX_URL is not set.":"Convex function called with invalid deployment address.");return t||Nn(r),r}a(v$,"getConvexUrl");var Ut={create:"",validate:"",drift:"",approve:"",execute:"",rollback:"",list:"",getJobWithSteps:""};async function b$(e){let t=globalThis.fetch,r=[],o=Nt(ze(),t),n=a((async(i,s)=>{try{return await o(i,s)}catch(c){throw c instanceof be&&r.push(c),c}}),"held");globalThis.fetch=n;try{return await e()}catch(i){throw r[0]??i}finally{globalThis.fetch===n&&(globalThis.fetch=t)}}a(b$,"underTheRunsFetch");function w$(){throw new C("`np promote` is no longer available: promotion to production was removed.",{code:"PROMOTION_UNAVAILABLE",hint:"Run `np deploy` from your pipeline to put your configuration in production."})}a(w$,"resolveAdminUrl");var tt=class e{constructor(t,r){this.url=t;this.token=r}static{a(this,"PromoteAdmin")}static async fromSession(){let t=w$(),r=await Eh();if(!r?.accessToken)throw new C("You are not signed in to the npayload Control Plane.",{code:"NOT_AUTHENTICATED",hint:"Run `npx @npayload/sdk init` or `np auth login` to sign in, then retry."});return ze().check(t),new e(t,r.accessToken)}async call(t){try{return await b$(()=>t({url:this.url,token:this.token}))}catch(r){throw F(r),x$(r)}}query(t,r){return this.call(o=>iv(qr(t),r,o))}mutation(t,r){return this.call(o=>sv(qr(t),r,o))}action(t,r){return this.call(o=>av(qr(t),r,o))}create(t){return this.mutation(Ut.create,{...t})}validate(t){return this.mutation(Ut.validate,{promotionId:t})}drift(t){return this.action(Ut.drift,{appId:t})}approve(t){return this.mutation(Ut.approve,{promotionId:t})}execute(t){return this.mutation(Ut.execute,{promotionId:t})}rollback(t){return this.mutation(Ut.rollback,{promotionId:t})}list(t){return this.query(Ut.list,t?{appId:t}:{})}getJobWithSteps(t){return this.query(Ut.getJobWithSteps,{promotionId:t})}};function x$(e){let t=e?.data;if(t!==null&&typeof t=="object"&&typeof t.kind=="string"){let r=t,o=typeof r.message=="string"&&r.message.length>0?r.message:e instanceof Error?e.message:r.kind;return new C(o,{code:r.kind,cause:e})}return e}a(x$,"adminRefusal");function yt(e,t){process.stdout.write(`${Jh(e,t)}
|
|
233
|
+
`)}a(yt,"emit");function eu(e){let t=String(e.status??"").toLowerCase(),r=t==="succeeded"||t==="success"||t==="completed"?"succeeded":t==="failed"||t==="error"?"failed":t==="skipped"?"skipped":"running",o=e.resourceGid??e.resource??e.label??"resource";return{label:`${e.plane?`${String(e.plane)}: `:""}${String(o)}`,status:r,message:e.message?String(e.message):void 0}}a(eu,"toStepLine");async function cv(e,t,r,o={}){let n=o.intervalMs??1e3,i=Date.now()+(o.timeoutMs??600*1e3),s=0,c=null,u=new Set(["completed","failed","rolled_back","rolledback","cancelled"]);for(;;){c=await e.getJobWithSteps(t);let l=c?.steps??[];for(let m=s;m<l.length;m++){let p=eu(l[m]);r.start(p.label),r.finish(p)}s=l.length;let d=String(c?.promotion?.status??"").toLowerCase();if(u.has(d))break;if(Date.now()>i)throw new C("Timed out waiting for the promotion to finish.",{code:"PROMOTE_TIMEOUT",hint:`Check status with: np promote status ${t}`});await new Promise(m=>setTimeout(m,n))}return c}a(cv,"streamSteps");function uv(e){let t=e.command("promote").description("[DEPRECATED \u2014 use `np deploy`] promote a tested app's config sandbox\u2192production (snapshot \u2192 diff \u2192 approve \u2192 execute \u2192 rollback)");t.hook("preAction",()=>{process.stderr.write("\u26A0\uFE0F `np promote` is deprecated and the sandbox\u2192production clone is disabled. Use `np deploy` to push config to production (code is the source of truth).\n")}),t.command("create").description("snapshot the sandbox's configuration and open a promotion").requiredOption("--app <slug>","app slug or GID to promote").option("--from <env>","source environment","sandbox").option("--to <env>","target environment","production").option("--mode <clone|fresh>","snapshot mode","clone").option("--output <fmt>","human | table | json | yaml | ndjson").action(async r=>{try{let o=Pt(r.output),n=r.mode==="fresh"?"fresh":"clone",s=await(await tt.fromSession()).create({appId:r.app,fromEnv:r.from,toEnv:r.to,mode:n});yt(s,o)}catch(o){de(o)}}),t.command("run").description("one-shot promotion: create \u2192 validate \u2192 approve \u2192 execute, streaming the live step log. Requires --yes.").requiredOption("--app <slug>","app slug or GID to promote").option("--from <env>","source environment","sandbox").option("--to <env>","target environment","production").option("--mode <clone|fresh>","snapshot mode","clone").option("--yes","confirm non-interactive auto-approval of the full pipeline").option("--output <fmt>","human | table | json | yaml | ndjson").option("--no-follow","do not stream the live step log; return immediately").action(async r=>{try{let o=Pt(r.output);if(!r.yes)throw new C("`np promote run` auto-approves and executes the promotion. Re-run with --yes to confirm.",{code:"CONFIRMATION_REQUIRED",hint:"Or use the step-by-step flow: create \u2192 diff \u2192 approve \u2192 execute."});let n=r.mode==="fresh"?"fresh":"clone",i=await tt.fromSession(),s=new yc(o),u=(await i.create({appId:r.app,fromEnv:r.from,toEnv:r.to,mode:n})).promotionId;await i.validate(u),await i.approve(u);let l=await i.execute(u),d=null;if(r.follow!==!1)d=await cv(i,u,s);else{d=await i.getJobWithSteps(u);for(let v of d?.steps??[]){let h=eu(v);s.start(h.label),s.finish(h)}}let m=String(d?.promotion?.status??"").toLowerCase(),{cellRegistryId:p,...f}=l,g={promotionId:u,...f,status:d?.promotion?.status??null,steps:s.all()};yt(o==="human"?{promotionId:u,status:g.status}:g,o),(s.hasFailure()||m==="failed")&&(process.exitCode=1)}catch(o){de(o)}}),t.command("diff").description("run the validation pipeline and show the field-level diff vs production (read-only)").argument("<promotion-id>","promotion id (prm_\u2026)").option("--output <fmt>","human | table | json | yaml | ndjson").action(async(r,o)=>{try{let n=Pt(o.output),i=await tt.fromSession();await i.validate(r);let s=await i.getJobWithSteps(r);if(!s)throw new C(`Promotion ${r} not found.`,{code:"PROMOTION_NOT_FOUND"});yt(s.promotion,n)}catch(n){de(n)}}),t.command("approve").description("record approval (production requires a second approver \u2014 4-eyes \u2014 on mesh+)").argument("<promotion-id>","promotion id (prm_\u2026)").option("--output <fmt>","human | table | json | yaml | ndjson").action(async(r,o)=>{try{let n=Pt(o.output),s=await(await tt.fromSession()).approve(r);yt({promotionId:r,...s},n)}catch(n){de(n)}}),t.command("execute").description("apply the promotion and stream a live step log").argument("<promotion-id>","promotion id (prm_\u2026)").option("--output <fmt>","human | table | json | yaml | ndjson").option("--no-follow","do not stream the live step log; return immediately").action(async(r,o)=>{try{let n=Pt(o.output),i=await tt.fromSession(),s=new yc(n),c=await i.execute(r),u=null;if(o.follow!==!1)u=await cv(i,r,s);else{u=await i.getJobWithSteps(r);for(let f of u?.steps??[]){let g=eu(f);s.start(g.label),s.finish(g)}}let l=String(u?.promotion?.status??"").toLowerCase(),{cellRegistryId:d,...m}=c,p={promotionId:r,...m,status:u?.promotion?.status??null,steps:s.all()};yt(n==="human"?{promotionId:r,status:p.status}:p,n),(s.hasFailure()||l==="failed")&&(process.exitCode=1)}catch(n){de(n)}}),t.command("rollback").description("restore the prior production snapshot within the rollback window (default 30m)").argument("<promotion-id>","promotion id (prm_\u2026)").option("--output <fmt>","human | table | json | yaml | ndjson").action(async(r,o)=>{try{let n=Pt(o.output),s=await(await tt.fromSession()).rollback(r);yt({promotionId:r,...s},n)}catch(n){de(n)}}),t.command("list").description("promotion history").option("--app <slug>","filter to one app slug or GID").option("--output <fmt>","human | table | json | yaml | ndjson").action(async r=>{try{let o=Pt(r.output),i=await(await tt.fromSession()).list(r.app);yt(i,o)}catch(o){de(o)}}),t.command("status").description("current job state + live steps").argument("<promotion-id>","promotion id (prm_\u2026)").option("--output <fmt>","human | table | json | yaml | ndjson").action(async(r,o)=>{try{let n=Pt(o.output),s=await(await tt.fromSession()).getJobWithSteps(r);if(!s)throw new C(`Promotion ${r} not found.`,{code:"PROMOTION_NOT_FOUND"});yt(s,n)}catch(n){de(n)}})}a(uv,"registerPromote");import{createServer as I$}from"http";import te from"chalk";var k$=12e4,_$=["dev","listen","sync","tail"];function $$(e){return _$.includes(e)}a($$,"isLongRunningVerb");function Lt(){let e,t=a(()=>{},"reject"),r=new Promise((o,n)=>{t=n});return r.catch(()=>{}),{onRefused:a(o=>{e??=o,t(o)},"onRefused"),ended:r,refusal:a(()=>e,"refusal")}}a(Lt,"heartbeatEnd");function S$(e,t,r={}){let o=r.intervalMs??k$,n=!1,i=!1,s=a(()=>{n||(n=!0,clearInterval(u))},"stop"),c=a(async()=>{if(!(n||i)){i=!0;try{await t.heartbeat(e)}catch(l){l instanceof be?(s(),r.onRefused?.(l)):Th(l)?(s(),r.onRevoked?.(l instanceof xr?l:new xr)):r.onTransientError?.(l)}finally{i=!1}}},"tick"),u=setInterval(()=>void c(),o);return u.unref?.(),c(),s}a(S$,"startHeartbeat");function zt(e,t,r={}){return!t||!$$(e)?()=>{}:S$(e,t,r)}a(zt,"maybeStartHeartbeat");async function tu(){let e=process.env.NPAYLOAD_CLIENT_ID,t=(process.env.NPAYLOAD_CLIENT_SECRET??process.env.NPAYLOAD_HMAC_SECRET)?.trim()||void 0,r;if(!e)try{let u=await kr();e=u.clientId,t=t??u.hmacSecret,r=u.dpopPrivateJwk}catch{}if(!e)throw new C("Not authenticated.",{code:"NOT_AUTHENTICATED",hint:"Run `npx @npayload/sdk init` (device flow), or export NPAYLOAD_CLIENT_ID + NPAYLOAD_HMAC_SECRET."});let{apiUrl:o,authUrl:n,guard:i}=wr(),s=ti({env:process.env,credentialKey:r})??(await Go()).privateJwk,c=process.env.NPAYLOAD_APP_ID;return Ho({clientId:e,dpopPrivateJwk:s,baseUrl:o,...t!==void 0?{clientSecret:t}:{},...n!==void 0?{authUrl:n}:{},...c!==void 0?{appId:c}:{}},i)}a(tu,"resolveKernel");function P$(e){return/^(ch|chn)_/.test(e)}a(P$,"isChannelGid");async function nu(e,t,r){if(P$(t))return t;if(!r)throw new C(`Cannot resolve channel slug "${t}" without an app.`,{code:"NO_APP_FOR_SLUG",hint:"Pass --app <app_\u2026> (or set NPAYLOAD_APP_ID), or pass a channel GID directly as --channel ch_\u2026"});let o=await e.send({method:"GET",path:`/v1/apps/channels/by-slug/${encodeURIComponent(t)}`,scope:"events:read"}),n=o.gid??o.channelId??o.id??o._id;if(!n)throw new C(`Channel "${t}" not found in app ${r}.`,{code:"CHANNEL_NOT_FOUND",hint:"Create it first (publish/subscribe in the scaffold), or pass a channel GID with --channel ch_\u2026"});return n}a(nu,"resolveChannelGid");function E$(e){return e.publicUrl?{url:e.publicUrl,note:"using --public-url"}:{url:`http://localhost:${e.port}/`,note:"localhost is not reachable from npayload's delivery: pass --public-url with a tunnel's address"}}a(E$,"deliveryEndpointUrl");async function T$(e,t){let r=t.events&&t.events.length===1?t.events[0]:void 0,o={name:t.name,type:"webhook",endpoint:{url:t.endpointUrl}};r&&(o.subjectFilter=r);try{let n=await e.send({method:"POST",path:`/v1/channels/${encodeURIComponent(t.channelGid)}/subscriptions`,body:o,scope:"events:write"}),i=n.gid??n.subscriptionId??n.id??n._id;if(!i)throw new C("Subscription created but no id was returned.",{code:"SUBSCRIPTION_NO_ID",hint:"Cannot guarantee cleanup without an id \u2014 aborting. Check the cell create response."});return i}catch(n){F(n);let i=n instanceof Error?n.message:String(n);if(/already.?exists|ALREADY_EXISTS/i.test(i)){let s=await A$(e,t.channelGid,t.name);if(s)return s}throw n}}a(T$,"registerTempSubscription");async function A$(e,t,r){let o=await e.send({method:"GET",path:`/v1/channels/${encodeURIComponent(t)}/subscriptions`,scope:"events:read"}),i=(o.subscriptions??o.items??[]).find(c=>c.name===r);if(!i)return;let s=i.gid??i.subscriptionId??i.id??i._id;return typeof s=="string"?s:void 0}a(A$,"findSubscriptionByName");async function C$(e,t){await e.send({method:"DELETE",path:`/v1/subscriptions/${encodeURIComponent(t)}`,scope:"events:write"})}a(C$,"deleteSubscription");async function R$(e){let t=[];for await(let r of e)t.push(r);return Buffer.concat(t).toString("utf8")}a(R$,"readBody");async function O$(e,t,r){let o={"content-type":"application/json"};for(let i of["x-npayload-signature","x-webhook-signature","x-npayload-timestamp","x-npayload-event-type","x-npayload-delivery-id"]){let s=r[i];typeof s=="string"&&(o[i]=s)}return(await Nt(ze())(e,{method:"POST",headers:o,body:t})).status}a(O$,"forwardDelivery");function N$(e){let t=e.log??(r=>void process.stderr.write(`${r}
|
|
234
|
+
`));return I$((r,o)=>{(async()=>{if(r.method==="GET"&&(r.url==="/health"||r.url==="/")){o.writeHead(200,{"content-type":"application/json"}),o.end(JSON.stringify({status:"ok"}));return}if(r.method!=="POST"){o.writeHead(404),o.end();return}let n=await R$(r),i=new Date().toISOString().slice(11,19);if(t(`${te.dim(i)} ${te.green("\u2190")} ${D$(n)}`),!e.printOnly)try{let s=await O$(e.forwardTo,n,r.headers),c=s>=200&&s<300?te.green("\u2192"):te.red("\u2192");t(` ${c} forwarded to ${te.dim(e.forwardTo)} ${te.dim(`[${s}]`)}`)}catch(s){let c=s instanceof Error?s.message:String(s);t(` ${te.red("\u2192")} forward failed: ${te.dim(se(c,s))}`)}o.writeHead(200,{"content-type":"application/json"}),o.end(JSON.stringify({received:!0}))})()})}a(N$,"createListenServer");function D$(e){try{let t=JSON.parse(e),r=t.eventType??t.type??"event",o=t.messageGid??t.id??t.deliveryId??"";return`${te.cyan(String(r))}${o?te.dim(` ${String(o)}`):""}`}catch{return te.dim(`${e.length} bytes (non-JSON)`)}}a(D$,"summarize");function lv(e){e.command("listen").description("forward npayload webhooks to a local URL (registers a temporary subscription, cleans up on exit)").option("--channel <slug|gid>","channel to listen on (slug needs --app, or pass a ch_\u2026 GID)","signals").option("--forward-to <url>","local URL to forward each event to","http://localhost:3001/hooks/signals").option("--forward <url>","alias of --forward-to").option("--events <types>","comma-separated event-type allowlist (a single type is applied as a subject filter)",t=>t.split(",").map(r=>r.trim()).filter(Boolean)).option("--print","log received events only; do not forward to --forward-to").option("--public-url <url>","explicit public/tunnel URL npayload should deliver to (e.g. an ngrok URL); required against production").option("--app <app_\u2026>","app GID to scope channel resolution + subscription (default NPAYLOAD_APP_ID)").option("--port <port>","local receiver port (default: ephemeral)",t=>Number(t)).action(async t=>{let r={channel:t.channel??"signals",forwardTo:t.forward??t.forwardTo??"http://localhost:3001/hooks/signals",events:t.events,printOnly:t.print===!0,publicUrl:t.publicUrl,appId:t.app??process.env.NPAYLOAD_APP_ID,port:typeof t.port=="number"&&!Number.isNaN(t.port)?t.port:0};try{await j$(r)}catch(o){de(o)}})}a(lv,"registerListen");async function j$(e){e.printOnly||ze().check(e.forwardTo);let r=await tu(),o=new Pn("Resolving channel\u2026").start(),n;try{n=await nu(r,e.channel,e.appId)}catch(k){throw o.fail("Could not resolve the channel."),k}o.succeed(`Channel ${te.cyan(e.channel)} \u2192 ${te.dim(n)}`);let i=null,s=!1,c=N$({forwardTo:e.forwardTo,printOnly:e.printOnly});await new Promise((k,O)=>{c.once("error",O),c.listen(e.port,"0.0.0.0",()=>k())});let u=c.address().port,{url:l,note:d}=E$({publicUrl:e.publicUrl,port:u}),m=`np-listen-${u}`,p=new Pn("Registering temporary subscription\u2026").start();try{i=await T$(r,{channelGid:n,endpointUrl:l,name:m,events:e.events})}catch(k){throw p.fail("Could not register the subscription."),c.close(),k}p.succeed(`Subscription ${te.dim(i)} \u2192 ${te.cyan(l)}`);let f=await Me().catch(()=>null),g=Lt(),v=zt("listen",f,{onRevoked:a(()=>lt(),"onRevoked"),onRefused:g.onRefused}),h=!1,x=a(async()=>{if(s)return;s=!0,v(),process.stderr.write(`
|
|
235
|
+
`);let k=new Pn("Cleaning up the temporary subscription\u2026").start();try{i&&await C$(r,i),k.succeed("Temporary subscription removed.")}catch(O){let A=O instanceof Error?O.message:String(O);O instanceof be?(h=!0,k.stop(),process.stderr.write(`${te.yellow("\u26A0")} ${se(`Could not delete subscription ${i??"?"}: ${A}`,O)}
|
|
236
|
+
`)):k.warn(`Could not delete subscription ${i??"?"}: ${A}`)}finally{c.close()}},"cleanup"),E=a(()=>{x().then(()=>process.exit(h?1:0))},"onSignal");process.on("SIGINT",E),process.on("SIGTERM",E),process.stderr.write(["",te.bold("Listening for npayload events\u2026"),` ${te.dim("channel")} ${e.channel} ${te.dim(`(${n})`)}`,` ${te.dim("endpoint")} ${l} ${te.dim(`(${d})`)}`,e.printOnly?` ${te.dim("mode")} print-only (not forwarding)`:` ${te.dim("forward to")} ${e.forwardTo}`,e.events?` ${te.dim("events")} ${e.events.join(", ")}`:"","",te.dim(" Publish one with: npx tsx npayload/events/publish.ts"),te.dim(" Press Ctrl-C to stop and remove the temporary subscription."),""].filter(k=>k!=="").join(`
|
|
237
|
+
`)+`
|
|
238
|
+
`);try{await g.ended}catch(k){throw s=!0,process.removeListener("SIGINT",E),process.removeListener("SIGTERM",E),c.close(),k}}a(j$,"runListen");import{readFile as U$}from"fs/promises";import ji from"chalk";async function L$(e,t,r){if(r){let o;try{o=await U$(r,"utf8")}catch(n){throw new C(`Cannot read --payload-file ${r}.`,{code:"PAYLOAD_FILE_UNREADABLE",hint:"Pass a readable JSON file, e.g. --payload-file ./sample.json",cause:n})}try{return{payload:JSON.parse(o),source:"payload-file"}}catch(n){throw new C(`--payload-file ${r} is not valid JSON.`,{code:"PAYLOAD_FILE_INVALID_JSON",hint:"The sample payload must be a JSON document.",cause:n})}}try{let o=await e.send({method:"GET",path:"/v1/event-catalogue",scope:"events:read"}),i=(Array.isArray(o)?o:o.items??o.entries??[]).find(s=>s.eventType===t||s.name===t);if(i&&i.example!==void 0)return{payload:i.example,source:"catalogue-example"}}catch(o){F(o)}return{payload:{sample:!0,eventType:t,note:"generated by `np trigger` \u2014 register a catalogue example for a realistic payload"},source:"generated-sample"}}a(L$,"resolveTriggerPayload");async function z$(e,t){let r=await e.send({method:"POST",path:`/v1/channels/${encodeURIComponent(t.channelGid)}/messages`,body:{payload:t.payload,routingKey:t.eventType,metadata:{source:"np-trigger"}},scope:"messages:write"});return{messageGid:r.gid??r.messageGid??r.id}}a(z$,"fireTrigger");function dv(e,t){e.command("trigger").argument("<event-type>","event type to fire, e.g. order.confirmed").description("Fire a sample event of the given type for webhook-handler testing (pairs with `np listen`)").option("--channel <channel>","channel slug or GID to publish into","events").option("--app <appId>","app the channel slug resolves under (or NPAYLOAD_APP_ID)").option("--payload-file <path>","JSON file overriding the sample payload").action(async(r,o)=>{let n=await t.resolveKernel(),i=o.app??process.env.NPAYLOAD_APP_ID,s=await t.resolveChannelGid(n,o.channel,i),{payload:c,source:u}=await L$(n,r,o.payloadFile),{messageGid:l}=await z$(n,{channelGid:s,eventType:r,payload:c});console.log(`${ji.green("\u2714")} fired ${ji.bold(r)} on ${o.channel} ${ji.dim(`(payload: ${u}${l?`, message ${l}`:""})`)}`),console.log(ji.dim(" Watching for it? `np listen --forward http://localhost:PORT/webhook`"))})}a(dv,"registerTrigger");import{existsSync as Z$,readFileSync as G$}from"fs";import{join as hv}from"path";import Ge from"chalk";import M$ from"ajv";var ru="d6f97f724c494689c7307f26fa9081b55303f9d0c6f4b7b9523b2f4a26172cb3",Ui={$schema:"http://json-schema.org/draft-07/schema#",title:"ConnectConfig",type:"object",additionalProperties:!1,properties:{bridges:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{entityTypeSlug:{type:"string",maxLength:4096}}}}}};var pv="f4d5410c733e4c4a28858907bb7addc6d1fd34280961bdfb74cf0ac7a0a8419b",Li={$schema:"http://json-schema.org/draft-07/schema#",title:"PipesConfig",type:"object",additionalProperties:!1,properties:{credentials:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{connectorId:{type:"string",maxLength:4096},auth:{type:"object",properties:{type:{type:"string",maxLength:4096},nangoConnectionId:{type:"string",maxLength:4096},vaultSecretId:{type:"string",maxLength:4096},expiresAt:{type:"number"}},required:["type"],additionalProperties:!1}}}},governance:{type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["open","allowlist","approval_required"]},allowedConnectors:{type:"array",items:{type:"string",maxLength:4096}},blockedConnectors:{type:"array",items:{type:"string",maxLength:4096}},allowedTiers:{type:"array",items:{type:"number"}},allowedCategories:{type:"array",items:{type:"string",maxLength:4096}},requireFirstUseApproval:{type:"boolean"},autoApproveInternalConnectors:{type:"boolean"},maxCredentialsPerConnector:{type:"number"},auditConfig:{type:"object",properties:{logAllActions:{type:"boolean"},logCredentialAccess:{type:"boolean"},retentionDays:{type:"number"}},required:["logAllActions","logCredentialAccess","retentionDays"],additionalProperties:!1}}},workflows:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{description:{type:"string",maxLength:4096},definition:{type:"object",properties:{nodes:{type:"array",items:{type:"object",properties:{id:{type:"string",maxLength:4096},type:{type:"string",maxLength:4096},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:!1},data:{}},required:["id","type","position","data"],additionalProperties:!1}},edges:{type:"array",items:{type:"object",properties:{id:{type:"string",maxLength:4096},source:{type:"string",maxLength:4096},target:{type:"string",maxLength:4096},sourceHandle:{type:"string",maxLength:4096},targetHandle:{type:"string",maxLength:4096}},required:["id","source","target"],additionalProperties:!1}},viewport:{}},required:["nodes","edges"],additionalProperties:!1},triggerConfig:{type:"object",properties:{type:{type:"string",maxLength:4096},config:{type:"object",additionalProperties:{},propertyNames:{maxLength:256,not:{enum:["__proto__","constructor","prototype"]}}}},required:["type","config"],additionalProperties:!1},maxDurationMs:{type:"number"}}}}}};var mv="41cca5221cf2d3f14ebe43426ffadbc50816dfa8db8d6325205687a732db66dc",Tt={$schema:"http://json-schema.org/draft-07/schema#",title:"PrimusConfig",type:"object",additionalProperties:!1,properties:{agents:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{name:{type:"string",maxLength:4096},description:{type:"string",maxLength:4096},systemPrompt:{type:"string",maxLength:4096},personality:{type:"string",maxLength:4096},language:{type:"string",maxLength:4096},skills:{type:"array",items:{type:"string",maxLength:4096}},isDiscoverable:{type:"boolean"},trustLevel:{type:"string",enum:["restricted","standard","elevated","admin"]},defaultModel:{type:"string",maxLength:4096},maxTurns:{type:"number"}},required:["name","systemPrompt"]}},skills:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{name:{type:"string",maxLength:4096},description:{type:"string",maxLength:4096},category:{type:"string",maxLength:4096},icon:{type:"string",maxLength:4096},executor:{type:"string",enum:["inline","webhook","dynamic_worker","container","gpu","openshell","cloud_run","fly_machines","k8s_jobs"]},definition:{type:"object",properties:{systemPrompt:{type:"string",maxLength:4096},tools:{type:"array",items:{type:"string",maxLength:4096}},examples:{type:"array",items:{type:"object",properties:{input:{type:"string",maxLength:4096},output:{type:"string",maxLength:4096}},required:["input","output"],additionalProperties:!1}},endpoint:{type:"string",maxLength:4096},containerImage:{type:"string",maxLength:4096}},additionalProperties:!1},limits:{type:"object",properties:{maxExecutionTime:{type:"number"},maxMemory:{type:"number"},maxCost:{type:"number"}},additionalProperties:!1},enabled:{type:"boolean"}},required:["name","description","executor","definition"]}},tools:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{name:{type:"string",maxLength:4096},description:{type:"string",maxLength:4096},parameters:{type:"object",additionalProperties:{},propertyNames:{maxLength:256,not:{enum:["__proto__","constructor","prototype"]}}},outputSchema:{type:"object",additionalProperties:{},propertyNames:{maxLength:256,not:{enum:["__proto__","constructor","prototype"]}}},riskLevel:{type:"string",enum:["safe","moderate","dangerous"]},requiresApproval:{type:"boolean"},endpoint:{type:"string",maxLength:4096},uri:{type:"string",maxLength:4096},authType:{type:"string",enum:["none","bearer","apiKey","basic","oauth","hmac"]},scopes:{type:"array",items:{type:"string",maxLength:4096}},executor:{type:"string",enum:["webhook","inline","dynamic_worker","container","gpu","openshell"]},timeout:{type:"number"},category:{type:"string",maxLength:4096},headers:{type:"object",additionalProperties:{type:"string",pattern:"^[^\\r\\n]*$",maxLength:4096},propertyNames:{pattern:"^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$"}}},required:["description","riskLevel"]}},triggers:{type:"object",maxProperties:500,propertyNames:{pattern:"^[a-z0-9][a-z0-9._-]{0,126}$"},additionalProperties:{type:"object",additionalProperties:!1,properties:{agentGid:{type:"string",maxLength:4096},name:{type:"string",maxLength:4096},description:{type:"string",maxLength:4096},type:{type:"string",maxLength:4096},config:{type:"object",properties:{cronExpression:{type:"string",maxLength:4096},eventType:{type:"string",maxLength:4096},webhookId:{type:"string",maxLength:4096},channel:{type:"string",maxLength:4096}},additionalProperties:!1},action:{type:"object",properties:{goal:{type:"string",maxLength:4096},skillIds:{type:"array",items:{type:"string",description:"skills id",maxLength:4096}},maxTurns:{type:"number"}},required:["goal"],additionalProperties:!1},conditions:{type:"array",items:{type:"object",properties:{field:{type:"string",maxLength:4096},operator:{type:"string",maxLength:4096},value:{oneOf:[{type:"string",maxLength:4096},{type:"number"},{type:"boolean"},{type:"null"}]}},required:["field","operator","value"],additionalProperties:!1}},enabled:{type:"boolean"}},required:["name","config","action"]}}}};function gv(e){let t=e.replace(/^\[|\]$/g,"").toLowerCase();if(t==="localhost"||t.endsWith(".localhost")||t.endsWith(".internal")||t.endsWith(".local")||t==="::1"||t==="::"||t.startsWith("fc")||t.startsWith("fd")||t.startsWith("fe8")||t.startsWith("fe9")||t.startsWith("fea")||t.startsWith("feb"))return!0;let r=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(t);if(!r)return!1;let[o,n]=[Number(r[1]),Number(r[2])];return o===10||o===127||o===0||o===169&&n===254||o===192&&n===168||o===172&&n>=16&&n<=31||o===100&&n>=64&&n<=127}a(gv,"isReservedHost");function F$(e,t={}){let r;try{r=new URL(e)}catch{return!1}return r.username||r.password?!1:t.allowInternal?r.protocol==="http:"||r.protocol==="https:":!(r.protocol!=="https:"||gv(r.hostname))}a(F$,"isSafeWebhookUrl");function q$(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol!=="https:"||gv(t.hostname)}a(q$,"isPlainOrReservedDoor");function zi(e={},t=process.env){if(e.strict===!0)return!1;if(e.allowInternalUrls===!0||t.NPAYLOAD_ALLOW_INTERNAL_URLS==="1")return!0;let r=ne(t.NPAYLOAD_API_URL,"apiUrl");return r!==void 0&&q$(r)}a(zi,"resolveUrlPosture");function Mi(e,t,r={}){let o=new M$({allErrors:!0,strict:!1});o.addFormat("npayload-safe-url",c=>F$(c,{allowInternal:r.allowInternalUrls??!1}));let n=o.compile(e);return n(t)?{ok:!0,issues:[]}:{ok:!1,issues:(n.errors??[]).map(c=>{let u=c.params??{},l=Object.keys(u).length?` (${JSON.stringify(u)})`:"";return{path:c.instancePath||"(root)",message:`${c.message??"invalid"}${l}`,..."allowedValues"in u?{allowed:u.allowedValues}:{}}})}}a(Mi,"validateConfig");function Jr(e,t={}){return Mi(Cn,e,t)}a(Jr,"validateEventsConfig");function Kr(e,t={}){return Mi(Li,e,t)}a(Kr,"validatePipesConfig");function ou(e,t={}){return Mi(Ui,e,t)}a(ou,"validateConnectConfig");var fv=/^[a-z][a-z0-9_]*$/;function Wr(e,t={}){let o=[...Mi(Tt,e,t).issues],n=e??{};for(let s of["skills","tools"])for(let c of Object.keys(n[s]??{}))fv.test(c)||o.push({path:`/${s}/${c}`,message:`invalid ${s.slice(0,-1)} name "${c}" \u2014 must match ${String(fv)} (lowercase + digits + underscores; hyphens are rejected by the platform)`});let i=e??{};for(let s of _r()){let c=i[s];if(c)for(let[u,l]of Object.entries(c))for(let d of un(s)){let m=new Set(Object.keys(i[d.parent]??{})),p=ni(Tn(l,d.path))??[];for(let f of p)m.has(f)||zh(f)||o.push({path:`/${s}/${u}/${d.path}`,message:`${s} "${u}" references ${d.parent.slice(0,-1)} "${f}", which is not declared in this config's ${d.parent} map. If it exists live (created in the dashboard/CLI), run \`npayload wire\` to confirm it; otherwise declare it or fix the name.`})}}return{ok:o.length===0,issues:o}}a(Wr,"validatePrimusConfig");function yv(e){return lh(e).map(t=>({path:t.path,message:`raw secret-classified header "${t.header}" present in config \u2014 replace the literal value with a secret reference "{{ secrets.NAME }}"; \`np pull\` writes references, \`np push\` resolves them`}))}a(yv,"secretHeaderIssues");function vv(e){e.command("validate").description("Validate a config against the contract (structure + security + relationships)").option("--config <path>","path to the config (default: the product's config)").option("--product <product>","which config to validate: events | primus | pipes","events").option("--allow-internal-urls","allow localhost / private webhook URLs (to test against your own receiver; never in production)").option("--strict","force the production security posture (reject internal/loopback URLs even on a dev machine)").action(async t=>{try{let r=t.product??"events",o=En();o&&Nh(o.accessScopes);let n=zi({allowInternalUrls:t.allowInternalUrls,strict:t.strict});if(r==="primus"||r==="pipes"){let d=t.config??Ke(r);d||(process.stderr.write(Ge.red(`no ${r}.config.ts found (pass --config).
|
|
239
|
+
`)),process.exit(1));let m=await le(d),p=r==="primus"?Wr(m,{allowInternalUrls:n}):Kr(m,{allowInternalUrls:n}),f=yv(m);p.ok&&f.length===0&&(process.stdout.write(Ge.green.bold(`\u2713 ${r}.config is valid.
|
|
240
|
+
`)),process.exit(0));let g=[...p.issues,...f];process.stderr.write(Ge.red.bold(`\u2717 ${r}.config has ${g.length} problem(s):
|
|
241
|
+
`));for(let v of g)process.stderr.write(` ${Ge.yellow(v.path)} ${v.message}
|
|
242
|
+
`);process.exit(1)}let i=t.config??We(),s=await le(i),u=Jr(s,{allowInternalUrls:n}),l=yv(s);if(l.length>0&&(u.ok=!1,u.issues.push(...l)),u.ok){process.stdout.write(Ge.green.bold(`\u2713 events.config is valid.
|
|
243
|
+
`));let d=hv(process.cwd(),"npayload","_generated","contract.lock");if(Z$(d))try{JSON.parse(G$(d,"utf8")).hash!==Sr&&process.stdout.write(Ge.yellow(`! contract.lock was pinned against a different npayload contract \u2014 re-validate after upgrading.
|
|
244
|
+
`))}catch{process.stdout.write(Ge.yellow("! contract.lock is unreadable \u2014 regenerate via `npayload init`.\n"))}let m=hv(i,"..","permissions.generated.ts"),{projectAllPermissions:p}=await import("../chunk-EL7XOWA4.mjs"),{checkScopesDrift:f}=await import("../chunk-A7HA64P6.mjs"),g=f(await p(),m);!g.ok&&g.reason&&process.stdout.write(Ge.yellow(`! ${g.reason}
|
|
245
|
+
`)),process.exit(0)}process.stderr.write(Ge.red.bold(`\u2717 events.config has ${u.issues.length} problem(s):
|
|
246
|
+
`));for(let d of u.issues){let m=d.allowed?Ge.dim(` allowed: ${JSON.stringify(d.allowed)}`):"";process.stderr.write(` ${Ge.yellow(d.path)} ${d.message}${m}
|
|
247
|
+
`)}process.exit(1)}catch(r){let o=r instanceof Error?r.message:String(r);process.stderr.write(Ge.red(`validate failed: ${o}
|
|
248
|
+
`)),process.exit(1)}})}a(vv,"registerValidate");import{existsSync as au,mkdirSync as V$,readFileSync as cu}from"fs";import{join as wv,resolve as iu}from"path";var bv=/^[A-Za-z_][A-Za-z0-9_]*$/;function uu(e){return wv(e,"npayload",".env")}a(uu,"secretEnvPath");function B$(e,t,r){let o=`${t}="${r}"`,n=e.length>0?e.replace(/\r?\n$/,"").split(/\r?\n/):[],i=a(u=>{let l=u.trim().replace(/^export\s+/,""),d=l.indexOf("=");return d>0&&l.slice(0,d).trim()===t},"isName"),s=[],c=!1;for(let u of n){if(i(u)){c||s.push(o),c=!0;continue}s.push(u)}return c||s.push(o),{text:s.join(`
|
|
249
|
+
`)+`
|
|
250
|
+
`,replaced:c}}a(B$,"upsertDotenv");function Fi(e){if(!bv.test(e))throw new Y(`invalid secret name "${e}" \u2014 a name must match ${bv.source} so a config can reference it as {{ secrets.NAME }}`)}a(Fi,"assertSecretName");function J$(e,t,r){if(Fi(t),r==="")throw new Y(`refusing to set ${t} to an empty value`);if(/[\r\n]/.test(r))throw new Y(`the value for ${t} spans several lines \u2014 a secret must be one line`);let o=uu(e);V$(wv(e,"npayload"),{recursive:!0});let n=au(o)?cu(o,"utf8"):"",{text:i,replaced:s}=B$(n,t,r);return Ye(o,i),{path:o,replaced:s}}a(J$,"mintSecret");var su="npayload/.env";function K$(e){let t=uu(e);return au(t)?Object.keys(Yo(cu(t,"utf8"))).sort():[]}a(K$,"listSecretNames");function W$(e,t){if(e.length===0)return{text:e,removed:!1};let r=/\r?\n$/.test(e),o=e.replace(/\r?\n$/,"").split(/\r?\n/),n=o.filter(i=>{let s=i.trim().replace(/^export\s+/,""),c=s.indexOf("=");return!(c>0&&s.slice(0,c).trim()===t)});return n.length===o.length?{text:e,removed:!1}:{text:n.length===0?"":n.join(`
|
|
251
|
+
`)+(r?`
|
|
252
|
+
`:""),removed:!0}}a(W$,"removeDotenvKey");function H$(e,t){Fi(t);let r=uu(e),o=au(r)?cu(r,"utf8"):"",{text:n,removed:i}=W$(o,t);if(!i)throw new Y(`no secret named ${t} \u2014 searched ${r}; \`np secret list\` shows the names it holds`);return Ye(r,n),{path:r}}a(H$,"deleteSecret");async function Y$(e){if(!process.stdin.isTTY){let r=[];for await(let o of process.stdin)r.push(Buffer.isBuffer(o)?o:Buffer.from(String(o)));return Buffer.concat(r).toString("utf8").replace(/\r?\n$/,"")}let{password:t}=await import("@inquirer/prompts");return t({message:`Value for ${e}`,mask:!0})}a(Y$,"readSecretValue");function xv(e,t){let r=e.command("secret").description("Manage local secret values referenced as {{ secrets.NAME }} in your config");r.command("set").argument("<NAME>","secret name, referenced in config as {{ secrets.NAME }}").description("Mint NAME into the git-ignored npayload/.env (value from stdin, or a masked prompt) so {{ secrets.NAME }} resolves on push / deploy").option("--project <dir>","project root (default: the current directory)").action(async(o,n)=>{try{let i=iu(n.project??process.cwd());Fi(o);let s=await(t.readSecret??Y$)(o),{replaced:c}=J$(i,o,s);t.print({secret:o,file:"npayload/.env",action:c?"replaced":"set",reference:`{{ secrets.${o} }}`})}catch(i){t.printError(i instanceof Error?i.message:String(i)),process.exitCode=1}}),r.command("list").description("List the secrets in the git-ignored npayload/.env by name, each with its {{ secrets.NAME }} reference (values are never shown)").option("--project <dir>","project root (default: the current directory)").action(o=>{try{let n=iu(o.project??process.cwd());t.print({file:su,secrets:K$(n).map(i=>({name:i,reference:`{{ secrets.${i} }}`}))})}catch(n){t.printError(n instanceof Error?n.message:String(n)),process.exitCode=1}}),r.command("delete").argument("<NAME>","secret name to remove from npayload/.env").description("Delete NAME from the git-ignored npayload/.env; {{ secrets.NAME }} stops resolving from that file").option("--project <dir>","project root (default: the current directory)").option("--yes","delete without asking for confirmation").action(async(o,n)=>{try{let i=iu(n.project??process.cwd());if(Fi(o),!n.yes&&!await(t.confirm??(async()=>!1))(`Delete the secret ${o} from ${su}? Its value cannot be recovered.`)){t.printError(`kept ${o}: nothing was deleted (pass --yes to delete without asking)`),process.exitCode=1;return}H$(i,o),t.print({secret:o,file:su,action:"deleted"})}catch(i){t.printError(i instanceof Error?i.message:String(i)),process.exitCode=1}})}a(xv,"registerSecret");var Q$={env:"the NPAYLOAD_CLIENT_ID environment variable",env_token:"the NPAYLOAD_TOKEN environment variable",project:"this project's .npayload.json",keychain:"np login (your OS keychain)"};async function X$(e){let{clientId:t,source:r}=await e.credential(),o=await e.token();return{clientId:t,signedInWith:Q$[r],scopes:[...o.scopes].sort(),expiresAt:new Date(o.expiresAt).toISOString()}}a(X$,"readAuthStatus");function kv(e,t){Lc(e).command("status").description("Show the client the CLI signs in as, where it was found, its scopes and when its token expires (no secret, token or key is ever shown)").action(async()=>{try{t.print(await X$(t))}catch(r){t.printError(Ie(r instanceof Error?r.message:String(r),r)),process.exitCode=Dt(r)}})}a(kv,"registerAuth");import{existsSync as lu,readFileSync as eS,writeFileSync as tS,mkdirSync as nS,rmSync as rS}from"fs";import{resolve as $v,join as jn,dirname as oS}from"path";import Mt from"chalk";var Sv=["contract.lock","events.d.ts"];function iS(){return{appName:"",appSlug:"",appId:"",appType:"internal",framework:"none",clientId:"",hmacSecret:""}}a(iS,"stubContext");async function Iv(e){let t=$v(e),o=(await le(t)).eventTypes,n=o?Object.values(o).filter(i=>i?.schema?.definition).length:0;return{dir:jn(oS(t),"_generated"),files:{"contract.lock":Ar(iS()),"events.d.ts":n>0&&o?qh(o):null}}}a(Iv,"renderGeneratedLayer");async function sS(e){let{dir:t,files:r}=await Iv(e);nS(t,{recursive:!0});let o=[],n=[];for(let i of Sv){let s=jn(t,i),c=r[i];if(c===null){lu(s)&&(rS(s),n.push(i));continue}tS(s,c,"utf8"),o.push(i)}return{dir:t,written:o,removed:n}}a(sS,"runGenerate");async function aS(e){let{dir:t,files:r}=await Iv(e),o=[];for(let n of Sv){let i=jn(t,n),s=r[n],c=lu(i);if(s===null){c&&o.push({file:n,why:"present, but the pin produces no such file"});continue}c?eS(i,"utf8")!==s&&o.push({file:n,why:"differs from the pinned projection"}):o.push({file:n,why:"missing"})}return{dir:t,drifted:o}}a(aS,"runCheck");function _v(e){let t=e?$v(e):We();if(!lu(t))throw new Error(`no events config found at ${t} \u2014 run \`npayload init\` first, or pass --config <path>.`);return t}a(_v,"resolveConfig");function Pv(e,t){e.command("generate").description("Regenerate _generated/ (contract.lock + events.d.ts) from the pinned contract (strict, never hand-edited)").option("--config <path>","path to events.config.ts (default: npayload/events.config.ts)").action(async r=>{try{let{dir:o,written:n,removed:i}=await sS(_v(r.config)),s=[...n.map(c=>` ${Mt.green("regenerated")} ${jn(o,c)}`),...i.map(c=>` ${Mt.yellow("removed")} ${jn(o,c)} (the pin produces no such file)`)];t.print(`${s.join(`
|
|
253
|
+
`)}
|
|
254
|
+
${Mt.green.bold("\u2713 _generated/ regenerated from the pinned contract.")}`)}catch(o){t.printError(Mt.red(o instanceof Error?o.message:String(o))),process.exitCode=1}}),e.command("check").description("Fail if the committed _generated/ differs from what the pinned contract would produce (drift gate)").option("--config <path>","path to events.config.ts (default: npayload/events.config.ts)").action(async r=>{try{let{dir:o,drifted:n}=await aS(_v(r.config));if(n.length>0){t.printError(Mt.red(`\u2717 _generated/ drifted from the pin (${n.length}):
|
|
255
|
+
`)+n.map(i=>` - ${jn(o,i.file)}: ${i.why}`).join(`
|
|
256
|
+
`)+Mt.dim("\n\nRun `npayload generate` to restore the pinned projection, then commit.")),process.exitCode=1;return}t.print(Mt.green.bold("\u2713 _generated/ matches the pinned contract \u2014 no drift."))}catch(o){t.printError(Mt.red(o instanceof Error?o.message:String(o))),process.exitCode=1}})}a(Pv,"registerGenerate");import{existsSync as ex}from"fs";import{join as cE}from"path";var S={};St(S,{$brand:()=>qi,$input:()=>kp,$output:()=>xp,NEVER:()=>du,TimePrecision:()=>Ip,ZodAny:()=>hf,ZodArray:()=>wf,ZodBase64:()=>pa,ZodBase64URL:()=>ma,ZodBigInt:()=>pr,ZodBigIntFormat:()=>ha,ZodBoolean:()=>dr,ZodCIDRv4:()=>la,ZodCIDRv6:()=>da,ZodCUID:()=>ra,ZodCUID2:()=>oa,ZodCatch:()=>qf,ZodCodec:()=>$a,ZodCustom:()=>Co,ZodCustomStringFormat:()=>ur,ZodDate:()=>Io,ZodDefault:()=>jf,ZodDiscriminatedUnion:()=>kf,ZodE164:()=>fa,ZodEmail:()=>ea,ZodEmoji:()=>ta,ZodEnum:()=>ar,ZodError:()=>DP,ZodExactOptional:()=>Of,ZodFile:()=>Cf,ZodFirstPartyTypeKind:()=>eg,ZodFunction:()=>Yf,ZodGUID:()=>xo,ZodIPv4:()=>ca,ZodIPv6:()=>ua,ZodISODate:()=>Ks,ZodISODateTime:()=>Js,ZodISODuration:()=>Hs,ZodISOTime:()=>Ws,ZodIntersection:()=>_f,ZodIssueCode:()=>UP,ZodJWT:()=>ga,ZodKSUID:()=>aa,ZodLazy:()=>Kf,ZodLiteral:()=>Af,ZodMAC:()=>uf,ZodMap:()=>Ef,ZodNaN:()=>Gf,ZodNanoID:()=>na,ZodNever:()=>vf,ZodNonOptional:()=>ka,ZodNull:()=>ff,ZodNullable:()=>Df,ZodNumber:()=>lr,ZodNumberFormat:()=>$n,ZodObject:()=>Eo,ZodOptional:()=>xa,ZodPipe:()=>_a,ZodPrefault:()=>Lf,ZodPromise:()=>Hf,ZodReadonly:()=>Vf,ZodRealError:()=>De,ZodRecord:()=>Ao,ZodSet:()=>Tf,ZodString:()=>cr,ZodStringFormat:()=>X,ZodSuccess:()=>Ff,ZodSymbol:()=>pf,ZodTemplateLiteral:()=>Jf,ZodTransform:()=>Rf,ZodTuple:()=>Sf,ZodType:()=>Z,ZodULID:()=>ia,ZodURL:()=>So,ZodUUID:()=>xt,ZodUndefined:()=>mf,ZodUnion:()=>To,ZodUnknown:()=>yf,ZodVoid:()=>bf,ZodXID:()=>sa,ZodXor:()=>xf,_ZodString:()=>Xs,_default:()=>Uf,_function:()=>fw,any:()=>Bb,array:()=>Po,base64:()=>Tb,base64url:()=>Ab,bigint:()=>Fb,boolean:()=>df,catch:()=>Zf,check:()=>gw,cidrv4:()=>Pb,cidrv6:()=>Eb,clone:()=>Ee,codec:()=>dw,coerce:()=>tg,config:()=>ae,core:()=>Rt,cuid:()=>bb,cuid2:()=>wb,custom:()=>hw,date:()=>Kb,decode:()=>tf,decodeAsync:()=>rf,describe:()=>yw,discriminatedUnion:()=>ew,e164:()=>Cb,email:()=>ub,emoji:()=>yb,encode:()=>ef,encodeAsync:()=>nf,endsWith:()=>Yn,enum:()=>ba,exactOptional:()=>Nf,file:()=>aw,flattenError:()=>oo,float32:()=>Ub,float64:()=>Lb,formatError:()=>io,fromJSONSchema:()=>$w,function:()=>fw,getErrorMap:()=>zP,globalRegistry:()=>ke,gt:()=>bt,gte:()=>Te,guid:()=>lb,hash:()=>jb,hex:()=>Db,hostname:()=>Nb,httpUrl:()=>hb,includes:()=>Wn,instanceof:()=>bw,int:()=>Qs,int32:()=>zb,int64:()=>qb,intersection:()=>$f,ipv4:()=>$b,ipv6:()=>Ib,iso:()=>sr,json:()=>xw,jwt:()=>Rb,keyof:()=>Wb,ksuid:()=>_b,lazy:()=>Wf,length:()=>kn,literal:()=>sw,locales:()=>yo,looseObject:()=>Qb,looseRecord:()=>nw,lowercase:()=>Jn,lt:()=>vt,lte:()=>Le,mac:()=>Sb,map:()=>rw,maxLength:()=>xn,maxSize:()=>Jt,meta:()=>vw,mime:()=>Qn,minLength:()=>Ct,minSize:()=>wt,multipleOf:()=>Bt,nan:()=>lw,nanoid:()=>vb,nativeEnum:()=>iw,negative:()=>Us,never:()=>ya,nonnegative:()=>zs,nonoptional:()=>Mf,nonpositive:()=>Ls,normalize:()=>Xn,null:()=>gf,nullable:()=>_o,nullish:()=>cw,number:()=>lf,object:()=>Hb,optional:()=>ko,overwrite:()=>rt,parse:()=>Hm,parseAsync:()=>Ym,partialRecord:()=>tw,pipe:()=>$o,positive:()=>js,prefault:()=>zf,preprocess:()=>kw,prettifyError:()=>_u,promise:()=>mw,property:()=>Ms,readonly:()=>Bf,record:()=>Pf,refine:()=>Qf,regex:()=>Bn,regexes:()=>Be,registry:()=>gs,safeDecode:()=>sf,safeDecodeAsync:()=>cf,safeEncode:()=>of,safeEncodeAsync:()=>af,safeParse:()=>Qm,safeParseAsync:()=>Xm,set:()=>ow,setErrorMap:()=>LP,size:()=>wn,slugify:()=>rr,startsWith:()=>Hn,strictObject:()=>Yb,string:()=>Ys,stringFormat:()=>Ob,stringbool:()=>ww,success:()=>uw,superRefine:()=>Xf,symbol:()=>Gb,templateLiteral:()=>pw,toJSONSchema:()=>Gs,toLowerCase:()=>tr,toUpperCase:()=>nr,transform:()=>wa,treeifyError:()=>ku,trim:()=>er,tuple:()=>If,uint32:()=>Mb,uint64:()=>Zb,ulid:()=>xb,undefined:()=>Vb,union:()=>va,unknown:()=>_n,uppercase:()=>Kn,url:()=>gb,util:()=>I,uuid:()=>db,uuidv4:()=>pb,uuidv6:()=>mb,uuidv7:()=>fb,void:()=>Jb,xid:()=>kb,xor:()=>Xb});var Rt={};St(Rt,{$ZodAny:()=>Yl,$ZodArray:()=>nd,$ZodAsyncError:()=>nt,$ZodBase64:()=>Fl,$ZodBase64URL:()=>ql,$ZodBigInt:()=>ds,$ZodBigIntFormat:()=>Jl,$ZodBoolean:()=>uo,$ZodCIDRv4:()=>Ll,$ZodCIDRv6:()=>zl,$ZodCUID:()=>Il,$ZodCUID2:()=>Pl,$ZodCatch:()=>wd,$ZodCheck:()=>ee,$ZodCheckBigIntFormat:()=>nl,$ZodCheckEndsWith:()=>fl,$ZodCheckGreaterThan:()=>os,$ZodCheckIncludes:()=>pl,$ZodCheckLengthEquals:()=>cl,$ZodCheckLessThan:()=>rs,$ZodCheckLowerCase:()=>ll,$ZodCheckMaxLength:()=>sl,$ZodCheckMaxSize:()=>rl,$ZodCheckMimeType:()=>hl,$ZodCheckMinLength:()=>al,$ZodCheckMinSize:()=>ol,$ZodCheckMultipleOf:()=>el,$ZodCheckNumberFormat:()=>tl,$ZodCheckOverwrite:()=>yl,$ZodCheckProperty:()=>gl,$ZodCheckRegex:()=>ul,$ZodCheckSizeEquals:()=>il,$ZodCheckStartsWith:()=>ml,$ZodCheckStringFormat:()=>Gn,$ZodCheckUpperCase:()=>dl,$ZodCodec:()=>po,$ZodCustom:()=>Ed,$ZodCustomStringFormat:()=>Vl,$ZodDate:()=>td,$ZodDefault:()=>hd,$ZodDiscriminatedUnion:()=>id,$ZodE164:()=>Zl,$ZodEmail:()=>kl,$ZodEmoji:()=>$l,$ZodEncodeError:()=>Ft,$ZodEnum:()=>ld,$ZodError:()=>ro,$ZodExactOptional:()=>fd,$ZodFile:()=>pd,$ZodFunction:()=>Sd,$ZodGUID:()=>wl,$ZodIPv4:()=>Dl,$ZodIPv6:()=>jl,$ZodISODate:()=>Rl,$ZodISODateTime:()=>Cl,$ZodISODuration:()=>Nl,$ZodISOTime:()=>Ol,$ZodIntersection:()=>sd,$ZodJWT:()=>Gl,$ZodKSUID:()=>Al,$ZodLazy:()=>Pd,$ZodLiteral:()=>dd,$ZodMAC:()=>Ul,$ZodMap:()=>cd,$ZodNaN:()=>xd,$ZodNanoID:()=>Sl,$ZodNever:()=>Xl,$ZodNonOptional:()=>vd,$ZodNull:()=>Hl,$ZodNullable:()=>gd,$ZodNumber:()=>ls,$ZodNumberFormat:()=>Bl,$ZodObject:()=>eb,$ZodObjectJIT:()=>rd,$ZodOptional:()=>ms,$ZodPipe:()=>kd,$ZodPrefault:()=>yd,$ZodPromise:()=>Id,$ZodReadonly:()=>_d,$ZodRealError:()=>Ne,$ZodRecord:()=>ad,$ZodRegistry:()=>fs,$ZodSet:()=>ud,$ZodString:()=>bn,$ZodStringFormat:()=>Q,$ZodSuccess:()=>bd,$ZodSymbol:()=>Kl,$ZodTemplateLiteral:()=>$d,$ZodTransform:()=>md,$ZodTuple:()=>ps,$ZodType:()=>z,$ZodULID:()=>El,$ZodURL:()=>_l,$ZodUUID:()=>xl,$ZodUndefined:()=>Wl,$ZodUnion:()=>lo,$ZodUnknown:()=>Ql,$ZodVoid:()=>ed,$ZodXID:()=>Tl,$ZodXor:()=>od,$brand:()=>qi,$constructor:()=>y,$input:()=>kp,$output:()=>xp,Doc:()=>co,JSONSchema:()=>ab,JSONSchemaGenerator:()=>Vs,NEVER:()=>du,TimePrecision:()=>Ip,_any:()=>Jp,_array:()=>em,_base64:()=>Rs,_base64url:()=>Os,_bigint:()=>Mp,_boolean:()=>Lp,_catch:()=>PP,_check:()=>sb,_cidrv4:()=>As,_cidrv6:()=>Cs,_coercedBigint:()=>Fp,_coercedBoolean:()=>zp,_coercedDate:()=>Qp,_coercedNumber:()=>Rp,_coercedString:()=>$p,_cuid:()=>_s,_cuid2:()=>$s,_custom:()=>nm,_date:()=>Yp,_decode:()=>Ki,_decodeAsync:()=>Hi,_default:()=>$P,_discriminatedUnion:()=>pP,_e164:()=>Ns,_email:()=>hs,_emoji:()=>xs,_encode:()=>Ji,_encodeAsync:()=>Wi,_endsWith:()=>Yn,_enum:()=>vP,_file:()=>tm,_float32:()=>Np,_float64:()=>Dp,_gt:()=>bt,_gte:()=>Te,_guid:()=>vo,_includes:()=>Wn,_int:()=>Op,_int32:()=>jp,_int64:()=>qp,_intersection:()=>mP,_ipv4:()=>Es,_ipv6:()=>Ts,_isoDate:()=>Ep,_isoDateTime:()=>Pp,_isoDuration:()=>Ap,_isoTime:()=>Tp,_jwt:()=>Ds,_ksuid:()=>Ps,_lazy:()=>CP,_length:()=>kn,_literal:()=>wP,_lowercase:()=>Jn,_lt:()=>vt,_lte:()=>Le,_mac:()=>Sp,_map:()=>hP,_max:()=>Le,_maxLength:()=>xn,_maxSize:()=>Jt,_mime:()=>Qn,_min:()=>Te,_minLength:()=>Ct,_minSize:()=>wt,_multipleOf:()=>Bt,_nan:()=>Xp,_nanoid:()=>ks,_nativeEnum:()=>bP,_negative:()=>Us,_never:()=>Wp,_nonnegative:()=>zs,_nonoptional:()=>SP,_nonpositive:()=>Ls,_normalize:()=>Xn,_null:()=>Bp,_nullable:()=>_P,_number:()=>Cp,_optional:()=>kP,_overwrite:()=>rt,_parse:()=>Mn,_parseAsync:()=>Fn,_pipe:()=>EP,_positive:()=>js,_promise:()=>RP,_property:()=>Ms,_readonly:()=>TP,_record:()=>gP,_refine:()=>rm,_regex:()=>Bn,_safeDecode:()=>Qi,_safeDecodeAsync:()=>es,_safeEncode:()=>Yi,_safeEncodeAsync:()=>Xi,_safeParse:()=>qn,_safeParseAsync:()=>Zn,_set:()=>yP,_size:()=>wn,_slugify:()=>rr,_startsWith:()=>Hn,_string:()=>_p,_stringFormat:()=>or,_stringbool:()=>am,_success:()=>IP,_superRefine:()=>om,_symbol:()=>Gp,_templateLiteral:()=>AP,_toLowerCase:()=>tr,_toUpperCase:()=>nr,_transform:()=>xP,_trim:()=>er,_tuple:()=>fP,_uint32:()=>Up,_uint64:()=>Zp,_ulid:()=>Ss,_undefined:()=>Vp,_union:()=>lP,_unknown:()=>Kp,_uppercase:()=>Kn,_url:()=>bo,_uuid:()=>ys,_uuidv4:()=>vs,_uuidv6:()=>bs,_uuidv7:()=>ws,_void:()=>Hp,_xid:()=>Is,_xor:()=>dP,clone:()=>Ee,config:()=>ae,createStandardJSONSchemaMethod:()=>ir,createToJSONSchemaMethod:()=>cm,decode:()=>DS,decodeAsync:()=>US,describe:()=>im,encode:()=>NS,encodeAsync:()=>jS,extractDefs:()=>Wt,finalize:()=>Ht,flattenError:()=>oo,formatError:()=>io,globalConfig:()=>Hr,globalRegistry:()=>ke,initializeContext:()=>Kt,isValidBase64:()=>Ml,isValidBase64URL:()=>Hv,isValidJWT:()=>Yv,locales:()=>yo,meta:()=>sm,parse:()=>Vi,parseAsync:()=>Bi,prettifyError:()=>_u,process:()=>W,regexes:()=>Be,registry:()=>gs,safeDecode:()=>zS,safeDecodeAsync:()=>FS,safeEncode:()=>LS,safeEncodeAsync:()=>MS,safeParse:()=>$u,safeParseAsync:()=>Su,toDotPath:()=>Rv,toJSONSchema:()=>Gs,treeifyError:()=>ku,util:()=>I,version:()=>vl});var du=Object.freeze({status:"aborted"});function y(e,t,r){function o(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);let l=s.prototype,d=Object.keys(l);for(let m=0;m<d.length;m++){let p=d[m];p in c||(c[p]=l[p].bind(c))}}a(o,"init");let n=r?.Parent??Object;class i extends n{static{a(this,"Definition")}}Object.defineProperty(i,"name",{value:e});function s(c){var u;let l=r?.Parent?new i:this;o(l,c),(u=l._zod).deferred??(u.deferred=[]);for(let d of l._zod.deferred)d();return l}return a(s,"_"),Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:a(c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e),"value")}),Object.defineProperty(s,"name",{value:e}),s}a(y,"$constructor");var qi=Symbol("zod_brand"),nt=class extends Error{static{a(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ft=class extends Error{static{a(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Hr={};function ae(e){return e&&Object.assign(Hr,e),Hr}a(ae,"config");var I={};St(I,{BIGINT_FORMAT_RANGES:()=>xu,Class:()=>mu,NUMBER_FORMAT_RANGES:()=>wu,aborted:()=>Vt,allowsEval:()=>hu,assert:()=>pS,assertEqual:()=>cS,assertIs:()=>lS,assertNever:()=>dS,assertNotEqual:()=>uS,assignProp:()=>Zt,base64ToUint8Array:()=>Tv,base64urlToUint8Array:()=>TS,cached:()=>Ln,captureStackTrace:()=>Gi,cleanEnum:()=>ES,cleanRegex:()=>Xr,clone:()=>Ee,cloneDef:()=>fS,createTransparentProxy:()=>wS,defineLazy:()=>G,esc:()=>Zi,escapeRegex:()=>Ve,extend:()=>_S,finalizeIssue:()=>Oe,floatSafeRemainder:()=>fu,getElementAtPath:()=>gS,getEnumValues:()=>Qr,getLengthableOrigin:()=>no,getParsedType:()=>bS,getSizableOrigin:()=>to,hexToUint8Array:()=>CS,isObject:()=>yn,isPlainObject:()=>Gt,issue:()=>zn,joinValues:()=>w,jsonStringifyReplacer:()=>Un,merge:()=>SS,mergeDefs:()=>At,normalizeParams:()=>P,nullish:()=>qt,numKeys:()=>vS,objectClone:()=>mS,omit:()=>kS,optionalKeys:()=>bu,parsedType:()=>$,partial:()=>IS,pick:()=>xS,prefixIssues:()=>Ue,primitiveTypes:()=>vu,promiseAllObject:()=>hS,propertyKeyTypes:()=>eo,randomString:()=>yS,required:()=>PS,safeExtend:()=>$S,shallowClone:()=>yu,slugify:()=>gu,stringifyPrimitive:()=>_,uint8ArrayToBase64:()=>Av,uint8ArrayToBase64url:()=>AS,uint8ArrayToHex:()=>RS,unwrapMessage:()=>Yr});function cS(e){return e}a(cS,"assertEqual");function uS(e){return e}a(uS,"assertNotEqual");function lS(e){}a(lS,"assertIs");function dS(e){throw new Error("Unexpected value in exhaustive check")}a(dS,"assertNever");function pS(e){}a(pS,"assert");function Qr(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}a(Qr,"getEnumValues");function w(e,t="|"){return e.map(r=>_(r)).join(t)}a(w,"joinValues");function Un(e,t){return typeof t=="bigint"?t.toString():t}a(Un,"jsonStringifyReplacer");function Ln(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}a(Ln,"cached");function qt(e){return e==null}a(qt,"nullish");function Xr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}a(Xr,"cleanRegex");function fu(e,t){let r=(e.toString().split(".")[1]||"").length,o=t.toString(),n=(o.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test(o)){let u=o.match(/\d?e-(\d?)/);u?.[1]&&(n=Number.parseInt(u[1]))}let i=r>n?r:n,s=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return s%c/10**i}a(fu,"floatSafeRemainder");var Ev=Symbol("evaluating");function G(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Ev)return o===void 0&&(o=Ev,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}a(G,"defineLazy");function mS(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}a(mS,"objectClone");function Zt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}a(Zt,"assignProp");function At(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}a(At,"mergeDefs");function fS(e){return At(e._zod.def)}a(fS,"cloneDef");function gS(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}a(gS,"getElementAtPath");function hS(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}a(hS,"promiseAllObject");function yS(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}a(yS,"randomString");function Zi(e){return JSON.stringify(e)}a(Zi,"esc");function gu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}a(gu,"slugify");var Gi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function yn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}a(yn,"isObject");var hu=Ln(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Gt(e){if(yn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(yn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}a(Gt,"isPlainObject");function yu(e){return Gt(e)?{...e}:Array.isArray(e)?[...e]:e}a(yu,"shallowClone");function vS(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}a(vS,"numKeys");var bS=a(e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},"getParsedType"),eo=new Set(["string","number","symbol"]),vu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ve(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}a(Ve,"escapeRegex");function Ee(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}a(Ee,"clone");function P(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:a(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:a(()=>t.error,"error")}:t}a(P,"normalizeParams");function wS(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}a(wS,"createTransparentProxy");function _(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}a(_,"stringifyPrimitive");function bu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}a(bu,"optionalKeys");var wu={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},xu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xS(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=At(e._zod.def,{get shape(){let s={};for(let c in t){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(s[c]=r.shape[c])}return Zt(this,"shape",s),s},checks:[]});return Ee(e,i)}a(xS,"pick");function kS(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=At(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let c in t){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete s[c]}return Zt(this,"shape",s),s},checks:[]});return Ee(e,i)}a(kS,"omit");function _S(e,t){if(!Gt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=At(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Zt(this,"shape",i),i}});return Ee(e,n)}a(_S,"extend");function $S(e,t){if(!Gt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=At(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Zt(this,"shape",o),o}});return Ee(e,r)}a($S,"safeExtend");function SS(e,t){let r=At(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Zt(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return Ee(e,r)}a(SS,"merge");function IS(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=At(t._zod.def,{get shape(){let c=t._zod.def.shape,u={...c};if(r)for(let l in r){if(!(l in c))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(u[l]=e?new e({type:"optional",innerType:c[l]}):c[l])}else for(let l in c)u[l]=e?new e({type:"optional",innerType:c[l]}):c[l];return Zt(this,"shape",u),u},checks:[]});return Ee(t,s)}a(IS,"partial");function PS(e,t,r){let o=At(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:n[s]}))}else for(let s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return Zt(this,"shape",i),i}});return Ee(t,o)}a(PS,"required");function Vt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}a(Vt,"aborted");function Ue(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}a(Ue,"prefixIssues");function Yr(e){return typeof e=="string"?e:e?.message}a(Yr,"unwrapMessage");function Oe(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=Yr(e.inst?._zod.def?.error?.(e))??Yr(t?.error?.(e))??Yr(r.customError?.(e))??Yr(r.localeError?.(e))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}a(Oe,"finalizeIssue");function to(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}a(to,"getSizableOrigin");function no(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}a(no,"getLengthableOrigin");function $(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 r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}a($,"parsedType");function zn(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}a(zn,"issue");function ES(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}a(ES,"cleanEnum");function Tv(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}a(Tv,"base64ToUint8Array");function Av(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}a(Av,"uint8ArrayToBase64");function TS(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Tv(t+r)}a(TS,"base64urlToUint8Array");function AS(e){return Av(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}a(AS,"uint8ArrayToBase64url");function CS(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}a(CS,"hexToUint8Array");function RS(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}a(RS,"uint8ArrayToHex");var mu=class{static{a(this,"Class")}constructor(...t){}};var Cv=a((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Un,2),Object.defineProperty(e,"toString",{value:a(()=>e.message,"value"),enumerable:!1})},"initializer"),ro=y("$ZodError",Cv),Ne=y("$ZodError",Cv,{Parent:Error});function oo(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}a(oo,"flattenError");function io(e,t=r=>r.message){let r={_errors:[]},o=a(n=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>o({issues:s}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let s=r,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(t(i))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}},"processError");return o(e),r}a(io,"formatError");function ku(e,t=r=>r.message){let r={errors:[]},o=a((n,i=[])=>{var s,c;for(let u of n.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(l=>o({issues:l},u.path));else if(u.code==="invalid_key")o({issues:u.issues},u.path);else if(u.code==="invalid_element")o({issues:u.issues},u.path);else{let l=[...i,...u.path];if(l.length===0){r.errors.push(t(u));continue}let d=r,m=0;for(;m<l.length;){let p=l[m],f=m===l.length-1;typeof p=="string"?(d.properties??(d.properties={}),(s=d.properties)[p]??(s[p]={errors:[]}),d=d.properties[p]):(d.items??(d.items=[]),(c=d.items)[p]??(c[p]={errors:[]}),d=d.items[p]),f&&d.errors.push(t(u)),m++}}},"processError");return o(e),r}a(ku,"treeifyError");function Rv(e){let t=[],r=e.map(o=>typeof o=="object"?o.key:o);for(let o of r)typeof o=="number"?t.push(`[${o}]`):typeof o=="symbol"?t.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?t.push(`[${JSON.stringify(o)}]`):(t.length&&t.push("."),t.push(o));return t.join("")}a(Rv,"toDotPath");function _u(e){let t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)t.push(`\u2716 ${o.message}`),o.path?.length&&t.push(` \u2192 at ${Rv(o.path)}`);return t.join(`
|
|
257
|
+
`)}a(_u,"prettifyError");var Mn=a(e=>(t,r,o,n)=>{let i=o?Object.assign(o,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new nt;if(s.issues.length){let c=new(n?.Err??e)(s.issues.map(u=>Oe(u,i,ae())));throw Gi(c,n?.callee),c}return s.value},"_parse"),Vi=Mn(Ne),Fn=a(e=>async(t,r,o,n)=>{let i=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let c=new(n?.Err??e)(s.issues.map(u=>Oe(u,i,ae())));throw Gi(c,n?.callee),c}return s.value},"_parseAsync"),Bi=Fn(Ne),qn=a(e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new nt;return i.issues.length?{success:!1,error:new(e??ro)(i.issues.map(s=>Oe(s,n,ae())))}:{success:!0,data:i.value}},"_safeParse"),$u=qn(Ne),Zn=a(e=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>Oe(s,n,ae())))}:{success:!0,data:i.value}},"_safeParseAsync"),Su=Zn(Ne),Ji=a(e=>(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Mn(e)(t,r,n)},"_encode"),NS=Ji(Ne),Ki=a(e=>(t,r,o)=>Mn(e)(t,r,o),"_decode"),DS=Ki(Ne),Wi=a(e=>async(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Fn(e)(t,r,n)},"_encodeAsync"),jS=Wi(Ne),Hi=a(e=>async(t,r,o)=>Fn(e)(t,r,o),"_decodeAsync"),US=Hi(Ne),Yi=a(e=>(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return qn(e)(t,r,n)},"_safeEncode"),LS=Yi(Ne),Qi=a(e=>(t,r,o)=>qn(e)(t,r,o),"_safeDecode"),zS=Qi(Ne),Xi=a(e=>async(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Zn(e)(t,r,n)},"_safeEncodeAsync"),MS=Xi(Ne),es=a(e=>async(t,r,o)=>Zn(e)(t,r,o),"_safeDecodeAsync"),FS=es(Ne);var Be={};St(Be,{base64:()=>Fu,base64url:()=>ts,bigint:()=>Ju,boolean:()=>Wu,browserEmail:()=>WS,cidrv4:()=>zu,cidrv6:()=>Mu,cuid:()=>Iu,cuid2:()=>Pu,date:()=>Zu,datetime:()=>Vu,domain:()=>QS,duration:()=>Ru,e164:()=>qu,email:()=>Nu,emoji:()=>Du,extendedDuration:()=>qS,guid:()=>Ou,hex:()=>XS,hostname:()=>YS,html5Email:()=>BS,idnEmail:()=>KS,integer:()=>Ku,ipv4:()=>ju,ipv6:()=>Uu,ksuid:()=>Au,lowercase:()=>Qu,mac:()=>Lu,md5_base64:()=>tI,md5_base64url:()=>nI,md5_hex:()=>eI,nanoid:()=>Cu,null:()=>Hu,number:()=>ns,rfc5322Email:()=>JS,sha1_base64:()=>oI,sha1_base64url:()=>iI,sha1_hex:()=>rI,sha256_base64:()=>aI,sha256_base64url:()=>cI,sha256_hex:()=>sI,sha384_base64:()=>lI,sha384_base64url:()=>dI,sha384_hex:()=>uI,sha512_base64:()=>mI,sha512_base64url:()=>fI,sha512_hex:()=>pI,string:()=>Bu,time:()=>Gu,ulid:()=>Eu,undefined:()=>Yu,unicodeEmail:()=>Ov,uppercase:()=>Xu,uuid:()=>vn,uuid4:()=>ZS,uuid6:()=>GS,uuid7:()=>VS,xid:()=>Tu});var Iu=/^[cC][^\s-]{8,}$/,Pu=/^[0-9a-z]+$/,Eu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Tu=/^[0-9a-vA-V]{20}$/,Au=/^[A-Za-z0-9]{27}$/,Cu=/^[a-zA-Z0-9_-]{21}$/,Ru=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qS=/^[-+]?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)?)??$/,Ou=/^([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})$/,vn=a(e=>e?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})$`):/^([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)$/,"uuid"),ZS=vn(4),GS=vn(6),VS=vn(7),Nu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,BS=/^[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])?)*$/,JS=/^(([^<>()\[\]\\.,;:\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,}))$/,Ov=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,KS=Ov,WS=/^[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])?)*$/,HS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Du(){return new RegExp(HS,"u")}a(Du,"emoji");var ju=/^(?:(?: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])$/,Uu=/^(([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}|:))$/,Lu=a(e=>{let t=Ve(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},"mac"),zu=/^((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])$/,Mu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Fu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ts=/^[A-Za-z0-9_-]*$/,YS=/^(?=.{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=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,qu=/^\+[1-9]\d{6,14}$/,Nv="(?:(?:\\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])))",Zu=new RegExp(`^${Nv}$`);function Dv(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}a(Dv,"timeSource");function Gu(e){return new RegExp(`^${Dv(e)}$`)}a(Gu,"time");function Vu(e){let t=Dv({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Nv}T(?:${o})$`)}a(Vu,"datetime");var Bu=a(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Ju=/^-?\d+n?$/,Ku=/^-?\d+$/,ns=/^-?\d+(?:\.\d+)?$/,Wu=/^(?:true|false)$/i,Hu=/^null$/i;var Yu=/^undefined$/i;var Qu=/^[^A-Z]*$/,Xu=/^[^a-z]*$/,XS=/^[0-9a-fA-F]*$/;function so(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}a(so,"fixedBase64");function ao(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}a(ao,"fixedBase64url");var eI=/^[0-9a-fA-F]{32}$/,tI=so(22,"=="),nI=ao(22),rI=/^[0-9a-fA-F]{40}$/,oI=so(27,"="),iI=ao(27),sI=/^[0-9a-fA-F]{64}$/,aI=so(43,"="),cI=ao(43),uI=/^[0-9a-fA-F]{96}$/,lI=so(64,""),dI=ao(64),pI=/^[0-9a-fA-F]{128}$/,mI=so(86,"=="),fI=ao(86);var ee=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Uv={number:"number",bigint:"bigint",object:"date"},rs=y("$ZodCheckLessThan",(e,t)=>{ee.init(e,t);let r=Uv[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),os=y("$ZodCheckGreaterThan",(e,t)=>{ee.init(e,t);let r=Uv[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),el=y("$ZodCheckMultipleOf",(e,t)=>{ee.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):fu(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),tl=y("$ZodCheckNumberFormat",(e,t)=>{ee.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=wu[t.format];e._zod.onattach.push(s=>{let c=s._zod.bag;c.format=t.format,c.minimum=n,c.maximum=i,r&&(c.pattern=Ku)}),e._zod.check=s=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}c<n&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),nl=y("$ZodCheckBigIntFormat",(e,t)=>{ee.init(e,t);let[r,o]=xu[t.format];e._zod.onattach.push(n=>{let i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=n=>{let i=n.value;i<r&&n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>o&&n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),rl=y("$ZodCheckMaxSize",(e,t)=>{var r;ee.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!qt(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;n.size<=t.maximum||o.issues.push({origin:to(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ol=y("$ZodCheckMinSize",(e,t)=>{var r;ee.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!qt(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;n.size>=t.minimum||o.issues.push({origin:to(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),il=y("$ZodCheckSizeEquals",(e,t)=>{var r;ee.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!qt(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=o=>{let n=o.value,i=n.size;if(i===t.size)return;let s=i>t.size;o.issues.push({origin:to(n),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),sl=y("$ZodCheckMaxLength",(e,t)=>{var r;ee.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!qt(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let s=no(n);o.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),al=y("$ZodCheckMinLength",(e,t)=>{var r;ee.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!qt(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let s=no(n);o.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),cl=y("$ZodCheckLengthEquals",(e,t)=>{var r;ee.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!qt(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,i=n.length;if(i===t.length)return;let s=no(n),c=i>t.length;o.issues.push({origin:s,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Gn=y("$ZodCheckStringFormat",(e,t)=>{var r,o;ee.init(e,t),e._zod.onattach.push(n=>{let i=n._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),ul=y("$ZodCheckRegex",(e,t)=>{Gn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ll=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Qu),Gn.init(e,t)}),dl=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Xu),Gn.init(e,t)}),pl=y("$ZodCheckIncludes",(e,t)=>{ee.init(e,t);let r=Ve(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ml=y("$ZodCheckStartsWith",(e,t)=>{ee.init(e,t);let r=new RegExp(`^${Ve(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),fl=y("$ZodCheckEndsWith",(e,t)=>{ee.init(e,t);let r=new RegExp(`.*${Ve(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function jv(e,t,r){e.issues.length&&t.issues.push(...Ue(r,e.issues))}a(jv,"handleCheckPropertyResult");var gl=y("$ZodCheckProperty",(e,t)=>{ee.init(e,t),e._zod.check=r=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then(n=>jv(n,r,t.property));jv(o,r,t.property)}}),hl=y("$ZodCheckMimeType",(e,t)=>{ee.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(o=>{o._zod.bag.mime=t.mime}),e._zod.check=o=>{r.has(o.value.type)||o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),yl=y("$ZodCheckOverwrite",(e,t)=>{ee.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var co=class{static{a(this,"Doc")}constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
|
|
258
|
+
`).filter(s=>s),n=Math.min(...o.map(s=>s.length-s.trimStart().length)),i=o.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,n.join(`
|
|
259
|
+
`))}};var vl={major:4,minor:3,patch:6};var z=y("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=vl;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=a((s,c,u)=>{let l=Vt(s),d;for(let m of c){if(m._zod.def.when){if(!m._zod.def.when(s))continue}else if(l)continue;let p=s.issues.length,f=m._zod.check(s);if(f instanceof Promise&&u?.async===!1)throw new nt;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(l||(l=Vt(s,p)))});else{if(s.issues.length===p)continue;l||(l=Vt(s,p))}}return d?d.then(()=>s):s},"runChecks"),i=a((s,c,u)=>{if(Vt(s))return s.aborted=!0,s;let l=n(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new nt;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)},"handleCanaryResult");e._zod.run=(s,c)=>{if(c.skipChecks)return e._zod.parse(s,c);if(c.direction==="backward"){let l=e._zod.parse({value:s.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,s,c)):i(l,s,c)}let u=e._zod.parse(s,c);if(u instanceof Promise){if(c.async===!1)throw new nt;return u.then(l=>n(l,o,c))}return n(u,o,c)}}G(e,"~standard",()=>({validate:a(n=>{try{let i=$u(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Su(e,n).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},"validate"),vendor:"zod",version:1}))}),bn=y("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Bu(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Q=y("$ZodStringFormat",(e,t)=>{Gn.init(e,t),bn.init(e,t)}),wl=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ou),Q.init(e,t)}),xl=y("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=vn(o))}else t.pattern??(t.pattern=vn());Q.init(e,t)}),kl=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Nu),Q.init(e,t)}),_l=y("$ZodURL",(e,t)=>{Q.init(e,t),e._zod.check=r=>{try{let o=r.value.trim(),n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),$l=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Du()),Q.init(e,t)}),Sl=y("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Cu),Q.init(e,t)}),Il=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Iu),Q.init(e,t)}),Pl=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Pu),Q.init(e,t)}),El=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Eu),Q.init(e,t)}),Tl=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Tu),Q.init(e,t)}),Al=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Au),Q.init(e,t)}),Cl=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Vu(t)),Q.init(e,t)}),Rl=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Zu),Q.init(e,t)}),Ol=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Gu(t)),Q.init(e,t)}),Nl=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ru),Q.init(e,t)}),Dl=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ju),Q.init(e,t),e._zod.bag.format="ipv4"}),jl=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Uu),Q.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Ul=y("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Lu(t.delimiter)),Q.init(e,t),e._zod.bag.format="mac"}),Ll=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=zu),Q.init(e,t)}),zl=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Mu),Q.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,i]=o;if(!i)throw new Error;let s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Ml(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}a(Ml,"isValidBase64");var Fl=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Fu),Q.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Ml(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Hv(e){if(!ts.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ml(r)}a(Hv,"isValidBase64URL");var ql=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ts),Q.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Hv(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Zl=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=qu),Q.init(e,t)});function Yv(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}a(Yv,"isValidJWT");var Gl=y("$ZodJWT",(e,t)=>{Q.init(e,t),e._zod.check=r=>{Yv(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Vl=y("$ZodCustomStringFormat",(e,t)=>{Q.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),ls=y("$ZodNumber",(e,t)=>{z.init(e,t),e._zod.pattern=e._zod.bag.pattern??ns,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let i=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),Bl=y("$ZodNumberFormat",(e,t)=>{tl.init(e,t),ls.init(e,t)}),uo=y("$ZodBoolean",(e,t)=>{z.init(e,t),e._zod.pattern=Wu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),ds=y("$ZodBigInt",(e,t)=>{z.init(e,t),e._zod.pattern=Ju,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Jl=y("$ZodBigIntFormat",(e,t)=>{nl.init(e,t),ds.init(e,t)}),Kl=y("$ZodSymbol",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),Wl=y("$ZodUndefined",(e,t)=>{z.init(e,t),e._zod.pattern=Yu,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),Hl=y("$ZodNull",(e,t)=>{z.init(e,t),e._zod.pattern=Hu,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Yl=y("$ZodAny",(e,t)=>{z.init(e,t),e._zod.parse=r=>r}),Ql=y("$ZodUnknown",(e,t)=>{z.init(e,t),e._zod.parse=r=>r}),Xl=y("$ZodNever",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),ed=y("$ZodVoid",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),td=y("$ZodDate",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,i=n instanceof Date;return i&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});function zv(e,t,r){e.issues.length&&t.issues.push(...Ue(r,e.issues)),t.value[r]=e.value}a(zv,"handleArrayResult");var nd=y("$ZodArray",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let i=[];for(let s=0;s<n.length;s++){let c=n[s],u=t.element._zod.run({value:c,issues:[]},o);u instanceof Promise?i.push(u.then(l=>zv(l,r,s))):zv(u,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function us(e,t,r,o,n){if(e.issues.length){if(n&&!(r in o))return;t.issues.push(...Ue(r,e.issues))}e.value===void 0?r in o&&(t.value[r]=void 0):t.value[r]=e.value}a(us,"handlePropertyResult");function Qv(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=bu(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}a(Qv,"normalizeDef");function Xv(e,t,r,o,n,i){let s=[],c=n.keySet,u=n.catchall._zod,l=u.def.type,d=u.optout==="optional";for(let m in t){if(c.has(m))continue;if(l==="never"){s.push(m);continue}let p=u.run({value:t[m],issues:[]},o);p instanceof Promise?e.push(p.then(f=>us(f,r,m,t,d))):us(p,r,m,t,d)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}a(Xv,"handleCatchall");var eb=y("$ZodObject",(e,t)=>{if(z.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:a(()=>{let u={...c};return Object.defineProperty(t,"shape",{value:u}),u},"get")})}let o=Ln(()=>Qv(t));G(e._zod,"propValues",()=>{let c=t.shape,u={};for(let l in c){let d=c[l]._zod;if(d.values){u[l]??(u[l]=new Set);for(let m of d.values)u[l].add(m)}}return u});let n=yn,i=t.catchall,s;e._zod.parse=(c,u)=>{s??(s=o.value);let l=c.value;if(!n(l))return c.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),c;c.value={};let d=[],m=s.shape;for(let p of s.keys){let f=m[p],g=f._zod.optout==="optional",v=f._zod.run({value:l[p],issues:[]},u);v instanceof Promise?d.push(v.then(h=>us(h,c,p,l,g))):us(v,c,p,l,g)}return i?Xv(d,l,c,u,o.value,e):d.length?Promise.all(d).then(()=>c):c}}),rd=y("$ZodObjectJIT",(e,t)=>{eb.init(e,t);let r=e._zod.parse,o=Ln(()=>Qv(t)),n=a(p=>{let f=new co(["shape","payload","ctx"]),g=o.value,v=a(k=>{let O=Zi(k);return`shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`},"parseStr");f.write("const input = payload.value;");let h=Object.create(null),x=0;for(let k of g.keys)h[k]=`key_${x++}`;f.write("const newResult = {};");for(let k of g.keys){let O=h[k],A=Zi(k),U=p[k]?._zod?.optout==="optional";f.write(`const ${O} = ${v(k)};`),U?f.write(`
|
|
260
|
+
if (${O}.issues.length) {
|
|
261
|
+
if (${A} in input) {
|
|
262
|
+
payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
|
|
263
|
+
...iss,
|
|
264
|
+
path: iss.path ? [${A}, ...iss.path] : [${A}]
|
|
265
|
+
})));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (${O}.value === undefined) {
|
|
270
|
+
if (${A} in input) {
|
|
271
|
+
newResult[${A}] = undefined;
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
newResult[${A}] = ${O}.value;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
`):f.write(`
|
|
278
|
+
if (${O}.issues.length) {
|
|
279
|
+
payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
|
|
280
|
+
...iss,
|
|
281
|
+
path: iss.path ? [${A}, ...iss.path] : [${A}]
|
|
282
|
+
})));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (${O}.value === undefined) {
|
|
286
|
+
if (${A} in input) {
|
|
287
|
+
newResult[${A}] = undefined;
|
|
288
|
+
}
|
|
289
|
+
} else {
|
|
290
|
+
newResult[${A}] = ${O}.value;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let E=f.compile();return(k,O)=>E(p,k,O)},"generateFastpass"),i,s=yn,c=!Hr.jitless,l=c&&hu.value,d=t.catchall,m;e._zod.parse=(p,f)=>{m??(m=o.value);let g=p.value;return s(g)?c&&l&&f?.async===!1&&f.jitless!==!0?(i||(i=n(t.shape)),p=i(p,f),d?Xv([],g,p,f,m,e):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p)}});function Mv(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter(i=>!Vt(i));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Oe(s,o,ae())))}),t)}a(Mv,"handleUnionResults");var lo=y("$ZodUnion",(e,t)=>{z.init(e,t),G(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),G(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),G(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),G(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){let n=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>Xr(i.source)).join("|")})$`)}});let r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,i)=>{if(r)return o(n,i);let s=!1,c=[];for(let u of t.options){let l=u._zod.run({value:n.value,issues:[]},i);if(l instanceof Promise)c.push(l),s=!0;else{if(l.issues.length===0)return l;c.push(l)}}return s?Promise.all(c).then(u=>Mv(u,n,e,i)):Mv(c,n,e,i)}});function Fv(e,t,r,o){let n=e.filter(i=>i.issues.length===0);return n.length===1?(t.value=n[0].value,t):(n.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Oe(s,o,ae())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}a(Fv,"handleExclusiveUnionResults");var od=y("$ZodXor",(e,t)=>{lo.init(e,t),t.inclusive=!1;let r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,i)=>{if(r)return o(n,i);let s=!1,c=[];for(let u of t.options){let l=u._zod.run({value:n.value,issues:[]},i);l instanceof Promise?(c.push(l),s=!0):c.push(l)}return s?Promise.all(c).then(u=>Fv(u,n,e,i)):Fv(c,n,e,i)}}),id=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,lo.init(e,t);let r=e._zod.parse;G(e._zod,"propValues",()=>{let n={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[c,u]of Object.entries(s)){n[c]||(n[c]=new Set);for(let l of u)n[c].add(l)}}return n});let o=Ln(()=>{let n=t.options,i=new Map;for(let s of n){let c=s._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let u of c){if(i.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);i.set(u,s)}}return i});e._zod.parse=(n,i)=>{let s=n.value;if(!yn(s))return n.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),n;let c=o.value.get(s?.[t.discriminator]);return c?c._zod.run(n,i):t.unionFallback?r(n,i):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),n)}}),sd=y("$ZodIntersection",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),s=t.right._zod.run({value:n,issues:[]},o);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([u,l])=>qv(r,u,l)):qv(r,i,s)}});function bl(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(Gt(e)&&Gt(t)){let r=Object.keys(t),o=Object.keys(e).filter(i=>r.indexOf(i)!==-1),n={...e,...t};for(let i of o){let s=bl(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n[i]=s.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],s=bl(n,i);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}a(bl,"mergeValues");function qv(e,t,r){let o=new Map,n;for(let c of t.issues)if(c.code==="unrecognized_keys"){n??(n=c);for(let u of c.keys)o.has(u)||o.set(u,{}),o.get(u).l=!0}else e.issues.push(c);for(let c of r.issues)if(c.code==="unrecognized_keys")for(let u of c.keys)o.has(u)||o.set(u,{}),o.get(u).r=!0;else e.issues.push(c);let i=[...o].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&n&&e.issues.push({...n,keys:i}),Vt(e))return e;let s=bl(t.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}a(qv,"handleIntersectionResults");var ps=y("$ZodTuple",(e,t)=>{z.init(e,t);let r=t.items;e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];let s=[],c=[...r].reverse().findIndex(d=>d._zod.optin!=="optional"),u=c===-1?0:r.length-c;if(!t.rest){let d=i.length>r.length,m=i.length<u-1;if(d||m)return o.issues.push({...d?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),o}let l=-1;for(let d of r){if(l++,l>=i.length&&l>=u)continue;let m=d._zod.run({value:i[l],issues:[]},n);m instanceof Promise?s.push(m.then(p=>is(p,o,l))):is(m,o,l)}if(t.rest){let d=i.slice(r.length);for(let m of d){l++;let p=t.rest._zod.run({value:m,issues:[]},n);p instanceof Promise?s.push(p.then(f=>is(f,o,l))):is(p,o,l)}}return s.length?Promise.all(s).then(()=>o):o}});function is(e,t,r){e.issues.length&&t.issues.push(...Ue(r,e.issues)),t.value[r]=e.value}a(is,"handleTupleResult");var ad=y("$ZodRecord",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Gt(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[],s=t.keyType._zod.values;if(s){r.value={};let c=new Set;for(let l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){c.add(typeof l=="number"?l.toString():l);let d=t.valueType._zod.run({value:n[l],issues:[]},o);d instanceof Promise?i.push(d.then(m=>{m.issues.length&&r.issues.push(...Ue(l,m.issues)),r.value[l]=m.value})):(d.issues.length&&r.issues.push(...Ue(l,d.issues)),r.value[l]=d.value)}let u;for(let l in n)c.has(l)||(u=u??[],u.push(l));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:u})}else{r.value={};for(let c of Reflect.ownKeys(n)){if(c==="__proto__")continue;let u=t.keyType._zod.run({value:c,issues:[]},o);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&ns.test(c)&&u.issues.length){let m=t.keyType._zod.run({value:Number(c),issues:[]},o);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(u=m)}if(u.issues.length){t.mode==="loose"?r.value[c]=n[c]:r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(m=>Oe(m,o,ae())),input:c,path:[c],inst:e});continue}let d=t.valueType._zod.run({value:n[c],issues:[]},o);d instanceof Promise?i.push(d.then(m=>{m.issues.length&&r.issues.push(...Ue(c,m.issues)),r.value[u.value]=m.value})):(d.issues.length&&r.issues.push(...Ue(c,d.issues)),r.value[u.value]=d.value)}}return i.length?Promise.all(i).then(()=>r):r}}),cd=y("$ZodMap",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;let i=[];r.value=new Map;for(let[s,c]of n){let u=t.keyType._zod.run({value:s,issues:[]},o),l=t.valueType._zod.run({value:c,issues:[]},o);u instanceof Promise||l instanceof Promise?i.push(Promise.all([u,l]).then(([d,m])=>{Zv(d,m,r,s,n,e,o)})):Zv(u,l,r,s,n,e,o)}return i.length?Promise.all(i).then(()=>r):r}});function Zv(e,t,r,o,n,i,s){e.issues.length&&(eo.has(typeof o)?r.issues.push(...Ue(o,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map(c=>Oe(c,s,ae()))})),t.issues.length&&(eo.has(typeof o)?r.issues.push(...Ue(o,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map(c=>Oe(c,s,ae()))})),r.value.set(e.value,t.value)}a(Zv,"handleMapResult");var ud=y("$ZodSet",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let s of n){let c=t.valueType._zod.run({value:s,issues:[]},o);c instanceof Promise?i.push(c.then(u=>Gv(u,r))):Gv(c,r)}return i.length?Promise.all(i).then(()=>r):r}});function Gv(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}a(Gv,"handleSetResult");var ld=y("$ZodEnum",(e,t)=>{z.init(e,t);let r=Qr(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>eo.has(typeof n)).map(n=>typeof n=="string"?Ve(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let s=n.value;return o.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),dd=y("$ZodLiteral",(e,t)=>{if(z.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?Ve(o):o?Ve(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),pd=y("$ZodFile",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),md=y("$ZodTransform",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ft(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new nt;return r.value=n,r}});function Vv(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}a(Vv,"handleOptionalResult");var ms=y("$ZodOptional",(e,t)=>{z.init(e,t),e._zod.optin="optional",e._zod.optout="optional",G(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),G(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xr(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Vv(i,r.value)):Vv(n,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),fd=y("$ZodExactOptional",(e,t)=>{ms.init(e,t),G(e._zod,"values",()=>t.innerType._zod.values),G(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),gd=y("$ZodNullable",(e,t)=>{z.init(e,t),G(e._zod,"optin",()=>t.innerType._zod.optin),G(e._zod,"optout",()=>t.innerType._zod.optout),G(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xr(r.source)}|null)$`):void 0}),G(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),hd=y("$ZodDefault",(e,t)=>{z.init(e,t),e._zod.optin="optional",G(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Bv(i,t)):Bv(n,t)}});function Bv(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}a(Bv,"handleDefaultResult");var yd=y("$ZodPrefault",(e,t)=>{z.init(e,t),e._zod.optin="optional",G(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),vd=y("$ZodNonOptional",(e,t)=>{z.init(e,t),G(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Jv(i,e)):Jv(n,e)}});function Jv(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}a(Jv,"handleNonOptionalResult");var bd=y("$ZodSuccess",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ft("ZodSuccess");let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),wd=y("$ZodCatch",(e,t)=>{z.init(e,t),G(e._zod,"optin",()=>t.innerType._zod.optin),G(e._zod,"optout",()=>t.innerType._zod.optout),G(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>Oe(s,o,ae()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(i=>Oe(i,o,ae()))},input:r.value}),r.issues=[]),r)}}),xd=y("$ZodNaN",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),kd=y("$ZodPipe",(e,t)=>{z.init(e,t),G(e._zod,"values",()=>t.in._zod.values),G(e._zod,"optin",()=>t.in._zod.optin),G(e._zod,"optout",()=>t.out._zod.optout),G(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);return i instanceof Promise?i.then(s=>ss(s,t.in,o)):ss(i,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(i=>ss(i,t.out,o)):ss(n,t.out,o)}});function ss(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}a(ss,"handlePipeResult");var po=y("$ZodCodec",(e,t)=>{z.init(e,t),G(e._zod,"values",()=>t.in._zod.values),G(e._zod,"optin",()=>t.in._zod.optin),G(e._zod,"optout",()=>t.out._zod.optout),G(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(r,o);return i instanceof Promise?i.then(s=>as(s,t,o)):as(i,t,o)}else{let i=t.out._zod.run(r,o);return i instanceof Promise?i.then(s=>as(s,t,o)):as(i,t,o)}}});function as(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let n=t.transform(e.value,e);return n instanceof Promise?n.then(i=>cs(e,i,t.out,r)):cs(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(i=>cs(e,i,t.in,r)):cs(e,n,t.in,r)}}a(as,"handleCodecAResult");function cs(e,t,r,o){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},o)}a(cs,"handleCodecTxResult");var _d=y("$ZodReadonly",(e,t)=>{z.init(e,t),G(e._zod,"propValues",()=>t.innerType._zod.propValues),G(e._zod,"values",()=>t.innerType._zod.values),G(e._zod,"optin",()=>t.innerType?._zod?.optin),G(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Kv):Kv(n)}});function Kv(e){return e.value=Object.freeze(e.value),e}a(Kv,"handleReadonlyResult");var $d=y("$ZodTemplateLiteral",(e,t)=>{z.init(e,t);let r=[];for(let o of t.parts)if(typeof o=="object"&&o!==null){if(!o._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,s=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,s))}else if(o===null||vu.has(typeof o))r.push(Ve(`${o}`));else throw new Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>typeof o.value!="string"?(o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(o.value)||o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o)}),Sd=y("$ZodFunction",(e,t)=>(z.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...o){let n=e._def.input?Vi(e._def.input,o):o,i=Reflect.apply(r,this,n);return e._def.output?Vi(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...o){let n=e._def.input?await Bi(e._def.input,o):o,i=await Reflect.apply(r,this,n);return e._def.output?await Bi(e._def.output,i):i}},e._zod.parse=(r,o)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let o=e.constructor;return Array.isArray(r[0])?new o({type:"function",input:new ps({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new o({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let o=e.constructor;return new o({type:"function",input:e._def.input,output:r})},e)),Id=y("$ZodPromise",(e,t)=>{z.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then(n=>t.innerType._zod.run({value:n,issues:[]},o))}),Pd=y("$ZodLazy",(e,t)=>{z.init(e,t),G(e._zod,"innerType",()=>t.getter()),G(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),G(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),G(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),G(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),Ed=y("$ZodCustom",(e,t)=>{ee.init(e,t),z.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(i=>Wv(i,r,o,e));Wv(n,r,o,e)}});function Wv(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(zn(n))}}a(Wv,"handleRefineResult");var yo={};St(yo,{ar:()=>Td,az:()=>Ad,be:()=>Cd,bg:()=>Rd,ca:()=>Od,cs:()=>Nd,da:()=>Dd,de:()=>jd,en:()=>mo,eo:()=>Ud,es:()=>Ld,fa:()=>zd,fi:()=>Md,fr:()=>Fd,frCA:()=>qd,he:()=>Zd,hu:()=>Gd,hy:()=>Vd,id:()=>Bd,is:()=>Jd,it:()=>Kd,ja:()=>Wd,ka:()=>Hd,kh:()=>Yd,km:()=>fo,ko:()=>Qd,lt:()=>Xd,mk:()=>ep,ms:()=>tp,nl:()=>np,no:()=>rp,ota:()=>op,pl:()=>sp,ps:()=>ip,pt:()=>ap,ru:()=>cp,sl:()=>up,sv:()=>lp,ta:()=>dp,th:()=>pp,tr:()=>mp,ua:()=>fp,uk:()=>ho,ur:()=>gp,uz:()=>hp,vi:()=>yp,yo:()=>wp,zhCN:()=>vp,zhTW:()=>bp});var hI=a(()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${n.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${c}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${i}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${c}`}case"invalid_value":return n.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${_(n.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${n.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${n.minimum.toString()} ${s.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${n.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${n.prefix}"`:i.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${i.suffix}"`:i.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${i.includes}"`:i.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${i.pattern}`:`${r[i.format]??n.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${n.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${n.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${n.keys.length>1?"\u0629":""}: ${w(n.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${n.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}},"error");function Td(){return{localeError:hI()}}a(Td,"default");var yI=a(()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(n){return e[n]??null}a(t,"getSizing");let r={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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${n.expected}, daxil olan ${c}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${i}, daxil olan ${c}`}case"invalid_value":return n.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${_(n.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()} ${s.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${n.origin??"d\u0259y\u0259r"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${i.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:i.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${i.suffix}" il\u0259 bitm\u0259lidir`:i.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${i.includes}" daxil olmal\u0131d\u0131r`:i.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${i.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${r[i.format]??n.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${n.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${n.keys.length>1?"lar":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${n.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}},"error");function Ad(){return{localeError:yI()}}a(Ad,"default");function tb(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;return s>=11&&s<=19?o:i===1?t:i>=2&&i<=4?r:o}a(tb,"getBelarusianPlural");var vI=a(()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},o={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${n.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${c}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${i}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${c}`}case"invalid_value":return n.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${_(n.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let c=Number(n.maximum),u=tb(c,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${n.maximum.toString()} ${u}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let c=Number(n.minimum),u=tb(c,s.unit.one,s.unit.few,s.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${s.verb} ${i}${n.minimum.toString()} ${u}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${n.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${n.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${w(n.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${n.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}},"error");function Cd(){return{localeError:vI()}}a(Cd,"default");var bI=a(()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${c}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${c}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${_(n.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${i}${n.minimum.toString()} ${s.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${n.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${i.prefix}"`;if(i.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${i.suffix}"`;if(i.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${i.includes}"`;if(i.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${i.pattern}`;let s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return i.format==="emoji"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="datetime"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="date"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),i.format==="time"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),i.format==="duration"&&(s="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${s} ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${n.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u043E\u0432\u0435":""}: ${w(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}},"error");function Rd(){return{localeError:bI()}}a(Rd,"default");var wI=a(()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"entrada",email:"adre\xE7a electr\xF2nica",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:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${n.expected}, s'ha rebut ${c}`:`Tipus inv\xE0lid: s'esperava ${i}, s'ha rebut ${c}`}case"invalid_value":return n.values.length===1?`Valor inv\xE0lid: s'esperava ${_(n.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${w(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a m\xE0xim":"menys de",s=t(n.origin);return s?`Massa gran: s'esperava que ${n.origin??"el valor"} contingu\xE9s ${i} ${n.maximum.toString()} ${s.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"com a m\xEDnim":"m\xE9s de",s=t(n.origin);return s?`Massa petit: s'esperava que ${n.origin} contingu\xE9s ${i} ${n.minimum.toString()} ${s.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${i.prefix}"`:i.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format inv\xE0lid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${i.pattern}`:`Format inv\xE0lid per a ${r[i.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${n.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${n.origin}`;default:return"Entrada inv\xE0lida"}}},"error");function Od(){return{localeError:wI()}}a(Od,"default");var xI=a(()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",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:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${n.expected}, obdr\u017Eeno ${c}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${i}, obdr\u017Eeno ${c}`}case"invalid_value":return n.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${_(n.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.maximum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED m\xEDt ${i}${n.minimum.toString()} ${s.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${n.origin??"hodnota"} mus\xED b\xFDt ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${i.prefix}"`:i.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${i.suffix}"`:i.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${i.includes}"`:i.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${i.pattern}`:`Neplatn\xFD form\xE1t ${r[i.format]??n.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${n.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${w(n.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${n.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${n.origin}`;default:return"Neplatn\xFD vstup"}}},"error");function Nd(){return{localeError:xI()}}a(Nd,"default");var kI=a(()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"input",email:"e-mailadresse",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 dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldigt input: forventede instanceof ${n.expected}, fik ${c}`:`Ugyldigt input: forventede ${i}, fik ${c}`}case"invalid_value":return n.values.length===1?`Ugyldig v\xE6rdi: forventede ${_(n.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),c=o[n.origin]??n.origin;return s?`For stor: forventede ${c??"value"} ${s.verb} ${i} ${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor: forventede ${c??"value"} havde ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),c=o[n.origin]??n.origin;return s?`For lille: forventede ${c} ${s.verb} ${i} ${n.minimum.toString()} ${s.unit}`:`For lille: forventede ${c} havde ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ugyldig streng: skal starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: skal ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: skal indeholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${w(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${n.origin}`;default:return"Ugyldigt input"}}},"error");function Dd(){return{localeError:kI()}}a(Dd,"default");var _I=a(()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"Eingabe",email:"E-Mail-Adresse",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-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},o={nan:"NaN",number:"Zahl",array:"Array"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${n.expected}, erhalten ${c}`:`Ung\xFCltige Eingabe: erwartet ${i}, erhalten ${c}`}case"invalid_value":return n.values.length===1?`Ung\xFCltige Eingabe: erwartet ${_(n.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${s.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${s.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ung\xFCltiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ung\xFCltiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ung\xFCltiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${i.pattern} entsprechen`:`Ung\xFCltig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${w(n.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${n.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${n.origin}`;default:return"Ung\xFCltige Eingabe"}}},"error");function jd(){return{localeError:_I()}}a(jd,"default");var $I=a(()=>{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(n){return e[n]??null}a(t,"getSizing");let r={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",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${_(n.values[0])}`:`Invalid option: expected one of ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${s.unit}`:`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}},"error");function mo(){return{localeError:$I()}}a(mo,"default");var SI=a(()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${n.expected}, ricevi\u011Dis ${c}`:`Nevalida enigo: atendi\u011Dis ${i}, ricevi\u011Dis ${c}`}case"invalid_value":return n.values.length===1?`Nevalida enigo: atendi\u011Dis ${_(n.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()} ${s.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Tro malgranda: atendi\u011Dis ke ${n.origin} havu ${i}${n.minimum.toString()} ${s.unit}`:`Tro malgranda: atendi\u011Dis ke ${n.origin} estu ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${i.prefix}"`:i.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${i.suffix}"`:i.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${i.includes}"`:i.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${i.pattern}`:`Nevalida ${r[i.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} \u015Dlosilo${n.keys.length>1?"j":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}},"error");function Ud(){return{localeError:SI()}}a(Ud,"default");var II=a(()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",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:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${n.expected}, recibido ${c}`:`Entrada inv\xE1lida: se esperaba ${i}, recibido ${c}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: se esperaba ${_(n.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),c=o[n.origin]??n.origin;return s?`Demasiado grande: se esperaba que ${c??"valor"} tuviera ${i}${n.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: se esperaba que ${c??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),c=o[n.origin]??n.origin;return s?`Demasiado peque\xF1o: se esperaba que ${c} tuviera ${i}${n.minimum.toString()} ${s.unit}`:`Demasiado peque\xF1o: se esperaba que ${c} fuera ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${i.prefix}"`:i.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${i.suffix}"`:i.format==="includes"?`Cadena inv\xE1lida: debe incluir "${i.includes}"`:i.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${i.pattern}`:`Inv\xE1lido ${r[i.format]??n.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${o[n.origin]??n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${o[n.origin]??n.origin}`;default:return"Entrada inv\xE1lida"}}},"error");function Ld(){return{localeError:II()}}a(Ld,"default");var PI=a(()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${n.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${c} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${i} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${c} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return n.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${_(n.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${w(n.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${n.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${s.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:i.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${i.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:i.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${i.includes}" \u0628\u0627\u0634\u062F`:i.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${i.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${r[i.format]??n.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${n.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${n.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${w(n.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${n.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${n.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}},"error");function zd(){return{localeError:PI()}}a(zd,"default");var EI=a(()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${c}`:`Virheellinen tyyppi: odotettiin ${i}, oli ${c}`}case"invalid_value":return n.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${_(n.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Liian suuri: ${s.subject} t\xE4ytyy olla ${i}${n.maximum.toString()} ${s.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Liian pieni: ${s.subject} t\xE4ytyy olla ${i}${n.minimum.toString()} ${s.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${i.includes}"`:i.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${i.pattern}`:`Virheellinen ${r[i.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${w(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}},"error");function Md(){return{localeError:EI()}}a(Md,"default");var TI=a(()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"entr\xE9e",email:"adresse e-mail",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:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},o={nan:"NaN",number:"nombre",array:"tableau"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : instanceof ${n.expected} attendu, ${c} re\xE7u`:`Entr\xE9e invalide : ${i} attendu, ${c} re\xE7u`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : ${_(n.values[0])} attendu`:`Option invalide : une valeur parmi ${w(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Trop grand : ${n.origin??"valeur"} doit ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${n.origin??"valeur"} doit \xEAtre ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Trop petit : ${n.origin} doit ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`Trop petit : ${n.origin} doit \xEAtre ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${i.pattern}`:`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${w(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}},"error");function Fd(){return{localeError:TI()}}a(Fd,"default");var AI=a(()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"entr\xE9e",email:"adresse courriel",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:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Entr\xE9e invalide : attendu instanceof ${n.expected}, re\xE7u ${c}`:`Entr\xE9e invalide : attendu ${i}, re\xE7u ${c}`}case"invalid_value":return n.values.length===1?`Entr\xE9e invalide : attendu ${_(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u2264":"<",s=t(n.origin);return s?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${s.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u2265":">",s=t(n.origin);return s?`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${s.unit}`:`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Cha\xEEne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${i.pattern}`:`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${n.divisor}`;case"unrecognized_keys":return`Cl\xE9${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${w(n.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${n.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entr\xE9e invalide"}}},"error");function qd(){return{localeError:AI()}}a(qd,"default");var CI=a(()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=a(l=>l?e[l]:void 0,"typeEntry"),o=a(l=>{let d=r(l);return d?d.label:l??e.unknown.label},"typeLabel"),n=a(l=>`\u05D4${o(l)}`,"withDefinite"),i=a(l=>(r(l)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA","verbFor"),s=a(l=>l?t[l]??null:null,"getSizing"),c={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},u={nan:"NaN"};return l=>{switch(l.code){case"invalid_type":{let d=l.expected,m=u[d??""]??o(d),p=$(l.input),f=u[p]??e[p]?.label??p;return/^[A-Z]/.test(l.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${l.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${m}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`}case"invalid_value":{if(l.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${_(l.values[0])}`;let d=l.values.map(f=>_(f));if(l.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${d[0]} \u05D0\u05D5 ${d[1]}`;let m=d[d.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${d.slice(0,-1).join(", ")} \u05D0\u05D5 ${m}`}case"too_big":{let d=s(l.origin),m=n(l.origin??"value");if(l.origin==="string")return`${d?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${m} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.maximum.toString()} ${d?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(l.origin==="number"){let g=l.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${l.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${m} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${g}`}if(l.origin==="array"||l.origin==="set"){let g=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",v=l.inclusive?`${l.maximum} ${d?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${l.maximum} ${d?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${m} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${v}`.trim()}let p=l.inclusive?"<=":"<",f=i(l.origin??"value");return d?.unit?`${d.longLabel} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${l.maximum.toString()} ${d.unit}`:`${d?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${l.maximum.toString()}`}case"too_small":{let d=s(l.origin),m=n(l.origin??"value");if(l.origin==="string")return`${d?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${m} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.minimum.toString()} ${d?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(l.origin==="number"){let g=l.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${l.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${m} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${g}`}if(l.origin==="array"||l.origin==="set"){let g=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(l.minimum===1&&l.inclusive){let h=(l.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${m} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${h}`}let v=l.inclusive?`${l.minimum} ${d?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${l.minimum} ${d?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${m} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${v}`.trim()}let p=l.inclusive?">=":">",f=i(l.origin??"value");return d?.unit?`${d.shortLabel} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${l.minimum.toString()} ${d.unit}`:`${d?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${m} ${f} ${p}${l.minimum.toString()}`}case"invalid_format":{let d=l;if(d.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${d.prefix}"`;if(d.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${d.suffix}"`;if(d.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${d.includes}"`;if(d.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${d.pattern}`;let m=c[d.format],p=m?.label??d.format,g=(m?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${p} \u05DC\u05D0 ${g}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${l.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${l.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${l.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${w(l.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${n(l.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}},"error");function Zd(){return{localeError:CI()}}a(Zd,"default");var RI=a(()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"bemenet",email:"email c\xEDm",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 id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${n.expected}, a kapott \xE9rt\xE9k ${c}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${i}, a kapott \xE9rt\xE9k ${c}`}case"invalid_value":return n.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${_(n.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`T\xFAl nagy: ${n.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${i}${n.maximum.toString()} ${s.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${n.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} m\xE9rete t\xFAl kicsi ${i}${n.minimum.toString()} ${s.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${n.origin} t\xFAl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\xC9rv\xE9nytelen string: "${i.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:i.format==="ends_with"?`\xC9rv\xE9nytelen string: "${i.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:i.format==="includes"?`\xC9rv\xE9nytelen string: "${i.includes}" \xE9rt\xE9ket kell tartalmaznia`:i.format==="regex"?`\xC9rv\xE9nytelen string: ${i.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${r[i.format]??n.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${n.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${n.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${n.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}},"error");function Gd(){return{localeError:RI()}}a(Gd,"default");function nb(e,t,r){return Math.abs(e)===1?t:r}a(nb,"getArmenianPlural");function Vn(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],r=e[e.length-1];return e+(t.includes(r)?"\u0576":"\u0568")}a(Vn,"withDefiniteArticle");var OI=a(()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},o={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${n.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${c}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${i}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${c}`}case"invalid_value":return n.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${_(n.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let c=Number(n.maximum),u=nb(c,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Vn(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.maximum.toString()} ${u}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Vn(n.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let c=Number(n.minimum),u=nb(c,s.unit.one,s.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Vn(n.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${i}${n.minimum.toString()} ${u}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Vn(n.origin)} \u056C\u056B\u0576\u056B ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${i.prefix}"-\u0578\u057E`:i.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${i.suffix}"-\u0578\u057E`:i.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${i.includes}"`:i.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${i.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${r[i.format]??n.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${n.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${n.keys.length>1?"\u0576\u0565\u0580":""}. ${w(n.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${Vn(n.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${Vn(n.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}},"error");function Vd(){return{localeError:OI()}}a(Vd,"default");var NI=a(()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"input",email:"alamat email",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:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${c}`:`Input tidak valid: diharapkan ${i}, diterima ${c}`}case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${_(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${r[i.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}},"error");function Bd(){return{localeError:NI()}}a(Bd,"default");var DI=a(()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"n\xFAmer",array:"fylki"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${c} \xFEar sem \xE1 a\xF0 vera instanceof ${n.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${c} \xFEar sem \xE1 a\xF0 vera ${i}`}case"invalid_value":return n.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${_(n.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} hafi ${i}${n.maximum.toString()} ${s.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin??"gildi"} s\xE9 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} hafi ${i}${n.minimum.toString()} ${s.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${n.origin} s\xE9 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${i.prefix}"`:i.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${i.suffix}"`:i.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${i.includes}"`:i.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${i.pattern}`:`Rangt ${r[i.format]??n.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${w(n.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${n.origin}`;default:return"Rangt gildi"}}},"error");function Jd(){return{localeError:DI()}}a(Jd,"default");var jI=a(()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"input",email:"indirizzo email",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:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"numero",array:"vettore"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Input non valido: atteso instanceof ${n.expected}, ricevuto ${c}`:`Input non valido: atteso ${i}, ricevuto ${c}`}case"invalid_value":return n.values.length===1?`Input non valido: atteso ${_(n.values[0])}`:`Opzione non valida: atteso uno tra ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${s.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${s.unit}`:`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${w(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}},"error");function Kd(){return{localeError:jI()}}a(Kd,"default");var UI=a(()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},o={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${n.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${c}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${i}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${c}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return n.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${_(n.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${w(n.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let i=n.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",s=t(n.origin);return s?`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${s.unit??"\u8981\u7D20"}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${n.origin??"\u5024"}\u306F${n.maximum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let i=n.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",s=t(n.origin);return s?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${s.unit}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${n.origin}\u306F${n.minimum.toString()}${i}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${i.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:i.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${i.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${r[i.format]??n.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${n.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${n.keys.length>1?"\u7FA4":""}: ${w(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${n.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}},"error");function Wd(){return{localeError:UI()}}a(Wd,"default");var LI=a(()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",json_string:"JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},o={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${n.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${c}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${c}`}case"invalid_value":return n.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${_(n.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${w(n.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${n.origin} \u10D8\u10E7\u10DD\u10E1 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.prefix}"-\u10D8\u10D7`:i.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${i.suffix}"-\u10D8\u10D7`:i.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${i.includes}"-\u10E1`:i.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${i.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${n.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${n.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${w(n.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${n.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${n.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}},"error");function Hd(){return{localeError:LI()}}a(Hd,"default");var zI=a(()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},o={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${n.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${c}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${c}`}case"invalid_value":return n.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${_(n.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()} ${s.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()} ${s.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${i.prefix}"`:i.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${i.suffix}"`:i.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${i.includes}"`:i.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${i.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${n.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${w(n.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${n.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}},"error");function fo(){return{localeError:zI()}}a(fo,"default");function Yd(){return fo()}a(Yd,"default");var MI=a(()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${n.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${c}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${i}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${c}\uC785\uB2C8\uB2E4`}case"invalid_value":return n.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${_(n.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${w(n.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let i=n.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",s=i==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",c=t(n.origin),u=c?.unit??"\uC694\uC18C";return c?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()}${u} ${i}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${n.maximum.toString()} ${i}${s}`}case"too_small":{let i=n.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",s=i==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",c=t(n.origin),u=c?.unit??"\uC694\uC18C";return c?`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()}${u} ${i}${s}`:`${n.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${n.minimum.toString()} ${i}${s}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:i.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${i.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:i.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${i.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${r[i.format]??n.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${n.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${w(n.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${n.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${n.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}},"error");function Qd(){return{localeError:MI()}}a(Qd,"default");var go=a(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalizeFirstCharacter");function rb(e){let t=Math.abs(e),r=t%10,o=t%100;return o>=11&&o<=19||r===0?"many":r===1?"one":"few"}a(rb,"getUnitTypeFromNumber");var FI=a(()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(n,i,s,c){let u=e[n]??null;return u===null?u:{unit:u.unit[i],verb:u.verb[c][s?"inclusive":"notInclusive"]}}a(t,"getSizing");let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},o={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Gautas tipas ${c}, o tik\u0117tasi - instanceof ${n.expected}`:`Gautas tipas ${c}, o tik\u0117tasi - ${i}`}case"invalid_value":return n.values.length===1?`Privalo b\u016Bti ${_(n.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${w(n.values,"|")} pasirinkim\u0173`;case"too_big":{let i=o[n.origin]??n.origin,s=t(n.origin,rb(Number(n.maximum)),n.inclusive??!1,"smaller");if(s?.verb)return`${go(i??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.maximum.toString()} ${s.unit??"element\u0173"}`;let c=n.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${go(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${c} ${n.maximum.toString()} ${s?.unit}`}case"too_small":{let i=o[n.origin]??n.origin,s=t(n.origin,rb(Number(n.minimum)),n.inclusive??!1,"bigger");if(s?.verb)return`${go(i??n.origin??"reik\u0161m\u0117")} ${s.verb} ${n.minimum.toString()} ${s.unit??"element\u0173"}`;let c=n.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${go(i??n.origin??"reik\u0161m\u0117")} turi b\u016Bti ${c} ${n.minimum.toString()} ${s?.unit}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${i.prefix}"`:i.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${i.suffix}"`:i.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${i.includes}"`:i.format==="regex"?`Eilut\u0117 privalo atitikti ${i.pattern}`:`Neteisingas ${r[i.format]??n.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${w(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let i=o[n.origin]??n.origin;return`${go(i??n.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}},"error");function Xd(){return{localeError:FI()}}a(Xd,"default");var qI=a(()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},o={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${n.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${c}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${c}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${_(n.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0438\u043C\u0430 ${i}${n.minimum.toString()} ${s.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${n.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${i.pattern}`:`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${w(n.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${n.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${n.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}},"error");function ep(){return{localeError:qI()}}a(ep,"default");var ZI=a(()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"input",email:"alamat e-mel",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:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"nombor"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${c}`:`Input tidak sah: dijangka ${i}, diterima ${c}`}case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${_(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Terlalu besar: dijangka ${n.origin??"nilai"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Terlalu kecil: dijangka ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${r[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${w(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}},"error");function tp(){return{localeError:ZI()}}a(tp,"default");var GI=a(()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"invoer",email:"emailadres",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 datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},o={nan:"NaN",number:"getal"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${c}`:`Ongeldige invoer: verwacht ${i}, ontving ${c}`}case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${_(n.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin),c=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";return s?`Te ${c}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${s.unit??"elementen"} ${s.verb}`:`Te ${c}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin),c=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";return s?`Te ${c}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Te ${c}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}},"error");function np(){return{localeError:GI()}}a(np,"default");var VI=a(()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"input",email:"e-postadresse",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 dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ugyldig input: forventet instanceof ${n.expected}, fikk ${c}`:`Ugyldig input: forventet ${i}, fikk ${c}`}case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${_(n.values[0])}`:`Ugyldig valg: forventet en av ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()} ${s.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til \xE5 ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()} ${s.unit}`:`For lite(n): forventet ${n.origin} til \xE5 ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${i.pattern}`:`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${w(n.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}},"error");function rp(){return{localeError:VI()}}a(rp,"default");var BI=a(()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"giren",email:"epostag\xE2h",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 heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`F\xE2sit giren: umulan instanceof ${n.expected}, al\u0131nan ${c}`:`F\xE2sit giren: umulan ${i}, al\u0131nan ${c}`}case"invalid_value":return n.values.length===1?`F\xE2sit giren: umulan ${_(n.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${s.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} ${s.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${n.origin}, ${i}${n.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let i=n;return i.format==="starts_with"?`F\xE2sit metin: "${i.prefix}" ile ba\u015Flamal\u0131.`:i.format==="ends_with"?`F\xE2sit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`F\xE2sit metin: "${i.includes}" ihtiv\xE2 etmeli.`:i.format==="regex"?`F\xE2sit metin: ${i.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${r[i.format]??n.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${n.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${n.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}},"error");function op(){return{localeError:BI()}}a(op,"default");var JI=a(()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},o={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${n.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${c} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${i} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${c} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return n.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${_(n.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${w(n.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${n.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${i}${n.maximum.toString()} \u0648\u064A`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} ${s.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${n.origin} \u0628\u0627\u06CC\u062F ${i}${n.minimum.toString()} \u0648\u064A`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:i.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${i.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:i.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${i.includes}" \u0648\u0644\u0631\u064A`:i.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${i.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${r[i.format]??n.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${n.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${n.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${w(n.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${n.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${n.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}},"error");function ip(){return{localeError:JI()}}a(ip,"default");var KI=a(()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"wyra\u017Cenie",email:"adres email",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:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},o={nan:"NaN",number:"liczba",array:"tablica"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${n.expected}, otrzymano ${c}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${i}, otrzymano ${c}`}case"invalid_value":return n.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${_(n.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.maximum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${i}${n.minimum.toString()} ${s.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${n.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${i.prefix}"`:i.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${i.suffix}"`:i.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${i.includes}"`:i.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${i.pattern}`:`Nieprawid\u0142ow(y/a/e) ${r[i.format]??n.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${n.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${n.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}},"error");function sp(){return{localeError:KI()}}a(sp,"default");var WI=a(()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"padr\xE3o",email:"endere\xE7o de e-mail",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:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",number:"n\xFAmero",null:"nulo"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Tipo inv\xE1lido: esperado instanceof ${n.expected}, recebido ${c}`:`Tipo inv\xE1lido: esperado ${i}, recebido ${c}`}case"invalid_value":return n.values.length===1?`Entrada inv\xE1lida: esperado ${_(n.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${s.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${s.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${i.prefix}"`:i.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inv\xE1lido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${i.pattern}`:`${r[i.format]??n.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${w(n.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${n.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${n.origin}`;default:return"Campo inv\xE1lido"}}},"error");function ap(){return{localeError:WI()}}a(ap,"default");function ob(e,t,r,o){let n=Math.abs(e),i=n%10,s=n%100;return s>=11&&s<=19?o:i===1?t:i>=2&&i<=4?r:o}a(ob,"getRussianPlural");var HI=a(()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${n.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${c}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${i}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${c}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${_(n.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);if(s){let c=Number(n.maximum),u=ob(c,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${n.maximum.toString()} ${u}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);if(s){let c=Number(n.minimum),u=ob(c,s.unit.one,s.unit.few,s.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${i}${n.minimum.toString()} ${u}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${n.origin} \u0431\u0443\u0434\u0435\u0442 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${n.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0438":""}: ${w(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${n.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}},"error");function cp(){return{localeError:HI()}}a(cp,"default");var YI=a(()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"vnos",email:"e-po\u0161tni naslov",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 datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${n.expected}, prejeto ${c}`:`Neveljaven vnos: pri\u010Dakovano ${i}, prejeto ${c}`}case"invalid_value":return n.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${_(n.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${s.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Premajhno: pri\u010Dakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${s.unit}`:`Premajhno: pri\u010Dakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${r[i.format]??n.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${w(n.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}},"error");function up(){return{localeError:YI()}}a(up,"default");var QI=a(()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"regulj\xE4rt uttryck",email:"e-postadress",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-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${n.expected}, fick ${c}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${i}, fick ${c}`}case"invalid_value":return n.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${_(n.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`F\xF6r stor(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()} ${s.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${n.origin??"v\xE4rdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()} ${s.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${n.origin??"v\xE4rdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${i.includes}"`:i.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${i.pattern}"`:`Ogiltig(t) ${r[i.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${w(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${n.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}},"error");function lp(){return{localeError:QI()}}a(lp,"default");var XI=a(()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",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 \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${n.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${c}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${c}`}case"invalid_value":return n.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${_(n.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${w(n.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${n.maximum.toString()} ${s.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${i}${n.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${i}${n.minimum.toString()} ${s.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${n.origin} ${i}${n.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${i.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:i.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${i.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${n.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${n.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${n.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}},"error");function dp(){return{localeError:XI()}}a(dp,"default");var eP=a(()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},o={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${n.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${c}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${i} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${c}`}case"invalid_value":return n.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${_(n.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);return s?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()} ${s.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",s=t(n.origin);return s?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()} ${s.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${n.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${i.prefix}"`:i.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${i.suffix}"`:i.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${i.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:i.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${i.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[i.format]??n.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${n.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${w(n.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${n.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}},"error");function pp(){return{localeError:eP()}}a(pp,"default");var tP=a(()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"girdi",email:"e-posta adresi",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 tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${n.expected}, al\u0131nan ${c}`:`Ge\xE7ersiz de\u011Fer: beklenen ${i}, al\u0131nan ${c}`}case"invalid_value":return n.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${_(n.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()} ${s.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${n.origin??"de\u011Fer"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Ge\xE7ersiz metin: "${i.prefix}" ile ba\u015Flamal\u0131`:i.format==="ends_with"?`Ge\xE7ersiz metin: "${i.suffix}" ile bitmeli`:i.format==="includes"?`Ge\xE7ersiz metin: "${i.includes}" i\xE7ermeli`:i.format==="regex"?`Ge\xE7ersiz metin: ${i.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[i.format]??n.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${n.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${n.keys.length>1?"lar":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${n.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}},"error");function mp(){return{localeError:tP()}}a(mp,"default");var nP=a(()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},o={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${n.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${c}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${i}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${c}`}case"invalid_value":return n.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${_(n.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${n.origin} \u0431\u0443\u0434\u0435 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${i.prefix}"`:i.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${i.suffix}"`:i.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${i.includes}"`:i.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${i.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${n.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${n.keys.length>1?"\u0456":""}: ${w(n.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${n.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${n.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}},"error");function ho(){return{localeError:nP()}}a(ho,"default");function fp(){return ho()}a(fp,"default");var rP=a(()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},o={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${n.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${c} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${i} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${c} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return n.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${_(n.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${w(n.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${i}${n.maximum.toString()} ${s.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${n.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${i}${n.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u06D2 ${i}${n.minimum.toString()} ${s.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${n.origin} \u06A9\u0627 ${i}${n.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${i.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:i.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${i.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${n.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${n.keys.length>1?"\u0632":""}: ${w(n.keys,"\u060C ")}`;case"invalid_key":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${n.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}},"error");function gp(){return{localeError:rP()}}a(gp,"default");var oP=a(()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"kirish",email:"elektron pochta manzili",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 sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},o={nan:"NaN",number:"raqam",array:"massiv"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${c}`:`Noto\u2018g\u2018ri kirish: kutilgan ${i}, qabul qilingan ${c}`}case"invalid_value":return n.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${_(n.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()} ${s.unit} ${s.verb}`:`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()} ${s.unit} ${s.verb}`:`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${i.prefix}" bilan boshlanishi kerak`:i.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${i.suffix}" bilan tugashi kerak`:i.format==="includes"?`Noto\u2018g\u2018ri satr: "${i.includes}" ni o\u2018z ichiga olishi kerak`:i.format==="regex"?`Noto\u2018g\u2018ri satr: ${i.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${r[i.format]??n.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${n.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${n.keys.length>1?"lar":""}: ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${n.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}},"error");function hp(){return{localeError:oP()}}a(hp,"default");var iP=a(()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",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:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},o={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${n.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${c}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${i}, nh\u1EADn \u0111\u01B0\u1EE3c ${c}`}case"invalid_value":return n.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${_(n.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${s.verb} ${i}${n.maximum.toString()} ${s.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${n.origin??"gi\xE1 tr\u1ECB"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${s.verb} ${i}${n.minimum.toString()} ${s.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${i.prefix}"`:i.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${i.suffix}"`:i.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${i.includes}"`:i.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${i.pattern}`:`${r[i.format]??n.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${n.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${w(n.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${n.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}},"error");function yp(){return{localeError:iP()}}a(yp,"default");var sP=a(()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},o={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${n.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${c}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${i}\uFF0C\u5B9E\u9645\u63A5\u6536 ${c}`}case"invalid_value":return n.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${_(n.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()} ${s.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${n.origin??"\u503C"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()} ${s.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.prefix}" \u5F00\u5934`:i.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${i.suffix}" \u7ED3\u5C3E`:i.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${i.pattern}`:`\u65E0\u6548${r[i.format]??n.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${n.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${w(n.keys,", ")}`;case"invalid_key":return`${n.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${n.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}},"error");function vp(){return{localeError:sP()}}a(vp,"default");var aP=a(()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",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 \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${n.expected}\uFF0C\u4F46\u6536\u5230 ${c}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${i}\uFF0C\u4F46\u6536\u5230 ${c}`}case"invalid_value":return n.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${_(n.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()} ${s.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${n.origin??"\u503C"} \u61C9\u70BA ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()} ${s.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${n.origin} \u61C9\u70BA ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.prefix}" \u958B\u982D`:i.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${i.suffix}" \u7D50\u5C3E`:i.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${i.includes}"`:i.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${i.pattern}`:`\u7121\u6548\u7684 ${r[i.format]??n.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${n.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${n.keys.length>1?"\u5011":""}\uFF1A${w(n.keys,"\u3001")}`;case"invalid_key":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${n.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}},"error");function bp(){return{localeError:aP()}}a(bp,"default");var cP=a(()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function t(n){return e[n]??null}a(t,"getSizing");let r={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",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:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},o={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return n=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,s=$(n.input),c=o[s]??s;return/^[A-Z]/.test(n.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${n.expected}, \xE0m\u1ECD\u0300 a r\xED ${c}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${i}, \xE0m\u1ECD\u0300 a r\xED ${c}`}case"invalid_value":return n.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${_(n.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${w(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",s=t(n.origin);return s?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin??"iye"} ${s.verb} ${i}${n.maximum} ${s.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.maximum}`}case"too_small":{let i=n.inclusive?">=":">",s=t(n.origin);return s?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${n.origin} ${s.verb} ${i}${n.minimum} ${s.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${i}${n.minimum}`}case"invalid_format":{let i=n;return i.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${i.prefix}"`:i.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${i.suffix}"`:i.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${i.includes}"`:i.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${i.pattern}`:`A\u1E63\xEC\u1E63e: ${r[i.format]??n.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${n.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${w(n.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${n.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}},"error");function wp(){return{localeError:cP()}}a(wp,"default");var ib,xp=Symbol("ZodOutput"),kp=Symbol("ZodInput"),fs=class{static{a(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function gs(){return new fs}a(gs,"registry");(ib=globalThis).__zod_globalRegistry??(ib.__zod_globalRegistry=gs());var ke=globalThis.__zod_globalRegistry;function _p(e,t){return new e({type:"string",...P(t)})}a(_p,"_string");function $p(e,t){return new e({type:"string",coerce:!0,...P(t)})}a($p,"_coercedString");function hs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...P(t)})}a(hs,"_email");function vo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...P(t)})}a(vo,"_guid");function ys(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...P(t)})}a(ys,"_uuid");function vs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...P(t)})}a(vs,"_uuidv4");function bs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...P(t)})}a(bs,"_uuidv6");function ws(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...P(t)})}a(ws,"_uuidv7");function bo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...P(t)})}a(bo,"_url");function xs(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...P(t)})}a(xs,"_emoji");function ks(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...P(t)})}a(ks,"_nanoid");function _s(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...P(t)})}a(_s,"_cuid");function $s(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...P(t)})}a($s,"_cuid2");function Ss(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...P(t)})}a(Ss,"_ulid");function Is(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...P(t)})}a(Is,"_xid");function Ps(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...P(t)})}a(Ps,"_ksuid");function Es(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...P(t)})}a(Es,"_ipv4");function Ts(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...P(t)})}a(Ts,"_ipv6");function Sp(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...P(t)})}a(Sp,"_mac");function As(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...P(t)})}a(As,"_cidrv4");function Cs(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...P(t)})}a(Cs,"_cidrv6");function Rs(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...P(t)})}a(Rs,"_base64");function Os(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...P(t)})}a(Os,"_base64url");function Ns(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...P(t)})}a(Ns,"_e164");function Ds(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...P(t)})}a(Ds,"_jwt");var Ip={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Pp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...P(t)})}a(Pp,"_isoDateTime");function Ep(e,t){return new e({type:"string",format:"date",check:"string_format",...P(t)})}a(Ep,"_isoDate");function Tp(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...P(t)})}a(Tp,"_isoTime");function Ap(e,t){return new e({type:"string",format:"duration",check:"string_format",...P(t)})}a(Ap,"_isoDuration");function Cp(e,t){return new e({type:"number",checks:[],...P(t)})}a(Cp,"_number");function Rp(e,t){return new e({type:"number",coerce:!0,checks:[],...P(t)})}a(Rp,"_coercedNumber");function Op(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...P(t)})}a(Op,"_int");function Np(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...P(t)})}a(Np,"_float32");function Dp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...P(t)})}a(Dp,"_float64");function jp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...P(t)})}a(jp,"_int32");function Up(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...P(t)})}a(Up,"_uint32");function Lp(e,t){return new e({type:"boolean",...P(t)})}a(Lp,"_boolean");function zp(e,t){return new e({type:"boolean",coerce:!0,...P(t)})}a(zp,"_coercedBoolean");function Mp(e,t){return new e({type:"bigint",...P(t)})}a(Mp,"_bigint");function Fp(e,t){return new e({type:"bigint",coerce:!0,...P(t)})}a(Fp,"_coercedBigint");function qp(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...P(t)})}a(qp,"_int64");function Zp(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...P(t)})}a(Zp,"_uint64");function Gp(e,t){return new e({type:"symbol",...P(t)})}a(Gp,"_symbol");function Vp(e,t){return new e({type:"undefined",...P(t)})}a(Vp,"_undefined");function Bp(e,t){return new e({type:"null",...P(t)})}a(Bp,"_null");function Jp(e){return new e({type:"any"})}a(Jp,"_any");function Kp(e){return new e({type:"unknown"})}a(Kp,"_unknown");function Wp(e,t){return new e({type:"never",...P(t)})}a(Wp,"_never");function Hp(e,t){return new e({type:"void",...P(t)})}a(Hp,"_void");function Yp(e,t){return new e({type:"date",...P(t)})}a(Yp,"_date");function Qp(e,t){return new e({type:"date",coerce:!0,...P(t)})}a(Qp,"_coercedDate");function Xp(e,t){return new e({type:"nan",...P(t)})}a(Xp,"_nan");function vt(e,t){return new rs({check:"less_than",...P(t),value:e,inclusive:!1})}a(vt,"_lt");function Le(e,t){return new rs({check:"less_than",...P(t),value:e,inclusive:!0})}a(Le,"_lte");function bt(e,t){return new os({check:"greater_than",...P(t),value:e,inclusive:!1})}a(bt,"_gt");function Te(e,t){return new os({check:"greater_than",...P(t),value:e,inclusive:!0})}a(Te,"_gte");function js(e){return bt(0,e)}a(js,"_positive");function Us(e){return vt(0,e)}a(Us,"_negative");function Ls(e){return Le(0,e)}a(Ls,"_nonpositive");function zs(e){return Te(0,e)}a(zs,"_nonnegative");function Bt(e,t){return new el({check:"multiple_of",...P(t),value:e})}a(Bt,"_multipleOf");function Jt(e,t){return new rl({check:"max_size",...P(t),maximum:e})}a(Jt,"_maxSize");function wt(e,t){return new ol({check:"min_size",...P(t),minimum:e})}a(wt,"_minSize");function wn(e,t){return new il({check:"size_equals",...P(t),size:e})}a(wn,"_size");function xn(e,t){return new sl({check:"max_length",...P(t),maximum:e})}a(xn,"_maxLength");function Ct(e,t){return new al({check:"min_length",...P(t),minimum:e})}a(Ct,"_minLength");function kn(e,t){return new cl({check:"length_equals",...P(t),length:e})}a(kn,"_length");function Bn(e,t){return new ul({check:"string_format",format:"regex",...P(t),pattern:e})}a(Bn,"_regex");function Jn(e){return new ll({check:"string_format",format:"lowercase",...P(e)})}a(Jn,"_lowercase");function Kn(e){return new dl({check:"string_format",format:"uppercase",...P(e)})}a(Kn,"_uppercase");function Wn(e,t){return new pl({check:"string_format",format:"includes",...P(t),includes:e})}a(Wn,"_includes");function Hn(e,t){return new ml({check:"string_format",format:"starts_with",...P(t),prefix:e})}a(Hn,"_startsWith");function Yn(e,t){return new fl({check:"string_format",format:"ends_with",...P(t),suffix:e})}a(Yn,"_endsWith");function Ms(e,t,r){return new gl({check:"property",property:e,schema:t,...P(r)})}a(Ms,"_property");function Qn(e,t){return new hl({check:"mime_type",mime:e,...P(t)})}a(Qn,"_mime");function rt(e){return new yl({check:"overwrite",tx:e})}a(rt,"_overwrite");function Xn(e){return rt(t=>t.normalize(e))}a(Xn,"_normalize");function er(){return rt(e=>e.trim())}a(er,"_trim");function tr(){return rt(e=>e.toLowerCase())}a(tr,"_toLowerCase");function nr(){return rt(e=>e.toUpperCase())}a(nr,"_toUpperCase");function rr(){return rt(e=>gu(e))}a(rr,"_slugify");function em(e,t,r){return new e({type:"array",element:t,...P(r)})}a(em,"_array");function lP(e,t,r){return new e({type:"union",options:t,...P(r)})}a(lP,"_union");function dP(e,t,r){return new e({type:"union",options:t,inclusive:!1,...P(r)})}a(dP,"_xor");function pP(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...P(o)})}a(pP,"_discriminatedUnion");function mP(e,t,r){return new e({type:"intersection",left:t,right:r})}a(mP,"_intersection");function fP(e,t,r,o){let n=r instanceof z,i=n?o:r,s=n?r:null;return new e({type:"tuple",items:t,rest:s,...P(i)})}a(fP,"_tuple");function gP(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...P(o)})}a(gP,"_record");function hP(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...P(o)})}a(hP,"_map");function yP(e,t,r){return new e({type:"set",valueType:t,...P(r)})}a(yP,"_set");function vP(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:o,...P(r)})}a(vP,"_enum");function bP(e,t,r){return new e({type:"enum",entries:t,...P(r)})}a(bP,"_nativeEnum");function wP(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...P(r)})}a(wP,"_literal");function tm(e,t){return new e({type:"file",...P(t)})}a(tm,"_file");function xP(e,t){return new e({type:"transform",transform:t})}a(xP,"_transform");function kP(e,t){return new e({type:"optional",innerType:t})}a(kP,"_optional");function _P(e,t){return new e({type:"nullable",innerType:t})}a(_P,"_nullable");function $P(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():yu(r)}})}a($P,"_default");function SP(e,t,r){return new e({type:"nonoptional",innerType:t,...P(r)})}a(SP,"_nonoptional");function IP(e,t){return new e({type:"success",innerType:t})}a(IP,"_success");function PP(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}a(PP,"_catch");function EP(e,t,r){return new e({type:"pipe",in:t,out:r})}a(EP,"_pipe");function TP(e,t){return new e({type:"readonly",innerType:t})}a(TP,"_readonly");function AP(e,t,r){return new e({type:"template_literal",parts:t,...P(r)})}a(AP,"_templateLiteral");function CP(e,t){return new e({type:"lazy",getter:t})}a(CP,"_lazy");function RP(e,t){return new e({type:"promise",innerType:t})}a(RP,"_promise");function nm(e,t,r){let o=P(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}a(nm,"_custom");function rm(e,t,r){return new e({type:"custom",check:"custom",fn:t,...P(r)})}a(rm,"_refine");function om(e){let t=sb(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(zn(o,r.value,t._zod.def));else{let n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(zn(n))}},e(r.value,r)));return t}a(om,"_superRefine");function sb(e,t){let r=new ee({check:"custom",...P(t)});return r._zod.check=e,r}a(sb,"_check");function im(e){let t=new ee({check:"describe"});return t._zod.onattach=[r=>{let o=ke.get(r)??{};ke.add(r,{...o,description:e})}],t._zod.check=()=>{},t}a(im,"describe");function sm(e){let t=new ee({check:"meta"});return t._zod.onattach=[r=>{let o=ke.get(r)??{};ke.add(r,{...o,...e})}],t._zod.check=()=>{},t}a(sm,"meta");function am(e,t){let r=P(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(o=o.map(f=>typeof f=="string"?f.toLowerCase():f),n=n.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(o),s=new Set(n),c=e.Codec??po,u=e.Boolean??uo,l=e.String??bn,d=new l({type:"string",error:r.error}),m=new u({type:"boolean",error:r.error}),p=new c({type:"pipe",in:d,out:m,transform:a(((f,g)=>{let v=f;return r.case!=="sensitive"&&(v=v.toLowerCase()),i.has(v)?!0:s.has(v)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:g.value,inst:p,continue:!1}),{})}),"transform"),reverseTransform:a(((f,g)=>f===!0?o[0]||"true":n[0]||"false"),"reverseTransform"),error:r.error});return p}a(am,"_stringbool");function or(e,t,r,o={}){let n=P(o),i={...P(o),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:c=>r.test(c),...n};return r instanceof RegExp&&(i.pattern=r),new e(i)}a(or,"_stringFormat");function Kt(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ke,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}a(Kt,"initializeContext");function W(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,d);else{let p=s.schema,f=t.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,p,d)}let m=e._zod.parent;m&&(s.ref||(s.ref=m),W(m,t,d),t.seen.get(m).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&Ae(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&s.schema._prefault&&((o=s.schema).default??(o.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}a(W,"process");function Wt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let u=o.get(c);if(u&&u!==s[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,s[0])}}let n=a(s=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let m=e.external.registry.get(s[0])?.id,p=e.external.uri??(g=>g);if(m)return{ref:p(m)};let f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${p("__shared")}#/${c}/${f}`}}if(s[1]===r)return{ref:"#"};let l=`#/${c}/`,d=s[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:l+d}},"makeURI"),i=a(s=>{if(s[1].schema.$ref)return;let c=s[1],{ref:u,defId:l}=n(s);c.def={...c.schema},l&&(c.defId=l);let d=c.schema;for(let m in d)delete d[m];d.$ref=u},"extractToDef");if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
294
|
+
|
|
295
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=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(c.cycle){i(s);continue}if(c.count>1&&e.reused==="ref"){i(s);continue}}}a(Wt,"extractDefs");function Ht(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a(s=>{let c=e.seen.get(s);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let p=e.seen.get(d),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):Object.assign(u,f),Object.assign(u,l),s._zod.parent===d)for(let v in u)v==="$ref"||v==="allOf"||v in l||delete u[v];if(f.$ref&&p.def)for(let v in u)v==="$ref"||v==="allOf"||v in p.def&&JSON.stringify(u[v])===JSON.stringify(p.def[v])&&delete u[v]}let m=s._zod.parent;if(m&&m!==d){o(m);let p=e.seen.get(m);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(let f in u)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(u[f])===JSON.stringify(p.def[f])&&delete u[f]}e.override({zodSchema:s,jsonSchema:u,path:c.path??[]})},"flattenRef");for(let s of[...e.seen.entries()].reverse())o(s[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Object.assign(n,r.def??r.schema);let i=e.external?.defs??{};for(let s of e.seen.entries()){let c=s[1];c.def&&c.defId&&(i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:ir(t,"input",e.processors),output:ir(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}a(Ht,"finalize");function Ae(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Ae(o.element,r);if(o.type==="set")return Ae(o.valueType,r);if(o.type==="lazy")return Ae(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Ae(o.innerType,r);if(o.type==="intersection")return Ae(o.left,r)||Ae(o.right,r);if(o.type==="record"||o.type==="map")return Ae(o.keyType,r)||Ae(o.valueType,r);if(o.type==="pipe")return Ae(o.in,r)||Ae(o.out,r);if(o.type==="object"){for(let n in o.shape)if(Ae(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(Ae(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(Ae(n,r))return!0;return!!(o.rest&&Ae(o.rest,r))}return!1}a(Ae,"isTransforming");var cm=a((e,t={})=>r=>{let o=Kt({...r,processors:t});return W(e,o),Wt(o,e),Ht(o,e)},"createToJSONSchemaMethod"),ir=a((e,t,r={})=>o=>{let{libraryOptions:n,target:i}=o??{},s=Kt({...n??{},target:i,io:t,processors:r});return W(e,s),Wt(s,e),Ht(s,e)},"createStandardJSONSchemaMethod");var OP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},um=a((e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof i=="number"&&(n.minLength=i),typeof s=="number"&&(n.maxLength=s),c&&(n.format=OP[c]??c,n.format===""&&delete n.format,c==="time"&&delete n.format),l&&(n.contentEncoding=l),u&&u.size>0){let d=[...u];d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},"stringProcessor"),lm=a((e,t,r,o)=>{let n=r,{minimum:i,maximum:s,format:c,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:d}=e._zod.bag;typeof c=="string"&&c.includes("int")?n.type="integer":n.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(n.minimum=d,n.exclusiveMinimum=!0):n.exclusiveMinimum=d),typeof i=="number"&&(n.minimum=i,typeof d=="number"&&t.target!=="draft-04"&&(d>=i?delete n.minimum:delete n.exclusiveMinimum)),typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(n.maximum=l,n.exclusiveMaximum=!0):n.exclusiveMaximum=l),typeof s=="number"&&(n.maximum=s,typeof l=="number"&&t.target!=="draft-04"&&(l<=s?delete n.maximum:delete n.exclusiveMaximum)),typeof u=="number"&&(n.multipleOf=u)},"numberProcessor"),dm=a((e,t,r,o)=>{r.type="boolean"},"booleanProcessor"),pm=a((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},"bigintProcessor"),mm=a((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},"symbolProcessor"),fm=a((e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),gm=a((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),hm=a((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},"voidProcessor"),ym=a((e,t,r,o)=>{r.not={}},"neverProcessor"),vm=a((e,t,r,o)=>{},"anyProcessor"),bm=a((e,t,r,o)=>{},"unknownProcessor"),wm=a((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},"dateProcessor"),xm=a((e,t,r,o)=>{let n=e._zod.def,i=Qr(n.entries);i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i},"enumProcessor"),km=a((e,t,r,o)=>{let n=e._zod.def,i=[];for(let s of n.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),i.every(s=>typeof s=="boolean")&&(r.type="boolean"),i.every(s=>s===null)&&(r.type="null"),r.enum=i},"literalProcessor"),_m=a((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},"nanProcessor"),$m=a((e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},"templateLiteralProcessor"),Sm=a((e,t,r,o)=>{let n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:c,mime:u}=e._zod.bag;s!==void 0&&(i.minLength=s),c!==void 0&&(i.maxLength=c),u?u.length===1?(i.contentMediaType=u[0],Object.assign(n,i)):(Object.assign(n,i),n.anyOf=u.map(l=>({contentMediaType:l}))):Object.assign(n,i)},"fileProcessor"),Im=a((e,t,r,o)=>{r.type="boolean"},"successProcessor"),Pm=a((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},"customProcessor"),Em=a((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},"functionProcessor"),Tm=a((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},"transformProcessor"),Am=a((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},"mapProcessor"),Cm=a((e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},"setProcessor"),Rm=a((e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:s,maximum:c}=e._zod.bag;typeof s=="number"&&(n.minItems=s),typeof c=="number"&&(n.maxItems=c),n.type="array",n.items=W(i.element,t,{...o,path:[...o.path,"items"]})},"arrayProcessor"),Om=a((e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object",n.properties={};let s=i.shape;for(let l in s)n.properties[l]=W(s[l],t,{...o,path:[...o.path,"properties",l]});let c=new Set(Object.keys(s)),u=new Set([...c].filter(l=>{let d=i.shape[l]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));u.size>0&&(n.required=Array.from(u)),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=W(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},"objectProcessor"),qs=a((e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,s=n.options.map((c,u)=>W(c,t,{...o,path:[...o.path,i?"oneOf":"anyOf",u]}));i?r.oneOf=s:r.anyOf=s},"unionProcessor"),Nm=a((e,t,r,o)=>{let n=e._zod.def,i=W(n.left,t,{...o,path:[...o.path,"allOf",0]}),s=W(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=a(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=u},"intersectionProcessor"),Dm=a((e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map((p,f)=>W(p,t,{...o,path:[...o.path,s,f]})),l=i.rest?W(i.rest,t,{...o,path:[...o.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(n.prefixItems=u,l&&(n.items=l)):t.target==="openapi-3.0"?(n.items={anyOf:u},l&&n.items.anyOf.push(l),n.minItems=u.length,l||(n.maxItems=u.length)):(n.items=u,l&&(n.additionalItems=l));let{minimum:d,maximum:m}=e._zod.bag;typeof d=="number"&&(n.minItems=d),typeof m=="number"&&(n.maxItems=m)},"tupleProcessor"),jm=a((e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let s=i.keyType,u=s._zod.bag?.patterns;if(i.mode==="loose"&&u&&u.size>0){let d=W(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let m of u)n.patternProperties[m.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=W(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=W(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let l=s._zod.values;if(l){let d=[...l].filter(m=>typeof m=="string"||typeof m=="number");d.length>0&&(n.required=d)}},"recordProcessor"),Um=a((e,t,r,o)=>{let n=e._zod.def,i=W(n.innerType,t,o),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},"nullableProcessor"),Lm=a((e,t,r,o)=>{let n=e._zod.def;W(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},"nonoptionalProcessor"),zm=a((e,t,r,o)=>{let n=e._zod.def;W(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},"defaultProcessor"),Mm=a((e,t,r,o)=>{let n=e._zod.def;W(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},"prefaultProcessor"),Fm=a((e,t,r,o)=>{let n=e._zod.def;W(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let s;try{s=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},"catchProcessor"),qm=a((e,t,r,o)=>{let n=e._zod.def,i=t.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;W(i,t,o);let s=t.seen.get(e);s.ref=i},"pipeProcessor"),Zm=a((e,t,r,o)=>{let n=e._zod.def;W(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},"readonlyProcessor"),Gm=a((e,t,r,o)=>{let n=e._zod.def;W(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},"promiseProcessor"),Zs=a((e,t,r,o)=>{let n=e._zod.def;W(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},"optionalProcessor"),Vm=a((e,t,r,o)=>{let n=e._zod.innerType;W(n,t,o);let i=t.seen.get(e);i.ref=n},"lazyProcessor"),Fs={string:um,number:lm,boolean:dm,bigint:pm,symbol:mm,null:fm,undefined:gm,void:hm,never:ym,any:vm,unknown:bm,date:wm,enum:xm,literal:km,nan:_m,template_literal:$m,file:Sm,success:Im,custom:Pm,function:Em,transform:Tm,map:Am,set:Cm,array:Rm,object:Om,union:qs,intersection:Nm,tuple:Dm,record:jm,nullable:Um,nonoptional:Lm,default:zm,prefault:Mm,catch:Fm,pipe:qm,readonly:Zm,promise:Gm,optional:Zs,lazy:Vm};function Gs(e,t){if("_idmap"in e){let o=e,n=Kt({...t,processors:Fs}),i={};for(let u of o._idmap.entries()){let[l,d]=u;W(d,n)}let s={},c={registry:o,uri:t?.uri,defs:i};n.external=c;for(let u of o._idmap.entries()){let[l,d]=u;Wt(n,d),s[l]=Ht(n,d)}if(Object.keys(i).length>0){let u=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[u]:i}}return{schemas:s}}let r=Kt({...t,processors:Fs});return W(e,r),Wt(r,e),Ht(r,e)}a(Gs,"toJSONSchema");var Vs=class{static{a(this,"JSONSchemaGenerator")}get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Kt({processors:Fs,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return W(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),Wt(this.ctx,t);let o=Ht(this.ctx,t),{"~standard":n,...i}=o;return i}};var ab={};var wo={};St(wo,{ZodAny:()=>hf,ZodArray:()=>wf,ZodBase64:()=>pa,ZodBase64URL:()=>ma,ZodBigInt:()=>pr,ZodBigIntFormat:()=>ha,ZodBoolean:()=>dr,ZodCIDRv4:()=>la,ZodCIDRv6:()=>da,ZodCUID:()=>ra,ZodCUID2:()=>oa,ZodCatch:()=>qf,ZodCodec:()=>$a,ZodCustom:()=>Co,ZodCustomStringFormat:()=>ur,ZodDate:()=>Io,ZodDefault:()=>jf,ZodDiscriminatedUnion:()=>kf,ZodE164:()=>fa,ZodEmail:()=>ea,ZodEmoji:()=>ta,ZodEnum:()=>ar,ZodExactOptional:()=>Of,ZodFile:()=>Cf,ZodFunction:()=>Yf,ZodGUID:()=>xo,ZodIPv4:()=>ca,ZodIPv6:()=>ua,ZodIntersection:()=>_f,ZodJWT:()=>ga,ZodKSUID:()=>aa,ZodLazy:()=>Kf,ZodLiteral:()=>Af,ZodMAC:()=>uf,ZodMap:()=>Ef,ZodNaN:()=>Gf,ZodNanoID:()=>na,ZodNever:()=>vf,ZodNonOptional:()=>ka,ZodNull:()=>ff,ZodNullable:()=>Df,ZodNumber:()=>lr,ZodNumberFormat:()=>$n,ZodObject:()=>Eo,ZodOptional:()=>xa,ZodPipe:()=>_a,ZodPrefault:()=>Lf,ZodPromise:()=>Hf,ZodReadonly:()=>Vf,ZodRecord:()=>Ao,ZodSet:()=>Tf,ZodString:()=>cr,ZodStringFormat:()=>X,ZodSuccess:()=>Ff,ZodSymbol:()=>pf,ZodTemplateLiteral:()=>Jf,ZodTransform:()=>Rf,ZodTuple:()=>Sf,ZodType:()=>Z,ZodULID:()=>ia,ZodURL:()=>So,ZodUUID:()=>xt,ZodUndefined:()=>mf,ZodUnion:()=>To,ZodUnknown:()=>yf,ZodVoid:()=>bf,ZodXID:()=>sa,ZodXor:()=>xf,_ZodString:()=>Xs,_default:()=>Uf,_function:()=>fw,any:()=>Bb,array:()=>Po,base64:()=>Tb,base64url:()=>Ab,bigint:()=>Fb,boolean:()=>df,catch:()=>Zf,check:()=>gw,cidrv4:()=>Pb,cidrv6:()=>Eb,codec:()=>dw,cuid:()=>bb,cuid2:()=>wb,custom:()=>hw,date:()=>Kb,describe:()=>yw,discriminatedUnion:()=>ew,e164:()=>Cb,email:()=>ub,emoji:()=>yb,enum:()=>ba,exactOptional:()=>Nf,file:()=>aw,float32:()=>Ub,float64:()=>Lb,function:()=>fw,guid:()=>lb,hash:()=>jb,hex:()=>Db,hostname:()=>Nb,httpUrl:()=>hb,instanceof:()=>bw,int:()=>Qs,int32:()=>zb,int64:()=>qb,intersection:()=>$f,ipv4:()=>$b,ipv6:()=>Ib,json:()=>xw,jwt:()=>Rb,keyof:()=>Wb,ksuid:()=>_b,lazy:()=>Wf,literal:()=>sw,looseObject:()=>Qb,looseRecord:()=>nw,mac:()=>Sb,map:()=>rw,meta:()=>vw,nan:()=>lw,nanoid:()=>vb,nativeEnum:()=>iw,never:()=>ya,nonoptional:()=>Mf,null:()=>gf,nullable:()=>_o,nullish:()=>cw,number:()=>lf,object:()=>Hb,optional:()=>ko,partialRecord:()=>tw,pipe:()=>$o,prefault:()=>zf,preprocess:()=>kw,promise:()=>mw,readonly:()=>Bf,record:()=>Pf,refine:()=>Qf,set:()=>ow,strictObject:()=>Yb,string:()=>Ys,stringFormat:()=>Ob,stringbool:()=>ww,success:()=>uw,superRefine:()=>Xf,symbol:()=>Gb,templateLiteral:()=>pw,transform:()=>wa,tuple:()=>If,uint32:()=>Mb,uint64:()=>Zb,ulid:()=>xb,undefined:()=>Vb,union:()=>va,unknown:()=>_n,url:()=>gb,uuid:()=>db,uuidv4:()=>pb,uuidv6:()=>mb,uuidv7:()=>fb,void:()=>Jb,xid:()=>kb,xor:()=>Xb});var Bs={};St(Bs,{endsWith:()=>Yn,gt:()=>bt,gte:()=>Te,includes:()=>Wn,length:()=>kn,lowercase:()=>Jn,lt:()=>vt,lte:()=>Le,maxLength:()=>xn,maxSize:()=>Jt,mime:()=>Qn,minLength:()=>Ct,minSize:()=>wt,multipleOf:()=>Bt,negative:()=>Us,nonnegative:()=>zs,nonpositive:()=>Ls,normalize:()=>Xn,overwrite:()=>rt,positive:()=>js,property:()=>Ms,regex:()=>Bn,size:()=>wn,slugify:()=>rr,startsWith:()=>Hn,toLowerCase:()=>tr,toUpperCase:()=>nr,trim:()=>er,uppercase:()=>Kn});var sr={};St(sr,{ZodISODate:()=>Ks,ZodISODateTime:()=>Js,ZodISODuration:()=>Hs,ZodISOTime:()=>Ws,date:()=>Jm,datetime:()=>Bm,duration:()=>Wm,time:()=>Km});var Js=y("ZodISODateTime",(e,t)=>{Cl.init(e,t),X.init(e,t)});function Bm(e){return Pp(Js,e)}a(Bm,"datetime");var Ks=y("ZodISODate",(e,t)=>{Rl.init(e,t),X.init(e,t)});function Jm(e){return Ep(Ks,e)}a(Jm,"date");var Ws=y("ZodISOTime",(e,t)=>{Ol.init(e,t),X.init(e,t)});function Km(e){return Tp(Ws,e)}a(Km,"time");var Hs=y("ZodISODuration",(e,t)=>{Nl.init(e,t),X.init(e,t)});function Wm(e){return Ap(Hs,e)}a(Wm,"duration");var cb=a((e,t)=>{ro.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:a(r=>io(e,r),"value")},flatten:{value:a(r=>oo(e,r),"value")},addIssue:{value:a(r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Un,2)},"value")},addIssues:{value:a(r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Un,2)},"value")},isEmpty:{get(){return e.issues.length===0}}})},"initializer"),DP=y("ZodError",cb),De=y("ZodError",cb,{Parent:Error});var Hm=Mn(De),Ym=Fn(De),Qm=qn(De),Xm=Zn(De),ef=Ji(De),tf=Ki(De),nf=Wi(De),rf=Hi(De),of=Yi(De),sf=Qi(De),af=Xi(De),cf=es(De);var Z=y("ZodType",(e,t)=>(z.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ir(e,"input"),output:ir(e,"output")}}),e.toJSONSchema=cm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(I.mergeDefs(t,{checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(r,o)=>Ee(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.parse=(r,o)=>Hm(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Qm(e,r,o),e.parseAsync=async(r,o)=>Ym(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Xm(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>ef(e,r,o),e.decode=(r,o)=>tf(e,r,o),e.encodeAsync=async(r,o)=>nf(e,r,o),e.decodeAsync=async(r,o)=>rf(e,r,o),e.safeEncode=(r,o)=>of(e,r,o),e.safeDecode=(r,o)=>sf(e,r,o),e.safeEncodeAsync=async(r,o)=>af(e,r,o),e.safeDecodeAsync=async(r,o)=>cf(e,r,o),e.refine=(r,o)=>e.check(Qf(r,o)),e.superRefine=r=>e.check(Xf(r)),e.overwrite=r=>e.check(rt(r)),e.optional=()=>ko(e),e.exactOptional=()=>Nf(e),e.nullable=()=>_o(e),e.nullish=()=>ko(_o(e)),e.nonoptional=r=>Mf(e,r),e.array=()=>Po(e),e.or=r=>va([e,r]),e.and=r=>$f(e,r),e.transform=r=>$o(e,wa(r)),e.default=r=>Uf(e,r),e.prefault=r=>zf(e,r),e.catch=r=>Zf(e,r),e.pipe=r=>$o(e,r),e.readonly=()=>Bf(e),e.describe=r=>{let o=e.clone();return ke.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return ke.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return ke.get(e);let o=e.clone();return ke.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Xs=y("_ZodString",(e,t)=>{bn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(o,n,i)=>um(e,o,n,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(Bn(...o)),e.includes=(...o)=>e.check(Wn(...o)),e.startsWith=(...o)=>e.check(Hn(...o)),e.endsWith=(...o)=>e.check(Yn(...o)),e.min=(...o)=>e.check(Ct(...o)),e.max=(...o)=>e.check(xn(...o)),e.length=(...o)=>e.check(kn(...o)),e.nonempty=(...o)=>e.check(Ct(1,...o)),e.lowercase=o=>e.check(Jn(o)),e.uppercase=o=>e.check(Kn(o)),e.trim=()=>e.check(er()),e.normalize=(...o)=>e.check(Xn(...o)),e.toLowerCase=()=>e.check(tr()),e.toUpperCase=()=>e.check(nr()),e.slugify=()=>e.check(rr())}),cr=y("ZodString",(e,t)=>{bn.init(e,t),Xs.init(e,t),e.email=r=>e.check(hs(ea,r)),e.url=r=>e.check(bo(So,r)),e.jwt=r=>e.check(Ds(ga,r)),e.emoji=r=>e.check(xs(ta,r)),e.guid=r=>e.check(vo(xo,r)),e.uuid=r=>e.check(ys(xt,r)),e.uuidv4=r=>e.check(vs(xt,r)),e.uuidv6=r=>e.check(bs(xt,r)),e.uuidv7=r=>e.check(ws(xt,r)),e.nanoid=r=>e.check(ks(na,r)),e.guid=r=>e.check(vo(xo,r)),e.cuid=r=>e.check(_s(ra,r)),e.cuid2=r=>e.check($s(oa,r)),e.ulid=r=>e.check(Ss(ia,r)),e.base64=r=>e.check(Rs(pa,r)),e.base64url=r=>e.check(Os(ma,r)),e.xid=r=>e.check(Is(sa,r)),e.ksuid=r=>e.check(Ps(aa,r)),e.ipv4=r=>e.check(Es(ca,r)),e.ipv6=r=>e.check(Ts(ua,r)),e.cidrv4=r=>e.check(As(la,r)),e.cidrv6=r=>e.check(Cs(da,r)),e.e164=r=>e.check(Ns(fa,r)),e.datetime=r=>e.check(Bm(r)),e.date=r=>e.check(Jm(r)),e.time=r=>e.check(Km(r)),e.duration=r=>e.check(Wm(r))});function Ys(e){return _p(cr,e)}a(Ys,"string");var X=y("ZodStringFormat",(e,t)=>{Q.init(e,t),Xs.init(e,t)}),ea=y("ZodEmail",(e,t)=>{kl.init(e,t),X.init(e,t)});function ub(e){return hs(ea,e)}a(ub,"email");var xo=y("ZodGUID",(e,t)=>{wl.init(e,t),X.init(e,t)});function lb(e){return vo(xo,e)}a(lb,"guid");var xt=y("ZodUUID",(e,t)=>{xl.init(e,t),X.init(e,t)});function db(e){return ys(xt,e)}a(db,"uuid");function pb(e){return vs(xt,e)}a(pb,"uuidv4");function mb(e){return bs(xt,e)}a(mb,"uuidv6");function fb(e){return ws(xt,e)}a(fb,"uuidv7");var So=y("ZodURL",(e,t)=>{_l.init(e,t),X.init(e,t)});function gb(e){return bo(So,e)}a(gb,"url");function hb(e){return bo(So,{protocol:/^https?$/,hostname:Be.domain,...I.normalizeParams(e)})}a(hb,"httpUrl");var ta=y("ZodEmoji",(e,t)=>{$l.init(e,t),X.init(e,t)});function yb(e){return xs(ta,e)}a(yb,"emoji");var na=y("ZodNanoID",(e,t)=>{Sl.init(e,t),X.init(e,t)});function vb(e){return ks(na,e)}a(vb,"nanoid");var ra=y("ZodCUID",(e,t)=>{Il.init(e,t),X.init(e,t)});function bb(e){return _s(ra,e)}a(bb,"cuid");var oa=y("ZodCUID2",(e,t)=>{Pl.init(e,t),X.init(e,t)});function wb(e){return $s(oa,e)}a(wb,"cuid2");var ia=y("ZodULID",(e,t)=>{El.init(e,t),X.init(e,t)});function xb(e){return Ss(ia,e)}a(xb,"ulid");var sa=y("ZodXID",(e,t)=>{Tl.init(e,t),X.init(e,t)});function kb(e){return Is(sa,e)}a(kb,"xid");var aa=y("ZodKSUID",(e,t)=>{Al.init(e,t),X.init(e,t)});function _b(e){return Ps(aa,e)}a(_b,"ksuid");var ca=y("ZodIPv4",(e,t)=>{Dl.init(e,t),X.init(e,t)});function $b(e){return Es(ca,e)}a($b,"ipv4");var uf=y("ZodMAC",(e,t)=>{Ul.init(e,t),X.init(e,t)});function Sb(e){return Sp(uf,e)}a(Sb,"mac");var ua=y("ZodIPv6",(e,t)=>{jl.init(e,t),X.init(e,t)});function Ib(e){return Ts(ua,e)}a(Ib,"ipv6");var la=y("ZodCIDRv4",(e,t)=>{Ll.init(e,t),X.init(e,t)});function Pb(e){return As(la,e)}a(Pb,"cidrv4");var da=y("ZodCIDRv6",(e,t)=>{zl.init(e,t),X.init(e,t)});function Eb(e){return Cs(da,e)}a(Eb,"cidrv6");var pa=y("ZodBase64",(e,t)=>{Fl.init(e,t),X.init(e,t)});function Tb(e){return Rs(pa,e)}a(Tb,"base64");var ma=y("ZodBase64URL",(e,t)=>{ql.init(e,t),X.init(e,t)});function Ab(e){return Os(ma,e)}a(Ab,"base64url");var fa=y("ZodE164",(e,t)=>{Zl.init(e,t),X.init(e,t)});function Cb(e){return Ns(fa,e)}a(Cb,"e164");var ga=y("ZodJWT",(e,t)=>{Gl.init(e,t),X.init(e,t)});function Rb(e){return Ds(ga,e)}a(Rb,"jwt");var ur=y("ZodCustomStringFormat",(e,t)=>{Vl.init(e,t),X.init(e,t)});function Ob(e,t,r={}){return or(ur,e,t,r)}a(Ob,"stringFormat");function Nb(e){return or(ur,"hostname",Be.hostname,e)}a(Nb,"hostname");function Db(e){return or(ur,"hex",Be.hex,e)}a(Db,"hex");function jb(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=Be[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return or(ur,o,n,t)}a(jb,"hash");var lr=y("ZodNumber",(e,t)=>{ls.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(o,n,i)=>lm(e,o,n,i),e.gt=(o,n)=>e.check(bt(o,n)),e.gte=(o,n)=>e.check(Te(o,n)),e.min=(o,n)=>e.check(Te(o,n)),e.lt=(o,n)=>e.check(vt(o,n)),e.lte=(o,n)=>e.check(Le(o,n)),e.max=(o,n)=>e.check(Le(o,n)),e.int=o=>e.check(Qs(o)),e.safe=o=>e.check(Qs(o)),e.positive=o=>e.check(bt(0,o)),e.nonnegative=o=>e.check(Te(0,o)),e.negative=o=>e.check(vt(0,o)),e.nonpositive=o=>e.check(Le(0,o)),e.multipleOf=(o,n)=>e.check(Bt(o,n)),e.step=(o,n)=>e.check(Bt(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function lf(e){return Cp(lr,e)}a(lf,"number");var $n=y("ZodNumberFormat",(e,t)=>{Bl.init(e,t),lr.init(e,t)});function Qs(e){return Op($n,e)}a(Qs,"int");function Ub(e){return Np($n,e)}a(Ub,"float32");function Lb(e){return Dp($n,e)}a(Lb,"float64");function zb(e){return jp($n,e)}a(zb,"int32");function Mb(e){return Up($n,e)}a(Mb,"uint32");var dr=y("ZodBoolean",(e,t)=>{uo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dm(e,r,o,n)});function df(e){return Lp(dr,e)}a(df,"boolean");var pr=y("ZodBigInt",(e,t)=>{ds.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(o,n,i)=>pm(e,o,n,i),e.gte=(o,n)=>e.check(Te(o,n)),e.min=(o,n)=>e.check(Te(o,n)),e.gt=(o,n)=>e.check(bt(o,n)),e.gte=(o,n)=>e.check(Te(o,n)),e.min=(o,n)=>e.check(Te(o,n)),e.lt=(o,n)=>e.check(vt(o,n)),e.lte=(o,n)=>e.check(Le(o,n)),e.max=(o,n)=>e.check(Le(o,n)),e.positive=o=>e.check(bt(BigInt(0),o)),e.negative=o=>e.check(vt(BigInt(0),o)),e.nonpositive=o=>e.check(Le(BigInt(0),o)),e.nonnegative=o=>e.check(Te(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Bt(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Fb(e){return Mp(pr,e)}a(Fb,"bigint");var ha=y("ZodBigIntFormat",(e,t)=>{Jl.init(e,t),pr.init(e,t)});function qb(e){return qp(ha,e)}a(qb,"int64");function Zb(e){return Zp(ha,e)}a(Zb,"uint64");var pf=y("ZodSymbol",(e,t)=>{Kl.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mm(e,r,o,n)});function Gb(e){return Gp(pf,e)}a(Gb,"symbol");var mf=y("ZodUndefined",(e,t)=>{Wl.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gm(e,r,o,n)});function Vb(e){return Vp(mf,e)}a(Vb,"_undefined");var ff=y("ZodNull",(e,t)=>{Hl.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fm(e,r,o,n)});function gf(e){return Bp(ff,e)}a(gf,"_null");var hf=y("ZodAny",(e,t)=>{Yl.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vm(e,r,o,n)});function Bb(){return Jp(hf)}a(Bb,"any");var yf=y("ZodUnknown",(e,t)=>{Ql.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bm(e,r,o,n)});function _n(){return Kp(yf)}a(_n,"unknown");var vf=y("ZodNever",(e,t)=>{Xl.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ym(e,r,o,n)});function ya(e){return Wp(vf,e)}a(ya,"never");var bf=y("ZodVoid",(e,t)=>{ed.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hm(e,r,o,n)});function Jb(e){return Hp(bf,e)}a(Jb,"_void");var Io=y("ZodDate",(e,t)=>{td.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(o,n,i)=>wm(e,o,n,i),e.min=(o,n)=>e.check(Te(o,n)),e.max=(o,n)=>e.check(Le(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function Kb(e){return Yp(Io,e)}a(Kb,"date");var wf=y("ZodArray",(e,t)=>{nd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rm(e,r,o,n),e.element=t.element,e.min=(r,o)=>e.check(Ct(r,o)),e.nonempty=r=>e.check(Ct(1,r)),e.max=(r,o)=>e.check(xn(r,o)),e.length=(r,o)=>e.check(kn(r,o)),e.unwrap=()=>e.element});function Po(e,t){return em(wf,e,t)}a(Po,"array");function Wb(e){let t=e._zod.def.shape;return ba(Object.keys(t))}a(Wb,"keyof");var Eo=y("ZodObject",(e,t)=>{rd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Om(e,r,o,n),I.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>ba(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:_n()}),e.loose=()=>e.clone({...e._zod.def,catchall:_n()}),e.strict=()=>e.clone({...e._zod.def,catchall:ya()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>I.extend(e,r),e.safeExtend=r=>I.safeExtend(e,r),e.merge=r=>I.merge(e,r),e.pick=r=>I.pick(e,r),e.omit=r=>I.omit(e,r),e.partial=(...r)=>I.partial(xa,e,r[0]),e.required=(...r)=>I.required(ka,e,r[0])});function Hb(e,t){let r={type:"object",shape:e??{},...I.normalizeParams(t)};return new Eo(r)}a(Hb,"object");function Yb(e,t){return new Eo({type:"object",shape:e,catchall:ya(),...I.normalizeParams(t)})}a(Yb,"strictObject");function Qb(e,t){return new Eo({type:"object",shape:e,catchall:_n(),...I.normalizeParams(t)})}a(Qb,"looseObject");var To=y("ZodUnion",(e,t)=>{lo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qs(e,r,o,n),e.options=t.options});function va(e,t){return new To({type:"union",options:e,...I.normalizeParams(t)})}a(va,"union");var xf=y("ZodXor",(e,t)=>{To.init(e,t),od.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qs(e,r,o,n),e.options=t.options});function Xb(e,t){return new xf({type:"union",options:e,inclusive:!1,...I.normalizeParams(t)})}a(Xb,"xor");var kf=y("ZodDiscriminatedUnion",(e,t)=>{To.init(e,t),id.init(e,t)});function ew(e,t,r){return new kf({type:"union",options:t,discriminator:e,...I.normalizeParams(r)})}a(ew,"discriminatedUnion");var _f=y("ZodIntersection",(e,t)=>{sd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Nm(e,r,o,n)});function $f(e,t){return new _f({type:"intersection",left:e,right:t})}a($f,"intersection");var Sf=y("ZodTuple",(e,t)=>{ps.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Dm(e,r,o,n),e.rest=r=>e.clone({...e._zod.def,rest:r})});function If(e,t,r){let o=t instanceof z,n=o?r:t,i=o?t:null;return new Sf({type:"tuple",items:e,rest:i,...I.normalizeParams(n)})}a(If,"tuple");var Ao=y("ZodRecord",(e,t)=>{ad.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jm(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function Pf(e,t,r){return new Ao({type:"record",keyType:e,valueType:t,...I.normalizeParams(r)})}a(Pf,"record");function tw(e,t,r){let o=Ee(e);return o._zod.values=void 0,new Ao({type:"record",keyType:o,valueType:t,...I.normalizeParams(r)})}a(tw,"partialRecord");function nw(e,t,r){return new Ao({type:"record",keyType:e,valueType:t,mode:"loose",...I.normalizeParams(r)})}a(nw,"looseRecord");var Ef=y("ZodMap",(e,t)=>{cd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Am(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(wt(...r)),e.nonempty=r=>e.check(wt(1,r)),e.max=(...r)=>e.check(Jt(...r)),e.size=(...r)=>e.check(wn(...r))});function rw(e,t,r){return new Ef({type:"map",keyType:e,valueType:t,...I.normalizeParams(r)})}a(rw,"map");var Tf=y("ZodSet",(e,t)=>{ud.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cm(e,r,o,n),e.min=(...r)=>e.check(wt(...r)),e.nonempty=r=>e.check(wt(1,r)),e.max=(...r)=>e.check(Jt(...r)),e.size=(...r)=>e.check(wn(...r))});function ow(e,t){return new Tf({type:"set",valueType:e,...I.normalizeParams(t)})}a(ow,"set");var ar=y("ZodEnum",(e,t)=>{ld.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(o,n,i)=>xm(e,o,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let s of o)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new ar({...t,checks:[],...I.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let s of o)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new ar({...t,checks:[],...I.normalizeParams(n),entries:i})}});function ba(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new ar({type:"enum",entries:r,...I.normalizeParams(t)})}a(ba,"_enum");function iw(e,t){return new ar({type:"enum",entries:e,...I.normalizeParams(t)})}a(iw,"nativeEnum");var Af=y("ZodLiteral",(e,t)=>{dd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>km(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function sw(e,t){return new Af({type:"literal",values:Array.isArray(e)?e:[e],...I.normalizeParams(t)})}a(sw,"literal");var Cf=y("ZodFile",(e,t)=>{pd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sm(e,r,o,n),e.min=(r,o)=>e.check(wt(r,o)),e.max=(r,o)=>e.check(Jt(r,o)),e.mime=(r,o)=>e.check(Qn(Array.isArray(r)?r:[r],o))});function aw(e){return tm(Cf,e)}a(aw,"file");var Rf=y("ZodTransform",(e,t)=>{md.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tm(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ft(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(I.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(I.issue(s))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r)):(r.value=n,r)}});function wa(e){return new Rf({type:"transform",transform:e})}a(wa,"transform");var xa=y("ZodOptional",(e,t)=>{ms.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ko(e){return new xa({type:"optional",innerType:e})}a(ko,"optional");var Of=y("ZodExactOptional",(e,t)=>{fd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Nf(e){return new Of({type:"optional",innerType:e})}a(Nf,"exactOptional");var Df=y("ZodNullable",(e,t)=>{gd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Um(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function _o(e){return new Df({type:"nullable",innerType:e})}a(_o,"nullable");function cw(e){return ko(_o(e))}a(cw,"nullish");var jf=y("ZodDefault",(e,t)=>{hd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Uf(e,t){return new jf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():I.shallowClone(t)}})}a(Uf,"_default");var Lf=y("ZodPrefault",(e,t)=>{yd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function zf(e,t){return new Lf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():I.shallowClone(t)}})}a(zf,"prefault");var ka=y("ZodNonOptional",(e,t)=>{vd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Lm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Mf(e,t){return new ka({type:"nonoptional",innerType:e,...I.normalizeParams(t)})}a(Mf,"nonoptional");var Ff=y("ZodSuccess",(e,t)=>{bd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Im(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function uw(e){return new Ff({type:"success",innerType:e})}a(uw,"success");var qf=y("ZodCatch",(e,t)=>{wd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Zf(e,t){return new qf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}a(Zf,"_catch");var Gf=y("ZodNaN",(e,t)=>{xd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_m(e,r,o,n)});function lw(e){return Xp(Gf,e)}a(lw,"nan");var _a=y("ZodPipe",(e,t)=>{kd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qm(e,r,o,n),e.in=t.in,e.out=t.out});function $o(e,t){return new _a({type:"pipe",in:e,out:t})}a($o,"pipe");var $a=y("ZodCodec",(e,t)=>{_a.init(e,t),po.init(e,t)});function dw(e,t,r){return new $a({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}a(dw,"codec");var Vf=y("ZodReadonly",(e,t)=>{_d.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Bf(e){return new Vf({type:"readonly",innerType:e})}a(Bf,"readonly");var Jf=y("ZodTemplateLiteral",(e,t)=>{$d.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$m(e,r,o,n)});function pw(e,t){return new Jf({type:"template_literal",parts:e,...I.normalizeParams(t)})}a(pw,"templateLiteral");var Kf=y("ZodLazy",(e,t)=>{Pd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vm(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function Wf(e){return new Kf({type:"lazy",getter:e})}a(Wf,"lazy");var Hf=y("ZodPromise",(e,t)=>{Id.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Gm(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function mw(e){return new Hf({type:"promise",innerType:e})}a(mw,"promise");var Yf=y("ZodFunction",(e,t)=>{Sd.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Em(e,r,o,n)});function fw(e){return new Yf({type:"function",input:Array.isArray(e?.input)?If(e?.input):e?.input??Po(_n()),output:e?.output??_n()})}a(fw,"_function");var Co=y("ZodCustom",(e,t)=>{Ed.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pm(e,r,o,n)});function gw(e){let t=new ee({check:"custom"});return t._zod.check=e,t}a(gw,"check");function hw(e,t){return nm(Co,e??(()=>!0),t)}a(hw,"custom");function Qf(e,t={}){return rm(Co,e,t)}a(Qf,"refine");function Xf(e){return om(e)}a(Xf,"superRefine");var yw=im,vw=sm;function bw(e,t={}){let r=new Co({type:"custom",check:"custom",fn:a(o=>o instanceof e,"fn"),abort:!0,...I.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}a(bw,"_instanceof");var ww=a((...e)=>am({Codec:$a,Boolean:dr,String:cr},...e),"stringbool");function xw(e){let t=Wf(()=>va([Ys(e),lf(),df(),gf(),Po(t),Pf(Ys(),t)]));return t}a(xw,"json");function kw(e,t){return $o(wa(e),t)}a(kw,"preprocess");var UP={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function LP(e){ae({customError:e})}a(LP,"setErrorMap");function zP(){return ae().customError}a(zP,"getErrorMap");var eg;eg||(eg={});var R={...wo,...Bs,iso:sr},MP=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 FP(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}a(FP,"detectVersion");function qP(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1];if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}a(qP,"resolveRef");function _w(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return R.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return R.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=qP(n,t),s=$e(i,t);return t.refs.set(n,s),t.processing.delete(n),s}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return R.null();if(n.length===0)return R.never();if(n.length===1)return R.literal(n[0]);if(n.every(s=>typeof s=="string"))return R.enum(n);let i=n.map(s=>R.literal(s));return i.length<2?i[0]:R.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return R.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(i=>{let s={...e,type:i};return _w(s,t)});return n.length===0?R.never():n.length===1?n[0]:R.union(n)}if(!r)return R.any();let o;switch(r){case"string":{let n=R.string();if(e.format){let i=e.format;i==="email"?n=n.check(R.email()):i==="uri"||i==="uri-reference"?n=n.check(R.url()):i==="uuid"||i==="guid"?n=n.check(R.uuid()):i==="date-time"?n=n.check(R.iso.datetime()):i==="date"?n=n.check(R.iso.date()):i==="time"?n=n.check(R.iso.time()):i==="duration"?n=n.check(R.iso.duration()):i==="ipv4"?n=n.check(R.ipv4()):i==="ipv6"?n=n.check(R.ipv6()):i==="mac"?n=n.check(R.mac()):i==="cidr"?n=n.check(R.cidrv4()):i==="cidr-v6"?n=n.check(R.cidrv6()):i==="base64"?n=n.check(R.base64()):i==="base64url"?n=n.check(R.base64url()):i==="e164"?n=n.check(R.e164()):i==="jwt"?n=n.check(R.jwt()):i==="emoji"?n=n.check(R.emoji()):i==="nanoid"?n=n.check(R.nanoid()):i==="cuid"?n=n.check(R.cuid()):i==="cuid2"?n=n.check(R.cuid2()):i==="ulid"?n=n.check(R.ulid()):i==="xid"?n=n.check(R.xid()):i==="ksuid"&&(n=n.check(R.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),o=n;break}case"number":case"integer":{let n=r==="integer"?R.number().int():R.number();typeof e.minimum=="number"&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),o=n;break}case"boolean":{o=R.boolean();break}case"null":{o=R.null();break}case"object":{let n={},i=e.properties||{},s=new Set(e.required||[]);for(let[u,l]of Object.entries(i)){let d=$e(l,t);n[u]=s.has(u)?d:d.optional()}if(e.propertyNames){let u=$e(e.propertyNames,t),l=e.additionalProperties&&typeof e.additionalProperties=="object"?$e(e.additionalProperties,t):R.any();if(Object.keys(n).length===0){o=R.record(u,l);break}let d=R.object(n).passthrough(),m=R.looseRecord(u,l);o=R.intersection(d,m);break}if(e.patternProperties){let u=e.patternProperties,l=Object.keys(u),d=[];for(let p of l){let f=$e(u[p],t),g=R.string().regex(new RegExp(p));d.push(R.looseRecord(g,f))}let m=[];if(Object.keys(n).length>0&&m.push(R.object(n).passthrough()),m.push(...d),m.length===0)o=R.object({}).passthrough();else if(m.length===1)o=m[0];else{let p=R.intersection(m[0],m[1]);for(let f=2;f<m.length;f++)p=R.intersection(p,m[f]);o=p}break}let c=R.object(n);e.additionalProperties===!1?o=c.strict():typeof e.additionalProperties=="object"?o=c.catchall($e(e.additionalProperties,t)):o=c.passthrough();break}case"array":{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let s=n.map(u=>$e(u,t)),c=i&&typeof i=="object"&&!Array.isArray(i)?$e(i,t):void 0;c?o=R.tuple(s).rest(c):o=R.tuple(s),typeof e.minItems=="number"&&(o=o.check(R.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(R.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=i.map(u=>$e(u,t)),c=e.additionalItems&&typeof e.additionalItems=="object"?$e(e.additionalItems,t):void 0;c?o=R.tuple(s).rest(c):o=R.tuple(s),typeof e.minItems=="number"&&(o=o.check(R.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(R.maxLength(e.maxItems)))}else if(i!==void 0){let s=$e(i,t),c=R.array(s);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),o=c}else o=R.array(R.any());break}default:throw new Error(`Unsupported type: ${r}`)}return e.description&&(o=o.describe(e.description)),e.default!==void 0&&(o=o.default(e.default)),o}a(_w,"convertBaseSchema");function $e(e,t){if(typeof e=="boolean")return e?R.any():R.never();let r=_w(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(l=>$e(l,t)),u=R.union(c);r=o?R.intersection(r,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(l=>$e(l,t)),u=R.xor(c);r=o?R.intersection(r,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:R.any();else{let c=o?r:$e(e.allOf[0],t),u=o?0:1;for(let l=u;l<e.allOf.length;l++)c=R.intersection(c,$e(e.allOf[l],t));r=c}e.nullable===!0&&t.version==="openapi-3.0"&&(r=R.nullable(r)),e.readOnly===!0&&(r=R.readonly(r));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of i)c in e&&(n[c]=e[c]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let c of s)c in e&&(n[c]=e[c]);for(let c of Object.keys(e))MP.has(c)||(n[c]=e[c]);return Object.keys(n).length>0&&t.registry.add(r,n),r}a($e,"convertSchema");function $w(e,t){if(typeof e=="boolean")return e?R.any():R.never();let r=FP(e,t?.defaultTarget),o=e.$defs||e.definitions||{},n={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??ke};return $e(e,n)}a($w,"fromJSONSchema");var tg={};St(tg,{bigint:()=>BP,boolean:()=>VP,date:()=>JP,number:()=>GP,string:()=>ZP});function ZP(e){return $p(cr,e)}a(ZP,"string");function GP(e){return Rp(lr,e)}a(GP,"number");function VP(e){return zp(dr,e)}a(VP,"boolean");function BP(e){return Fp(pr,e)}a(BP,"bigint");function JP(e){return Qp(Io,e)}a(JP,"date");ae(mo());import uE from"ajv";import{McpServer as lE}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as dE}from"@modelcontextprotocol/sdk/server/stdio.js";import{resolve as Yw}from"path";var Sa={skills:Tt.properties.skills.additionalProperties.properties.executor.enum,tools:Tt.properties.tools.additionalProperties.properties.executor.enum},Sw=a(e=>e.map(t=>`"${t}"`).join(" | "),"quoted"),Ro={publish:{feature:"Publish (single, by channel slug)",whenToUse:"Emit a domain event as a side effect of a business operation, after the state is durably stored.",snippet:`// after the order is saved to your DB:
|
|
296
|
+
await np.events.publish("orders", { id: order.id, symbol: order.symbol, qty: order.qty }, {
|
|
297
|
+
routingKey: "trade.order.placed",
|
|
298
|
+
});`,notes:"The facade resolves the channel slug to its id. Publish is server side; never publish from a browser."},idempotentPublish:{feature:"Idempotent publish",whenToUse:"Avoid duplicates when a publish may be retried (network retries, at-least-once upstream).",snippet:`const channelGid = (await np.events.channels.getBySlug({ slug: "orders" })).gid;
|
|
299
|
+
const r = await np.events.messages.publish({ channelGid, payload, idempotencyKey: order.id });
|
|
300
|
+
// re-publishing with the same idempotencyKey returns the same message id (no duplicate).`},batchPublish:{feature:"Batch publish (all-or-nothing)",whenToUse:"Publish many events in one call (e.g. a burst of ticks). Either all are accepted or none.",snippet:`const channelGid = (await np.events.channels.getBySlug({ slug: "prices" })).gid;
|
|
301
|
+
const { messageIds } = await np.events.messages.publishBatch({
|
|
302
|
+
channelGid,
|
|
303
|
+
messages: ticks.map((t) => ({ payload: t, idempotencyKey: t.id })),
|
|
304
|
+
});`,notes:"Returns messageIds in request order. An oversized batch is rejected whole."},orderedGroups:{feature:"Ordered groups (FIFO within a key)",whenToUse:"Guarantee in-order processing for a partition (per account, per symbol) while allowing cross-key parallelism.",snippet:`await np.events.messages.publishGroup({
|
|
305
|
+
channelGid,
|
|
306
|
+
messages: updates.map((u) => ({ partitionKey: u.account, payload: u })),
|
|
307
|
+
});`},priority:{feature:"Priority",whenToUse:"Process urgent events (alerts, liquidations) ahead of routine ones in a subscription's delivery queue.",snippet:"await np.events.messages.publish({ channelGid, payload, priority: 9 }); // 0..9, default 5"},scheduled:{feature:"Scheduled publish",whenToUse:"Defer an event to a future time (a delayed warning, a market-close action).",snippet:`const scheduledId = await np.events.scheduling.scheduleMessage({
|
|
308
|
+
channelGid, payload, deliverAt: Date.now() + 60_000,
|
|
309
|
+
});
|
|
310
|
+
// cancel before delivery:
|
|
311
|
+
await np.events.scheduling.cancelScheduled({ scheduledMessageGid: scheduledId });`,notes:"scheduleMessage returns the scheduled-message id; pass it to cancelScheduled."},ttlAndAttributes:{feature:"TTL + attributes",whenToUse:"Expire transient events (ttl seconds) and carry routing/compliance metadata (attributes).",snippet:'await np.events.messages.publish({ channelGid, payload, ttl: 60, attributes: { venue: "NYSE", region: "us-east" } });'},queueConsume:{feature:"Queue consume (the outbox / work queue)",whenToUse:"Process each message exactly once across many workers; survive restarts. Publish to a `queue` channel with a `queue` subscription, then pull.",snippet:`// resolve your queue subscription's id once (by its declared name on the channel).
|
|
312
|
+
for (;;) {
|
|
313
|
+
const { messages } = await np.events.queues.receiveMessages({
|
|
314
|
+
subscriptionGid, maxMessages: 25, waitTimeSeconds: 2, visibilityTimeoutSeconds: 30,
|
|
315
|
+
});
|
|
316
|
+
for (const m of messages) {
|
|
317
|
+
const ok = await handleIdempotently(m.body); // your work, safe to repeat
|
|
318
|
+
if (ok) await np.events.queues.deleteMessage({ subscriptionGid, receiptHandle: m.receiptHandle });
|
|
319
|
+
// do NOT delete on failure \u2014 the message reappears after the visibility window for retry.
|
|
320
|
+
}
|
|
321
|
+
}`,notes:"Each message is { receiptHandle, body }. Delete (ack) only after success. Use changeMessageVisibility({ subscriptionGid, receiptHandle, visibilityTimeoutSeconds }) to extend while still working."},stream:{feature:"Stream read + offset commit",whenToUse:"Replay an ordered log (analytics, P&L rebuild, backtest) and resume from where you left off.",snippet:`const messages = await np.events.streams.readFromOffset({ channelGid, offset: 0, limit: 100 }); // the messages themselves, an array
|
|
322
|
+
// after processing up to N:
|
|
323
|
+
await np.events.streams.commitOffset({ channelGid, consumerId: "analytics", offset: N });
|
|
324
|
+
const resumeAt = await np.events.streams.getOffset({ channelGid, consumerId: "analytics" }); // a number`},compactedKv:{feature:"Compacted channel as key/value (latest wins)",whenToUse:'Keep the latest value per key (a live price book, current config). Declare the channel retentionMode: "compacted".',snippet:`await np.events.kvStore.setEntry({ channelGid, key: symbol, value: { price } });
|
|
325
|
+
const latest = await np.events.kvStore.getEntry({ channelGid, key: symbol }); // { value }
|
|
326
|
+
const history = await np.events.kvStore.getHistory({ channelGid, key: symbol });`},webhookVerify:{feature:"Verify an inbound webhook (the receiver)",whenToUse:"ALWAYS, before acting on a delivered event. Never trust an unsigned or tampered delivery.",snippet:`import { WebhookHandler } from "@npayload/sdk";
|
|
327
|
+
const wh = new WebhookHandler();
|
|
328
|
+
// hand it the delivery headers (req.headers, request.headers or the request itself):
|
|
329
|
+
// it verifies X-NPayload-Signature (the hex HMAC-SHA256 of "<X-NPayload-Timestamp>.<raw body>", or "t=<ts>,v1=<hmac>[,kid=...]")
|
|
330
|
+
const event = await wh.constructEvent(rawBody, req.headers, signingSecret); // throws if invalid
|
|
331
|
+
// event.data = the body exactly as published (no envelope, never unwrapped);
|
|
332
|
+
// event.id = X-NPayload-Message-Id, plus event.deliveryId, event.channelGid, event.publishedAt, event.metadata.`,notes:"Get the signing secret once via np.events.subscriptions.rotateSecret({ subscriptionGid }) \u2192 { webhookSecret } and store it in your server env (a real secret manager in prod)."},catalogue:{feature:"Event catalogue + schema versioning",whenToUse:"Govern the events you publish: register a typed event, publish a versioned schema, check compatibility before promoting.",snippet:`const eventTypeGid = await np.events.catalogue.registerEventType({
|
|
333
|
+
name: "trade.order.filled", displayName: "Order filled", description: "...",
|
|
334
|
+
domain: "trade", entity: "order", action: "filled", ownership: { team: "trading", contact: "trading@x.com" },
|
|
335
|
+
});
|
|
336
|
+
await np.events.catalogue.registerVersion({ eventTypeGid, version: 1, schema: { format: "json_schema", definition }, changelog: "v1", publishedBy: appId });
|
|
337
|
+
const { compatible } = await np.events.catalogue.checkCompatibility({ eventTypeGid, schemaDefinition, mode: "backward" });`},exchanges:{feature:"Exchanges (route one publish to many channels)",whenToUse:"Fan a single publish out to several channels (direct/topic/fanout/headers routing).",snippet:`const exchangeGid = (await np.events.exchanges.create({ name: "executions", type: "fanout" })).gid;
|
|
338
|
+
await np.events.exchanges.createBinding({ exchangeGid, channelGid });
|
|
339
|
+
await np.events.exchanges.publishToExchange({ exchangeGid, payload });
|
|
340
|
+
// preview routing without publishing:
|
|
341
|
+
const routes = await np.events.exchanges.dryRun({ exchangeGid, routingKey: "trade.execution" }); // [{ channelGid, bindingGid }]`},consumerGroups:{feature:"Consumer groups (scale a stream across workers)",whenToUse:"Load-balance a stream across competing workers; members join and leave dynamically.",snippet:`// createGroup answers the new group's gid itself (a string), never an object:
|
|
342
|
+
const groupGid = await np.events.consumerGroups.createGroup({ channelGid, name: "analytics", strategy: "competing" });
|
|
343
|
+
await np.events.consumerGroups.joinGroup({ groupGid, subscriptionGid });
|
|
344
|
+
// later:
|
|
345
|
+
await np.events.consumerGroups.leaveGroup({ groupGid, subscriptionGid });`,notes:"createGroup resolves to the group's gid (cg_\u2026), so join and leave address the group by that value. To read the group back (members, strategy, status), call getGroup({ groupGid })."},dlq:{feature:"Dead letter queue",whenToUse:"Inspect + recover deliveries that failed past their retry budget instead of losing them.",snippet:`const stats = await np.events.dlq.getStats({ subscriptionGid });
|
|
346
|
+
const entries = await np.events.dlq.listBySubscription({ subscriptionGid });
|
|
347
|
+
await np.events.dlq.reprocess({ dlqEntryGid: entries[0].gid }); // once the endpoint recovers`},snapshots:{feature:"Snapshots (checkpoint + restore a consumer)",whenToUse:"Let a new worker restore to a known point instead of replaying from the start.",snippet:`// createSnapshot records the subscription's current position itself and answers the snapshot's gid (a string):
|
|
348
|
+
const snapshotGid = await np.events.snapshots.createSnapshot({ subscriptionGid, name: "checkpoint" });
|
|
349
|
+
await np.events.snapshots.seekToSnapshot({ snapshotGid });`,notes:"The request takes the subscription's gid, a name and optional metadata \u2014 never a position: the platform records the offset, the acknowledged mark and the pending count at the moment of the call. seekToSnapshot takes the gid createSnapshot answers."},privacy:{feature:"End to end / hybrid privacy",whenToUse:'Share private payloads the platform must not read. Declare the channel privacyMode "e2e" (payload opaque) or "hybrid" (metadata visible, payload encrypted).',snippet:`// the app encrypts before publishing; npayload relays the ciphertext and never reads it.
|
|
350
|
+
await np.events.publish("positions", { ciphertext: encrypt(position) });`,notes:"Server-side transforms (pipe filters) are not available on e2e channels \u2014 the platform cannot see the payload."},nppTransport:{feature:"NPP transport (the default binary data plane)",whenToUse:"Lower-latency publish/consume over signed binary frames. The default; opt into HTTP only if you need it.",snippet:`const np = await NPayload.connect({ clientId, appId, baseUrl, transport: "npp", edgeUrl });
|
|
351
|
+
await np.events.publish("orders", payload); // rides the NPP wire; lands in the same store as HTTP`,notes:"Management operations (create/list/rotate) always ride the HTTP API; NPP carries the event data itself (publish/consume)."},transportChoice:{feature:"Choosing a transport (NPP vs HTTP) \u2014 the decision tree",whenToUse:"Decide ONCE per service, at connect(). Both transports publish to and consume from the SAME channels \u2014 the choice is about latency and environment, never about features.",snippet:`// 1. High-throughput / latency-sensitive event flow (trading, telemetry,
|
|
352
|
+
// realtime pipelines) \u2192 NPP. Signed binary frames, fastest acks.
|
|
353
|
+
const fast = await NPayload.connect({ clientId, appId, baseUrl, transport: "npp", edgeUrl });
|
|
354
|
+
|
|
355
|
+
// 2. Ordinary backend services, serverless functions, restricted networks
|
|
356
|
+
// (plain HTTPS only) \u2192 HTTP. Zero extra setup, universal reach.
|
|
357
|
+
const simple = await NPayload.connect({ clientId, appId, baseUrl, transport: "http" });
|
|
358
|
+
|
|
359
|
+
// Either way the SAME code runs: publish/consume/manage are identical.
|
|
360
|
+
await fast.events.publish("orders", payload);`,notes:"Everything works on both: a client connected with transport 'npp' still performs every management operation transparently (they ride HTTPS under the hood), so switching transports never changes your code. Signing keys and credentials are provisioned automatically at connect() \u2014 never configure them by hand. Rule of thumb: start with HTTP; move a hot publisher/consumer to NPP when publish latency matters."},typedEvents:{feature:"Typed event payloads (schema in config \u2192 generated TypeScript types)",whenToUse:"Declare a JSON Schema on an eventType in events.config.ts and every publish/consume of that event becomes compile-time typed. Schema changes create NEW versions (append-only) \u2014 existing consumers keep their pinned version.",snippet:`// events.config.ts
|
|
361
|
+
eventTypes: {
|
|
362
|
+
"market.price.tick": {
|
|
363
|
+
displayName: "Price tick", description: "New market price", domain: "market", entity: "price", action: "tick",
|
|
364
|
+
ownership: { team: "market-data", contact: "md@example.com" },
|
|
365
|
+
schema: { format: "json_schema", definition: JSON.stringify({
|
|
366
|
+
type: "object", properties: { symbol: { type: "string" }, price: { type: "number" } }, required: ["symbol", "price"],
|
|
367
|
+
}) },
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
// then: npayload push \u2192 registers the schema version + regenerates npayload/_generated/events.d.ts
|
|
372
|
+
import type { EventPayloads } from "./npayload/_generated/events";
|
|
373
|
+
const tick: EventPayloads["market.price.tick"] = { symbol: "BTC-USD", price: 64000 };
|
|
374
|
+
await np.events.publish("prices", tick, { routingKey: "market.price.tick" });`,notes:"The generated file is stamped and regenerated on every push \u2014 never edit it by hand. A changed schema registers the NEXT catalogue version; an identical schema is a no-op."},permissionsAsCode:{feature:"Generated permissions (permissions.generated.ts)",whenToUse:"Understand what your app's credential can do. Every push regenerates npayload/permissions.generated.ts \u2014 the exact, least-privilege scope set projected from your declared topology.",snippet:`// npayload/permissions.generated.ts (GENERATED \u2014 never edit)
|
|
375
|
+
export const permissions = { scopes: ["channels:read", "channels:write", "messages:read", "messages:write", /* \u2026 */] };`,notes:"Scopes are per-object (channels:write, messages:read, \u2026) \u2014 never a blanket grant. To widen access, declare the feature in events.config.ts and push; the file (and the credential's authorization) follows the topology. If an operation fails with a scope error, check this file first, then `npayload validate` for drift."}},Iw={decisionGuide:{channelType:"topic = fan-out to all subscribers (order lifecycle, alerts). queue = each message handled once across workers, with ack/retry (settlement, jobs, the outbox). stream = ordered, replayable log (the trade tape, analytics, event sourcing). compacted (retentionMode) = latest value per key wins (a live price book, current config) \u2014 also usable as a key/value store.",delivery:"Push delivery = a webhook subscription (the platform POSTs signed events to your URL). Pull delivery = a queue subscription (your worker pulls with receiveMessages, the outbox pattern). Choose push for low-latency reactions, pull for controlled throughput + at-least-once with explicit ack.",privacy:"standard = platform can read the payload (default; enables server-side transforms). hybrid = metadata visible, payload encrypted. e2e = payload opaque to the platform (you encrypt before publishing)."},core:["publish (single, batch, groups-FIFO, priority, scheduled, idempotency, TTL, attributes)","channels (topic, queue, stream, compacted)","queue consume / outbox (receive, delete/ack, visibility)","subscriptions (webhook + HMAC, filter, pause/resume, secret rotation, retry, DLQ)","streams (read from offset, commit/resume, replay)","consumer groups (competing/sticky/broadcast, join/leave)","dead letter queue (stats, list, reprocess)","event catalogue (register type, version, compatibility)","exchanges (direct/topic/fanout/headers, bindings, dry run)","key/value (compacted set/get/history)","snapshots (checkpoint, restore)","privacy modes (standard / hybrid / e2e)","transports (NPP default + HTTP)"],notDeclarable:["external connectors / adapters (Kafka, SQS, EventBridge, SNS, Azure, GCP)","cross-workspace channels + geo-replication","bring-your-own-key (BYOK) encryption"]},Pw=`npayload Pipes config-as-code. Write npayload/pipes.config.ts that default-exports
|
|
376
|
+
definePipesConfig({...}). Resources are keyed by name (the map key):
|
|
377
|
+
|
|
378
|
+
- workflows: an automation. Provide a "definition" (React-Flow "nodes" + "edges";
|
|
379
|
+
nodes reference connectors) and a "triggerConfig" { type: "event" | "schedule" |
|
|
380
|
+
"webhook" | "manual" | "form", config }. Config "update" changes name/description
|
|
381
|
+
only \u2014 the node graph is versioned and edited in the editor, not via config.
|
|
382
|
+
A config-declared workflow is created as a DRAFT (activate it in the dashboard,
|
|
383
|
+
via the CLI, or with pipes_create's activate flag for imperative builds); a
|
|
384
|
+
workflow the config no longer declares is deleted only by deploy --prune.
|
|
385
|
+
- credentials: a connector credential. name + connectorId + auth. NEVER put a
|
|
386
|
+
plaintext secret in the config \u2014 declare it by reference (auth.vaultSecretId,
|
|
387
|
+
the id of a credential stored from the dashboard); the platform stores the
|
|
388
|
+
secret in the vault (AES-256-GCM) and the config carries only the reference.
|
|
389
|
+
- governance: a SINGLETON (one object, NOT a keyed map) \u2014 connector "mode"
|
|
390
|
+
("open" | "allowlist" | "approval_required") + allowedConnectors / blockedConnectors.
|
|
391
|
+
ADMIN-GATED: an org admin applies it; a machine credential gets a clear "needs
|
|
392
|
+
admin" note (manage it in the dashboard).
|
|
393
|
+
|
|
394
|
+
Loop: write pipes.config.ts, call pipes_validate (omit the arg to validate the file
|
|
395
|
+
on disk), then pipes_deploy (use check:true first to preview). Reconciles over the
|
|
396
|
+
same edge=>admin=>cell path as Events, keyed by name (idempotent: re-deploy = no-op).`,Ew={decisionGuide:{workflow:"A workflow is a node graph + a trigger. triggerConfig.type: event (an Events channel/event), schedule (cron), webhook (inbound HTTP), manual (run on demand), form (user-submitted).",credentials:"Connectors need auth. Declare a credential by NAME with its connectorId and an auth object whose secret is a vault reference (vaultSecretId) \u2014 never a plaintext key; store the secret from the dashboard and reference its id."},core:["workflows (create/list, update name+description, activate/pause/archive)","credentials (vault-backed; secret declared by reference, never plaintext)","connectors (200+ built-in; referenced by workflow nodes, not declared)","governance (mode + allow/block lists; a SINGLETON object, ADMIN-GATED \u2014 an org admin applies it; a machine credential gets a clear 'needs admin' note)"],notDeclarable:["workflow definition (node-graph) edits via config \u2014 use the editor; config update is name/description only","executions / runs / logs / DLQ \u2014 runtime state, not declarable"]},Tw=`npayload Primus (AI agents) config-as-code. Write npayload/primus.config.ts that
|
|
397
|
+
default-exports definePrimusConfig({...}). Resources are keyed by name (the map key):
|
|
398
|
+
|
|
399
|
+
- agents: an autonomous worker. "systemPrompt" is required; description/personality/
|
|
400
|
+
language optional. "skills" takes the NAMES of skills declared in this config \u2014
|
|
401
|
+
resolved to their ids at deploy (skills reconcile first). The binding is applied
|
|
402
|
+
at CREATE; re-wire an existing agent imperatively (\`np primus agents assign-skill\`).
|
|
403
|
+
- skills: a reusable capability. description + "executor" (${Sw(Sa.skills)})
|
|
404
|
+
+ a "definition" { systemPrompt }.
|
|
405
|
+
- tools: an action an agent/skill can call. description + "riskLevel" ("safe" |
|
|
406
|
+
"moderate" | "dangerous") + "executor" (${Sw(Sa.tools)}).
|
|
407
|
+
An "inline" executor needs no endpoint; a "webhook" executor requires an https endpoint.
|
|
408
|
+
Tool/skill names: lowercase + underscores, NO hyphens.
|
|
409
|
+
- triggers: fire an agent. "agentGid" is an AGENT's name from above (resolved to its id),
|
|
410
|
+
"type" ("event" | "cron" | "webhook" | "message"), "config" (e.g. { eventType }), "action" { goal }.
|
|
411
|
+
|
|
412
|
+
Loop: write primus.config.ts, call primus_validate, then primus_deploy (check:true first).
|
|
413
|
+
Same edge=>admin=>primus path, keyed by name (idempotent).`,Aw={decisionGuide:{executor:`inline = runs in the agent process (simple transforms/lookups); webhook = your own https endpoint; every other executor (${Sa.skills.filter(e=>e!=="inline"&&e!=="webhook").join(", ")}) = a sandboxed runtime npayload manages \u2014 the schema primus_contract serves lists the exact set.`,risk:"tools.riskLevel: safe (no approval) | moderate | dangerous (approval-gated). Tool/skill names are lowercase + underscores."},core:["agents (create/list/update, name-keyed)",`skills (create/list/update; executors: ${Sa.skills.join("/")})`,"tools (create/list/update; vault-backed webhook secrets)","triggers (event/cron/webhook/message; parent agent referenced by name via agentGid)"],notDeclarable:["conversations / executions / memories / approvals / kill-switch / audit \u2014 runtime, not declarable","teams / brainConfig (LLM provider): not declarable in config"]};var Oo={updateProfile:{feature:"Set the app's Connect profile (visibility + what it offers)",whenToUse:"Make an app discoverable in Explore and declare which event types it offers cross-org. The profile is the app's one declarative Connect setting.",snippet:`await np.connect.connect.updateAppProfile({
|
|
414
|
+
appId,
|
|
415
|
+
connectVisibility: "listed", // public | listed | unlisted | private
|
|
416
|
+
connectDescription: "Real-time trade signals",
|
|
417
|
+
publishedEventTypes: ["signal.generated", "alert.risk_breach"],
|
|
418
|
+
});`,notes:"INTERNAL-type apps are refused (they are org-private). publishedEventTypes reference eventTypes you declared in events.config.ts. The write lands in the admin registry and propagates to cells."},exploreApps:{feature:"Discover apps to subscribe to (Explore)",whenToUse:"Find publishers in other orgs that expose event types you want to consume.",snippet:`const { items } = await np.connect.connectExplore.searchExploreApps({ query: "trading" }); // { items, nextCursor?, hasMore }
|
|
419
|
+
// or list/page: np.connect.connectExplore.listExploreApps({})
|
|
420
|
+
// or one app: np.connect.connectExplore.getExploreApp({ appId: publisherAppId })`,notes:"Only public/listed apps in OTHER orgs appear; your own org's apps and INTERNAL apps are excluded."},requestAccess:{feature:"Request cross-org access (subscriber side)",whenToUse:"Ask a publisher app in another org for access to specific event types. Opens a pending grant the publisher must approve.",snippet:`const grant = await np.connect.connect.requestAccess({
|
|
421
|
+
subscriberAppId: appId, // your app asking for access
|
|
422
|
+
publisherAppId, // the app you found in Explore
|
|
423
|
+
eventTypes: ["signal.generated"], // what you want to consume
|
|
424
|
+
purpose: "Mirror signals into our risk desk",
|
|
425
|
+
});`,notes:"Both apps must be CONNECT-type (not INTERNAL). Returns the pending grant; nothing flows until the publisher approves."},approveAccess:{feature:"Approve / reject an access request (publisher side)",whenToUse:"As the publisher, accept (optionally rate-limited / time-boxed) or decline an inbound request.",snippet:`await np.connect.connect.approveAccess({
|
|
426
|
+
grantId,
|
|
427
|
+
rateLimit: { perSecond: 50, perDay: 100000 }, // optional
|
|
428
|
+
expiresAt: Date.now() + 30 * 864e5, // optional (ms epoch)
|
|
429
|
+
});
|
|
430
|
+
// or decline: np.connect.connect.rejectAccess({ grantId, reason })`,notes:"Only the publisher org can approve/reject. After approval, fan-out to the subscriber is authorized by the grant."},listGrants:{feature:"List / inspect your grants",whenToUse:"See inbound and outbound grants, their status, and usage; revoke when no longer needed.",snippet:`const { items } = await np.connect.connectAccess.listMyGrants({}); // { items, nextCursor?, hasMore }
|
|
431
|
+
// one grant: np.connect.connectAccess.getGrant({ grantGid })
|
|
432
|
+
// revoke: np.connect.connect.revokeGrant({ grantId })`,notes:"Reads are projected from the cell's synced copy; revoke is the admin-first write."},createBridge:{feature:"Identity Bridge (cross-platform entity mapping)",whenToUse:"When two orgs name the same real entity differently (Shopify customer_123 vs HubSpot contact_XYZ). A bilateral, consent-based bridge lets events translate IDs across the boundary.",snippet:`const { gid } = await np.connect.connect.createBridge({
|
|
433
|
+
targetOrgGID, // the other business's org GID
|
|
434
|
+
entityTypeSlug: "customer",
|
|
435
|
+
});
|
|
436
|
+
// the TARGET org confirms to activate (bilateral):
|
|
437
|
+
await np.connect.connect.confirmBridge({ gid });`,notes:"Starts pending (confirmedBySource only); becomes active when BOTH sides confirm. List via np.connect.connectBridges.listBridges. Suspend/archive via np.connect.identityBridges.suspendBridge({ gid }) / np.connect.identityBridges.archiveBridge({ gid })."},tenantApproval:{feature:"Tenant consent (platform apps)",whenToUse:"A multi-tenant platform app proving a specific tenant (store/business) consented to a cross-org connection on an active grant.",snippet:`const challenge = await np.connect.connect.initiateTenantApproval({
|
|
438
|
+
grantId,
|
|
439
|
+
tenantId: "store_42",
|
|
440
|
+
tenantDisplayName: "Acme Store",
|
|
441
|
+
redirectUri: "https://app.example.com/connect/done", // optional
|
|
442
|
+
});
|
|
443
|
+
// challenge carries the consent URL + expiry; revoke later:
|
|
444
|
+
// np.connect.connect.revokeTenantApproval({ approvalId })`,notes:"Caller must be the SUBSCRIBER org on an ACTIVE grant; an existing active approval is a CONFLICT. Read state via np.connect.connectTenantApproval.listTenantApprovals({ grantGid })."}},Cw={decisionGuide:{visibility:"public = listed + profile visible to all. listed = appears in Explore. unlisted = reachable by direct link only. private = not discoverable (default). INTERNAL-type apps can never be made discoverable \u2014 they are org-private by design.",accessVsBridge:"Access GRANT = subscribe to another org's event types (the core cross-org handshake: request -> approve). Identity BRIDGE = translate entity IDs across two orgs that name the same entity differently (needed only for cross-platform ID mapping). Most integrations need only a grant; add a bridge when the two sides use different IDs for the same customer/order.",tenantConsent:"Plain grant = org-to-org. Tenant approval = a platform app proving an individual tenant (store/business) consented \u2014 required before per-tenant events may flow on that grant."},core:["profile (connectVisibility, connectDescription, publishedEventTypes, platformSlug)","explore (search / list / get discoverable apps in other orgs)","access grants (request -> approve/reject, rate-limit, expiry, list, revoke)","identity bridges (create -> bilateral confirm, suspend, archive, list)","tenant approvals (initiate consent challenge, revoke, list)","partner governance (freeze / reinstate / delist apps on your platformSlug) \u2014 connect:admin"],notDeclarable:["the profile (managed through the np.connect.* SDK calls, not declared in connect.config.ts)","exchanges / AMQP routing across orgs"]};var No="1.0.1",Rw="https://api.npayload.com/schemas/pipes/pipe-definition.schema.json";var Ow="execution_output",Nw="execution_input",Dw={condition:["true","false"],loop:["loop-body","done"],"error-handler":["success","error"],retry:["success","exhausted"],parallel:["branch-1","branch-2","branch-3"]},jw="switch",mr="default",ng=["manual","schedule","event"],Do=[{type:"manual",requiredAnyOf:[[]],keys:["inputData"],summary:"A manual trigger needs no key is needed."},{type:"schedule",requiredAnyOf:[["cron"]],keys:["cron","timezone"],summary:'A schedule trigger needs `cron` (a cron expression such as "0 9 * * 1").'},{type:"event",requiredAnyOf:[["channel"],["eventType"]],keys:["channel","eventType"],summary:'A event trigger needs `channel` (the channel it listens on, a slug or a gid) and `eventType` (the event type it fires on, such as "order.created").'}];var Uw=["condition","switch","loop","filter","merge","setVariable","delay","transform","http","log","ai","classify","generate","extract","summarize","agent"],Lw="condition: Routes on a true/false test (handles: true, false). switch: Routes to one of its cases (handles: each case, default). loop: Runs its body for each item (handles: loop-body, done). filter: Keeps the items that pass a test. merge: Joins the outputs of several branches. setVariable: Sets a pipe variable. delay: Waits before the next step. transform: Reshapes data (config.input, config.mapping). http: Calls an HTTP endpoint (config.url, config.method). log: Writes a line to the run log (config.message). ai: An AI step (config.prompt). classify: An AI classification step (config.prompt). generate: An AI generation step (config.prompt). extract: An AI extraction step (config.prompt). summarize: An AI summary step (config.prompt). agent: An AI agent step.",zw="connector",Ia="{ actionId, params }";var Mw="npayload://pipes/authoring-flow",rg="npayload://pipes/definition-schema",Fw="pipes_author";var jo=`npayload Pipes: how to author a pipe (pipe definition schema 1.0.1, https://api.npayload.com/schemas/pipes/pipe-definition.schema.json).
|
|
445
|
+
|
|
446
|
+
Follow these steps in this order. Every fact below is generated from the pipe definition schema and its v1 connector catalogue; the schema itself is the MCP resource npayload://pipes/definition-schema.
|
|
447
|
+
|
|
448
|
+
1. Discover the connectors. Call pipes_catalog. It returns your organization's live connector catalogue: every connector, every action, and each action's inputSchema and outputSchema. The v1 catalogue: condition (evaluate); delay (wait, waitUntil); error-handler (its own settings in config, no action); events (publish, get); http (request, get, post); log (log, inspect, passthrough); loop (its own settings in config, no action); noop (passthrough); parallel (fork, join, map, race); primus-agent (execute_agent, search_memory, store_memory, list_skills, check_approval); retry (its own settings in config, no action); switch (evaluate); transform (map, filter, reduce, merge, pick, omit, parse, format, flatten, group, sort). Never write a connector id or an action id from memory.
|
|
449
|
+
|
|
450
|
+
2. Read their input schemas. For each connector step you plan, read that action's inputSchema in the pipes_catalog result. Its params go in data.config.params, typed by that inputSchema, and only there; a param value may be a template such as {{trigger.amount}}, resolved at run time.
|
|
451
|
+
|
|
452
|
+
3. Draft the definition. Call pipes_build with a spec of nodes and edges; it writes node.type, the handles and the layout for you and returns { definition, triggerConfig }.
|
|
453
|
+
- Exactly one trigger node, the entry (no edge leads into it). Its type and config become the trigger config:
|
|
454
|
+
- manual: A manual trigger needs no key is needed.
|
|
455
|
+
- schedule: A schedule trigger needs \`cron\` (a cron expression such as "0 9 * * 1").
|
|
456
|
+
- event: A event trigger needs \`channel\` (the channel it listens on, a slug or a gid) and \`eventType\` (the event type it fires on, such as "order.created").
|
|
457
|
+
- A built-in step: nodeType one of condition, switch, loop, filter, merge, setVariable, delay, transform, http, log, ai, classify, generate, extract, summarize, agent; its settings are read flat from config.
|
|
458
|
+
- A connector step: nodeType "connector", connectorId from the catalogue, config { actionId, params }, and credentials { <connectorId>: <credential gid> } when the connector signs in.
|
|
459
|
+
- A step with branches is left by a named branch: condition true|false \xB7 loop loop-body|done \xB7 error-handler success|error \xB7 retry success|exhausted \xB7 parallel branch-1|branch-2|branch-3 \xB7 switch <each case>|default. Any other step is left by execution_output.
|
|
460
|
+
|
|
461
|
+
4. Validate it. Call pipes_validate_definition with the definition and the trigger config. It applies every check the create door applies and writes nothing: { valid: true } or every reason the door would refuse.
|
|
462
|
+
|
|
463
|
+
5. Create the pipe. Call pipes_create with the same spec. The door validates again before it writes anything. Pass activate: true to publish it at once; where your organization's Pipes settings ask for a review, activation answers REVIEW_REQUIRED and a person publishes it.
|
|
464
|
+
|
|
465
|
+
6. Run it. Call pipes_run with the workflow id (the pipe must be active). It returns the execution id.
|
|
466
|
+
|
|
467
|
+
7. Inspect the run. Call pipes_get_execution with the execution id until its status is completed, failed or cancelled; each step's run carries its status, its output and its error.
|
|
468
|
+
|
|
469
|
+
8. Iterate on the reasons returned. A refused definition answers PIPE_DEFINITION_INVALID with every reason: its path, what was expected there, what was got, and didYouMean when an id is mistyped. Fix each reason at its path and go back to step 4; a failed run's step errors send you back to step 2 or 3.`,qw={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://api.npayload.com/schemas/pipes/pipe-definition.schema.json",title:"npayload pipe definition",description:"A pipe as the Pipes engine runs it: the definition (nodes and edges) and the trigger config. Each node is typed by data.nodeType, the type the engine runs; a connector node names its connector (data.connectorId), its action (data.config.actionId) and its params (data.config.params), typed by the action's input schema. A params value may be a template such as {{trigger.amount}}, resolved at run time.","x-schema-version":"1.0.1","x-generated-from":"the Pipes v1 node contract and connector catalogue (condition, delay, error-handler, events, http, log, loop, noop, parallel, primus-agent, retry, switch, transform)","x-linear-handle":"execution_output","x-target-handle":"execution_input","x-branch-handles":{condition:["true","false"],loop:["loop-body","done"],"error-handler":["success","error"],retry:["success","exhausted"],parallel:["branch-1","branch-2","branch-3"],switch:["<each case: its branch, name or id>","default"]},type:"object",required:["definition","triggerConfig"],properties:{name:{type:"string",description:"The pipe's name."},description:{type:"string"},definition:{type:"object",required:["nodes","edges"],additionalProperties:!1,properties:{nodes:{type:"array",items:{type:"object",required:["id","type","position","data"],properties:{id:{type:"string",minLength:1},type:{type:"string",description:"The canvas category the dashboard draws the node as: trigger, logic or action. The engine runs data.nodeType."},position:{type:"object",required:["x","y"],properties:{x:{type:"number"},y:{type:"number"}},description:"Where the node sits on the dashboard canvas."},data:{oneOf:[{type:"object",title:"trigger node",required:["nodeType"],properties:{nodeType:{enum:["trigger","manual","schedule","event"]},label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object"}},description:"The pipe's entry. At most one per pipe; no edge leads into it."},{type:"object",title:"built-in node",required:["nodeType"],not:{required:["connectorId"]},properties:{nodeType:{enum:["condition","switch","loop","filter","merge","setVariable","delay","transform","http","log","ai","classify","generate","extract","summarize","agent"]},label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object",description:"The node's settings, read flat from data.config (e.g. log reads config.message)."}},description:"condition: Routes on a true/false test (handles: true, false). switch: Routes to one of its cases (handles: each case, default). loop: Runs its body for each item (handles: loop-body, done). filter: Keeps the items that pass a test. merge: Joins the outputs of several branches. setVariable: Sets a pipe variable. delay: Waits before the next step. transform: Reshapes data (config.input, config.mapping). http: Calls an HTTP endpoint (config.url, config.method). log: Writes a line to the run log (config.message). ai: An AI step (config.prompt). classify: An AI classification step (config.prompt). generate: An AI generation step (config.prompt). extract: An AI extraction step (config.prompt). summarize: An AI summary step (config.prompt). agent: An AI agent step."},{type:"object",title:"connector condition",description:"Evaluate conditions and branch workflow execution",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"condition"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this condition node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["params"],additionalProperties:!1,properties:{actionId:{const:"evaluate",description:"Evaluate Condition"},params:{type:"object",properties:{condition:{oneOf:[{type:"object",properties:{field:{type:"string",description:"Field to evaluate"},operator:{type:"string",enum:["equals","notEquals","greaterThan","greaterThanOrEquals","lessThan","lessThanOrEquals","contains","notContains","startsWith","endsWith","matches","isEmpty","isNotEmpty","isNull","isNotNull","isTrue","isFalse"],description:"Comparison operator"},value:{description:"Value to compare against"}},required:["field","operator"]},{type:"object",properties:{logic:{type:"string",enum:["and","or"]},conditions:{type:"array",items:{type:"object"}}},required:["logic","conditions"]}]},data:{type:"object",description:"Data object to evaluate conditions against"}},required:["condition"]}},description:"Evaluate a condition or group of conditions"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector delay",description:"Wait for a specified duration or until a specific time",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"delay"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this delay node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId"],additionalProperties:!1,properties:{actionId:{const:"wait",description:"Wait"},params:{type:"object",properties:{duration:{type:"number",description:"Duration to wait in milliseconds",minimum:0,maximum:3e5},durationSeconds:{type:"number",description:"Duration to wait in seconds",minimum:0,maximum:300},durationMinutes:{type:"number",description:"Duration to wait in minutes",minimum:0,maximum:5}}}},description:"Wait for a specified duration"},{type:"object",required:["actionId"],additionalProperties:!1,properties:{actionId:{const:"waitUntil",description:"Wait Until"},params:{type:"object",properties:{timestamp:{type:"number",description:"Unix timestamp (milliseconds) to wait until"},datetime:{type:"string",description:"ISO 8601 datetime string to wait until",format:"date-time"},maxWait:{type:"number",description:"Maximum wait time in milliseconds (default: 300000 = 5 min)",default:3e5}}}},description:"Wait until a specific time"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector error-handler",description:"Try/catch/finally error handling for workflows",required:["nodeType","connectorId"],properties:{nodeType:{const:"connector"},connectorId:{const:"error-handler"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object",description:"The error-handler node's own settings; the engine's runner reads them itself (no action)."},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector events",description:"Read or publish npayload Events messages \u2014 the pipe's SENSE (events.get) and ACT (events.publish). Org-scoped: you can only touch your own channels and messages.",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"events"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this events node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"publish",description:"Publish to channel"},params:{type:"object",properties:{channel:{type:"string",description:`Target channel \u2014 its slug (e.g. "fulfillment") or gid. MUST belong to your org; the cell rejects any other tenant's channel.`},payload:{type:"object",description:"The message body to publish. Omit to forward the trigger event's data unchanged (republish).",additionalProperties:!0},eventType:{type:"string",description:'Optional event type label recorded on the message metadata (e.g. "order.fulfilled").'},idempotencyKey:{type:"string",description:"Optional idempotency key \u2014 a duplicate publish collapses to the first message."}},required:["channel"],additionalProperties:!1}},description:"Publish a message to one of your Events channels (by slug or gid). Fans out to subscribers and can re-trigger other pipes via event triggers \u2014 closing the autonomy loop."},{type:"object",required:["actionId"],additionalProperties:!1,properties:{actionId:{const:"get",description:"Get message"},params:{type:"object",properties:{messageGid:{type:"string",description:"The message gid to read. Defaults to the trigger event's messageGid, so an event-triggered pipe can omit it to load the event that fired it."}},additionalProperties:!1}},description:"Read an Events message by gid (the pipe's SENSE). An event-triggered pipe omits messageGid to load the very event that fired it \u2014 fan-out passes only the gid, so this is how a pipe gets the payload to ETL."}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector http",description:"Make HTTP requests to any REST API endpoint",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"http"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this http node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"request",description:"HTTP Request"},params:{type:"object",properties:{method:{type:"string",enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],description:"HTTP method",default:"GET"},url:{type:"string",description:"Request URL (must be HTTPS)",format:"uri"},headers:{type:"object",description:"Request headers",additionalProperties:{type:"string"}},queryParams:{type:"object",description:"Query parameters to append to URL",additionalProperties:{type:"string"}},body:{description:"Request body (for POST, PUT, PATCH)"},contentType:{type:"string",enum:["application/json","application/x-www-form-urlencoded","text/plain"],description:"Content type for request body",default:"application/json"},timeout:{type:"number",description:"Request timeout in milliseconds",default:3e4,minimum:1e3,maximum:6e4},followRedirects:{type:"boolean",description:"Whether to follow redirects",default:!0},validateStatus:{type:"boolean",description:"Throw error for non-2xx status codes",default:!0}},required:["url"]}},description:"Make a custom HTTP request"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"get",description:"GET Request"},params:{type:"object",properties:{url:{type:"string",description:"Request URL",format:"uri"},headers:{type:"object",description:"Request headers",additionalProperties:{type:"string"}},queryParams:{type:"object",description:"Query parameters",additionalProperties:{type:"string"}}},required:["url"]}},description:"Make a GET request"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"post",description:"POST Request"},params:{type:"object",properties:{url:{type:"string",description:"Request URL",format:"uri"},headers:{type:"object",description:"Request headers",additionalProperties:{type:"string"}},body:{type:"object",description:"Request body"}},required:["url"]}},description:"Make a POST request with JSON body"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector log",description:"Log data for debugging workflows",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"log"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this log node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"log",description:"Log Message"},params:{type:"object",properties:{message:{type:"string",description:"Log message"},level:{type:"string",enum:["debug","info","warn","error"],description:"Log level",default:"info"},data:{description:"Optional data to include in log"}},required:["message"]}},description:"Log a message with optional data"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"inspect",description:"Inspect Data"},params:{type:"object",properties:{data:{description:"Data to inspect"},label:{type:"string",description:"Optional label for the inspection"},maxDepth:{type:"number",description:"Maximum depth to inspect",default:3,minimum:1,maximum:10}},required:["data"]}},description:"Inspect and return data structure information"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"passthrough",description:"Passthrough"},params:{type:"object",properties:{data:{description:"Data to pass through"},log:{type:"boolean",description:"Whether to also log the data",default:!1}},required:["data"]}},description:"Pass data through unchanged (useful for debugging flow)"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector loop",description:"Iterate over arrays and ranges in workflows",required:["nodeType","connectorId"],properties:{nodeType:{const:"connector"},connectorId:{const:"loop"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object",description:"The loop node's own settings; the engine's runner reads them itself (no action)."},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector noop",description:"Built-in passthrough connector. Returns input as output verbatim \u2014 Pass-state equivalent.",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"noop"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this noop node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",additionalProperties:!1,properties:{actionId:{const:"passthrough",description:"Passthrough"},params:{type:"object",description:"Arbitrary JSON object. The action returns this value verbatim.",additionalProperties:!0}},description:"Return the input unchanged."}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector parallel",description:"Execute multiple branches in parallel",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"parallel"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this parallel node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"fork",description:"Fork"},params:{type:"object",properties:{branches:{type:"array",description:"Names of branches to execute in parallel",items:{type:"string"},minItems:1},maxConcurrency:{type:"number",description:"Maximum branches to run concurrently (default: unlimited)",minimum:1},timeout:{type:"number",description:"Timeout for all branches in milliseconds",minimum:0},continueOnError:{type:"boolean",description:"Continue executing other branches if one fails",default:!1}},required:["branches"]}},description:"Start parallel execution of multiple branches"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"join",description:"Join"},params:{type:"object",properties:{results:{type:"object",description:"Results from parallel branches (branch name -> result)",additionalProperties:{}},waitFor:{type:"string",enum:["all","any","first"],description:"Wait strategy: all, any success, or first to complete",default:"all"},requiredBranches:{type:"array",description:"Branches that must succeed (optional)",items:{type:"string"}}},required:["results"]}},description:"Wait for and aggregate results from parallel branches"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"map",description:"Parallel Map"},params:{type:"object",properties:{items:{type:"array",description:"Items to process in parallel",items:{}},maxConcurrency:{type:"number",description:"Maximum parallel executions",minimum:1,default:10},continueOnError:{type:"boolean",description:"Continue processing other items if one fails",default:!0}},required:["items"]}},description:"Process array items in parallel (returns items for iteration)"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"race",description:"Race"},params:{type:"object",properties:{branches:{type:"array",description:"Names of branches to execute in parallel",items:{type:"string"},minItems:1},maxConcurrency:{type:"number",description:"Maximum branches to run concurrently (default: unlimited)",minimum:1},timeout:{type:"number",description:"Timeout for all branches in milliseconds",minimum:0},continueOnError:{type:"boolean",description:"Continue executing other branches if one fails",default:!1}},required:["branches"]}},description:"Execute branches and return first result"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector primus-agent",description:"Execute npayload Primus AI agents",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"primus-agent"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this primus-agent node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"execute_agent",description:"Execute Agent"},params:{type:"object",properties:{agentId:{type:"string",description:"Primus agent ID"},goal:{type:"string",description:"What the agent should accomplish (mapped to Primus 'message' field)"},context:{type:"object",description:"Additional context \u2014 merged into Primus 'config'"},maxExecutionTime:{type:"number",description:"Max execution time in ms",default:3e4},testMode:{type:"boolean",description:"When true, sends X-Primus-Test-Mode: 1 so Primus returns an echo fixture instead of invoking the real LLM. Not for production.",default:!1}},required:["agentId","goal"]}},description:"Run a Primus agent with a goal and optional context"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"search_memory",description:"Search Memory"},params:{type:"object",properties:{agentId:{type:"string",description:"Primus agent ID"},query:{type:"string",description:"Search query"},topK:{type:"number",default:5,description:"Number of results"}},required:["agentId","query"]}},description:"Search an agent's memory using hybrid RAG. Not available yet."},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"store_memory",description:"Store Memory"},params:{type:"object",properties:{agentId:{type:"string",description:"Primus agent ID"},content:{type:"string",description:"Content to store"},type:{type:"string",enum:["episodic","semantic","procedural"],default:"semantic",description:"Memory type"},metadata:{type:"object",description:"Additional metadata"}},required:["agentId","content"]}},description:"Store content in an agent's memory. Not available yet."},{type:"object",required:["actionId"],additionalProperties:!1,properties:{actionId:{const:"list_skills",description:"List Skills"},params:{type:"object",properties:{agentId:{type:"string",description:"Primus agent ID"},category:{type:"string",description:"Filter by category"}}}},description:"List available skills for an agent. Not available yet."},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"check_approval",description:"Check Approval"},params:{type:"object",properties:{approvalId:{type:"string",description:"Approval request ID"}},required:["approvalId"]}},description:"Check the status of a pending approval request. Not available yet."}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector retry",description:"Retry operations with exponential backoff",required:["nodeType","connectorId"],properties:{nodeType:{const:"connector"},connectorId:{const:"retry"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object",description:"The retry node's own settings; the engine's runner reads them itself (no action)."},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector switch",description:"Multi-way branching based on value matching",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"switch"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this switch node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["params"],additionalProperties:!1,properties:{actionId:{const:"evaluate",description:"Evaluate Switch"},params:{type:"object",properties:{value:{description:"Value to switch on"},cases:{type:"array",description:"Case definitions",items:{type:"object",properties:{match:{description:"Value(s) to match",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array",items:{}}]},name:{type:"string",description:"Branch name for this case"},output:{description:"Optional output data for this case"}},required:["match","name"]}},default:{type:"object",description:"Default case if no match",properties:{name:{type:"string"},output:{}}},strict:{type:"boolean",description:"Use strict equality (===) for comparison",default:!0}},required:["value","cases"]}},description:"Match value against cases and determine branch"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"connector transform",description:"Data transformation and manipulation",required:["nodeType","connectorId","config"],properties:{nodeType:{const:"connector"},connectorId:{const:"transform"},label:{type:"string",description:"The name the dashboard shows on the node."},config:{description:"The action this transform node runs (data.config.actionId) and its params (data.config.params, where the engine reads them).",oneOf:[{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"map",description:"Map"},params:{type:"object",properties:{input:{description:"Input data to transform"},mapping:{type:"object",description:"Mapping of output field -> input path or expression",additionalProperties:{type:"string"}}},required:["input","mapping"]}},description:"Map/transform data using field mappings"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"filter",description:"Filter"},params:{type:"object",properties:{items:{type:"array",description:"Array to filter",items:{}},condition:{type:"object",description:"Filter condition",properties:{field:{type:"string"},operator:{type:"string"},value:{}},required:["field","operator"]}},required:["items","condition"]}},description:"Filter array items based on condition"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"reduce",description:"Reduce"},params:{type:"object",properties:{items:{type:"array",description:"Array to reduce",items:{}},operation:{type:"string",enum:["sum","count","min","max","avg","first","last","concat","unique"],description:"Reduction operation"},field:{type:"string",description:"Field to operate on (for objects)"},initialValue:{description:"Initial value for reduction"}},required:["items","operation"]}},description:"Reduce array to single value"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"merge",description:"Merge"},params:{type:"object",properties:{objects:{type:"array",description:"Objects to merge",items:{type:"object"}},strategy:{type:"string",enum:["shallow","deep","replace"],description:"Merge strategy",default:"shallow"}},required:["objects"]}},description:"Merge multiple objects into one"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"pick",description:"Pick"},params:{type:"object",properties:{input:{type:"object"},fields:{type:"array",items:{type:"string"}}},required:["input","fields"]}},description:"Pick specific fields from object"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"omit",description:"Omit"},params:{type:"object",properties:{input:{type:"object"},fields:{type:"array",items:{type:"string"}}},required:["input","fields"]}},description:"Omit specific fields from object"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"parse",description:"Parse"},params:{type:"object",properties:{input:{type:"string",description:"String to parse"},format:{type:"string",enum:["json","csv","querystring","number","boolean","date"],description:"Format to parse"},options:{type:"object",description:"Format-specific options"}},required:["input","format"]}},description:"Parse string into structured data"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"format",description:"Format"},params:{type:"object",properties:{input:{description:"Data to format"},format:{type:"string",enum:["json","csv","querystring","string","number","date"],description:"Output format"},options:{type:"object",description:"Format-specific options"}},required:["input","format"]}},description:"Format data into string"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"flatten",description:"Flatten"},params:{type:"object",properties:{input:{},depth:{type:"number",default:1},separator:{type:"string",default:"."}},required:["input"]}},description:"Flatten nested object or array"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"group",description:"Group"},params:{type:"object",properties:{items:{type:"array",items:{type:"object"}},by:{type:"string",description:"Field to group by"}},required:["items","by"]}},description:"Group array items by field"},{type:"object",required:["actionId","params"],additionalProperties:!1,properties:{actionId:{const:"sort",description:"Sort"},params:{type:"object",properties:{items:{type:"array"},by:{type:"string",description:"Field to sort by"},direction:{type:"string",enum:["asc","desc"],default:"asc"}},required:["items"]}},description:"Sort array items"}]},credentials:{type:"object",description:"The credential each connector of this node signs in with: the connector id mapped to the gid of a credential of this application (Pipes, Credentials).",additionalProperties:{type:"string",minLength:1}}}},{type:"object",title:"node typed by node.type",not:{required:["nodeType"]},properties:{label:{type:"string",description:"The name the dashboard shows on the node."},config:{type:"object"}},description:"No data.nodeType: the engine dispatches on node.type, which must then be a built-in node type."}]}},if:{properties:{data:{not:{required:["nodeType"]}}}},then:{properties:{type:{enum:["trigger","manual","schedule","event","condition","switch","loop","filter","merge","setVariable","delay","transform","http","log","ai","classify","generate","extract","summarize","agent"]}}}}},edges:{type:"array",items:{type:"object",required:["id","source","target"],additionalProperties:!1,properties:{id:{type:"string",minLength:1},source:{type:"string",description:"The id of the node the edge leaves."},target:{type:"string",description:"The id of the node the edge enters (never the trigger)."},sourceHandle:{type:"string",description:`The branch the edge leaves by: "execution_output" for a step without branches, or one of the node's branches (x-branch-handles: condition true|false, switch each case|default, loop loop-body|done, error-handler success|error, retry success|exhausted, parallel branch-1|branch-2|branch-3).`},targetHandle:{enum:["execution_input"]}}}},viewport:{type:"object",required:["x","y","zoom"],properties:{x:{type:"number"},y:{type:"number"},zoom:{type:"number"}}},maxDurationMs:{type:"integer",minimum:1,maximum:864e5,description:"The pipe's run time limit, in milliseconds. A run still going when its next step would start after this limit stops, failed with the error code TIMEOUT. From 1 to 86400000 (24 hours); 1 hour when absent."}}},triggerConfig:{description:"When the pipe runs. One of the v1 trigger types, with the config keys it needs.",oneOf:[{type:"object",title:"manual trigger",required:["type","config"],additionalProperties:!1,properties:{type:{const:"manual"},config:{type:"object",properties:{inputData:{type:"object"}},description:"A manual trigger needs no key is needed."}}},{type:"object",title:"schedule trigger",required:["type","config"],additionalProperties:!1,properties:{type:{const:"schedule"},config:{type:"object",properties:{cron:{type:"string",minLength:1},timezone:{type:"string",minLength:1}},description:'A schedule trigger needs `cron` (a cron expression such as "0 9 * * 1").',required:["cron"]}}},{type:"object",title:"event trigger",required:["type","config"],additionalProperties:!1,properties:{type:{const:"event"},config:{type:"object",properties:{channel:{type:"string",minLength:1},eventType:{type:"string",minLength:1}},description:'A event trigger needs `channel` (the channel it listens on, a slug or a gid) and `eventType` (the event type it fires on, such as "order.created").',anyOf:[{required:["channel"]},{required:["eventType"]}]}}}]}}};var KP=Ow,WP=Nw,Yt=Object.fromEntries(Object.entries(Dw).map(([e,t])=>[e,[...t]])),Qt=jw,Uo=ng,kt=zw,HP=new Set(["condition","switch","loop","filter","merge","setVariable","delay"]),Xt=Object.fromEntries([...ng.map(e=>[e,"trigger"]),...Uw.map(e=>[e,HP.has(e)?"logic":"action"])]),Zw=jo;function YP(e){return e.nodeType===kt?"action":Xt[e.nodeType]??"action"}a(YP,"backendTypeOf");function Gw(e){return e.nodeType===kt?e.connectorId??kt:e.nodeType}a(Gw,"brancherKey");function QP(e,t,r){let o=Gw(e),n=o===Qt||o in Yt;if(!t){if(n){let s=o===Qt?[...r,mr]:Yt[o];throw new Error(`Node "${e.id}" (${o}) is a brancher \u2014 connect FROM one of its branches (${s.join(", ")||"define cases first"}) via { branch }, not a linear edge.`)}return KP}if(o===Qt){let s=[...r,mr];if(!s.includes(t))throw new Error(`switch branch "${t}" is not a configured case. Allowed: ${s.join(", ")} (cases come from config.cases, or config.params.cases on a switch connector step).`);return t}if(!n)throw new Error(`Node "${e.id}" (${o}) has no branches \u2014 use a linear edge (omit "branch").`);let i=Yt[o];if(!i.includes(t))throw new Error(`Branch "${t}" is invalid for "${o}". Allowed: ${i.join(", ")}.`);return t}a(QP,"resolveSourceHandle");function XP(e,t){let r=new Map;e.forEach(d=>r.set(d,0)),t.forEach(d=>r.set(d.to,(r.get(d.to)??0)+1));let o=new Map,n=e.filter(d=>(r.get(d)??0)===0);n.length===0&&e.length&&(n=[e[0]]),n.forEach(d=>o.set(d,0));let i=new Map;t.forEach(d=>i.set(d.from,[...i.get(d.from)??[],d.to]));let s=[...n],c=0;for(;s.length&&c++<1e4;){let d=s.shift(),m=o.get(d)??0;for(let p of i.get(d)??[]){let f=Math.max(o.get(p)??0,m+1);o.get(p)!==f&&(o.set(p,f),s.push(p))}}e.forEach(d=>{o.has(d)||o.set(d,0)});let u=new Map;e.forEach(d=>{let m=o.get(d);u.set(m,[...u.get(m)??[],d])});let l={};for(let[d,m]of u)m.forEach((p,f)=>{l[p]={x:80+d*320,y:120+f*180}});return l}a(XP,"layout");function og(e){if(!e?.nodes?.length)throw new Error("A pipe needs at least one node.");let t=new Set;for(let u of e.nodes){if(!u.id)throw new Error("Every node needs an id.");if(!u.nodeType)throw new Error(`Node "${u.id}" needs a nodeType (a built-in like "condition"/"log", or "connector" with a connectorId \u2014 see pipes_catalog).`);if(u.nodeType===kt&&!u.connectorId)throw new Error(`Node "${u.id}" has nodeType "connector" but no connectorId \u2014 set connectorId to a connector from pipes_catalog (e.g. "events").`);if(u.nodeType!==kt&&u.connectorId)throw new Error(`Node "${u.id}" sets connectorId "${u.connectorId}" but nodeType is "${u.nodeType}" \u2014 a connector node MUST use nodeType "connector". For a built-in node, drop connectorId.`);if(u.nodeType!==kt&&!(u.nodeType in Xt))throw new Error(`Node "${u.id}" has nodeType "${u.nodeType}", which is not authorable in v1. Use a built-in (${Object.keys(Xt).join(", ")}) or nodeType "connector" with a connectorId from pipes_catalog.`);if(t.has(u.id))throw new Error(`Duplicate node id "${u.id}".`);t.add(u.id)}let r=e.edges??[];for(let u of r){if(!t.has(u.from))throw new Error(`Edge.from "${u.from}" is not a node id.`);if(!t.has(u.to))throw new Error(`Edge.to "${u.to}" is not a node id.`)}let o=XP(e.nodes.map(u=>u.id),r),n=new Map(e.nodes.map(u=>[u.id,u])),i=new Map;for(let u of e.nodes)Gw(u)===Qt&&i.set(u.id,tE(u));let s=e.nodes.map(u=>({id:u.id,type:YP(u),position:o[u.id]??{x:80,y:120},data:{nodeType:u.nodeType,label:u.label??u.id,config:u.config??{},...u.connectorId?{connectorId:u.connectorId}:{},...u.credentials&&Object.keys(u.credentials).length?{credentials:u.credentials}:{}}})),c=r.map(u=>{let l=n.get(u.from),d=QP(l,u.branch,i.get(u.from)??[]);return{id:`edge-${u.from}-${u.to}-${d}`,source:u.from,target:u.to,sourceHandle:d,targetHandle:WP}});return{nodes:s,edges:c}}a(og,"buildPipeDefinition");function eE(e){return e.nodes.find(t=>Uo.includes(t.nodeType))}a(eE,"triggerNodeOf");function ig(e,t){let r=eE(e);return r?{type:r.nodeType,config:r.config??{}}:{type:t?.type??"manual",config:t?.config??{}}}a(ig,"triggerConfigOf");function tE(e){let t=e.config??{},r=t.params&&typeof t.params=="object"?t.params:{},o=Array.isArray(r.cases)?r.cases:Array.isArray(t.cases)?t.cases:[],n=[];for(let i of o){if(!i||typeof i!="object")continue;let s=i,c=[s.branch,s.name,s.id].find(u=>typeof u=="string"&&u.length>0);c&&n.push(c)}return n}a(tE,"switchCaseNames");function Vw(e){let t=new Map;for(let r of e){let o=String(r.id??r.connectorId??r._id??"");if(!o)continue;let n=new Map;for(let s of r.actions??[]){let c=String(s.id??s.actionId??"");c&&n.set(c,{actionId:c,inputSchema:s.inputSchema??void 0})}let i=r.auth?.type;t.set(o,{actions:n,needsCredential:!!i&&i!=="none"})}return{connectors:t}}a(Vw,"indexConnectorCatalog");function nE(e,t){let r=e.length,o=t.length;if(Math.abs(r-o)>3)return 99;let n=Array.from({length:r+1},(i,s)=>[s,...new Array(o).fill(0)]);for(let i=0;i<=o;i++)n[0][i]=i;for(let i=1;i<=r;i++)for(let s=1;s<=o;s++)n[i][s]=Math.min(n[i-1][s]+1,n[i][s-1]+1,n[i-1][s-1]+(e[i-1]===t[s-1]?0:1));return n[r][o]}a(nE,"editDistance");function Pa(e,t){let r=e.toLowerCase();return t.map(n=>{let i=n.toLowerCase(),s=i.includes(r)||r.includes(i)?0:nE(r,i);return{c:n,score:s}}).filter(n=>n.score<=3).sort((n,i)=>n.score-i.score).slice(0,3).map(n=>n.c)}a(Pa,"suggestIds");function sg(e,t,r){let o=[],n=[],i=Object.keys(Xt);for(let[u,l]of(e.nodes??[]).entries())if(l.nodeType===kt){let d=l.config??{},m=Object.keys(d).filter(g=>g!=="actionId"&&g!=="params");if(("actionId"in d||"params"in d||(t?.connectors.get(l.connectorId??"")?.actions.size??0)>0)&&m.length&&o.push(`Node "${l.id}" (connector "${l.connectorId}"): its params go under config.params (definition.nodes[${u}].data.config.params, where the engine reads them), but ${m.map(g=>`"${g}"`).join(", ")} sit flat in config. Write config ${Ia}: { actionId: "${String(d.actionId??"<action>")}", params: { ${m.join(", ")} } }.`),!t)continue;let f=l.connectorId?t.connectors.get(l.connectorId):void 0;if(!f){let g=[...t.connectors.keys()],v=l.connectorId?Pa(l.connectorId,g):[];o.push(`Node "${l.id}": connector "${l.connectorId}" does NOT exist in this deployment`+(v.length?` \u2014 did you mean ${v.map(h=>`"${h}"`).join(" / ")}?`:"")+` Call pipes_catalog for the ${g.length} available connectors; never guess a connectorId.`);continue}if(f.actions.size>0){let g=l.config?.actionId;if(!g)o.push(`Node "${l.id}" (connector "${l.connectorId}"): config.actionId is required (definition.nodes[${u}].data.config.actionId) \u2014 one of: ${[...f.actions.keys()].join(", ")}.`);else if(f.actions.has(g)){if(r){let v=f.actions.get(g).inputSchema;if(v&&typeof v=="object"){let h=d.params??{},x=r(v,h);for(let E of x)o.push(`Node "${l.id}" (${l.connectorId}.${g}): params ${E} (definition.nodes[${u}].data.config.params) \u2014 the schema is in pipes_catalog under this action's inputSchema.`)}}}else{let v=Pa(g,[...f.actions.keys()]);o.push(`Node "${l.id}": action "${g}" does not exist on connector "${l.connectorId}"`+(v.length?` \u2014 did you mean ${v.map(h=>`"${h}"`).join(" / ")}?`:"")+` Valid actions: ${[...f.actions.keys()].join(", ")}.`)}}f.needsCredential&&n.push(`Node "${l.id}" (connector "${l.connectorId}") requires a CREDENTIAL \u2014 configure one for this connector (dashboard \u2192 Pipes \u2192 Credentials) or the node fails at run time with an auth error.`)}else if(!i.includes(l.nodeType)){let d=Pa(l.nodeType,i),m=t?Pa(l.nodeType,[...t.connectors.keys()]):[];o.push(`Node "${l.id}": "${l.nodeType}" is not a built-in node type`+(d.length?` \u2014 did you mean ${d.map(p=>`"${p}"`).join(" / ")}?`:"")+(m.length?` If you meant the "${m[0]}" integration, use nodeType "connector" with connectorId "${m[0]}".`:' For an integration, use nodeType "connector" + a connectorId from pipes_catalog.')+` Built-ins: ${i.join(", ")}.`)}let s=(e.nodes??[]).filter(u=>Uo.includes(u.nodeType)),c=e.edges??[];if(s.length===0)n.push("No trigger node \u2014 the workflow gets triggerType 'manual' by default. Add ONE trigger node (manual|schedule|event) as the entry for an explicit trigger.");else if(s.length>1)o.push(`${s.length} trigger nodes (${s.map(u=>`"${u.id}"`).join(", ")}) \u2014 a workflow has exactly ONE trigger. Keep one; downstream steps hang off it.`);else{let u=s[0];if(c.some(l=>l.to===u.id)&&o.push(`Trigger node "${u.id}" has an INCOMING edge \u2014 the trigger is the entry; nothing routes into it.`),e.nodes.length>1){let l=new Set([u.id]),d=!0;for(;d;){d=!1;for(let p of c)l.has(p.from)&&!l.has(p.to)&&(l.add(p.to),d=!0)}let m=e.nodes.filter(p=>!l.has(p.id));m.length&&o.push(`Node(s) ${m.map(p=>`"${p.id}"`).join(", ")} are not reachable from the trigger "${u.id}" \u2014 they will never execute and render disconnected. Wire them with edges (or remove them).`)}}return{ok:o.length===0,issues:o,warnings:n}}a(sg,"validateSpecAgainstCatalog");function Ea(e){return e.key.split(".")[0]??"other"}a(Ea,"productOf");var ag=[];function Bw(e){let t=new Set(we.commands.map(o=>o.key)),r=new Set;ag=e.filter(o=>t.has(o.key)||r.has(o.key)?!1:(r.add(o.key),!0))}a(Bw,"setCatalogExtraRows");function Ta(){return ag.length===0?[...we.commands]:[...we.commands,...ag]}a(Ta,"catalogRows");function rE(e){return{key:e.key,method:e.method,path:e.pattern,summary:e.summary,isQuery:e.isQuery,idempotent:e.idempotent,scopes:e.scopes,pathParams:e.pathParams.map(t=>({name:t.name,segment:t.key})),args:e.flags.map(t=>({name:t.name,type:t.coerce??"string",required:!t.optional}))}}a(rE,"toCatalogOp");var oE=["events.appDpopKeys.","keys.appDpopKeys."],iE=["credentials.connectors.","pipes.connectors.","pipes.connectorCredentials."],sE=new Set(["events.adapters.createAdapter","events.subscriptions.create","events.subscriptions.revealSecret","events.subscriptions.rotateSecret","events.subscriptions.subscribe","events.subscriptions.update","events.systemEvents.rotateSecret","events.systemEvents.subscribe","events.systemEvents.unsubscribe","webhooks.webhooks.create","webhooks.webhooks.revealSecret","webhooks.webhooks.revoke","webhooks.webhooks.rotateSecret","pipes.webhooks.rotateWebhookSecret","pipes.workflows.updateWorkflow","pipes.governance.revokeConnectorApproval","primus.brainConfig.storeProviderKey","primus.brainConfig.deleteConfig","primus.brainConfig.configure","primus.integrations.connect","primus.integrations.disconnect","primus.integrations.refresh","primus.mcpConnect.beginConnect","primus.mcpConnect.revokeConnection","primus.mcpOauth.beginOauth","primus.mcpOauth.setPreregisteredClient","primus.mcpServers.connect","primus.mcpServers.rotateAuth","primus.mcpServers.test","primus.tenants.suspend","primus.tenants.archive","primus.tools.create","primus.tools.update","primus.tools.importFromOpenApi","primus.triggers.create","primus.triggers.rotateSecret","primus.webhooks.create","primus.configPromotion.applyConfigBundle","billing.connectAccounts.createAccountSession","billing.feedListings.subscribeToListing","billing.feedListings.subscribeToListingWithSavedCard","billing.subscriptions.confirmSubscriptionPayment","billing.subscriptions.createSetupIntent","billing.subscriptions.createSubscription","embed.sessions.create","embed.sessions.revoke","tenants.actAs.actAs","tenants.tenants.close","tenants.tenants.suspend","account.environments.clone","connect.connect.revokeGrant","connect.connect.revokeTenantApproval","connect.publishGrants.revoke","feed.publishers.revokePublisher","connect.connect.partnerOverrideTenantApproval","connect.identityBridges.archiveBridge","connect.connect.partnerDelistApp"]);function aE(e){return e.isQuery?!1:sE.has(e.key)||iE.some(t=>e.key.startsWith(t))}a(aE,"requiresConfirmation");function cg(e){return oE.some(t=>e.startsWith(t))}a(cg,"catalogDenied");function Jw(e){let t=e?.trim().toLowerCase()||void 0,r=new Map;for(let n of Ta()){if(cg(n.key))continue;let i=Ea(n);if(t&&i!==t)continue;r.has(i)||r.set(i,[]);let s=rE(n);aE(n)&&(s.summary=`${s.summary} [CREDENTIAL OP \u2014 always confirm with the user before invoking]`),r.get(i).push(s)}let o=[...r.entries()].map(([n,i])=>({product:n,ops:i.sort((s,c)=>s.key.localeCompare(c.key))})).sort((n,i)=>n.product.localeCompare(i.product));return{contentHash:we.contentHash,generatedAt:we.generatedAt,products:o,totalOps:o.reduce((n,i)=>n+i.ops.length,0)}}a(Jw,"buildCatalog");function Aa(){return[...new Set(Ta().filter(e=>!cg(e.key)).map(e=>Ea(e)))].sort()}a(Aa,"listProducts");function Kw(e){return Ta().find(t=>t.key===e)}a(Kw,"findOp");var Sn=class extends Error{static{a(this,"UnknownOpError")}suggestions;constructor(t,r){super(`unknown op key "${t}". Call npayload_catalog to discover valid keys`+(r.length?`. Did you mean: ${r.join(", ")}?`:".")),this.name="UnknownOpError",this.suggestions=r}};function Ww(e,t=5){let r=e.split(".");return Ta().map(o=>{let n=o.key.split("."),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return{key:o.key,shared:i}}).filter(o=>o.shared>0).sort((o,n)=>n.shared-o.shared||o.key.localeCompare(n.key)).slice(0,t).map(o=>o.key)}a(Ww,"suggestKeys");function _t(e){let t=Kw(e);if(!t)throw new Sn(e,Ww(e));return{method:t.method==="HEAD"?"GET":t.method,path:mh(t.pattern)}}a(_t,"contractRouteFor");async function Hw(e,t,r){if(cg(e))throw new Sn(e,[]);let o=Kw(e);if(!o)throw new Sn(e,Ww(e));let n={...t??{}},i=[];for(let u of o.pathParams){let l=n[u.name];if(delete n[u.name],(l==null||l==="")&&u.name==="appId"){let d=await r.resolveAppId();if(!d)throw new Y(`${e} needs a path param "${u.name}" and it could not be resolved from the token \u2014 pass { "${u.name}": "app_\u2026" }.`);l=d}if(l==null||l==="")throw new Y(`${e} requires path param "${u.name}" (URL segment :${u.key}).`);i.push(typeof l=="object"?JSON.stringify(l):String(l))}let s={};for(let[u,l]of Object.entries(n))if(l!=null){if(u==="idempotencyKey"||u==="idempotency-key"){s["idempotency-key"]=String(l);continue}s[u]=typeof l=="object"?JSON.stringify(l):String(l)}let c=ut({row:o,positionals:i,flags:s,newIdempotencyKey:r.newIdempotencyKey});return{row:o,request:c}}a(Hw,"composeInvoke");async function Qw(e,t){if(t)return t;let{token:r}=await e.auth.getAccessToken([]),o=JSON.parse(Buffer.from(r.split(".")[1]??"","base64url").toString("utf8"));return o["npayload/appId"]??o.appId??o.app}a(Qw,"resolveAppIdFromToken");var pE=`npayload Events config-as-code. Write a npayload/events.config.ts that default-exports
|
|
470
|
+
defineEventsConfig({...}). Resources are keyed by their natural identity (the map key):
|
|
471
|
+
|
|
472
|
+
- channels: keyed by slug (lowercase, a-z 0-9 and hyphens). Choose "type":
|
|
473
|
+
"topic" \u2014 fan-out to all subscribers (notifications, broadcasts).
|
|
474
|
+
"queue" \u2014 work distributed across consumers, each message handled once (jobs).
|
|
475
|
+
"stream" \u2014 ordered, replayable log (event sourcing, analytics).
|
|
476
|
+
- eventTypes (catalogue): keyed by event name, conventionally "domain.entity.action"
|
|
477
|
+
(e.g. "commerce.order.created"). Declares ownership + meaning; one per meaningful event.
|
|
478
|
+
The optional "channels" array binds the type to channels BY SLUG (resolved at push).
|
|
479
|
+
- subscriptions: keyed by name. type "webhook" with endpoint.url (https; the URL must be
|
|
480
|
+
publicly reachable). Reference its channel via the "channelGid" field \u2014 the field
|
|
481
|
+
TAKES THE CHANNEL'S SLUG from your config (it is resolved to the id at push);
|
|
482
|
+
never invent ids.
|
|
483
|
+
|
|
484
|
+
Loop: write events.config.ts, then call events_validate (pass the config object, or
|
|
485
|
+
omit it to validate the file you wrote on disk; fix any issues it returns), then
|
|
486
|
+
events_deploy (use check:true first to preview). Then the app publishes with
|
|
487
|
+
np.events.publish("<channel-slug>", payload). Payload typing is the developer's:
|
|
488
|
+
the agent generates the payload shape from the app's schema. NPP transport, signing
|
|
489
|
+
keys, and credentials are handled automatically \u2014 never put them in the config.`,mE=`npayload Connect = cross-org event sharing. An app in one org consumes the event
|
|
490
|
+
types published by an app in ANOTHER org, gated by an explicit access grant.
|
|
491
|
+
|
|
492
|
+
Core flow (subscriber S in org A wants publisher P's events in org B):
|
|
493
|
+
1. P makes itself discoverable + declares what it offers:
|
|
494
|
+
np.connect.connect.updateAppProfile({ appId, connectVisibility, publishedEventTypes }).
|
|
495
|
+
2. S finds P: np.connect.connectExplore.searchExploreApps({ query }).
|
|
496
|
+
3. S requests access: np.connect.connect.requestAccess({ subscriberAppId, publisherAppId, eventTypes }).
|
|
497
|
+
4. P approves: np.connect.connect.approveAccess({ grantId }) \u2014 now P's matching events fan out to S.
|
|
498
|
+
|
|
499
|
+
Add an Identity Bridge ONLY when the two orgs use different ids for the same entity
|
|
500
|
+
(np.connect.connect.createBridge -> the other side confirmBridge). For multi-tenant
|
|
501
|
+
platform apps, prove per-tenant consent with np.connect.connect.initiateTenantApproval
|
|
502
|
+
before per-tenant events flow.
|
|
503
|
+
|
|
504
|
+
Both apps MUST be CONNECT-type \u2014 INTERNAL apps are org-private and refused. The ONLY resource
|
|
505
|
+
you declare in connect.config.ts is identity BRIDGES \u2014 declare them and run connect_deploy
|
|
506
|
+
(reconciled against ADMIN, the source of truth \u2014 admin syncs to cells). Everything else (profile,
|
|
507
|
+
access grants, tenant approvals) is managed through the np.connect.* SDK calls above \u2014 use
|
|
508
|
+
connect_usage for copy-ready snippets. The cross-org HANDSHAKE stays imperative regardless: a
|
|
509
|
+
bridge/grant you declare is an OFFER (pending) until the other org confirms in ITS own config \u2014
|
|
510
|
+
declarative intent, never auto-consent.`;function en(){return zi()}a(en,"allowInternalUrls");function N(e){return{content:[{type:"text",text:typeof e=="string"?e:JSON.stringify(e,null,2)}]}}a(N,"text");function ce(e,t={}){let r=e?.code;return{...N({ok:!1,...typeof r=="string"?{code:r}:{},type:e instanceof Error?e.name:typeof e,error:e instanceof Error?e.message:String(e),...t}),isError:!0}}a(ce,"toolFailure");function Xw(e){let t=e,r=t?.details?.errors;if(!(!t||!Array.isArray(r))&&!(t.code!=="PIPE_DEFINITION_INVALID"&&t.status!==400))return{ok:!1,code:typeof t.code=="string"?t.code:"PIPE_DEFINITION_INVALID",message:typeof t.message=="string"?t.message:"The pipe definition is not valid.",errors:r,schemaVersion:No,retry:!0,next:"Fix each reason at its path, then call pipes_validate_definition (or pipes_create) again.",...typeof t.requestId=="string"?{requestId:t.requestId}:{}}}a(Xw,"pipeDefinitionRefusal");function ug(){for(let e of["connect.config.ts","connect.config.mjs","connect.config.js","npayload/connect.config.ts","npayload/connect.config.mjs","npayload/connect.config.js"]){let t=Yw(process.cwd(),e);if(ex(t))return t}return Yw(process.cwd(),"connect.config.ts")}a(ug,"findConnectConfig");function fE(){let e=new lE({name:"npayload",version:an()});e.tool("npayload_overview","Call this FIRST, before anything else. Returns the complete deterministic map for working on this npayload project: current project state (config found, credential source, generated artifacts), the exact ordered end-to-end workflow (each step names the MCP tool AND the CLI command), and the hard rules. Follow it step by step \u2014 never guess, never reverse-engineer.",async()=>{let p=null;try{p=We()}catch{p=null}let f=a(v=>ex(cE(process.cwd(),v)),"gen"),g=null;try{let{resolveCredentials:v}=await import("../chunk-5SMWYS7Z.mjs");g=(await v()).source}catch{g=null}return N({version:an(),state:{eventsConfig:p,credentialSource:g,generated:{contractLock:f("npayload/_generated/contract.lock"),typedEventPayloads:f("npayload/_generated/events.d.ts"),permissions:f("npayload/permissions.generated.ts")},note:g===null?"No credential source \u2014 run `npx @npayload/sdk init` in this project (or `npayload doctor` for diagnosis) before any deploy/status call.":"Credentials resolve automatically; never read or edit .env / .npayload.json."},...yy()})}),e.tool("events_contract","Return the npayload Events config schema (JSON Schema) + the capability catalog + decision guide + guidance. Call this BEFORE writing or editing events.config.ts \u2014 the schema returned here is the only valid source of config fields (after npayload_overview).",async()=>N({version:Sr,guidance:pE,capabilities:Iw,schema:Cn})),e.tool("events_usage","Return server-side, copy-ready RUNTIME recipes for using Events from app code (publish variants, queue/outbox consume, streams, KV, webhook verification, catalogue, exchanges, consumer groups, DLQ, snapshots, privacy, NPP). Call this when writing the app code (not just the topology). Optionally pass a feature key to get one recipe.",{feature:S.string().optional().describe('a recipe key (e.g. "queueConsume", "webhookVerify"); omit to get all recipes')},async({feature:p})=>p&&Ro[p]?N(Ro[p]):N(p?{error:`unknown feature "${p}"`,available:Object.keys(Ro)}:{version:Sr,recipes:Ro})),e.tool("events_validate","Validate an Events config against the contract (structure + security). Pass the config object, OR omit it to validate the project's events.config.ts on disk. Returns { ok, issues } with precise, fixable problems.",{config:S.union([S.record(S.string(),S.unknown()),S.string()]).optional().describe("the EventsConfig object (or a JSON string) to validate; omit to validate events.config.ts on disk"),configPath:S.string().optional().describe("path to events.config.ts (used when `config` is omitted)")},async({config:p,configPath:f})=>{let g=p;if(typeof g=="string")try{g=JSON.parse(g)}catch{}g==null&&(g=await le(f??We()));let v=Jr(g,{allowInternalUrls:en()});return{...N(v),isError:!v.ok}}),e.tool("events_deploy","Reconcile the project's events.config.ts to your deployment (idempotent). Validates first; pass check:true for a dry-run plan. Mutating: confirm before applying.",{check:S.boolean().optional().describe("dry run: print the plan, apply nothing"),configPath:S.string().optional().describe("path to events.config.ts (default: ./events.config.ts or ./npayload/events.config.ts)")},async({check:p,configPath:f})=>{let g=f??We(),v=await le(g),h=Jr(v,{allowInternalUrls:en()});if(!h.ok)return{...N({error:"config invalid \u2014 fix before deploy",issues:h.issues}),isError:!0};try{let x=await xe({config:g,check:p??!1,sink:a(()=>{},"sink")});return N(x.output)}catch(x){return ce(x)}}),e.tool("events_status","Show the current sync state between events.config.ts and your deployment (a dry-run plan: what exists, what would change).",{configPath:S.string().optional()},async({configPath:p})=>{let f=p??We();try{let g=await xe({config:f,check:!0,sink:a(()=>{},"sink")});return N(g.output)}catch(g){return ce(g)}}),e.tool("connect_contract","Return what npayload Connect can do (cross-org event sharing): the connect.config.ts schema (JSON Schema) + the capability catalog + decision guide + guidance. Call FIRST to learn how to write connect.config.ts and drive the np.connect.* SDK.",async()=>N({version:ru,guidance:mE,capabilities:Cw,schema:Ui})),e.tool("pipes_contract","Return the npayload Pipes config schema (JSON Schema) + the capability catalog + decision guide + guidance. Call this BEFORE writing or editing pipes.config.ts \u2014 the schema returned here is the only valid source of config fields.",async()=>N({version:pv,guidance:Pw,capabilities:Ew,schema:Li})),e.tool("connect_usage","Return server-side, copy-ready RUNTIME recipes for driving Connect from app code (set profile, explore, request/approve access grants, identity bridges, tenant approvals). Call this when writing the cross-org integration. Optionally pass a feature key to get one recipe.",{feature:S.string().optional().describe('a recipe key (e.g. "requestAccess", "createBridge"); omit to get all recipes')},async({feature:p})=>p&&Oo[p]?N(Oo[p]):N(p?{error:`unknown feature "${p}"`,available:Object.keys(Oo)}:{version:ru,recipes:Oo})),e.tool("connect_validate","Validate a connect.config.ts against the contract (structure + security). Pass the config object, OR omit it to validate the project's connect.config.ts on disk. Returns { ok, issues } with precise, fixable problems.",{config:S.union([S.record(S.string(),S.unknown()),S.string()]).optional().describe("the ConnectConfig object (or a JSON string) to validate; omit to validate connect.config.ts on disk"),configPath:S.string().optional().describe("path to connect.config.ts (used when `config` is omitted)")},async({config:p,configPath:f})=>{let g=p;if(typeof g=="string")try{g=JSON.parse(g)}catch{}g==null&&(g=await le(f??ug()));let v=ou(g,{allowInternalUrls:en()});return{...N(v),isError:!v.ok}}),e.tool("pipes_validate","Validate a Pipes config against the contract (structure + security). Pass the config object, OR omit it to validate the project's pipes.config.ts on disk. Returns { ok, issues } with precise, fixable problems.",{config:S.union([S.record(S.string(),S.unknown()),S.string()]).optional().describe("the PipesConfig object (or a JSON string) to validate; omit to validate pipes.config.ts on disk"),configPath:S.string().optional().describe("path to pipes.config.ts (used when `config` is omitted)")},async({config:p,configPath:f})=>{let g=p;if(typeof g=="string")try{g=JSON.parse(g)}catch{}if(g==null){let h=f??Ke("pipes");if(!h)return{...N({ok:!1,error:"no pipes.config.ts found \u2014 write npayload/pipes.config.ts first (see pipes_contract)"}),isError:!0};g=await le(h)}let v=Kr(g,{allowInternalUrls:en()});return{...N(v),isError:!v.ok}}),e.tool("pipes_deploy","Reconcile the project's pipes.config.ts to your deployment (idempotent, keyed by name). Validates first; pass check:true for a dry-run plan. Mutating: confirm before applying. Governance is admin-gated \u2014 a machine credential gets a clear 'needs admin' note, not a failure.",{check:S.boolean().optional().describe("dry run: print the plan, apply nothing"),configPath:S.string().optional().describe("path to pipes.config.ts (default: ./npayload/pipes.config.ts)")},async({check:p,configPath:f})=>{let g=f??Ke("pipes");if(!g)return{...N({ok:!1,error:"no pipes.config.ts found \u2014 write npayload/pipes.config.ts first (see pipes_contract)"}),isError:!0};let v=await le(g),h=Kr(v,{allowInternalUrls:en()});if(!h.ok)return{...N({error:"config invalid \u2014 fix before deploy",issues:h.issues}),isError:!0};try{let x=await xe({config:g,check:p??!1,sink:a(()=>{},"sink")});return N(x.output)}catch(x){return ce(x)}}),e.tool("pipes_status","Show the current sync state between pipes.config.ts and your deployment (a dry-run plan: what exists, what would change).",{configPath:S.string().optional()},async({configPath:p})=>{let f=p??Ke("pipes");if(!f)return{...N({ok:!1,error:"no pipes.config.ts found"}),isError:!0};try{let g=await xe({config:f,check:!0,sink:a(()=>{},"sink")});return N(g.output)}catch(g){return ce(g)}});let t=a(async p=>{let{buildKernel:f}=await import("../chunk-2PCG57PX.mjs"),g=await f(),v=await Qw(g,p);if(!v)throw new Error("could not resolve appId from token; pass appId (app_\u2026)");return{kernel:g,appId:v}},"kernelAndApp"),r=a(p=>{let f=p;return f?.gid??f?.workflowGid??f?.data?.gid},"wfId"),o=6e4,n=new Map,i=a(async(p,f)=>{let g=n.get(f);if(g&&Date.now()-g.at<o)return g;let v=await p.send(_t("pipes.workflows.listConnectors")),h=v?.data??v??[],x={at:Date.now(),rows:h,index:Vw(h)};return n.set(f,x),x},"fetchConnectorCatalog"),s=a((p,f)=>{try{let v=new uE({allErrors:!0,strict:!1}).compile(p);return v(f)?[]:(v.errors??[]).map(h=>`${h.instancePath||"(root)"} ${h.message??"invalid"}${h.params?` ${JSON.stringify(h.params)}`:""}`)}catch{return[]}},"ajvValidator"),c=a(async(p,f)=>{try{let{kernel:g,appId:v}=await t(f),{index:h}=await i(g,v);return{...sg(p,h,s),catalogReachable:!0}}catch(g){F(g);let v=sg(p,void 0);return{...v,warnings:[...v.warnings,"deployment unreachable \u2014 connector ids, actionIds, and params were NOT verified against the live catalog; pipes_create will verify them"],catalogReachable:!1}}},"validateAgainstLive");e.tool("pipes_catalog","Return the Pipes authoring guide + the LIVE connector catalog from your deployment: every connector, every action, and each action's FULL JSON-Schema (all params, types, enums, required) \u2014 plus the branch-handle map and the valid trigger types. Call FIRST so you author with the real, current params (no guessing).",{appId:S.string().optional().describe("app GID (app_\u2026); defaults to the token's app claim")},async({appId:p})=>{try{let{kernel:f,appId:g}=await t(p),{rows:v}=await i(f,g);return N({guidance:Zw,definitionSchema:{id:Rw,version:No,resource:rg},triggerTypes:Uo,triggers:Do,branchHandles:Yt,builtinNodeTypes:Object.entries(Xt).map(([h,x])=>({nodeType:h,backendType:x,isBrancher:h===Qt||h in Yt})),connectors:v.map(h=>({connectorId:h.id??h.connectorId??h._id,category:h.category,description:h.description,tier:h.tier,needsCredential:h.auth?.type&&h.auth.type!=="none",branchHandles:Yt[h.id??h.connectorId]??((h.id??h.connectorId)===Qt?["<case name>",mr]:void 0),actions:(h.actions??[]).map(x=>({actionId:x.id,name:x.name,description:x.description,inputSchema:x.inputSchema,outputSchema:x.outputSchema}))}))})}catch(f){return ce(f)}});let u=Do.map(p=>p.type).join("|"),l=[...Object.entries(Yt).map(([p,f])=>`${p} ${f.join("/")}`),`${Qt} <case>/${mr}`].join(", "),d=S.object({id:S.string().describe("unique node id"),nodeType:S.string().describe(`the type the engine runs (data.nodeType): a trigger (${u}), a built-in (${Object.keys(Xt).filter(p=>Xt[p]!=="trigger").join("|")}), or "${kt}" for a catalogue connector (then set connectorId from pipes_catalog; it is checked against the live catalogue). Built-ins: ${Lw}`),connectorId:S.string().optional().describe(`REQUIRED when nodeType is "${kt}": the connector id from pipes_catalog`),config:S.record(S.string(),S.unknown()).optional().describe(`data.config. A trigger: its trigger config keys (${Do.map(p=>`${p.type}: ${p.summary}`).join(" ")}). A built-in: its settings, flat. A connector step: ${Ia} \u2014 the action id from pipes_catalog and its params, typed by that action's inputSchema, under params (data.config.params, the only place the engine reads them).`),credentials:S.record(S.string(),S.string()).optional().describe("a connector step's credentials: { <connectorId>: <credential gid> } (data.credentials)"),label:S.string().optional()}),m=S.object({from:S.string(),to:S.string(),branch:S.string().optional().describe(`the branch a brancher is left by (${l}); omit for a step without branches`)});return e.tool("pipes_build","Compile a HIGH-LEVEL pipe spec into a CORRECT workflow definition (connector-schema nodes + explicit edge handles + branch resolution + auto-layout) AND validate it against the LIVE deployment catalog: every connectorId must exist, every actionId must be one of that connector's actions, and connector params are checked against the action's real inputSchema \u2014 so a guessed name fails HERE with a did-you-mean, not at run time. NEVER hand-write node/edge JSON \u2014 use this. Returns { definition, warnings }.",{nodes:S.array(d).describe("the steps"),edges:S.array(m).optional().describe("how steps connect"),appId:S.string().optional().describe("app GID (app_\u2026); defaults to the token's app claim \u2014 used to fetch the live connector catalog for validation")},async({appId:p,...f})=>{try{let g=og(f),v=await c(f,p);if(!v.ok)return{...N({ok:!1,stage:"catalog-validation",issues:v.issues,warnings:v.warnings}),isError:!0};let h=ig(f);return N({ok:!0,definition:g,triggerConfig:h,...v.warnings.length?{warnings:v.warnings}:{}})}catch(g){return ce(g)}}),e.tool("pipes_create",`Create a pipe in your deployment from a high-level spec (the same spec as pipes_build) and optionally activate it. Mutating; confirm first. Include exactly ONE trigger node (nodeType ${u}) as the ENTRY node (no incoming edge) wired to the first step; the trigger config is derived from it (or omit the trigger node and pass triggerType + triggerConfig). The door validates the whole definition before it writes anything; a refusal returns PIPE_DEFINITION_INVALID with every reason (path, expected, got) and retry: true.`,{name:S.string(),description:S.string().optional(),nodes:S.array(d),edges:S.array(m).optional(),triggerType:S.enum(Uo).optional().describe("the single workflow trigger (default manual)"),triggerConfig:S.record(S.string(),S.unknown()).optional().describe(`the trigger's config when the spec has no trigger node (${Do.map(p=>`${p.type}: ${p.summary}`).join(" ")})`),activate:S.boolean().optional(),appId:S.string().optional()},async p=>{try{let f;try{f=og({nodes:p.nodes,edges:p.edges})}catch(k){return ce(k,{stage:"build"})}let g=await c({nodes:p.nodes,edges:p.edges},p.appId);if(!g.catalogReachable)return{...N({ok:!1,stage:"catalog-validation",error:"could not fetch the connector catalog from your deployment \u2014 pipes_create refuses to create unverified workflows",warnings:g.warnings}),isError:!0};if(!g.ok)return{...N({ok:!1,stage:"catalog-validation",issues:g.issues,warnings:g.warnings}),isError:!0};let v=ig({nodes:p.nodes,edges:p.edges},{type:p.triggerType,config:p.triggerConfig}),{kernel:h}=await t(p.appId),x;try{x=await h.send({..._t("pipes.workflows.createWorkflow"),body:{name:p.name,description:p.description??"",definition:f,triggerConfig:v}})}catch(k){let O=Xw(k);if(O)return{...N({...O,stage:"door"}),isError:!0};throw k}let E=r(x);return p.activate&&E&&await h.send({..._t("pipes.workflows.activateWorkflow"),pathParams:{workflowId:E},body:{}}),N({ok:!0,workflowId:E,activated:!!(p.activate&&E),nodes:f.nodes.length,edges:f.edges.length,...g.warnings.length?{warnings:g.warnings}:{}})}catch(f){return ce(f)}}),e.tool("pipes_validate_definition","Validate a pipe definition and trigger config against your deployment WITHOUT saving anything: the door applies every check it applies on create (the one pipe definition schema, your live connector catalogue, params against each action's inputSchema, credentials, branches, one reachable trigger). Pass the { definition, triggerConfig } pipes_build returned. Answers { valid: true } or PIPE_DEFINITION_INVALID with every reason (path, expected, got, didYouMean) and retry: true.",{definition:S.record(S.string(),S.unknown()).describe("the pipe definition { nodes, edges } (pipes_build's definition)"),triggerConfig:S.record(S.string(),S.unknown()).optional().describe("the trigger config { type, config } (pipes_build's triggerConfig)"),appId:S.string().optional()},async({definition:p,triggerConfig:f,appId:g})=>{try{let{kernel:v}=await t(g),h;try{h=await v.send({..._t("pipes.workflows.validateWorkflowDefinition"),body:{definition:p,...f?{triggerConfig:f}:{}}})}catch(E){let k=Xw(E);if(k)return{...N({...k,stage:"door",valid:!1}),isError:!0};throw E}let x=h?.data??h;return N({ok:!0,valid:x?.valid??!0,errors:x?.errors??[],schemaVersion:No})}catch(v){return ce(v)}}),e.resource("pipes-authoring-flow",Mw,{description:"How to author a pipe, step by step: discover the connectors, read their input schemas, draft, validate, create, run, inspect, iterate.",mimeType:"text/plain"},async p=>({contents:[{uri:p.href,mimeType:"text/plain",text:jo}]})),e.resource("pipes-definition-schema",rg,{description:`The pipe definition JSON Schema ${No} every pipes tool is generated from and the door validates against.`,mimeType:"application/schema+json"},async p=>({contents:[{uri:p.href,mimeType:"application/schema+json",text:JSON.stringify(qw,null,2)}]})),e.prompt(Fw,"Author an npayload pipe with the pipes tools, following the pipe-authoring flow.",{goal:S.string().optional().describe("what the pipe should do, in your words")},({goal:p})=>({messages:[{role:"user",content:{type:"text",text:`${p?`Build an npayload pipe that does this: ${p}
|
|
511
|
+
|
|
512
|
+
`:""}${jo}`}}]})),e.tool("pipes_list","List the workflows in your deployment (gid, name, status).",{appId:S.string().optional()},async({appId:p})=>{try{let{kernel:f}=await t(p),g=await f.send(_t("pipes.workflows.listWorkflows")),v=g?.data??g??[];return N(v.map(h=>({workflowId:h.gid??h.workflowGid??h._id,name:h.name,status:h.status})))}catch(f){return ce(f)}}),e.tool("pipes_get","Get one workflow incl. its full definition (nodes + edges) \u2014 useful to inspect or modify an existing pipe.",{workflowId:S.string(),appId:S.string().optional()},async({workflowId:p,appId:f})=>{try{let{kernel:g}=await t(f),v=await g.send({..._t("pipes.workflows.getWorkflow"),pathParams:{workflowId:p}});return N(v)}catch(g){return ce(g)}}),e.tool("pipes_run","Trigger one execution of a workflow (must be active). Returns the execution id + status; poll pipes_get_execution.",{workflowId:S.string(),triggerData:S.record(S.string(),S.unknown()).optional(),appId:S.string().optional()},async({workflowId:p,triggerData:f,appId:g})=>{try{let{kernel:v}=await t(g),h=await v.send({..._t("pipes.executions.triggerExecution"),pathParams:{workflowId:p},body:{triggerData:f??{}}});return N({executionId:h?.gid??h?.executionGid??h?.executionId,status:h?.status})}catch(v){return ce(v)}}),e.tool("pipes_get_execution","Get one execution's live state: overall status (running|completed|failed|cancelled) plus per-node runs with each node's status, output and error. Poll this after pipes_run until the status is terminal. The definition was already checked at create (PIPE_DEFINITION_INVALID); what fails here is the run itself (a remote call, a resolved template, a credential).",{executionId:S.string().describe("the execution id returned by pipes_run"),appId:S.string().optional()},async({executionId:p,appId:f})=>{try{let{kernel:g}=await t(f),v=await g.send({..._t("pipes.executions.getExecution"),pathParams:{executionId:p}});return N(v?.data??v)}catch(g){return ce(g)}}),e.tool("pipes_delete","Delete a workflow (works from ANY state \u2014 draft, paused, archived, active). Mutating \u2014 confirm first.",{workflowId:S.string(),appId:S.string().optional()},async({workflowId:p,appId:f})=>{try{let{kernel:g}=await t(f);return await g.send({..._t("pipes.workflows.deleteWorkflow"),pathParams:{workflowId:p}}),N({ok:!0,deleted:p})}catch(g){return ce(g)}}),e.tool("primus_contract","Return the npayload Primus (AI agents) config schema (JSON Schema) + the capability catalog + decision guide + guidance. Call this BEFORE writing or editing primus.config.ts \u2014 the schema returned here is the only valid source of config fields. Naming rule: skill/tool names are lowercase + underscores (hyphens are rejected).",async()=>N({version:mv,guidance:Tw,capabilities:Aw,schema:Tt})),e.tool("primus_validate","Validate a Primus config against the contract PLUS the platform preflight the schema can't express: skill/tool naming rule (lowercase + underscores, NO hyphens \u2014 the platform hard-rejects them) and trigger\u2192agent parent references. Pass the config object, OR omit it to validate the project's primus.config.ts on disk. Returns { ok, issues }.",{config:S.union([S.record(S.string(),S.unknown()),S.string()]).optional().describe("the PrimusConfig object (or a JSON string) to validate; omit to validate primus.config.ts on disk"),configPath:S.string().optional().describe("path to primus.config.ts (used when `config` is omitted)")},async({config:p,configPath:f})=>{let g=p;if(typeof g=="string")try{g=JSON.parse(g)}catch{}if(g==null){let h=f??Ke("primus");if(!h)return{...N({ok:!1,error:"no primus.config.ts found \u2014 write npayload/primus.config.ts first (see primus_contract)"}),isError:!0};g=await le(h)}let v=Wr(g,{allowInternalUrls:en()});return{...N(v),isError:!v.ok}}),e.tool("primus_deploy","Reconcile the project's primus.config.ts (agents / skills / tools / triggers) to your AI deployment \u2014 idempotent, keyed by name; triggers attach to their agent by NAME (resolved at deploy). Validates first; pass check:true for a dry-run plan. Mutating: confirm before applying.",{check:S.boolean().optional().describe("dry run: print the plan, apply nothing"),configPath:S.string().optional().describe("path to primus.config.ts (default: ./npayload/primus.config.ts)")},async({check:p,configPath:f})=>{let g=f??Ke("primus");if(!g)return{...N({ok:!1,error:"no primus.config.ts found \u2014 write npayload/primus.config.ts first (see primus_contract)"}),isError:!0};let v=await le(g),h=Wr(v,{allowInternalUrls:en()});if(!h.ok)return{...N({error:"config invalid \u2014 fix before deploy",issues:h.issues}),isError:!0};try{let x=await xe({config:g,check:p??!1,sink:a(()=>{},"sink")});return N(x.output)}catch(x){return ce(x)}}),e.tool("primus_status","Show the current sync state between primus.config.ts and your AI deployment (a dry-run plan: what exists, what would change).",{configPath:S.string().optional()},async({configPath:p})=>{let f=p??Ke("primus");if(!f)return{...N({ok:!1,error:"no primus.config.ts found"}),isError:!0};try{let g=await xe({config:f,check:!0,sink:a(()=>{},"sink")});return N(g.output)}catch(g){return ce(g)}}),e.tool("npayload_status","Diagnose the npayload environment: API + auth endpoint reachability, which credential source is available, and whether this project's pinned contract and generated permissions are in sync \u2014 each failure with a one-line remediation. Call this FIRST whenever another tool returns a connection or authorization error.",async()=>{try{let{buildReport:p}=await import("../chunk-52ZB3ZAG.mjs"),f=await p(),g={code:"TRANSPORT_UNAVAILABLE",type:"TransportUnavailableError"};return N({ok:f.authReady&&f.stack.apiReachable,endpoints:{api:{url:f.stack.apiUrl,reachable:f.stack.apiReachable,probe:f.stack.apiProbe,...f.stack.apiProbe==="refused"?g:{}},auth:f.stack.authUrl?{url:f.stack.authUrl,reachable:f.stack.authReachable,probe:f.stack.authProbe,...f.stack.authProbe==="refused"?g:{}}:void 0},credentials:f.credentials,project:{contractPin:f.stack.contractLock,generatedPermissions:f.stack.permissions},remediation:f.remediation})}catch(p){return ce(p)}}),e.tool("npayload_catalog",`Discover the FULL npayload op surface across ALL products (events, pipes, connect, feed, primus, account, \u2026). Returns every op grouped by product, each with { key, method, path, summary, isQuery, idempotent, scopes, pathParams, args }. The "key" is what you pass to npayload_invoke. Call this FIRST to learn what you can do, then npayload_invoke to do it. Pass a "product" to filter (products: ${Aa().join(", ")}).`,{product:S.string().optional().describe(`filter to one product, e.g. ${Aa().slice(0,4).join(", ")}; omit for the full catalog`)},async({product:p})=>{try{let f=Jw(p);return p&&f.products.length===0?{...N({ok:!1,error:`no product "${p}"`,products:Aa()}),isError:!0}:N(f)}catch(f){return ce(f)}}),e.tool("connect_deploy","Reconcile the project's connect.config.ts to the ADMIN control plane (idempotent; admin is the source of truth and syncs to cells). Validates first; pass check:true for a dry-run plan. Mutating: confirm before applying. Declaring a bridge/grant is an OFFER (pending) \u2014 the other org confirms in its own config.",{check:S.boolean().optional().describe("dry run: print the plan, apply nothing"),configPath:S.string().optional().describe("path to connect.config.ts (default: ./connect.config.ts or ./npayload/connect.config.ts)")},async({check:p,configPath:f})=>{let g=f??ug(),v=await le(g),h=ou(v,{allowInternalUrls:en()});if(!h.ok)return{...N({error:"config invalid \u2014 fix before deploy",issues:h.issues}),isError:!0};try{let x=await xe({config:g,check:p??!1,sink:a(()=>{},"sink")});return N(x.output)}catch(x){return ce(x)}}),e.tool("connect_status","Show the current sync state between connect.config.ts and the admin control plane (a dry-run plan: what exists, what would change).",{configPath:S.string().optional()},async({configPath:p})=>{let f=p??ug();try{let g=await xe({config:f,check:!0,sink:a(()=>{},"sink")});return N(g.output)}catch(g){return ce(g)}}),e.tool("npayload_invoke",`Invoke ANY npayload op by its catalog "key" (from npayload_catalog), e.g. "events.channels.list", "connect.connectAccess.listMyGrants", "feed.listings.create", "primus.agents.create", "account.environments.create". Pass "args" keyed by the op's arg names \u2014 path params and body/query fields together; this tool splits them per the op's contract. Path params named "appId" are auto-resolved from your token when omitted. Dispatches as your authenticated client (bounded by your own token scopes \u2014 no escalation). WARNING: ops where isQuery is false MUTATE state; ALWAYS confirm with the user before invoking a mutating op (create/update/delete/publish/trigger/\u2026).`,{key:S.string().describe('the op key from npayload_catalog, e.g. "events.channels.create"'),args:S.record(S.string(),S.unknown()).optional().describe("op args keyed by arg name (path params + body/query); see the op's pathParams/args in npayload_catalog")},async({key:p,args:f})=>{try{let{buildKernel:g}=await import("../chunk-2PCG57PX.mjs"),v=Ea({key:p})==="primus"?ne(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl"):void 0,h=await g(v||void 0),{row:x,request:E}=await Hw(p,f,{resolveAppId:a(()=>Qw(h),"resolveAppId"),newIdempotencyKey:a(()=>globalThis.crypto.randomUUID(),"newIdempotencyKey")}),k=await h.send(E);return N({ok:!0,key:p,method:x.method,path:E.path,mutating:!x.isQuery,result:k})}catch(g){return g instanceof Sn?ce(g,{suggestions:g.suggestions}):ce(g)}}),e}a(fE,"buildServer");function tx(e){e.command("mcp").description("npayload MCP server for your coding agent (local stdio)").command("serve",{isDefault:!0}).description("Run the MCP server on stdio (Claude / Cursor / Codex connect to this)").action(async()=>{Bw(await Oh());let r=fE(),o=new dE;await r.connect(o)})}a(tx,"registerMcp");import{existsSync as hg,readFileSync as UE,watch as LE}from"fs";import{resolve as zE,join as Ga}from"path";import tn from"chalk";import ue from"chalk";import{createHash as DE}from"crypto";import{readFileSync as jE}from"fs";import{existsSync as Mo,readFileSync as fg,writeFileSync as La,mkdirSync as ax}from"fs";import{resolve as cx,join as Ot,dirname as ux}from"path";import _e from"chalk";function Ca(e,t){return Ra(e)===Ra(t)}a(Ca,"deepEqual");function Ra(e){if(e===null||typeof e!="object")return JSON.stringify(e)??"null";if(Array.isArray(e))return`[${e.map(Ra).join(",")}]`;let t=e;return`{${Object.keys(t).sort().map(o=>`${JSON.stringify(o)}:${Ra(t[o])}`).join(",")}}`}a(Ra,"stableStringify");var gE=a(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isObj");function rx(e,t,r){let o={},n=[],i=[],s=[],c=nx(t,r);for(let u of c){let l=t[u]??{},d=r[u]??{},m=e[u]??{},p={};for(let f of nx(l,d)){let g=l[f],v=d[f],h=m[f];if(g&&!v){p[f]=ot(g),s.push({resource:u,key:f});continue}if(!g&&v){p[f]=ot(v),n.push({resource:u,key:f,kind:"add-entry",value:ot(v)});continue}if(!g||!v)continue;let x={};for(let E of hE(h,g,v)){let k=h?E in h:!1,O=E in g,A=E in v,j=h?.[E],U=g[E],K=v[E];if(O&&A)Ca(U,K)?x[E]=ot(U):k&&Ca(U,j)?(x[E]=ot(K),n.push({resource:u,key:f,field:E,kind:"update-field",value:ot(K)})):k&&Ca(K,j)?x[E]=ot(U):(x[E]=ot(U),i.push({resource:u,key:f,field:E,base:j,local:U,remote:K}));else if(O&&!A)x[E]=ot(U);else if(!O&&A){if(k&&Ca(K,j))continue;x[E]=ot(K),n.push({resource:u,key:f,field:E,kind:"add-field",value:ot(K)})}}p[f]=x}Object.keys(p).length&&(o[u]=p)}return{merged:o,changes:n,conflicts:i,localOnly:s}}a(rx,"threeWayMergeConfig");function nx(e,t){return Array.from(new Set([...Object.keys(e),...Object.keys(t)]))}a(nx,"unionKeys");function hE(...e){let t=new Set;for(let r of e)if(gE(r))for(let o of Object.keys(r))t.add(o);return Array.from(t)}a(hE,"unionFieldKeys");function ot(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}a(ot,"clone");var Lo;async function yE(){if(Lo!==void 0)return Lo;try{Lo=(await import("typescript")).default??await import("typescript")}catch{Lo=null}return Lo}a(yE,"loadTs");function fr(e,t=0){let r=" ".repeat(t),o=" ".repeat(t+1);if(e===null)return"null";if(e===void 0)return"undefined";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.length===0?"[]":`[
|
|
513
|
+
${e.map(i=>`${o}${fr(i,t+1)}`).join(`,
|
|
514
|
+
`)},
|
|
515
|
+
${r}]`;if(typeof e=="object"){let n=e,i=Object.keys(n);return i.length===0?"{}":`{
|
|
516
|
+
${i.map(c=>`${o}${Na(c)}: ${fr(n[c],t+1)}`).join(`,
|
|
517
|
+
`)},
|
|
518
|
+
${r}}`}return JSON.stringify(e)??"null"}a(fr,"toTsLiteral");function Na(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?e:JSON.stringify(e)}a(Na,"tsKey");async function Da(e,t){if(t.changes.length+t.conflicts.length===0)return{ok:!0,text:e,applied:0};let o=await yE();if(!o)return{ok:!1,applied:0,reason:"typescript not available"};let n=o.createSourceFile("config.ts",e,o.ScriptTarget.Latest,!0),i,s=a(h=>{if(!i){if(o.isCallExpression(h)){let x=h.expression.getText(n);if(/define\w*Config$/.test(x)&&h.arguments.length>=1){let E=h.arguments[0];o.isObjectLiteralExpression(E)&&(i=E)}}o.forEachChild(h,s)}},"visit");if(s(n),!i)return{ok:!1,applied:0,reason:"define*Config({...}) object not found"};let c=[],u=a((h,x)=>h.properties.find(E=>o.isPropertyAssignment(E)&&vE(o,n,E)===x),"propByName"),l=a(h=>{let x=e.lastIndexOf(`
|
|
519
|
+
`,h-1)+1,E=/^[ \t]*/.exec(e.slice(x,h));return E?E[0]:""},"indentOf"),d=0,m=a(h=>({ok:!1,applied:0,reason:h}),"fail"),p=new Map;for(let h of t.changes){if(h.kind!=="add-entry"||u(i,h.resource))continue;let x=p.get(h.resource)??{};x[h.key]=h.value,p.set(h.resource,x)}for(let h of t.changes){let x=u(i,h.resource)?.initializer;if(h.kind==="add-entry"){if(!x){if(p.has(h.resource)){d++;continue}return m(`resource "${h.resource}" not found for add-entry`)}if(!o.isObjectLiteralExpression(x))return m(`resource "${h.resource}" is not an object literal (add-entry)`);let V=l(x.getStart(n))+" ",D=`${Na(h.key)}: ${fr(h.value,Oa(V))}`;c.push(lg(o,n,x,D,V)),d++;continue}if(!x||!o.isObjectLiteralExpression(x))return m(`resource "${h.resource}" not found`);let E=u(x,h.key)?.initializer;if(!E||!o.isObjectLiteralExpression(E))return m(`entry "${h.resource}.${h.key}" not found`);let k=(h.field??"").split("."),O=E,A=!0;for(let V=0;V<k.length-1;V++){let D=u(O,k[V])?.initializer;if(!D||!o.isObjectLiteralExpression(D)){A=!1;break}O=D}if(!A)return m(`nested path "${h.resource}.${h.key}.${h.field}" not found`);let j=k[k.length-1],U=h.trailingComment?` ${h.trailingComment}`:"",K=u(O,j);if(h.kind==="add-field"||!K){let V=l(O.getStart(n))+" ",D=`${Na(j)}: ${fr(h.value,Oa(V))}${U}`;c.push(lg(o,n,O,D,V)),d++}else if(h.kind==="update-field"){let V=K.initializer,D=fr(h.value,Oa(l(K.getStart(n))));if(U){let B=e.indexOf(`
|
|
520
|
+
`,V.getEnd());c.push({start:V.getStart(n),end:B===-1?V.getEnd():B,text:`${D},${U}`})}else c.push({start:V.getStart(n),end:V.getEnd(),text:D});d++}}if(p.size>0){let h=l(i.getStart(n))+" ",x=Array.from(p,([E,k])=>`${Na(E)}: ${fr(k,Oa(h))}`).join(`,
|
|
521
|
+
${h}`);c.push(lg(o,n,i,x,h))}for(let h of t.conflicts){let x=u(i,h.resource)?.initializer;if(!x||!o.isObjectLiteralExpression(x))continue;let E=u(x,h.key)?.initializer;if(!E||!o.isObjectLiteralExpression(E))continue;let k=u(E,h.field);if(!k)continue;let O=l(k.getStart(n)),A=`/* CONFLICT (np pull): live=${dg(h.remote)} ; keeping local ${dg(h.local)} (was ${dg(h.base)}). Resolve, then re-pull. */
|
|
522
|
+
${O}`;c.push({start:k.getStart(n),end:k.getStart(n),text:A}),d++}c.sort((h,x)=>x.start-h.start);let f=e;for(let h of c)f=f.slice(0,h.start)+h.text+f.slice(h.end);return(o.createSourceFile("check.ts",f,o.ScriptTarget.Latest,!0).parseDiagnostics??[]).length>0?m("merged output failed re-parse (kept original)"):{ok:!0,text:f,applied:d}}a(Da,"applyThreeWayMerge");function vE(e,t,r){let o=r.name;return e.isIdentifier(o)||e.isStringLiteral(o)?o.text:o.getText(t)}a(vE,"propName");function lg(e,t,r,o,n){let i=r.getEnd()-1,s=r.properties.length>0,c="";if(s){let l=r.properties[r.properties.length-1],d=t.text.slice(l.getEnd(),i);!/,\s*$/.test(t.text.slice(l.getEnd()-1,l.getEnd()))&&!d.includes(",")&&(c=",")}let u=n.slice(2);return{start:i,end:i,text:`${c}
|
|
523
|
+
${n}${o},
|
|
524
|
+
${u}`}}a(lg,"insertIntoObject");function Oa(e){return Math.floor(e.replace(/\t/g," ").length/2)}a(Oa,"indentLevel");function dg(e){let t=JSON.stringify(e);return t&&t.length>80?t.slice(0,77)+"...":t??"undefined"}a(dg,"jsonInline");var bE=[{name:"events",define:"defineEventsConfig",resources:ah,files:["npayload/events.config.ts","npayload/events.config.mjs","npayload/events.config.js","events.config.ts","events.config.mjs","events.config.js"],plane:"cell",schema:Cn},{name:"primus",define:"definePrimusConfig",resources:ch,files:["npayload/primus.config.ts","npayload/primus.config.mjs","npayload/primus.config.js","primus.config.ts","primus.config.mjs","primus.config.js"],plane:"primus",schema:Tt}],wE=new Set(["gid","_id","_creationTime","id","createdAt","updatedAt","ownerId","ownerType","orgId","appId","status","subscriptionGid","exchangeGid","consumerGroupGid","messageCount","lastMessageAt","createdBy","version","brainAgentId","environmentId","tenantId"]),xE=new Set(["connect_receiving","feed_receiving"]);function ja(e){return typeof e=="string"?e.length>0:e!=null&&e!==!1}a(ja,"present");function kE(e){if(e.isSystemChannel===!0)return!0;let t=typeof e.slug=="string"?e.slug:"";return t.startsWith("_system.")||t==="_system"?!0:(t.split(".")[0]??"").toLowerCase()==="system"}a(kE,"isAutoCreatedSystemRow");function _E(e){let t=e.metadata,r=t!==null&&typeof t=="object"?t:void 0;return ja(r?.connectGrantGid)||ja(r?.feedBindingGid)||ja(e.connectGrantGid)||ja(e.feedBindingGid)||typeof e.origin=="string"&&xE.has(e.origin)}a(_E,"isSystemManagedRow");function $E(e,t){if(Mo(e))try{for(let r of fg(e,"utf8").split(`
|
|
525
|
+
`)){let o=r.trim();if(!o||o.startsWith("#"))continue;let n=o.indexOf("=");if(!(n===-1||o.slice(0,n).trim()!==t))return o.slice(n+1).trim().replace(/^["']|["']$/g,"")}}catch{}}a($E,"readEnvVar");function SE(e){if(e)return e;let t=process.env.NPAYLOAD_APP_ID?.trim();if(t)return t;for(let r of[Ot(process.cwd(),".env"),Ot(process.cwd(),"npayload",".env")]){let o=$E(r,"NPAYLOAD_APP_ID");if(o)return o}}a(SE,"resolveAppGid");function ox(e){return/^[a-z]{2,6}_[A-Za-z0-9]{4,}$/.test(e)}a(ox,"looksLikeGid");function pg(e){if(Array.isArray(e))return e;if(e&&typeof e=="object")for(let t of["data","items","channels","subscriptions","agents","skills","tools","results"]){let r=e[t];if(Array.isArray(r))return r}return[]}a(pg,"asRows");function IE(e){return(e.match(/:([A-Za-z0-9_]+)/g)??[]).map(t=>t.slice(1))}a(IE,"paramsOf");function PE(e){return e.replace(/:([A-Za-z0-9_]+)/g,"{$1}")}a(PE,"toTemplate");function ix(e,t){let n=e.properties?.[t]?.additionalProperties;return n&&typeof n=="object"?n:null}a(ix,"entrySchemaOf");function EE(e,t){for(let[r,o]of Object.entries(t?.properties??{})){let n=o.enum,i=e[r];if(Array.isArray(n)&&typeof i=="string"&&!n.includes(i))return r}}a(EE,"undeclarableField");function mg(e,t,r={}){if(!e||t===null||t===void 0)return e?t??void 0:void 0;if(e.properties&&typeof t=="object"&&!Array.isArray(t)){let o={};for(let[n,i]of Object.entries(e.properties)){let s=mg(i,t[n],{fieldName:n,secret:r.secret});s!==void 0&&(o[n]=s)}return Object.keys(o).length?o:void 0}return e.additionalProperties&&typeof t=="object"&&!Array.isArray(t)?r.fieldName==="headers"&&r.secret?uh(t,r.secret):t:e.items&&Array.isArray(t)?t.map(o=>mg(e.items,o,r)).filter(o=>o!==void 0):typeof t=="object"&&!Array.isArray(t)?void 0:t}a(mg,"projectToSchema");function TE(e,t,r,o){let n={},i=typeof e[t]=="string"?{...o?{app:o}:{},channel:String(e[t])}:void 0;for(let[s,c]of Object.entries(e))if(!(s===t||wE.has(s))&&c!=null)if(r){let u=r.properties?.[s];if(!u)continue;let l=mg(u,c,{fieldName:s,...i?{secret:i}:{}});l!==void 0&&(n[s]=l)}else n[s]=c;return n}a(TE,"projectRow");var AE=new Set(we.commands.filter(e=>(e.flags??[]).some(t=>t.name==="appId")).map(e=>`${e.method} ${e.pattern}`));function CE(e){let t=ne(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl"),r=rn(e);return t!==void 0&&r!==void 0&&t.replace(/\/+$/,"")===r.replace(/\/+$/,"")?"NPAYLOAD_PRIMUS_API_URL":"NPAYLOAD_API_URL"}a(CE,"endpointVarOf");async function RE(e,t,r,o,n,i,s=AE){let c=a((g,v,h,x)=>e.send({method:g,path:PE(v),...Object.keys(h).length?{pathParams:h}:{},...x&&Object.keys(x).length?{query:x}:{}}),"send"),u={},l=new Map,d=new Map,m=["agentGid","channelGid","channels"],p={channels:0,tools:0,skills:1,agents:2,triggers:3},f=Object.keys(t).sort((g,v)=>(p[g]??99)-(p[v]??99));for(let g of f){let v=t[g],h=v.ops?.list;if(!h)continue;let x=IE(h.pattern),E=x.some(A=>A==="channelId"||A==="channelGid"),k=[];try{if(E)for(let[,A]of l){let j={...o?{appId:o}:{}};for(let U of x)(U==="channelId"||U==="channelGid")&&(j[U]=A);k.push(...pg(await c(h.method,h.pattern,j)))}else if(x.length===0){let A=o&&s.has(`${h.method} ${h.pattern}`);k.push(...pg(await c(h.method,h.pattern,{},A?{appId:o}:void 0)))}else if(x.every(A=>A==="appId"))k.push(...pg(await c(h.method,h.pattern,{appId:o})));else{n(` \u2022 skipped ${g} (list needs ${x.join(",")}, which pull does not support)`),i&&i.count++;continue}}catch(A){F(A),n(` \u2022 ${g}: list failed (${hh(A,rn(e),CE(e))})`),i&&i.count++;continue}if(k.length===0)continue;let O={};for(let A of k){let j=A[v.identity];if(typeof j!="string"||_E(A)||kE(A))continue;if(EE(A,ix(r,g))!==void 0){n(` \u2022 skipped ${g}/${j}: npayload creates and manages it for you, so your config does not declare it`);continue}let U=A.gid??A.channelGid??A.id;g==="channels"&&U&&l.set(j,U),U&&d.set(U,j);let K=TE(A,v.identity,ix(r,g),o),V;for(let D of m){let B=K[D];if(typeof B=="string"){if(d.has(B))K[D]=d.get(B);else if(ox(B)){V=`${D} ${B}`;break}}if(Array.isArray(B)){let fe=[];for(let ie of B)typeof ie=="string"&&d.has(ie)?fe.push(d.get(ie)):typeof ie=="string"&&ox(ie)?n(` \u2022 ${g}/${j}: dropped ${D} entry ${ie} \u2014 its parent is not exported (archived, system-managed or not listed); a pulled config must push back as no-ops`):fe.push(ie);K[D]=fe}}if(V!==void 0){n(` \u2022 skipped ${g}/${j}: its ${V} is not exported (archived, system-managed or not listed) \u2014 a pulled config must push back as no-ops`);continue}for(let D of un(g)){if(D.wire==="name")continue;let B=Tn(A,D.publicField);if(D.array){if(!Array.isArray(B))continue;let fe=B.map(ie=>typeof ie=="string"&&d.has(ie)?d.get(ie):ie);dc(K,D.path,fe)}else typeof B=="string"&&dc(K,D.path,d.get(B)??B)}O[j]=K}Object.keys(O).length&&(u[g]=O)}return u}a(RE,"fetchLive");function OE(e){for(let t of e){let r=cx(process.cwd(),t);if(Mo(r))return r}return null}a(OE,"firstConfig");function zo(e,t){let r=Mo(Ot(process.cwd(),"npayload"))?Ot(process.cwd(),"npayload",".npayload"):Ot(process.cwd(),".npayload");return Ot(r,`${e.name}.${t}.pull-base.json`)}a(zo,"basePath");function NE(e){try{return Mo(e)?JSON.parse(fg(e,"utf8")):{}}catch{return{}}}a(NE,"readBase");function Ua(e,t){try{ax(ux(e),{recursive:!0}),La(e,JSON.stringify(t,null,2),"utf8")}catch{}}a(Ua,"saveBase");function sx(e,t,r,o){return`/**
|
|
526
|
+
* Pulled from the live ${t} topology by \`npayload pull\`.
|
|
527
|
+
`+(o?` *
|
|
528
|
+
${o}
|
|
529
|
+
`:"")+` * Review + merge into your config \u2014 do not blindly overwrite.
|
|
530
|
+
*/
|
|
531
|
+
import { ${e} } from "@npayload/sdk";
|
|
532
|
+
|
|
533
|
+
export default ${e}(${JSON.stringify(r,null,2)});
|
|
534
|
+
`}a(sx,"renderModule");async function gg(e,t=r=>process.stdout.write(r)){let r=e.env??"sandbox",o=e.check===!0,n=SE(e.app);if(!n)throw new Error("No app GID. Pass --app or set NPAYLOAD_APP_ID (or run from a project with .env).");let i=await It(void 0,e.env,{readOnly:!0}),s=ne(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl"),c=s?await It(s,e.env,{readOnly:!0}):null,u=a(m=>process.stderr.write(_e.yellow(`${m}
|
|
535
|
+
`)),"warn"),l={count:0},d=0;for(let m of bE){let p=m.plane==="primus"?c:i;if(!p)continue;let f=OE(m.files),g;try{g=await RE(p,m.resources,m.schema,n,u,l)}catch(A){F(A),u(` \u2022 ${m.name}: ${A instanceof Error?A.message:String(A)}`);continue}let v=Object.values(g).reduce((A,j)=>A+Object.keys(j).length,0);if(!f||e.out||e.force){if(!f&&v===0)continue;let A;if(e.out?A=cx(process.cwd(),e.out):e.force&&f?A=f:A=Mo(Ot(process.cwd(),"npayload"))?Ot(process.cwd(),"npayload",`${m.name}.config.ts`):Ot(process.cwd(),`${m.name}.config.ts`),o){t(_e.cyan(`~ ${m.name}: would write ${v} resource(s) \u2192 ${A}
|
|
536
|
+
`)),d++;continue}try{ax(ux(A),{recursive:!0}),La(A,sx(m.define,r,g),"utf8")}catch(j){u(` \u2022 ${m.name}: could not write ${A} (${j instanceof Error?j.message:String(j)})`);continue}Ua(zo(m,r),g),t(_e.green(`\u2713 ${m.name}: wrote ${v} resource(s) \u2192 ${A}
|
|
537
|
+
`)),d++;continue}let h,x;try{h=fg(f,"utf8"),x=await le(f)}catch(A){u(` \u2022 ${m.name}: could not read ${f} (${A instanceof Error?A.message:String(A)})`);continue}let E=NE(zo(m,r)),k=rx(E,x,g);if(k.changes.length===0&&k.conflicts.length===0){o||Ua(zo(m,r),g),t(_e.dim(` \u2022 ${m.name}: up to date (${f})
|
|
538
|
+
`));continue}if(o){let A=k.changes.filter(U=>U.kind!=="update-field").length,j=k.changes.filter(U=>U.kind==="update-field").length;t(_e.cyan(`~ ${m.name}: would merge into ${f} `)+_e.dim(`(${j} updated, ${A} added`)+(k.conflicts.length?_e.yellow(`, ${k.conflicts.length} CONFLICT`):"")+_e.dim(`)
|
|
539
|
+
`));for(let U of k.conflicts)t(_e.yellow(` conflict: ${String(U.path??JSON.stringify(U))}
|
|
540
|
+
`));d++;continue}let O=await Da(h,k);if(O.ok&&O.text!==void 0){La(f,O.text,"utf8"),Ua(zo(m,r),g);let A=k.changes.filter(U=>U.kind!=="update-field").length,j=k.changes.filter(U=>U.kind==="update-field").length;t(_e.green(`\u2713 ${m.name}: merged into ${f} `)+_e.dim(`(${j} updated, ${A} added`)+(k.conflicts.length?_e.yellow(`, ${k.conflicts.length} CONFLICT \u2014 resolve inline`):"")+_e.dim(`)
|
|
541
|
+
`)),d++}else{let A=f.replace(/\.config\.(ts|mjs|js)$/,".config.pulled.$1"),j=` * \u26A0 ${k.conflicts.length} conflict(s); in-place merge unavailable (${O.reason??"n/a"}).
|
|
542
|
+
* This is the MERGED result \u2014 diff it against ${f}, then keep.`;La(A,sx(m.define,r,k.merged,j),"utf8"),Ua(zo(m,r),g),t(_e.yellow(`! ${m.name}: in-place merge unavailable (${O.reason??"n/a"}) \u2014 wrote sidecar ${A}
|
|
543
|
+
`)),d++}}return d===0&&l.count===0&&t(_e.dim(`Nothing to pull.
|
|
544
|
+
`)),l.count>0&&process.stderr.write(_e.yellow(`\u26A0 ${l.count} resource type(s) unreadable \u2014 this preview/sync is PARTIAL.
|
|
545
|
+
`)),{touched:d,listFailures:l.count}}a(gg,"runPullOnce");function lx(e){e.command("pull").description("Pull your live Events and Primus setup into *.config.ts (three-way backward sync)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--out <path>","force-write the resolved config to this path (skips merge)").option("--force","overwrite the resolved config in place (skips merge)").option("--env <slug>","environment to pull from (default: the active environment, `np env use`)").option("--check","preview the merge (adopted fields, additions, conflicts) \u2014 write NOTHING").action(async(t,r)=>{try{let o=dt(t,r),n=An(o!==void 0?{explicitSlug:o}:{}),i=await gg({...t,env:n});try{let{pullScopesIntoManifest:s}=await import("../chunk-22PYMXSS.mjs");await s({...t.app?{appId:t.app}:{},readRemoteGrant:a(async c=>{let{restoreSession:u}=await import("../chunk-QUJ2IZXU.mjs"),l=await u();return l?l.getOacGrant(c):null},"readRemoteGrant"),log:a(c=>process.stdout.write(c),"log")})}catch(s){F(s)}process.exit(i.listFailures>0?1:0)}catch(o){process.stderr.write(_e.red(`${se(o instanceof Error?o.message:String(o),o)}
|
|
546
|
+
`)),process.exit(1)}})}a(lx,"registerPull");var qa=class extends Error{static{a(this,"PushTargetsProductionError")}constructor(t,r="active"){super((r==="--env"?`Refusing: \`--env ${t}\` names the PRODUCTION environment. `:`Refusing: the active environment "${t}" is the PRODUCTION environment. `)+"`np push`/`diff`/`watch`/`sync` target development environments only \u2014 production changes ship through `np deploy`. "+(r==="--env"?"Pass a development environment's slug.":"Switch with `np env use <dev-slug>` first.")),this.name="PushTargetsProductionError"}};function gr(e,t){let r=t?.trim()?t.trim():void 0,o=r!==void 0?"--env":"active",n=r??pc(e)??"sandbox";if(n==="production"||n==="prod")throw new qa(n,o);if(En(e)?.environments.find(c=>c.slug===n)?.kind==="production")throw new qa(n,o);return n}a(gr,"resolveActivePushEnv");function za(e,t){let r=Ir(e.app);return{...e.config?{config:e.config}:{},...r?{app:r}:{},env:gr(void 0,e.env),check:t,...e.prune?{prune:!0}:{},...e.yes?{yes:!0}:{},...e.acceptRemote?{acceptRemote:!0}:{},...e.overwriteRemote?{overwriteRemote:!0}:{}}}a(za,"sandboxOpts");function Ma(e){return dt({},e)}a(Ma,"typedEnv");function Fa(e){process.stderr.write(ue.red(`${se(`failed: ${e instanceof Error?e.message:String(e)}`,e)}
|
|
547
|
+
`)),process.exit(1)}a(Fa,"fail");function dx(e){try{return DE("sha256").update(jE(e)).digest("hex")}catch{return}}a(dx,"fileDigest");var Za=class{static{a(this,"AdoptedWrites")}digests=new Map;record(t){for(let r of t){let o=dx(r);o!==void 0&&this.digests.set(r,o)}}isOnlyTheAdoption(t){return t.length===0||this.digests.size===0?!1:t.every(r=>this.digests.get(r)!==void 0&&this.digests.get(r)===dx(r))}clear(){this.digests.clear()}};function px(e,t,r,o){let n=Math.max(5,e.pollSeconds)*1e3,i=!1,s=a(async()=>{if(!(i||t.flag)){t.flag=!0;try{try{let m=await le(We()),p=Zh(fc(m)),f=await It(void 0,void 0,{readOnly:!0}),{token:g}=await f.auth.getAccessToken([]),h=(JSON.parse(Buffer.from(g.split(".")[1]??"","base64url").toString("utf8")).scope??"").split(" ").filter(Boolean).sort();h.length>0&&JSON.stringify(h)!==JSON.stringify(p)&&!i&&(process.stdout.write(ue.cyan(`\u2193 scope drift: credential carries ${h.length} scope(s), config projects ${p.length} \u2014 resyncing to the config\u2026
|
|
548
|
+
`)),await Gh(fc(m),Ir(e.app),x=>process.stdout.write(x)))}catch(m){F(m)}if(i)return;let u=gr(void 0,e.env),d=(await xe({...e.config?{config:e.config}:{},...Ir(e.app)?{app:Ir(e.app)}:{},env:u,check:!0,sink:a(()=>{},"sink")})).plan.filter(m=>m.action!=="noop");d.length>0&&!i&&(process.stdout.write(ue.cyan(`
|
|
549
|
+
\u2193 drift: ${d.length} live change(s) not in your config \u2014 adopting (pull merge)\u2026
|
|
550
|
+
`)),await gg({...e.app?{app:e.app}:{},env:u}),r.record(o))}catch(u){if(u instanceof be){i=!0,clearInterval(c),process.stderr.write(ue.red(`${se(`drift poll stopped: ${u.message}`,u)}
|
|
551
|
+
`));return}process.stderr.write(ue.yellow(`drift poll failed (${u instanceof Error?u.message:String(u)}) \u2014 still watching
|
|
552
|
+
`))}finally{t.flag=!1}}},"tick"),c=setInterval(()=>void s(),n);return()=>{i=!0,clearInterval(c)}}a(px,"startDriftLane");function mx(e){e.command("diff").alias("status").description("Show the plan (create / update / orphan / no-op) without applying \u2014 your code vs the sandbox. Exit 0 in sync, 2 with changes, 1 on error.").option("--config <path>","a single config file (default: every *.config.ts)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--json","machine-readable plan on stdout (no ANSI)").action(async(t,r)=>{try{let o=await xe({...za({...t,env:Ma(r)},!0),...t.json?{json:!0}:{}});process.exit(hc("diff",o.plan))}catch(o){Fa(o)}}),e.command("push").description("Apply your config to the sandbox (create + update changed fields; --prune deletes undeclared resources after confirmation)").option("--config <path>","a single config file (default: every *.config.ts)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--prune","delete live resources not declared in the config (confirmed; --yes for CI)").option("--yes","skip the prune confirmation (CI)").option("--accept-remote","on scope drift: pull the remote grant change into npayload.toml").option("--overwrite-remote","on scope drift: replace the remote grant with the manifest declaration").option("--json","machine-readable plan + apply results on stdout (no ANSI)").action(async(t,r)=>{try{let o=await xe({...za({...t,yes:gc(t,r),env:Ma(r)},!1),...t.json?{json:!0}:{}});process.exit(hc("push",o.plan))}catch(o){Fa(o)}}),e.command("watch").description("Watch your configs and push to the sandbox on every change; poll for backend drift and adopt it into your files (Ctrl-C to stop)").option("--config <path>","a single config file (default: every *.config.ts)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--poll <seconds>","backend drift poll interval","20").option("--no-poll","disable the poll for the server's drift (file-change pushes only)").action(async(t,r)=>{let o=Ma(r);try{gr(void 0,o)}catch(l){Fa(l);return}let n=vc(t.config);n.length===0&&(process.stderr.write(ue.red("No product config found. Run `npayload init` first.\n")),process.exit(1));let i=t.poll!==!1;process.stdout.write(ue.bold(`\u{1F440} watching ${n.length} config(s) \u2192 sandbox`)+ue.dim(i?` \xB7 drift poll every ${t.poll}s`:" \xB7 drift poll off")+ue.bold(` \xB7 Ctrl-C to stop
|
|
553
|
+
`));let s={flag:!1},c=new Za,u=i?px({...t.config?{config:t.config}:{},...t.app?{app:t.app}:{},...o!==void 0?{env:o}:{},pollSeconds:Number(t.poll)||20},s,c,n):()=>{};await bc(n,async()=>{if(c.isOnlyTheAdoption(n)){process.stdout.write(ue.dim(`\u2193 config updated by the drift poll \u2014 nothing pushed (the poll never pushes topology)
|
|
554
|
+
`));return}c.clear(),s.flag=!0;try{await xe(za({...t,env:o},!1))}catch(l){process.stderr.write(ue.red(`${se(`reconcile failed: ${l instanceof Error?l.message:String(l)}`,l)}
|
|
555
|
+
`))}finally{s.flag=!1}}),u(),process.stdout.write(ue.dim(`
|
|
556
|
+
stopped.
|
|
557
|
+
`)),process.exit(0)}),e.command("sync").description("Continuously sync your config to the sandbox: push now, then on every save; poll for backend drift and adopt it (= `np dev`)").option("--config <path>","a single config file (default: every *.config.ts)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--prune","delete live resources not declared in the config (requires --yes in the loop)").option("--yes","skip the prune confirmation (CI / the sync loop)").option("--poll <seconds>","backend drift poll interval","20").option("--no-poll","disable the poll for the server's drift (file-change pushes only)").action(async(t,r)=>{let o=gc(t,r),n=Ma(r);try{gr(void 0,n)}catch(g){Fa(g);return}let i=vc(t.config);i.length===0&&(process.stderr.write(ue.red("No product config found. Run `npayload init` first.\n")),process.exit(1));let s={flag:!1},c=a(async g=>{s.flag=!0,process.stdout.write(ue.dim(`
|
|
558
|
+
[${g}] syncing ${i.length} config(s) \u2192 sandbox\u2026
|
|
559
|
+
`));try{await xe(za({...t,yes:o,env:n},!1))}catch(v){process.stderr.write(ue.red(`${se(`reconcile failed: ${v instanceof Error?v.message:String(v)}`,v)}
|
|
560
|
+
`))}finally{s.flag=!1}},"run");await c("start");let u=await Me().catch(()=>null),l=Lt(),d=zt("sync",u,{onRevoked:a(()=>lt(),"onRevoked"),onRefused:l.onRefused}),m=t.poll!==!1;process.stdout.write(ue.bold(`
|
|
561
|
+
\u{1F440} watching ${i.map(g=>g.replace(process.cwd()+"/","")).join(", ")}`)+ue.dim(m?` \xB7 drift poll every ${t.poll}s`:" \xB7 drift poll off")+ue.bold(` \xB7 Ctrl-C to stop
|
|
562
|
+
`));let p=new Za,f=m?px({...t.config?{config:t.config}:{},...t.app?{app:t.app}:{},...n!==void 0?{env:n}:{},pollSeconds:Number(t.poll)||20},s,p,i):()=>{};try{await bc(i,async g=>{if(p.isOnlyTheAdoption(i)){process.stdout.write(ue.dim(`\u2193 config updated by the drift poll \u2014 nothing pushed (the poll never pushes topology)
|
|
563
|
+
`));return}p.clear(),await c(g)},300,l)}catch(g){d(),f(),process.stderr.write(ue.red(`${se(`sync stopped: ${g instanceof Error?g.message:String(g)}`,g)}
|
|
564
|
+
`)),process.exit(1);return}d(),f(),process.stdout.write(ue.dim(`
|
|
565
|
+
stopped.
|
|
566
|
+
`)),process.exit(0)})}a(mx,"registerSyncCommands");function ME(e){if(e){let r=zE(process.cwd(),e);return hg(r)?[r]:[]}let t=[];for(let r of["events","primus","pipes"])for(let o of[`${r}.config.ts`,Ga("npayload",`${r}.config.ts`)]){let n=Ga(process.cwd(),o);hg(n)&&t.push(n)}return t}a(ME,"findAllConfigs");function FE(e,t){if(hg(e))try{for(let r of UE(e,"utf8").split(`
|
|
567
|
+
`)){let o=r.trim();if(!o||o.startsWith("#"))continue;let n=o.indexOf("=");if(!(n===-1||o.slice(0,n).trim()!==t))return o.slice(n+1).trim().replace(/^["']|["']$/g,"")}}catch{}}a(FE,"readEnvVar");function qE(e){if(e)return e;let t=process.env.NPAYLOAD_APP_ID?.trim();if(t)return t;for(let r of[Ga(process.cwd(),".env"),Ga(process.cwd(),"npayload",".env")]){let o=FE(r,"NPAYLOAD_APP_ID");if(o)return o}}a(qE,"resolveAppGid");function fx(e){e.command("dev").description("Watch your product configs and reconcile ALL of them to npayload on every change").option("--config <path>","watch/sync a single config file (default: every *.config.ts)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--env <slug>","target development environment (default: the active environment, `np env use`; else sandbox)").action(async(t,r)=>{let o;try{o=gr(void 0,dt(t,r))}catch(g){process.stderr.write(tn.red(`failed: ${g instanceof Error?g.message:String(g)}
|
|
568
|
+
`)),process.exit(1);return}let n=ME(t.config);n.length===0&&(process.stderr.write(tn.red("No product config found (events.config.ts / primus.config.ts). Run `npayload init` first.\n")),process.exit(1));let i=qE(t.app),s={...t.config?{config:t.config}:{},...i?{app:i}:{},env:o},c=a(async g=>{process.stdout.write(tn.dim(`
|
|
569
|
+
[${g}] reconciling ${n.length} config(s)\u2026
|
|
570
|
+
`));try{await xe(s)}catch(v){process.stderr.write(tn.red(`${se(`reconcile failed: ${v instanceof Error?v.message:String(v)}`,v)}
|
|
571
|
+
`))}},"reconcile");await c("start"),process.stdout.write(tn.bold(`
|
|
572
|
+
\u{1F440} watching ${n.map(g=>g.replace(process.cwd()+"/","")).join(", ")}
|
|
573
|
+
`)+tn.dim(" edit any to re-reconcile (creates + updates, never deletes) \xB7 run `npayload listen` for a live stream \xB7 Ctrl-C to stop\n"));let u=await Me().catch(()=>null),l=Lt(),d=zt("dev",u,{onRevoked:a(()=>lt(),"onRevoked"),onRefused:l.onRefused}),m=null,p=a(()=>{m&&clearTimeout(m),m=setTimeout(()=>void c("change"),300)},"bump"),f=n.map(g=>LE(g,p));try{await Promise.race([new Promise(g=>{process.on("SIGINT",()=>{d(),process.stdout.write(tn.dim(`
|
|
574
|
+
stopped.
|
|
575
|
+
`)),g()})}),l.ended])}catch(g){m&&clearTimeout(m);for(let v of f)v.close();process.stderr.write(tn.red(`${se(`dev stopped: ${g instanceof Error?g.message:String(g)}`,g)}
|
|
576
|
+
`)),process.exit(1);return}process.exit(0)})}a(fx,"registerDev");var gx="Save the signing secret now: it is shown this once.";function ZE(e,t){let r=a((n,i,s={})=>e.send(ut({row:n,positionals:i,flags:s,newIdempotencyKey:e.newIdempotencyKey})),"call"),o=a((n,i)=>i===void 0?{}:{[n]:i},"optional");return{listChannelWebhooks:a(()=>r(t.list,[]),"listChannelWebhooks"),listAgentWebhookTriggers:a(()=>r(t.triggersList,[],{type:"webhook"}),"listAgentWebhookTriggers"),channel:a(n=>r(t.channelGet,[n]),"channel"),listAgents:a(()=>r(t.agentsList,[]),"listAgents"),createChannelWebhook:a(n=>r(t.create,[],{channelGid:n.channelGid,name:n.name,...o("description",n.description)}),"createChannelWebhook"),createAgentWebhookTrigger:a(n=>r(t.triggersCreate,[],{agentGid:n.agentGid,name:n.name,type:n.type,config:JSON.stringify(n.config),action:JSON.stringify(n.action),...o("description",n.description)}),"createAgentWebhookTrigger"),rotateChannelWebhookSecret:a(n=>r(t.rotateSecret,[n]),"rotateChannelWebhookSecret"),revokeChannelWebhook:a(n=>r(t.revoke,[n]),"revokeChannelWebhook"),removeAgentTrigger:a(n=>r(t.triggersRemove,[n]),"removeAgentTrigger")}}a(ZE,"kernelWebhookDoors");async function Va(e,t){try{await t(ZE(e,await e.rows()))}catch(r){e.printError(Ie(r instanceof Error?r.message:String(r),r)),process.exitCode=r instanceof Xg||r instanceof Y?1:Dt(r)}}a(Va,"run");function hx(e,t){let r=e.commands.find(o=>o.name()==="webhooks")??e.command("webhooks").description("Your incoming webhooks: the channels' and the agents'");r.command("list").description("List your incoming webhooks in one list \u2014 the webhooks that publish into a channel and the webhook triggers that start an agent \u2014 with what each delivers to, its signing secret's state, its last delivery and its status").action(()=>Va(t,async o=>t.print({webhooks:await th(o)}))),r.command("add").description("Add an incoming webhook to a channel (--channel) or to an agent (--agent with --goal); its signing secret is shown once").requiredOption("--name <name>","the webhook's name").option("--channel <channelId>","the channel it publishes into").option("--agent <agentId>","the agent it starts").option("--goal <text>","what the agent does when the webhook fires (with --agent)").option("--description <text>","a description").action(o=>Va(t,async n=>{if(o.channel===void 0==(o.agent===void 0))throw new Y("name exactly one of --channel <channelId> or --agent <agentId>");if(o.agent!==void 0&&(o.goal===void 0||o.goal.trim()===""))throw new Y("--agent needs --goal: what the agent does when the webhook fires");let i=o.description!==void 0?{description:o.description}:{},s=o.channel!==void 0?await cc(n,{channel:o.channel,name:o.name,...i}):await cc(n,{agent:o.agent,name:o.name,goal:o.goal,...i});t.print(s),t.printError(gx)})),r.command("rotate-secret").argument("<webhookId>","the incoming webhook (whk_\u2026)").description("Rotate an incoming webhook's signing secret; the new one is shown once and the previous one keeps verifying for a grace window").action(o=>Va(t,async n=>{t.print(await nh(n,o)),t.printError(gx)})),r.command("revoke").argument("<webhookId>","the incoming webhook (whk_\u2026 for a channel's, trg_\u2026 for an agent's)").description("Revoke an incoming webhook: requests sent to it stop being accepted (asks first; --yes skips the question)").action(o=>Va(t,async n=>{if(eh(o),!await t.confirm(`Revoke the incoming webhook ${o}? Requests sent to it stop being accepted.`)){t.printError(`kept ${o}: nothing was revoked (pass --yes to revoke without asking)`),process.exitCode=1;return}t.print(await rh(n,o))}))}a(hx,"registerIncomingWebhooks");import $t from"chalk";function GE(e){if(Array.isArray(e))return e;let t=e;return t?.data??t?.messages??t?.page??[]}a(GE,"rowsOf");async function yg(e,t,r={}){let o=new Set,n=!0,i=Math.max(500,r.intervalMs??1500);for(;;){let s=r.end?.refusal();if(s!==void 0)throw s;try{let c=await e.send({method:"GET",path:"/v1/channels/{channelId}/messages",pathParams:{channelId:t},query:{limit:25}}),l=GE(c).filter(d=>d.gid&&!o.has(d.gid)).reverse();for(let d of l)if(o.add(d.gid),r.json)process.stdout.write(JSON.stringify({gid:d.gid,routingKey:d.routingKey,payload:d.payload})+`
|
|
577
|
+
`);else{let m=new Date(d.publishedAt??d.createdAt??Date.now()).toLocaleTimeString(),p=`${$t.dim(m)} ${$t.cyan(d.routingKey??"event")} ${JSON.stringify(d.payload).slice(0,160)}`;process.stdout.write(n?$t.dim(p)+`
|
|
578
|
+
`:p+`
|
|
579
|
+
`)}n=!1}catch(c){F(c),process.stderr.write($t.yellow(`tail: ${c instanceof Error?c.message:String(c)} \u2014 retrying
|
|
580
|
+
`))}await new Promise(c=>setTimeout(c,i))}}a(yg,"followChannel");function yx(e){e.command("tail").argument("<channel>","channel slug to watch").description("Watch events arrive on a channel, live (Ctrl-C to stop)").option("--app <appGid>","app GID (default: NPAYLOAD_APP_ID or the project .env)").option("--interval <ms>","poll interval in ms","1500").option("--json","one JSON object per event (NDJSON) \u2014 no decoration").action(async(t,r)=>{try{let o=await It(),n=await Vh(o,r.app);n||(process.stderr.write($t.red(`No app GID. Pass --app or set NPAYLOAD_APP_ID.
|
|
581
|
+
`)),process.exit(1));let i=await o.send({method:"GET",path:"/v1/apps/channels/by-slug/{slug}",pathParams:{slug:t}});i?.gid||(process.stderr.write($t.red(`Channel "${t}" not found under app ${n}.
|
|
582
|
+
`)),process.exit(1)),r.json||process.stdout.write(`
|
|
583
|
+
${Xo("npayload",!1)} ${$t.bold("tail")} ${$t.cyan(t)} ${$t.dim(`(${i.gid}) \xB7 Ctrl-C to stop`)}
|
|
584
|
+
|
|
585
|
+
`);let s=await Me().catch(()=>null),c=Lt(),u=zt("tail",s,{onRevoked:a(()=>lt(),"onRevoked"),onRefused:c.onRefused});process.on("SIGINT",()=>{u(),process.exit(0)}),await yg(o,i.gid,{intervalMs:Number(r.interval)||1500,...r.json?{json:!0}:{},end:c})}catch(o){process.stderr.write($t.red(`${se(`tail failed: ${o instanceof Error?o.message:String(o)}`,o)}
|
|
586
|
+
`)),process.exit(1)}})}a(yx,"registerTail");import ve from"chalk";var VE="2026-09-15.v1",BE="2026-09-15.v1",JE="template",KE="Fees are non-refundable, except when the feed did not deliver, the platform failed, or the charge was wrong.",WE="POST /v1/billing/feed-listings/subscribe-with-saved-card",HE="/settings/billing",vx=/^[a-z0-9-]+$/,YE="Use <publisher-slug>/<listing-slug> (or the alias <publisher-slug>.<listing-slug>), each slug lowercase letters, digits and hyphens [a-z0-9-] \u2014 e.g. `npayload subscribe wickfeed/lit`.";function bg(e){let t=(e??"").trim(),r=t.split("/").length-1,o=t.split(".").length-1;if(r+o===1){let n=r===1?"/":".",i=t.indexOf(n),s=t.slice(0,i),c=t.slice(i+1);if(vx.test(s)&&vx.test(c))return{publisherSlug:s,listingSlug:c,ref:`${s}/${c}`,dotted:n==="."}}throw new C(`"${t}" is not a listing reference.`,{code:"INVALID_LISTING_REF",hint:YE})}a(bg,"parseListingRef");function wg(e,t,r){t.dotted&&e.print(` ${ve.dim(`Using ${t.ref} \u2014 the canonical form of ${r.trim()}.`)}`)}a(wg,"printAliasHint");function vg(e){return e instanceof Error?e.message:String(e)}a(vg,"messageOf");function QE(e){if(!/ACCEPTANCE_REQUIRED/.test(e))return null;let t=a(i=>new RegExp(`${i}:\\s*([^\\s,;)]+)`).exec(e)?.[1],"field"),r=t("subscriberAgreementVersion"),o=t("listingLicenceVersion"),n=/\(version\s*([^)\s]+)\)/.exec(e)?.[1]??t("currentVersion");if(n){let i=/listing_licence/i.test(e)||/licence|license/i.test(e),s=/subscriber_agreement/i.test(e)||/subscriber agreement/i.test(e);i&&!o?o=n:s&&!r&&(r=n)}return!r&&!o?null:{...r?{subscriberAgreementVersion:r}:{},...o?{listingLicenceVersion:o}:{}}}a(QE,"parseStaleAcceptance");function XE(e){if(!/SPEND_CAP_EXCEEDED/.test(e))return null;let t=/approvalRequestId:\s*([^\s,;]+)/.exec(e),r=/expiresAt:\s*([^\s,;]+)/.exec(e);return{...t?{approvalRequestId:t[1]}:{},...r?{expiresAt:r[1]}:{}}}a(XE,"parseSpendCapRefusal");function xx(e){let t=/^([A-Z][A-Z0-9_]{3,})\b/.exec(e.trim());return t?t[1]:null}a(xx,"typedCodeOf");function eT(e,t){let r=xx(e)??t;return new C(e,{code:r})}a(eT,"doorError");function Ba(e,t){if(e instanceof C)return e;let r=vg(e),o=e?.code,n=xx(r)??(typeof o=="string"&&/^[A-Z][A-Z0-9_]{3,}$/.test(o)?o:null)??t;return new C(r,{code:n,...e!==void 0?{cause:e}:{}})}a(Ba,"typedDoorError");function xg(e){let t=(e.env??e.envGid)?.trim();if(t)return{wanted:t,explicit:!0};let r=e.mintedEnvSlug?.trim();if(r)return{wanted:r,explicit:!1};throw new C("No environment. Pass --env <slug>, or select one with `np env use <slug>`.",{code:"ENV_REQUIRED",hint:"List them with `np env list`, then pass --env <slug> or run `np env use <slug>`."})}a(xg,"requireEnvChoice");async function kg(e,t){let r;try{r=await e.send({method:"GET",path:"/v1/feeds/resolve/{publisherSlug}/{listingSlug}",pathParams:{publisherSlug:t.publisherSlug,listingSlug:t.listingSlug},scope:"listings:read"})}catch(o){throw F(o),Ba(o,"RESOLVE_FAILED")}if(!r?.gid)throw new C(`The resolver answered no listing for ${t.ref}.`,{code:"RESOLVE_FAILED",hint:"Try again; if it persists, the catalogue door is not answering."});return r}a(kg,"resolveListingRef");async function _g(e,t,r){let o=await e.send({method:"GET",path:"/v1/account/environments",scope:"account:read"}),i=(Array.isArray(o)?o:o?.environments??[]).find(s=>s.slug===t.wanted||s.gid===t.wanted);if(!i?.gid)throw new C(`No environment "${t.wanted}" on this account.`,{code:"ENV_NOT_FOUND",hint:"List them with `np env list` and pass one of those slugs to --env."});if(t.explicit&&r&&i.slug&&r!==i.slug)throw new C(`This session is authenticated for the "${r}" environment, but --env names "${i.slug}" (${i.gid}).`,{code:"ENV_MINT_MISMATCH",hint:`Run \`np env use ${i.slug}\` (or pass the global --env ${i.slug}) and try again.`});return i}a(_g,"resolveTargetEnvironment");var tT=new Set(["cancelled","expired"]);async function $g(e,t,r){let o;try{o=await e.send({method:"GET",path:"/v1/feeds/subscriptions",scope:"feed:read"})}catch(i){throw F(i),Ba(i,"SUBSCRIPTIONS_UNREADABLE")}return(Array.isArray(o)?o:o?.data??[]).filter(i=>typeof i.gid=="string"&&i.listingGid===t&&!tT.has(i.status??"")&&(i.targetAppGids??[]).includes(r))}a($g,"liveSubscriptionsIn");async function Sg(e,t,r){try{let o=await e.send({method:"GET",path:"/v1/feeds/subscriptions/{subscriptionId}/bindings",pathParams:{subscriptionId:t},scope:"feed:read"}),n=Array.isArray(o)?o:o?.data??[];return(n.find(s=>s.targetAppGid===r)??n[0])?.receivingChannelGid??null}catch(o){return F(o),null}}a(Sg,"receivingChannelOf");function nT(e){let t=e.licence;return t?.version&&t.type?{...t,type:t.type,version:t.version}:{type:JE,version:BE}}a(nT,"resolveListingLicence");function rT(e){return`$${(e/100).toFixed(2)}`}a(rT,"money");function oT(e,t,r){let o=e.pricing,n=o?.model;if(n==="free"||n===void 0)return 0;if(n==="flat_rate"){let i=o?.flatRate;if(!i)throw new C(`The catalogue does not publish a price for ${e.name??e.slug??"this listing"}, so it cannot be shown before you subscribe.`,{code:"LISTING_PRICE_UNAVAILABLE",hint:"Subscribe from the dashboard, which reads the price from the listing itself."});let s=t==="yearly"?i.yearlyPriceCents:i.monthlyPriceCents;if(typeof s!="number")throw new C(`${e.name??e.slug??"This listing"} has no ${t} price.`,{code:"BILLING_CYCLE_UNAVAILABLE",hint:"Run the command again with --billing-cycle monthly."});return s}if(n==="tiered"){if(t==="yearly")throw new C(`${e.name??e.slug??"This listing"} is tiered: tiers carry a monthly price only, so yearly billing is not available.`,{code:"BILLING_CYCLE_UNAVAILABLE",hint:"Run the command again with --billing-cycle monthly."});let i=o?.tiered?.tiers??[],s=(r?i.find(c=>c.name===r):void 0)??i[0];if(!s||typeof s.monthlyPriceCents!="number")throw new C(`${e.name??e.slug??"This listing"} has no tier${r?` named "${r}"`:""}.`,{code:"TIER_NOT_FOUND",hint:"Pass --tier <name> with a tier the listing offers."});return s.monthlyPriceCents}throw new C(`${e.name??e.slug??"This listing"} is priced per message, which this command cannot subscribe to yet.`,{code:"PRICING_MODEL_UNAVAILABLE",hint:"Subscribe to a free, flat-rate or tiered listing, or use the dashboard."})}a(oT,"resolvePrice");function bx(e,t){let r=`${t.listing.name??t.listing.slug??"listing"} (${t.listing.slug??""})`,o=`${t.environment?.name??t.envGid} (${t.envGid})`;e.print(""),e.print(` ${ve.bold("Publisher")} ${t.listing.publisherSlug??""}`),e.print(` ${ve.bold("Listing")} ${r}`),t.listing.description&&e.print(` ${ve.bold("About")} ${t.listing.description}`),iT(e,t.listing.samplePayload),e.print(` ${ve.bold("Price")} ${t.priceInCents>0?`${rT(t.priceInCents)} ${t.billingCycle}`:"free"}`),e.print(` ${ve.bold("Delivers to")} ${o}`),t.sandboxOnly?e.print(` ${ve.dim("This target is a sandbox app: the subscription is free, no card is charged, and delivery pauses at the trial limit until you add a production app.")}`):t.chargeable&&e.print(` ${ve.dim("This target is a production app, so this subscription is a paid one.")}`),e.print(` ${ve.bold("Agreement")} Subscriber Agreement ${t.agreementVersion}`),e.print(` ${ve.bold("Licence")} ${t.licence.type} licence ${t.licence.version}`),e.print(` ${ve.dim(KE)}`),e.print("")}a(bx,"printTerms");function iT(e,t){let r=t?.trim();if(!r){e.print(` ${ve.bold("Sample")} no sample provided by the publisher`);return}let o;try{o=JSON.stringify(JSON.parse(r),null,2).split(`
|
|
587
|
+
`)}catch{o=r.split(`
|
|
588
|
+
`)}e.print(` ${ve.bold("Sample")}`);for(let n of o)e.print(` ${n}`)}a(iT,"printSample");async function wx(e,t){if(t)return;if(!e.isTty)throw new C("Subscribing needs an explicit confirmation, and this session is not interactive.",{code:"CONFIRMATION_REQUIRED",hint:"Run the command again with --yes to accept the terms printed above."});if(!await e.confirm())throw new C("Not subscribed.",{code:"SUBSCRIBE_DECLINED",hint:"Nothing was charged and no subscription was created."})}a(wx,"takeConsent");async function sT(e,t,r){let o=xg(t),n=bg(t.ref);wg(r,n,t.ref);let i=t.billingCycle??"monthly",s=await kg(e,n),c=await _g(e,o,t.mintedEnvSlug),u=c.gid,l=(await $g(e,s.gid,u))[0];if(l){let T=await Sg(e,l.gid,u),M=c.slug??u;throw new C(`Already subscribed to ${n.ref} in ${M} (${l.gid}), delivering to ${T??"a receiving channel not yet bound"}.`,{code:"ALREADY_SUBSCRIBED",hint:"Nothing was sent. "+(T?`Watch it with \`npayload tail ${T}\`, or cancel`:"Cancel")+` it with \`npayload unsubscribe ${n.ref} --env ${M}\`.`})}let d=c.pool==="production"||c.kind==="production",m=oT(s,i,t.tierName),p=nT(s),f=!!s.licence?.version,g=m>0&&d,v=m>0&&!d,h=s.subscriberAgreementVersion??VE,x=p.version,E=f;bx(r,{listing:s,environment:c,envGid:u,priceInCents:m,billingCycle:i,agreementVersion:h,licence:p,chargeable:g,sandboxOnly:v});let k=!1;if(g)throw new C(`${s.name??n.listingSlug} is a paid listing and ${c.name??u} is a production app, so this subscribe has to be charged. The one door that charges and subscribes in a single transaction (${WE}) is not live yet, so the CLI will not charge you: it never runs a charge and a subscribe as two separate calls.`,{code:"PAID_PATH_UNAVAILABLE",hint:`Subscribe to this listing from the dashboard, or with this command point --env at a sandbox app (nothing is charged), or subscribe to a free listing. See ${HE} for your cards.`});await wx(r,t.yes);let O=4,A=null;for(let T=0;;T+=1)try{A=await e.send({method:"POST",path:"/v1/feeds/listings/{listingId}/subscribe",pathParams:{listingId:s.gid},scope:"feed:write",body:{targetAppGids:[u],billingCycle:i,...t.tierName?{tierName:t.tierName}:{},...E?{acceptedSubscriberAgreementVersion:h,acceptedListingLicenceVersion:x}:{}}});break}catch(M){F(M);let J=vg(M),H=XE(J);if(H)throw r.print(""),r.print(` ${ve.yellow("!")} This subscribe is over your organization's agent spend cap.`),H.approvalRequestId&&r.print(` Approval request ${H.approvalRequestId}`),H.expiresAt&&r.print(` Expires ${H.expiresAt}`),r.print(" A billing admin of your organization was emailed to approve it."),new C("Refused by the agent spend cap.",{code:"SPEND_CAP_EXCEEDED",hint:"Run the same command again once a billing admin has approved the request."});let re=QE(J);if(!re||T+1>=O)throw eT(J,"SUBSCRIBE_FAILED");h=re.subscriberAgreementVersion??h,x=re.listingLicenceVersion??x,E=!0,r.print(` ${ve.yellow("!")} The terms this listing is sold under are not the ones shown above. Here they are again.`),bx(r,{listing:s,environment:c,envGid:u,priceInCents:m,billingCycle:i,agreementVersion:h,licence:{...p,version:x},chargeable:g,sandboxOnly:v}),await wx(r,t.yes)}let j=A?.gid;if(!j)throw new C("The subscribe door answered without a subscription gid.",{code:"SUBSCRIBE_FAILED"});let U=a((T,M)=>new C(`Subscribed (${j}), but the receiving channel could not be read: ${T}.`,{code:"RECEIVING_CHANNEL_UNRESOLVED",hint:`The subscription exists \u2014 do not subscribe again. Read it with \`np feed subscriptions get ${j}\`.`,...M!==void 0?{cause:M}:{}}),"bindingFailure"),K;try{K=await e.send({method:"GET",path:"/v1/feeds/subscriptions/{subscriptionId}/bindings",pathParams:{subscriptionId:j},scope:"feed:read"})}catch(T){throw F(T),U("the bindings door refused",T)}let V=Array.isArray(K)?K:K?.data??[],B=(V.find(T=>T.targetAppGid===u)??V[0])?.receivingChannelGid;if(!B)throw U("no delivery binding carries a receiving channel yet");let fe;try{fe=await e.send({method:"GET",path:"/v1/channels/{channelId}",pathParams:{channelId:B},scope:"channels:read"})}catch(T){throw F(T),U(`channel ${B} could not be read`,T)}let ie=fe?.name;if(!ie)throw U(`channel ${B} answered without a name`);let b;try{b=await e.send({method:"GET",path:"/v1/feeds/subscriptions/{subscriptionId}",pathParams:{subscriptionId:j},scope:"feed:read"})}catch(T){throw F(T),new C(`Subscribed (${j}), but the subscription could not be read back: ${vg(T)}.`,{code:"ENTITLEMENT_UNREADABLE",hint:`The subscription exists \u2014 do not subscribe again. Read it with \`np feed subscriptions get ${j}\`.`,cause:T})}return r.print(` ${ve.green("\u2714")} Subscribed. ${ve.dim(j)}`),r.print(` Receiving channel ${ie} (${B})`),r.print(` Entitlement ${b?.environment??"unknown"} \xB7 ${b?.mode??"unknown"} \xB7 ${b?.status??"unknown"}`),r.print(` ${ve.dim(`Watch it: npayload tail ${ie}`)}`),t.tail&&r.tail&&await r.tail(B),{subscriptionGid:j,receivingChannelGid:B,receivingChannelName:ie,charged:k,listingGid:s.gid,priceInCents:m,billingCycle:i,acceptedSubscriberAgreementVersion:h,acceptedListingLicenceVersion:x,entitlement:{...b?.environment?{environment:b.environment}:{},...b?.mode?{mode:b.mode}:{},...b?.status?{status:b.status}:{}}}}a(sT,"runSubscribe");function kx(e,t={}){e.command("subscribe").argument("<listing>","listing reference: <publisher-slug>/<listing-slug> (or <publisher-slug>.<listing-slug>), e.g. wickfeed/lit").description("Subscribe this organization to a feed listing by its name and print the channel it arrives on").option("--env <slug>","environment that receives the feed, by slug (a gid is also accepted); defaults to the active environment").option("--billing-cycle <cycle>","monthly | yearly","monthly").option("--tier <name>","tier name, for a tiered listing").option("--yes","accept the printed terms without a prompt").option("--tail","after subscribing, follow the receiving channel until interrupted").action(async(r,o)=>{let n=t.resolveKernel;if(!n)throw new C("No credentials resolver is wired for `subscribe`.",{code:"NOT_AUTHENTICATED",hint:"Run `np login` and try again."});let i=await n(),s=t.tail,c=t.confirm,u={print:a(d=>process.stdout.write(`${d}
|
|
589
|
+
`),"print"),confirm:a(async()=>c?c("Accept these terms and subscribe?"):!1,"confirm"),isTty:!!(process.stdin.isTTY&&process.stdout.isTTY),...s?{tail:a(d=>s(i,d),"tail")}:{}},l=t.mintedEnvSlug?t.mintedEnvSlug():void 0;await sT(i,{ref:r,...o.env?{env:o.env}:{},...l?{mintedEnvSlug:l}:{},yes:o.yes??(t.yes?t.yes():!1),...o.tail?{tail:!0}:{},...o.billingCycle?{billingCycle:o.billingCycle}:{},...o.tier?{tierName:o.tier}:{}},u)})}a(kx,"registerSubscribe");import Ig from"chalk";async function aT(e,t,r){let o=xg(t),n=bg(t.ref);wg(r,n,t.ref);let i=await kg(e,n),s=await _g(e,o,t.mintedEnvSlug),c=s.slug??s.gid,u=await $g(e,i.gid,s.gid);if(u.length===0)throw new C(`No live subscription to ${n.ref} in ${c}.`,{code:"NOT_SUBSCRIBED",hint:"Nothing was cancelled. Check the listing reference and --env."});if(u.length>1){let d=await Promise.all(u.map(async m=>{let p=await Sg(e,m.gid,s.gid);return`${m.gid} \u2192 ${p??"no receiving channel bound"}`}));r.print(` ${Ig.yellow("!")} ${u.length} live subscriptions to ${n.ref} in ${c}:`);for(let m of d)r.print(` ${m}`);throw new C(`${u.length} live subscriptions to ${n.ref} in ${c} (${d.join("; ")}); none was cancelled.`,{code:"MULTIPLE_SUBSCRIPTIONS",hint:"Cancel the one you mean from the dashboard (Feed \u2192 Subscriptions)."})}let l=u[0];try{await e.send({method:"DELETE",path:"/v1/feeds/subscriptions/{subscriptionId}",pathParams:{subscriptionId:l.gid},scope:"feed:write"})}catch(d){throw F(d),Ba(d,"UNSUBSCRIBE_FAILED")}return r.print(` ${Ig.green("\u2714")} Unsubscribed ${n.ref} in ${c}. ${Ig.dim(l.gid)}`),{ref:n.ref,environment:c,subscriptionGid:l.gid}}a(aT,"runUnsubscribe");function _x(e,t={}){e.command("unsubscribe").argument("<listing>","listing reference: <publisher-slug>/<listing-slug> (or <publisher-slug>.<listing-slug>), e.g. wickfeed/lit").description("Cancel this organization's subscription to a feed listing, by its name").option("--env <slug>","environment whose subscription to cancel, by slug (a gid is also accepted); defaults to the active environment").action(async(r,o)=>{let n=t.resolveKernel;if(!n)throw new C("No credentials resolver is wired for `unsubscribe`.",{code:"NOT_AUTHENTICATED",hint:"Run `np login` and try again."});let i=await n(),s=t.mintedEnvSlug?t.mintedEnvSlug():void 0;await aT(i,{ref:r,...o.env?{env:o.env}:{},...s?{mintedEnvSlug:s}:{}},{print:a(c=>process.stdout.write(`${c}
|
|
590
|
+
`),"print")})})}a(_x,"registerUnsubscribe");import Ce from"chalk";import hr from"chalk";function $x(e){return typeof e=="object"&&e!==null&&typeof e.tier=="string"}a($x,"isAccountStatus");function Sx(e){let t=[],r=hr.bold(e.tier);if(e.trialExpired)r+=" "+hr.red("trial expired");else if(e.inTrial){let n=typeof e.trialDaysLeft=="number"?`${e.trialDaysLeft} day${e.trialDaysLeft===1?"":"s"} left`:"active";r+=" "+hr.yellow(`trial \u2014 ${n}`)}return t.push(`${hr.dim("Plan")} ${r}`),(e.trialExpired||e.inTrial===!0||e.converted===!1)&&typeof e.upgradeUrl=="string"&&e.upgradeUrl.length>0&&t.push(`${hr.dim("Upgrade")} ${hr.cyan(e.upgradeUrl)}`),t}a(Sx,"renderPlanLines");function Ix(e={}){return{write:e.write??(t=>void process.stdout.write(t)),error:e.error??(t=>void process.stderr.write(t)),exit:e.exit??(t=>process.exit(t))}}a(Ix,"ioOf");async function cT(e){let t=Ix(e.io),r=await e.resolveSession();if(!r){t.error(Ce.red("Not signed in.")+" Run `npayload login` to authenticate.\n"),t.exit(1);return}let o,n;try{({sid:o,label:n}=await r.whoami())}catch(c){if(c instanceof xr){lt({write:t.error,exit:t.exit});return}F(c),o=r.sessionId(),n=null}t.write(`${Ce.dim("Session")} ${o?Ce.cyan(o):Ce.dim("(unknown)")}
|
|
591
|
+
`),t.write(`${Ce.dim("Device")} ${n?Ce.bold(n):Ce.dim("(unavailable \u2014 could not reach npayload)")}
|
|
592
|
+
`);let i=e.resolveContext?await e.resolveContext(r):mc(r),s=a(c=>c?Ce.bold(c):Ce.dim("(none)"),"show");if(t.write(`${Ce.dim("Org")} ${s(i.org)}
|
|
593
|
+
`),t.write(`${Ce.dim("App")} ${s(i.app)}
|
|
594
|
+
`),t.write(`${Ce.dim("Env")} ${s(i.env)}
|
|
595
|
+
`),e.fetchAccountStatus){let c=await e.fetchAccountStatus().catch(u=>(F(u),null));if(c&&$x(c))for(let u of Sx(c))t.write(u+`
|
|
596
|
+
`)}t.exit(0)}a(cT,"runWhoami");async function uT(e,t){let r=Ix(t.io),o=await t.resolveSession();if(!o){r.write(Ce.dim(`Already signed out.
|
|
597
|
+
`)),r.exit(0);return}e.all?(await o.logoutAll(),r.write(Ce.green("\u2713")+` Signed out of ALL your npayload CLI sessions.
|
|
598
|
+
`)):(await o.logout(),r.write(Ce.green("\u2713")+` Signed out of this npayload CLI session.
|
|
599
|
+
`)),r.exit(0)}a(uT,"runLogout");function Px(e,t){let r={...t,resolveSession:a(()=>Me(),"resolveSession"),resolveContext:a(o=>{let n=e.opts().env;return mc(o,typeof n=="string"&&n.trim()!==""?{explicitEnv:n}:{})},"resolveContext")};e.command("whoami").description("Show the current CLI session id, device label, and active org / app / env context").action(async()=>{await cT(r)}),e.command("logout").description("Sign out this CLI session (revoke it server-side and clear local credentials)").option("--all","revoke ALL of your CLI sessions across every device, not just this one").action(async o=>{await uT({all:o.all===!0},r)})}a(Px,"registerSessionCommands");import hT from"chalk";function it(e){return typeof e=="object"&&e!==null?e:{}}a(it,"rec");function Se(e){return typeof e=="string"&&e.length>0?e:void 0}a(Se,"asString");var st={accepted:a(e=>({conversationId:Se(it(e).conversationId)}),"accepted"),phaseChange:a(e=>{let t=it(e);return{from:Se(t.from),to:Se(t.to),reason:Se(t.reason)}},"phaseChange"),toolStart:a(e=>{let t=it(e);return{toolCallId:Se(t.toolCallId),toolName:Se(t.toolName),arguments:t.arguments}},"toolStart"),toolEnd:a(e=>{let t=it(e);return{toolCallId:Se(t.toolCallId),success:t.success===!0,result:t.result,durationMs:typeof t.durationMs=="number"?t.durationMs:void 0}},"toolEnd"),turnComplete:a(e=>{let t=it(e);return{turnNumber:typeof t.turnNumber=="number"?t.turnNumber:void 0,tokensUsed:typeof t.tokensUsed=="number"?t.tokensUsed:void 0}},"turnComplete"),contentDelta:a(e=>({content:Se(it(e).content)}),"contentDelta"),executionComplete:a(e=>{let t=it(e),r=it(t.usage);return{text:Se(t.text),usage:{promptTokens:typeof r.promptTokens=="number"?r.promptTokens:void 0,completionTokens:typeof r.completionTokens=="number"?r.completionTokens:void 0,totalTokens:typeof r.totalTokens=="number"?r.totalTokens:void 0}}},"executionComplete"),response:a(e=>({text:Se(it(e).text)}),"response"),done:a(e=>{let t=it(e);return{conversationId:Se(t.conversationId),executionId:Se(t.executionId),status:Se(t.status)}},"done"),error:a(e=>{let t=it(e);return{message:Se(t.message),code:Se(t.code),kind:Se(t.kind)}},"error")};function Pg(e,t=60){if(e==null)return"";let r;if(typeof e=="string")r=e;else try{r=JSON.stringify(e)}catch{r=String(e)}return r=r.replace(/\s+/g," ").trim(),r.length>t&&(r=`${r.slice(0,Math.max(0,t-1))}\u2026`),r}a(Pg,"previewOneLine");function Eg(e){return typeof e!="number"||!Number.isFinite(e)||e<0?"":e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}a(Eg,"formatDuration");function Ja(e){return{rendered:"",openTools:new Map,done:!1,startedAt:e}}a(Ja,"initialTurnState");function lT(e,t){return t===e?null:t.startsWith(e)?t.slice(e.length):e.startsWith(t)?null:`
|
|
600
|
+
${t}`}a(lT,"contentSuffix");function Ka(e,t,r=e.startedAt){let o={...e,openTools:new Map(e.openTools)},n=[];switch(t.event){case"accepted":{let i=st.accepted(t.data);i.conversationId&&(o.conversationId=i.conversationId),n.push({kind:"spinner",text:"thinking\u2026"});break}case"phase_change":{let i=st.phaseChange(t.data);i.to&&(o.phase=i.to,n.push({kind:"phase",text:i.reason?`\u203A ${i.to} \u2014 ${i.reason}`:`\u203A ${i.to}`}),n.push({kind:"spinner",text:`${i.to}\u2026`}));break}case"tool_call_start":{let i=st.toolStart(t.data),s=i.toolCallId??`tool-${o.openTools.size}`,c=i.toolName??"tool";o.openTools.set(s,{name:c});let u=Pg(i.arguments,48);n.push({kind:"tool_start",id:s,text:u?`${c} ${u}`:c}),n.push({kind:"spinner",text:`running ${c}\u2026`});break}case"tool_call_end":{let i=st.toolEnd(t.data),s=i.toolCallId??"",c=(s&&o.openTools.get(s)?.name)??"tool";s&&o.openTools.delete(s);let u=Eg(i.durationMs),l=!i.success&&i.result!==void 0?` ${Pg(i.result,60)}`:"";n.push({kind:"tool_end",id:s,ok:i.success===!0,text:`${c}${u?` (${u})`:""}${l}`}),n.push({kind:"spinner",text:`${o.phase??"working"}\u2026`});break}case"turn_complete":{let i=st.turnComplete(t.data);if(i.turnNumber!==void 0){let s=i.tokensUsed!==void 0?` \xB7 ${i.tokensUsed} tokens`:"";n.push({kind:"phase",text:`\u203A turn ${i.turnNumber}${s}`})}break}case"content_delta":{let i=st.contentDelta(t.data);if(i.content!==void 0){let s=lT(o.rendered,i.content);s!==null&&s.length>0&&(o.rendered=i.content,n.push({kind:"content",text:s}))}break}case"execution_complete":{let i=st.executionComplete(t.data);i.usage&&(o.usage=i.usage),i.text&&o.rendered===""&&(o.rendered=i.text,n.push({kind:"content",text:i.text}));break}case"response":{let i=st.response(t.data);i.text&&o.rendered===""&&(o.rendered=i.text,n.push({kind:"content",text:i.text}));break}case"done":{let i=st.done(t.data);i.conversationId&&(o.conversationId=i.conversationId),i.executionId&&(o.executionId=i.executionId),o.status=i.status??"completed",o.done=!0;let s=[o.status];if(o.usage?.totalTokens!==void 0){let u=o.usage.promptTokens!==void 0&&o.usage.completionTokens!==void 0?` (${o.usage.promptTokens}+${o.usage.completionTokens})`:"";s.push(`${o.usage.totalTokens} tokens${u}`)}let c=r-o.startedAt;c>0&&s.push(Eg(c)),o.status!=="completed"&&o.status!=="cancelled"&&n.push({kind:"error",text:`run ${o.status}`}),n.push({kind:"meta",text:`\u23FA ${s.filter(Boolean).join(" \xB7 ")}`}),n.push({kind:"end"});break}case"error":{let i=st.error(t.data);o.status="failed",o.done=!0;let s=oy(i);n.push({kind:"error",text:s.message,code:i.kind??i.code}),s.hint&&n.push({kind:"meta",text:`\u2192 ${s.hint}`}),n.push({kind:"end"});break}default:break}return{state:o,actions:n}}a(Ka,"reduceChatEvent");import at from"chalk";var Ex={out:a(e=>process.stdout.write(e),"out"),err:a(e=>process.stderr.write(e),"err")},yr=class{static{a(this,"ChatRenderer")}spinner=null;spinnerRetired=!1;contentOpen=!1;sinks;interactive;constructor(t){this.sinks=t?.sinks??Ex,this.interactive=t?.interactive??process.stderr.isTTY===!0}beginTurn(){this.spinnerRetired=!1,this.contentOpen=!1}spin(t){!this.interactive||this.spinnerRetired||(this.spinner?this.spinner.text=t:this.spinner=new Pn(t).start())}pauseSpinner(){this.spinner?.stop()}resumeSpinner(){!this.spinnerRetired&&this.interactive&&this.spinner?.start()}retireSpinner(){this.spinner?.stop(),this.spinner=null,this.spinnerRetired=!0}stepLine(t){this.pauseSpinner(),this.contentOpen&&(this.sinks.out(`
|
|
601
|
+
`),this.contentOpen=!1),this.sinks.err(`${t}
|
|
602
|
+
`),this.resumeSpinner()}apply(t){switch(t.kind){case"spinner":this.spin(at.dim(t.text));break;case"phase":this.stepLine(at.dim(t.text));break;case"tool_start":this.stepLine(at.dim(` \u2699 ${t.text}`));break;case"tool_end":this.stepLine(t.ok?at.dim(` ${at.green("\u2713")} ${t.text}`):` ${at.red("\u2717")} ${at.dim(t.text)}`);break;case"content":this.retireSpinner(),this.sinks.out(t.text),this.contentOpen=!t.text.endsWith(`
|
|
603
|
+
`);break;case"meta":this.retireSpinner(),this.contentOpen&&(this.sinks.out(`
|
|
604
|
+
`),this.contentOpen=!1),this.sinks.err(`${at.dim(t.text)}
|
|
605
|
+
`);break;case"error":this.retireSpinner(),this.contentOpen&&(this.sinks.out(`
|
|
606
|
+
`),this.contentOpen=!1),this.sinks.err(`${at.red(`\u2717 ${t.text}`)}${t.code?at.dim(` [${t.code}]`):""}
|
|
607
|
+
`);break;case"end":this.retireSpinner(),this.contentOpen&&(this.sinks.out(`
|
|
608
|
+
`),this.contentOpen=!1);break}}interrupt(t){this.retireSpinner(),this.contentOpen&&(this.sinks.out(`
|
|
609
|
+
`),this.contentOpen=!1),this.sinks.err(`${at.dim(t)}
|
|
610
|
+
`)}},Wa=class{constructor(t=Ex){this.sinks=t}static{a(this,"NdjsonRenderer")}onEvent(t){this.sinks.out(`${JSON.stringify({event:t.event,data:t.data})}
|
|
611
|
+
`)}};function dT(e){return e?/nonce="([^"]+)"/.exec(e)?.[1]:void 0}a(dT,"parseDpopNonce");var pT="executions:execute";async function*Fo(e,t,r,o,n){let i=Nt(In(e)??ze(),n?.fetchImpl),s=`${t.replace(/\/+$/,"")}/v1/primus/chat/stream-pipeline`,c=JSON.stringify({agentGid:r.agentGid,input:r.input,...r.conversationGid?{conversationGid:r.conversationGid}:{}}),u=a(async()=>{In(e)?.check(s);let d=await e.auth.getAccessToken([pT]),m=await e.auth.signDpopProof({method:"POST",url:s,accessToken:d.token});return i(s,{method:"POST",headers:{Authorization:`DPoP ${d.token}`,DPoP:m,Accept:"text/event-stream","content-type":"application/json"},body:c,signal:o})},"doFetch"),l=await u();if(l.status===401){let d=dT(l.headers.get("www-authenticate"));d&&(e.auth.cacheNonce(new URL(s).origin,d),l=await u())}if(!l.ok){let d="";try{d=(await l.text()).slice(0,300)}catch{}throw new C(`chat stream request failed (${l.status})${d?`: ${d}`:""}`,{code:l.status===401||l.status===403?"CHAT_AUTH":l.status===404?"PRIMUS_UNREACHABLE":"CHAT_STREAM_FAILED",hint:l.status===403?"your credential is missing the executions:execute scope \u2014 re-run `npayload push` (permissions sync) or grant it in the dashboard":l.status===404?"the chat route was not found at this endpoint \u2014 check NPAYLOAD_PRIMUS_API_URL (or --api-url) names your AI endpoint":void 0})}if(!l.body)throw new C("chat stream returned no body",{code:"CHAT_STREAM_FAILED"});for await(let d of Zg(l.body))yield{event:d.event??"message",data:d.data}}a(Fo,"streamChatTurn");function Ha(e){let t=e;return(Array.isArray(t)?t:Array.isArray(t?.data)?t.data:[]).filter(o=>typeof o=="object"&&o!==null)}a(Ha,"rowsOf");var ct=a(e=>typeof e=="string"&&e?e:void 0,"str");async function qo(e){let t=await e.send({method:"GET",path:"/v1/primus/agents",query:{activeOnly:!0},scope:"agents:read"});return Ha(t).map(r=>({gid:ct(r.gid)??"",name:ct(r.name)??"(unnamed)",description:ct(r.description),status:ct(r.status)})).filter(r=>r.gid&&(r.status===void 0||r.status==="active"))}a(qo,"listActiveAgents");function Ya(e,t){let r=e.find(i=>i.gid===t);if(r)return r;let o=t.toLowerCase(),n=e.filter(i=>i.name.toLowerCase()===o);if(n.length===1)return n[0];throw n.length>1?new C(`agent name "${t}" is ambiguous (${n.length} matches)`,{code:"AGENT_AMBIGUOUS",hint:`use the gid: ${n.map(i=>i.gid).join(" | ")}`}):new C(`no active agent matches "${t}"`,{code:"AGENT_NOT_FOUND",hint:e.length?`available: ${e.slice(0,8).map(i=>i.name).join(", ")}`:"no active agents in this app \u2014 create one first (np primus agents create / dashboard)"})}a(Ya,"resolveAgent");async function Tx(e,t){let r=await e.send({method:"GET",path:"/v1/primus/conversations/by-agent",query:{agentGid:t},scope:"conversations:read"});return Ha(r).map(o=>({id:ct(o.gid)??"",title:ct(o.title),updatedAt:typeof o.updatedAt=="number"?o.updatedAt:typeof o.lastMessageAt=="number"?o.lastMessageAt:void 0})).filter(o=>o.id)}a(Tx,"listConversationsByAgent");async function Ax(e,t,r=10){let o=await e.send({method:"GET",path:"/v1/primus/conversations/{conversationId}/messages",pathParams:{conversationId:t},query:{messageLimit:r},scope:"conversations:read"}),n=o??{};return(Array.isArray(n.messages)?n.messages:Ha(o)).filter(s=>typeof s=="object"&&s!==null).map(s=>({role:ct(s.role)??"message",content:ct(s.content)??JSON.stringify(s.content??"").slice(0,200)})).slice(-r)}a(Ax,"getConversationMessages");async function Cx(e,t){try{let r=await e.send({method:"GET",path:"/v1/primus/executions/by-conversation",query:{conversationGid:t,limit:5},scope:"executions:read"}),o=Ha(r).find(i=>ct(i.status)==="running"||ct(i.status)==="pending"),n=o?ct(o.gid):void 0;return n?(await e.send({method:"POST",path:"/v1/primus/executions/{executionId}/cancel",pathParams:{executionId:n},body:{reason:"interrupted from np primus chat"},scope:"executions:execute"}),!0):!1}catch(r){return F(r),!1}}a(Cx,"cancelRunningExecution");import{createInterface as mT}from"readline/promises";import pe from"chalk";function Rx(e){let t=e.trim();if(!t.startsWith("/"))return null;let[r,...o]=t.slice(1).split(/\s+/),n=o.join(" ").trim()||void 0;switch((r??"").toLowerCase()){case"help":case"h":case"?":return{kind:"help"};case"exit":case"quit":case"q":return{kind:"exit"};case"new":return{kind:"new"};case"resume":return{kind:"resume"};case"info":return{kind:"info"};case"agent":return{kind:"agent",ref:n};default:return{kind:"unknown",raw:t}}}a(Rx,"parseSlashCommand");var Ox=["commands:"," /agent [name|gid] switch agent (picker when no argument; resets the conversation)"," /new start a fresh conversation with the current agent"," /resume pick one of this agent's conversations to continue"," /info show current agent, conversation, and endpoint"," /help this help"," /exit leave the chat","","Ctrl-C during a reply interrupts the run (best-effort server cancel);","at the prompt it exits. Messages are single-line in this version."].join(`
|
|
612
|
+
`);var Je=a(e=>{process.stderr.write(e)},"err");async function Tg(e,t,r={}){let o=await qo(e);if(o.length===0){let{CliError:n}=await import("../chunk-4HVQZC7R.mjs");throw new n("no active agents in this app",{code:"NO_AGENTS",hint:"create one first: np primus agents create --name \u2026 (or use the dashboard), then re-run np primus chat"})}return o.length===1?o[0]:(r.select??He)("Pick an agent",o.map(n=>({name:n.gid===t?.gid?`${n.name} (current)`:n.name,value:n,description:n.description})))}a(Tg,"pickAgent");async function Nx(e,t,r={}){let o=r.err??Je,n=await Tx(e,t.gid);if(n.length===0){o(pe.dim(`no previous conversations with ${t.name} \u2014 starting fresh
|
|
613
|
+
`));return}let i=await(r.select??He)(`Resume a conversation with ${t.name}`,n.slice(0,20).map(s=>({name:s.title??s.id,value:s.id,description:s.updatedAt?new Date(s.updatedAt).toLocaleString():void 0})));try{let s=await Ax(e,i,10);if(s.length){o(pe.dim("\u2500".repeat(40)+`
|
|
614
|
+
`));for(let c of s){let u=c.role==="user"?"you":c.role;o(pe.dim(`${u}: ${c.content.split(`
|
|
615
|
+
`)[0].slice(0,120)}
|
|
616
|
+
`))}o(pe.dim("\u2500".repeat(40)+`
|
|
617
|
+
`))}}catch(s){F(s)}return i}a(Nx,"pickConversation");async function fT(e,t,r,o,n,i,s={}){let c=Ja(Date.now());n.beginTurn();let u=Fo(e,t,{agentGid:r.agent.gid,input:o,conversationGid:r.conversationId},i,s.fetchImpl?{fetchImpl:s.fetchImpl}:void 0);for await(let l of u){let d=Ka(c,l,Date.now());c=d.state;for(let m of d.actions)n.apply(m);if(c.conversationId&&(r.conversationId=c.conversationId),c.done)break}return c}a(fT,"runTurn");async function gT(e,t,r,o,n,i,s={}){let c=s.err??Je;try{return await fT(e,t,r,o,n,i.signal,s),c(`
|
|
618
|
+
`),{interrupted:!1,cancelled:!1}}catch(u){if(!i.signal.aborted)throw u;n.interrupt("\u23F9 interrupted");let l=!1;if(r.conversationId){let d;l=await Promise.race([Cx(e,r.conversationId),new Promise(m=>{d=setTimeout(()=>m(!1),s.cancelTimeoutMs??2e3)})]),d&&clearTimeout(d),c(pe.dim(l?`\xB7 run cancelled server-side
|
|
619
|
+
|
|
620
|
+
`:`\xB7 could not confirm server-side cancel \u2014 the run may finish anyway
|
|
621
|
+
|
|
622
|
+
`))}else c(pe.dim(`\xB7 no conversation yet \u2014 nothing to cancel server-side
|
|
623
|
+
|
|
624
|
+
`));return{interrupted:!0,cancelled:l}}}a(gT,"runInterruptibleTurn");async function Dx(e,t,r,o){o.resume&&(r.conversationId=await Nx(e,r.agent));let n=mT({input:process.stdin,output:process.stderr}),i=new yr,s=!1,c=null,u=!1;for(n.on("SIGINT",()=>{if(s&&c){c.abort();return}u=!0,n.close()}),Je(pe.dim(`chatting with ${pe.bold(r.agent.name)} \xB7 ${r.conversationId?`resuming ${r.conversationId}`:"new conversation"} \xB7 /help for commands \xB7 Ctrl-C to leave
|
|
625
|
+
|
|
626
|
+
`));!u;){let l;try{l=await n.question(pe.cyan("\u276F "))}catch{break}let d=l.trim();if(!d)continue;let m=Rx(d);if(m){switch(m.kind){case"help":Je(`${pe.dim(Ox)}
|
|
627
|
+
`);break;case"exit":u=!0;break;case"new":r.conversationId=void 0,Je(pe.dim(`started a new conversation
|
|
628
|
+
`));break;case"resume":try{let p=await Nx(e,r.agent);p&&(r.conversationId=p)}catch(p){Je(pe.red(`${se(p instanceof Error?p.message:String(p),p)}
|
|
629
|
+
`))}break;case"agent":try{let p=m.ref?Ya(await qo(e),m.ref):await Tg(e,r.agent);p.gid!==r.agent.gid&&(r.agent=p,r.conversationId=void 0,Je(pe.dim(`switched to ${p.name} (new conversation)
|
|
630
|
+
`)))}catch(p){Je(pe.red(`${se(p instanceof Error?p.message:String(p),p)}
|
|
631
|
+
`))}break;case"info":Je(pe.dim([`agent ${r.agent.name} (${r.agent.gid})`,`conversation ${r.conversationId??"(new \u2014 created on first message)"}`,`endpoint ${t}`].join(`
|
|
632
|
+
`)+`
|
|
633
|
+
`));break;case"unknown":Je(pe.dim(`unknown command ${m.raw} \u2014 /help
|
|
634
|
+
`));break}continue}s=!0,c=new AbortController;try{await gT(e,t,r,d,i,c)}catch(p){let f=oi(p),g=f instanceof Error?f.message:String(f),v=f?.hint;Je(pe.red(`\u2717 ${se(g,p)}
|
|
635
|
+
`)+(v?pe.dim(` ${v}
|
|
636
|
+
`):"")+`
|
|
637
|
+
`)}finally{s=!1,c=null}}n.close(),Je(pe.dim(`bye
|
|
638
|
+
`))}a(Dx,"runChatRepl");function yT(e,t){if(e.json&&!e.message)throw new C("--json requires --message (NDJSON output is one-shot only)",{code:"JSON_REQUIRES_MESSAGE",hint:'np primus chat --agent <ref> --message "\u2026" --json'});if(e.message){if(!e.agent&&!t)throw new C("--message without a TTY also needs --agent",{code:"AGENT_REQUIRED",hint:'np primus chat --agent <gid|name> --message "\u2026"'});return"oneshot"}if(!t)throw new C("interactive chat needs a TTY",{code:"NO_TTY",hint:'for scripts/CI use one-shot mode: np primus chat --agent <ref> --message "\u2026" [--json]'});return"repl"}a(yT,"assertChatInvocation");async function vT(e){let{buildKernel:t}=await import("../chunk-2PCG57PX.mjs"),r=e??ne(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl"),o=await t(r),n=r??ne(process.env.NPAYLOAD_API_URL,"apiUrl","https://api.npayload.com");return{kernel:o,baseUrl:n}}a(vT,"resolveChatKernel");async function bT(e,t,r,o,n,i={}){let s=i.fetchImpl?{fetchImpl:i.fetchImpl}:void 0,c=new AbortController,u=a(()=>c.abort(),"onSignal");process.on("SIGINT",u);try{let l;if(n){let m=new Wa(i.sinks);for await(let p of Fo(e,t,{agentGid:r.gid,input:o},c.signal,s)){if(m.onEvent(p),p.event==="done"){l=(p.data??{}).status;break}if(p.event==="error"){l="failed";break}}}else{let m=new yr(i.sinks?{sinks:i.sinks}:void 0);m.beginTurn();let p=Ja(Date.now()),f=Fo(e,t,{agentGid:r.gid,input:o},c.signal,s);for await(let g of f){let v=Ka(p,g,Date.now());p=v.state;for(let h of v.actions)m.apply(h);if(p.done)break}l=p.status}let d=l==="completed"?0:1;return process.exitCode=d,d}finally{process.off("SIGINT",u)}}a(bT,"runOneShot");function jx(e){e.command("chat").description("chat with an agent \u2014 streams the run's steps (phases, tool calls) and the reply live").option("--agent <ref>","agent gid or name (picker on a TTY when omitted)").option("--resume","pick one of the agent's conversations to continue").option("--message <text>","one-shot: send one message, print the reply, exit").option("--json","one-shot only: emit the raw stream as NDJSON").option("--api-url <url>","override the AI endpoint (defaults to npayload's own)").action(async t=>{try{let r=yT(t,je()),{kernel:o,baseUrl:n}=await vT(t.apiUrl),i;try{i=await qo(o)}catch(u){let l=u?.status;throw l===404?new C("the AI endpoint is not reachable at this base URL",{code:"PRIMUS_UNREACHABLE",hint:"check NPAYLOAD_PRIMUS_API_URL (or --api-url) names your AI endpoint",cause:u}):l===403?new C("your credential is missing the agents:read scope",{code:"CHAT_AUTH",hint:"re-run `npayload push` (permissions sync) or grant the ai scopes in the dashboard",cause:u}):u}let s=t.agent?Ya(i,t.agent):r==="oneshot"?(()=>{if(i.length===1)return i[0];throw new C("--message needs --agent when more than one agent exists",{code:"AGENT_REQUIRED",hint:`available: ${i.slice(0,8).map(u=>u.name).join(", ")}`})})():await Tg(o);if(r==="oneshot"){await bT(o,n,s,t.message,t.json===!0);return}await Dx(o,n,{agent:s},{resume:t.resume===!0})}catch(r){(r instanceof C||r instanceof be)&&de(r),process.stderr.write(hT.red(`\u2717 ${r instanceof Error?r.message:String(r)}
|
|
639
|
+
`)),process.exitCode=1}})}a(jx,"registerChat");import me from"chalk";import{readFileSync as wT,writeFileSync as Ux}from"fs";import{resolve as xT}from"path";function Lx(e,t){let r=[];for(let o of _r()){let n=e[o];if(n)for(let[i,s]of Object.entries(n))for(let c of un(o)){let u=ni(Tn(s,c.path))??[],l=new Map;for(let f of Object.keys(e[c.parent]??{}))l.set(f,{name:f,source:"config"});for(let f of t[c.parent]??[]){let g=l.get(f.name);l.set(f.name,{name:f.name,source:g?.source??"live",gid:f.gid??g?.gid})}let d=[...l.values()].sort((f,g)=>f.name.localeCompare(g.name)),m=new Set(d.map(f=>f.name)),p=u.filter(f=>!m.has(f));r.push({resource:o,key:i,spec:c,current:u,candidates:d,dangling:p})}}return r}a(Lx,"computeWiringSlots");function kT(e,t,r){if(Lh(e.current,t))return null;let o=e.spec.array?t:t[0]??null,n=t.map(s=>e.candidates.find(c=>c.name===s)?.gid).filter(s=>!!s),i=n.length?`// ${r}: ${n.join(", ")}`:void 0;return{resource:e.resource,key:e.key,field:e.spec.path,kind:"update-field",value:o,...i?{trailingComment:i}:{}}}a(kT,"slotToChange");function _T(e){let t=e.current.length?e.current.join(", "):me.dim("(none)"),r=e.dangling.length?me.red(` \u26A0 not found: ${e.dangling.join(", ")}`):"";return`${e.resource} "${e.key}" \u2192 ${e.spec.label}: ${t}${r}`}a(_T,"describeSlot");var $T={agents:"/v1/primus/agents",skills:"/v1/primus/skills",tools:"/v1/primus/tools"};async function ST(e,t){let r={},o=ne(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl"),n;try{n=await It(o,t)}catch(s){return e(me.yellow(` \u2022 live topology unavailable (${s instanceof Error?s.message:String(s)}) \u2014 using config-declared candidates only
|
|
640
|
+
`)),r}let i=new Set;for(let s of _r())for(let c of un(s))i.add(c.parent);for(let s of i){let c=$T[s];if(c)try{let u=await n.send({method:"GET",path:c}),l=IT(u);r[s]=l.map(d=>({name:typeof d.name=="string"?d.name:"",gid:typeof d.gid=="string"?d.gid:void 0})).filter(d=>d.name)}catch(u){F(u),e(me.yellow(` \u2022 could not list ${s} (${u instanceof Error?u.message:String(u)})
|
|
641
|
+
`))}}return r}a(ST,"fetchLive");function IT(e){let t=e;return(Array.isArray(t)?t:Array.isArray(t.data)?t.data:[]).filter(o=>typeof o=="object"&&o!==null)}a(IT,"extractRows");async function PT(e){let t=e.sink??(u=>void process.stdout.write(u)),r={checkbox:dy,select:He,confirm:ly,...e.prompts},o=Lx(e.config,e.live);t(me.bold(`
|
|
642
|
+
Wiring relationships (env: ${e.env}) \u2014 Enter to keep a slot unchanged
|
|
643
|
+
|
|
644
|
+
`));let n=[];for(let u of o){if(u.candidates.length===0){t(me.dim(` ${u.resource} "${u.key}" \u2192 ${u.spec.label}: no candidates yet (declare some ${u.spec.parent} first)
|
|
645
|
+
`));continue}let l=u.candidates.map(p=>({name:p.source==="live"&&!Object.keys(e.config[u.spec.parent]??{}).includes(p.name)?`${p.name} ${me.dim("(live)")}`:p.name,value:p.name,checked:u.current.includes(p.name)})),d;if(u.spec.array)d=await r.checkbox(`${u.resource} "${u.key}" \u2192 ${u.spec.label}`,l);else{let p=await r.select(`${u.resource} "${u.key}" \u2192 ${u.spec.label}`,[{name:me.dim("(none)"),value:""},...l.map(f=>({name:f.name,value:f.value}))]);d=p?[p]:[]}let m=kT(u,d,e.env);m&&n.push(m)}if(n.length===0)return t(me.green(`
|
|
646
|
+
\u2713 Everything already wired \u2014 no changes.
|
|
647
|
+
`)),{changes:n};t(me.bold(`
|
|
648
|
+
Changes to write:
|
|
649
|
+
`));for(let u of n){let l=Array.isArray(u.value)?`[${u.value.join(", ")}]`:String(u.value);t(` ${u.resource} "${u.key}".${u.field} = ${l}${u.trailingComment?me.dim(` ${u.trailingComment}`):""}
|
|
650
|
+
`)}if(!await r.confirm(`
|
|
651
|
+
Write these to the config?`,!0))return t(me.dim(`Aborted \u2014 nothing written.
|
|
652
|
+
`)),{changes:n,aborted:!0};let s={merged:{},changes:n,conflicts:[],localOnly:[]},c=await Da(e.sourceText,s);return!c.ok||c.text===void 0?{changes:n,reason:c.reason??"unknown"}:{changes:n,text:c.text}}a(PT,"runWireWizard");function zx(e){e.command("wire").description("Interactively wire primus relationships (agents\u2194skills\u2194tools\u2194triggers) by NAME \u2014 no gids").option("--config <path>","path to primus.config.ts (default: ./npayload/primus.config.ts)").option("--check","print the wiring report and change nothing").option("--env <slug>","environment to read live gids from and name in the gid pin comment (default: the active environment)").action(async(t,r)=>{try{let o=dt(t,r),n=An(o!==void 0?{explicitSlug:o}:{}),i=n??"sandbox",s=t.config?xT(process.cwd(),t.config):Ke("primus");if(!s)throw new Error("no primus.config.ts found \u2014 run from a project with npayload/primus.config.ts (or pass --config).");let c=await le(s),u=a(f=>process.stdout.write(f),"sink"),l=await ST(u,n),d=Lx(c,l);if(d.length===0){u(me.dim(`No relationship slots in this config (declare agents/skills/tools/triggers first).
|
|
653
|
+
`));return}if(t.check||!je()){u(me.bold(`
|
|
654
|
+
Wiring report
|
|
655
|
+
`));for(let g of d)u(` ${_T(g)}
|
|
656
|
+
`);let f=d.filter(g=>g.dangling.length);f.length&&u(me.yellow(`
|
|
657
|
+
${f.length} slot(s) reference a name that doesn't exist \u2014 fix the name or declare the parent, then run \`npayload wire\`.
|
|
658
|
+
`)),!t.check&&!je()&&u(me.dim(`
|
|
659
|
+
(non-interactive: showing the report only; run in a TTY to wire)
|
|
660
|
+
`));return}let m=wT(s,"utf8"),p=await PT({config:c,live:l,env:i,sourceText:m,sink:u});if(p.changes.length===0||p.aborted)return;if(p.text===void 0){let f=`${s}.wire-suggested.txt`;Ux(f,`Could not apply wiring automatically (${p.reason??"unknown"}). Apply manually:
|
|
661
|
+
|
|
662
|
+
`+p.changes.map(g=>` ${g.resource}.${g.key}.${g.field} = ${JSON.stringify(g.value)}${g.trailingComment?" "+g.trailingComment:""}`).join(`
|
|
663
|
+
`)+`
|
|
664
|
+
`),u(me.yellow(`
|
|
665
|
+
\u26A0 Could not edit the config safely \u2014 wrote suggestions to ${f} (config untouched).
|
|
666
|
+
`));return}Ux(s,p.text),u(me.green(`
|
|
667
|
+
\u2713 Wired ${p.changes.length} relationship(s) into ${s}.
|
|
668
|
+
`)),u(me.dim("Run `npayload push` to reconcile the new wiring to your deployment.\n"))}catch(o){de(o)}})}a(zx,"registerWire");import{dirname as ET}from"path";function TT(e){if(!e||typeof e!="object")return null;let t=e,r=typeof t.slug=="string"?t.slug:void 0,o=t.kind==="production"||t.kind==="development"?t.kind:void 0;if(!r||!o)return null;let n={slug:r,kind:o},i=typeof t.gid=="string"?t.gid:typeof t.envId=="string"?t.envId:void 0;i&&(n.envId=i);let s=typeof t.deployBranch=="string"?t.deployBranch:void 0;return s&&(n.deployBranch=s),n}a(TT,"toTargetEnv");function Mx(e){if(Array.isArray(e))return e;if(e&&typeof e=="object")for(let t of["environments","data","items"]){let r=e[t];if(Array.isArray(r))return r}return[]}a(Mx,"rowsOf");function AT(e){let t=[];for(let r of e){if(!r||typeof r!="object")continue;let o=r,n=typeof o.slug=="string"?o.slug:void 0,i=o.kind==="production"||o.kind==="development"?o.kind:void 0;if(!n||!i)continue;let s=typeof o.name=="string"?o.name:void 0;t.push({slug:n,kind:i,...s?{name:s}:{}})}return t}a(AT,"toReconcileEnvs");function Fx(e,t){if(t.length!==0)try{let r=Uh(e??process.cwd());if(!r)return;let o=gi(ET(r),{envs:t});o.addedEnvSections.length>0&&process.stderr.write(`npayload.toml updated: added [env.${o.addedEnvSections.join("], [env.")}]
|
|
669
|
+
`)}catch{}}a(Fx,"reconcileEnvSections");async function CT(e){try{let t=await e.send($r("list")),r=Mx(t).map(TT).filter(o=>o!==null);r.length>0&&Fh(r,e.cwd),Fx(e.cwd,AT(Mx(t))),e.print(t),e.exit(0)}catch(t){e.printError(Ie(t instanceof Error?t.message:String(t),t)),e.exit(2)}}a(CT,"runEnvList");async function RT(e,t){let r;try{r=$r("create",e)}catch(o){if(o instanceof Y){t.printError(o.message),t.exit(o.exitCode);return}throw o}try{let o=await t.send(r);Fx(t.cwd,[{slug:e.slug,kind:e.kind,...e.name?{name:e.name}:{}}]),t.print(o),t.exit(0)}catch(o){t.printError(Ie(o instanceof Error?o.message:String(o),o)),t.exit(2)}}a(RT,"runEnvCreate");async function OT(e,t){let r;try{r=$r("show",{slug:e})}catch(o){if(o instanceof Y){t.printError(o.message),t.exit(o.exitCode);return}throw o}try{let o=await t.send(r);t.print(o),t.exit(0)}catch(o){t.printError(Ie(o instanceof Error?o.message:String(o),o)),t.exit(2)}}a(OT,"runEnvShow");async function NT(e,t){let r;try{r=$r("clone",{slug:e.source,targetSlug:e.target,...e.name?{targetName:e.name}:{},...e.withData?{withData:!0}:{},...e.confirm?{confirmation:e.confirm}:{}})}catch(o){if(o instanceof Y){t.printError(o.message),t.exit(o.exitCode);return}throw o}try{let o=await t.send(r);t.print(o),t.exit(0)}catch(o){t.printError(Ie(o instanceof Error?o.message:String(o),o)),t.exit(2)}}a(NT,"runEnvClone");function DT(e,t){let r=En(t.cwd);if(r){let o=r.environments.map(n=>n.slug);if(!o.includes(e)){t.printError(`Unknown environment "${e}". Declared in npayload.toml: ${o.join(", ")||"(none)"}.`),t.exit(1);return}}Mh(e,t.cwd),t.print({activeEnvironment:e}),t.exit(0)}a(DT,"runEnvUse");function jT(e){let t={name:String(e.name??""),slug:String(e.slug??""),kind:String(e.kind??"")};return typeof e.deployBranch=="string"&&e.deployBranch!==""&&(t.deployBranch=e.deployBranch),t}a(jT,"createArgsFromOptions");function qx(e,t){let r=a((s,c)=>{s.command("list").description(c?"List the app's logical environments":"List the app's logical environments (alias of `np account environments list`)").action(async()=>{await CT(t())}),s.command("create").description("Create a logical environment (--kind development|production)").requiredOption("--name <name>","human-readable environment name").requiredOption("--slug <slug>","environment slug (stable identifier)").requiredOption("--kind <kind>","development | production").option("--deploy-branch <branch>","git branch `np deploy` requires for this env").action(async l=>{await RT(jT(l),t())}),s.command("show <slug>").description("Show one of the app's logical environments by slug").action(async l=>{await OT(l,t())}),s.command("clone <source> <target>").description("Clone an environment into a NEW development environment (runs as a background job)").option("--name <name>","display name for the target env (defaults to the target slug)").option("--with-data","also copy the data tables (config_and_data mode)").option("--confirm <source-slug>","typed confirmation, required when copying DATA out of a production source").action(async(l,d,m)=>{await NT({source:l,target:d,...typeof m.name=="string"&&m.name!==""?{name:m.name}:{},...m.withData?{withData:!0}:{},...typeof m.confirm=="string"&&m.confirm!==""?{confirm:m.confirm}:{}},t())}),s.command("use <slug>").description("Record the active logical environment for subsequent env-scoped commands").action(l=>{DT(l,t())})},"wire"),o=e.command("env").description("Logical environments \u2014 list/create/show/clone/use (alias of `np account environments`). NOTE: distinct from `np envs`, the local auth-profile switcher.");r(o,!1);let n=e.commands.find(s=>s.name()==="account")??e.command("account");n.description("Account & identity management \u2014 org, apps, environments, oauth-clients, keys");let i=n.command("environments").description("The app's logical environments (canonical form of `np env`)");r(i,!0)}a(qx,"registerEnv");var Qa=["events","primus","pipes"],UT={events:"Events",primus:"Primus",pipes:"Pipes"},LT="The log of the requests made with your keys is coming; until it exists, np logs lists your agents' and tools' errors and your failed pipe runs.",zT=200,MT=20,Zx=5,Gx=50,Vx=a(e=>new Date(typeof e=="number"&&Number.isFinite(e)?e:0).toISOString(),"iso"),Xa=a(e=>typeof e=="string"?e:"","str"),Ag=a(e=>{if(Array.isArray(e))return e;let t=e?.data;return Array.isArray(t)?t:[]},"items");async function FT(e,t,r){let o=await e.send(ut({row:t.primusErrors,positionals:[],flags:{limit:String(r)},newIdempotencyKey:e.newIdempotencyKey}));return Ag(o).map(n=>({product:"Primus",status:n.status==="resolved"?"resolved":"active",message:Xa(n.message),source:Xa(n.source),at:Vx(n.lastOccurrence??n.firstOccurrence??n.createdAt)}))}a(FT,"primusProblems");function qT(e){let t=e.error;if(typeof t?.message=="string"&&t.message!=="")return t.message;let o=(Array.isArray(e.nodeRuns)?e.nodeRuns:[]).find(n=>n.status==="error"&&typeof n.error=="string"&&n.error!=="");return o?String(o.error):"The run failed."}a(qT,"runMessage");async function ZT(e,t){let r=Ag(await e.send(ut({row:t.pipesList,positionals:[],flags:{limit:String(zT)},newIdempotencyKey:e.newIdempotencyKey}))),o=[];for(let n=0;n<r.length;n+=Zx){let i=r.slice(n,n+Zx),s=await Promise.all(i.map(c=>e.send(ut({row:t.pipeRuns,positionals:[Xa(c.gid)],flags:{status:"failed",limit:String(MT)},newIdempotencyKey:e.newIdempotencyKey}))));i.forEach((c,u)=>{for(let l of Ag(s[u])){if(l.status!=="failed")continue;let d=l.timing;o.push({product:"Pipes",status:"failed",message:qT(l),source:Xa(c.name),at:Vx(d?.startedAt)})}})}return o}a(ZT,"pipesProblems");async function GT(e,t,r){let o=t?[t]:[...Qa],n=o.filter(d=>d!=="events"),i=n.length>0?await e.rows():void 0,s=await Promise.all(n.map(async d=>{try{let m=d==="primus"?await FT(e,i,r):await ZT(e,i);return{product:d,rows:m}}catch(m){return F(m),{product:d,error:m}}})),c=s.filter(d=>"error"in d);if(c.length>0&&c.length===s.length&&!o.includes("events"))throw c[0].error;let l={logs:s.flatMap(d=>"rows"in d?d.rows:[]).sort((d,m)=>Date.parse(m.at)-Date.parse(d.at)).slice(0,r),requests:LT};return c.length>0&&(l.unavailable=c.map(d=>({product:UT[d.product],reason:d.error instanceof Error?d.error.message:String(d.error)}))),l}a(GT,"readLogs");function Bx(e,t){e.command("logs").argument("[topic]",`one product's problems: ${Qa.join(", ")} (default: all)`).description("List the environment's problems in one list \u2014 your agents' and tools' errors and your failed pipe runs \u2014 newest first, each with its product and status").option("--limit <n>",`how many problems to list (default ${Gx})`).action(async(r,o)=>{try{if(r!==void 0&&!Qa.includes(r))throw new Y(`no product "${r}" \u2014 np logs lists ${Qa.join(", ")} (or all of them)`);let n=o.limit===void 0?Gx:Number(o.limit);if(!Number.isInteger(n)||n<1)throw new Y(`--limit must be a whole number above 0, got "${o.limit}"`);t.print(await GT(t,r,n))}catch(n){t.printError(Ie(n instanceof Error?n.message:String(n),n)),process.exitCode=n instanceof Y?n.exitCode:Dt(n)}})}a(Bx,"registerLogs");function VT(e,t){return JSON.stringify([e,t??""])}a(VT,"cacheKey");function Jx(e){let t=new Map;return{getKernelFor(r){let{lane:o,url:n}=e.laneOf(r),i=r.envless?void 0:e.resolveEnvSlug(),s=VT(o,i),c=t.get(s);return c||(c=e.build(n,i),t.set(s,c)),c}}}a(Jx,"makeEnvKeyedKernelCache");import{createHash as Qx,randomBytes as Rg}from"crypto";import{closeSync as BT,mkdirSync as Xx,openSync as JT,readFileSync as Og,renameSync as ek,statSync as KT,unlinkSync as Kx,writeFileSync as tk,writeSync as WT}from"fs";import{homedir as nk}from"os";import{join as vr}from"path";function HT(){return vr(process.env.NPAYLOAD_AUTH_HOME??vr(nk(),".npayload"),"npp","producer-sequence")}a(HT,"cliNppSequenceDir");var Wx=3e4,YT=10*6e4,QT=1e4,rk=new Set(["EACCES","EPERM","EROFS","ENOTDIR"]),Hx=!1,tc=class{constructor(t=HT()){this.dir=t}static{a(this,"FileNppSequenceStore")}async exclusive(t,r){let o=vr(this.dir,Qx("sha256").update(Vg(t)).digest("hex")),n=`${o}.json`,i;try{Xx(this.dir,{recursive:!0,mode:448}),i=await ok(`${o}.lock`)}catch(s){if(!rk.has(br(s)??""))throw s;return Hx||(Hx=!0,process.stderr.write(`np: cannot write the NPP producer-sequence store at ${this.dir} (${br(s)}); the producer sequence is kept for this process only, so a later np process on this credential may be refused REJECTED_DUPLICATE on the same channel. Set NPAYLOAD_AUTH_HOME to a writable directory.
|
|
670
|
+
`)),Bg.exclusive(t,r)}try{return await r({load:a(async()=>XT(n),"load"),save:a(async s=>eA(n,t.channelGid,s),"save")})}finally{i()}}};function br(e){return e&&typeof e=="object"&&"code"in e?String(e.code):void 0}a(br,"errCode");function XT(e){let t;try{t=Og(e,"utf8")}catch(r){if(br(r)==="ENOENT")return{lastAccepted:0n};throw r}try{let r=JSON.parse(t);if(r.v===1&&typeof r.lastAccepted=="string"&&/^\d+$/.test(r.lastAccepted)){let o=BigInt(r.lastAccepted),n=typeof r.inFlight=="string"&&/^\d+$/.test(r.inFlight)?BigInt(r.inFlight):void 0;return n===o+1n?{lastAccepted:o,inFlight:n}:{lastAccepted:o}}}catch{}return{lastAccepted:0n}}a(XT,"readState");function eA(e,t,r){let o={v:1,channelGid:t,lastAccepted:r.lastAccepted.toString(),...r.inFlight!==void 0?{inFlight:r.inFlight.toString()}:{}},n=`${e}.${process.pid}.${Rg(4).toString("hex")}.tmp`;tk(n,`${JSON.stringify(o)}
|
|
671
|
+
`,{mode:384}),ek(n,e)}a(eA,"writeState");function ec(e){try{let t=JSON.parse(Og(e,"utf8"));return typeof t.pid=="number"&&typeof t.token=="string"&&typeof t.at=="number"?{pid:t.pid,token:t.token,at:t.at}:void 0}catch{return}}a(ec,"readHolder");function tA(e){try{return process.kill(e,0),!0}catch(t){return br(t)==="EPERM"}}a(tA,"processAlive");function nA(e){let t=ec(e);if(t)return{stale:!tA(t.pid)||Date.now()-t.at>YT,token:t.token};try{return{stale:Date.now()-KT(e).mtimeMs>QT,token:void 0}}catch{return{stale:!1,token:void 0}}}a(nA,"staleHold");async function ok(e){let t=`${process.pid}.${Rg(8).toString("hex")}`,r=Date.now()+Wx;for(;;){try{let n=JT(e,"wx",384);try{WT(n,JSON.stringify({pid:process.pid,token:t,at:Date.now()}))}finally{BT(n)}return()=>{try{ec(e)?.token===t&&Kx(e)}catch{}}}catch(n){if(br(n)!=="EEXIST")throw n}let o=nA(e);if(o.stale){try{ec(e)?.token===o.token&&Kx(e)}catch{}continue}if(Date.now()>r){let n=ec(e);throw new Error(`np: another npayload process${n?` (pid ${n.pid})`:""} has held this channel's NPP producer sequence for over ${Wx/1e3} s (${e}); retry when it finishes.`)}await new Promise(n=>setTimeout(n,5+Math.floor(Math.random()*20)))}}a(ok,"acquireHold");function rA(){return vr(process.env.NPAYLOAD_AUTH_HOME??vr(nk(),".npayload"),"npp","producer-epoch")}a(rA,"cliNppEpochDir");var oA=Date.UTC(2025,0,1),Yx=2147483647,Cg=new Map;function iA(e){try{let t=JSON.parse(Og(e,"utf8"));return t.v===1&&typeof t.lastDrawn=="number"&&Number.isInteger(t.lastDrawn)&&t.lastDrawn>=0?t.lastDrawn:-1}catch{return-1}}a(iA,"readEpoch");function sA(e,t){let r=`${e}.${process.pid}.${Rg(4).toString("hex")}.tmp`;tk(r,`${JSON.stringify({v:1,lastDrawn:t})}
|
|
672
|
+
`,{mode:384}),ek(r,e)}a(sA,"writeEpoch");async function ik(e,t={}){let r=Math.floor(((t.nowMs??Date.now())-oA)/1e3),o=Math.max(r,(Cg.get(e)??-1)+1),n=t.dir??rA(),i=vr(n,Qx("sha256").update(e).digest("hex")),s;try{Xx(n,{recursive:!0,mode:448}),s=await ok(`${i}.lock`)}catch(c){if(!rk.has(br(c)??""))throw c;let u=Math.min(Yx,Math.max(0,o));return Cg.set(e,u),u}try{let c=Math.min(Yx,Math.max(0,o,iA(`${i}.json`)+1));return sA(`${i}.json`,c),Cg.set(e,c),c}finally{s()}}a(ik,"drawCliProducerEpoch");import"fs";import*as aA from"tls";import{Agent as _V,fetch as $V}from"undici";function sk(e){return!1}a(sk,"twinNamesKernelFrameDoor");function ak(e,t){if(!t.edgeUrl)throw new be("NPP transport selected but not configured: no NPP door is named"+(t.refusal?`: ${t.refusal}`:". Set NPAYLOAD_EDGE_URL.")+" Or opt into HTTP/JSON explicitly with --transport http or NPAYLOAD_TRANSPORT=http.");let r=t.named?"NPAYLOAD_EDGE_URL":"the production edge";return{url:t.edgeUrl,source:r}}a(ak,"resolveCliKernelFrameDoor");async function nc(e){let t=process.env.NPAYLOAD_CLIENT_ID,r=(process.env.NPAYLOAD_CLIENT_SECRET??process.env.NPAYLOAD_HMAC_SECRET)?.trim()||void 0,o;if(!t)try{let u=await kr();t=u.clientId,r=r??u.hmacSecret,o=u.dpopPrivateJwk}catch(u){if(u instanceof lc)throw u}if(!t)throw new lc("Not authenticated. Run `np login` (alias `npayload login`; device flow, stores the session in the OS keychain), or export NPAYLOAD_CLIENT_ID + NPAYLOAD_HMAC_SECRET.");let{apiUrl:n,authUrl:i,guard:s}=wr(),c=ti({env:process.env,credentialKey:o})??(await Go()).privateJwk;return Ho({clientId:t,dpopPrivateJwk:c,baseUrl:n,...r!==void 0?{clientSecret:r}:{},...i!==void 0?{authUrl:i}:{},...e?{env:e}:{}},s)}a(nc,"resolveKernel");var dA={async text(e,t){let{input:r}=await import("@inquirer/prompts");return(await r({message:e,validate:a(o=>t.optional||o.trim()!==""||"required \u2014 enter a value","validate")})).trim()},async secret(e,t){let{password:r}=await import("@inquirer/prompts");return(await r({message:e,mask:!0,validate:a(o=>t.optional||o.trim()!==""||"required \u2014 enter a value","validate")})).trim()},async select(e,t){let{select:r}=await import("@inquirer/prompts");return r({message:e,choices:t})}};async function Ng(e){if(!process.stdin.isTTY)return process.stderr.write(`${e}
|
|
673
|
+
Refusing a destructive op without a TTY; pass --yes to proceed.
|
|
674
|
+
`),!1;let{createInterface:t}=await import("readline/promises"),r=t({input:process.stdin,output:process.stderr});try{let o=await r.question(`${e} [y/N] `);return/^y(es)?$/i.test(o.trim())}finally{r.close()}}a(Ng,"ttyConfirm");function pA(e){let t=Wg(e),r={code:"NPP_PUBLISH_REJECTED",status:e.httpStatus};switch(Ko(e.statusName??Jg(e.statusCode))){case"auth":return new Vo(t,r);case"deferred":return e.httpStatus===429?new Lg(t,r):new zg(t,r);case"protocol":return new Wo(t,Gg.BULK_ACK,{status:e.httpStatus});default:return new Ug(t,r)}}a(pA,"nppRejectionError");async function mA(e={}){let t=new cA;t.name("np").description("npayload CLI \u2014 contract-generated Events surface"),t.addHelpText("after",`
|
|
675
|
+
np --version print the npayload package version
|
|
676
|
+
np --build print the contract build hash
|
|
677
|
+
`+ey+`
|
|
678
|
+
Docs: ${fh}
|
|
679
|
+
`);let r=a(b=>{let T=(b??process.argv)[2];return T==="--version"||T==="--build"?T:void 0},"rootOnlyFlag"),o=t.parseAsync.bind(t);t.parseAsync=(async(b,T)=>{let M=r(b);return M==="--version"?(process.stdout.write(`${an()}
|
|
680
|
+
`),t):M==="--build"?(process.stdout.write(`${we.contentHash.slice(0,12)}
|
|
681
|
+
`),t):o(b,T)}),t.option("-y, --yes","skip confirmation prompts for destructive operations"),t.option("--transport <transport>",'transport for data-plane publish/subscribe: "npp" (default) or "http"'),t.option("--env <slug>","target logical environment for env-scoped commands (overrides `np env use`)"),jy(t),zy(t),Fy(t),uv(t),lv(t),dv(t,{resolveKernel:tu,resolveChannelGid:a((b,T,M)=>nu(b,T,M),"resolveChannelGid")}),Bh(t,{sendAccount:a(async b=>(await c(b)).send(b),"sendAccount")}),vv(t),Pv(t,{print:e.print??(b=>void process.stdout.write(`${String(b)}
|
|
682
|
+
`)),printError:e.printError??(b=>void process.stderr.write(`${b}
|
|
683
|
+
`))}),xv(t,{print:e.print??(b=>{process.stdout.write(`${JSON.stringify(b,null,2)}
|
|
684
|
+
`)}),printError:e.printError??(b=>{process.stderr.write(`${b}
|
|
685
|
+
`)}),...e.readSecret?{readSecret:e.readSecret}:{},confirm:e.confirm??Ng}),tx(t),fx(t),mx(t),lx(t),Wh(t),Kh(t),yx(t),zx(t),Px(t,{fetchAccountStatus:a(async()=>{try{let b={method:"GET",path:"/v1/billing/account-status",scope:"billing:read"},M=await(await c(b)).send(b);return M&&typeof M.tier=="string"?M:null}catch(b){return F(b),null}},"fetchAccountStatus")});let n=a(b=>{if(b.path.startsWith("/v1/primus/")){let T=ne(process.env.NPAYLOAD_PRIMUS_API_URL,"primusApiUrl");if(T)return{lane:"primus",url:T}}if(b.path.startsWith("/v1/account/")){let T=ne(process.env.NPAYLOAD_ACCOUNT_API_URL,"accountApiUrl");if(T)return{lane:"account",url:T}}if(b.path.startsWith("/v1/analytics/")){let T=ne(process.env.NPAYLOAD_ADMIN_API_URL,"adminApiUrl");if(T)return{lane:"analytics",url:T}}return{lane:"cell"}},"laneOf"),i=a(()=>{let b=t.opts().env;return An(typeof b=="string"&&b.trim()!==""?{explicitSlug:b}:{})},"resolveDispatchEnvSlug"),s=Jx({laneOf:n,resolveEnvSlug:i,build:a(async(b,T)=>{if(b){let{buildKernel:M}=await import("../chunk-2PCG57PX.mjs");return M(b,T)}return nc(T)},"build")}),c=a(b=>s.getKernelFor(b),"getKernelFor");kv(t,{print:e.print??(b=>{process.stdout.write(`${JSON.stringify(b,null,2)}
|
|
686
|
+
`)}),printError:e.printError??(b=>{process.stderr.write(`${b}
|
|
687
|
+
`)}),credential:a(async()=>{let b=process.env.NPAYLOAD_CLIENT_ID;if(b)return{clientId:b,source:"env"};let T=await kr();return{clientId:T.clientId,source:T.source}},"credential"),token:a(async()=>(await nc(i())).auth.getAccessToken([]),"token")}),kx(t,{resolveKernel:a(async()=>nc(i()),"resolveKernel"),mintedEnvSlug:a(()=>i(),"mintedEnvSlug"),yes:a(()=>t.opts().yes===!0,"yes"),tail:a(async(b,T)=>yg(b,T),"tail"),confirm:a(async b=>e.confirm?e.confirm(b):Ng(b),"confirm")}),_x(t,{resolveKernel:a(async()=>nc(i()),"resolveKernel"),mintedEnvSlug:a(()=>i(),"mintedEnvSlug")});let u=a(()=>{let b=t.opts().transport;if(b==="http"||b==="npp")return b;if(b!==void 0)throw new Y(`--transport must be "npp" or "http", got "${b}"`);return process.env.NPAYLOAD_TRANSPORT==="http"?"http":"npp"},"resolveCliTransport"),l=/^\/v1\/channels\/\{channelId\}\/messages$/,d=/^\/v1\/channels\/\{channelId\}\/subscribe$/,m=new Set(["payload","qosLevel"]),p=new WeakMap,f=a(b=>{let T=rn(b);return $h(process.env.NPAYLOAD_EDGE_URL,In(b),[Hg(b),`${T.replace(/\/+$/,"")}/v1/apps/dpop-keys`])},"nppEdgeOf"),g=a(b=>new be("NPP transport selected but not configured"+(b?`: ${b}`:". Set NPAYLOAD_EDGE_URL.")+" Or opt into HTTP/JSON explicitly with --transport http or NPAYLOAD_TRANSPORT=http."),"nppNotConfigured"),v=a(b=>{let{edgeUrl:T,refusal:M}=f(b);if(!T)throw g(M);let J=rn(b),H=p.get(b);return H||(H=Yg(b,{baseUrl:J,edgeUrl:T,clientId:process.env.NPAYLOAD_CLIENT_ID??"",appId:process.env.NPAYLOAD_APP_ID,sequenceStore:new tc}),p.set(b,H)),H},"getNppPublisher"),h=new Map,x=a((b,T)=>b.send({method:"GET",path:"/v1/channels/{channelId}",pathParams:{channelId:T}}),"readChannelAnswer"),E=new Map,k=new WeakMap,O=a(()=>ne(process.env.NPAYLOAD_API_URL,"apiUrl","https://api.npayload.com"),"cliApiUrl"),A=a((b,T)=>{let M=k.get(b);if(!M){let J=O(),H=ak(J,T);M=Qg(b,{baseUrl:J,frameDoorUrl:H.url,clientId:process.env.NPAYLOAD_CLIENT_ID??"",appId:process.env.NPAYLOAD_APP_ID,readChannel:a(async re=>{if(E.has(re)){let Zo=E.get(re);return E.delete(re),Zo}return x(b,re)},"readChannel"),producerEpoch:a(re=>ik(re),"producerEpoch"),...H.fetchImpl?{fetchImpl:H.fetchImpl}:{}}),k.set(b,M)}return M},"getKernelDoorPublisher"),j=a(async(b,T,M)=>{let J=h.get(T);if(!J){J=x(b,T).catch(()=>{}),h.set(T,J);let H=await J;ic(H)&&E.set(T,H)}if(ic(await J))return A(b,M)},"kernelDoorPublisherFor"),U=a(async b=>{let T=await c(b);if(u()==="npp"){let J=b.body??{};if(b.method==="POST"&&l.test(b.path)){if("payload"in J&&b.idempotencyKeySupplied!==!0&&Object.keys(J).every(re=>m.has(re)||J[re]===void 0)){let re=f(T);if(!re.edgeUrl&&!sk(O()))throw g(re.refusal);let nn=await(await j(T,b.pathParams.channelId,re)??await v(T)).publish(b.pathParams.channelId,J.payload,{...J.qosLevel!==void 0?{qosLevel:J.qosLevel}:{}});if(!nn.accepted)throw pA(nn);return ac({gid:nn.gid,status:"accepted",statusCode:nn.statusCode,statusName:nn.statusName,sequence:nn.sequence,httpStatus:nn.httpStatus,transport:"npp"})}}else if(b.method==="POST"&&d.test(b.path)){let H=await v(T),re=typeof J.consumerId=="string"&&J.consumerId||`consumer-${b.pathParams.channelId}`;return H.subscribe(b.pathParams.channelId,{consumerId:re,...typeof J.mode=="number"?{mode:J.mode}:{},...typeof J.deliveryPreference=="number"?{deliveryPreference:J.deliveryPreference}:{}})}}let M=await T.send(b);return b.method==="POST"&&l.test(b.path)?ac(M):M},"sendViaTransport");Bx(t,{send:U,newIdempotencyKey:a(()=>globalThis.crypto.randomUUID(),"newIdempotencyKey"),print:e.print??(b=>{process.stdout.write(`${JSON.stringify(b,null,2)}
|
|
688
|
+
`)}),printError:e.printError??(b=>{process.stderr.write(`${b}
|
|
689
|
+
`)}),rows:a(async()=>{let b=a((M,J)=>{let H=M.find(re=>re.key===J);if(!H)throw new Error(`np logs: the command table carries no ${J}`);return H},"row"),T=(await ei()).commands;return{primusErrors:b(T,"primus.observability.getErrors"),pipesList:b(we.commands,"pipes.workflows.listWorkflows"),pipeRuns:b(we.commands,"pipes.executions.listExecutions")}},"rows")}),qx(t,()=>({send:a(async b=>(await c(b)).send(b),"send"),print:e.print??(b=>{process.stdout.write(`${JSON.stringify(b,null,2)}
|
|
690
|
+
`)}),printError:e.printError??(b=>{process.stderr.write(`${b}
|
|
691
|
+
`)}),exit:a(b=>{process.exitCode=b},"exit")}));let K=await ei(),V=new Set(we.commands.map(b=>b.commandPath[0])),D=[...new Set(K.commands.map(b=>b.commandPath[0]))].filter(b=>V.has(b));if(D.length>0)throw new Error(`CLI namespace collision between cell and primus command tables: ${D.join(", ")}`);let B=[...we.commands,...K.commands,...Ch(),...Rh()],fe=a(async b=>t.opts().yes===!0?!0:e.confirm?e.confirm(b):Ng(b),"confirmDestructive");ay(t,B,{send:U,newIdempotencyKey:a(()=>globalThis.crypto.randomUUID(),"newIdempotencyKey"),print:e.print??(b=>{process.stdout.write(`${JSON.stringify(b,null,2)}
|
|
692
|
+
`)}),printError:e.printError??(b=>{process.stderr.write(`${b}
|
|
693
|
+
`)}),exit:a(b=>{process.exitCode=b},"exit"),prompt:e.prompt??dA,...e.prompt?{}:{isInteractive:je},confirm:fe,whereAmI:a(async b=>{let T=b!==void 0?await c(b).catch(()=>{}):void 0,M=wr(),J=(T!==void 0?rn(T):void 0)??M.apiUrl,H=(T!==void 0?In(T):void 0)??M.guard;return ny(J,H)},"whereAmI")}),hx(t,{send:U,newIdempotencyKey:a(()=>globalThis.crypto.randomUUID(),"newIdempotencyKey"),print:e.print??(b=>{process.stdout.write(`${JSON.stringify(b,null,2)}
|
|
694
|
+
`)}),printError:e.printError??(b=>{process.stderr.write(`${b}
|
|
695
|
+
`)}),confirm:fe,rows:a(async()=>{let b=a((J,H)=>{let re=J.find(Zo=>Zo.key===H);if(!re)throw new Error(`np webhooks: the command table carries no ${H}`);return re},"row"),T=(await ei()).commands,M=we.commands;return{list:b(M,"webhooks.webhooks.list"),create:b(M,"webhooks.webhooks.create"),rotateSecret:b(M,"webhooks.webhooks.rotateSecret"),revoke:b(M,"webhooks.webhooks.revoke"),channelGet:b(M,"events.channels.get"),triggersList:b(T,"primus.triggers.list"),triggersCreate:b(T,"primus.triggers.create"),triggersRemove:b(T,"primus.triggers.remove"),agentsList:b(T,"primus.agents.list")}},"rows")});let ie=t.commands.find(b=>b.name()==="primus")??t.command("primus");return jx(ie),Pc(t),t}a(mA,"buildProgram");async function fA(){await(await mA()).parseAsync(process.argv)}a(fA,"main");function gA(){let e=process.argv[1];if(!e)return!1;try{return import.meta.url===lA(uA(e)).href}catch{return!1}}a(gA,"invokedAsBinary");gA()&&fA().catch(e=>{process.stderr.write(`${Ie(e instanceof Error?e.message:String(e),e)}
|
|
696
|
+
`),process.exitCode=1});export{mA as buildProgram};
|