@intentius/chant 0.124.106 → 0.124.107

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.
@@ -251,6 +251,16 @@ if (args[0] === "publish") {
251
251
  console.log("added " + Object.keys(deps).length + " packages");
252
252
  } else if (args[0] === "audit" && args[1] === "signatures") {
253
253
  const n = Object.keys(JSON.parse(fs.readFileSync("package.json", "utf-8")).dependencies || {}).length;
254
+ // FAKE_NPM_ATTESTATION_404=N answers the first N audits with the registry's attestation 404 ("always" never stops).
255
+ const lateAttest = process.env.FAKE_NPM_ATTESTATION_404;
256
+ if (lateAttest) {
257
+ const seen = fs.existsSync(".audit-count") ? Number(fs.readFileSync(".audit-count", "utf-8")) : 0;
258
+ fs.writeFileSync(".audit-count", String(seen + 1));
259
+ if (lateAttest === "always" || seen < Number(lateAttest)) {
260
+ console.error("npm error 404 Not Found - GET https://registry.npmjs.org/-/npm/v1/attestations/@acme%2fcore@1.0.0 - Not found");
261
+ process.exit(1);
262
+ }
263
+ }
254
264
  if (process.env.FAKE_NPM_AUDIT_FAIL) { console.error(n + " packages have invalid attestations"); process.exit(1); }
255
265
  console.log("audited " + n + " packages");
256
266
  console.log(n + " packages have verified registry signatures");
@@ -74,6 +74,8 @@ export declare function npmAuditSignaturesArgs(decl: Pick<NpmPublishDeclaration,
74
74
  export declare const NPM_REGISTRY_POLL_MS = 10000;
75
75
  /** Between progress lines while the reveal waits for the registry (#4271). */
76
76
  export declare const NPM_REGISTRY_PROGRESS_MS = 60000;
77
+ /** How long the audit waits for the registry to serve a package's provenance attestation after the version (#5315). */
78
+ export declare const NPM_ATTESTATION_WAIT_MS = 120000;
77
79
  /**
78
80
  * #4657: refuse a package whose `pins` file holds an image digest the release
79
81
  * does not record, and a target none of whose packages has the file. Read
@@ -173,6 +173,10 @@ function run(bin, args, ctx, cwd = ctx.cwd, env = ctx.env) {
173
173
  export const NPM_REGISTRY_POLL_MS = 10000;
174
174
  /** Between progress lines while the reveal waits for the registry (#4271). */
175
175
  export const NPM_REGISTRY_PROGRESS_MS = 60000;
176
+ /** How long the audit waits for the registry to serve a package's provenance attestation after the version (#5315). */
177
+ export const NPM_ATTESTATION_WAIT_MS = 120000;
178
+ /** What `npm audit signatures` prints while the registry does not serve an attestation yet. */
179
+ const NPM_ATTESTATION_NOT_YET = /\b404\b.*\/-\/npm\/v1\/attestations\/|\/-\/npm\/v1\/attestations\/.*\b404\b/;
176
180
  /** `npm view`'s answers for a version the registry does not serve yet; any other failure is the registry's error. */
177
181
  const NPM_VIEW_NOT_YET = /\bE404\b|\b404 Not Found\b|is not in (this|the npm) registry|No match found for version|\b(ETARGET|notarget)\b/;
178
182
  /** npm's errors for a version the registry does not serve yet. */
@@ -453,6 +457,20 @@ export function npmTarget(decl, deps) {
453
457
  for (const line of result.output)
454
458
  ctx.log(` ${line}`);
455
459
  }
460
+ // The registry serves the attestation some seconds after the version: while the audit fails only on that 404, wait and audit again (#5315).
461
+ if (result.code !== 0 && args[0] === "audit") {
462
+ const start = now();
463
+ while (result.code !== 0 && result.output.some((l) => NPM_ATTESTATION_NOT_YET.test(l))) {
464
+ if (now() - start >= NPM_ATTESTATION_WAIT_MS) {
465
+ throw new PublishTargetError("publish-npm-audit-failed", `the registry did not serve the provenance attestation for ${pkgs.map((p) => `${p.name}@${p.version}`).join(", ")} within ${Math.round(NPM_ATTESTATION_WAIT_MS / 1000)}s of the publish, so the attestation never appeared and was not verified, after latest moved: ${result.output.at(-1) ?? "npm printed nothing"}`, "Each package was published. Once the registry serves the attestation, run the publish again: it publishes nothing twice and audits again.");
466
+ }
467
+ ctx.log("the registry does not serve the provenance attestation yet; waiting, then auditing again");
468
+ await sleep(NPM_REGISTRY_POLL_MS);
469
+ result = await npm(ctx, args, dir);
470
+ for (const line of result.output)
471
+ ctx.log(` ${line}`);
472
+ }
473
+ }
456
474
  if (result.code !== 0) {
457
475
  throw new PublishTargetError("publish-npm-audit-failed", `npm ${args.slice(0, 2).join(" ")} exited ${result.code} for ${pkgs.map((p) => `${p.name}@${p.version}`).join(", ")}, after latest moved: ${result.output.at(-1) ?? "npm printed nothing"}`, "Each package was published; check its signature and provenance on the registry. Running the publish again moves no tag that moved and audits again.");
458
476
  }
@@ -30,7 +30,7 @@
30
30
  * files rather than to the end of this one. The floors below were declared
31
31
  * here before that and keep the subpath they shipped under.
32
32
  */
33
- export declare const NEXT_RELEASE = "0.124.106";
33
+ export declare const NEXT_RELEASE = "0.124.107";
34
34
  /** The first chant with `chant dev local` and `chant dev bundle-check`, `@intentius/chant/local-chant` and `@intentius/chant/bundle-check` (`chantRuntimeTarget`, `chantExternalPlugin`, `checkBundle`): a product built against a chant checkout, and its bundle checked, without its own scripts (#4787). */
35
35
  export declare const LOCAL_CHANT_FLOOR = "0.124.86";
36
36
  /** The first chant with `chant workspace ref-gate` (pre-receive, pre-push, check, status, attach, install) and `refs` in `.chant/trust.json`, the checks a ref update needs evidence for (#4867). */
@@ -30,7 +30,7 @@
30
30
  * files rather than to the end of this one. The floors below were declared
31
31
  * here before that and keep the subpath they shipped under.
32
32
  */
33
- export const NEXT_RELEASE = "0.124.106";
33
+ export const NEXT_RELEASE = "0.124.107";
34
34
  /** The first chant with `chant dev local` and `chant dev bundle-check`, `@intentius/chant/local-chant` and `@intentius/chant/bundle-check` (`chantRuntimeTarget`, `chantExternalPlugin`, `checkBundle`): a product built against a chant checkout, and its bundle checked, without its own scripts (#4787). */
35
35
  export const LOCAL_CHANT_FLOOR = "0.124.86";
36
36
  /** The first chant with `chant workspace ref-gate` (pre-receive, pre-push, check, status, attach, install) and `refs` in `.chant/trust.json`, the checks a ref update needs evidence for (#4867). */
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- // @intentius/chant 0.124.106 wave-job runtime (#3896): run wave, run resume, approve, workspace points.
2
+ // @intentius/chant 0.124.107 wave-job runtime (#3896): run wave, run resume, approve, workspace points.
3
3
  import { createRequire as __chantCreateRequire } from "node:module";
4
4
  const require = __chantCreateRequire(import.meta.url);
5
5
  var JAe=Object.create;var ZT=Object.defineProperty;var ZAe=Object.getOwnPropertyDescriptor;var YAe=Object.getOwnPropertyNames;var QAe=Object.getPrototypeOf,XAe=Object.prototype.hasOwnProperty;var $=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}};var ve=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},me=(e,t)=>{for(var n in t)ZT(e,n,{get:t[n],enumerable:!0})},eCe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of YAe(t))!XAe.call(e,o)&&o!==n&&ZT(e,o,{get:()=>t[o],enumerable:!(r=ZAe(t,o))||r.enumerable});return e};var et=(e,t,n)=>(n=e!=null?JAe(QAe(e)):{},eCe(t||!e||!e.__esModule?ZT(n,"default",{value:e,enumerable:!0}):n,e));function QT(e,t=new Set){let n=[];for(let r of e)if(r.startsWith("--")&&r.includes("=")){let o=r.indexOf("="),i=r.slice(0,o),s=r.slice(o+1);if(t.has(i))throw new Error(`${r} \u2014 ${i} is a boolean flag and does not take a value. Pass ${i} on its own.`);n.push(i,s)}else n.push(r);return n}var YT,XT=$(()=>{"use strict";YT=new Set(["build","lint","list","describe","import","audit","migrate","carve","init","update","doctor","dev","run","graph","vendor","lifecycle","lc","components","emulator","serve","operator","approve","workspace"])});function nCe(){return!process.env.NO_COLOR&&process.stdout.isTTY!==!1}function sl(e,t){return nCe()?`${t}${e}${qa.reset}`:e}function be(e){let t=[];if(e.file){let n=e.file;e.line!==void 0&&(n+=`:${e.line}`,e.column!==void 0&&(n+=`:${e.column}`)),t.push(sl(n,qa.cyan)),t.push(" - ")}return t.push(sl("error",qa.red)),t.push(": "),t.push(e.message),e.hint&&(t.push(`
6
6
  `),t.push(sl(e.hint,qa.gray))),t.join("")}function vr(e){let t=[];if(e.file){let n=e.file;e.line!==void 0&&(n+=`:${e.line}`,e.column!==void 0&&(n+=`:${e.column}`)),t.push(sl(n,qa.cyan)),t.push(" - ")}return t.push(sl("warning",qa.yellow)),t.push(": "),t.push(e.message),e.hint&&(t.push(`
7
- `),t.push(sl(e.hint,qa.gray))),t.join("")}function Ey(e){return sl(e,qa.green)}function Wn(e){return sl(e,qa.gray)}var qa,sr=$(()=>{"use strict";qa={red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",cyan:"\x1B[36m",gray:"\x1B[90m",reset:"\x1B[0m",bold:"\x1B[1m"}});var f$,tD=$(()=>{"use strict";f$="0.124.106"});function K(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let l=s.prototype,d=Object.keys(l);for(let u=0;u<d.length;u++){let p=d[u];p in a||(a[p]=l[p].bind(a))}}let o=n?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var c;let l=n?.Parent?new i:this;r(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let d of l._zod.deferred)d();return l}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}function Sn(e){return e&&Object.assign(Oy,e),Oy}var nD,g$,ps,al,Oy,yf=$(()=>{nD=Object.freeze({status:"aborted"});g$=Symbol("zod_brand"),ps=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},al=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Oy={}});var Ee={};me(Ee,{BIGINT_FORMAT_RANGES:()=>pD,Class:()=>oD,NUMBER_FORMAT_RANGES:()=>uD,aborted:()=>ul,allowsEval:()=>aD,assert:()=>cCe,assertEqual:()=>oCe,assertIs:()=>sCe,assertNever:()=>aCe,assertNotEqual:()=>iCe,assignProp:()=>ll,base64ToUint8Array:()=>G3,base64urlToUint8Array:()=>SCe,cached:()=>bf,captureStackTrace:()=>h$,cleanEnum:()=>$Ce,cleanRegex:()=>Cy,clone:()=>Kr,cloneDef:()=>dCe,createTransparentProxy:()=>hCe,defineLazy:()=>ht,esc:()=>m$,escapeRegex:()=>xi,extend:()=>bCe,finalizeIssue:()=>xo,floatSafeRemainder:()=>iD,getElementAtPath:()=>uCe,getEnumValues:()=>Ay,getLengthableOrigin:()=>Ty,getParsedType:()=>mCe,getSizableOrigin:()=>Iy,hexToUint8Array:()=>OCe,isObject:()=>ru,isPlainObject:()=>dl,issue:()=>vf,joinValues:()=>ie,jsonStringifyReplacer:()=>wf,merge:()=>kCe,mergeDefs:()=>Ka,normalizeParams:()=>Oe,nullish:()=>cl,numKeys:()=>gCe,objectClone:()=>lCe,omit:()=>wCe,optionalKeys:()=>dD,parsedType:()=>Se,partial:()=>RCe,pick:()=>yCe,prefixIssues:()=>Qo,primitiveTypes:()=>lD,promiseAllObject:()=>pCe,propertyKeyTypes:()=>_y,randomString:()=>fCe,required:()=>xCe,safeExtend:()=>vCe,shallowClone:()=>cD,slugify:()=>sD,stringifyPrimitive:()=>Re,uint8ArrayToBase64:()=>B3,uint8ArrayToBase64url:()=>ECe,uint8ArrayToHex:()=>PCe,unwrapMessage:()=>Py});function oCe(e){return e}function iCe(e){return e}function sCe(e){}function aCe(e){throw new Error("Unexpected value in exhaustive check")}function cCe(e){}function Ay(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ie(e,t="|"){return e.map(n=>Re(n)).join(t)}function wf(e,t){return typeof t=="bigint"?t.toString():t}function bf(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function cl(e){return e==null}function Cy(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function iD(e,t){let n=(e.toString().split(".")[1]||"").length,r=t.toString(),o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){let c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=n>o?n:o,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}function ht(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==W3)return r===void 0&&(r=W3,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function lCe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ll(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ka(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function dCe(e){return Ka(e._zod.def)}function uCe(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function pCe(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}function fCe(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function m$(e){return JSON.stringify(e)}function sD(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function ru(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function dl(e){if(ru(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(ru(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function cD(e){return dl(e)?{...e}:Array.isArray(e)?[...e]:e}function gCe(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function xi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Kr(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Oe(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function hCe(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function Re(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function dD(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function yCe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Ka(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return ll(this,"shape",s),s},checks:[]});return Kr(e,i)}function wCe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Ka(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return ll(this,"shape",s),s},checks:[]});return Kr(e,i)}function bCe(e,t){if(!dl(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.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 o=Ka(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return ll(this,"shape",i),i}});return Kr(e,o)}function vCe(e,t){if(!dl(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=Ka(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return ll(this,"shape",r),r}});return Kr(e,n)}function kCe(e,t){let n=Ka(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return ll(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Kr(e,n)}function RCe(e,t,n){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=Ka(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(n)for(let l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(c[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(let l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return ll(this,"shape",c),c},checks:[]});return Kr(t,s)}function xCe(e,t,n){let r=Ka(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(n)for(let s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(let s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return ll(this,"shape",i),i}});return Kr(t,r)}function ul(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Qo(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Py(e){return typeof e=="string"?e:e?.message}function xo(e,t,n){let r={...e,path:e.path??[]};if(!e.message){let o=Py(e.inst?._zod.def?.error?.(e))??Py(t?.error?.(e))??Py(n.customError?.(e))??Py(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Iy(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ty(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Se(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function vf(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function $Ce(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function G3(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function B3(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function SCe(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return G3(t+n)}function ECe(e){return B3(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function OCe(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function PCe(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var W3,h$,aD,mCe,_y,lD,uD,pD,oD,ze=$(()=>{W3=Symbol("evaluating");h$="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};aD=bf(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});mCe=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}`)}},_y=new Set(["string","number","symbol"]),lD=new Set(["string","number","bigint","boolean","symbol","undefined"]);uD={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]},pD={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};oD=class{constructor(...t){}}});function Ny(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function jy(e,t=n=>n.message){let n={_errors:[]},r=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>r({issues:s}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,a=0;for(;a<i.path.length;){let c=i.path[a];a===i.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return r(e),n}function fD(e,t=n=>n.message){let n={errors:[]},r=(o,i=[])=>{var s,a;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>r({issues:l},c.path));else if(c.code==="invalid_key")r({issues:c.issues},c.path);else if(c.code==="invalid_element")r({issues:c.issues},c.path);else{let l=[...i,...c.path];if(l.length===0){n.errors.push(t(c));continue}let d=n,u=0;for(;u<l.length;){let p=l[u],f=u===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=[]),(a=d.items)[p]??(a[p]={errors:[]}),d=d.items[p]),f&&d.errors.push(t(c)),u++}}};return r(e),n}function H3(e){let t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(let r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function gD(e){let t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of n)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${H3(r.path)}`);return t.join(`
7
+ `),t.push(sl(e.hint,qa.gray))),t.join("")}function Ey(e){return sl(e,qa.green)}function Wn(e){return sl(e,qa.gray)}var qa,sr=$(()=>{"use strict";qa={red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",cyan:"\x1B[36m",gray:"\x1B[90m",reset:"\x1B[0m",bold:"\x1B[1m"}});var f$,tD=$(()=>{"use strict";f$="0.124.107"});function K(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let l=s.prototype,d=Object.keys(l);for(let u=0;u<d.length;u++){let p=d[u];p in a||(a[p]=l[p].bind(a))}}let o=n?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var c;let l=n?.Parent?new i:this;r(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let d of l._zod.deferred)d();return l}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}function Sn(e){return e&&Object.assign(Oy,e),Oy}var nD,g$,ps,al,Oy,yf=$(()=>{nD=Object.freeze({status:"aborted"});g$=Symbol("zod_brand"),ps=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},al=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Oy={}});var Ee={};me(Ee,{BIGINT_FORMAT_RANGES:()=>pD,Class:()=>oD,NUMBER_FORMAT_RANGES:()=>uD,aborted:()=>ul,allowsEval:()=>aD,assert:()=>cCe,assertEqual:()=>oCe,assertIs:()=>sCe,assertNever:()=>aCe,assertNotEqual:()=>iCe,assignProp:()=>ll,base64ToUint8Array:()=>G3,base64urlToUint8Array:()=>SCe,cached:()=>bf,captureStackTrace:()=>h$,cleanEnum:()=>$Ce,cleanRegex:()=>Cy,clone:()=>Kr,cloneDef:()=>dCe,createTransparentProxy:()=>hCe,defineLazy:()=>ht,esc:()=>m$,escapeRegex:()=>xi,extend:()=>bCe,finalizeIssue:()=>xo,floatSafeRemainder:()=>iD,getElementAtPath:()=>uCe,getEnumValues:()=>Ay,getLengthableOrigin:()=>Ty,getParsedType:()=>mCe,getSizableOrigin:()=>Iy,hexToUint8Array:()=>OCe,isObject:()=>ru,isPlainObject:()=>dl,issue:()=>vf,joinValues:()=>ie,jsonStringifyReplacer:()=>wf,merge:()=>kCe,mergeDefs:()=>Ka,normalizeParams:()=>Oe,nullish:()=>cl,numKeys:()=>gCe,objectClone:()=>lCe,omit:()=>wCe,optionalKeys:()=>dD,parsedType:()=>Se,partial:()=>RCe,pick:()=>yCe,prefixIssues:()=>Qo,primitiveTypes:()=>lD,promiseAllObject:()=>pCe,propertyKeyTypes:()=>_y,randomString:()=>fCe,required:()=>xCe,safeExtend:()=>vCe,shallowClone:()=>cD,slugify:()=>sD,stringifyPrimitive:()=>Re,uint8ArrayToBase64:()=>B3,uint8ArrayToBase64url:()=>ECe,uint8ArrayToHex:()=>PCe,unwrapMessage:()=>Py});function oCe(e){return e}function iCe(e){return e}function sCe(e){}function aCe(e){throw new Error("Unexpected value in exhaustive check")}function cCe(e){}function Ay(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ie(e,t="|"){return e.map(n=>Re(n)).join(t)}function wf(e,t){return typeof t=="bigint"?t.toString():t}function bf(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function cl(e){return e==null}function Cy(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function iD(e,t){let n=(e.toString().split(".")[1]||"").length,r=t.toString(),o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){let c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=n>o?n:o,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}function ht(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==W3)return r===void 0&&(r=W3,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function lCe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ll(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ka(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function dCe(e){return Ka(e._zod.def)}function uCe(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function pCe(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}function fCe(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function m$(e){return JSON.stringify(e)}function sD(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function ru(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function dl(e){if(ru(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(ru(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function cD(e){return dl(e)?{...e}:Array.isArray(e)?[...e]:e}function gCe(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function xi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Kr(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Oe(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function hCe(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function Re(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function dD(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function yCe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Ka(e._zod.def,{get shape(){let s={};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return ll(this,"shape",s),s},checks:[]});return Kr(e,i)}function wCe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Ka(e._zod.def,{get shape(){let s={...e._zod.def.shape};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return ll(this,"shape",s),s},checks:[]});return Kr(e,i)}function bCe(e,t){if(!dl(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.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 o=Ka(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return ll(this,"shape",i),i}});return Kr(e,o)}function vCe(e,t){if(!dl(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=Ka(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return ll(this,"shape",r),r}});return Kr(e,n)}function kCe(e,t){let n=Ka(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return ll(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Kr(e,n)}function RCe(e,t,n){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=Ka(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(n)for(let l in n){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(c[l]=e?new e({type:"optional",innerType:a[l]}):a[l])}else for(let l in a)c[l]=e?new e({type:"optional",innerType:a[l]}):a[l];return ll(this,"shape",c),c},checks:[]});return Kr(t,s)}function xCe(e,t,n){let r=Ka(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(n)for(let s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(let s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return ll(this,"shape",i),i}});return Kr(t,r)}function ul(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Qo(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Py(e){return typeof e=="string"?e:e?.message}function xo(e,t,n){let r={...e,path:e.path??[]};if(!e.message){let o=Py(e.inst?._zod.def?.error?.(e))??Py(t?.error?.(e))??Py(n.customError?.(e))??Py(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Iy(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ty(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Se(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function vf(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function $Ce(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function G3(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function B3(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function SCe(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return G3(t+n)}function ECe(e){return B3(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function OCe(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function PCe(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var W3,h$,aD,mCe,_y,lD,uD,pD,oD,ze=$(()=>{W3=Symbol("evaluating");h$="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};aD=bf(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});mCe=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}`)}},_y=new Set(["string","number","symbol"]),lD=new Set(["string","number","bigint","boolean","symbol","undefined"]);uD={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]},pD={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};oD=class{constructor(...t){}}});function Ny(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function jy(e,t=n=>n.message){let n={_errors:[]},r=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>r({issues:s}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,a=0;for(;a<i.path.length;){let c=i.path[a];a===i.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return r(e),n}function fD(e,t=n=>n.message){let n={errors:[]},r=(o,i=[])=>{var s,a;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>r({issues:l},c.path));else if(c.code==="invalid_key")r({issues:c.issues},c.path);else if(c.code==="invalid_element")r({issues:c.issues},c.path);else{let l=[...i,...c.path];if(l.length===0){n.errors.push(t(c));continue}let d=n,u=0;for(;u<l.length;){let p=l[u],f=u===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=[]),(a=d.items)[p]??(a[p]={errors:[]}),d=d.items[p]),f&&d.errors.push(t(c)),u++}}};return r(e),n}function H3(e){let t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(let r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function gD(e){let t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of n)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${H3(r.path)}`);return t.join(`
8
8
  `)}var U3,Dy,$o,mD=$(()=>{yf();ze();U3=(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,wf,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Dy=K("$ZodError",U3),$o=K("$ZodError",U3,{Parent:Error})});var kf,y$,Rf,w$,xf,hD,$f,yD,b$,CCe,v$,_Ce,k$,ICe,R$,TCe,x$,DCe,$$,NCe,S$,jCe,E$,LCe,wD=$(()=>{yf();mD();ze();kf=e=>(t,n,r,o)=>{let i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new ps;if(s.issues.length){let a=new(o?.Err??e)(s.issues.map(c=>xo(c,i,Sn())));throw h$(a,o?.callee),a}return s.value},y$=kf($o),Rf=e=>async(t,n,r,o)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(o?.Err??e)(s.issues.map(c=>xo(c,i,Sn())));throw h$(a,o?.callee),a}return s.value},w$=Rf($o),xf=e=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new ps;return i.issues.length?{success:!1,error:new(e??Dy)(i.issues.map(s=>xo(s,o,Sn())))}:{success:!0,data:i.value}},hD=xf($o),$f=e=>async(t,n,r)=>{let o=r?Object.assign(r,{async:!0}):{async:!0},i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>xo(s,o,Sn())))}:{success:!0,data:i.value}},yD=$f($o),b$=e=>(t,n,r)=>{let o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return kf(e)(t,n,o)},CCe=b$($o),v$=e=>(t,n,r)=>kf(e)(t,n,r),_Ce=v$($o),k$=e=>async(t,n,r)=>{let o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Rf(e)(t,n,o)},ICe=k$($o),R$=e=>async(t,n,r)=>Rf(e)(t,n,r),TCe=R$($o),x$=e=>(t,n,r)=>{let o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return xf(e)(t,n,o)},DCe=x$($o),$$=e=>(t,n,r)=>xf(e)(t,n,r),NCe=$$($o),S$=e=>async(t,n,r)=>{let o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return $f(e)(t,n,o)},jCe=S$($o),E$=e=>async(t,n,r)=>$f(e)(t,n,r),LCe=E$($o)});var $i={};me($i,{base64:()=>DD,base64url:()=>O$,bigint:()=>WD,boolean:()=>BD,browserEmail:()=>zCe,cidrv4:()=>ID,cidrv6:()=>TD,cuid:()=>bD,cuid2:()=>vD,date:()=>jD,datetime:()=>MD,domain:()=>KCe,duration:()=>SD,e164:()=>ND,email:()=>OD,emoji:()=>PD,extendedDuration:()=>MCe,guid:()=>ED,hex:()=>JCe,hostname:()=>qCe,html5Email:()=>BCe,idnEmail:()=>HCe,integer:()=>GD,ipv4:()=>AD,ipv6:()=>CD,ksuid:()=>xD,lowercase:()=>zD,mac:()=>_D,md5_base64:()=>YCe,md5_base64url:()=>QCe,md5_hex:()=>ZCe,nanoid:()=>$D,null:()=>UD,number:()=>P$,rfc5322Email:()=>UCe,sha1_base64:()=>e_e,sha1_base64url:()=>t_e,sha1_hex:()=>XCe,sha256_base64:()=>r_e,sha256_base64url:()=>o_e,sha256_hex:()=>n_e,sha384_base64:()=>s_e,sha384_base64url:()=>a_e,sha384_hex:()=>i_e,sha512_base64:()=>l_e,sha512_base64url:()=>d_e,sha512_hex:()=>c_e,string:()=>FD,time:()=>LD,ulid:()=>kD,undefined:()=>HD,unicodeEmail:()=>z3,uppercase:()=>VD,uuid:()=>ou,uuid4:()=>FCe,uuid6:()=>WCe,uuid7:()=>GCe,xid:()=>RD});function PD(){return new RegExp(VCe,"u")}function q3(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+)?)?`}function LD(e){return new RegExp(`^${q3(e)}$`)}function MD(e){let t=q3({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${t}(?:${n.join("|")})`;return new RegExp(`^${V3}T(?:${r})$`)}function Ly(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function My(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var bD,vD,kD,RD,xD,$D,SD,MCe,ED,ou,FCe,WCe,GCe,OD,BCe,UCe,z3,HCe,zCe,VCe,AD,CD,_D,ID,TD,DD,O$,qCe,KCe,ND,V3,jD,FD,WD,GD,P$,BD,UD,HD,zD,VD,JCe,ZCe,YCe,QCe,XCe,e_e,t_e,n_e,r_e,o_e,i_e,s_e,a_e,c_e,l_e,d_e,A$=$(()=>{ze();bD=/^[cC][^\s-]{8,}$/,vD=/^[0-9a-z]+$/,kD=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,RD=/^[0-9a-vA-V]{20}$/,xD=/^[A-Za-z0-9]{27}$/,$D=/^[a-zA-Z0-9_-]{21}$/,SD=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,MCe=/^[-+]?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)?)??$/,ED=/^([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})$/,ou=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)$/,FCe=ou(4),WCe=ou(6),GCe=ou(7),OD=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,BCe=/^[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])?)*$/,UCe=/^(([^<>()\[\]\\.,;:\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,}))$/,z3=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,HCe=z3,zCe=/^[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])?)*$/,VCe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";AD=/^(?:(?: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])$/,CD=/^(([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}|:))$/,_D=e=>{let t=xi(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},ID=/^((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])$/,TD=/^(([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])$/,DD=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,O$=/^[A-Za-z0-9_-]*$/,qCe=/^(?=.{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])?)*\.?$/,KCe=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,ND=/^\+[1-9]\d{6,14}$/,V3="(?:(?:\\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])))",jD=new RegExp(`^${V3}$`);FD=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},WD=/^-?\d+n?$/,GD=/^-?\d+$/,P$=/^-?\d+(?:\.\d+)?$/,BD=/^(?:true|false)$/i,UD=/^null$/i,HD=/^undefined$/i,zD=/^[^A-Z]*$/,VD=/^[^a-z]*$/,JCe=/^[0-9a-fA-F]*$/;ZCe=/^[0-9a-fA-F]{32}$/,YCe=Ly(22,"=="),QCe=My(22),XCe=/^[0-9a-fA-F]{40}$/,e_e=Ly(27,"="),t_e=My(27),n_e=/^[0-9a-fA-F]{64}$/,r_e=Ly(43,"="),o_e=My(43),i_e=/^[0-9a-fA-F]{96}$/,s_e=Ly(64,""),a_e=My(64),c_e=/^[0-9a-fA-F]{128}$/,l_e=Ly(86,"=="),d_e=My(86)});function K3(e,t,n){e.issues.length&&t.issues.push(...Qo(n,e.issues))}var nn,J3,C$,_$,qD,KD,JD,ZD,YD,QD,XD,eN,tN,Sf,nN,rN,oN,iN,sN,aN,cN,lN,dN,I$=$(()=>{yf();A$();ze();nn=K("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),J3={number:"number",bigint:"bigint",object:"date"},C$=K("$ZodCheckLessThan",(e,t)=>{nn.init(e,t);let n=J3[typeof t.value];e._zod.onattach.push(r=>{let o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_$=K("$ZodCheckGreaterThan",(e,t)=>{nn.init(e,t);let n=J3[typeof t.value];e._zod.onattach.push(r=>{let o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qD=K("$ZodCheckMultipleOf",(e,t)=>{nn.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):iD(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),KD=K("$ZodCheckNumberFormat",(e,t)=>{nn.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=uD[t.format];e._zod.onattach.push(s=>{let a=s._zod.bag;a.format=t.format,a.minimum=o,a.maximum=i,n&&(a.pattern=GD)}),e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),JD=K("$ZodCheckBigIntFormat",(e,t)=>{nn.init(e,t);let[n,r]=pD[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=o=>{let i=o.value;i<n&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>r&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),ZD=K("$ZodCheckMaxSize",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{let o=r.value;return!cl(o)&&o.size!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let o=r.value;o.size<=t.maximum||r.issues.push({origin:Iy(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),YD=K("$ZodCheckMinSize",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{let o=r.value;return!cl(o)&&o.size!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let o=r.value;o.size>=t.minimum||r.issues.push({origin:Iy(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),QD=K("$ZodCheckSizeEquals",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{let o=r.value;return!cl(o)&&o.size!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=r=>{let o=r.value,i=o.size;if(i===t.size)return;let s=i>t.size;r.issues.push({origin:Iy(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),XD=K("$ZodCheckMaxLength",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{let o=r.value;return!cl(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let o=r.value;if(o.length<=t.maximum)return;let s=Ty(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),eN=K("$ZodCheckMinLength",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{let o=r.value;return!cl(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let o=r.value;if(o.length>=t.minimum)return;let s=Ty(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),tN=K("$ZodCheckLengthEquals",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{let o=r.value;return!cl(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{let o=r.value,i=o.length;if(i===t.length)return;let s=Ty(o),a=i>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Sf=K("$ZodCheckStringFormat",(e,t)=>{var n,r;nn.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),nN=K("$ZodCheckRegex",(e,t)=>{Sf.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),rN=K("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=zD),Sf.init(e,t)}),oN=K("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=VD),Sf.init(e,t)}),iN=K("$ZodCheckIncludes",(e,t)=>{nn.init(e,t);let n=xi(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),sN=K("$ZodCheckStartsWith",(e,t)=>{nn.init(e,t);let n=new RegExp(`^${xi(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),aN=K("$ZodCheckEndsWith",(e,t)=>{nn.init(e,t);let n=new RegExp(`.*${xi(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});cN=K("$ZodCheckProperty",(e,t)=>{nn.init(e,t),e._zod.check=n=>{let r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>K3(o,n,t.property));K3(r,n,t.property)}}),lN=K("$ZodCheckMimeType",(e,t)=>{nn.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(r=>{r._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),dN=K("$ZodCheckOverwrite",(e,t)=>{nn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}})});var Fy,uN=$(()=>{Fy=class{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 r=t.split(`
9
9
  `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,n=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
10
10
  `))}}});var pN,fN=$(()=>{pN={major:4,minor:3,patch:6}});function NN(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function cZ(e){if(!O$.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return NN(n)}function lZ(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}function Y3(e,t,n){e.issues.length&&t.issues.push(...Qo(n,e.issues)),t.value[n]=e.value}function L$(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Qo(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function dZ(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);let n=dD(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function uZ(e,t,n,r,o,i){let s=[],a=o.keySet,c=o.catchall._zod,l=c.def.type,d=c.optout==="optional";for(let u in t){if(a.has(u))continue;if(l==="never"){s.push(u);continue}let p=c.run({value:t[u],issues:[]},r);p instanceof Promise?e.push(p.then(f=>L$(f,n,u,t,d))):L$(p,n,u,t,d)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}function Q3(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!ul(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>xo(s,r,Sn())))}),t)}function X3(e,t,n,r){let o=e.filter(i=>i.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>xo(s,r,Sn())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t)}function gN(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(dl(e)&&dl(t)){let n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(let i of r){let s=gN(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],s=gN(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function eZ(e,t,n){let r=new Map,o;for(let a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(let c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(a);for(let a of n.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(a);let i=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&o&&e.issues.push({...o,keys:i}),ul(e))return e;let s=gN(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}function T$(e,t,n){e.issues.length&&t.issues.push(...Qo(n,e.issues)),t.value[n]=e.value}function tZ(e,t,n,r,o,i,s){e.issues.length&&(_y.has(typeof r)?n.issues.push(...Qo(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>xo(a,s,Sn()))})),t.issues.length&&(_y.has(typeof r)?n.issues.push(...Qo(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map(a=>xo(a,s,Sn()))})),n.value.set(e.value,t.value)}function nZ(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function rZ(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}function oZ(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function iZ(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function D$(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}function N$(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>j$(e,i,t.out,n)):j$(e,o,t.out,n)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>j$(e,i,t.in,n)):j$(e,o,t.in,n)}}function j$(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}function sZ(e){return e.value=Object.freeze(e.value),e}function aZ(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(vf(o))}}var rt,iu,Jt,mN,hN,yN,wN,bN,vN,kN,RN,xN,$N,SN,EN,ON,PN,AN,CN,_N,IN,TN,DN,jN,LN,MN,FN,WN,M$,GN,Wy,F$,BN,UN,HN,zN,VN,qN,KN,JN,ZN,YN,pZ,QN,Gy,XN,ej,tj,W$,nj,rj,oj,ij,sj,aj,cj,G$,lj,dj,uj,pj,fj,gj,mj,hj,yj,By,wj,bj,vj,kj,Rj,xj,$j=$(()=>{I$();yf();uN();wD();A$();ze();fN();ze();rt=K("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=pN;let r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(let o of r)for(let i of o._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(s,a,c)=>{let l=ul(s),d;for(let u of a){if(u._zod.def.when){if(!u._zod.def.when(s))continue}else if(l)continue;let p=s.issues.length,f=u._zod.check(s);if(f instanceof Promise&&c?.async===!1)throw new ps;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(l||(l=ul(s,p)))});else{if(s.issues.length===p)continue;l||(l=ul(s,p))}}return d?d.then(()=>s):s},i=(s,a,c)=>{if(ul(s))return s.aborted=!0,s;let l=o(a,r,c);if(l instanceof Promise){if(c.async===!1)throw new ps;return l.then(d=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){let l=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,s,a)):i(l,s,a)}let c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new ps;return c.then(l=>o(l,r,a))}return o(c,r,a)}}ht(e,"~standard",()=>({validate:o=>{try{let i=hD(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return yD(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),iu=K("$ZodString",(e,t)=>{rt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??FD(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Jt=K("$ZodStringFormat",(e,t)=>{Sf.init(e,t),iu.init(e,t)}),mN=K("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ED),Jt.init(e,t)}),hN=K("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ou(r))}else t.pattern??(t.pattern=ou());Jt.init(e,t)}),yN=K("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=OD),Jt.init(e,t)}),wN=K("$ZodURL",(e,t)=>{Jt.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),bN=K("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=PD()),Jt.init(e,t)}),vN=K("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=$D),Jt.init(e,t)}),kN=K("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=bD),Jt.init(e,t)}),RN=K("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=vD),Jt.init(e,t)}),xN=K("$ZodULID",(e,t)=>{t.pattern??(t.pattern=kD),Jt.init(e,t)}),$N=K("$ZodXID",(e,t)=>{t.pattern??(t.pattern=RD),Jt.init(e,t)}),SN=K("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=xD),Jt.init(e,t)}),EN=K("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=MD(t)),Jt.init(e,t)}),ON=K("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=jD),Jt.init(e,t)}),PN=K("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=LD(t)),Jt.init(e,t)}),AN=K("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=SD),Jt.init(e,t)}),CN=K("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=AD),Jt.init(e,t),e._zod.bag.format="ipv4"}),_N=K("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=CD),Jt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),IN=K("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=_D(t.delimiter)),Jt.init(e,t),e._zod.bag.format="mac"}),TN=K("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ID),Jt.init(e,t)}),DN=K("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=TD),Jt.init(e,t),e._zod.check=n=>{let r=n.value.split("/");try{if(r.length!==2)throw new Error;let[o,i]=r;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://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});jN=K("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=DD),Jt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{NN(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});LN=K("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=O$),Jt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{cZ(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),MN=K("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ND),Jt.init(e,t)});FN=K("$ZodJWT",(e,t)=>{Jt.init(e,t),e._zod.check=n=>{lZ(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),WN=K("$ZodCustomStringFormat",(e,t)=>{Jt.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),M$=K("$ZodNumber",(e,t)=>{rt.init(e,t),e._zod.pattern=e._zod.bag.pattern??P$,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),GN=K("$ZodNumberFormat",(e,t)=>{KD.init(e,t),M$.init(e,t)}),Wy=K("$ZodBoolean",(e,t)=>{rt.init(e,t),e._zod.pattern=BD,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),F$=K("$ZodBigInt",(e,t)=>{rt.init(e,t),e._zod.pattern=WD,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),BN=K("$ZodBigIntFormat",(e,t)=>{JD.init(e,t),F$.init(e,t)}),UN=K("$ZodSymbol",(e,t)=>{rt.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),HN=K("$ZodUndefined",(e,t)=>{rt.init(e,t),e._zod.pattern=HD,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),zN=K("$ZodNull",(e,t)=>{rt.init(e,t),e._zod.pattern=UD,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),VN=K("$ZodAny",(e,t)=>{rt.init(e,t),e._zod.parse=n=>n}),qN=K("$ZodUnknown",(e,t)=>{rt.init(e,t),e._zod.parse=n=>n}),KN=K("$ZodNever",(e,t)=>{rt.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),JN=K("$ZodVoid",(e,t)=>{rt.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),ZN=K("$ZodDate",(e,t)=>{rt.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});YN=K("$ZodArray",(e,t)=>{rt.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);let i=[];for(let s=0;s<o.length;s++){let a=o[s],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?i.push(c.then(l=>Y3(l,n,s))):Y3(c,n,s)}return i.length?Promise.all(i).then(()=>n):n}});pZ=K("$ZodObject",(e,t)=>{if(rt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let r=bf(()=>dZ(t));ht(e._zod,"propValues",()=>{let a=t.shape,c={};for(let l in a){let d=a[l]._zod;if(d.values){c[l]??(c[l]=new Set);for(let u of d.values)c[l].add(u)}}return c});let o=ru,i=t.catchall,s;e._zod.parse=(a,c)=>{s??(s=r.value);let l=a.value;if(!o(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};let d=[],u=s.shape;for(let p of s.keys){let f=u[p],g=f._zod.optout==="optional",m=f._zod.run({value:l[p],issues:[]},c);m instanceof Promise?d.push(m.then(y=>L$(y,a,p,l,g))):L$(m,a,p,l,g)}return i?uZ(d,l,a,c,r.value,e):d.length?Promise.all(d).then(()=>a):a}}),QN=K("$ZodObjectJIT",(e,t)=>{pZ.init(e,t);let n=e._zod.parse,r=bf(()=>dZ(t)),o=p=>{let f=new Fy(["shape","payload","ctx"]),g=r.value,m=v=>{let k=m$(v);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),w=0;for(let v of g.keys)y[v]=`key_${w++}`;f.write("const newResult = {};");for(let v of g.keys){let k=y[v],x=m$(v),E=p[v]?._zod?.optout==="optional";f.write(`const ${k} = ${m(v)};`),E?f.write(`
@@ -107,7 +107,7 @@ status:${e.status}`,"utf-8")])}function xNe(e,t,n){let r=`the approval of gate $
107
107
  `+I.slice(ue+1):Ne+=I.slice(he),Ne.slice(1)}function Fn(I){let Y="",oe=0;for(let fe=0;fe<I.length;oe>=65536?fe+=2:fe++){oe=Pe(I,fe);let he=C[oe];!he&&se(oe)?(Y+=I[fe],oe>=65536&&(Y+=I[fe+1])):Y+=he||J(oe)}return Y}function yr(I,Y,oe){let fe="",he=I.tag;for(let ke=0,ue=oe.length;ke<ue;ke+=1){let Ae=oe[ke];I.replacer&&(Ae=I.replacer.call(oe,String(ke),Ae)),(V(I,Y,Ae,!1,!1)||typeof Ae>"u"&&V(I,Y,null,!1,!1))&&(fe!==""&&(fe+=","+(I.condenseFlow?"":" ")),fe+=I.dump)}I.tag=he,I.dump="["+fe+"]"}function qr(I,Y,oe,fe){let he="",ke=I.tag;for(let ue=0,Ae=oe.length;ue<Ae;ue+=1){let Ne=oe[ue];I.replacer&&(Ne=I.replacer.call(oe,String(ue),Ne)),(V(I,Y+1,Ne,!0,!0,!1,!0)||typeof Ne>"u"&&V(I,Y+1,null,!0,!0,!1,!0))&&((!fe||he!=="")&&(he+=U(I,Y)),I.dump&&a===I.dump.charCodeAt(0)?he+="-":he+="- ",he+=I.dump)}I.tag=ke,I.dump=he||"[]"}function Ir(I,Y,oe){let fe="",he=I.tag,ke=Object.keys(oe);for(let ue=0,Ae=ke.length;ue<Ae;ue+=1){let Ne="";fe!==""&&(Ne+=", "),I.condenseFlow&&(Ne+='"');let qe=ke[ue],Ze=oe[qe];I.replacer&&(Ze=I.replacer.call(oe,qe,Ze)),V(I,Y,qe,!1,!1)&&(I.dump.length>1024&&(Ne+="? "),Ne+=I.dump+(I.condenseFlow?'"':"")+":"+(I.condenseFlow?"":" "),V(I,Y,Ze,!1,!1)&&(Ne+=I.dump,fe+=Ne))}I.tag=he,I.dump="{"+fe+"}"}function ol(I,Y,oe,fe){let he="",ke=I.tag,ue=Object.keys(oe);if(I.sortKeys===!0)ue.sort();else if(typeof I.sortKeys=="function")ue.sort(I.sortKeys);else if(I.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let Ae=0,Ne=ue.length;Ae<Ne;Ae+=1){let qe="";(!fe||he!=="")&&(qe+=U(I,Y));let Ze=ue[Ae],Xe=oe[Ze];if(I.replacer&&(Xe=I.replacer.call(oe,Ze,Xe)),!V(I,Y+1,Ze,!0,!0,!0))continue;let ut=I.tag!==null&&I.tag!=="?"||I.dump&&I.dump.length>1024;ut&&(I.dump&&a===I.dump.charCodeAt(0)?qe+="?":qe+="? "),qe+=I.dump,ut&&(qe+=U(I,Y)),V(I,Y+1,Xe,!0,ut)&&(I.dump&&a===I.dump.charCodeAt(0)?qe+=":":qe+=": ",qe+=I.dump,he+=qe)}I.tag=ke,I.dump=he||"{}"}function R(I,Y,oe){let fe=oe?I.explicitTypes:I.implicitTypes;for(let he=0,ke=fe.length;he<ke;he+=1){let ue=fe[he];if((ue.instanceOf||ue.predicate)&&(!ue.instanceOf||typeof Y=="object"&&Y instanceof ue.instanceOf)&&(!ue.predicate||ue.predicate(Y))){if(oe?ue.multi&&ue.representName?I.tag=ue.representName(Y):I.tag=ue.tag:I.tag="?",ue.represent){let Ae=I.styleMap[ue.tag]||ue.defaultStyle,Ne;if(r.call(ue.represent)==="[object Function]")Ne=ue.represent(Y,Ae);else if(o.call(ue.represent,Ae))Ne=ue.represent[Ae](Y,Ae);else throw new t("!<"+ue.tag+'> tag resolver accepts not "'+Ae+'" style');I.dump=Ne}return!0}}return!1}function V(I,Y,oe,fe,he,ke,ue){I.tag=null,I.dump=oe,R(I,oe,!1)||R(I,oe,!0);let Ae=r.call(I.dump),Ne=fe;fe&&(fe=I.flowLevel<0||I.flowLevel>Y);let qe=Ae==="[object Object]"||Ae==="[object Array]",Ze,Xe;if(qe&&(Ze=I.duplicates.indexOf(oe),Xe=Ze!==-1),(I.tag!==null&&I.tag!=="?"||Xe||I.indent!==2&&Y>0)&&(he=!1),Xe&&I.usedDuplicates[Ze])I.dump="*ref_"+Ze;else{if(qe&&Xe&&!I.usedDuplicates[Ze]&&(I.usedDuplicates[Ze]=!0),Ae==="[object Object]")fe&&Object.keys(I.dump).length!==0?(ol(I,Y,I.dump,he),Xe&&(I.dump="&ref_"+Ze+I.dump)):(Ir(I,Y,I.dump),Xe&&(I.dump="&ref_"+Ze+" "+I.dump));else if(Ae==="[object Array]")fe&&I.dump.length!==0?(I.noArrayIndent&&!ue&&Y>0?qr(I,Y-1,I.dump,he):qr(I,Y,I.dump,he),Xe&&(I.dump="&ref_"+Ze+I.dump)):(yr(I,Y,I.dump),Xe&&(I.dump="&ref_"+Ze+" "+I.dump));else if(Ae==="[object String]")I.tag!=="?"&&Mt(I,I.dump,Y,ke,Ne);else{if(Ae==="[object Undefined]")return!1;if(I.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+Ae)}if(I.tag!==null&&I.tag!=="?"){let ut=encodeURI(I.tag[0]==="!"?I.tag.slice(1):I.tag).replace(/!/g,"%21");I.tag[0]==="!"?ut="!"+ut:ut.slice(0,18)==="tag:yaml.org,2002:"?ut="!!"+ut.slice(18):ut="!<"+ut+">",I.dump=ut+" "+I.dump}}return!0}function re(I,Y){let oe=[],fe=[];de(I,oe,fe);let he=fe.length;for(let ke=0;ke<he;ke+=1)Y.duplicates.push(oe[fe[ke]]);Y.usedDuplicates=new Array(he)}function de(I,Y,oe){if(I!==null&&typeof I=="object"){let fe=Y.indexOf(I);if(fe!==-1)oe.indexOf(fe)===-1&&oe.push(fe);else if(Y.push(I),Array.isArray(I))for(let he=0,ke=I.length;he<ke;he+=1)de(I[he],Y,oe);else{let he=Object.keys(I);for(let ke=0,ue=he.length;ke<ue;ke+=1)de(I[he[ke]],Y,oe)}}}function ne(I,Y){Y=Y||{};let oe=new G(Y);oe.noRefs||re(I,oe);let fe=I;return oe.replacer&&(fe=oe.replacer.call({"":fe},"",fe)),V(oe,0,fe,!0,!0)?oe.dump+`
108
108
  `:""}return kB.dump=ne,kB}function kGe(){if($re)return Lr;$re=1;let e=bGe(),t=vGe();function n(r,o){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+o+" instead, which is now safe by default.")}}return Lr.Type=io(),Lr.Schema=Sre(),Lr.FAILSAFE_SCHEMA=Are(),Lr.JSON_SCHEMA=Dre(),Lr.CORE_SCHEMA=Nre(),Lr.DEFAULT_SCHEMA=RB(),Lr.load=e.load,Lr.loadAll=e.loadAll,Lr.dump=t.dump,Lr.YAMLException=Rb(),Lr.types={binary:Mre(),float:Tre(),map:Pre(),null:Cre(),pairs:Wre(),set:Gre(),timestamp:jre(),bool:_re(),int:Ire(),merge:Lre(),omap:Fre(),seq:Ore(),str:Ere()},Lr.safeLoad=n("safeLoad","load"),Lr.safeLoadAll=n("safeLoadAll","loadAll"),Lr.safeDump=n("safeDump","dump"),Lr}var Lr,_O,Dl,ere,eB,tre,tB,nre,nB,rre,rB,ore,oB,ire,iB,sre,sB,are,aB,cre,cB,lre,lB,dre,dB,ure,uB,pre,pB,fre,fB,gre,gB,mre,mB,hre,hB,yre,yB,wre,wB,bre,bB,vre,vB,kre,Rre,kB,xre,$re,RGe,ic,DRt,NRt,jRt,LRt,MRt,FRt,WRt,GRt,BRt,URt,HRt,zRt,VRt,qRt,IO=$(()=>{Lr={},_O={},Dl={};kB={};RGe=kGe(),ic=yGe(RGe),{Type:DRt,Schema:NRt,FAILSAFE_SCHEMA:jRt,JSON_SCHEMA:LRt,CORE_SCHEMA:MRt,DEFAULT_SCHEMA:FRt,load:WRt,loadAll:GRt,dump:BRt,YAMLException:URt,types:HRt,safeLoad:zRt,safeLoadAll:VRt,safeDump:qRt}=ic});import{existsSync as Bre,readFileSync as LO}from"node:fs";import{isAbsolute as DO,join as $B,relative as NO,resolve as jO}from"node:path";function WO(e=[]){let t=new Map;for(let n of[...Ure,...e]){if(t.has(n.name))throw new Error(`kind ${n.name} is registered twice`);t.set(n.name,n)}return{get:n=>t.get(n),names:()=>[...t.values()].filter(n=>n.shape==="member").map(n=>n.name).sort(),all:()=>[...t.values()]}}function Hre(){return WO()}function SB(e,t,n){if("directory"in e.probe)return!0;if("chantProject"in e.probe)return OB(t,n);if("repo"in e.probe)return!0;let{anyFile:r,anyBlock:o,anyJsonKey:i,anyLine:s,anyDocument:a}=e.probe;if(r&&xb(t,n,r).length>0)return!0;if(i)for(let c of xb(t,n,i.in))try{let l=JSON.parse(t.read(c));if(i.pointers.some(d=>zre(l,d)!==void 0))return!0}catch{}if(s){let c=s.starts.map(l=>l.toLowerCase());for(let l of xb(t,n,s.in))try{if(t.read(l).split(/\r?\n/).some(d=>c.some(u=>d.trimStart().toLowerCase().startsWith(u))))return!0}catch{}}if(a)for(let c of xb(t,n,a.in))try{if(EGe(t.read(c)).some(l=>a.match.some(d=>OGe(l,d))))return!0}catch{}if(o){let c=new RegExp(`^\\s*(?:${o.blocks.map(EB).join("|")})\\s*\\{`,"m");for(let l of xb(t,n,o.in))try{if(c.test(t.read(l)))return!0}catch{}}return!1}function SGe(e){return!("directory"in e)&&!("chantProject"in e)&&!("repo"in e)}function xb(e,t,n){let r=[],o=n.filter(i=>i.includes("*"));for(let i of n)!i.includes("*")&&e.stat(je(t,i))==="file"&&r.push(je(t,i));if(o.length>0){let i=o.map(s=>new RegExp(`^${s.split("*").map(a=>EB(a).replace(/\\\[0-9\\\]/g,"[0-9]")).join("[^/]*")}$`));for(let s of e.list(t)??[])s.type==="file"&&i.some(a=>a.test(s.name))&&r.push(je(t,s.name))}return r.sort()}function EGe(e){try{return ic.loadAll(e)}catch{try{return ic.loadAll(e.replace(/(^|[\s:\-[,{])!(?:[A-Za-z][\w]*:?)+/gm,"$1"))}catch{return[]}}}function OGe(e,t){let n=Object.entries(t);return n.length>0&&n.every(([r,o])=>{let i=zre(e,r);return i===void 0?!1:o.some(s=>new RegExp(`^${s.split("*").map(EB).join(".*")}$`).test(String(i)))})}function zre(e,t){let n=e;for(let r of t.split("/").slice(1)){let o=r.replace(/~1/g,"/").replace(/~0/g,"~");if(n===null||typeof n!="object"||!Object.prototype.hasOwnProperty.call(n,o))return;n=n[o]}return n}function EB(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Vre(e,t,n,r=[]){let o=e.all().filter(s=>s.shape==="member"&&SGe(s.probe)&&!r.includes(s.name)&&SB(s,t,n)).sort((s,a)=>a.precedence-s.precedence||(s.name<a.name?-1:1)),i=o.filter(s=>s.precedence===o[0]?.precedence);return{claims:o,winner:i.length===1?i[0]:void 0,tie:i.length>1?i:[]}}function OB(e,t){let n=je(t,"package.json");if(e.stat(n)==="file")try{let o=JSON.parse(e.read(n));for(let i of["dependencies","devDependencies","peerDependencies"]){let s=o[i];if(s&&typeof s=="object"&&Object.keys(s).some(CGe))return!0}}catch{}let r=(o,i)=>{let s=e.list(o)??[];return s.some(a=>a.type==="file"&&PGe.includes(a.name))?!0:i===AGe?!1:s.some(a=>a.type==="dir"&&!to(a.name)&&r(je(o,a.name),i+1))};return r(t,0)}function CGe(e){return e==="@intentius/chant"||e.startsWith("@intentius/chant-lexicon-")}function _Ge(){if(TO)return TO;let e=oc();return TO=new e({allErrors:!0,strict:!0}).compile(PF),TO}function IGe(e,t){let n;try{n=JSON.parse(e)}catch(a){return{kinds:[],problems:[`${t}: the kinds file is not JSON (${a.message})`]}}let r=_Ge();if(!r(n)){let a=(r.errors??[]).map(c=>`${t}: ${c.instancePath||"the kinds file"} ${c.message??"is invalid"}`);return{kinds:[],problems:[...new Set(a)]}}let o=[],i=[],s=new Set;for(let a of n.kinds){if($Ge.includes(a.name)){o.push(`${t}: kind ${a.name} is built in and can't be supplied by a package`);continue}if(s.has(a.name)){o.push(`${t}: kind ${a.name} is listed twice`);continue}s.add(a.name),i.push({name:a.name,description:a.description,probe:{...a.probe.anyFile?{anyFile:[...a.probe.anyFile]}:{},...a.probe.anyBlock?{anyBlock:{in:[...a.probe.anyBlock.in],blocks:[...a.probe.anyBlock.blocks]}}:{},...a.probe.anyJsonKey?{anyJsonKey:{in:[...a.probe.anyJsonKey.in],pointers:[...a.probe.anyJsonKey.pointers]}}:{},...a.probe.anyLine?{anyLine:{in:[...a.probe.anyLine.in],starts:[...a.probe.anyLine.starts]}}:{},...a.probe.anyDocument?{anyDocument:{in:[...a.probe.anyDocument.in],match:a.probe.anyDocument.match.map(c=>structuredClone(c))}}:{}},precedence:a.precedence,shape:"member",outputs:{from:"declared",names:[...a.outputs??[]]},source:t,...a.graph?{graph:{...a.graph.lexicon?{lexicon:a.graph.lexicon}:{},...a.graph.reader?{reader:a.graph.reader}:{},config:structuredClone(a.graph.config??{})}}:{},...a.drift?{drift:{reader:a.drift.reader,config:structuredClone(a.drift.config??{})}}:{},...a.fields?{fields:structuredClone(a.fields)}:{},...a.reader&&xB.includes(a.reader)?{reader:a.reader}:{},...a.memberFile?{memberFile:{path:a.memberFile.path,schema:a.memberFile.schema}}:{}}),a.reader&&!xB.includes(a.reader)&&o.push(`${t}: kind ${a.name} names link reader ${a.reader}, which this chant does not have (it has ${xB.join(", ")}); the kind is kept, and its members' links are only those their entries state`);for(let c of NGe(a.fields??{}))o.push(`${t}: kind ${a.name} ${c}`)}return{kinds:i,problems:o}}function TGe(e,t=$b){return Bw(e,t)}function PB(e,t){let n=$B(e,"package.json"),r;try{r=JSON.parse(LO(n,"utf-8"))}catch{return{kinds:[],problems:[`${t??e}: no readable package.json in ${e}`],file:void 0}}let o=t??(typeof r.name=="string"?r.name:e),i=TGe(r);if(i===void 0)return{kinds:[],problems:[],file:void 0};if(typeof i!="string")return{kinds:[],problems:[`${o}: ${i.problem}`],file:void 0};let s=jO(e,i),a=NO(e,s);if(a.startsWith("..")||DO(a))return{kinds:[],problems:[`${o}: exports["${$b}"] points outside the package`],file:void 0};let c;try{c=LO(s,"utf-8")}catch{return{kinds:[],problems:[`${o}: exports["${$b}"] names ${i}, which does not exist`],file:s}}let l=IGe(c,o),d=typeof r.name=="string"?r.name:void 0;for(let u of l.kinds){if(u.packageDir=e,u.memberFile){let p=DGe(u.memberFile,e);p&&l.problems.push(`${o}: kind ${u.name} ${p}; members of the kind fail WSP012 until it is fixed`)}if(u.graph?.reader){let p=jO(e,...u.graph.reader.split("/")),f=NO(e,p);f.startsWith("..")||DO(f)?(l.problems.push(`${o}: kind ${u.name} names graph reader ${u.graph.reader}, which is outside the package; the kind is kept, and workspace graph lists its members with kind-not-run`),delete u.graph):Bre(p)?u.graph.readerFile=p:(l.problems.push(`${o}: kind ${u.name} names graph reader ${u.graph.reader}, which does not exist in the package; the kind is kept, and workspace graph lists its members with kind-not-run`),delete u.graph)}else u.graph?.lexicon&&d!==MO(u.graph.lexicon)&&(l.problems.push(`${o}: kind ${u.name} reads its members with lexicon ${u.graph.lexicon}, which is ${MO(u.graph.lexicon)}, and this package is ${d??"unnamed"}; the kind is kept, and workspace graph lists its members with kind-not-run`),delete u.graph);if(u.drift){let p=jO(e,...u.drift.reader.split("/")),f=NO(e,p);f.startsWith("..")||DO(f)?(l.problems.push(`${o}: kind ${u.name} names drift reader ${u.drift.reader}, which is outside the package; the kind is kept, and workspace drift answers no-drift-read for its members`),delete u.drift):Bre(p)?u.drift.readerFile=p:(l.problems.push(`${o}: kind ${u.name} names drift reader ${u.drift.reader}, which does not exist in the package; the kind is kept, and workspace drift answers no-drift-read for its members`),delete u.drift)}}return{...l,file:s}}function DGe(e,t){let n=jO(t,...e.schema.split("/"));e.schemaFile=n;let r=NO(t,n);if(r.startsWith("..")||DO(r))return`names member-file schema ${e.schema}, which is outside the package`;let o;try{o=JSON.parse(LO(n,"utf-8"))}catch(i){return i.code==="ENOENT"?`names member-file schema ${e.schema}, which does not exist`:`names member-file schema ${e.schema}, which is not JSON (${i.message})`}if(o===null||typeof o!="object"||Array.isArray(o))return`names member-file schema ${e.schema}, which is not a JSON Schema object`;try{let i=oc();e.validate=new i({allErrors:!0,strict:!1}).compile(o)}catch(i){return`names member-file schema ${e.schema}, which does not compile as a draft 2020-12 schema (${i.message})`}}function MO(e){return`@intentius/chant-lexicon-${e}`}function AB(e,t){let n=o=>o.replace(/\{(member|dir|workspace)\}/g,(i,s)=>t[s]),r=o=>typeof o=="string"?n(o):Array.isArray(o)?o.map(r):o!==null&&typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,s])=>[n(i),r(s)])):o;return r(e)}function CB(e,t,n=bu){if(e.package){let r=ia(e.package,t)??ia(e.package,n);if(!r)return{problem:`pinned package ${e.package} is not installed; install it to read the kinds it supplies`};let o;try{o=JSON.parse(LO($B(r,"package.json"),"utf-8")).version}catch{o=void 0}return e.version&&o!==e.version?{problem:`${e.package} is pinned at ${e.version}, and ${String(o??"an unknown version")} is installed`}:{dir:r,source:e.package}}if(e.path){let r=$B(t,...e.path.split("/"));if(e.integrity){let o=YX(r,e.integrity,e.path);if(!o.ok)return{problem:o.message}}return{dir:r,source:e.path}}return null}function Iu(e,t){let n=[],r=[],o=new Map,i=new Set;return e.forEach((s,a)=>{let c=CB(s,t);if(c===null)return;if("problem"in c){n.push({pin:a,message:c.problem});return}let{dir:l,source:d}=c,u=PB(l,d);for(let p of u.problems)n.push({pin:a,message:p});for(let p of u.kinds){let f=o.get(p.name);if(f){i.add(p.name),n.push({pin:a,message:`kind ${p.name} is supplied by both ${f} and ${d}; a kind name has one source`});continue}o.set(p.name,d),r.push(p)}}),{registry:WO(r.filter(s=>!i.has(s.name))),problems:n}}function qre(e,t){if(!(e.type==="integer"?typeof t=="number"&&Number.isInteger(t):typeof t===e.type))return`is ${JSON.stringify(t)}, and the field is ${e.type==="integer"?"an integer":`a ${e.type}`}`;if(e.pattern!==void 0&&typeof t=="string"){let r;try{r=new RegExp(e.pattern,"u")}catch{return}if(!r.test(t))return`is ${JSON.stringify(t)}, which does not match ${e.pattern}`}}function NGe(e){let t=[],n=(r,o)=>{if(o.pattern!==void 0)try{new RegExp(o.pattern,"u")}catch{t.push(`declares field ${r} with pattern ${o.pattern}, which is not a regular expression`);return}if(o.default===void 0)return;let i=qre(o,o.default);i&&t.push(`declares field ${r} whose default ${i}`)};for(let[r,o]of Object.entries(e))if(o.type==="object")for(let[i,s]of Object.entries(o.properties))n(`${r}.${i}`,s);else n(r,o);return t}function _B(e,t){if(e===void 0)return{fields:null,problems:[]};let n=e.fields,r=[];if(n===void 0)return t!==null&&r.push({path:"",message:`kind ${e.name} declares no fields, and the entry sets ${Object.keys(t).join(", ")||"an empty fields block"}`}),{fields:null,problems:r};let o=t??{};for(let a of Object.keys(o))a in n||r.push({path:a,message:`kind ${e.name} declares no field ${a}; its fields are ${Object.keys(n).join(", ")}`});let i=(a,c,l)=>{if(l!==void 0){let d=qre(c,l);if(!d)return l;r.push({path:a,message:`field ${a.replace("/",".")} ${d}`})}return c.default??null},s={};for(let[a,c]of Object.entries(n)){if(c.type!=="object"){s[a]=i(a,c,o[a]);continue}let l=o[a],d={};l!==void 0&&(l!==null&&typeof l=="object"&&!Array.isArray(l)?d=l:r.push({path:a,message:`field ${a} is ${JSON.stringify(l)}, and the field is an object`}));for(let u of Object.keys(d))u in c.properties||r.push({path:`${a}/${u}`,message:`kind ${e.name} declares no field ${a}.${u}; ${a} has ${Object.keys(c.properties).join(", ")}`});s[a]=Object.fromEntries(Object.entries(c.properties).map(([u,p])=>[u,i(`${a}/${u}`,p,d[u])]))}return{fields:s,problems:r}}var rxt,$b,xB,FO,sc,xGe,Ure,$Ge,PGe,AGe,TO,oi=$(()=>{"use strict";VX();qt();QX();Sl();vb();IO();rxt=PF.$id,$b="./workspace-kinds",xB=["dbt-project","goose-dir","golang-migrate-dir","clickhouse-migrations-dir","flyway-dir"],FO="examples",sc="repo",xGe="design",Ure=[{name:"chant",description:"a chant project, with a chant.config.ts or chant.config.json in its directory",probe:{anyFile:["chant.config.ts","chant.config.json"]},precedence:500,shape:"member",outputs:{from:"chant-source"},source:"builtin"},{name:"workspace",description:"a nested workspace, with its own chant.workspace.json; the outer one reads it through its own chant workspace graph and never writes inside it",probe:{anyFile:["chant.workspace.json","chant.workspace.jsonc"]},precedence:1e3,shape:"member",outputs:{from:"none"},source:"builtin"},{name:sc,description:"another repository's workspace, named by URL and pinned revision; chant reads it through that repository's own chant workspace graph and never writes there",probe:{repo:!0},precedence:0,shape:"member",outputs:{from:"none"},source:"builtin"},{name:"other",description:"a directory chant does not read; the entry says why in `because`",probe:{directory:!0},precedence:0,shape:"member",outputs:{from:"declared",names:[]},source:"builtin"},{name:xGe,description:"a data member holding the design artifacts the workspace owns; chant reads its files for record pins and builds nothing",probe:{directory:!0},precedence:0,shape:"member",outputs:{from:"declared",names:[]},source:"builtin"},{name:FO,description:"an example group: every directory its glob matches that holds a chant project is built and linted",probe:{chantProject:!0},precedence:0,shape:"group",outputs:{from:"none"},source:"builtin"}],$Ge=Ure.map(e=>e.name);PGe=["chant.config.ts","chant.config.json"],AGe=4});function ac(e){return String(e).replace(/~/g,"~0").replace(/\//g,"~1")}function Nl(e,t){let n=[0];for(let y=0;y<e.length;y++)e.charCodeAt(y)===10&&n.push(y+1);let r=y=>{let w=0,b=n.length-1;for(;w<b;){let v=w+b+1>>1;n[v]<=y?w=v:b=v-1}return{line:w+1,column:y-n[w]+1}},o=new Map,i=new Map,s=new Map,a=e.charCodeAt(0)===65279?1:0,c=(y,w=a)=>{throw new GO(y,w)},l=y=>y>=e.length?"the end of the file":`${JSON.stringify(e[y])}`;function d(){for(;;){let y=e[a];if(y===" "||y===" "||y===`
109
109
  `||y==="\r")a++;else if(y==="/"&&(e[a+1]==="/"||e[a+1]==="*"))if(t.jsonc||c("comments are only allowed in chant.workspace.jsonc"),e[a+1]==="/")for(;a<e.length&&e[a]!==`
110
- `;)a++;else{let w=e.indexOf("*/",a+2);w<0&&c("unterminated /* comment"),a=w+2}else return}}function u(){let y=a;for(a++;;){a>=e.length&&c("unterminated string",y);let w=e.charCodeAt(a);if(w===34)break;w<32&&c("control character in a string; escape it",a),a+=w===92?2:1}a++;try{return JSON.parse(e.slice(y,a))}catch{return c("invalid escape in a string",y)}}function p(y){d(),o.set(y,a);let w=f(y);return i.set(y,a),w}function f(y){let w=e[a];if(w==="{")return g(y);if(w==="[")return m(y);if(w==='"')return u();for(let[v,k]of[["true",!0],["false",!1],["null",null]])if(e.startsWith(v,a))return a+=v.length,k;let b=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(e.slice(a,a+64));return b?(a+=b[0].length,Number(b[0])):c(`expected a value, found ${l(a)}`)}function g(y){let w={},b=new Set;if(a++,d(),e[a]==="}")return a++,w;for(;;){d(),e[a]!=='"'&&c(`expected a quoted key, found ${l(a)}`);let v=a,k=u();b.has(k)&&c(`duplicate key ${JSON.stringify(k)}`,v),b.add(k);let x=`${y}/${ac(k)}`;if(s.set(x,v),d(),e[a]!==":"&&c(`expected ":" after key ${JSON.stringify(k)}, found ${l(a)}`),a++,Object.defineProperty(w,k,{value:p(x),enumerable:!0,writable:!0,configurable:!0}),d(),e[a]===","){if(a++,d(),e[a]==="}")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,w;continue}if(e[a]==="}")return a++,w;c(`expected "," or "}", found ${l(a)}`)}}function m(y){let w=[];if(a++,d(),e[a]==="]")return a++,w;for(;;){if(w.push(p(`${y}/${w.length}`)),d(),e[a]===","){if(a++,d(),e[a]==="]")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,w;continue}if(e[a]==="]")return a++,w;c(`expected "," or "]", found ${l(a)}`)}}try{d(),a>=e.length&&c("the file is empty");let y=p("");return d(),a<e.length&&c(`unexpected ${l(a)} after the value`),{ok:!0,value:y,locate(w,b){if(b&&s.has(w))return r(s.get(w));for(let v=w;;v=v.slice(0,v.lastIndexOf("/"))){let k=o.get(v);if(k!==void 0)return r(k);if(v==="")return r(0)}},span(w){let b=o.get(w),v=i.get(w);if(!(b===void 0||v===void 0))return{key:s.get(w)??null,start:b,end:v}}}}catch(y){if(!(y instanceof GO))throw y;return{ok:!1,message:y.message,location:r(y.offset)}}}var GO,Ig=$(()=>{"use strict";GO=class extends Error{constructor(n,r){super(n);this.offset=r}}});function Kre(){return"0.124.106"}var Jre=$(()=>{"use strict"});function Tg(e=process.env){let t=e.CI?.trim().toLowerCase();return t&&t!=="false"&&t!=="0"?"ledger":void 0}function BO(e){if(e!==void 0)return typeof e=="string"?{name:e}:e}function Tu(e,t=!1){let n=[];t&&n.push("a gate that asks a decision point takes its quorum from the point: give `approval` or `point`, not both");let r=typeof e=="string"?{name:e}:e;if(r===null||typeof r!="object"||Array.isArray(r))return[...n,"`point` is a decision point's name or { name, inputs?, pass?, store? }"];let{name:o,inputs:i,pass:s,store:a,...c}=r;if((typeof o!="string"||!jGe.test(o))&&n.push("`point.name` is a decision point's name: lower case letters, digits and hyphens, starting with a letter"),i!==void 0&&(i===null||typeof i!="object"||Array.isArray(i))&&n.push("`point.inputs` is an object of input name to value"),i&&typeof i=="object"){let d=Object.keys(i).filter(u=>u in Sb);d.length>0&&n.push(`\`point.inputs\` gives ${d.join(", ")}, which the gate passes itself`)}s!==void 0&&(!Array.isArray(s)||s.length===0||s.some(d=>typeof d!="string"&&typeof d!="boolean"))&&n.push("`point.pass` is a non-empty list of the answers that pass the gate"),a!==void 0&&a!=="tree"&&a!=="ledger"&&n.push("`point.store` is tree or ledger: where the question is held");let l=Object.keys(c);return l.length>0&&n.push(`\`point\` takes name, inputs, pass and store, not ${l.join(", ")}`),n}function Du(e,t,n,r={}){if(n.planDigest!==null&&!t.includes("gate.planDigest"))throw new Error(`gate "${n.name}" binds a plan and asks decision point ${e}, which does not declare the input gate.planDigest: declare it in the points file, so each plan is its own question and an answer for one plan never passes another`);let o={};for(let[i,s]of Object.entries(Sb))t.includes(i)&&n[s]!==null&&(o[i]=n[s]);return{...r,...o}}function Eb(e,t,n){return`gate:${e}/${t}${n?`@${n}`:""}`}function UO(e){if(!e||!e.startsWith("gate:"))return;let t=e.slice(5),n=t.lastIndexOf("@"),r=n>0?t.slice(0,n):t,o=r.indexOf("/");if(!(o<=0||o===r.length-1))return{op:r.slice(0,o),gate:r.slice(o+1),...n>0?{env:t.slice(n+1)}:{}}}var Dg,jGe,Sb,cc=$(()=>{"use strict";Dg=[!0];jGe=/^[a-z][a-z0-9-]*$/;Sb={"gate.component":"component","gate.name":"name","gate.env":"env","gate.planDigest":"planDigest"}});function Di(e){return e===void 0?[]:Array.isArray(e)?[...e]:[e]}function IB(e,t){let n=e.replace(/\\/g,"/").replace(/\/+$/,""),r="";for(let o=0;o<n.length;o++){let i=n[o];i==="*"&&n[o+1]==="*"?n[o+2]==="/"?(r+="(?:.*/)?",o+=2):(r+=".*",o+=1):i==="*"?r+="[^/]*":i==="?"?r+="[^/]":r+=i.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${r}$`).test(t.replace(/\\/g,"/").replace(/\/+$/,""))}function Ng(e,t){return e.filter(n=>n.targets===void 0||n.targets.some(r=>t.some(o=>IB(r,o))))}function Pb(e){return e.reduce((t,n)=>Math.max(t,n.count),1)}function Ni(e,t,n){let r=Array.isArray(e)?e:[e],o=[];return Array.isArray(e)&&e.length===0&&o.push(`\`${t}\` must name at least one rule`),r.forEach((i,s)=>{let a=Array.isArray(e)?`${t}[${s}]`:t;if(typeof i!="object"||i===null||Array.isArray(i)){o.push(`\`${a}\` must be an object`);return}let c=i;(typeof c.count!="number"||!Number.isInteger(c.count)||c.count<1)&&o.push(`\`${a}.count\` must be an integer of at least 1`),c.roles!==void 0&&(!Array.isArray(c.roles)||c.roles.length===0||c.roles.some(d=>typeof d!="string"||d===""))&&o.push(`\`${a}.roles\` must be a non-empty list of role names`),c.targets!==void 0&&(!Array.isArray(c.targets)||c.targets.length===0||c.targets.some(d=>typeof d!="string"||d===""))&&o.push(`\`${a}.targets\` must be a non-empty list of globs`),c.notAuthor!==void 0&&typeof c.notAuthor!="boolean"&&o.push(`\`${a}.notAuthor\` must be true or false`),c.notAuthor===!0&&!n.notAuthor&&o.push(`\`${a}.notAuthor\` is not read here: an Op gate has no author to judge by. An Op waves spec's \`approvals.quorum\` reads it from the merged pull request`);let l=new Set(["targets","count","roles","notAuthor"]);for(let d of Object.keys(c))l.has(d)||o.push(`\`${a}.${d}\` is not a quorum field; use targets, count, roles or notAuthor`)}),o}function zO(e,t){return Object.entries(t).filter(([,n])=>n.some(r=>ii(r,e))).map(([n])=>n).sort()}function Ab(e,t){let n=new Set,r=[];for(let s of[...t].sort((a,c)=>Date.parse(a.at)-Date.parse(c.at)))n.has(HO(s.who))||s.judged.excluded!==void 0||e.roles?.length&&!(s.judged.proven&&s.judged.roles.some(a=>e.roles.includes(a)))||(n.add(HO(s.who)),r.push(s));let o=!e.notAuthor||r.some(s=>s.judged.proven&&s.judged.author===!1),i=e.notAuthor===!0&&!o&&r.some(s=>s.judged.proven&&s.judged.author===void 0);return{...e.targets?{targets:[...e.targets]}:{},count:e.count,...e.roles?.length?{roles:[...e.roles]}:{},...e.notAuthor?{notAuthor:!0}:{},approvers:r.map(s=>s.who),met:r.length>=e.count&&o,...i?{authorUnknown:!0}:{}}}function jl(e){let t=e.targets?e.targets.join(", "):"every target",n=`${e.approvers.length} of ${e.count} approval${e.count===1?"":"s"}${e.approvers.length?` (${e.approvers.join(", ")})`:""}`;if(e.met)return`${t}: ${n}, met`;let r=e.count-e.approvers.length,o=[];r>0&&o.push(`${r} more${e.roles?.length?` from ${e.roles.join(" or ")}`:""}`),e.notAuthor&&o.push(r>0?"one of them not the author":"an approver who is not the author");let i=e.authorUnknown?" (the change's author is not known, so no approver can show they are someone else)":"";return`${t}: ${n}, needs ${o.join(", ")}${i}`}function Cb(e){return e.filter(t=>!t.met).map(jl).join("; ")}function VO(e){let t=[];for(let n of e.replace(/\r\n/g,`
110
+ `;)a++;else{let w=e.indexOf("*/",a+2);w<0&&c("unterminated /* comment"),a=w+2}else return}}function u(){let y=a;for(a++;;){a>=e.length&&c("unterminated string",y);let w=e.charCodeAt(a);if(w===34)break;w<32&&c("control character in a string; escape it",a),a+=w===92?2:1}a++;try{return JSON.parse(e.slice(y,a))}catch{return c("invalid escape in a string",y)}}function p(y){d(),o.set(y,a);let w=f(y);return i.set(y,a),w}function f(y){let w=e[a];if(w==="{")return g(y);if(w==="[")return m(y);if(w==='"')return u();for(let[v,k]of[["true",!0],["false",!1],["null",null]])if(e.startsWith(v,a))return a+=v.length,k;let b=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(e.slice(a,a+64));return b?(a+=b[0].length,Number(b[0])):c(`expected a value, found ${l(a)}`)}function g(y){let w={},b=new Set;if(a++,d(),e[a]==="}")return a++,w;for(;;){d(),e[a]!=='"'&&c(`expected a quoted key, found ${l(a)}`);let v=a,k=u();b.has(k)&&c(`duplicate key ${JSON.stringify(k)}`,v),b.add(k);let x=`${y}/${ac(k)}`;if(s.set(x,v),d(),e[a]!==":"&&c(`expected ":" after key ${JSON.stringify(k)}, found ${l(a)}`),a++,Object.defineProperty(w,k,{value:p(x),enumerable:!0,writable:!0,configurable:!0}),d(),e[a]===","){if(a++,d(),e[a]==="}")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,w;continue}if(e[a]==="}")return a++,w;c(`expected "," or "}", found ${l(a)}`)}}function m(y){let w=[];if(a++,d(),e[a]==="]")return a++,w;for(;;){if(w.push(p(`${y}/${w.length}`)),d(),e[a]===","){if(a++,d(),e[a]==="]")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,w;continue}if(e[a]==="]")return a++,w;c(`expected "," or "]", found ${l(a)}`)}}try{d(),a>=e.length&&c("the file is empty");let y=p("");return d(),a<e.length&&c(`unexpected ${l(a)} after the value`),{ok:!0,value:y,locate(w,b){if(b&&s.has(w))return r(s.get(w));for(let v=w;;v=v.slice(0,v.lastIndexOf("/"))){let k=o.get(v);if(k!==void 0)return r(k);if(v==="")return r(0)}},span(w){let b=o.get(w),v=i.get(w);if(!(b===void 0||v===void 0))return{key:s.get(w)??null,start:b,end:v}}}}catch(y){if(!(y instanceof GO))throw y;return{ok:!1,message:y.message,location:r(y.offset)}}}var GO,Ig=$(()=>{"use strict";GO=class extends Error{constructor(n,r){super(n);this.offset=r}}});function Kre(){return"0.124.107"}var Jre=$(()=>{"use strict"});function Tg(e=process.env){let t=e.CI?.trim().toLowerCase();return t&&t!=="false"&&t!=="0"?"ledger":void 0}function BO(e){if(e!==void 0)return typeof e=="string"?{name:e}:e}function Tu(e,t=!1){let n=[];t&&n.push("a gate that asks a decision point takes its quorum from the point: give `approval` or `point`, not both");let r=typeof e=="string"?{name:e}:e;if(r===null||typeof r!="object"||Array.isArray(r))return[...n,"`point` is a decision point's name or { name, inputs?, pass?, store? }"];let{name:o,inputs:i,pass:s,store:a,...c}=r;if((typeof o!="string"||!jGe.test(o))&&n.push("`point.name` is a decision point's name: lower case letters, digits and hyphens, starting with a letter"),i!==void 0&&(i===null||typeof i!="object"||Array.isArray(i))&&n.push("`point.inputs` is an object of input name to value"),i&&typeof i=="object"){let d=Object.keys(i).filter(u=>u in Sb);d.length>0&&n.push(`\`point.inputs\` gives ${d.join(", ")}, which the gate passes itself`)}s!==void 0&&(!Array.isArray(s)||s.length===0||s.some(d=>typeof d!="string"&&typeof d!="boolean"))&&n.push("`point.pass` is a non-empty list of the answers that pass the gate"),a!==void 0&&a!=="tree"&&a!=="ledger"&&n.push("`point.store` is tree or ledger: where the question is held");let l=Object.keys(c);return l.length>0&&n.push(`\`point\` takes name, inputs, pass and store, not ${l.join(", ")}`),n}function Du(e,t,n,r={}){if(n.planDigest!==null&&!t.includes("gate.planDigest"))throw new Error(`gate "${n.name}" binds a plan and asks decision point ${e}, which does not declare the input gate.planDigest: declare it in the points file, so each plan is its own question and an answer for one plan never passes another`);let o={};for(let[i,s]of Object.entries(Sb))t.includes(i)&&n[s]!==null&&(o[i]=n[s]);return{...r,...o}}function Eb(e,t,n){return`gate:${e}/${t}${n?`@${n}`:""}`}function UO(e){if(!e||!e.startsWith("gate:"))return;let t=e.slice(5),n=t.lastIndexOf("@"),r=n>0?t.slice(0,n):t,o=r.indexOf("/");if(!(o<=0||o===r.length-1))return{op:r.slice(0,o),gate:r.slice(o+1),...n>0?{env:t.slice(n+1)}:{}}}var Dg,jGe,Sb,cc=$(()=>{"use strict";Dg=[!0];jGe=/^[a-z][a-z0-9-]*$/;Sb={"gate.component":"component","gate.name":"name","gate.env":"env","gate.planDigest":"planDigest"}});function Di(e){return e===void 0?[]:Array.isArray(e)?[...e]:[e]}function IB(e,t){let n=e.replace(/\\/g,"/").replace(/\/+$/,""),r="";for(let o=0;o<n.length;o++){let i=n[o];i==="*"&&n[o+1]==="*"?n[o+2]==="/"?(r+="(?:.*/)?",o+=2):(r+=".*",o+=1):i==="*"?r+="[^/]*":i==="?"?r+="[^/]":r+=i.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${r}$`).test(t.replace(/\\/g,"/").replace(/\/+$/,""))}function Ng(e,t){return e.filter(n=>n.targets===void 0||n.targets.some(r=>t.some(o=>IB(r,o))))}function Pb(e){return e.reduce((t,n)=>Math.max(t,n.count),1)}function Ni(e,t,n){let r=Array.isArray(e)?e:[e],o=[];return Array.isArray(e)&&e.length===0&&o.push(`\`${t}\` must name at least one rule`),r.forEach((i,s)=>{let a=Array.isArray(e)?`${t}[${s}]`:t;if(typeof i!="object"||i===null||Array.isArray(i)){o.push(`\`${a}\` must be an object`);return}let c=i;(typeof c.count!="number"||!Number.isInteger(c.count)||c.count<1)&&o.push(`\`${a}.count\` must be an integer of at least 1`),c.roles!==void 0&&(!Array.isArray(c.roles)||c.roles.length===0||c.roles.some(d=>typeof d!="string"||d===""))&&o.push(`\`${a}.roles\` must be a non-empty list of role names`),c.targets!==void 0&&(!Array.isArray(c.targets)||c.targets.length===0||c.targets.some(d=>typeof d!="string"||d===""))&&o.push(`\`${a}.targets\` must be a non-empty list of globs`),c.notAuthor!==void 0&&typeof c.notAuthor!="boolean"&&o.push(`\`${a}.notAuthor\` must be true or false`),c.notAuthor===!0&&!n.notAuthor&&o.push(`\`${a}.notAuthor\` is not read here: an Op gate has no author to judge by. An Op waves spec's \`approvals.quorum\` reads it from the merged pull request`);let l=new Set(["targets","count","roles","notAuthor"]);for(let d of Object.keys(c))l.has(d)||o.push(`\`${a}.${d}\` is not a quorum field; use targets, count, roles or notAuthor`)}),o}function zO(e,t){return Object.entries(t).filter(([,n])=>n.some(r=>ii(r,e))).map(([n])=>n).sort()}function Ab(e,t){let n=new Set,r=[];for(let s of[...t].sort((a,c)=>Date.parse(a.at)-Date.parse(c.at)))n.has(HO(s.who))||s.judged.excluded!==void 0||e.roles?.length&&!(s.judged.proven&&s.judged.roles.some(a=>e.roles.includes(a)))||(n.add(HO(s.who)),r.push(s));let o=!e.notAuthor||r.some(s=>s.judged.proven&&s.judged.author===!1),i=e.notAuthor===!0&&!o&&r.some(s=>s.judged.proven&&s.judged.author===void 0);return{...e.targets?{targets:[...e.targets]}:{},count:e.count,...e.roles?.length?{roles:[...e.roles]}:{},...e.notAuthor?{notAuthor:!0}:{},approvers:r.map(s=>s.who),met:r.length>=e.count&&o,...i?{authorUnknown:!0}:{}}}function jl(e){let t=e.targets?e.targets.join(", "):"every target",n=`${e.approvers.length} of ${e.count} approval${e.count===1?"":"s"}${e.approvers.length?` (${e.approvers.join(", ")})`:""}`;if(e.met)return`${t}: ${n}, met`;let r=e.count-e.approvers.length,o=[];r>0&&o.push(`${r} more${e.roles?.length?` from ${e.roles.join(" or ")}`:""}`),e.notAuthor&&o.push(r>0?"one of them not the author":"an approver who is not the author");let i=e.authorUnknown?" (the change's author is not known, so no approver can show they are someone else)":"";return`${t}: ${n}, needs ${o.join(", ")}${i}`}function Cb(e){return e.filter(t=>!t.met).map(jl).join("; ")}function VO(e){let t=[];for(let n of e.replace(/\r\n/g,`
111
111
  `).split(`
112
112
  `)){let r=/^requested-by:\s*(\S+)\s*$/i.exec(n.trim());r&&LGe.test(r[1])&&!t.some(o=>ii(o,r[1]))&&t.push(r[1])}return t}function Ob(e){let t=/^(?:github|gitlab|forgejo|gitea|codeberg)(?:@[^:\s]+)?:(.+)$/i.exec(e.trim());return t?[e,t[1]]:[e]}function qO(e,t){let n=Ob(t);return e.find(r=>Ob(r.who).some(o=>n.some(i=>ii(o,i))))?.why}function _b(e){let t=[],n=(r,o)=>{r.trim()&&!t.some(i=>ii(i.who,r))&&t.push({who:r,why:o})};e.author&&n(e.author,`${e.author} opened the change`);for(let r of e.commits??[])for(let o of VO(r.message))n(e.principal?e.principal(o):o,`${o} asked for ${r.sha.slice(0,7)}`);for(let r of e.agents??[])n(r,`${r} is an account an agent acts as`);return t}function jg(e){let t=e;return t.via!=="pr-review"||typeof t.head!="string"||t.head===""||!Array.isArray(t.reviewers)||t.reviewers.length===0||t.reviewers.some(n=>typeof n!="string"||n==="")?null:{...typeof t.pr=="number"?{pr:t.pr}:{},head:t.head,reviewers:[...t.reviewers]}}function Ib(e,t=n=>n){let n=[],r=[];for(let o of e){let i=jg(o);if(!i){n.push(o);continue}let s=i.reviewers.map(t);r.push({head:i.head,approvers:s});let{seal:a,...c}=o,l=Object.fromEntries(Object.entries(c).filter(([d])=>!["via","reviewers","head","pr","excluded"].includes(d)));for(let d of s)n.push({...l,resolvedBy:d,approver:{kind:"human"},review:{pr:i.pr??0,head:i.head,approvers:s}})}return{records:n,reviews:r}}function ji(e){let t=(n,r)=>n.some(o=>ii(o,r));return n=>{let r=n.seal!==void 0&&n.seal!==null&&ra(e.signers,n)===null,o=e.review!==void 0&&n.review?.head===e.review.head&&t(e.review.approvers,n.resolvedBy),i=n.review!==void 0&&(e.recorded??[]).some(l=>l.head===n.review.head&&t(l.approvers,n.resolvedBy)),s=r||o||i,c=e.authors!==void 0&&e.authors.some(l=>ii(l,n.resolvedBy))?`${n.resolvedBy} wrote the change`:qO(e.involved??[],n.resolvedBy);return{proven:s,roles:s?zO(n.resolvedBy,e.roles):[],...c!==void 0?{author:!0}:e.authors!==void 0?{author:!1}:{},...c!==void 0&&e.excludeInvolved?{excluded:`${c}, so ${n.resolvedBy}'s approval does not count`}:{}}}}var lc,HO,ii,dc,LGe,si=$(()=>{"use strict";ws();lc=()=>({proven:!1,roles:[]});HO=e=>e.normalize("NFKC").trim().toLowerCase(),ii=(e,t)=>HO(e)===HO(t);dc=e=>(e.roles?.length??0)>0||e.notAuthor===!0,LGe=/^[A-Za-z0-9][A-Za-z0-9._-]*(\[bot\])?$/});function TB(e,t,n){return(e??KO).replaceAll("{gate}",t).replaceAll("{k}",String(n))}function DB(e,t,n,r){let o=[...e].sort((l,d)=>{let u=r(l),p=r(d);return u<p?-1:u>p?1:0}),i=Math.floor(o.length/n),s=o.length%n,a=(t-1)*i+Math.min(t-1,s),c=i+(t<=s?1:0);return o.slice(a,a+c)}var KO,NB=$(()=>{"use strict";KO="{gate}-wave-{k}"});var QO={};me(QO,{WAVE_OUTCOME_VERSION:()=>JO,blockedMembers:()=>ZO,blockedWords:()=>YO,earlierWaveOutcomes:()=>Mg,onlyWaiting:()=>HGe,passesThrough:()=>Ll,readWaveOutcomeFile:()=>MB,runSummary:()=>zGe,settleEarlierWaves:()=>UGe,waveOutcomeFileName:()=>Lg,writeWaveOutcomeFile:()=>LB});import{existsSync as MGe,readdirSync as FGe,readFileSync as Zre,statSync as WGe,writeFileSync as GGe}from"node:fs";import{basename as BGe,join as Yre}from"node:path";function Ll(e){return e!==void 0&&jB.has(e.status)}function ZO(e,t,n,r,o){if(o!==void 0)return new Map(e.map(s=>[s,`wave-${o}`]));let i=new Map;for(let s of e){let a=[...t.get(s)??[]].filter(c=>n.has(c)).sort().map(c=>{let l=r.get(c);if(!Ll(l))return l?.status==="blocked"&&l.by?l.by:c}).find(c=>c!==void 0);a!==void 0&&i.set(s,a)}return i}function UGe(e,t,n,r){let o=new Map(r),i=[],s=new Set;for(let a=1;a<t&&a<=e.length;a++){let c=e[a-1],l=c.filter(u=>!o.has(u)),d=ZO(l,n,s,o);for(let u of l){let p=d.get(u);p!==void 0?o.set(u,{status:"blocked",by:p}):i.push(u)}for(let u of c)s.add(u)}return{outcomes:o,unsettled:i}}function HGe(e){let t=!1;for(let n of e.values())if(!jB.has(n.status)&&(t=!0,n.status!=="waiting"&&!(n.status==="blocked"&&n.by!==void 0&&e.get(n.by)?.status==="waiting")))return!1;return t}function YO(e){let t=new Map;for(let[n,r]of[...e].sort(Qre))t.set(r,[...t.get(r)??[],n]);return[...t].map(([n,r])=>`${r.join(", ")} (blocked by ${n})`).join("; ")}function zGe(e){let t=new Map;for(let r of e)t.set(r.status,(t.get(r.status)??0)+1);if(![...t.keys()].some(r=>!jB.has(r)))return;let n=[`${t.get("applied")??0} applied`,`${t.get("failed")??0} failed`,`${t.get("blocked")??0} blocked`];for(let r of["waiting","refused","decided","not-applied"])t.get(r)&&n.push(`${t.get(r)} ${r==="decided"?"not reported by their share":r}`);return t.get("unchanged")&&n.push(`${t.get("unchanged")} unchanged`),n.join(", ")}function Lg(e,t={}){let n=t.group!==void 0?`-group-${t.group.replace(/[^A-Za-z0-9._-]/g,"_")}`:"",r=t.share!==void 0?`-share-${t.share}`:"",o=t.apply===!0&&!n&&!r?"-apply":"";return`outcome-wave-${e}${n}${r}${o}.json`}function LB(e,t,n,r,o=new Date().toISOString(),i=!1){let s=Yre(e,Lg(t,n)),a={version:JO,wave:t,at:o,members:Object.fromEntries(Object.entries(r).sort(Qre)),...i?{holds_all:!0}:{}};return GGe(s,JSON.stringify(a,null,2)+`
113
113
  `),s}function Xre(e){let t=[],n=(r,o)=>{let i;try{i=FGe(r)}catch{return}for(let s of i){let a=Yre(r,s),c=!1;try{c=WGe(a).isDirectory()}catch{continue}c?o<4&&n(a,o+1):/^outcome-wave-\d+.*\.json$/.test(s)&&t.push(a)}};for(let r of e)MGe(r)&&n(r,0);return t.sort()}function Mg(e,t){let n=new Map,r=new Map;for(let i of Xre(e)){let s;try{s=JSON.parse(Zre(i,"utf-8"))}catch{continue}let a=s?.members??s?.roots;if(s?.version!==JO||!Number.isInteger(s.wave)||s.wave>=t||typeof s.at!="string"||typeof a!="object"||a===null)continue;for(let[l,d]of Object.entries(a)){let u=n.get(l);u&&(u.at>s.at||u.at===s.at&&d.status==="decided"&&u.status!=="decided")||n.set(l,{...d,wave:s.wave,at:s.at})}let c=r.get(s.wave);(!c||c.at<=s.at)&&r.set(s.wave,{at:s.at,holdsAll:s.holds_all===!0})}let o=[...r].filter(([,i])=>i.holdsAll).map(([i])=>i).sort((i,s)=>i-s);return{members:n,...o.length?{holdsAll:o[0]}:{}}}function MB(e,t){let n;for(let r of Xre(e)){if(BGe(r)!==t)continue;let o;try{o=JSON.parse(Zre(r,"utf-8"))}catch{continue}o?.version!==JO||typeof o.at!="string"||typeof o.members!="object"||o.members===null||(!n||n.at<=o.at)&&(n=o)}return n}var JO,jB,Qre,Ml=$(()=>{"use strict";JO=1,jB=new Set(["applied","unchanged"]);Qre=([e],[t])=>e<t?-1:e>t?1:0});function Tb(e){if(e===void 0)return[];if(e===null||typeof e!="object"||Array.isArray(e))return["`evidence` must be an object"];let t=e,n=[];for(let r of Object.keys(t))r!=="requires"&&n.push(`\`evidence.${r}\` is not a setting; \`evidence\` takes \`requires\``);return t.requires!==void 0&&(!Array.isArray(t.requires)||t.requires.some(r=>typeof r!="string"||!/^[A-Za-z0-9][A-Za-z0-9._:-]*$/.test(r)))&&n.push("`evidence.requires` must be a list of check names (letters, digits, `.`, `_`, `:` and `-`, as `refs` in .chant/trust.json names them)"),n}var XO=$(()=>{"use strict"});function tP(e){let t=e.step;if(t===void 0)return[];if(t===null||typeof t!="object"||Array.isArray(t))return['`step` must be { "kind": "<capability>", ...input }'];let n=[],r=t.kind;(typeof r!="string"||r.trim()==="")&&n.push('`step.kind` must name a capability, such as "terraform-apply"');for(let o of["plan","apply","planWave","applyWave"])e[o]!==void 0&&n.push(`\`step\` and \`${o}\` are both set; a wave plans and applies through its capability or through commands, so give one`);e.hooks?.apply?.runBy==="apply"&&n.push('`hooks.apply.runBy: "apply"` hands the apply-stage hooks to an apply command, and a `step` has none; leave runBy as chant');for(let o of e.waves){o.hooks?.apply?.runBy==="apply"&&n.push(`wave "${o.name}" hands its apply-stage hooks to an apply command, and a \`step\` has none`);for(let i of o.runs??[]){let s=i.input;s!==void 0&&(s===null||typeof s!="object"||Array.isArray(s))&&n.push(`wave "${o.name}" run "${i.target}": \`input\` must be an object laid over the step's input`),s&&typeof s=="object"&&"kind"in s&&n.push(`wave "${o.name}" run "${i.target}": \`input\` cannot change the step's kind`)}}return n}function eoe(e){let t=[];for(let[n,r]of[["parallelism",e.parallelism],...e.waves.map(o=>[`wave "${o.name}" parallelism`,o.parallelism])])r!==void 0&&(typeof r!="number"||!Number.isInteger(r)||r<1?t.push(`${n} is ${JSON.stringify(r)}; give a whole number of 1 or more, the most that run at once`):r>1&&e.step===void 0&&t.push(`${n} is ${r}, and runs apply at once only through \`step\`; drop it or give step`));return t}function Wg(e){if(e===void 0)return[];if(e===null||typeof e!="object"||Array.isArray(e))return['`holds` must be { "policy"?: true, "cost"?: {...} }'];let t=[];for(let[n,r]of Object.entries(e))n==="policy"?typeof r!="boolean"&&t.push("`holds.policy` must be true or false"):n==="cost"?t.push(...VGe(r)):t.push(`\`holds.${n}\` is not a setting; the ones there are holds.policy and holds.cost`);return t}function VGe(e){if(e===null||typeof e!="object"||Array.isArray(e))return['`holds.cost` must be { "command": [...], "approveAbove": <number>, "format"?, "currency"? }'];let t=e,n=[];(!Array.isArray(t.command)||t.command.length===0||!t.command.every(r=>typeof r=="string"&&r!==""))&&n.push("`holds.cost.command` must be argv, a non-empty list of strings"),(typeof t.approveAbove!="number"||!Number.isFinite(t.approveAbove)||t.approveAbove<0)&&n.push("`holds.cost.approveAbove` must be a monthly amount of 0 or more"),t.format!==void 0&&!eP.includes(t.format)&&n.push(`\`holds.cost.format\` must be ${eP.join(" or ")}`),t.currency!==void 0&&(typeof t.currency!="string"||!/^[A-Z]{3}$/.test(t.currency))&&n.push('`holds.cost.currency` must be a three-letter currency code, such as "USD"');for(let r of Object.keys(t))["command","approveAbove","format","currency"].includes(r)||n.push(`\`holds.cost.${r}\` is not a setting`);return n}function nP(e,t){let n=e?.policy===!0||t?.policy===!0,r=e!==void 0?e.cost:t?.cost;if(!(!n&&!r))return{...n?{policy:!0}:{},...r?{cost:r}:{}}}var eP,Fg,Db=$(()=>{"use strict";eP=["infracost","chant"],Fg="(monthly cost)"});function FB(e){let t=[],n=(r,o,i)=>{if(r!==void 0&&!(r===!1&&i)){if(r===null||typeof r!="object"||Array.isArray(r)){t.push(`${o} must be { "env"?: "<env>", "component"?: "<name>" }${i?" or false":""}`);return}for(let[s,a]of Object.entries(r))s!=="env"&&s!=="component"?t.push(`${o} has an unknown key "${s}"; it takes env and component`):(typeof a!="string"||a.trim()==="")&&t.push(`${o}.${s} must be a non-empty string`)}};n(e.release,"`release`",!0);for(let r of e.waves)for(let o of r.runs??[])n(o.release,`wave "${r.name}" run "${o.target}": \`release\``,!1);return t}function toe(e,t){return e.replaceAll("{target}",t.target).replaceAll("{op}",t.op).replaceAll("{wave}",t.wave)}function WB(e,t,n){if(!e.step||e.release===!1)return null;let r={target:n.target,op:n.op??e.op,wave:t.name},o=e.release??{},i=n.release?.env??o.env,s=n.release?.component??o.component;return{env:i!==void 0?toe(i,r):e.labels?.Env??t.name,component:s!==void 0?toe(s,r):n.target}}function GB(e,t,n,r){let o=new Map;for(let a of t){let c=o.get(a.releaseDigest);(c===void 0||a.timestamp>c)&&o.set(a.releaseDigest,a.timestamp)}let s=e.filter(a=>a.commit===n.commit).map(a=>({r:a,digest:r(a,n.env,n.component)})).filter(a=>a.digest!==null).sort((a,c)=>(o.get(c.r.releaseDigest)??"").localeCompare(o.get(a.r.releaseDigest)??"")||a.r.releaseDigest.localeCompare(c.r.releaseDigest))[0];return s?{releaseDigest:s.r.releaseDigest,templatesDigest:s.digest}:null}var Nb=$(()=>{"use strict"});function HB(e){let t=[];return typeof e.train=="string"&&KGe.test(e.train)||t.push("train must be a release train's id"),typeof e.run=="string"&&JGe.test(e.run)||t.push("run must be a workspace run's id"),typeof e.env=="string"&&Gg.test(e.env)||t.push("env must be an environment's name"),typeof e.releaseDigest=="string"&&ZGe.test(e.releaseDigest)||t.push("releaseDigest must be a release digest"),t}function Fb(e){let n=e.replace(/^https?:\/\//,"").replace(/\.git$/,"").replace(/\/+$/,"").split("/");if(n.length<3||n.some(i=>i===""))throw new jb(`project key "${e}" must be <host>/<owner>/<name>, such as github.com/acme/infra`);let[r,...o]=n;return{key:e,host:r,path:o.join("/"),owner:o.slice(0,-1).join("/"),name:o[o.length-1]}}function coe(e){let t=e.toLowerCase().replace(/:\d+$/,"");if(t==="github.com"||t.startsWith("github."))return"github";if(t==="gitlab.com"||t.startsWith("gitlab.")||t.includes(".gitlab."))return"gitlab";if(t==="codeberg.org"||t.startsWith("forgejo.")||t.startsWith("gitea.")||t.includes("forgejo"))return"forgejo"}function QGe(e,t){let n=t.toLowerCase();return e==="github"?n==="github.com"?"https://api.github.com":`https://${t}/api/v3`:e==="gitlab"?`https://${t}/api/v4`:`https://${t}/api/v1`}function VB(e,t="control"){if(typeof e!="object"||e===null||Array.isArray(e))return[`${t} must be a mapping with repo and op`];let n=e,r=[],o;if(typeof n.repo!="string")r.push(`${t}.repo must name the control repo, such as github.com/acme/control`);else try{o=Fb(n.repo).host}catch(i){r.push(`${t}.repo: ${i.message}`)}return typeof n.op=="string"&&Gg.test(n.op)||r.push(`${t}.op must name the Op the control repo runs on this repo's dependents, such as deploy`),n.forge!==void 0&&!roe.includes(n.forge)&&r.push(`${t}.forge must be one of ${roe.join(", ")}`),o!==void 0&&n.forge===void 0&&!coe(o)&&r.push(`${t}.forge is needed: ${n.repo}'s host does not say which forge it is`),n.member!==void 0&&!(typeof n.member=="string"&&Gg.test(n.member))&&r.push(`${t}.member must be this repo's name in the control repo's workspace`),n.tokenSecret!==void 0&&!(typeof n.tokenSecret=="string"&&noe.test(n.tokenSecret))&&r.push(`${t}.tokenSecret must name the secret holding the dispatch token, such as ${BB}`),n.readTokenSecret!==void 0&&!(typeof n.readTokenSecret=="string"&&noe.test(n.readTokenSecret))?r.push(`${t}.readTokenSecret must name the secret holding a read-only token for the control repo, such as ${ooe}`):typeof n.readTokenSecret=="string"&&n.readTokenSecret===(n.tokenSecret??BB)&&r.push(`${t}.readTokenSecret must not be the dispatch token's secret (${n.readTokenSecret}): the plan job runs the change's code`),n.ref!==void 0&&!(typeof n.ref=="string"&&qGe.test(n.ref))&&r.push(`${t}.ref must be a branch name`),n.apiBase!==void 0&&!(typeof n.apiBase=="string"&&/^https?:\/\/[^\s'"]+$/.test(n.apiBase))&&r.push(`${t}.apiBase must be an http(s) URL`),r}function loe(e,t){let n=VB(e);if(n.length>0)throw new jb(n.join("; "),n);let r=Fb(e.repo),o=e.forge??coe(r.host),i=e.member??t;if(!Gg.test(i))throw new jb(`control.member: "${i}" is not a name the control repo's workspace can hold; set control.member`);return{repo:e.repo,host:r.host,path:r.path,forge:o,apiBase:(e.apiBase??QGe(o,r.host)).replace(/\/+$/,""),op:e.op,member:i,ref:e.ref??YGe,tokenSecret:e.tokenSecret??BB,readTokenSecret:e.readTokenSecret??ooe}}var Gg,qGe,noe,BB,ooe,Lb,UB,ioe,soe,aoe,KGe,JGe,ZGe,Mb,zB,YGe,jb,roe,doe,Bg=$(()=>{"use strict";_o();Gg=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/,qGe=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,127}$/,noe=/^[A-Za-z_][A-Za-z0-9_]{0,127}$/,BB="CHANT_CONTROL_TOKEN",ooe="CHANT_CONTROL_READ_TOKEN",Lb="CHANT_CONTROL_OUTCOME",UB="CHANT_CONTROL_TRAIN",ioe="CHANT_CONTROL_RUN",soe="CHANT_CONTROL_ENV",aoe="CHANT_CONTROL_RELEASE",KGe=/^train-[A-Za-z0-9-]{1,64}$/,JGe=/^ws-[A-Za-z0-9-]{1,64}$/,ZGe=/^[a-z0-9]+(-[a-z0-9]+)*:[0-9a-f]{64}$/;Mb=["applied","partial","unchanged","waiting","failed"],zB=["applied","partial"],YGe="main",jb=class extends Error{constructor(n,r=[n]){super(n);this.problems=r;this.name="ControlConfigError"}};roe=["github","gitlab","forgejo"];doe="control-dispatch"});var pP={};me(pP,{CHECK_HOOK_MOMENT:()=>XGe,CI_CHECK_HOOK_FLOOR:()=>eBe,GATE_APPROVAL_SOURCES:()=>uc,OP_LEDGER_NAME:()=>Vg,OP_WAVES_APPROVAL_STATUS_VAR:()=>pBe,OP_WAVES_CONTROL_FLOOR:()=>tBe,OP_WAVES_CONTROL_JOB:()=>nBe,OP_WAVES_DIGEST_OVER:()=>goe,OP_WAVE_APPLY_HOOKS_RUNNERS:()=>rP,OP_WAVE_DEFAULT_APPLY:()=>sP,OP_WAVE_DEFAULT_GATE_NAME:()=>JB,OP_WAVE_GATE_POLICIES:()=>Hg,OP_WAVE_HOOK_FAILURES:()=>zg,OP_WAVE_HOOK_MOMENTS:()=>Gb,OP_WAVE_JOB_TIMEOUT_MINUTES:()=>foe,PR_LOOP_HOOK_MOMENTS:()=>hoe,assertCheckHooks:()=>yoe,assertOpWaveCloud:()=>ZB,assertOpWaveHooks:()=>pc,assertOpWavesSpec:()=>Lu,assertPrLoopHooks:()=>uP,notifyVariables:()=>cX,opWaveApplyHooksRunBy:()=>Hb,opWaveAt:()=>Mu,opWaveBinArgv:()=>qg,opWaveChecksDir:()=>aP,opWaveGateName:()=>Bb,opWaveGroupOf:()=>bBe,opWaveGroupRuns:()=>lP,opWaveGroupsProblem:()=>dP,opWaveHookRuns:()=>Fl,opWaveHooksAt:()=>Ub,opWaveJobArtifactName:()=>lBe,opWaveJobArtifactPaths:()=>cBe,opWaveJobInputsByWave:()=>aBe,opWaveJobTimeout:()=>sBe,opWaveJobs:()=>woe,opWaveOf:()=>vBe,opWaveOutcomeDir:()=>la,opWaveOutcomePath:()=>Nu,opWavePointAt:()=>oP,opWavePointOf:()=>uoe,opWavePointProblems:()=>Wb,opWaveRecordPath:()=>ai,opWaveRunMatches:()=>cP,opWaveShare:()=>zb,opWavesApprovalStatusCommand:()=>gBe,opWavesControlProblems:()=>poe,opWavesControlTarget:()=>rBe,opWavesInvolvedProblems:()=>iP,opWavesLastJobs:()=>iBe,opWavesOutcomeCommand:()=>oBe,opWavesPostsApprovalStatus:()=>fBe,opWavesRecordPlansCommand:()=>uBe,opWavesResumeCommand:()=>dBe,waveApproveTarget:()=>ju});function uoe(e){if(e!==void 0)return typeof e=="string"?{name:e}:e}function Wb(e){if(e!==null&&typeof e=="object"&&!Array.isArray(e)&&"timeout"in e){let{timeout:t,...n}=e,r=Tu(n);return(typeof t!="string"||!/^(\d+(ms|s|m|h|d))+$/.test(t))&&r.push('`point.timeout` is a duration such as "48h"'),r}return Tu(e)}function oP(e,t){let n=e.waves.find(r=>r.name===t);return uoe(n?.point??e.point)}function ju(e,t){return t.length===1?t[0]:e}function poe(e){let t=VB(e,"control");if(t.length>0)return t;let n=e,r=[];typeof n.member=="string"&&Gg.test(n.member)||r.push("control.member must name this repo in the control repo's workspace: an Op waves spec has no repository name to default it to");for(let o of["sentCheck","markSent"])n[o]!==void 0&&!(typeof n[o]=="string"&&n[o]!==""&&!n[o].includes(`
@@ -310,6 +310,15 @@ interface DispatchInput {
310
310
  /** The cut job runs `chant release doctor` before the cut (#5161), with the publish job's forge token. */
311
311
  doctor: boolean;
312
312
  }
313
+ /**
314
+ * The `label` input's description, from what the cut accepts. Under
315
+ * `release.version` the label is the package version, so `v1.4.0` is refused
316
+ * (`release-version-label-invalid`). A `release.tag` template that names
317
+ * `{version}` drops one leading `v` and adds its own, so `0.13.5` and `v0.13.5`
318
+ * make the tag `v0.13.5`. Otherwise the tag carries the label as given. Plain
319
+ * YAML scalar: no colon followed by a space, no ` #`.
320
+ */
321
+ export declare function dispatchLabelDescription(c: Pick<ReleaseWorkflowContext, "version" | "tags">): string;
313
322
  /** The node one-liner that prints a JSON document's field from stdin, or from the file its argument names. */
314
323
  export declare const field: (path: string) => string;
315
324
  /** The gate's shell: the commit to cut, from `ci last-green`, refused when there is none or, under `head`, when it is not the dispatched one. */
@@ -491,6 +491,22 @@ export function githubSetup(ref, setup, persist = true) {
491
491
  function cutEnvToken(o) {
492
492
  return [...new Set([...o.cutToken, ...(o.doctor ? o.forgeToken : [])])];
493
493
  }
494
+ /**
495
+ * The `label` input's description, from what the cut accepts. Under
496
+ * `release.version` the label is the package version, so `v1.4.0` is refused
497
+ * (`release-version-label-invalid`). A `release.tag` template that names
498
+ * `{version}` drops one leading `v` and adds its own, so `0.13.5` and `v0.13.5`
499
+ * make the tag `v0.13.5`. Otherwise the tag carries the label as given. Plain
500
+ * YAML scalar: no colon followed by a space, no ` #`.
501
+ */
502
+ export function dispatchLabelDescription(c) {
503
+ const auto = "or auto for the one chant release next computes";
504
+ if (c.version)
505
+ return `The release's label, a bare version such as 1.4.0 with no leading v since it becomes the package version, ${auto}`;
506
+ if (c.tags && !c.tags.template.legacy && c.tags.template.name.includes("{version}"))
507
+ return `The release's label, a bare version such as 1.4.0 since the tag template adds any v (one leading v is dropped), ${auto}`;
508
+ return `The release's label, such as 1.4.0 (the tag carries it as given), ${auto}`;
509
+ }
494
510
  /** The label in a dispatched release's cut and publish jobs. */
495
511
  const DISPATCH_LABEL = '"$CHANT_RELEASE_LABEL"';
496
512
  /** The node one-liner that prints a JSON document's field from stdin, or from the file its argument names. */
@@ -615,7 +631,7 @@ function renderGithubDispatch(o) {
615
631
  " workflow_dispatch:",
616
632
  " inputs:",
617
633
  " label:",
618
- " description: The release's label, such as v1.4.0, or auto for the one chant release next computes",
634
+ ` description: ${dispatchLabelDescription(o.context)}`,
619
635
  " required: true",
620
636
  " type: string",
621
637
  "permissions:",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant",
3
- "version": "0.124.106",
3
+ "version": "0.124.107",
4
4
  "description": "Declarative infrastructure-as-code toolkit — TypeScript on Node.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",