@intentius/chant 0.124.49 → 0.124.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wave-runtime.mjs +3 -3
- package/package.json +1 -1
package/dist/wave-runtime.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// @intentius/chant 0.124.
|
|
2
|
+
// @intentius/chant 0.124.51 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 uce=Object.create;var vO=Object.defineProperty;var dce=Object.getOwnPropertyDescriptor;var pce=Object.getOwnPropertyNames;var fce=Object.getPrototypeOf,mce=Object.prototype.hasOwnProperty;var v=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(i){throw n=[i],i}};var de=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},_e=(e,t)=>{for(var n in t)vO(e,n,{get:t[n],enumerable:!0})},gce=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of pce(t))!mce.call(e,r)&&r!==n&&vO(e,r,{get:()=>t[r],enumerable:!(i=dce(t,r))||i.enumerable});return e};var Ze=(e,t,n)=>(n=e!=null?uce(fce(e)):{},gce(t||!e||!e.__esModule?vO(n,"default",{value:e,enumerable:!0}):n,e));function xO(e,t=new Set){let n=[];for(let i of e)if(i.startsWith("--")&&i.includes("=")){let r=i.indexOf("="),o=i.slice(0,r),s=i.slice(r+1);if(t.has(o))throw new Error(`${i} \u2014 ${o} is a boolean flag and does not take a value. Pass ${o} on its own.`);n.push(o,s)}else n.push(i);return n}var kO,$O=v(()=>{"use strict";kO=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 yce(){return!process.env.NO_COLOR&&process.stdout.isTTY!==!1}function ka(e,t){return yce()?`${t}${e}${Es.reset}`:e}function $e(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(ka(n,Es.cyan)),t.push(" - ")}return t.push(ka("error",Es.red)),t.push(": "),t.push(e.message),e.hint&&(t.push(`
|
|
6
6
|
`),t.push(ka(e.hint,Es.gray))),t.join("")}function hi(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(ka(n,Es.cyan)),t.push(" - ")}return t.push(ka("warning",Es.yellow)),t.push(": "),t.push(e.message),e.hint&&(t.push(`
|
|
7
|
-
`),t.push(ka(e.hint,Es.gray))),t.join("")}function am(e){return ka(e,Es.green)}function zn(e){return ka(e,Es.gray)}var Es,gr=v(()=>{"use strict";Es={red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",cyan:"\x1B[36m",gray:"\x1B[90m",reset:"\x1B[0m",bold:"\x1B[1m"}});var kb,SO=v(()=>{"use strict";kb="0.124.49"});function F(e,t,n){function i(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,u=Object.keys(l);for(let d=0;d<u.length;d++){let p=u[d];p in a||(a[p]=l[p].bind(a))}}let r=n?.Parent??Object;class o extends r{}Object.defineProperty(o,"name",{value:e});function s(a){var c;let l=n?.Parent?new o:this;i(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(s,"init",{value:i}),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 cn(e){return e&&Object.assign(cm,e),cm}var EO,xb,Qi,xa,cm,Ju=v(()=>{EO=Object.freeze({status:"aborted"});xb=Symbol("zod_brand"),Qi=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},xa=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},cm={}});var be={};_e(be,{BIGINT_FORMAT_RANGES:()=>NO,Class:()=>AO,NUMBER_FORMAT_RANGES:()=>jO,aborted:()=>Ea,allowsEval:()=>_O,assert:()=>$ce,assertEqual:()=>bce,assertIs:()=>kce,assertNever:()=>xce,assertNotEqual:()=>vce,assignProp:()=>Ra,base64ToUint8Array:()=>_U,base64urlToUint8Array:()=>Gce,cached:()=>Yu,captureStackTrace:()=>Rb,cleanEnum:()=>Fce,cleanRegex:()=>dm,clone:()=>hr,cloneDef:()=>Sce,createTransparentProxy:()=>_ce,defineLazy:()=>ct,esc:()=>$b,escapeRegex:()=>yi,extend:()=>Dce,finalizeIssue:()=>Ir,floatSafeRemainder:()=>PO,getElementAtPath:()=>Ece,getEnumValues:()=>um,getLengthableOrigin:()=>mm,getParsedType:()=>Cce,getSizableOrigin:()=>fm,hexToUint8Array:()=>Bce,isObject:()=>dl,isPlainObject:()=>Sa,issue:()=>Qu,joinValues:()=>K,jsonStringifyReplacer:()=>Zu,merge:()=>Nce,mergeDefs:()=>Os,normalizeParams:()=>ve,nullish:()=>$a,numKeys:()=>Pce,objectClone:()=>Rce,omit:()=>Tce,optionalKeys:()=>DO,parsedType:()=>we,partial:()=>Lce,pick:()=>Ice,prefixIssues:()=>Yr,primitiveTypes:()=>TO,promiseAllObject:()=>Oce,propertyKeyTypes:()=>pm,randomString:()=>Ace,required:()=>Mce,safeExtend:()=>jce,shallowClone:()=>IO,slugify:()=>CO,stringifyPrimitive:()=>me,uint8ArrayToBase64:()=>IU,uint8ArrayToBase64url:()=>Wce,uint8ArrayToHex:()=>Uce,unwrapMessage:()=>lm});function bce(e){return e}function vce(e){return e}function kce(e){}function xce(e){throw new Error("Unexpected value in exhaustive check")}function $ce(e){}function um(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function K(e,t="|"){return e.map(n=>me(n)).join(t)}function Zu(e,t){return typeof t=="bigint"?t.toString():t}function Yu(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function $a(e){return e==null}function dm(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function PO(e,t){let n=(e.toString().split(".")[1]||"").length,i=t.toString(),r=(i.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(i)){let c=i.match(/\d?e-(\d?)/);c?.[1]&&(r=Number.parseInt(c[1]))}let o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return s%a/10**o}function ct(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==CU)return i===void 0&&(i=CU,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Rce(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ra(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Os(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function Sce(e){return Os(e._zod.def)}function Ece(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function Oce(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function Ace(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function $b(e){return JSON.stringify(e)}function CO(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function dl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Sa(e){if(dl(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(dl(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function IO(e){return Sa(e)?{...e}:Array.isArray(e)?[...e]:e}function Pce(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function yi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hr(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function ve(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 _ce(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function me(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function DO(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Ice(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Os(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 Ra(this,"shape",s),s},checks:[]});return hr(e,o)}function Tce(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Os(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 Ra(this,"shape",s),s},checks:[]});return hr(e,o)}function Dce(e,t){if(!Sa(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=Os(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Ra(this,"shape",o),o}});return hr(e,r)}function jce(e,t){if(!Sa(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=Os(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Ra(this,"shape",i),i}});return hr(e,n)}function Nce(e,t){let n=Os(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return Ra(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:[]});return hr(e,n)}function Lce(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=Os(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 Ra(this,"shape",c),c},checks:[]});return hr(t,s)}function Mce(e,t,n){let i=Os(t._zod.def,{get shape(){let r=t._zod.def.shape,o={...r};if(n)for(let s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(let s in r)o[s]=new e({type:"nonoptional",innerType:r[s]});return Ra(this,"shape",o),o}});return hr(t,i)}function Ea(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 Yr(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function lm(e){return typeof e=="string"?e:e?.message}function Ir(e,t,n){let i={...e,path:e.path??[]};if(!e.message){let r=lm(e.inst?._zod.def?.error?.(e))??lm(t?.error?.(e))??lm(n.customError?.(e))??lm(n.localeError?.(e))??"Invalid input";i.message=r}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function fm(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function mm(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function we(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 Qu(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function Fce(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function _U(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function IU(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Gce(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return _U(t+n)}function Wce(e){return IU(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Bce(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 i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function Uce(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var CU,Rb,_O,Cce,pm,TO,jO,NO,AO,Ge=v(()=>{CU=Symbol("evaluating");Rb="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};_O=Yu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});Cce=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}`)}},pm=new Set(["string","number","symbol"]),TO=new Set(["string","number","bigint","boolean","symbol","undefined"]);jO={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]},NO={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};AO=class{constructor(...t){}}});function hm(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):i.push(t(r));return{formErrors:i,fieldErrors:n}}function ym(e,t=n=>n.message){let n={_errors:[]},i=r=>{for(let o of r.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let s=n,a=0;for(;a<o.path.length;){let c=o.path[a];a===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return i(e),n}function LO(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var s,a;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>i({issues:l},c.path));else if(c.code==="invalid_key")i({issues:c.issues},c.path);else if(c.code==="invalid_element")i({issues:c.issues},c.path);else{let l=[...o,...c.path];if(l.length===0){n.errors.push(t(c));continue}let u=n,d=0;for(;d<l.length;){let p=l[d],f=d===l.length-1;typeof p=="string"?(u.properties??(u.properties={}),(s=u.properties)[p]??(s[p]={errors:[]}),u=u.properties[p]):(u.items??(u.items=[]),(a=u.items)[p]??(a[p]={errors:[]}),u=u.items[p]),f&&u.errors.push(t(c)),d++}}};return i(e),n}function DU(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function MO(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${DU(i.path)}`);return t.join(`
|
|
7
|
+
`),t.push(ka(e.hint,Es.gray))),t.join("")}function am(e){return ka(e,Es.green)}function zn(e){return ka(e,Es.gray)}var Es,gr=v(()=>{"use strict";Es={red:"\x1B[31m",yellow:"\x1B[33m",green:"\x1B[32m",cyan:"\x1B[36m",gray:"\x1B[90m",reset:"\x1B[0m",bold:"\x1B[1m"}});var kb,SO=v(()=>{"use strict";kb="0.124.51"});function F(e,t,n){function i(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,u=Object.keys(l);for(let d=0;d<u.length;d++){let p=u[d];p in a||(a[p]=l[p].bind(a))}}let r=n?.Parent??Object;class o extends r{}Object.defineProperty(o,"name",{value:e});function s(a){var c;let l=n?.Parent?new o:this;i(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(s,"init",{value:i}),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 cn(e){return e&&Object.assign(cm,e),cm}var EO,xb,Qi,xa,cm,Ju=v(()=>{EO=Object.freeze({status:"aborted"});xb=Symbol("zod_brand"),Qi=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},xa=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},cm={}});var be={};_e(be,{BIGINT_FORMAT_RANGES:()=>NO,Class:()=>AO,NUMBER_FORMAT_RANGES:()=>jO,aborted:()=>Ea,allowsEval:()=>_O,assert:()=>$ce,assertEqual:()=>bce,assertIs:()=>kce,assertNever:()=>xce,assertNotEqual:()=>vce,assignProp:()=>Ra,base64ToUint8Array:()=>_U,base64urlToUint8Array:()=>Gce,cached:()=>Yu,captureStackTrace:()=>Rb,cleanEnum:()=>Fce,cleanRegex:()=>dm,clone:()=>hr,cloneDef:()=>Sce,createTransparentProxy:()=>_ce,defineLazy:()=>ct,esc:()=>$b,escapeRegex:()=>yi,extend:()=>Dce,finalizeIssue:()=>Ir,floatSafeRemainder:()=>PO,getElementAtPath:()=>Ece,getEnumValues:()=>um,getLengthableOrigin:()=>mm,getParsedType:()=>Cce,getSizableOrigin:()=>fm,hexToUint8Array:()=>Bce,isObject:()=>dl,isPlainObject:()=>Sa,issue:()=>Qu,joinValues:()=>K,jsonStringifyReplacer:()=>Zu,merge:()=>Nce,mergeDefs:()=>Os,normalizeParams:()=>ve,nullish:()=>$a,numKeys:()=>Pce,objectClone:()=>Rce,omit:()=>Tce,optionalKeys:()=>DO,parsedType:()=>we,partial:()=>Lce,pick:()=>Ice,prefixIssues:()=>Yr,primitiveTypes:()=>TO,promiseAllObject:()=>Oce,propertyKeyTypes:()=>pm,randomString:()=>Ace,required:()=>Mce,safeExtend:()=>jce,shallowClone:()=>IO,slugify:()=>CO,stringifyPrimitive:()=>me,uint8ArrayToBase64:()=>IU,uint8ArrayToBase64url:()=>Wce,uint8ArrayToHex:()=>Uce,unwrapMessage:()=>lm});function bce(e){return e}function vce(e){return e}function kce(e){}function xce(e){throw new Error("Unexpected value in exhaustive check")}function $ce(e){}function um(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}function K(e,t="|"){return e.map(n=>me(n)).join(t)}function Zu(e,t){return typeof t=="bigint"?t.toString():t}function Yu(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function $a(e){return e==null}function dm(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function PO(e,t){let n=(e.toString().split(".")[1]||"").length,i=t.toString(),r=(i.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(i)){let c=i.match(/\d?e-(\d?)/);c?.[1]&&(r=Number.parseInt(c[1]))}let o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return s%a/10**o}function ct(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==CU)return i===void 0&&(i=CU,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Rce(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ra(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Os(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function Sce(e){return Os(e._zod.def)}function Ece(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}function Oce(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let o=0;o<t.length;o++)r[t[o]]=i[o];return r})}function Ace(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}function $b(e){return JSON.stringify(e)}function CO(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function dl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Sa(e){if(dl(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(dl(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function IO(e){return Sa(e)?{...e}:Array.isArray(e)?[...e]:e}function Pce(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function yi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hr(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function ve(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 _ce(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,o){return t??(t=e()),Reflect.set(t,i,r,o)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}function me(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function DO(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function Ice(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Os(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 Ra(this,"shape",s),s},checks:[]});return hr(e,o)}function Tce(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Os(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 Ra(this,"shape",s),s},checks:[]});return hr(e,o)}function Dce(e,t){if(!Sa(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=e._zod.def.shape;for(let s in t)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=Os(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Ra(this,"shape",o),o}});return hr(e,r)}function jce(e,t){if(!Sa(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=Os(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Ra(this,"shape",i),i}});return hr(e,n)}function Nce(e,t){let n=Os(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t._zod.def.shape};return Ra(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:[]});return hr(e,n)}function Lce(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=Os(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 Ra(this,"shape",c),c},checks:[]});return hr(t,s)}function Mce(e,t,n){let i=Os(t._zod.def,{get shape(){let r=t._zod.def.shape,o={...r};if(n)for(let s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(let s in r)o[s]=new e({type:"nonoptional",innerType:r[s]});return Ra(this,"shape",o),o}});return hr(t,i)}function Ea(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 Yr(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function lm(e){return typeof e=="string"?e:e?.message}function Ir(e,t,n){let i={...e,path:e.path??[]};if(!e.message){let r=lm(e.inst?._zod.def?.error?.(e))??lm(t?.error?.(e))??lm(n.customError?.(e))??lm(n.localeError?.(e))??"Invalid input";i.message=r}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function fm(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function mm(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function we(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 Qu(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function Fce(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function _U(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}function IU(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Gce(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return _U(t+n)}function Wce(e){return IU(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Bce(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 i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}function Uce(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var CU,Rb,_O,Cce,pm,TO,jO,NO,AO,Ge=v(()=>{CU=Symbol("evaluating");Rb="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};_O=Yu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});Cce=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}`)}},pm=new Set(["string","number","symbol"]),TO=new Set(["string","number","bigint","boolean","symbol","undefined"]);jO={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]},NO={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};AO=class{constructor(...t){}}});function hm(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(t(r))):i.push(t(r));return{formErrors:i,fieldErrors:n}}function ym(e,t=n=>n.message){let n={_errors:[]},i=r=>{for(let o of r.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>i({issues:s}));else if(o.code==="invalid_key")i({issues:o.issues});else if(o.code==="invalid_element")i({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let s=n,a=0;for(;a<o.path.length;){let c=o.path[a];a===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return i(e),n}function LO(e,t=n=>n.message){let n={errors:[]},i=(r,o=[])=>{var s,a;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>i({issues:l},c.path));else if(c.code==="invalid_key")i({issues:c.issues},c.path);else if(c.code==="invalid_element")i({issues:c.issues},c.path);else{let l=[...o,...c.path];if(l.length===0){n.errors.push(t(c));continue}let u=n,d=0;for(;d<l.length;){let p=l[d],f=d===l.length-1;typeof p=="string"?(u.properties??(u.properties={}),(s=u.properties)[p]??(s[p]={errors:[]}),u=u.properties[p]):(u.items??(u.items=[]),(a=u.items)[p]??(a[p]={errors:[]}),u=u.items[p]),f&&u.errors.push(t(c)),d++}}};return i(e),n}function DU(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}function MO(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${DU(i.path)}`);return t.join(`
|
|
8
8
|
`)}var TU,gm,Tr,FO=v(()=>{Ju();Ge();TU=(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,Zu,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},gm=F("$ZodError",TU),Tr=F("$ZodError",TU,{Parent:Error})});var Xu,Sb,ed,Eb,td,GO,nd,WO,Ob,Vce,Ab,qce,Pb,Hce,Cb,Kce,_b,Jce,Ib,Zce,Tb,Yce,Db,Qce,BO=v(()=>{Ju();FO();Ge();Xu=e=>(t,n,i,r)=>{let o=i?Object.assign(i,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Qi;if(s.issues.length){let a=new(r?.Err??e)(s.issues.map(c=>Ir(c,o,cn())));throw Rb(a,r?.callee),a}return s.value},Sb=Xu(Tr),ed=e=>async(t,n,i,r)=>{let o=i?Object.assign(i,{async:!0}):{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(r?.Err??e)(s.issues.map(c=>Ir(c,o,cn())));throw Rb(a,r?.callee),a}return s.value},Eb=ed(Tr),td=e=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new Qi;return o.issues.length?{success:!1,error:new(e??gm)(o.issues.map(s=>Ir(s,r,cn())))}:{success:!0,data:o.value}},GO=td(Tr),nd=e=>async(t,n,i)=>{let r=i?Object.assign(i,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(s=>Ir(s,r,cn())))}:{success:!0,data:o.value}},WO=nd(Tr),Ob=e=>(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Xu(e)(t,n,r)},Vce=Ob(Tr),Ab=e=>(t,n,i)=>Xu(e)(t,n,i),qce=Ab(Tr),Pb=e=>async(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return ed(e)(t,n,r)},Hce=Pb(Tr),Cb=e=>async(t,n,i)=>ed(e)(t,n,i),Kce=Cb(Tr),_b=e=>(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return td(e)(t,n,r)},Jce=_b(Tr),Ib=e=>(t,n,i)=>td(e)(t,n,i),Zce=Ib(Tr),Tb=e=>async(t,n,i)=>{let r=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return nd(e)(t,n,r)},Yce=Tb(Tr),Db=e=>async(t,n,i)=>nd(e)(t,n,i),Qce=Db(Tr)});var wi={};_e(wi,{base64:()=>iA,base64url:()=>jb,bigint:()=>uA,boolean:()=>pA,browserEmail:()=>sle,cidrv4:()=>nA,cidrv6:()=>rA,cuid:()=>UO,cuid2:()=>zO,date:()=>sA,datetime:()=>cA,domain:()=>lle,duration:()=>JO,e164:()=>oA,email:()=>YO,emoji:()=>QO,extendedDuration:()=>Xce,guid:()=>ZO,hex:()=>ule,hostname:()=>cle,html5Email:()=>rle,idnEmail:()=>ole,integer:()=>dA,ipv4:()=>XO,ipv6:()=>eA,ksuid:()=>HO,lowercase:()=>gA,mac:()=>tA,md5_base64:()=>ple,md5_base64url:()=>fle,md5_hex:()=>dle,nanoid:()=>KO,null:()=>fA,number:()=>Nb,rfc5322Email:()=>ile,sha1_base64:()=>gle,sha1_base64url:()=>hle,sha1_hex:()=>mle,sha256_base64:()=>wle,sha256_base64url:()=>ble,sha256_hex:()=>yle,sha384_base64:()=>kle,sha384_base64url:()=>xle,sha384_hex:()=>vle,sha512_base64:()=>Rle,sha512_base64url:()=>Sle,sha512_hex:()=>$le,string:()=>lA,time:()=>aA,ulid:()=>VO,undefined:()=>mA,unicodeEmail:()=>jU,uppercase:()=>hA,uuid:()=>pl,uuid4:()=>ele,uuid6:()=>tle,uuid7:()=>nle,xid:()=>qO});function QO(){return new RegExp(ale,"u")}function LU(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 aA(e){return new RegExp(`^${LU(e)}$`)}function cA(e){let t=LU({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${t}(?:${n.join("|")})`;return new RegExp(`^${NU}T(?:${i})$`)}function wm(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function bm(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var UO,zO,VO,qO,HO,KO,JO,Xce,ZO,pl,ele,tle,nle,YO,rle,ile,jU,ole,sle,ale,XO,eA,tA,nA,rA,iA,jb,cle,lle,oA,NU,sA,lA,uA,dA,Nb,pA,fA,mA,gA,hA,ule,dle,ple,fle,mle,gle,hle,yle,wle,ble,vle,kle,xle,$le,Rle,Sle,Lb=v(()=>{Ge();UO=/^[cC][^\s-]{8,}$/,zO=/^[0-9a-z]+$/,VO=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qO=/^[0-9a-vA-V]{20}$/,HO=/^[A-Za-z0-9]{27}$/,KO=/^[a-zA-Z0-9_-]{21}$/,JO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Xce=/^[-+]?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)?)??$/,ZO=/^([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})$/,pl=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)$/,ele=pl(4),tle=pl(6),nle=pl(7),YO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rle=/^[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])?)*$/,ile=/^(([^<>()\[\]\\.,;:\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,}))$/,jU=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,ole=jU,sle=/^[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])?)*$/,ale="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";XO=/^(?:(?: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])$/,eA=/^(([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}|:))$/,tA=e=>{let t=yi(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},nA=/^((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])$/,rA=/^(([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])$/,iA=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jb=/^[A-Za-z0-9_-]*$/,cle=/^(?=.{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])?)*\.?$/,lle=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,oA=/^\+[1-9]\d{6,14}$/,NU="(?:(?:\\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])))",sA=new RegExp(`^${NU}$`);lA=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},uA=/^-?\d+n?$/,dA=/^-?\d+$/,Nb=/^-?\d+(?:\.\d+)?$/,pA=/^(?:true|false)$/i,fA=/^null$/i,mA=/^undefined$/i,gA=/^[^A-Z]*$/,hA=/^[^a-z]*$/,ule=/^[0-9a-fA-F]*$/;dle=/^[0-9a-fA-F]{32}$/,ple=wm(22,"=="),fle=bm(22),mle=/^[0-9a-fA-F]{40}$/,gle=wm(27,"="),hle=bm(27),yle=/^[0-9a-fA-F]{64}$/,wle=wm(43,"="),ble=bm(43),vle=/^[0-9a-fA-F]{96}$/,kle=wm(64,""),xle=bm(64),$le=/^[0-9a-fA-F]{128}$/,Rle=wm(86,"=="),Sle=bm(86)});function MU(e,t,n){e.issues.length&&t.issues.push(...Yr(n,e.issues))}var Wt,FU,Mb,Fb,yA,wA,bA,vA,kA,xA,$A,RA,SA,rd,EA,OA,AA,PA,CA,_A,IA,TA,DA,Gb=v(()=>{Ju();Lb();Ge();Wt=F("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),FU={number:"number",bigint:"bigint",object:"date"},Mb=F("$ZodCheckLessThan",(e,t)=>{Wt.init(e,t);let n=FU[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Fb=F("$ZodCheckGreaterThan",(e,t)=>{Wt.init(e,t);let n=FU[typeof t.value];e._zod.onattach.push(i=>{let r=i._zod.bag,o=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yA=F("$ZodCheckMultipleOf",(e,t)=>{Wt.init(e,t),e._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.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):PO(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})}}),wA=F("$ZodCheckNumberFormat",(e,t)=>{Wt.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,o]=jO[t.format];e._zod.onattach.push(s=>{let a=s._zod.bag;a.format=t.format,a.minimum=r,a.maximum=o,n&&(a.pattern=dA)}),e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:i,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:i,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:i,inclusive:!0,continue:!t.abort});return}}a<r&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),bA=F("$ZodCheckBigIntFormat",(e,t)=>{Wt.init(e,t);let[n,i]=NO[t.format];e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,o.minimum=n,o.maximum=i}),e._zod.check=r=>{let o=r.value;o<n&&r.issues.push({origin:"bigint",input:o,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),o>i&&r.issues.push({origin:"bigint",input:o,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),vA=F("$ZodCheckMaxSize",(e,t)=>{var n;Wt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!$a(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let r=i.value;r.size<=t.maximum||i.issues.push({origin:fm(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),kA=F("$ZodCheckMinSize",(e,t)=>{var n;Wt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!$a(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let r=i.value;r.size>=t.minimum||i.issues.push({origin:fm(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),xA=F("$ZodCheckSizeEquals",(e,t)=>{var n;Wt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!$a(r)&&r.size!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag;r.minimum=t.size,r.maximum=t.size,r.size=t.size}),e._zod.check=i=>{let r=i.value,o=r.size;if(o===t.size)return;let s=o>t.size;i.issues.push({origin:fm(r),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),$A=F("$ZodCheckMaxLength",(e,t)=>{var n;Wt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!$a(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(i._zod.bag.maximum=t.maximum)}),e._zod.check=i=>{let r=i.value;if(r.length<=t.maximum)return;let s=mm(r);i.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),RA=F("$ZodCheckMinLength",(e,t)=>{var n;Wt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!$a(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{let r=i.value;if(r.length>=t.minimum)return;let s=mm(r);i.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),SA=F("$ZodCheckLengthEquals",(e,t)=>{var n;Wt.init(e,t),(n=e._zod.def).when??(n.when=i=>{let r=i.value;return!$a(r)&&r.length!==void 0}),e._zod.onattach.push(i=>{let r=i._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=i=>{let r=i.value,o=r.length;if(o===t.length)return;let s=mm(r),a=o>t.length;i.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),rd=F("$ZodCheckStringFormat",(e,t)=>{var n,i;Wt.init(e,t),e._zod.onattach.push(r=>{let o=r._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),EA=F("$ZodCheckRegex",(e,t)=>{rd.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})}}),OA=F("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=gA),rd.init(e,t)}),AA=F("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=hA),rd.init(e,t)}),PA=F("$ZodCheckIncludes",(e,t)=>{Wt.init(e,t);let n=yi(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(i)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),CA=F("$ZodCheckStartsWith",(e,t)=>{Wt.init(e,t);let n=new RegExp(`^${yi(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),_A=F("$ZodCheckEndsWith",(e,t)=>{Wt.init(e,t);let n=new RegExp(`.*${yi(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(i=>{let r=i._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});IA=F("$ZodCheckProperty",(e,t)=>{Wt.init(e,t),e._zod.check=n=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>MU(r,n,t.property));MU(i,n,t.property)}}),TA=F("$ZodCheckMimeType",(e,t)=>{Wt.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(i=>{i._zod.bag.mime=t.mime}),e._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),DA=F("$ZodCheckOverwrite",(e,t)=>{Wt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}})});var vm,jA=v(()=>{vm=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 i=t.split(`
|
|
9
9
|
`).filter(s=>s),r=Math.min(...i.map(s=>s.length-s.trimStart().length)),o=i.map(s=>s.slice(r)).map(s=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let t=Function,n=this?.args,r=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,r.join(`
|
|
10
10
|
`))}}});var NA,LA=v(()=>{NA={major:4,minor:3,patch:6}});function oP(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function QU(e){if(!jb.test(e))return!1;let t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return oP(n)}function XU(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[i]=n;if(!i)return!1;let r=JSON.parse(atob(i));return!("typ"in r&&r?.typ!=="JWT"||!r.alg||t&&(!("alg"in r)||r.alg!==t))}catch{return!1}}function WU(e,t,n){e.issues.length&&t.issues.push(...Yr(n,e.issues)),t.value[n]=e.value}function Vb(e,t,n,i,r){if(e.issues.length){if(r&&!(n in i))return;t.issues.push(...Yr(n,e.issues))}e.value===void 0?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function ez(e){let t=Object.keys(e.shape);for(let i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);let n=DO(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function tz(e,t,n,i,r,o){let s=[],a=r.keySet,c=r.catchall._zod,l=c.def.type,u=c.optout==="optional";for(let d in t){if(a.has(d))continue;if(l==="never"){s.push(d);continue}let p=c.run({value:t[d],issues:[]},i);p instanceof Promise?e.push(p.then(f=>Vb(f,n,d,t,u))):Vb(p,n,d,t,u)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}function BU(e,t,n,i){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let r=e.filter(o=>!Ea(o));return r.length===1?(t.value=r[0].value,r[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(s=>Ir(s,i,cn())))}),t)}function UU(e,t,n,i){let r=e.filter(o=>o.issues.length===0);return r.length===1?(t.value=r[0].value,t):(r.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(s=>Ir(s,i,cn())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1}),t)}function MA(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(Sa(e)&&Sa(t)){let n=Object.keys(t),i=Object.keys(e).filter(o=>n.indexOf(o)!==-1),r={...e,...t};for(let o of i){let s=MA(e[o],t[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};r[o]=s.data}return{valid:!0,data:r}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let i=0;i<e.length;i++){let r=e[i],o=t[i],s=MA(r,o);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function zU(e,t,n){let i=new Map,r;for(let a of t.issues)if(a.code==="unrecognized_keys"){r??(r=a);for(let c of a.keys)i.has(c)||i.set(c,{}),i.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)i.has(c)||i.set(c,{}),i.get(c).r=!0;else e.issues.push(a);let o=[...i].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(o.length&&r&&e.issues.push({...r,keys:o}),Ea(e))return e;let s=MA(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 Wb(e,t,n){e.issues.length&&t.issues.push(...Yr(n,e.issues)),t.value[n]=e.value}function VU(e,t,n,i,r,o,s){e.issues.length&&(pm.has(typeof i)?n.issues.push(...Yr(i,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:r,inst:o,issues:e.issues.map(a=>Ir(a,s,cn()))})),t.issues.length&&(pm.has(typeof i)?n.issues.push(...Yr(i,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:r,inst:o,key:i,issues:t.issues.map(a=>Ir(a,s,cn()))})),n.value.set(e.value,t.value)}function qU(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function HU(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}function KU(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function JU(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 Bb(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}function Ub(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let r=t.transform(e.value,e);return r instanceof Promise?r.then(o=>zb(e,o,t.out,n)):zb(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(o=>zb(e,o,t.in,n)):zb(e,r,t.in,n)}}function zb(e,t,n,i){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},i)}function ZU(e){return e.value=Object.freeze(e.value),e}function YU(e,t,n,i){if(!e){let r={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(r.params=i._zod.def.params),t.issues.push(Qu(r))}}var Ye,fl,Tt,FA,GA,WA,BA,UA,zA,VA,qA,HA,KA,JA,ZA,YA,QA,XA,eP,tP,nP,rP,iP,sP,aP,cP,lP,uP,qb,dP,km,Hb,pP,fP,mP,gP,hP,yP,wP,bP,vP,kP,nz,xP,xm,$P,RP,SP,Kb,EP,OP,AP,PP,CP,_P,IP,Jb,TP,DP,jP,NP,LP,MP,FP,GP,WP,$m,BP,UP,zP,VP,qP,HP,KP=v(()=>{Gb();Ju();jA();BO();Lb();Ge();LA();Ge();Ye=F("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=NA;let i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(let r of i)for(let o of r._zod.onattach)o(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(s,a,c)=>{let l=Ea(s),u;for(let d of a){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(l)continue;let p=s.issues.length,f=d._zod.check(s);if(f instanceof Promise&&c?.async===!1)throw new Qi;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(l||(l=Ea(s,p)))});else{if(s.issues.length===p)continue;l||(l=Ea(s,p))}}return u?u.then(()=>s):s},o=(s,a,c)=>{if(Ea(s))return s.aborted=!0,s;let l=r(a,i,c);if(l instanceof Promise){if(c.async===!1)throw new Qi;return l.then(u=>e._zod.parse(u,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(u=>o(u,s,a)):o(l,s,a)}let c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Qi;return c.then(l=>r(l,i,a))}return r(c,i,a)}}ct(e,"~standard",()=>({validate:r=>{try{let o=GO(e,r);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return WO(e,r).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),fl=F("$ZodString",(e,t)=>{Ye.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??lA(e._zod.bag),e._zod.parse=(n,i)=>{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}}),Tt=F("$ZodStringFormat",(e,t)=>{rd.init(e,t),fl.init(e,t)}),FA=F("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ZO),Tt.init(e,t)}),GA=F("$ZodUUID",(e,t)=>{if(t.version){let i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=pl(i))}else t.pattern??(t.pattern=pl());Tt.init(e,t)}),WA=F("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=YO),Tt.init(e,t)}),BA=F("$ZodURL",(e,t)=>{Tt.init(e,t),e._zod.check=n=>{try{let i=n.value.trim(),r=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(r.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(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.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=r.href:n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),UA=F("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=QO()),Tt.init(e,t)}),zA=F("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=KO),Tt.init(e,t)}),VA=F("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=UO),Tt.init(e,t)}),qA=F("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=zO),Tt.init(e,t)}),HA=F("$ZodULID",(e,t)=>{t.pattern??(t.pattern=VO),Tt.init(e,t)}),KA=F("$ZodXID",(e,t)=>{t.pattern??(t.pattern=qO),Tt.init(e,t)}),JA=F("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=HO),Tt.init(e,t)}),ZA=F("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=cA(t)),Tt.init(e,t)}),YA=F("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=sA),Tt.init(e,t)}),QA=F("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=aA(t)),Tt.init(e,t)}),XA=F("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=JO),Tt.init(e,t)}),eP=F("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=XO),Tt.init(e,t),e._zod.bag.format="ipv4"}),tP=F("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=eA),Tt.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})}}}),nP=F("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=tA(t.delimiter)),Tt.init(e,t),e._zod.bag.format="mac"}),rP=F("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=nA),Tt.init(e,t)}),iP=F("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=rA),Tt.init(e,t),e._zod.check=n=>{let i=n.value.split("/");try{if(i.length!==2)throw new Error;let[r,o]=i;if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});sP=F("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=iA),Tt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{oP(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});aP=F("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=jb),Tt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{QU(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),cP=F("$ZodE164",(e,t)=>{t.pattern??(t.pattern=oA),Tt.init(e,t)});lP=F("$ZodJWT",(e,t)=>{Tt.init(e,t),e._zod.check=n=>{XU(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),uP=F("$ZodCustomStringFormat",(e,t)=>{Tt.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})}}),qb=F("$ZodNumber",(e,t)=>{Ye.init(e,t),e._zod.pattern=e._zod.bag.pattern??Nb,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let o=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:e,...o?{received:o}:{}}),n}}),dP=F("$ZodNumberFormat",(e,t)=>{wA.init(e,t),qb.init(e,t)}),km=F("$ZodBoolean",(e,t)=>{Ye.init(e,t),e._zod.pattern=pA,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=!!n.value}catch{}let r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:e}),n}}),Hb=F("$ZodBigInt",(e,t)=>{Ye.init(e,t),e._zod.pattern=uA,e._zod.parse=(n,i)=>{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}}),pP=F("$ZodBigIntFormat",(e,t)=>{bA.init(e,t),Hb.init(e,t)}),fP=F("$ZodSymbol",(e,t)=>{Ye.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:e}),n}}),mP=F("$ZodUndefined",(e,t)=>{Ye.init(e,t),e._zod.pattern=mA,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:e}),n}}),gP=F("$ZodNull",(e,t)=>{Ye.init(e,t),e._zod.pattern=fA,e._zod.values=new Set([null]),e._zod.parse=(n,i)=>{let r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),n}}),hP=F("$ZodAny",(e,t)=>{Ye.init(e,t),e._zod.parse=n=>n}),yP=F("$ZodUnknown",(e,t)=>{Ye.init(e,t),e._zod.parse=n=>n}),wP=F("$ZodNever",(e,t)=>{Ye.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),bP=F("$ZodVoid",(e,t)=>{Ye.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:e}),n}}),vP=F("$ZodDate",(e,t)=>{Ye.init(e,t),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let r=n.value,o=r instanceof Date;return o&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...o?{received:"Invalid Date"}:{},inst:e}),n}});kP=F("$ZodArray",(e,t)=>{Ye.init(e,t),e._zod.parse=(n,i)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),n;n.value=Array(r.length);let o=[];for(let s=0;s<r.length;s++){let a=r[s],c=t.element._zod.run({value:a,issues:[]},i);c instanceof Promise?o.push(c.then(l=>WU(l,n,s))):WU(c,n,s)}return o.length?Promise.all(o).then(()=>n):n}});nz=F("$ZodObject",(e,t)=>{if(Ye.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 i=Yu(()=>ez(t));ct(e._zod,"propValues",()=>{let a=t.shape,c={};for(let l in a){let u=a[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(let d of u.values)c[l].add(d)}}return c});let r=dl,o=t.catchall,s;e._zod.parse=(a,c)=>{s??(s=i.value);let l=a.value;if(!r(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),a;a.value={};let u=[],d=s.shape;for(let p of s.keys){let f=d[p],g=f._zod.optout==="optional",h=f._zod.run({value:l[p],issues:[]},c);h instanceof Promise?u.push(h.then(w=>Vb(w,a,p,l,g))):Vb(h,a,p,l,g)}return o?tz(u,l,a,c,i.value,e):u.length?Promise.all(u).then(()=>a):a}}),xP=F("$ZodObjectJIT",(e,t)=>{nz.init(e,t);let n=e._zod.parse,i=Yu(()=>ez(t)),r=p=>{let f=new vm(["shape","payload","ctx"]),g=i.value,h=$=>{let k=$b($);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};f.write("const input = payload.value;");let w=Object.create(null),b=0;for(let $ of g.keys)w[$]=`key_${b++}`;f.write("const newResult = {};");for(let $ of g.keys){let k=w[$],R=$b($),T=p[$]?._zod?.optout==="optional";f.write(`const ${k} = ${h($)};`),T?f.write(`
|
|
@@ -102,7 +102,7 @@ ${e.timestamp}`,"utf-8")}function Kfe(e,t,n){let i=`the approval of gate ${n.gat
|
|
|
102
102
|
`+S.slice(ee+1):Ae+=S.slice(ue),Ae.slice(1)}function mn(S){let G="",H=0;for(let ae=0;ae<S.length;H>=65536?ae+=2:ae++){H=Se(S,ae);let ue=E[H];!ue&&oe(H)?(G+=S[ae],H>=65536&&(G+=S[ae+1])):G+=ue||te(H)}return G}function Wn(S,G,H){let ae="",ue=S.tag;for(let fe=0,ee=H.length;fe<ee;fe+=1){let ke=H[fe];S.replacer&&(ke=S.replacer.call(H,String(fe),ke)),(M(S,G,ke,!1,!1)||typeof ke>"u"&&M(S,G,null,!1,!1))&&(ae!==""&&(ae+=","+(S.condenseFlow?"":" ")),ae+=S.dump)}S.tag=ue,S.dump="["+ae+"]"}function mr(S,G,H,ae){let ue="",fe=S.tag;for(let ee=0,ke=H.length;ee<ke;ee+=1){let Ae=H[ee];S.replacer&&(Ae=S.replacer.call(H,String(ee),Ae)),(M(S,G+1,Ae,!0,!0,!1,!0)||typeof Ae>"u"&&M(S,G+1,null,!0,!0,!1,!0))&&((!ae||ue!=="")&&(ue+=le(S,G)),S.dump&&a===S.dump.charCodeAt(0)?ue+="-":ue+="- ",ue+=S.dump)}S.tag=fe,S.dump=ue||"[]"}function tr(S,G,H){let ae="",ue=S.tag,fe=Object.keys(H);for(let ee=0,ke=fe.length;ee<ke;ee+=1){let Ae="";ae!==""&&(Ae+=", "),S.condenseFlow&&(Ae+='"');let Be=fe[ee],ze=H[Be];S.replacer&&(ze=S.replacer.call(H,Be,ze)),M(S,G,Be,!1,!1)&&(S.dump.length>1024&&(Ae+="? "),Ae+=S.dump+(S.condenseFlow?'"':"")+":"+(S.condenseFlow?"":" "),M(S,G,ze,!1,!1)&&(Ae+=S.dump,ae+=Ae))}S.tag=ue,S.dump="{"+ae+"}"}function ba(S,G,H,ae){let ue="",fe=S.tag,ee=Object.keys(H);if(S.sortKeys===!0)ee.sort();else if(typeof S.sortKeys=="function")ee.sort(S.sortKeys);else if(S.sortKeys)throw new t("sortKeys must be a boolean or a function");for(let ke=0,Ae=ee.length;ke<Ae;ke+=1){let Be="";(!ae||ue!=="")&&(Be+=le(S,G));let ze=ee[ke],Ke=H[ze];if(S.replacer&&(Ke=S.replacer.call(H,ze,Ke)),!M(S,G+1,ze,!0,!0,!0))continue;let rt=S.tag!==null&&S.tag!=="?"||S.dump&&S.dump.length>1024;rt&&(S.dump&&a===S.dump.charCodeAt(0)?Be+="?":Be+="? "),Be+=S.dump,rt&&(Be+=le(S,G)),M(S,G+1,Ke,!0,rt)&&(S.dump&&a===S.dump.charCodeAt(0)?Be+=":":Be+=": ",Be+=S.dump,ue+=Be)}S.tag=fe,S.dump=ue||"{}"}function y(S,G,H){let ae=H?S.explicitTypes:S.implicitTypes;for(let ue=0,fe=ae.length;ue<fe;ue+=1){let ee=ae[ue];if((ee.instanceOf||ee.predicate)&&(!ee.instanceOf||typeof G=="object"&&G instanceof ee.instanceOf)&&(!ee.predicate||ee.predicate(G))){if(H?ee.multi&&ee.representName?S.tag=ee.representName(G):S.tag=ee.tag:S.tag="?",ee.represent){let ke=S.styleMap[ee.tag]||ee.defaultStyle,Ae;if(i.call(ee.represent)==="[object Function]")Ae=ee.represent(G,ke);else if(r.call(ee.represent,ke))Ae=ee.represent[ke](G,ke);else throw new t("!<"+ee.tag+'> tag resolver accepts not "'+ke+'" style');S.dump=Ae}return!0}}return!1}function M(S,G,H,ae,ue,fe,ee){S.tag=null,S.dump=H,y(S,H,!1)||y(S,H,!0);let ke=i.call(S.dump),Ae=ae;ae&&(ae=S.flowLevel<0||S.flowLevel>G);let Be=ke==="[object Object]"||ke==="[object Array]",ze,Ke;if(Be&&(ze=S.duplicates.indexOf(H),Ke=ze!==-1),(S.tag!==null&&S.tag!=="?"||Ke||S.indent!==2&&G>0)&&(ue=!1),Ke&&S.usedDuplicates[ze])S.dump="*ref_"+ze;else{if(Be&&Ke&&!S.usedDuplicates[ze]&&(S.usedDuplicates[ze]=!0),ke==="[object Object]")ae&&Object.keys(S.dump).length!==0?(ba(S,G,S.dump,ue),Ke&&(S.dump="&ref_"+ze+S.dump)):(tr(S,G,S.dump),Ke&&(S.dump="&ref_"+ze+" "+S.dump));else if(ke==="[object Array]")ae&&S.dump.length!==0?(S.noArrayIndent&&!ee&&G>0?mr(S,G-1,S.dump,ue):mr(S,G,S.dump,ue),Ke&&(S.dump="&ref_"+ze+S.dump)):(Wn(S,G,S.dump),Ke&&(S.dump="&ref_"+ze+" "+S.dump));else if(ke==="[object String]")S.tag!=="?"&&$t(S,S.dump,G,fe,Ae);else{if(ke==="[object Undefined]")return!1;if(S.skipInvalid)return!1;throw new t("unacceptable kind of an object to dump "+ke)}if(S.tag!==null&&S.tag!=="?"){let rt=encodeURI(S.tag[0]==="!"?S.tag.slice(1):S.tag).replace(/!/g,"%21");S.tag[0]==="!"?rt="!"+rt:rt.slice(0,18)==="tag:yaml.org,2002:"?rt="!!"+rt.slice(18):rt="!<"+rt+">",S.dump=rt+" "+S.dump}}return!0}function q(S,G){let H=[],ae=[];X(S,H,ae);let ue=ae.length;for(let fe=0;fe<ue;fe+=1)G.duplicates.push(H[ae[fe]]);G.usedDuplicates=new Array(ue)}function X(S,G,H){if(S!==null&&typeof S=="object"){let ae=G.indexOf(S);if(ae!==-1)H.indexOf(ae)===-1&&H.push(ae);else if(G.push(S),Array.isArray(S))for(let ue=0,fe=S.length;ue<fe;ue+=1)X(S[ue],G,H);else{let ue=Object.keys(S);for(let fe=0,ee=ue.length;fe<ee;fe+=1)X(S[ue[fe]],G,H)}}}function V(S,G){G=G||{};let H=new qe(G);H.noRefs||q(S,H);let ae=S;return H.replacer&&(ae=H.replacer.call({"":ae},"",ae)),M(H,0,ae,!0,!0)?H.dump+`
|
|
103
103
|
`:""}return hj.dump=V,hj}function Vve(){if(VJ)return lr;VJ=1;let e=Uve(),t=zve();function n(i,r){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}return lr.Type=xr(),lr.Schema=qJ(),lr.FAILSAFE_SCHEMA=ZJ(),lr.JSON_SCHEMA=t5(),lr.CORE_SCHEMA=n5(),lr.DEFAULT_SCHEMA=yj(),lr.load=e.load,lr.loadAll=e.loadAll,lr.dump=t.dump,lr.YAMLException=Kg(),lr.types={binary:o5(),float:e5(),map:JJ(),null:YJ(),pairs:a5(),set:c5(),timestamp:r5(),bool:QJ(),int:XJ(),merge:i5(),omap:s5(),seq:KJ(),str:HJ()},lr.safeLoad=n("safeLoad","load"),lr.safeLoadAll=n("safeLoadAll","loadAll"),lr.safeDump=n("safeDump","dump"),lr}var lr,Sx,Ja,kJ,JD,xJ,ZD,$J,YD,RJ,QD,SJ,XD,EJ,ej,OJ,tj,AJ,nj,PJ,rj,CJ,ij,_J,oj,IJ,sj,TJ,aj,DJ,cj,jJ,lj,NJ,uj,LJ,dj,MJ,pj,FJ,fj,GJ,mj,WJ,gj,BJ,UJ,hj,zJ,VJ,qve,Ws,cKe,lKe,uKe,dKe,pKe,fKe,mKe,gKe,hKe,yKe,wKe,bKe,vKe,kKe,Ex=v(()=>{lr={},Sx={},Ja={};hj={};qve=Vve(),Ws=Wve(qve),{Type:cKe,Schema:lKe,FAILSAFE_SCHEMA:uKe,JSON_SCHEMA:dKe,CORE_SCHEMA:pKe,DEFAULT_SCHEMA:fKe,load:mKe,loadAll:gKe,dump:hKe,YAMLException:yKe,types:wKe,safeLoad:bKe,safeLoadAll:vKe,safeDump:kKe}=Ws});import{existsSync as Hve,readFileSync as Ax}from"node:fs";import{isAbsolute as bj,join as vj,relative as kj,resolve as xj}from"node:path";function u5(e=[]){let t=new Map;for(let n of[...l5,...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 d5(){return u5()}function p5(e,t,n){if("directory"in e.probe)return!0;if("chantProject"in e.probe)return Sj(t,n);if("repo"in e.probe)return!0;let{anyFile:i,anyBlock:r,anyJsonKey:o,anyLine:s,anyDocument:a}=e.probe;if(i&&Jg(t,n,i).length>0)return!0;if(o)for(let c of Jg(t,n,o.in))try{let l=JSON.parse(t.read(c));if(o.pointers.some(u=>f5(l,u)!==void 0))return!0}catch{}if(s){let c=s.starts.map(l=>l.toLowerCase());for(let l of Jg(t,n,s.in))try{if(t.read(l).split(/\r?\n/).some(u=>c.some(d=>u.trimStart().toLowerCase().startsWith(d))))return!0}catch{}}if(a)for(let c of Jg(t,n,a.in))try{if(Zve(t.read(c)).some(l=>a.match.some(u=>Yve(l,u))))return!0}catch{}if(r){let c=new RegExp(`^\\s*(?:${r.blocks.map(Rj).join("|")})\\s*\\{`,"m");for(let l of Jg(t,n,r.in))try{if(c.test(t.read(l)))return!0}catch{}}return!1}function Jg(e,t,n){let i=[],r=n.filter(o=>o.includes("*"));for(let o of n)!o.includes("*")&&e.stat(De(t,o))==="file"&&i.push(De(t,o));if(r.length>0){let o=r.map(s=>new RegExp(`^${s.split("*").map(a=>Rj(a).replace(/\\\[0-9\\\]/g,"[0-9]")).join("[^/]*")}$`));for(let s of e.list(t)??[])s.type==="file"&&o.some(a=>a.test(s.name))&&i.push(De(t,s.name))}return i.sort()}function Zve(e){try{return Ws.loadAll(e)}catch{try{return Ws.loadAll(e.replace(/(^|[\s:\-[,{])!(?:[A-Za-z][\w]*:?)+/gm,"$1"))}catch{return[]}}}function Yve(e,t){let n=Object.entries(t);return n.length>0&&n.every(([i,r])=>{let o=f5(e,i);return o===void 0?!1:r.some(s=>new RegExp(`^${s.split("*").map(Rj).join(".*")}$`).test(String(o)))})}function f5(e,t){let n=e;for(let i of t.split("/").slice(1)){let r=i.replace(/~1/g,"/").replace(/~0/g,"~");if(n===null||typeof n!="object"||!Object.prototype.hasOwnProperty.call(n,r))return;n=n[r]}return n}function Rj(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sj(e,t){let n=De(t,"package.json");if(e.stat(n)==="file")try{let r=JSON.parse(e.read(n));for(let o of["dependencies","devDependencies","peerDependencies"]){let s=r[o];if(s&&typeof s=="object"&&Object.keys(s).some(eke))return!0}}catch{}let i=(r,o)=>{let s=e.list(r)??[];return s.some(a=>a.type==="file"&&Qve.includes(a.name))?!0:o===Xve?!1:s.some(a=>a.type==="dir"&&!ni(a.name)&&i(De(r,a.name),o+1))};return i(t,0)}function eke(e){return e==="@intentius/chant"||e.startsWith("@intentius/chant-lexicon-")}function tke(){if(Ox)return Ox;let e=Gs();return Ox=new e({allErrors:!0,strict:!0}).compile(CI),Ox}function nke(e,t){let n;try{n=JSON.parse(e)}catch(a){return{kinds:[],problems:[`${t}: the kinds file is not JSON (${a.message})`]}}let i=tke();if(!i(n)){let a=(i.errors??[]).map(c=>`${t}: ${c.instancePath||"the kinds file"} ${c.message??"is invalid"}`);return{kinds:[],problems:[...new Set(a)]}}let r=[],o=[],s=new Set;for(let a of n.kinds){if(Jve.includes(a.name)){r.push(`${t}: kind ${a.name} is built in and can't be supplied by a package`);continue}if(s.has(a.name)){r.push(`${t}: kind ${a.name} is listed twice`);continue}s.add(a.name),o.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.fields?{fields:structuredClone(a.fields)}:{},...a.reader&&wj.includes(a.reader)?{reader:a.reader}:{},...a.memberFile?{memberFile:{path:a.memberFile.path,schema:a.memberFile.schema}}:{}}),a.reader&&!wj.includes(a.reader)&&r.push(`${t}: kind ${a.name} names link reader ${a.reader}, which this chant does not have (it has ${wj.join(", ")}); the kind is kept, and its members' links are only those their entries state`);for(let c of ske(a.fields??{}))r.push(`${t}: kind ${a.name} ${c}`)}return{kinds:o,problems:r}}function rke(e,t=$j){return FI(e,t)}function ike(e,t){let n=vj(e,"package.json"),i;try{i=JSON.parse(Ax(n,"utf-8"))}catch{return{kinds:[],problems:[`${t??e}: no readable package.json in ${e}`],file:void 0}}let r=t??(typeof i.name=="string"?i.name:e),o=rke(i);if(o===void 0)return{kinds:[],problems:[],file:void 0};if(typeof o!="string")return{kinds:[],problems:[`${r}: ${o.problem}`],file:void 0};let s=xj(e,o),a=kj(e,s);if(a.startsWith("..")||bj(a))return{kinds:[],problems:[`${r}: exports["${$j}"] points outside the package`],file:void 0};let c;try{c=Ax(s,"utf-8")}catch{return{kinds:[],problems:[`${r}: exports["${$j}"] names ${o}, which does not exist`],file:s}}let l=nke(c,r),u=typeof i.name=="string"?i.name:void 0;for(let d of l.kinds){if(d.packageDir=e,d.memberFile){let p=oke(d.memberFile,e);p&&l.problems.push(`${r}: kind ${d.name} ${p}; members of the kind fail WSP012 until it is fixed`)}if(d.graph?.reader){let p=xj(e,...d.graph.reader.split("/")),f=kj(e,p);f.startsWith("..")||bj(f)?(l.problems.push(`${r}: kind ${d.name} names graph reader ${d.graph.reader}, which is outside the package; the kind is kept, and workspace graph lists its members with kind-not-run`),delete d.graph):Hve(p)?d.graph.readerFile=p:(l.problems.push(`${r}: kind ${d.name} names graph reader ${d.graph.reader}, which does not exist in the package; the kind is kept, and workspace graph lists its members with kind-not-run`),delete d.graph)}else d.graph?.lexicon&&u!==Px(d.graph.lexicon)&&(l.problems.push(`${r}: kind ${d.name} reads its members with lexicon ${d.graph.lexicon}, which is ${Px(d.graph.lexicon)}, and this package is ${u??"unnamed"}; the kind is kept, and workspace graph lists its members with kind-not-run`),delete d.graph)}return{...l,file:s}}function oke(e,t){let n=xj(t,...e.schema.split("/"));e.schemaFile=n;let i=kj(t,n);if(i.startsWith("..")||bj(i))return`names member-file schema ${e.schema}, which is outside the package`;let r;try{r=JSON.parse(Ax(n,"utf-8"))}catch(o){return o.code==="ENOENT"?`names member-file schema ${e.schema}, which does not exist`:`names member-file schema ${e.schema}, which is not JSON (${o.message})`}if(r===null||typeof r!="object"||Array.isArray(r))return`names member-file schema ${e.schema}, which is not a JSON Schema object`;try{let o=Gs();e.validate=new o({allErrors:!0,strict:!1}).compile(r)}catch(o){return`names member-file schema ${e.schema}, which does not compile as a draft 2020-12 schema (${o.message})`}}function Px(e){return`@intentius/chant-lexicon-${e}`}function Ej(e,t){let n=r=>r.replace(/\{(member|dir|workspace)\}/g,(o,s)=>t[s]),i=r=>typeof r=="string"?n(r):Array.isArray(r)?r.map(i):r!==null&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([o,s])=>[n(o),i(s)])):r;return i(e)}function Oj(e,t){if(e.package){let n=Ga(e.package,t);if(!n)return{problem:`pinned package ${e.package} is not installed; install it to read the kinds it supplies`};let i;try{i=JSON.parse(Ax(vj(n,"package.json"),"utf-8")).version}catch{i=void 0}return e.version&&i!==e.version?{problem:`${e.package} is pinned at ${e.version}, and ${String(i??"an unknown version")} is installed`}:{dir:n,source:e.package}}if(e.path){let n=vj(t,...e.path.split("/"));if(e.integrity){let i=vK(n,e.integrity,e.path);if(!i.ok)return{problem:i.message}}return{dir:n,source:e.path}}return null}function Za(e,t){let n=[],i=[],r=new Map,o=new Set;return e.forEach((s,a)=>{let c=Oj(s,t);if(c===null)return;if("problem"in c){n.push({pin:a,message:c.problem});return}let{dir:l,source:u}=c,d=ike(l,u);for(let p of d.problems)n.push({pin:a,message:p});for(let p of d.kinds){let f=r.get(p.name);if(f){o.add(p.name),n.push({pin:a,message:`kind ${p.name} is supplied by both ${f} and ${u}; a kind name has one source`});continue}r.set(p.name,u),i.push(p)}}),{registry:u5(i.filter(s=>!o.has(s.name))),problems:n}}function m5(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 i;try{i=new RegExp(e.pattern,"u")}catch{return}if(!i.test(t))return`is ${JSON.stringify(t)}, which does not match ${e.pattern}`}}function ske(e){let t=[],n=(i,r)=>{if(r.pattern!==void 0)try{new RegExp(r.pattern,"u")}catch{t.push(`declares field ${i} with pattern ${r.pattern}, which is not a regular expression`);return}if(r.default===void 0)return;let o=m5(r,r.default);o&&t.push(`declares field ${i} whose default ${o}`)};for(let[i,r]of Object.entries(e))if(r.type==="object")for(let[o,s]of Object.entries(r.properties))n(`${i}.${o}`,s);else n(i,r);return t}function Aj(e,t){if(e===void 0)return{fields:null,problems:[]};let n=e.fields,i=[];if(n===void 0)return t!==null&&i.push({path:"",message:`kind ${e.name} declares no fields, and the entry sets ${Object.keys(t).join(", ")||"an empty fields block"}`}),{fields:null,problems:i};let r=t??{};for(let a of Object.keys(r))a in n||i.push({path:a,message:`kind ${e.name} declares no field ${a}; its fields are ${Object.keys(n).join(", ")}`});let o=(a,c,l)=>{if(l!==void 0){let u=m5(c,l);if(!u)return l;i.push({path:a,message:`field ${a.replace("/",".")} ${u}`})}return c.default??null},s={};for(let[a,c]of Object.entries(n)){if(c.type!=="object"){s[a]=o(a,c,r[a]);continue}let l=r[a],u={};l!==void 0&&(l!==null&&typeof l=="object"&&!Array.isArray(l)?u=l:i.push({path:a,message:`field ${a} is ${JSON.stringify(l)}, and the field is an object`}));for(let d of Object.keys(u))d in c.properties||i.push({path:`${a}/${d}`,message:`kind ${e.name} declares no field ${a}.${d}; ${a} has ${Object.keys(c.properties).join(", ")}`});s[a]=Object.fromEntries(Object.entries(c.properties).map(([d,p])=>[d,o(`${a}/${d}`,p,u[d])]))}return{fields:s,problems:i}}var _Ke,$j,wj,Cx,Bs,Kve,l5,Jve,Qve,Xve,Ox,Ai=v(()=>{"use strict";gK();jt();kK();zd();qg();Ex();_Ke=CI.$id,$j="./workspace-kinds",wj=["dbt-project","goose-dir","golang-migrate-dir","clickhouse-migrations-dir","flyway-dir"],Cx="examples",Bs="repo",Kve="design",l5=[{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:Bs,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:Kve,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:Cx,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"}],Jve=l5.map(e=>e.name);Qve=["chant.config.ts","chant.config.json"],Xve=4});function Fl(e){return String(e).replace(/~/g,"~0").replace(/\//g,"~1")}function Ya(e,t){let n=[0];for(let w=0;w<e.length;w++)e.charCodeAt(w)===10&&n.push(w+1);let i=w=>{let b=0,x=n.length-1;for(;b<x;){let $=b+x+1>>1;n[$]<=w?b=$:x=$-1}return{line:b+1,column:w-n[b]+1}},r=new Map,o=new Map,s=new Map,a=e.charCodeAt(0)===65279?1:0,c=(w,b=a)=>{throw new _x(w,b)},l=w=>w>=e.length?"the end of the file":`${JSON.stringify(e[w])}`;function u(){for(;;){let w=e[a];if(w===" "||w===" "||w===`
|
|
104
104
|
`||w==="\r")a++;else if(w==="/"&&(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]!==`
|
|
105
|
-
`;)a++;else{let b=e.indexOf("*/",a+2);b<0&&c("unterminated /* comment"),a=b+2}else return}}function d(){let w=a;for(a++;;){a>=e.length&&c("unterminated string",w);let b=e.charCodeAt(a);if(b===34)break;b<32&&c("control character in a string; escape it",a),a+=b===92?2:1}a++;try{return JSON.parse(e.slice(w,a))}catch{return c("invalid escape in a string",w)}}function p(w){u(),r.set(w,a);let b=f(w);return o.set(w,a),b}function f(w){let b=e[a];if(b==="{")return g(w);if(b==="[")return h(w);if(b==='"')return d();for(let[$,k]of[["true",!0],["false",!1],["null",null]])if(e.startsWith($,a))return a+=$.length,k;let x=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(e.slice(a,a+64));return x?(a+=x[0].length,Number(x[0])):c(`expected a value, found ${l(a)}`)}function g(w){let b={},x=new Set;if(a++,u(),e[a]==="}")return a++,b;for(;;){u(),e[a]!=='"'&&c(`expected a quoted key, found ${l(a)}`);let $=a,k=d();x.has(k)&&c(`duplicate key ${JSON.stringify(k)}`,$),x.add(k);let R=`${w}/${Fl(k)}`;if(s.set(R,$),u(),e[a]!==":"&&c(`expected ":" after key ${JSON.stringify(k)}, found ${l(a)}`),a++,Object.defineProperty(b,k,{value:p(R),enumerable:!0,writable:!0,configurable:!0}),u(),e[a]===","){if(a++,u(),e[a]==="}")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,b;continue}if(e[a]==="}")return a++,b;c(`expected "," or "}", found ${l(a)}`)}}function h(w){let b=[];if(a++,u(),e[a]==="]")return a++,b;for(;;){if(b.push(p(`${w}/${b.length}`)),u(),e[a]===","){if(a++,u(),e[a]==="]")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,b;continue}if(e[a]==="]")return a++,b;c(`expected "," or "]", found ${l(a)}`)}}try{u(),a>=e.length&&c("the file is empty");let w=p("");return u(),a<e.length&&c(`unexpected ${l(a)} after the value`),{ok:!0,value:w,locate(b,x){if(x&&s.has(b))return i(s.get(b));for(let $=b;;$=$.slice(0,$.lastIndexOf("/"))){let k=r.get($);if(k!==void 0)return i(k);if($==="")return i(0)}},span(b){let x=r.get(b),$=o.get(b);if(!(x===void 0||$===void 0))return{key:s.get(b)??null,start:x,end:$}}}}catch(w){if(!(w instanceof _x))throw w;return{ok:!1,message:w.message,location:i(w.offset)}}}var _x,lp=v(()=>{"use strict";_x=class extends Error{constructor(n,i){super(n);this.offset=i}}});function g5(){return"0.124.
|
|
105
|
+
`;)a++;else{let b=e.indexOf("*/",a+2);b<0&&c("unterminated /* comment"),a=b+2}else return}}function d(){let w=a;for(a++;;){a>=e.length&&c("unterminated string",w);let b=e.charCodeAt(a);if(b===34)break;b<32&&c("control character in a string; escape it",a),a+=b===92?2:1}a++;try{return JSON.parse(e.slice(w,a))}catch{return c("invalid escape in a string",w)}}function p(w){u(),r.set(w,a);let b=f(w);return o.set(w,a),b}function f(w){let b=e[a];if(b==="{")return g(w);if(b==="[")return h(w);if(b==='"')return d();for(let[$,k]of[["true",!0],["false",!1],["null",null]])if(e.startsWith($,a))return a+=$.length,k;let x=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(e.slice(a,a+64));return x?(a+=x[0].length,Number(x[0])):c(`expected a value, found ${l(a)}`)}function g(w){let b={},x=new Set;if(a++,u(),e[a]==="}")return a++,b;for(;;){u(),e[a]!=='"'&&c(`expected a quoted key, found ${l(a)}`);let $=a,k=d();x.has(k)&&c(`duplicate key ${JSON.stringify(k)}`,$),x.add(k);let R=`${w}/${Fl(k)}`;if(s.set(R,$),u(),e[a]!==":"&&c(`expected ":" after key ${JSON.stringify(k)}, found ${l(a)}`),a++,Object.defineProperty(b,k,{value:p(R),enumerable:!0,writable:!0,configurable:!0}),u(),e[a]===","){if(a++,u(),e[a]==="}")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,b;continue}if(e[a]==="}")return a++,b;c(`expected "," or "}", found ${l(a)}`)}}function h(w){let b=[];if(a++,u(),e[a]==="]")return a++,b;for(;;){if(b.push(p(`${w}/${b.length}`)),u(),e[a]===","){if(a++,u(),e[a]==="]")return t.jsonc||c("trailing comma; only chant.workspace.jsonc allows one"),a++,b;continue}if(e[a]==="]")return a++,b;c(`expected "," or "]", found ${l(a)}`)}}try{u(),a>=e.length&&c("the file is empty");let w=p("");return u(),a<e.length&&c(`unexpected ${l(a)} after the value`),{ok:!0,value:w,locate(b,x){if(x&&s.has(b))return i(s.get(b));for(let $=b;;$=$.slice(0,$.lastIndexOf("/"))){let k=r.get($);if(k!==void 0)return i(k);if($==="")return i(0)}},span(b){let x=r.get(b),$=o.get(b);if(!(x===void 0||$===void 0))return{key:s.get(b)??null,start:x,end:$}}}}catch(w){if(!(w instanceof _x))throw w;return{ok:!1,message:w.message,location:i(w.offset)}}}var _x,lp=v(()=>{"use strict";_x=class extends Error{constructor(n,i){super(n);this.offset=i}}});function g5(){return"0.124.51"}var h5=v(()=>{"use strict"});function up(e=process.env){let t=e.CI?.trim().toLowerCase();return t&&t!=="false"&&t!=="0"?"ledger":void 0}function Ix(e){if(e!==void 0)return typeof e=="string"?{name:e}:e}function Gl(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 i=typeof e=="string"?{name:e}:e;if(i===null||typeof i!="object"||Array.isArray(i))return[...n,"`point` is a decision point's name or { name, inputs?, pass?, store? }"];let{name:r,inputs:o,pass:s,store:a,...c}=i;if((typeof r!="string"||!ake.test(r))&&n.push("`point.name` is a decision point's name: lower case letters, digits and hyphens, starting with a letter"),o!==void 0&&(o===null||typeof o!="object"||Array.isArray(o))&&n.push("`point.inputs` is an object of input name to value"),o&&typeof o=="object"){let u=Object.keys(o).filter(d=>d in Zg);u.length>0&&n.push(`\`point.inputs\` gives ${u.join(", ")}, which the gate passes itself`)}s!==void 0&&(!Array.isArray(s)||s.length===0||s.some(u=>typeof u!="string"&&typeof u!="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 Wl(e,t,n,i={}){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 r={};for(let[o,s]of Object.entries(Zg))t.includes(o)&&n[s]!==null&&(r[o]=n[s]);return{...i,...r}}function Yg(e,t,n){return`gate:${e}/${t}${n?`@${n}`:""}`}function Tx(e){if(!e||!e.startsWith("gate:"))return;let t=e.slice(5),n=t.lastIndexOf("@"),i=n>0?t.slice(0,n):t,r=i.indexOf("/");if(!(r<=0||r===i.length-1))return{op:i.slice(0,r),gate:i.slice(r+1),...n>0?{env:t.slice(n+1)}:{}}}var dp,ake,Zg,Us=v(()=>{"use strict";dp=[!0];ake=/^[a-z][a-z0-9-]*$/;Zg={"gate.component":"component","gate.name":"name","gate.env":"env","gate.planDigest":"planDigest"}});function Pi(e){return e===void 0?[]:Array.isArray(e)?[...e]:[e]}function Pj(e,t){let n=e.replace(/\\/g,"/").replace(/\/+$/,""),i="";for(let r=0;r<n.length;r++){let o=n[r];o==="*"&&n[r+1]==="*"?n[r+2]==="/"?(i+="(?:.*/)?",r+=2):(i+=".*",r+=1):o==="*"?i+="[^/]*":o==="?"?i+="[^/]":i+=o.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${i}$`).test(t.replace(/\\/g,"/").replace(/\/+$/,""))}function pp(e,t){return e.filter(n=>n.targets===void 0||n.targets.some(i=>t.some(r=>Pj(i,r))))}function Xg(e){return e.reduce((t,n)=>Math.max(t,n.count),1)}function Ci(e,t,n){let i=Array.isArray(e)?e:[e],r=[];return Array.isArray(e)&&e.length===0&&r.push(`\`${t}\` must name at least one rule`),i.forEach((o,s)=>{let a=Array.isArray(e)?`${t}[${s}]`:t;if(typeof o!="object"||o===null||Array.isArray(o)){r.push(`\`${a}\` must be an object`);return}let c=o;(typeof c.count!="number"||!Number.isInteger(c.count)||c.count<1)&&r.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(u=>typeof u!="string"||u===""))&&r.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(u=>typeof u!="string"||u===""))&&r.push(`\`${a}.targets\` must be a non-empty list of globs`),c.notAuthor!==void 0&&typeof c.notAuthor!="boolean"&&r.push(`\`${a}.notAuthor\` must be true or false`),c.notAuthor===!0&&!n.notAuthor&&r.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 u of Object.keys(c))l.has(u)||r.push(`\`${a}.${u}\` is not a quorum field; use targets, count, roles or notAuthor`)}),r}function jx(e,t){return Object.entries(t).filter(([,n])=>n.some(i=>ri(i,e))).map(([n])=>n).sort()}function eh(e,t){let n=new Set,i=[];for(let s of[...t].sort((a,c)=>Date.parse(a.at)-Date.parse(c.at)))n.has(Dx(s.who))||s.judged.excluded!==void 0||e.roles?.length&&!(s.judged.proven&&s.judged.roles.some(a=>e.roles.includes(a)))||(n.add(Dx(s.who)),i.push(s));let r=!e.notAuthor||i.some(s=>s.judged.proven&&s.judged.author===!1),o=e.notAuthor===!0&&!r&&i.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:i.map(s=>s.who),met:i.length>=e.count&&r,...o?{authorUnknown:!0}:{}}}function Qa(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 i=e.count-e.approvers.length,r=[];i>0&&r.push(`${i} more${e.roles?.length?` from ${e.roles.join(" or ")}`:""}`),e.notAuthor&&r.push(i>0?"one of them not the author":"an approver who is not the author");let o=e.authorUnknown?" (the change's author is not known, so no approver can show they are someone else)":"";return`${t}: ${n}, needs ${r.join(", ")}${o}`}function th(e){return e.filter(t=>!t.met).map(Qa).join("; ")}function Nx(e){let t=[];for(let n of e.replace(/\r\n/g,`
|
|
106
106
|
`).split(`
|
|
107
107
|
`)){let i=/^requested-by:\s*(\S+)\s*$/i.exec(n.trim());i&&cke.test(i[1])&&!t.some(r=>ri(r,i[1]))&&t.push(i[1])}return t}function Qg(e){let t=/^(?:github|gitlab|forgejo|gitea|codeberg)(?:@[^:\s]+)?:(.+)$/i.exec(e.trim());return t?[e,t[1]]:[e]}function Lx(e,t){let n=Qg(t);return e.find(i=>Qg(i.who).some(r=>n.some(o=>ri(r,o))))?.why}function nh(e){let t=[],n=(i,r)=>{i.trim()&&!t.some(o=>ri(o.who,i))&&t.push({who:i,why:r})};e.author&&n(e.author,`${e.author} opened the change`);for(let i of e.commits??[])for(let r of Nx(i.message))n(e.principal?e.principal(r):r,`${r} asked for ${i.sha.slice(0,7)}`);for(let i of e.agents??[])n(i,`${i} is an account an agent acts as`);return t}function Mx(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 rh(e,t=n=>n){let n=[],i=[];for(let r of e){let o=Mx(r);if(!o){n.push(r);continue}let s=o.reviewers.map(t);i.push({head:o.head,approvers:s});let{seal:a,...c}=r,l=Object.fromEntries(Object.entries(c).filter(([u])=>!["via","reviewers","head","pr","excluded"].includes(u)));for(let u of s)n.push({...l,resolvedBy:u,approver:{kind:"human"},review:{pr:o.pr??0,head:o.head,approvers:s}})}return{records:n,reviews:i}}function _i(e){let t=(n,i)=>n.some(r=>ri(r,i));return n=>{let i=n.seal!==void 0&&n.seal!==null&&zo(e.signers,n)===null,r=e.review!==void 0&&n.review?.head===e.review.head&&t(e.review.approvers,n.resolvedBy),o=n.review!==void 0&&(e.recorded??[]).some(l=>l.head===n.review.head&&t(l.approvers,n.resolvedBy)),s=i||r||o,c=e.authors!==void 0&&e.authors.some(l=>ri(l,n.resolvedBy))?`${n.resolvedBy} wrote the change`:Lx(e.involved??[],n.resolvedBy);return{proven:s,roles:s?jx(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 zs,Dx,ri,Vs,cke,ii=v(()=>{"use strict";js();zs=()=>({proven:!1,roles:[]});Dx=e=>e.normalize("NFKC").trim().toLowerCase(),ri=(e,t)=>Dx(e)===Dx(t);Vs=e=>(e.roles?.length??0)>0||e.notAuthor===!0,cke=/^[A-Za-z0-9][A-Za-z0-9._-]*(\[bot\])?$/});function Cj(e,t,n){return(e??Fx).replaceAll("{gate}",t).replaceAll("{k}",String(n))}function _j(e,t,n,i){let r=[...e].sort((l,u)=>{let d=i(l),p=i(u);return d<p?-1:d>p?1:0}),o=Math.floor(r.length/n),s=r.length%n,a=(t-1)*o+Math.min(t-1,s),c=o+(t<=s?1:0);return r.slice(a,a+c)}var Fx,Ij=v(()=>{"use strict";Fx="{gate}-wave-{k}"});import{existsSync as lke,readdirSync as uke,readFileSync as y5,statSync as dke,writeFileSync as pke}from"node:fs";import{basename as fke,join as w5}from"node:path";function Dj(e){return e!==void 0&&mke.has(e.status)}function b5(e,t,n,i,r){if(r!==void 0)return new Map(e.map(s=>[s,`wave-${r}`]));let o=new Map;for(let s of e){let a=[...t.get(s)??[]].filter(c=>n.has(c)).sort().map(c=>{let l=i.get(c);if(!Dj(l))return l?.status==="blocked"&&l.by?l.by:c}).find(c=>c!==void 0);a!==void 0&&o.set(s,a)}return o}function jj(e){let t=new Map;for(let[n,i]of[...e].sort(v5))t.set(i,[...t.get(i)??[],n]);return[...t].map(([n,i])=>`${i.join(", ")} (blocked by ${n})`).join("; ")}function Gx(e,t={}){let n=t.group!==void 0?`-group-${t.group.replace(/[^A-Za-z0-9._-]/g,"_")}`:"",i=t.share!==void 0?`-share-${t.share}`:"";return`outcome-wave-${e}${n}${i}.json`}function k5(e,t,n,i,r=new Date().toISOString(),o=!1){let s=w5(e,Gx(t,n)),a={version:Tj,wave:t,at:r,members:Object.fromEntries(Object.entries(i).sort(v5)),...o?{holds_all:!0}:{}};return pke(s,JSON.stringify(a,null,2)+`
|
|
108
108
|
`),s}function x5(e){let t=[],n=(i,r)=>{let o;try{o=uke(i)}catch{return}for(let s of o){let a=w5(i,s),c=!1;try{c=dke(a).isDirectory()}catch{continue}c?r<4&&n(a,r+1):/^outcome-wave-\d+.*\.json$/.test(s)&&t.push(a)}};for(let i of e)lke(i)&&n(i,0);return t.sort()}function $5(e,t){let n=new Map,i=new Map;for(let o of x5(e)){let s;try{s=JSON.parse(y5(o,"utf-8"))}catch{continue}let a=s?.members??s?.roots;if(s?.version!==Tj||!Number.isInteger(s.wave)||s.wave>=t||typeof s.at!="string"||typeof a!="object"||a===null)continue;for(let[l,u]of Object.entries(a)){let d=n.get(l);d&&(d.at>s.at||d.at===s.at&&u.status==="decided"&&d.status!=="decided")||n.set(l,{...u,wave:s.wave,at:s.at})}let c=i.get(s.wave);(!c||c.at<=s.at)&&i.set(s.wave,{at:s.at,holdsAll:s.holds_all===!0})}let r=[...i].filter(([,o])=>o.holdsAll).map(([o])=>o).sort((o,s)=>o-s);return{members:n,...r.length?{holdsAll:r[0]}:{}}}function R5(e,t){let n;for(let i of x5(e)){if(fke(i)!==t)continue;let r;try{r=JSON.parse(y5(i,"utf-8"))}catch{continue}r?.version!==Tj||typeof r.at!="string"||typeof r.members!="object"||r.members===null||(!n||n.at<=r.at)&&(n=r)}return n}var Tj,mke,v5,Nj=v(()=>{"use strict";Tj=1,mke=new Set(["applied","unchanged"]);v5=([e],[t])=>e<t?-1:e>t?1:0});function gke(e){if(e!==void 0)return typeof e=="string"?{name:e}:e}function Wx(e){if(e!==null&&typeof e=="object"&&!Array.isArray(e)&&"timeout"in e){let{timeout:t,...n}=e,i=Gl(n);return(typeof t!="string"||!/^(\d+(ms|s|m|h|d))+$/.test(t))&&i.push('`point.timeout` is a duration such as "48h"'),i}return Gl(e)}function Gj(e,t){let n=e.waves.find(i=>i.name===t);return gke(n?.point??e.point)}function Wj(e,t){return Cj(e.gateName,e.gate??e.name,t)}function Uj(e){if(e===null||typeof e!="object"||Array.isArray(e))return['`approvals.involved` must be { "agents"?: [...], "exclude"?: true | false }'];let t=[];for(let[n,i]of Object.entries(e))n==="agents"?(!Array.isArray(i)||i.length===0||i.some(r=>typeof r!="string"||r.trim()===""))&&t.push("`approvals.involved.agents` must be a non-empty list of principals or logins"):n==="exclude"?typeof i!="boolean"&&t.push("`approvals.involved.exclude` must be true or false"):t.push(`\`approvals.involved.${n}\` is not a setting; use agents or exclude`);return t}function Ux(e,t){return`.chant/op-waves/${e.name}/wave-${t}.json`}function O5(e){return`.chant/op-waves/${e.name}/outcomes`}function sh(e){let t=`Op waves "${e.name}"`;if(!Mj.test(e.name))throw new Error(`${t}: the name must be lowercase letters, digits, "-" and "_"`);if(!e.op)throw new Error(`${t} names no \`op\`. Name the Op a run runs when it names none.`);if(e.plan!==void 0&&e.planWave!==void 0)throw new Error(`${t} has both \`plan\` and \`planWave\`. A wave is planned one run at a time or all at once; give one.`);if(e.apply!==void 0&&e.applyWave!==void 0)throw new Error(`${t} has both \`apply\` and \`applyWave\`. A wave is applied one run at a time or all at once; give one.`);if(e.planWave!==void 0){if(ih(t,"planWave",e.planWave),!e.planWave.some(i=>i.includes("{plans}")))throw new Error(`${t}: the \`planWave\` command never names {plans}, the file it writes each run's plan digest to.`)}else{if(!Array.isArray(e.plan)||e.plan.length===0)throw new Error(`${t} has no \`plan\` command. Each wave plans its runs to bind its gate to their plan digests; give \`plan\` or \`planWave\`.`);if(ih(t,"plan",e.plan),!e.plan.some(i=>i.includes("{plan}")))throw new Error(`${t}: the \`plan\` command never names {plan}, the file it writes the plan digest to.`)}if(e.apply!==void 0&&ih(t,"apply",e.apply),e.applyWave!==void 0&&(ih(t,"applyWave",e.applyWave),!e.applyWave.some(i=>i.includes("{runs}"))))throw new Error(`${t}: the \`applyWave\` command never names {runs}, the file listing the approved runs it applies.`);if(Bl(t,e.hooks),e.waves.length===0)throw new Error(`${t} has no waves.`);if(e.resume!==void 0&&(typeof e.resume.schedule!="string"||e.resume.schedule.trim().split(/\s+/).length!==5))throw new Error(`${t}: resume.schedule must be a five-field cron expression, such as "*/10 * * * *".`);if(e.approvals!==void 0){let i=e.approvals;if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${t}: \`approvals\` must be { "spend"?: true | false, "quorum"?: [...], "reviewLedger"?: "<op>", "involved"?: {...} }.`);for(let[r,o]of Object.entries(i)){if(r==="quorum"){if(!Array.isArray(o))throw new Error(`${t}: approvals.quorum must be a list of rules, each { "targets"?, "count", "roles"?, "notAuthor"? }.`);let s=Ci(o,"approvals.quorum",{notAuthor:!0});if(s.length>0)throw new Error(`${t}: ${s.join("; ")}.`);continue}if(r==="reviewLedger"){if(typeof o!="string"||!Bj.test(o))throw new Error(`${t}: approvals.reviewLedger must name an op, such as "tf-apply": letters, digits, dot, dash and underscore.`);continue}if(r==="involved"){let s=Uj(o);if(s.length>0)throw new Error(`${t}: ${s.join("; ")}.`);continue}if(r!=="spend")throw new Error(`${t}: approvals.${r} is not a setting; the ones there are approvals.spend, approvals.quorum, approvals.reviewLedger and approvals.involved.`);if(typeof o!="boolean")throw new Error(`${t}: approvals.spend must be true or false.`)}if(i.quorum?.length&&(e.point!==void 0||e.waves.some(r=>r.point!==void 0)))throw new Error(`${t}: approvals.quorum and a decision point are both set; a gate that asks a point takes its deciders and quorum from the point, so drop one of them.`)}if(e.gateName!==void 0){if(typeof e.gateName!="string"||!e.gateName.includes("{k}")||/\s/.test(e.gateName))throw new Error(`${t}: gateName must be a pattern with {k}, the wave's number, and no spaces, such as "${E5}" or "wave-{k}".`);let i=e.gateName.replaceAll("{gate}","").replaceAll("{k}","").match(/\{[^}]*\}/);if(i)throw new Error(`${t}: gateName names ${i[0]}; the pattern fills in {gate} and {k} only.`)}if(e.digest!==void 0){let i=e.digest;if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${t}: \`digest\` must be { "over"?: "all" | "changing" }.`);for(let[r,o]of Object.entries(i)){if(r!=="over")throw new Error(`${t}: digest.${r} is not a setting; the one there is digest.over.`);if(!hke.includes(o))throw new Error(`${t}: digest.over is ${JSON.stringify(o)}; use "all" or "changing".`)}}if(e.override!==void 0){let i=e.override;if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${t}: \`override\` must be { "overriders"?: "<file at base>" }.`);for(let[r,o]of Object.entries(i)){if(r!=="overriders")throw new Error(`${t}: override.${r} is not a setting; the one there is override.overriders.`);if(typeof o!="string"||o.trim()==="")throw new Error(`${t}: override.overriders must be a path, such as ".chant/overriders".`)}}if(e.point!==void 0){let i=Wx(e.point);if(i.length>0)throw new Error(`${t}: ${i.join("; ")}.`)}if(e.neverOverMcp!==void 0&&typeof e.neverOverMcp!="boolean")throw new Error(`${t}: neverOverMcp must be true or false.`);if(e.runner!==void 0&&Fj(t,"runner",e.runner),e.notify!==void 0){let i=Tk(e.notify,"notify");if(i)throw new Error(`${t}: ${i}`)}let n=new Set;for(let i of e.waves){if(!Mj.test(i.name))throw new Error(`${t}: wave "${i.name}" must be named with lowercase letters, digits, "-" and "_"`);if(n.has(i.name))throw new Error(`${t} names wave "${i.name}" twice.`);if(n.add(i.name),i.gate!==void 0&&!oh.includes(i.gate))throw new Error(`${t}: wave "${i.name}" has gate "${i.gate}"; use ${oh.join(", ")}.`);if(i.approval!==void 0&&!Xa.includes(i.approval))throw new Error(`${t}: wave "${i.name}" has approval "${i.approval}"; use ${Xa.join(", ")}.`);if(Bl(`${t}, wave "${i.name}"`,i.hooks),i.point!==void 0){let s=Wx(i.point);if(s.length>0)throw new Error(`${t}: wave "${i.name}": ${s.join("; ")}.`)}if(i.runner!==void 0&&Fj(t,`wave "${i.name}" runner`,i.runner),i.idTokens!==void 0&&P5(t,`wave "${i.name}" idTokens`,i.idTokens),i.cloud!==void 0&&A5(t,`wave "${i.name}" cloud`,i.cloud),i.jobs!==void 0&&vke(t,i),i.discover!==void 0&&typeof i.discover!="boolean")throw new Error(`${t}: wave "${i.name}" has discover ${JSON.stringify(i.discover)}; use true or false.`);if(i.rest!==void 0&&typeof i.rest!="boolean")throw new Error(`${t}: wave "${i.name}" has rest ${JSON.stringify(i.rest)}; use true or false.`);if(i.discover){if(e.planWave===void 0)throw new Error(`${t}: wave "${i.name}" discovers its runs, which only \`planWave\` can report. Give planWave.`);if((i.runs??[]).length>0)throw new Error(`${t}: wave "${i.name}" discovers its runs, so it lists none.`)}if(i.rest){if(!i.discover)throw new Error(`${t}: wave "${i.name}" has rest, which follows the waves planWave discovers; set discover too.`);if(i!==e.waves[e.waves.length-1])throw new Error(`${t}: wave "${i.name}" has rest, which only the last wave can have.`);if((i.shares??1)>1)throw new Error(`${t}: wave "${i.name}" has rest and shares; the waves after it run in its one job, so it cannot be split.`)}if(i.discover){let s=i.shares??1;if(!Number.isInteger(s)||s<1)throw new Error(`${t}: wave "${i.name}" has shares ${i.shares}; use a whole number from 1.`);continue}if(!Array.isArray(i.runs)||i.runs.length===0)throw new Error(`${t}: wave "${i.name}" has no runs.`);let r=new Set;for(let s of i.runs){if(!s.target)throw new Error(`${t}: wave "${i.name}" has a run with no target.`);if(r.has(s.target))throw new Error(`${t}: wave "${i.name}" names target "${s.target}" twice.`);r.add(s.target)}let o=i.shares??1;if(!Number.isInteger(o)||o<1)throw new Error(`${t}: wave "${i.name}" has shares ${i.shares}; use a whole number from 1.`);if(o>i.runs.length)throw new Error(`${t}: wave "${i.name}" has ${o} shares for ${i.runs.length} runs, so a share would apply nothing.`);if(i.jobs!==void 0){let s=Kj(i,i.runs.map(a=>a.target));if(s)throw new Error(`${t}: ${s}.`)}}yke(t,e)}function yke(e,t){let n=new Set,i=!1;for(let r of t.waves){let o=new Set;for(let s of r.runs??[]){let a=s.dependsOn;if(a!==void 0){let c=`wave "${r.name}" run "${s.target}"`;if(!Array.isArray(a)||!a.every(l=>typeof l=="string"&&l!==""))throw new Error(`${e}: ${c} dependsOn must be a list of targets.`);for(let l of a){if(l===s.target&&!n.has(l))throw new Error(`${e}: ${c} depends on itself.`);if(o.has(l)){if((r.shares??1)>1||r.jobs!==void 0)throw new Error(`${e}: ${c} depends on "${l}" in its own wave, which ${r.jobs?"job groups":"shares"} apply in separate jobs; move one of them to another wave.`);continue}if(!n.has(l)&&!i)throw new Error(`${e}: ${c} depends on "${l}", which is no run of an earlier wave or listed before it in its own.`)}}o.add(s.target)}for(let s of o)n.add(s);r.discover&&(i=!0)}}function A5(e,t,n){if(n===null||typeof n!="object"||Array.isArray(n)||Object.keys(n).length===0)throw new Error(`${e}: ${t} must name one or more of aws, gcp and azure.`);for(let[i,r]of Object.entries(n)){let o=bke[i];if(!o)throw new Error(`${e}: ${t}.${i} is not a cloud; use aws, gcp or azure.`);let s=r,a=s?.targets,c=a===void 0||Array.isArray(a)&&a.every(l=>l&&Array.isArray(l.targets)&&typeof l[o]=="string");if(!s||typeof s.audience!="string"||!c||typeof s[o]!="string"&&!(Array.isArray(a)&&a.length>0))throw new Error(`${e}: ${t}.${i} must give an audience and a ${o}, or targets each with targets and a ${o}, as cloudIdentityWave gives them.`)}}function Fj(e,t,n){let i=r=>Array.isArray(r)&&r.length>0&&r.every(o=>typeof o=="string"&&o.trim()!=="");if(!(typeof n=="string"&&n.trim()!=="")&&!i(n)){if(n!==null&&typeof n=="object"&&!Array.isArray(n)){let{group:r,labels:o,...s}=n,a=Object.keys(s)[0];if(a!==void 0)throw new Error(`${e}: ${t}.${a} is not a setting; a runner group is { "group": "<name>", "labels"?: [...] }.`);if(typeof r=="string"&&r.trim()!==""&&(o===void 0||i(o)))return}throw new Error(`${e}: ${t} must be a runner label, a non-empty list of labels, or { "group": "<name>", "labels"?: [...] } (GitHub only).`)}}function P5(e,t,n){if(n===null||typeof n!="object"||Array.isArray(n)||Object.keys(n).length===0)throw new Error(`${e}: ${t} must be { "<variable>": "<audience>" }, with at least one token.`);for(let[i,r]of Object.entries(n)){if(!wke.test(i))throw new Error(`${e}: ${t} names "${i}", which is not a variable name (letters, digits and "_", not starting with a digit).`);if(typeof r!="string"||r.trim()==="")throw new Error(`${e}: ${t}.${i} must be an audience, a non-empty string.`)}}function vke(e,t){let n=`wave "${t.name}"`;if(!Array.isArray(t.jobs)||t.jobs.length===0)throw new Error(`${e}: ${n} jobs must be a non-empty list of job groups.`);if((t.shares??1)>1)throw new Error(`${e}: ${n} has jobs and shares; split each job group with its own shares.`);if(t.rest)throw new Error(`${e}: ${n} has jobs and rest; the waves after it run in its one job, so its apply cannot be split into groups.`);let i=new Set;t.jobs.forEach((r,o)=>{if(r===null||typeof r!="object")throw new Error(`${e}: ${n} jobs[${o}] must be { "name", "runs", ... }.`);let s=`${n} jobs[${o}]${typeof r.name=="string"?` (${r.name})`:""}`;if(typeof r.name!="string"||!Mj.test(r.name))throw new Error(`${e}: ${s} must be named with lowercase letters, digits, "-" and "_".`);if(r.name==="decide"||/^share-\d+$/.test(r.name))throw new Error(`${e}: ${s} is named like the wave's own jobs (decide, share-<i>); name it another way.`);if(i.has(r.name))throw new Error(`${e}: ${n} names job group "${r.name}" twice.`);i.add(r.name);let a=new Set(["name","runs","shares","runner","environment","variables","setup","idTokens","cloud"]),c=Object.keys(r).find(u=>!a.has(u));if(c!==void 0)throw new Error(`${e}: ${s}.${c} is not a setting; a job group takes ${[...a].join(", ")}.`);if(!Array.isArray(r.runs)||r.runs.length===0||!r.runs.every(u=>typeof u=="string"&&u.trim()!==""))throw new Error(`${e}: ${s} runs must be a non-empty list of targets or patterns.`);let l=r.shares??1;if(!Number.isInteger(l)||l<1)throw new Error(`${e}: ${s} has shares ${r.shares}; use a whole number from 1.`);if(r.runner!==void 0&&Fj(e,`${s} runner`,r.runner),r.idTokens!==void 0&&P5(e,`${s} idTokens`,r.idTokens),r.cloud!==void 0&&A5(e,`${s} cloud`,r.cloud),r.variables!==void 0&&(r.variables===null||typeof r.variables!="object"||Array.isArray(r.variables)||!Object.values(r.variables).every(u=>typeof u=="string")))throw new Error(`${e}: ${s} variables must be { "<name>": "<value>" }.`);if(r.setup!==void 0&&!Array.isArray(r.setup))throw new Error(`${e}: ${s} setup must be a list of steps.`);if(r.environment!==void 0&&(r.environment===null||typeof r.environment!="object"||typeof r.environment.name!="string"))throw new Error(`${e}: ${s} environment must be { "name", "url"? }.`)})}function Vj(e,t){if(!e.includes("*"))return e===t;let n="";for(let i=0;i<e.length;i++){let r=e[i];r==="*"&&e[i+1]==="*"?(n+=".*",i++):r==="*"?n+="[^/]*":n+=r.replace(/[.+?^${}()|[\]\\]/g,"\\$&")}return new RegExp(`^${n}$`).test(t)}function qj(e,t){return e.targets?t.filter(n=>e.targets.some(i=>Vj(i,n.target))):[...t]}function Hj(e,t){return t.filter(n=>e.runs.some(i=>Vj(i,n.target)))}function Kj(e,t){for(let n of t){let i=(e.jobs??[]).filter(r=>r.runs.some(o=>Vj(o,n))).map(r=>`"${r.name}"`);if(i.length>1)return`wave "${e.name}" jobs: run "${n}" is in job groups ${i.join(" and ")}; each run is in exactly one`;if(i.length===0)return`wave "${e.name}" jobs: run "${n}" is in no job group; each run is in exactly one`}}function ih(e,t,n){if(!Array.isArray(n)||n.length===0||!n.every(i=>typeof i=="string")||n[0]==="")throw new Error(`${e}: \`${t}\` must be a command as argv, a non-empty array of strings.`)}function Bl(e,t){if(t!==void 0){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e}: \`hooks\` must be { "before"?: { "observe"?, "plan"?, "apply"? }, "after"?: { "plan"?, "gate"?, "apply"? } }.`);for(let[n,i]of Object.entries(t)){if(n==="apply"){let r=i?.runBy;if(i===null||typeof i!="object"||Array.isArray(i)||Object.keys(i).some(o=>o!=="runBy"))throw new Error(`${e}: hooks.apply must be { "runBy"?: "chant" | "apply" }.`);if(r!==void 0&&!Lj.includes(r))throw new Error(`${e}: hooks.apply.runBy is ${JSON.stringify(r)}; use ${Lj.map(o=>`"${o}"`).join(" or ")}.`);continue}if(n!=="before"&&n!=="after")throw new Error(`${e}: hooks.${n} is not a moment; use hooks.before or hooks.after (or hooks.apply.runBy).`);if(i===null||typeof i!="object"||Array.isArray(i))throw new Error(`${e}: hooks.${n} must be { "plan"?: [...], "apply"?: [...] }.`);for(let[r,o]of Object.entries(i)){let s=`hooks.${n}.${r}`;if(r==="gate"&&n==="before")throw new Error(`${e}: ${s} is not a moment; a hook runs after the gate (hooks.after.gate), or before the plan or the apply.`);if(r==="observe"&&n==="after")throw new Error(`${e}: ${s} is not a moment; a hook runs before the observe (hooks.before.observe), or after the plan, which reads what the observe saw.`);if(r!=="observe"&&r!=="plan"&&r!=="apply"&&r!=="gate")throw new Error(`${e}: ${s} is not a stage; a hook runs before the observe, before or after plan or apply, or after the gate.`);if(!Array.isArray(o))throw new Error(`${e}: ${s} must be a list of hooks.`);o.forEach((a,c)=>{let l=`${s}[${c}]${a&&typeof a=="object"&&typeof a.name=="string"?` (${a.name})`:""}`;if(!a||typeof a!="object")throw new Error(`${e}: ${l} must be { "command": [...], "onFailure"?, "perRun"? }.`);if(ih(e,`${l}.command`,a.command),a.onFailure!==void 0&&!S5.includes(a.onFailure))throw new Error(`${e}: ${l} has onFailure "${a.onFailure}"; use ${S5.join(" or ")}.`);if(a.onFailure==="approve"&&n==="after"&&r==="apply")throw new Error(`${e}: ${l} has onFailure "approve", but after the apply there is nothing left to hold. Use "fail".`);if(a.onFailure==="approve"&&r==="gate")throw new Error(`${e}: ${l} has onFailure "approve", but the gate has already decided when it runs. Use "fail", or hold the wave from an after.plan hook.`);if(a.perRun!==void 0&&typeof a.perRun!="boolean")throw new Error(`${e}: ${l}.perRun must be true or false.`);if(a.targets!==void 0&&(!Array.isArray(a.targets)||a.targets.length===0||!a.targets.every(u=>typeof u=="string"&&u!=="")))throw new Error(`${e}: ${l}.targets must be a non-empty list of targets or patterns, such as ["prod/*"].`);if(a.perRun){if(n==="before"&&(r==="plan"||r==="observe")&&a.command.some(u=>u.includes("{plan}")))throw new Error(`${e}: ${l} runs before the plan, so it has no {plan} yet.`)}else{let u=a.command.find(d=>d.includes("{target}")||d.includes("{plan}"));if(u)throw new Error(`${e}: ${l} runs once for the wave, so it has no {target} or {plan} ("${u}"). Set "perRun": true, or read the runs from {runs}.`)}})}}}}function Jj(e,t){if(Bl(e,t),t?.apply!==void 0)throw new Error(`${e}: hooks.apply.runBy is for an Op waves spec; chant runs a pull request's apply, so it runs the apply-stage hooks itself.`)}function zx(e,t){let n=e.waves.find(r=>r.name===t),i=(r,o)=>{let[s,a]=o.split("-");return r?.[s]?.[a]??[]};return Object.fromEntries(Bx.map(r=>[r,[...i(e.hooks,r),...i(n?.hooks,r)]]))}function Vx(e,t){return e.waves.find(i=>i.name===t)?.hooks?.apply?.runBy??e.hooks?.apply?.runBy??"chant"}function qx(e,t,n){return _j(e,t,n,i=>i.target)}var oh,Xa,S5,Bx,Lj,hke,E5,Bj,zj,Mj,wke,bke,ec=v(()=>{"use strict";Us();ii();Dk();Ij();Nj();Dk();oh=["always","on-destructive","never"],Xa=["ledger","pr-review","sealed"];S5=["fail","approve"],Bx=["before-observe","before-plan","after-plan","after-gate","before-apply","after-apply"],Lj=["chant","apply"],hke=["all","changing"],E5=Fx;Bj=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;zj=["chant","run","{op}","--env","{target}"];Mj=/^[a-z0-9][a-z0-9_-]*$/;wke=/^[A-Za-z_][A-Za-z0-9_]*$/,bke={aws:"role",gcp:"serviceAccount",azure:"clientId"}});var ah,ch=v(()=>{"use strict";ah="plan"});import{createHash as kke}from"node:crypto";function C5(e){return typeof e=="object"&&e!==null&&e[xke]===!0}function Hx(e){return`sha256:${kke("sha256").update(e).digest("hex")}`}function Kx(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.kind==="gate-policy"&&typeof t.lexicon=="string"&&t.lexicon!==""&&typeof t.name=="string"&&t.name!==""&&typeof t.version=="string"&&t.version!==""&&typeof t.text=="string"&&t.text.trim()!==""}function uh(e,t){let n=[];if(e.policy!==void 0&&(Kx(e.policy)?e.policy.version!==Hx(e.policy.text)&&n.push(`\`${t}.policy\` "${e.policy.name}" has a version that is not the digest of its text`):n.push(`\`${t}.policy\` does not resolve to a gate policy set: it needs kind "gate-policy", lexicon, name, version and text`)),e.mode!==void 0&&!lh.includes(e.mode)&&n.push(`\`${t}.mode\` must be one of ${lh.map(i=>`"${i}"`).join(", ")}`),e.context!==void 0)if(typeof e.context!="object"||e.context===null||Array.isArray(e.context))n.push(`\`${t}.context\` must be an object of plan attributes`);else for(let[i,r]of Object.entries(e.context))i===ah?n.push(`\`${t}.context.${i}\` is reserved: the run fills it with the plan's change-set summary (#3182)`):(C5(r)||!_5(r))&&n.push(`\`${t}.context.${i}\` must be a string, number, boolean or list of strings`);return n}function _5(e){return typeof e=="string"||typeof e=="boolean"?!0:typeof e=="number"?Number.isFinite(e):Array.isArray(e)?e.every(t=>typeof t=="string"):C5(e)}var lh,xke,Jx=v(()=>{"use strict";ch();lh=["log-only","enforce"],xke=Symbol.for("chant.op.stepOutputRef")});import{createHash as $ke}from"node:crypto";function dh(e){return`sha256:${$ke("sha256").update(JSON.stringify(e??{},Rke)).digest("hex")}`}function Rke(e,t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([n],[i])=>n<i?-1:n>i?1:0)):t}async function Zj(e){let t=_s(e)??`@intentius/chant-lexicon-${e}/gate-policy`,n;try{n=await Wo(t)}catch(i){throw new Error(`the gate's policy is evaluated by ${t}, which could not be loaded: `+(i instanceof Error?i.message:String(i)))}if(typeof n.evaluateGatePolicy!="function")throw new Error(`${t} exports no evaluateGatePolicy function`);return n}function Yj(e){return{principal:{kind:e.approver.kind,name:e.resolvedBy,roles:[...e.roles??[]]},action:"PassGate",resource:{op:e.op,gate:e.gate},context:{...e.context??{},...e.planDigest!==void 0?{planDigest:e.planDigest}:{}}}}var fp=v(()=>{"use strict";ir();ch();Jx();Jx();ii()});function T5(e,t){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be { engine?, path?, namespace?, command? }`);for(let[n,i]of Object.entries(t))if(n==="engine"){if(!I5.includes(i))throw new Error(`${e}.engine must be ${I5.join(" or ")}, the result shape the command prints`)}else if(n==="path"||n==="namespace"){if(typeof i!="string"||i.trim()==="")throw new Error(`${e}.${n} must be a non-empty string`);if(n==="path"&&(i.startsWith("/")||i.split("/").includes("..")))throw new Error(`${e}.path must be a directory inside the workspace, relative to its declaration`)}else if(n==="command"){if(!Array.isArray(i)||i.length===0||!i.every(r=>typeof r=="string"&&r!==""))throw new Error(`${e}.command must be argv, a non-empty list of strings`);if(!i.some(r=>r.includes("{input}")))throw new Error(`${e}.command must pass the input file as {input}`)}else throw n==="outcomes"||n==="allow_unattended"||n==="allowUnattended"?new Error(`${e}.${n}: chant's policy step denies and holds only; a non-empty plan always waits for a person (ws-104), so there is no unattended outcome`):new Error(`${e}.${n} is not a setting; the settings are engine, path, namespace and command`)}var I5,D5=v(()=>{"use strict";I5=["conftest","opa"]});var rN={};_e(rN,{CHANT_PACKAGE:()=>gp,DECLARATION_FILES:()=>mp,DECLARATION_SCHEMA_ID:()=>Ske,DECLARATION_SCHEMA_VERSION:()=>Eke,DEFAULT_CI_WINDOW:()=>G5,DEFAULT_PR_ENVIRONMENT_TTL:()=>W5,DEFAULT_PUBLISH_BRANCH_PREFIX:()=>V5,DEFAULT_REPLICATE_REMOTE:()=>z5,DEFAULT_SHIP_ENV:()=>U5,DEFAULT_SHIP_GATE:()=>B5,DEFAULT_STATE_ROOT:()=>q5,DIAGRAM_TOOLS:()=>Cke,FACTORY_CHECK_KINDS:()=>_ke,NAME_PATTERN:()=>Oke,PRINCIPAL_CLASSES:()=>Ake,REPLICATE_REF_CLASSES:()=>Qj,REPLICATE_TRIGGERS:()=>Xj,RESERVED_NAMES:()=>F5,WORKSPACE_ERROR_CODES:()=>Ii,WRITE_VERBS:()=>Pke,WorkspaceReadError:()=>xe,boxServicesProblem:()=>X5,compareVersions:()=>K5,declaredDiagrams:()=>tN,declaredRecordKinds:()=>ur,extensionsAt:()=>ph,findDeclarationDir:()=>nN,greenBranches:()=>Ul,isInside:()=>Wr,ownerOf:()=>eZ,parseDeclaration:()=>Z5,pinnedChant:()=>Yx,readDeclaration:()=>It,readerVersion:()=>tn,repoMemberDir:()=>H5,resolveGroups:()=>tc,rootExclusions:()=>Qx});function Ul(e){return e.branches??[e.branch]}function H5(e){return`@repo/${e}`}function tn(){return j5??=g5(),j5}function K5(e,t){let n=eN.exec(e),i=eN.exec(t);if(!n||!i)throw new Error(`not a version: ${n?t:e}`);for(let r=1;r<=3;r++){let o=Number(n[r])-Number(i[r]);if(o!==0)return o}return n[4]===i[4]?0:n[4]===void 0?1:i[4]===void 0||n[4]<i[4]?-1:1}function Ike(){if(Zx)return Zx;let e=Gs();return Zx=new e({allErrors:!0,strict:!0}).compile(SI),Zx}function Tke(e,t){let n=/#\/\$defs\/([A-Za-z]+)\//.exec(e.schemaPath)?.[1];if(e.keyword==="pattern"){let i=JSON.stringify(t);return n==="name"&&typeof t=="string"&&F5.includes(t)?`${i} is reserved; pick another name`:n==="name"?`${i} is not a valid name: use lowercase letters, digits and hyphens, starting with a letter or digit, at most 40 characters`:n==="kindName"?`${i} is not a valid kind or role name`:n==="dir"?`${i} is not a directory inside the workspace: use a relative path with / separators, and no . or .. segments`:n==="path"?`${i} is not a path inside the member or workspace: use a relative path with / separators, and no . or .. segments`:n==="glob"?`${i} is not a glob inside the workspace: use a relative pattern with / separators, and no . or .. segments`:n==="version"?`${i} is not a version such as 1.2.3`:`${i} is not allowed here`}if(e.keyword==="additionalProperties")return`unknown field ${JSON.stringify(e.params.additionalProperty)}; only fields named x-... may be added`;if(e.keyword==="required"){let i=String(e.params.missingProperty);return i==="because"&&e.instancePath.endsWith("/handWritten")?'a hand-written generated file needs "because", saying why it is kept by hand':i==="because"?'a member of kind other needs "because", saying why it is there':i==="repo"?`a member of kind repo needs "repo", the other repository's url and pinned rev`:`missing required field ${JSON.stringify(i)}`}return e.keyword==="const"&&e.instancePath==="/schema"?"schema must be 1, the only declaration format this chant reads":e.keyword==="false schema"&&e.instancePath.endsWith("/dir")?"a member of kind repo has no dir: it names another repository's workspace with repo":e.keyword==="false schema"&&e.instancePath.endsWith("/repo")?"only a member of kind repo has repo":e.message??"is invalid"}function J5(e,t){let n=e;for(let i of t.split("/").slice(1)){let r=i.replace(/~1/g,"/").replace(/~0/g,"~");if(n===null||typeof n!="object")return;n=n[r]}return n}function Yx(e){if(!Array.isArray(e.pins))return;let t=e.pins.findIndex(n=>n!==null&&typeof n=="object"&&n.package===gp&&typeof n.version=="string");return t<0?void 0:{version:e.pins[t].version,index:t}}function Z5(e,t,n=tn(),i={}){let r=Ya(e,{jsonc:t.endsWith(".jsonc")});if(!r.ok)throw new xe("declaration-unparseable",r.message,{file:t,...r.location});let o=(E,P=!1)=>({file:t,...r.locate(E,P)}),s=r.value;if(s===null||typeof s!="object"||Array.isArray(s))throw new xe("declaration-invalid","the declaration must be a JSON object",o(""));let a=s,c=i.rootChant?Yx(a):void 0;if(c&&c.version!==n)throw new xe("root-chant-required",`this declaration pins ${gp} ${c.version}, and this is chant ${n}; the root's chant reads it, so install ${gp}@${c.version} at the workspace root`,o(`/pins/${c.index}/version`));if(typeof a.minReader=="string"&&eN.test(a.minReader)&&K5(n,a.minReader)<0)throw new xe("reader-too-old",`this declaration needs chant ${a.minReader} or newer to read it, and this is chant ${n}`,o("/minReader"));let l=Ike();if(!l(s)){let E=(l.errors??[]).filter(se=>!Dke.has(se.keyword));E.sort((se,qe)=>qe.instancePath.split("/").length-se.instancePath.split("/").length);let P=E[0]??l.errors[0],L=P.keyword==="additionalProperties",he=L?`${P.instancePath}/${Fl(String(P.params.additionalProperty))}`:P.instancePath,te=P.instancePath===""?"":` (at ${P.instancePath})`,J=E.length>1?`; ${E.length-1} more problem${E.length>2?"s":""} after this one`:"";throw new xe("declaration-invalid",`${Tke(P,J5(s,P.instancePath))}${te}${J}`,o(he,L))}let u=a.members.map((E,P)=>{let L=`/members/${P}`,he=(E.suppress??[]).map(oe=>({check:oe.check,because:oe.because}));if(E.kind===Cx){let oe=E.glob;return{type:"group",name:E.name,kind:Cx,globs:typeof oe=="string"?[oe]:[...oe],suppress:he,pointer:L,globLocation:r.locate(`${L}/glob`)}}let te=(E.roles??[]).map(oe=>typeof oe=="string"?{name:oe,path:null}:{name:oe.name,path:oe.path??null}),J=(E.generated??[]).map((oe,Te)=>({path:oe.path,generator:oe.generator,sources:[...oe.sources??[]],handWritten:oe.handWritten?{because:oe.handWritten.because}:null,pointer:`${L}/generated/${Te}`})),se=(E.links??[]).map((oe,Te)=>({member:oe.member,output:oe.output,kind:oe.kind??null,protocol:oe.protocol??null,pointer:`${L}/links/${Te}`})),qe=E.repo,ie=E.kind===Bs?H5(E.name):E.dir,le=L5(E.records,ie,E.name,`${L}/records`),pe=M5(E.diagrams,E.name,`${L}/diagrams`),re=zke(E.box,`${L}/box`);return{type:"member",name:E.name,dir:ie,kind:E.kind,repo:qe?{url:qe.url,rev:qe.rev,workspace:qe.workspace??"."}:null,roles:te,generated:J,outputs:E.outputs===void 0?null:[...E.outputs],fields:E.fields===void 0?null:structuredClone(E.fields),links:se,records:le,diagrams:pe,box:re,upstream:E.upstream??null,because:E.because??null,travel:E.travel===!0,...E.acceptWorkspaceGates===!0?{acceptWorkspaceGates:!0}:{},security:[...E.security??[]],ciWorkflow:E.ci?.workflow??null,ciHooks:Q5(E.ci?.hooks,`${L}/ci/hooks`,o),suppress:he,pointer:L}}),d=new Map;for(let E of u){let P=d.get(E.name);if(P)throw new xe("declaration-invalid",`the name ${JSON.stringify(E.name)} is already used by the entry at ${P.pointer}`,o(`${E.pointer}/name`));d.set(E.name,E)}let p=u.filter(E=>E.type==="member"),f=p.filter(E=>E.kind!==Bs),g=new Map;for(let E of f){let P=g.get(E.dir);if(P)throw new xe("placement-invalid",`member ${E.name} has the same directory as member ${P.name} (${E.dir})`,o(`${E.pointer}/dir`));g.set(E.dir,E)}for(let E of f){let P=f.find(L=>L!==E&&L.dir!=="."&&Wr(E.dir,L.dir));if(P)throw new xe("placement-invalid",`member ${E.name} (${E.dir}) sits inside member ${P.name} (${P.dir}); only the root member "." may contain other members`,o(`${E.pointer}/dir`))}for(let E of p){let P=new Map;for(let L of E.generated){let he=P.get(L.path);if(he)throw new xe("declaration-invalid",`member ${E.name} lists the generated file ${L.path} twice; the first is at ${he.pointer}`,o(`${L.pointer}/path`));P.set(L.path,L);let te=E.dir==="."?L.path:`${E.dir}/${L.path}`,J=p.find(se=>se!==E&&se.dir!=="."&&Wr(se.dir,E.dir)&&Wr(te,se.dir));if(J)throw new xe("placement-invalid",`member ${E.name} lists the generated file ${L.path}, which sits inside member ${J.name} (${J.dir}); list it there`,o(`${L.pointer}/path`))}}let h=L5(a.records,".",null,"/records"),w=new Map,b=new Map;for(let E of[...h,...p.flatMap(P=>P.records)]){let P=w.get(E.path);if(P)throw new xe("declaration-invalid",`the record kind ${E.path} is already declared at ${P.pointer}`,o(`${E.pointer}/kind`));if(w.set(E.path,E),E.name===null)continue;let L=b.get(E.name);if(L)throw new xe("declaration-invalid",`the record kind name ${JSON.stringify(E.name)} is already given at ${L.pointer}`,o(`${E.pointer}/name`));b.set(E.name,E)}for(let E of p){let P=new Map;for(let he of E.box?.capabilities??[]){let te=P.get(he.name);if(te)throw new xe("declaration-invalid",`member ${E.name}'s box lists the capability ${he.name} twice; the first is at ${te.pointer}`,o(`${he.pointer}/name`));P.set(he.name,he)}let L=E.box?X5(E.name,E.box.services):null;if(L)throw new xe("declaration-invalid",L.message,o(L.pointer))}let x=Vke(p);if(x)throw new xe("declaration-invalid",x.message,o(x.pointer));let $=p.filter(E=>E.box?.replicate);if($.length>1)throw new xe("declaration-invalid",`members ${$[0].name} and ${$[1].name} both declare replicate in their box block; a checkout's work in progress goes to one remote, so a workspace has one replicate policy`,o($[1].box.replicate.pointer));let k=M5(a.diagrams,null,"/diagrams"),R=new Map;for(let E of[...k,...p.flatMap(P=>P.diagrams)]){let P=R.get(E.name);if(P)throw new xe("declaration-invalid",`the diagram name ${JSON.stringify(E.name)} is already used by the diagram at ${P.pointer}`,o(`${E.pointer}/name`));R.set(E.name,E)}let A=Kke(a,p,o),T=jke(a.writeScope,p,o),_=Bke(a.agents,p,o),j=qke(p,_);if(j)throw new xe("declaration-invalid",j.message,o(j.pointer));let C=Wke(a.ci,o),[Q]=sK(C?.branches,p.map(E=>E.name));if(Q)throw new xe("declaration-invalid",`ci.branches routes member ${Q.member} to both ${Q.branches.join(" and ")}; a member applies from one branch`,o(`/ci/branches/${Fl(Q.branches[1])}`));let ce=(a.pins??[]).map(E=>({package:E.package??null,version:E.version??null,path:E.path??null,integrity:E.integrity??null})),z={name:a.name,schema:a.schema,minReader:a.minReader??null,scope:a.scope==="org"?"org":"repo",entries:u,members:p,groups:u.filter(E=>E.type==="group"),pins:ce,checks:{...a.checks??{}},quorum:typeof a.quorum=="number"?a.quorum:null,records:h,diagrams:k,hosts:A,changes:Uke(a.changes),writeScope:T,agents:_,identity:Nke(a.identity,o),ci:C,retention:Mke(a.retention),metrics:Lke(a.metrics),security:[...a.security??[]],file:t};return Y5.set(z,s),z}function ph(e,t){let n=J5(Y5.get(e),t);return n===null||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(([i])=>i.startsWith("x-")))}function jke(e,t,n){if(e===void 0)return null;let i=e,r={};for(let[o,s]of Object.entries(i)){let a=`/writeScope/${o}`,c=s.members===void 0||s.members==="*"?null:[...s.members];for(let[d,p]of(c??[]).entries())if(!t.some(f=>f.name===p))throw new xe("declaration-invalid",`writeScope.${o} names the member ${JSON.stringify(p)}, which the declaration does not declare; declared members: ${t.map(f=>f.name).join(", ")||"none"}`,n(`${a}/members/${d}`));let l=s.records===void 0?null:Object.fromEntries(Object.entries(s.records).map(([d,p])=>[d,[...p]])),u=(s.protected??[]).map(d=>typeof d=="string"?{path:d,except:[]}:{path:d.path,except:[...d.except??[]]});r[o]={members:c,records:l,protected:u,pointer:a}}return r}function Nke(e,t){if(e===void 0)return null;let n=e,i={};for(let[r,o]of Object.entries(n.gates??{})){let s=`/identity/gates/${r.replace(/~/g,"~0").replace(/\//g,"~1")}`;if(o.quorum!==void 0){let[c]=Ci(o.quorum,`identity.gates.${r}.quorum`,{notAuthor:!1});if(c)throw new xe("declaration-invalid",c.replace(/`/g,""),t(`${s}/quorum`))}let[a]=uh(o,`identity.gates.${r}`);if(a)throw new xe("declaration-invalid",a.replace(/`/g,""),t(s));i[r]={gate:r,class:o.class??null,quorum:o.quorum!==void 0?structuredClone(o.quorum):null,policy:o.policy!==void 0?structuredClone(o.policy):null,mode:o.mode??null,context:o.context!==void 0?structuredClone(o.context):null,pointer:s}}return{attribution:n.attribution??"any",gates:i}}function Lke(e){if(!e||typeof e!="object")return null;let t=e.failureWindowDays;return typeof t=="number"?{failureWindowDays:t}:{}}function Mke(e){if(!e||typeof e!="object")return null;let t={};for(let n of tK){let i=e[n];i&&(t[n]={...typeof i.days=="number"?{days:i.days}:{},...typeof i.keep=="number"?{keep:i.keep}:{}})}return t}function Q5(e,t,n){if(e===void 0)return null;try{Jj(t.slice(1).replace(/\//g,"."),e)}catch(i){throw new xe("declaration-invalid",i instanceof Error?i.message:String(i),n(t))}return structuredClone(e)}function N5(e){return Object.fromEntries(Object.entries(e).filter(([t])=>!t.startsWith("x-")).map(([t,n])=>[t,[...n]]))}function Fke(e,t){if(e===void 0)return null;try{T5("ci.policy",e)}catch(n){throw new xe("declaration-invalid",n instanceof Error?n.message:String(n),t("/ci/policy"))}return structuredClone(e)}function Gke(e,t){let n={};for(let r of Lk){let o=e[r];if(o===void 0)continue;let s=Object.fromEntries(Object.entries(o).filter(([c])=>!c.startsWith("x-"))),a=o.rules.map(c=>Object.fromEntries(Object.entries(c).filter(([l])=>!l.startsWith("x-")).map(([l,u])=>[l,Array.isArray(u)?[...u]:u])));n[r]={...s,rules:a}}let[i]=aK(n);if(i)throw new xe("declaration-invalid",i.message,t(i.pointer));return n}function Wke(e,t){if(e===void 0)return null;let n=e,i=Q5(n.hooks,"/ci/hooks",t),r=Fke(n.policy,t),o={...n.workflow!==void 0?{workflow:n.workflow}:{},...i?{hooks:i}:{},...n.branches!==void 0?{branches:N5(n.branches)}:{},...n.labels!==void 0?{labels:N5(n.labels)}:{},...n.locks!==void 0?{locks:n.locks}:{},...r?{policy:r}:{},...n.identity?.cloud!==void 0?{identity:{cloud:Gke(n.identity.cloud,t)}}:{},...n.prEnvironment!==void 0?{prEnvironment:{template:n.prEnvironment.template,ttl:n.prEnvironment.ttl??W5,...n.prEnvironment.teardown!==void 0?{teardown:{...n.prEnvironment.teardown.name!==void 0?{name:n.prEnvironment.teardown.name}:{},command:[...n.prEnvironment.teardown.command],...n.prEnvironment.teardown.lexicons!==void 0?{lexicons:[...n.prEnvironment.teardown.lexicons]}:{}}}:{}}}:{}},s=null;if(n.reportUrl!==void 0){let u=nK(n.reportUrl,"ci.reportUrl");if("error"in u)throw new xe("declaration-invalid",u.error,t("/ci/reportUrl"));s=u.url}if(n.green===void 0)return{green:null,...o,reportUrl:s};let a=n.green,c=Object.entries(a.phases).map(([u,d])=>({name:u,runs:[...Array.isArray(d)?d:d.runs],skipped:Array.isArray(d)?"fail":d.skipped??"fail",...!Array.isArray(d)&&d.build!==void 0?{build:d.build}:{},pointer:`/ci/green/phases/${Fl(u)}`}));for(let[u,d]of a.require.entries())if(!c.some(p=>p.name===d))throw new xe("declaration-invalid",`ci.green.require names the phase ${JSON.stringify(d)}, which ci.green.phases does not declare; declared phases: ${c.map(p=>p.name).join(", ")}`,t(`/ci/green/require/${u}`));for(let[u,d]of(a.preMerge??[]).entries())if(!c.some(p=>p.name===d))throw new xe("declaration-invalid",`ci.green.preMerge names the phase ${JSON.stringify(d)}, which ci.green.phases does not declare; declared phases: ${c.map(p=>p.name).join(", ")}`,t(`/ci/green/preMerge/${u}`));let l=Array.isArray(a.branch)?a.branch:[a.branch];return{green:{branch:l[0],...l.length>1?{branches:[...l]}:{},window:a.window??G5,phases:c,require:[...a.require],...a.preMerge!==void 0?{preMerge:[...a.preMerge]}:{},signedSince:a.signedSince??null,source:a.source??"checks",pointer:"/ci/green"},...o,reportUrl:s}}function Bke(e,t,n){let i=(e??[]).map((s,a)=>{let c=s.members!==void 0?[...s.members]:[s.member];return{name:s.name,members:c,member:c[0],principals:[...s.principals??[]],pointer:`/agents/${a}`,listed:s.members!==void 0}}),r=new Map,o=new Map;for(let{listed:s,...a}of i){let c=r.get(a.name);if(c)throw new xe("declaration-invalid",`the agent name ${JSON.stringify(a.name)} is already used by the agent at ${c.pointer}`,n(`${a.pointer}/name`));r.set(a.name,a);for(let[l,u]of a.members.entries())if(!t.some(d=>d.name===u))throw new xe("declaration-invalid",`agent ${a.name} is bound to ${JSON.stringify(u)}, which is not a declared member; an agent session is bound to members, not an example group`,n(s?`${a.pointer}/members/${l}`:`${a.pointer}/member`));for(let[l,u]of a.principals.entries()){let d=o.get(u);if(d)throw new xe("declaration-invalid",`the principal ${JSON.stringify(u)} is already listed by agent ${d.name}`,n(`${a.pointer}/principals/${l}`));o.set(u,a)}}return[...r.values()]}function Uke(e){return e===void 0?null:{severity:e.severity??"warn",ignore:[...e.ignore??[]]}}function L5(e,t,n,i){return(e??[]).map((r,o)=>({kind:r.kind,path:t==="."?r.kind:`${t}/${r.kind}`,name:r.name??null,member:n,pointer:`${i}/${o}`}))}function M5(e,t,n){return(e??[]).map((i,r)=>({name:i.name,title:i.title,source:i.source??null,render:i.render??null,renderer:{tool:i.renderer.tool,version:i.renderer.version,args:[...i.renderer.args??[]]},sourceHash:i.sourceHash??null,member:t,pointer:`${n}/${r}`}))}function zke(e,t){if(e===void 0)return null;let n=e,i=n.factory,r=n.listing,o=n.replicate;return{capabilities:(n.capabilities??[]).map((s,a)=>({name:s.name,broker:s.broker??null,scope:[...s.scope??[]],pointer:`${t}/capabilities/${a}`})),isolation:n.host===void 0?null:{host:n.host,slot:n.slot,ports:{...n.ports??{}},state:{...n.state??{}},cookies:[...n.cookies??[]]},intent:n.intent??null,services:(n.services??[]).map((s,a)=>({name:s.name,cmd:s.cmd,needs:[...s.needs??[]],httpPort:s.httpPort??null,duration:s.duration??null,health:s.health??null,optional:s.optional??!1,pointer:`${t}/services/${a}`})),factory:i===void 0?null:{builds:[...i.builds],check:i.check===void 0?null:typeof i.check=="string"?{run:i.check,kind:"test"}:{run:i.check.run,kind:i.check.kind??"test"},checks:i.checks??null,builders:i.builders??null,tiers:(i.tiers??[]).map(s=>({tier:s.tier,agent:s.agent,kinds:s.kinds===void 0?null:[...s.kinds],session:s.session??null})),publish:i.publish===void 0?null:{forge:i.publish.forge??"github",repo:i.publish.repo,base:i.publish.base??null,branchPrefix:i.publish.branchPrefix??V5,head:i.publish.head??null},pointer:`${t}/factory`},listing:r===void 0?null:{published:r.published??!0,title:r.title??"",line:r.line??"",cover:r.cover??null},publisher:n.publisher??null,ship:n.ship===void 0?null:{op:n.ship.op,gate:n.ship.gate??B5,env:n.ship.env??U5,bookkeeping:(n.ship.bookkeeping??[]).map(s=>s.replace(/^\.\//,"").replace(/\/+$/,"")),pointer:`${t}/ship`},replicate:o===void 0?null:{remote:o.remote??z5,refs:Qj.filter(s=>(o.refs??Qj).includes(s)),on:Xj.filter(s=>(o.on??Xj).includes(s)),every:o.every??null,pointer:`${t}/replicate`},pointer:t}}function Vke(e){let t=e.filter(s=>s.box?.factory);if(t.length>1)return{message:`members ${t[0].name} and ${t[1].name} both declare a factory in their box block; a workspace has one factory, so an orchestrator reads one`,pointer:t[1].box.factory.pointer};let n=t[0]?.box?.factory;if(!n)return null;let i=()=>e.map(s=>s.name).join(", "),r=n.builds.findIndex(s=>!e.some(a=>a.name===s));if(r>=0)return{message:`the factory builds ${JSON.stringify(n.builds[r])}, which is not a declared member; declared members: ${i()}`,pointer:`${n.pointer}/builds/${r}`};if(n.builders!==null&&!e.some(s=>s.name===n.builders))return{message:`the factory's builders names ${JSON.stringify(n.builders)}, which is not a declared member; declared members: ${i()}`,pointer:`${n.pointer}/builders`};if(n.tiers.length>0&&n.builders===null)return{message:"the factory declares tiers and no builders; tiers name agents the builders member declares, so name it",pointer:`${n.pointer}/tiers`};let o=new Map;for(let[s,a]of n.tiers.entries())for(let c of a.kinds??[null]){let l=`${a.tier}\0${c??""}`,u=o.get(l);if(u!==void 0){let d=c===null?"with no kinds":`for kind ${c}`;return{message:`tiers/${u} and tiers/${s} both name a builder at tier ${a.tier} ${d}; a tier has one builder per kind, so one entry answers it`,pointer:`${n.pointer}/tiers/${s}`}}o.set(l,s)}return null}function qke(e,t){let n=e.find(i=>i.box?.factory)?.box?.factory;if(!n)return null;for(let[i,r]of n.tiers.entries())if(r.session!==null&&!t.some(o=>o.name===r.session)){let o=t.map(s=>s.name).join(", ")||"none";return{message:`tiers/${i} names the session ${JSON.stringify(r.session)}, which is not a declared agent session; declared sessions: ${o}`,pointer:`${n.pointer}/tiers/${i}/session`}}return null}function X5(e,t){let n=new Map;for(let o of t){let s=n.get(o.name);if(s)return{message:`member ${e}'s box declares the service ${o.name} twice; the first is at ${s.pointer}`,pointer:`${o.pointer}/name`};n.set(o.name,o)}let i;for(let o of t)if(o.httpPort!==null){if(i)return{message:`member ${e}'s box gives both ${i.name} (port ${i.httpPort}) and ${o.name} (port ${o.httpPort}) an httpPort, and the supervisor routes the sprite's URL to one service`,pointer:`${o.pointer}/httpPort`};i=o}for(let o of t){let s=o.needs.findIndex(a=>!n.has(a));if(s>=0){let a=t.map(c=>c.name).join(", ");return{message:`member ${e}'s box service ${o.name} needs ${JSON.stringify(o.needs[s])}, which the block does not declare; declared services: ${a}`,pointer:`${o.pointer}/needs/${s}`}}}let r=Hke(t);if(r){let o=n.get(r[0]);return{message:`member ${e}'s box services need each other in a cycle: ${r.join(" -> ")}`,pointer:`${o.pointer}/needs`}}return null}function Hke(e){let t=new Map(e.map(r=>[r.name,r])),n=new Map,i=(r,o)=>{let s=n.get(r);if(s==="done")return null;if(s==="visiting")return[...o.slice(o.indexOf(r)),r];n.set(r,"visiting");for(let a of t.get(r)?.needs??[]){let c=i(a,[...o,r]);if(c)return c}return n.set(r,"done"),null};for(let r of e){let o=i(r.name,[]);if(o)return o}return null}function Kke(e,t,n){let i=(e.hosts??[]).map((s,a)=>({name:s.name,ports:{...s.ports},stateRoot:s.stateRoot??null,pointer:`/hosts/${a}`})),r=(s,a)=>new xe("declaration-invalid",s,n(a)),o=new Map;for(let s of i){let a=o.get(s.name);if(a)throw r(`the host name ${JSON.stringify(s.name)} is already used by the host at ${a.pointer}`,`${s.pointer}/name`);if(o.set(s.name,s),s.ports.from>s.ports.to)throw r(`host ${s.name}'s port range starts at ${s.ports.from}, after its end ${s.ports.to}`,`${s.pointer}/ports`)}for(let s of t){let a=s.box?.isolation;if(!a)continue;let c=s.box.pointer,l=o.get(a.host);if(!l){let g=i.map(h=>h.name).join(", ")||"none are declared";throw r(`member ${s.name}'s box names the host ${JSON.stringify(a.host)}, which hosts does not declare; declared hosts: ${g}`,`${c}/host`)}let{from:u,to:d,perBox:p}=l.ports,f=u+(a.slot+1)*p-1;if(f>d){let g=Math.floor((d-u+1)/p);throw r(`member ${s.name}'s box has slot ${a.slot} on host ${l.name}, which needs ports ${u+a.slot*p} to ${f}, past the end of the host's range (${d}); the range holds ${g} slot${g===1?"":"s"}`,`${c}/slot`)}for(let[g,h]of Object.entries(a.ports))if(h>=p)throw r(`member ${s.name}'s box gives port ${g} offset ${h}, and host ${l.name} gives each box ${p} port${p===1?"":"s"} (offsets 0 to ${p-1})`,`${c}/ports/${Fl(g)}`)}return i}function ur(e){return[...e.records,...e.members.flatMap(t=>t.records)]}function tN(e){return[...e.diagrams,...e.members.flatMap(t=>t.diagrams)]}function Wr(e,t){return t==="."?!0:e===t||e.startsWith(`${t}/`)}function It(e,t="",n={}){let i=mp.map(r=>De(t,r)).filter(r=>e.stat(r)==="file");if(i.length===0)throw new xe("declaration-missing",`no ${mp.join(" or ")} in ${t||"the workspace root"}${e.label}`);if(i.length>1)throw new xe("declaration-ambiguous",`both ${i.join(" and ")} exist${e.label}; keep one of them`,{file:i[1],line:1,column:1});return Z5(e.read(i[0]),i[0],tn(),n)}function nN(e,t){for(let n=t;;n=n.includes("/")?n.slice(0,n.lastIndexOf("/")):""){if(mp.some(i=>e.stat(De(n,i))==="file"))return n;if(n==="")return}}function tc(e,t){let n=o=>({file:e.file,...o.globLocation}),i=new Map,r=[];for(let o of e.groups){let s=[...new Set(o.globs.flatMap(l=>fK(t,l)))].sort(),a=[],c=[];for(let l of s){if(!Sj(t,l)){c.push(l);continue}let u=p=>new xe("placement-invalid",`group ${o.name} matches ${l}, ${p}`,n(o));for(let p of e.members)if(p.dir!=="."){if(p.dir===l)throw u(`which is member ${p.name}'s directory; a match is never a member`);if(Wr(p.dir,l))throw u(`which contains member ${p.name} (${p.dir})`);if(p.kind==="workspace"&&Wr(l,p.dir))throw u(`which sits inside the nested workspace ${p.name}; that workspace declares its own examples`)}let d=i.get(l);if(d)throw u(`which group ${d.name} also matches`);i.set(l,o),a.push(l)}r.push({group:o,matches:a,skipped:c})}return r}function eZ(e,t,n){for(let r of t){let o=r.matches.find(s=>Wr(n,s));if(o)return{group:r.group,match:o}}let i;for(let r of e.members)Wr(n,r.dir)&&(!i||i.dir==="."||r.dir!=="."&&r.dir.length>i.dir.length)&&(i=r);return i?{member:i}:void 0}function Qx(e,t){let n=[];for(let i of e.members)i.dir!=="."&&n.push({dir:i.dir,owner:i.name});for(let i of t)for(let r of i.matches)e.members.some(o=>o.dir!=="."&&Wr(r,o.dir))||n.push({dir:r,owner:i.group.name});return n.sort((i,r)=>i.dir<r.dir?-1:i.dir>r.dir?1:0)}var Ske,mp,Eke,F5,Oke,Ii,xe,Ake,Pke,G5,W5,Cke,B5,U5,Qj,Xj,z5,_ke,V5,q5,gp,j5,eN,Zx,Dke,Y5,Ot=v(()=>{"use strict";RI();rK();iK();EI();cK();mK();Ai();lp();jt();qg();h5();ec();ii();fp();D5();Ske=SI.$id,mp=["chant.workspace.json","chant.workspace.jsonc"],Eke=1,F5=["_workspace","_members"],Oke=/^[a-z0-9][a-z0-9-]{0,39}$/,Ii=["declaration-missing","declaration-ambiguous","declaration-unparseable","declaration-invalid","placement-invalid","reader-too-old","root-chant-required","not-a-git-repository","revision-unknown"],xe=class extends Error{constructor(n,i,r){super(i);this.code=n;this.location=r;this.name="WorkspaceReadError"}describe(){let n=this.location;return n?`${n.file}:${n.line}:${n.column}: ${this.message}`:this.message}},Ake=["human","agent","runner","service"],Pke=["new","amend","review","close"];G5="24h",W5="72h",Cke=["d2","mermaid","graphviz","excalidraw"],B5="ship",U5="box",Qj=["work","kept","wip","ledger"],Xj=["save","release"],z5="origin",_ke=["test","build","lint","plan","conformance"],V5="chant/work/",q5="${XDG_STATE_HOME}/chant/boxes";gp="@intentius/chant";eN=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?$/;Dke=new Set(["if","then","else","oneOf","anyOf"]);Y5=new WeakMap});var rZ={};_e(rZ,{MEMBERS_DIR:()=>t$,MEMBER_LEDGER_FLOOR:()=>txe,MemberLedgerError:()=>e$,clearMemberLedgerCache:()=>nxe,memberLedgerPrefix:()=>n$,resolveMemberLedger:()=>oi});import{existsSync as Jke}from"node:fs";import{dirname as Zke,join as Yke,relative as Qke,resolve as Xke,sep as exe}from"node:path";function n$(e){return e.map(t=>`${t$}/${t}/`).join("")}function oi(e){let t=Xke(e),n=Xx.get(t);return n||(n=ixe(t),Xx.set(t,n),n.catch(()=>Xx.delete(t))),n}function nxe(){Xx.clear()}function rxe(e,t){let n=Qke(e,t);return n===""?"":n.split(exe).join("/")}async function ixe(e){let t=rr(e);return t?nZ(t.dir,e):tZ}async function nZ(e,t){let{readDeclaration:n,resolveGroups:i,ownerOf:r,WorkspaceReadError:o}=await Promise.resolve().then(()=>(Ot(),rN)),{workingTree:s}=await Promise.resolve().then(()=>(jt(),PI)),a;try{let d=s(e),p=n(d),f=r(p,i(p,d),rxe(e,t));a=f&&"member"in f&&f.member.dir!=="."?[f.member.name]:[]}catch(d){throw d instanceof o?new e$(`cannot place this project's lifecycle ledger: ${d.describe()}. A project inside a workspace writes under ${t$}/<member>/ on chant/lifecycle, and chant does not guess the member. Fix the declaration and retry.`):d}let c=tZ,l=Zke(e);if(l!==e&&!Jke(Yke(e,".git"))){let d=rr(l);d&&(c=await nZ(d.dir,e))}let u=[...c.members,...a];return{members:u,prefix:n$(u)}}var t$,txe,tZ,e$,Xx,Jo=v(()=>{"use strict";eo();t$="_members",txe="0.81.0",tZ={members:[],prefix:""};e$=class extends Error{constructor(t){super(t),this.name="MemberLedgerError"}},Xx=new Map});function fh(e){return e===hp}var hp,mh=v(()=>{"use strict";hp="recorded locally (no remote for chant/lifecycle)"});function co(e=process.env){let t=e[r$]?.trim().toLowerCase();return t!==void 0&&t!==""&&t!=="0"&&t!=="false"}function gh(e){return iN.get(e)?.tip}function iZ(e,t,n,i){let r=iN.get(e)??{tip:null,writes:[]};r.tip=t;for(let o of n)r.writes.push({path:o,message:i});iN.set(e,r)}function i$(e,t){if(co())throw new oN(e,t)}var r$,sN,iN,oN,yp=v(()=>{"use strict";r$="CHANT_NO_RECORD";sN="not recorded (--no-record): chant/lifecycle was not written or pushed",iN=new Map;oN=class extends Error{constructor(n,i){super(`gate "${i}" of "${n}" cannot be passed under --no-record: a gate is decided and approved on chant/lifecycle, which this run does not write. Run without --no-record (and without CHANT_NO_RECORD) to stop at the gate for approval.`);this.op=n;this.gate=i;this.name="GateNotRecordableError"}}});var gN={};_e(gN,{LifecycleLedgerUnreadableError:()=>yh,RefCASConflictError:()=>At,StaleLifecycleBranchError:()=>hh,StaleLockError:()=>zl,appendLedgerLine:()=>fZ,appendReleaseRecordLine:()=>lN,deleteRefCAS:()=>vp,describeLifecyclePush:()=>pN,fetchLifecycle:()=>fxe,fetchLifecycleStatus:()=>po,fetchRef:()=>yxe,fetchRefInto:()=>wZ,fetchRefIntoStatus:()=>a$,getHeadCommit:()=>c$,getRemoteLifecycleBranchSha:()=>mZ,gitLedgerReadPort:()=>bxe,ledgerDir:()=>Jn,ledgerRevision:()=>kp,listFilesInDir:()=>uo,listLedgerEnvironments:()=>dN,listLedgerTrees:()=>wh,listSnapshots:()=>pxe,pushLifecycle:()=>wp,pushLifecycleReport:()=>rc,pushLifecycleStatus:()=>nc,pushRef:()=>hxe,pushRefStatus:()=>bh,readBlobBySha:()=>yn,readBlobFromPath:()=>Pt,readEnvironmentSnapshots:()=>dxe,readPathSha:()=>hn,readRefSha:()=>ic,readReleaseLedgerLines:()=>uN,readSnapshot:()=>pZ,readSnapshotAt:()=>uxe,requireLifecycleLedger:()=>Br,snapshotStorageKey:()=>uZ,updateRefCAS:()=>bp,writeBlob:()=>fN,writeBlobToPath:()=>gn,writeLedgerFiles:()=>lo,writeSnapshot:()=>dZ});async function Jn(e,t){return`${await oxe(t)}${e}`}async function oxe(e){return e?.ledgerPrefix!==void 0?e.ledgerPrefix:e?.member!==void 0?n$((typeof e.member=="string"?[e.member]:[...e.member]).filter(t=>t!==".")):(await oi(e?.cwd??process.cwd())).prefix}async function cxe(e){let t=bt();if((await t.spawn(["git","var","GIT_COMMITTER_IDENT"],{cwd:e,env:Ti})).exitCode===0)return[];let i=[];for(let[r,o,s]of[["user.name","CHANT_LIFECYCLE_COMMITTER_NAME",sxe],["user.email","CHANT_LIFECYCLE_COMMITTER_EMAIL",axe]]){let a=await t.spawn(["git","config","--get",r],{cwd:e,env:Ti});a.exitCode===0&&a.stdout.trim()!==""||i.push("-c",`${r}=${process.env[o]?.trim()||s}`)}return i}function aN(e,t,n){return new Error(`cannot write ${t} on the ${Lt} branch: ${e} failed: ${(n??"").trim()}`)}async function gn(e,t,n,i,r){let o=await Jn(e,r);return lo([{path:`${o}/${t}`,content:n,...r?.expectPriorPathSha!==void 0?{expectPriorSha:r.expectPriorPathSha}:{}}],i,r)}async function lo(e,t,n){let i=bt(),r=n?.cwd;if(e.length===0)throw new Error("writeLedgerFiles needs at least one file");let o=e[0].path;for(let u of e){let d=u.path.split("/");if(d.length<2||d.some(p=>p===""))throw new Error(`cannot write ${u.path} on the ${Lt} branch: a ledger path is <dir>/<file>`)}let s=[];for(let u of e){if(lxe(u)){s.push({path:u.path,sha:null});continue}let d=await i.spawn(["git","hash-object","-w","--stdin"],{cwd:r,stdin:u.content});if(d.exitCode!==0)throw aN("git hash-object",u.path,d.stderr);s.push({path:u.path,sha:d.stdout.trim()})}let a=await cxe(r);await Vl(r)===null&&await Br({...r?{cwd:r}:{}});let c=new Map(e.map(u=>[u.path,u.expectPriorSha])),l;for(let u=1;u<=lZ;u++){let d=await Vl(r);if(n?.expectTip!==void 0&&d!==n.expectTip)throw new At(`refs/heads/${Lt}`,n.expectTip,`the branch moved to ${d??"(none)"} since it was read`);let p=new Map,f=async k=>{let R=p.get(k);return R||(R=d?await wxe(d,k,r):new Map,p.set(k,R)),R};for(let k of s){let{dir:R,name:A}=sZ(k.path),T=(await f(R)).get(A),_=T?.type==="blob"?T.sha:null,j=c.get(k.path);if(j!==void 0&&_!==j)throw l??new At(`refs/heads/${Lt}`,j,"target path changed concurrently");c.set(k.path,_)}for(let k of s){let{dir:R,name:A}=sZ(k.path);k.sha===null?(await f(R)).delete(A):(await f(R)).set(A,{mode:"100644",type:"blob",sha:k.sha});for(let T=R;T!=="";T=s$(T))await f(s$(T))}let g=[...p.keys()].sort((k,R)=>cZ(R)-cZ(k)||(k<R?-1:1)),h="";for(let k of g){if(k!==""&&p.get(k).size===0){p.get(s$(k)).delete(aZ(k));continue}let R=[...p.get(k)].map(([_,j])=>`${j.mode} ${j.type} ${j.sha} ${_}`).join(`
|
package/package.json
CHANGED