@eforge-build/eforge-plan 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +466 -0
- package/dist/backlog-curation-source-provider.d.ts +62 -0
- package/dist/backlog-curation-source-provider.js +495 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +589 -0
- package/package.json +72 -0
- package/prompts/eforge-plan-backlog-curation-item-audit.md +71 -0
- package/prompts/eforge-plan-backlog-curation-reducer.md +61 -0
- package/prompts/eforge-plan-planning-draft.md +125 -0
- package/workstation-assets/plans/assets/abnfDiagram-VRR7QNED-78B0yOEK.js +1 -0
- package/workstation-assets/plans/assets/arc-XmhKxjV7.js +1 -0
- package/workstation-assets/plans/assets/architecture-TIHT7OUA-NvwveMWr.js +1 -0
- package/workstation-assets/plans/assets/architectureDiagram-ZJ3FMSHR-DwWqL5gE.js +36 -0
- package/workstation-assets/plans/assets/array-BifhSqXX.js +1 -0
- package/workstation-assets/plans/assets/blockDiagram-677ZJIJ3-DKTnUbdw.js +132 -0
- package/workstation-assets/plans/assets/c4Diagram-LMCZKHZV-X42ysI10.js +10 -0
- package/workstation-assets/plans/assets/channel-D_5qxKhT.js +1 -0
- package/workstation-assets/plans/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/workstation-assets/plans/assets/chunk-32BRIVSS-CC-cwjI2.js +1 -0
- package/workstation-assets/plans/assets/chunk-52WLFC77-C5jMuCNv.js +10 -0
- package/workstation-assets/plans/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/workstation-assets/plans/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
- package/workstation-assets/plans/assets/chunk-C7G6YPKG-QJOKf7JR.js +1 -0
- package/workstation-assets/plans/assets/chunk-EX3LRPZG-BC6hcB7L.js +231 -0
- package/workstation-assets/plans/assets/chunk-FWX5IMBZ-DjGANnm8.js +2 -0
- package/workstation-assets/plans/assets/chunk-HOUHSVGY-CTvTF8P_.js +1 -0
- package/workstation-assets/plans/assets/chunk-ICXQ74PX-BnobhCjQ.js +2 -0
- package/workstation-assets/plans/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/workstation-assets/plans/assets/chunk-KEIR6QF5-Dj-OpFgW.js +161 -0
- package/workstation-assets/plans/assets/chunk-MOJQB5TN-Dwkjcsly.js +88 -0
- package/workstation-assets/plans/assets/chunk-OGEWGWER-CFMxH_hz.js +1 -0
- package/workstation-assets/plans/assets/chunk-PUDLZKDR-Dor57faH.js +156 -0
- package/workstation-assets/plans/assets/chunk-Q4XR5HBZ-D-IK7DlL.js +70 -0
- package/workstation-assets/plans/assets/chunk-RYQCIY6F-DpTa04be.js +1 -0
- package/workstation-assets/plans/assets/chunk-V7JOEXUC-CFqzUdj4.js +206 -0
- package/workstation-assets/plans/assets/chunk-VAUOI2AC-BbIlIF2a.js +1 -0
- package/workstation-assets/plans/assets/chunk-VR4S4FIN-CFMVg8B3.js +1 -0
- package/workstation-assets/plans/assets/chunk-WYO6CB5R-BlOpSQhB.js +125 -0
- package/workstation-assets/plans/assets/chunk-XXDRQBXY-BTV-IdbV.js +1 -0
- package/workstation-assets/plans/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/workstation-assets/plans/assets/chunk-ZGVPDNZ5-DughZ6NH.js +62 -0
- package/workstation-assets/plans/assets/chunk-ZIRB5QZD-C6fEPe3t.js +32 -0
- package/workstation-assets/plans/assets/classDiagram-OUVF2IWQ-BDFCV_Gu.js +1 -0
- package/workstation-assets/plans/assets/classDiagram-v2-EOCWNBFH-BDFCV_Gu.js +1 -0
- package/workstation-assets/plans/assets/cose-bilkent-JH36ORCC-DBeM55MZ.js +1 -0
- package/workstation-assets/plans/assets/cynefin-VYW2F7L2-DNQDl6J7.js +1 -0
- package/workstation-assets/plans/assets/cynefinDiagram-TSTJHNR4-7rwTPI0P.js +62 -0
- package/workstation-assets/plans/assets/cytoscape.esm-CQFVGiJu.js +321 -0
- package/workstation-assets/plans/assets/dagre-VKFMJZFB-w4kYnfcE.js +4 -0
- package/workstation-assets/plans/assets/dagre-dpRSp0QF.js +1 -0
- package/workstation-assets/plans/assets/defaultLocale-C8Fc0cco.js +1 -0
- package/workstation-assets/plans/assets/diagram-FQU43EPY-CYlyxHIb.js +3 -0
- package/workstation-assets/plans/assets/diagram-G47NLZAW-BTQ2Ih7M.js +24 -0
- package/workstation-assets/plans/assets/diagram-NH7WQ7WH-CzVwXQzn.js +24 -0
- package/workstation-assets/plans/assets/diagram-OA4YK3LP-DZyMdlgd.js +30 -0
- package/workstation-assets/plans/assets/diagram-WEI45ONY-CPKPEidU.js +41 -0
- package/workstation-assets/plans/assets/dist-BN7f1r-d.js +1 -0
- package/workstation-assets/plans/assets/ebnfDiagram-CCIWWBDH-CedQkhiI.js +1 -0
- package/workstation-assets/plans/assets/erDiagram-Q63AITRT--f4SojKJ.js +85 -0
- package/workstation-assets/plans/assets/eventmodeling-45OFAUF4-Dmd0oPLe.js +1 -0
- package/workstation-assets/plans/assets/flowDiagram-23GEKE2U-Bk0_NpAg.js +1 -0
- package/workstation-assets/plans/assets/ganttDiagram-NO4QXBWP-BD2wDR3D.js +292 -0
- package/workstation-assets/plans/assets/gitGraph-TEB2WS4Q-Cu5uXxdQ.js +1 -0
- package/workstation-assets/plans/assets/gitGraphDiagram-IHSO6WYX-VyFjgVvS.js +106 -0
- package/workstation-assets/plans/assets/graphlib-DS17s2tU.js +1 -0
- package/workstation-assets/plans/assets/info-DKCQHKI2-BbwvhFJT.js +1 -0
- package/workstation-assets/plans/assets/infoDiagram-FWYZ7A6U-CtgDgw_G.js +2 -0
- package/workstation-assets/plans/assets/init-D6jRqBbL.js +1 -0
- package/workstation-assets/plans/assets/ishikawaDiagram-FXEZZL3T-4xM3fMGV.js +70 -0
- package/workstation-assets/plans/assets/journeyDiagram-5HDEW3XC-Bo-Wurg9.js +139 -0
- package/workstation-assets/plans/assets/kanban-definition-HUTT4EX6-9bumG_hJ.js +89 -0
- package/workstation-assets/plans/assets/katex-B7rAX3Vi.js +257 -0
- package/workstation-assets/plans/assets/line-BuQmF8pC.js +1 -0
- package/workstation-assets/plans/assets/linear-RuFdJ2n1.js +1 -0
- package/workstation-assets/plans/assets/map-BaFkSB1l.js +1 -0
- package/workstation-assets/plans/assets/mermaid-parser.core-Z7aCdDC3.js +7 -0
- package/workstation-assets/plans/assets/mermaid.core-7qPnBf_x.js +11 -0
- package/workstation-assets/plans/assets/mindmap-definition-LN4V7U3C-CzdKkzT7.js +96 -0
- package/workstation-assets/plans/assets/ordinal-hYBb2elL.js +1 -0
- package/workstation-assets/plans/assets/packet-7NZHBO7P-Bjesbb-N.js +1 -0
- package/workstation-assets/plans/assets/path-BWPyau1x.js +1 -0
- package/workstation-assets/plans/assets/pegDiagram-2B236MQR-D1f0OGd_.js +1 -0
- package/workstation-assets/plans/assets/pie-RZYD4A2V-BHdG1B1p.js +1 -0
- package/workstation-assets/plans/assets/pieDiagram-ENE6RG2P-Da5uhg-w.js +39 -0
- package/workstation-assets/plans/assets/quadrantDiagram-ABIIQ3AL-Cxs3S7y0.js +7 -0
- package/workstation-assets/plans/assets/radar-I7S5WNFK-u6N10cFf.js +1 -0
- package/workstation-assets/plans/assets/railroad-3IZDKUUU-BzfIqZiM.js +1 -0
- package/workstation-assets/plans/assets/railroad-abnf-AHOZXSZD-DGhviTe2.js +1 -0
- package/workstation-assets/plans/assets/railroad-ebnf-EBAXGLYW-C-Tn21vK.js +1 -0
- package/workstation-assets/plans/assets/railroad-peg-LSFZ7HO6-DIdilv2h.js +1 -0
- package/workstation-assets/plans/assets/railroadDiagram-RFXS5EU6-DNtNT7hD.js +1 -0
- package/workstation-assets/plans/assets/requirementDiagram-TGXJPOKE-raVb_23e.js +84 -0
- package/workstation-assets/plans/assets/rough.esm-CSKSodPl.js +1 -0
- package/workstation-assets/plans/assets/sankeyDiagram-HTMAVEWB-CeV_C-V-.js +40 -0
- package/workstation-assets/plans/assets/sequenceDiagram-DBY2YBRQ-COqLefWL.js +162 -0
- package/workstation-assets/plans/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
- package/workstation-assets/plans/assets/src-YX8hbnqp.js +1 -0
- package/workstation-assets/plans/assets/stateDiagram-2N3HPSRC-hFzKGo6t.js +1 -0
- package/workstation-assets/plans/assets/stateDiagram-v2-6OUMAXLB-B0mmwSp9.js +1 -0
- package/workstation-assets/plans/assets/swimlanes-5IMT3BWC-8GwDMK58.js +2 -0
- package/workstation-assets/plans/assets/swimlanesDiagram-G3AALYLV-CZI5CzhY.js +8 -0
- package/workstation-assets/plans/assets/timeline-definition-FHXFAJF6-9eSt4R4I.js +120 -0
- package/workstation-assets/plans/assets/treeView-QDETBFTQ-D8MgMJ8g.js +1 -0
- package/workstation-assets/plans/assets/treemap-6X3UGDF4-CrzhEgHE.js +1 -0
- package/workstation-assets/plans/assets/vennDiagram-L72KCM5P-D8jY-Ckx.js +34 -0
- package/workstation-assets/plans/assets/wardley-OPB4EBWU-C6HBA56t.js +1 -0
- package/workstation-assets/plans/assets/wardleyDiagram-EHGQE667-DScKs1nw.js +78 -0
- package/workstation-assets/plans/assets/xychartDiagram-FW5EYKEG-CMdUL3S6.js +7 -0
- package/workstation-assets/plans/index.html +13 -0
- package/workstation-assets/plans/index.js +381 -0
- package/workstation-assets/plans/style.css +3 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
import { createRequire as __eforgeCreateRequire } from 'node:module';
|
|
2
|
+
const require = __eforgeCreateRequire(import.meta.url);
|
|
3
|
+
var NX=Object.create;var Ub=Object.defineProperty;var jX=Object.getOwnPropertyDescriptor;var BX=Object.getOwnPropertyNames;var MX=Object.getPrototypeOf,UX=Object.prototype.hasOwnProperty;var Wm=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof require<"u"?require:t)[i]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var B=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(i){throw t=0,i}},Ht=(e,t)=>{for(var i in t)Ub(e,i,{get:t[i],enumerable:!0})},FX=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of BX(t))!UX.call(e,o)&&o!==i&&Ub(e,o,{get:()=>t[o],enumerable:!(r=jX(t,o))||r.enumerable});return e};var Po=(e,t,i)=>(i=e!=null?NX(MX(e)):{},FX(t||!e||!e.__esModule?Ub(i,"default",{value:e,enumerable:!0}):i,e));var ye=B(Ut=>{"use strict";var _R=Symbol.for("yaml.alias"),B$=Symbol.for("yaml.document"),Cf=Symbol.for("yaml.map"),M$=Symbol.for("yaml.pair"),AR=Symbol.for("yaml.scalar"),Lf=Symbol.for("yaml.seq"),Xr=Symbol.for("yaml.node.type"),R3=e=>!!e&&typeof e=="object"&&e[Xr]===_R,x3=e=>!!e&&typeof e=="object"&&e[Xr]===B$,E3=e=>!!e&&typeof e=="object"&&e[Xr]===Cf,P3=e=>!!e&&typeof e=="object"&&e[Xr]===M$,U$=e=>!!e&&typeof e=="object"&&e[Xr]===AR,k3=e=>!!e&&typeof e=="object"&&e[Xr]===Lf;function F$(e){if(e&&typeof e=="object")switch(e[Xr]){case Cf:case Lf:return!0}return!1}function v3(e){if(e&&typeof e=="object")switch(e[Xr]){case _R:case Cf:case AR:case Lf:return!0}return!1}var _3=e=>(U$(e)||F$(e))&&!!e.anchor;Ut.ALIAS=_R;Ut.DOC=B$;Ut.MAP=Cf;Ut.NODE_TYPE=Xr;Ut.PAIR=M$;Ut.SCALAR=AR;Ut.SEQ=Lf;Ut.hasAnchor=_3;Ut.isAlias=R3;Ut.isCollection=F$;Ut.isDocument=x3;Ut.isMap=E3;Ut.isNode=v3;Ut.isPair=P3;Ut.isScalar=U$;Ut.isSeq=k3});var Gu=B(OR=>{"use strict";var wt=ye(),En=Symbol("break visit"),q$=Symbol("skip children"),Sr=Symbol("remove node");function Df(e,t){let i=z$(t);wt.isDocument(e)?Sc(null,e.contents,i,Object.freeze([e]))===Sr&&(e.contents=null):Sc(null,e,i,Object.freeze([]))}Df.BREAK=En;Df.SKIP=q$;Df.REMOVE=Sr;function Sc(e,t,i,r){let o=G$(e,t,i,r);if(wt.isNode(o)||wt.isPair(o))return K$(e,r,o),Sc(e,o,i,r);if(typeof o!="symbol"){if(wt.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=Sc(s,t.items[s],i,r);if(typeof a=="number")s=a-1;else{if(a===En)return En;a===Sr&&(t.items.splice(s,1),s-=1)}}}else if(wt.isPair(t)){r=Object.freeze(r.concat(t));let s=Sc("key",t.key,i,r);if(s===En)return En;s===Sr&&(t.key=null);let a=Sc("value",t.value,i,r);if(a===En)return En;a===Sr&&(t.value=null)}}return o}async function $f(e,t){let i=z$(t);wt.isDocument(e)?await yc(null,e.contents,i,Object.freeze([e]))===Sr&&(e.contents=null):await yc(null,e,i,Object.freeze([]))}$f.BREAK=En;$f.SKIP=q$;$f.REMOVE=Sr;async function yc(e,t,i,r){let o=await G$(e,t,i,r);if(wt.isNode(o)||wt.isPair(o))return K$(e,r,o),yc(e,o,i,r);if(typeof o!="symbol"){if(wt.isCollection(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let a=await yc(s,t.items[s],i,r);if(typeof a=="number")s=a-1;else{if(a===En)return En;a===Sr&&(t.items.splice(s,1),s-=1)}}}else if(wt.isPair(t)){r=Object.freeze(r.concat(t));let s=await yc("key",t.key,i,r);if(s===En)return En;s===Sr&&(t.key=null);let a=await yc("value",t.value,i,r);if(a===En)return En;a===Sr&&(t.value=null)}}return o}function z$(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function G$(e,t,i,r){if(typeof i=="function")return i(e,t,r);if(wt.isMap(t))return i.Map?.(e,t,r);if(wt.isSeq(t))return i.Seq?.(e,t,r);if(wt.isPair(t))return i.Pair?.(e,t,r);if(wt.isScalar(t))return i.Scalar?.(e,t,r);if(wt.isAlias(t))return i.Alias?.(e,t,r)}function K$(e,t,i){let r=t[t.length-1];if(wt.isCollection(r))r.items[e]=i;else if(wt.isPair(r))e==="key"?r.key=i:r.value=i;else if(wt.isDocument(r))r.contents=i;else{let o=wt.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${o} parent`)}}OR.visit=Df;OR.visitAsync=$f});var wR=B(H$=>{"use strict";var V$=ye(),A3=Gu(),O3={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},w3=e=>e.replace(/[!,[\]{}]/g,t=>O3[t]),Ku=class e{constructor(t,i){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,i)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,i){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.trim().split(/[ \t]+/),o=r.shift();switch(o){case"%TAG":{if(r.length!==2&&(i(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,a]=r;return this.tags[s]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return i(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let a=/^\d+\.\d+$/.test(s);return i(6,`Unsupported YAML version ${s}`,a),!1}}default:return i(0,`Unknown directive ${o}`,!0),!1}}tagName(t,i){if(t==="!")return"!";if(t[0]!=="!")return i(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let a=t.slice(2,-1);return a==="!"||a==="!!"?(i(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&i("Verbatim tags must end with a >"),a)}let[,r,o]=t.match(/^(.*!)([^!]*)$/s);o||i(`The ${t} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(o)}catch(a){return i(String(a)),null}return r==="!"?t:(i(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[i,r]of Object.entries(this.tags))if(t.startsWith(r))return i+w3(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let i=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),o;if(t&&r.length>0&&V$.isNode(t.contents)){let s={};A3.visit(t.contents,(a,c)=>{V$.isNode(c)&&c.tag&&(s[c.tag]=!0)}),o=Object.keys(s)}else o=[];for(let[s,a]of r)s==="!!"&&a==="tag:yaml.org,2002:"||(!t||o.some(c=>c.startsWith(a)))&&i.push(`%TAG ${s} ${a}`);return i.join(`
|
|
4
|
+
`)}};Ku.defaultYaml={explicit:!1,version:"1.2"};Ku.defaultTags={"!!":"tag:yaml.org,2002:"};H$.Directives=Ku});var Nf=B(Vu=>{"use strict";var W$=ye(),T3=Gu();function C3(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let i=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(i)}return!0}function X$(e){let t=new Set;return T3.visit(e,{Value(i,r){r.anchor&&t.add(r.anchor)}}),t}function Q$(e,t){for(let i=1;;++i){let r=`${e}${i}`;if(!t.has(r))return r}}function L3(e,t){let i=[],r=new Map,o=null;return{onAnchor:s=>{i.push(s),o??(o=X$(e));let a=Q$(t,o);return o.add(a),a},setAnchors:()=>{for(let s of i){let a=r.get(s);if(typeof a=="object"&&a.anchor&&(W$.isScalar(a.node)||W$.isCollection(a.node)))a.node.anchor=a.anchor;else{let c=new Error("Failed to resolve repeated object (this should not happen)");throw c.source=s,c}}},sourceObjects:r}}Vu.anchorIsValid=C3;Vu.anchorNames=X$;Vu.createNodeAnchors=L3;Vu.findNewAnchor=Q$});var TR=B(Z$=>{"use strict";function Hu(e,t,i,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let o=0,s=r.length;o<s;++o){let a=r[o],c=Hu(e,r,String(o),a);c===void 0?delete r[o]:c!==a&&(r[o]=c)}else if(r instanceof Map)for(let o of Array.from(r.keys())){let s=r.get(o),a=Hu(e,r,o,s);a===void 0?r.delete(o):a!==s&&r.set(o,a)}else if(r instanceof Set)for(let o of Array.from(r)){let s=Hu(e,r,o,o);s===void 0?r.delete(o):s!==o&&(r.delete(o),r.add(s))}else for(let[o,s]of Object.entries(r)){let a=Hu(e,r,o,s);a===void 0?delete r[o]:a!==s&&(r[o]=a)}return e.call(t,i,r)}Z$.applyReviver=Hu});var $o=B(Y$=>{"use strict";var D3=ye();function J$(e,t,i){if(Array.isArray(e))return e.map((r,o)=>J$(r,String(o),i));if(e&&typeof e.toJSON=="function"){if(!i||!D3.hasAnchor(e))return e.toJSON(t,i);let r={aliasCount:0,count:1,res:void 0};i.anchors.set(e,r),i.onCreate=s=>{r.res=s,delete i.onCreate};let o=e.toJSON(t,i);return i.onCreate&&i.onCreate(o),o}return typeof e=="bigint"&&!i?.keep?Number(e):e}Y$.toJS=J$});var jf=B(tN=>{"use strict";var $3=TR(),eN=ye(),N3=$o(),CR=class{constructor(t){Object.defineProperty(this,eN.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:i,maxAliasCount:r,onAnchor:o,reviver:s}={}){if(!eN.isDocument(t))throw new TypeError("A document argument is required");let a={anchors:new Map,doc:t,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=N3.toJS(this,"",a);if(typeof o=="function")for(let{count:d,res:u}of a.anchors.values())o(u,d);return typeof s=="function"?$3.applyReviver(s,{"":c},"",c):c}};tN.NodeBase=CR});var Wu=B(nN=>{"use strict";var j3=Nf(),B3=Gu(),hc=ye(),M3=jf(),U3=$o(),LR=class extends M3.NodeBase{constructor(t){super(hc.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,i){if(i?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;i?.aliasResolveCache?r=i.aliasResolveCache:(r=[],B3.visit(t,{Node:(s,a)=>{(hc.isAlias(a)||hc.hasAnchor(a))&&r.push(a)}}),i&&(i.aliasResolveCache=r));let o;for(let s of r){if(s===this)break;s.anchor===this.source&&(o=s)}return o}toJSON(t,i){if(!i)return{source:this.source};let{anchors:r,doc:o,maxAliasCount:s}=i,a=this.resolve(o,i);if(!a){let d=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(d)}let c=r.get(a);if(c||(U3.toJS(a,null,i),c=r.get(a)),c?.res===void 0){let d="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(d)}if(s>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=Bf(o,a,r)),c.count*c.aliasCount>s)){let d="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(d)}return c.res}toString(t,i,r){let o=`*${this.source}`;if(t){if(j3.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${o} `}return o}};function Bf(e,t,i){if(hc.isAlias(t)){let r=t.resolve(e),o=i&&r&&i.get(r);return o?o.count*o.aliasCount:0}else if(hc.isCollection(t)){let r=0;for(let o of t.items){let s=Bf(e,o,i);s>r&&(r=s)}return r}else if(hc.isPair(t)){let r=Bf(e,t.key,i),o=Bf(e,t.value,i);return Math.max(r,o)}return 1}nN.Alias=LR});var Et=B(DR=>{"use strict";var F3=ye(),q3=jf(),z3=$o(),G3=e=>!e||typeof e!="function"&&typeof e!="object",No=class extends q3.NodeBase{constructor(t){super(F3.SCALAR),this.value=t}toJSON(t,i){return i?.keep?this.value:z3.toJS(this.value,t,i)}toString(){return String(this.value)}};No.BLOCK_FOLDED="BLOCK_FOLDED";No.BLOCK_LITERAL="BLOCK_LITERAL";No.PLAIN="PLAIN";No.QUOTE_DOUBLE="QUOTE_DOUBLE";No.QUOTE_SINGLE="QUOTE_SINGLE";DR.Scalar=No;DR.isScalarValue=G3});var Xu=B(rN=>{"use strict";var K3=Wu(),qs=ye(),iN=Et(),V3="tag:yaml.org,2002:";function H3(e,t,i){if(t){let r=i.filter(s=>s.tag===t),o=r.find(s=>!s.format)??r[0];if(!o)throw new Error(`Tag ${t} not found`);return o}return i.find(r=>r.identify?.(e)&&!r.format)}function W3(e,t,i){if(qs.isDocument(e)&&(e=e.contents),qs.isNode(e))return e;if(qs.isPair(e)){let p=i.schema[qs.MAP].createNode?.(i.schema,null,i);return p.items.push(e),p}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:o,onTagObj:s,schema:a,sourceObjects:c}=i,d;if(r&&e&&typeof e=="object"){if(d=c.get(e),d)return d.anchor??(d.anchor=o(e)),new K3.Alias(d.anchor);d={anchor:null,node:null},c.set(e,d)}t?.startsWith("!!")&&(t=V3+t.slice(2));let u=H3(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let p=new iN.Scalar(e);return d&&(d.node=p),p}u=e instanceof Map?a[qs.MAP]:Symbol.iterator in Object(e)?a[qs.SEQ]:a[qs.MAP]}s&&(s(u),delete i.onTagObj);let l=u?.createNode?u.createNode(i.schema,e,i):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(i.schema,e,i):new iN.Scalar(e);return t?l.tag=t:u.default||(l.tag=u.tag),d&&(d.node=l),l}rN.createNode=W3});var Uf=B(Mf=>{"use strict";var X3=Xu(),yr=ye(),Q3=jf();function $R(e,t,i){let r=i;for(let o=t.length-1;o>=0;--o){let s=t[o];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let a=[];a[s]=r,r=a}else r=new Map([[s,r]])}return X3.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var oN=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,NR=class extends Q3.NodeBase{constructor(t,i){super(t),Object.defineProperty(this,"schema",{value:i,configurable:!0,enumerable:!1,writable:!0})}clone(t){let i=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(i.schema=t),i.items=i.items.map(r=>yr.isNode(r)||yr.isPair(r)?r.clone(t):r),this.range&&(i.range=this.range.slice()),i}addIn(t,i){if(oN(t))this.add(i);else{let[r,...o]=t,s=this.get(r,!0);if(yr.isCollection(s))s.addIn(o,i);else if(s===void 0&&this.schema)this.set(r,$R(this.schema,o,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}deleteIn(t){let[i,...r]=t;if(r.length===0)return this.delete(i);let o=this.get(i,!0);if(yr.isCollection(o))return o.deleteIn(r);throw new Error(`Expected YAML collection at ${i}. Remaining path: ${r}`)}getIn(t,i){let[r,...o]=t,s=this.get(r,!0);return o.length===0?!i&&yr.isScalar(s)?s.value:s:yr.isCollection(s)?s.getIn(o,i):void 0}hasAllNullValues(t){return this.items.every(i=>{if(!yr.isPair(i))return!1;let r=i.value;return r==null||t&&yr.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[i,...r]=t;if(r.length===0)return this.has(i);let o=this.get(i,!0);return yr.isCollection(o)?o.hasIn(r):!1}setIn(t,i){let[r,...o]=t;if(o.length===0)this.set(r,i);else{let s=this.get(r,!0);if(yr.isCollection(s))s.setIn(o,i);else if(s===void 0&&this.schema)this.set(r,$R(this.schema,o,i));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}};Mf.Collection=NR;Mf.collectionFromPath=$R;Mf.isEmptyPath=oN});var Qu=B(Ff=>{"use strict";var Z3=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function jR(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var J3=(e,t,i)=>e.endsWith(`
|
|
5
|
+
`)?jR(i,t):i.includes(`
|
|
6
|
+
`)?`
|
|
7
|
+
`+jR(i,t):(e.endsWith(" ")?"":" ")+i;Ff.indentComment=jR;Ff.lineComment=J3;Ff.stringifyComment=Z3});var aN=B(Zu=>{"use strict";var Y3="flow",BR="block",qf="quoted";function e7(e,t,i="flow",{indentAtStart:r,lineWidth:o=80,minContentWidth:s=20,onFold:a,onOverflow:c}={}){if(!o||o<0)return e;o<s&&(s=0);let d=Math.max(1+s,1+o-t.length);if(e.length<=d)return e;let u=[],l={},p=o-t.length;typeof r=="number"&&(r>o-Math.max(2,s)?u.push(0):p=o-r);let m,f,g=!1,y=-1,R=-1,A=-1;i===BR&&(y=sN(e,y,t.length),y!==-1&&(p=y+d));for(let _;_=e[y+=1];){if(i===qf&&_==="\\"){switch(R=y,e[y+1]){case"x":y+=3;break;case"u":y+=5;break;case"U":y+=9;break;default:y+=1}A=y}if(_===`
|
|
8
|
+
`)i===BR&&(y=sN(e,y,t.length)),p=y+t.length+d,m=void 0;else{if(_===" "&&f&&f!==" "&&f!==`
|
|
9
|
+
`&&f!==" "){let $=e[y+1];$&&$!==" "&&$!==`
|
|
10
|
+
`&&$!==" "&&(m=y)}if(y>=p)if(m)u.push(m),p=m+d,m=void 0;else if(i===qf){for(;f===" "||f===" ";)f=_,_=e[y+=1],g=!0;let $=y>A+1?y-2:R-1;if(l[$])return e;u.push($),l[$]=!0,p=$+d,m=void 0}else g=!0}f=_}if(g&&c&&c(),u.length===0)return e;a&&a();let D=e.slice(0,u[0]);for(let _=0;_<u.length;++_){let $=u[_],M=u[_+1]||e.length;$===0?D=`
|
|
11
|
+
${t}${e.slice(0,M)}`:(i===qf&&l[$]&&(D+=`${e[$]}\\`),D+=`
|
|
12
|
+
${t}${e.slice($+1,M)}`)}return D}function sN(e,t,i){let r=t,o=t+1,s=e[o];for(;s===" "||s===" ";)if(t<o+i)s=e[++t];else{do s=e[++t];while(s&&s!==`
|
|
13
|
+
`);r=t,o=t+1,s=e[o]}return r}Zu.FOLD_BLOCK=BR;Zu.FOLD_FLOW=Y3;Zu.FOLD_QUOTED=qf;Zu.foldFlowLines=e7});var Yu=B(cN=>{"use strict";var zi=Et(),jo=aN(),Gf=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Kf=e=>/^(%|---|\.\.\.)/m.test(e);function t7(e,t,i){if(!t||t<0)return!1;let r=t-i,o=e.length;if(o<=r)return!1;for(let s=0,a=0;s<o;++s)if(e[s]===`
|
|
14
|
+
`){if(s-a>r)return!0;if(a=s+1,o-a<=r)return!1}return!0}function Ju(e,t){let i=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return i;let{implicitKey:r}=t,o=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(Kf(e)?" ":""),a="",c=0;for(let d=0,u=i[d];u;u=i[++d])if(u===" "&&i[d+1]==="\\"&&i[d+2]==="n"&&(a+=i.slice(c,d)+"\\ ",d+=1,c=d,u="\\"),u==="\\")switch(i[d+1]){case"u":{a+=i.slice(c,d);let l=i.substr(d+2,4);switch(l){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:l.substr(0,2)==="00"?a+="\\x"+l.substr(2):a+=i.substr(d,6)}d+=5,c=d+1}break;case"n":if(r||i[d+2]==='"'||i.length<o)d+=1;else{for(a+=i.slice(c,d)+`
|
|
15
|
+
|
|
16
|
+
`;i[d+2]==="\\"&&i[d+3]==="n"&&i[d+4]!=='"';)a+=`
|
|
17
|
+
`,d+=2;a+=s,i[d+2]===" "&&(a+="\\"),d+=1,c=d+1}break;default:d+=1}return a=c?a+i.slice(c):i,r?a:jo.foldFlowLines(a,s,jo.FOLD_QUOTED,Gf(t,!1))}function MR(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
18
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return Ju(e,t);let i=t.indent||(Kf(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
19
|
+
${i}`)+"'";return t.implicitKey?r:jo.foldFlowLines(r,i,jo.FOLD_FLOW,Gf(t,!1))}function Ic(e,t){let{singleQuote:i}=t.options,r;if(i===!1)r=Ju;else{let o=e.includes('"'),s=e.includes("'");o&&!s?r=MR:s&&!o?r=Ju:r=i?MR:Ju}return r(e,t)}var UR;try{UR=new RegExp(`(^|(?<!
|
|
20
|
+
))
|
|
21
|
+
+(?!
|
|
22
|
+
|$)`,"g")}catch{UR=/\n+(?!\n|$)/g}function zf({comment:e,type:t,value:i},r,o,s){let{blockQuote:a,commentString:c,lineWidth:d}=r.options;if(!a||/\n[\t ]+$/.test(i))return Ic(i,r);let u=r.indent||(r.forceBlockIndent||Kf(i)?" ":""),l=a==="literal"?!0:a==="folded"||t===zi.Scalar.BLOCK_FOLDED?!1:t===zi.Scalar.BLOCK_LITERAL?!0:!t7(i,d,u.length);if(!i)return l?`|
|
|
23
|
+
`:`>
|
|
24
|
+
`;let p,m;for(m=i.length;m>0;--m){let M=i[m-1];if(M!==`
|
|
25
|
+
`&&M!==" "&&M!==" ")break}let f=i.substring(m),g=f.indexOf(`
|
|
26
|
+
`);g===-1?p="-":i===f||g!==f.length-1?(p="+",s&&s()):p="",f&&(i=i.slice(0,-f.length),f[f.length-1]===`
|
|
27
|
+
`&&(f=f.slice(0,-1)),f=f.replace(UR,`$&${u}`));let y=!1,R,A=-1;for(R=0;R<i.length;++R){let M=i[R];if(M===" ")y=!0;else if(M===`
|
|
28
|
+
`)A=R;else break}let D=i.substring(0,A<R?A+1:R);D&&(i=i.substring(D.length),D=D.replace(/\n+/g,`$&${u}`));let $=(y?u?"2":"1":"")+p;if(e&&($+=" "+c(e.replace(/ ?[\r\n]+/g," ")),o&&o()),!l){let M=i.replace(/\n+/g,`
|
|
29
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),G=!1,H=Gf(r,!0);a!=="folded"&&t!==zi.Scalar.BLOCK_FOLDED&&(H.onOverflow=()=>{G=!0});let F=jo.foldFlowLines(`${D}${M}${f}`,u,jo.FOLD_BLOCK,H);if(!G)return`>${$}
|
|
30
|
+
${u}${F}`}return i=i.replace(/\n+/g,`$&${u}`),`|${$}
|
|
31
|
+
${u}${D}${i}${f}`}function n7(e,t,i,r){let{type:o,value:s}=e,{actualString:a,implicitKey:c,indent:d,indentStep:u,inFlow:l}=t;if(c&&s.includes(`
|
|
32
|
+
`)||l&&/[[\]{},]/.test(s))return Ic(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return c||l||!s.includes(`
|
|
33
|
+
`)?Ic(s,t):zf(e,t,i,r);if(!c&&!l&&o!==zi.Scalar.PLAIN&&s.includes(`
|
|
34
|
+
`))return zf(e,t,i,r);if(Kf(s)){if(d==="")return t.forceBlockIndent=!0,zf(e,t,i,r);if(c&&d===u)return Ic(s,t)}let p=s.replace(/\n+/g,`$&
|
|
35
|
+
${d}`);if(a){let m=y=>y.default&&y.tag!=="tag:yaml.org,2002:str"&&y.test?.test(p),{compat:f,tags:g}=t.doc.schema;if(g.some(m)||f?.some(m))return Ic(s,t)}return c?p:jo.foldFlowLines(p,d,jo.FOLD_FLOW,Gf(t,!1))}function i7(e,t,i,r){let{implicitKey:o,inFlow:s}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==zi.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(c=zi.Scalar.QUOTE_DOUBLE);let d=l=>{switch(l){case zi.Scalar.BLOCK_FOLDED:case zi.Scalar.BLOCK_LITERAL:return o||s?Ic(a.value,t):zf(a,t,i,r);case zi.Scalar.QUOTE_DOUBLE:return Ju(a.value,t);case zi.Scalar.QUOTE_SINGLE:return MR(a.value,t);case zi.Scalar.PLAIN:return n7(a,t,i,r);default:return null}},u=d(c);if(u===null){let{defaultKeyType:l,defaultStringType:p}=t.options,m=o&&l||p;if(u=d(m),u===null)throw new Error(`Unsupported default string type ${m}`)}return u}cN.stringifyString=i7});var el=B(FR=>{"use strict";var r7=Nf(),Bo=ye(),o7=Qu(),s7=Yu();function a7(e,t){let i=Object.assign({blockQuote:!0,commentString:o7.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(i.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:i.flowCollectionPadding?" ":"",indent:"",indentStep:typeof i.indent=="number"?" ".repeat(i.indent):" ",inFlow:r,options:i}}function c7(e,t){if(t.tag){let o=e.filter(s=>s.tag===t.tag);if(o.length>0)return o.find(s=>s.format===t.format)??o[0]}let i,r;if(Bo.isScalar(t)){r=t.value;let o=e.filter(s=>s.identify?.(r));if(o.length>1){let s=o.filter(a=>a.test);s.length>0&&(o=s)}i=o.find(s=>s.format===t.format)??o.find(s=>!s.format)}else r=t,i=e.find(o=>o.nodeClass&&r instanceof o.nodeClass);if(!i){let o=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${o} value`)}return i}function d7(e,t,{anchors:i,doc:r}){if(!r.directives)return"";let o=[],s=(Bo.isScalar(e)||Bo.isCollection(e))&&e.anchor;s&&r7.anchorIsValid(s)&&(i.add(s),o.push(`&${s}`));let a=e.tag??(t.default?null:t.tag);return a&&o.push(r.directives.tagString(a)),o.join(" ")}function u7(e,t,i,r){if(Bo.isPair(e))return e.toString(t,i,r);if(Bo.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let o,s=Bo.isNode(e)?e:t.doc.createNode(e,{onTagObj:d=>o=d});o??(o=c7(t.doc.schema.tags,s));let a=d7(s,o,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);let c=typeof o.stringify=="function"?o.stringify(s,t,i,r):Bo.isScalar(s)?s7.stringifyString(s,t,i,r):s.toString(t,i,r);return a?Bo.isScalar(s)||c[0]==="{"||c[0]==="["?`${a} ${c}`:`${a}
|
|
36
|
+
${t.indent}${c}`:c}FR.createStringifyContext=a7;FR.stringify=u7});var pN=B(lN=>{"use strict";var Qr=ye(),dN=Et(),uN=el(),tl=Qu();function l7({key:e,value:t},i,r,o){let{allNullValues:s,doc:a,indent:c,indentStep:d,options:{commentString:u,indentSeq:l,simpleKeys:p}}=i,m=Qr.isNode(e)&&e.comment||null;if(p){if(m)throw new Error("With simple keys, key nodes cannot have comments");if(Qr.isCollection(e)||!Qr.isNode(e)&&typeof e=="object"){let H="With simple keys, collection cannot be used as a key value";throw new Error(H)}}let f=!p&&(!e||m&&t==null&&!i.inFlow||Qr.isCollection(e)||(Qr.isScalar(e)?e.type===dN.Scalar.BLOCK_FOLDED||e.type===dN.Scalar.BLOCK_LITERAL:typeof e=="object"));i=Object.assign({},i,{allNullValues:!1,implicitKey:!f&&(p||!s),indent:c+d});let g=!1,y=!1,R=uN.stringify(e,i,()=>g=!0,()=>y=!0);if(!f&&!i.inFlow&&R.length>1024){if(p)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");f=!0}if(i.inFlow){if(s||t==null)return g&&r&&r(),R===""?"?":f?`? ${R}`:R}else if(s&&!p||t==null&&f)return R=`? ${R}`,m&&!g?R+=tl.lineComment(R,i.indent,u(m)):y&&o&&o(),R;g&&(m=null),f?(m&&(R+=tl.lineComment(R,i.indent,u(m))),R=`? ${R}
|
|
37
|
+
${c}:`):(R=`${R}:`,m&&(R+=tl.lineComment(R,i.indent,u(m))));let A,D,_;Qr.isNode(t)?(A=!!t.spaceBefore,D=t.commentBefore,_=t.comment):(A=!1,D=null,_=null,t&&typeof t=="object"&&(t=a.createNode(t))),i.implicitKey=!1,!f&&!m&&Qr.isScalar(t)&&(i.indentAtStart=R.length+1),y=!1,!l&&d.length>=2&&!i.inFlow&&!f&&Qr.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(i.indent=i.indent.substring(2));let $=!1,M=uN.stringify(t,i,()=>$=!0,()=>y=!0),G=" ";if(m||A||D){if(G=A?`
|
|
38
|
+
`:"",D){let H=u(D);G+=`
|
|
39
|
+
${tl.indentComment(H,i.indent)}`}M===""&&!i.inFlow?G===`
|
|
40
|
+
`&&_&&(G=`
|
|
41
|
+
|
|
42
|
+
`):G+=`
|
|
43
|
+
${i.indent}`}else if(!f&&Qr.isCollection(t)){let H=M[0],F=M.indexOf(`
|
|
44
|
+
`),St=F!==-1,ur=i.inFlow??t.flow??t.items.length===0;if(St||!ur){let z=!1;if(St&&(H==="&"||H==="!")){let Le=M.indexOf(" ");H==="&"&&Le!==-1&&Le<F&&M[Le+1]==="!"&&(Le=M.indexOf(" ",Le+1)),(Le===-1||F<Le)&&(z=!0)}z||(G=`
|
|
45
|
+
${i.indent}`)}}else(M===""||M[0]===`
|
|
46
|
+
`)&&(G="");return R+=G+M,i.inFlow?$&&r&&r():_&&!$?R+=tl.lineComment(R,i.indent,u(_)):y&&o&&o(),R}lN.stringifyPair=l7});var zR=B(qR=>{"use strict";var mN=Wm("process");function p7(e,...t){e==="debug"&&console.log(...t)}function m7(e,t){(e==="debug"||e==="warn")&&(typeof mN.emitWarning=="function"?mN.emitWarning(t):console.warn(t))}qR.debug=p7;qR.warn=m7});var Qf=B(Xf=>{"use strict";var Wf=ye(),fN=Et(),Vf="<<",Hf={identify:e=>e===Vf||typeof e=="symbol"&&e.description===Vf,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new fN.Scalar(Symbol(Vf)),{addToJSMap:gN}),stringify:()=>Vf},f7=(e,t)=>(Hf.identify(t)||Wf.isScalar(t)&&(!t.type||t.type===fN.Scalar.PLAIN)&&Hf.identify(t.value))&&e?.doc.schema.tags.some(i=>i.tag===Hf.tag&&i.default);function gN(e,t,i){let r=SN(e,i);if(Wf.isSeq(r))for(let o of r.items)GR(e,t,o);else if(Array.isArray(r))for(let o of r)GR(e,t,o);else GR(e,t,r)}function GR(e,t,i){let r=SN(e,i);if(!Wf.isMap(r))throw new Error("Merge sources must be maps or map aliases");let o=r.toJSON(null,e,Map);for(let[s,a]of o)t instanceof Map?t.has(s)||t.set(s,a):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function SN(e,t){return e&&Wf.isAlias(t)?t.resolve(e.doc,e):t}Xf.addMergeToJSMap=gN;Xf.isMergeKey=f7;Xf.merge=Hf});var VR=B(IN=>{"use strict";var g7=zR(),yN=Qf(),S7=el(),hN=ye(),KR=$o();function y7(e,t,{key:i,value:r}){if(hN.isNode(i)&&i.addToJSMap)i.addToJSMap(e,t,r);else if(yN.isMergeKey(e,i))yN.addMergeToJSMap(e,t,r);else{let o=KR.toJS(i,"",e);if(t instanceof Map)t.set(o,KR.toJS(r,o,e));else if(t instanceof Set)t.add(o);else{let s=h7(i,o,e),a=KR.toJS(r,s,e);s in t?Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[s]=a}}return t}function h7(e,t,i){if(t===null)return"";if(typeof t!="object")return String(t);if(hN.isNode(e)&&i?.doc){let r=S7.createStringifyContext(i.doc,{});r.anchors=new Set;for(let s of i.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let o=e.toString(r);if(!i.mapKeyWarned){let s=JSON.stringify(o);s.length>40&&(s=s.substring(0,36)+'..."'),g7.warn(i.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),i.mapKeyWarned=!0}return o}return JSON.stringify(t)}IN.addPairToJSMap=y7});var Mo=B(HR=>{"use strict";var bN=Xu(),I7=pN(),b7=VR(),Zf=ye();function R7(e,t,i){let r=bN.createNode(e,void 0,i),o=bN.createNode(t,void 0,i);return new Jf(r,o)}var Jf=class e{constructor(t,i=null){Object.defineProperty(this,Zf.NODE_TYPE,{value:Zf.PAIR}),this.key=t,this.value=i}clone(t){let{key:i,value:r}=this;return Zf.isNode(i)&&(i=i.clone(t)),Zf.isNode(r)&&(r=r.clone(t)),new e(i,r)}toJSON(t,i){let r=i?.mapAsMap?new Map:{};return b7.addPairToJSMap(i,r,this)}toString(t,i,r){return t?.doc?I7.stringifyPair(this,t,i,r):JSON.stringify(this)}};HR.Pair=Jf;HR.createPair=R7});var WR=B(xN=>{"use strict";var zs=ye(),RN=el(),Yf=Qu();function x7(e,t,i){return(t.inFlow??e.flow?P7:E7)(e,t,i)}function E7({comment:e,items:t},i,{blockItemPrefix:r,flowChars:o,itemIndent:s,onChompKeep:a,onComment:c}){let{indent:d,options:{commentString:u}}=i,l=Object.assign({},i,{indent:s,type:null}),p=!1,m=[];for(let g=0;g<t.length;++g){let y=t[g],R=null;if(zs.isNode(y))!p&&y.spaceBefore&&m.push(""),eg(i,m,y.commentBefore,p),y.comment&&(R=y.comment);else if(zs.isPair(y)){let D=zs.isNode(y.key)?y.key:null;D&&(!p&&D.spaceBefore&&m.push(""),eg(i,m,D.commentBefore,p))}p=!1;let A=RN.stringify(y,l,()=>R=null,()=>p=!0);R&&(A+=Yf.lineComment(A,s,u(R))),p&&R&&(p=!1),m.push(r+A)}let f;if(m.length===0)f=o.start+o.end;else{f=m[0];for(let g=1;g<m.length;++g){let y=m[g];f+=y?`
|
|
47
|
+
${d}${y}`:`
|
|
48
|
+
`}}return e?(f+=`
|
|
49
|
+
`+Yf.indentComment(u(e),d),c&&c()):p&&a&&a(),f}function P7({items:e},t,{flowChars:i,itemIndent:r}){let{indent:o,indentStep:s,flowCollectionPadding:a,options:{commentString:c}}=t;r+=s;let d=Object.assign({},t,{indent:r,inFlow:!0,type:null}),u=!1,l=0,p=[];for(let g=0;g<e.length;++g){let y=e[g],R=null;if(zs.isNode(y))y.spaceBefore&&p.push(""),eg(t,p,y.commentBefore,!1),y.comment&&(R=y.comment);else if(zs.isPair(y)){let D=zs.isNode(y.key)?y.key:null;D&&(D.spaceBefore&&p.push(""),eg(t,p,D.commentBefore,!1),D.comment&&(u=!0));let _=zs.isNode(y.value)?y.value:null;_?(_.comment&&(R=_.comment),_.commentBefore&&(u=!0)):y.value==null&&D?.comment&&(R=D.comment)}R&&(u=!0);let A=RN.stringify(y,d,()=>R=null);u||(u=p.length>l||A.includes(`
|
|
50
|
+
`)),g<e.length-1?A+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(u||(u=p.reduce((D,_)=>D+_.length+2,2)+(A.length+2)>t.options.lineWidth)),u&&(A+=",")),R&&(A+=Yf.lineComment(A,r,c(R))),p.push(A),l=p.length}let{start:m,end:f}=i;if(p.length===0)return m+f;if(!u){let g=p.reduce((y,R)=>y+R.length+2,2);u=t.options.lineWidth>0&&g>t.options.lineWidth}if(u){let g=m;for(let y of p)g+=y?`
|
|
51
|
+
${s}${o}${y}`:`
|
|
52
|
+
`;return`${g}
|
|
53
|
+
${o}${f}`}else return`${m}${a}${p.join(" ")}${a}${f}`}function eg({indent:e,options:{commentString:t}},i,r,o){if(r&&o&&(r=r.replace(/^\n+/,"")),r){let s=Yf.indentComment(t(r),e);i.push(s.trimStart())}}xN.stringifyCollection=x7});var Fo=B(QR=>{"use strict";var k7=WR(),v7=VR(),_7=Uf(),Uo=ye(),tg=Mo(),A7=Et();function nl(e,t){let i=Uo.isScalar(t)?t.value:t;for(let r of e)if(Uo.isPair(r)&&(r.key===t||r.key===i||Uo.isScalar(r.key)&&r.key.value===i))return r}var XR=class extends _7.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Uo.MAP,t),this.items=[]}static from(t,i,r){let{keepUndefined:o,replacer:s}=r,a=new this(t),c=(d,u)=>{if(typeof s=="function")u=s.call(i,d,u);else if(Array.isArray(s)&&!s.includes(d))return;(u!==void 0||o)&&a.items.push(tg.createPair(d,u,r))};if(i instanceof Map)for(let[d,u]of i)c(d,u);else if(i&&typeof i=="object")for(let d of Object.keys(i))c(d,i[d]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,i){let r;Uo.isPair(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new tg.Pair(t,t?.value):r=new tg.Pair(t.key,t.value);let o=nl(this.items,r.key),s=this.schema?.sortMapEntries;if(o){if(!i)throw new Error(`Key ${r.key} already set`);Uo.isScalar(o.value)&&A7.isScalarValue(r.value)?o.value.value=r.value:o.value=r.value}else if(s){let a=this.items.findIndex(c=>s(r,c)<0);a===-1?this.items.push(r):this.items.splice(a,0,r)}else this.items.push(r)}delete(t){let i=nl(this.items,t);return i?this.items.splice(this.items.indexOf(i),1).length>0:!1}get(t,i){let o=nl(this.items,t)?.value;return(!i&&Uo.isScalar(o)?o.value:o)??void 0}has(t){return!!nl(this.items,t)}set(t,i){this.add(new tg.Pair(t,i),!0)}toJSON(t,i,r){let o=r?new r:i?.mapAsMap?new Map:{};i?.onCreate&&i.onCreate(o);for(let s of this.items)v7.addPairToJSMap(i,o,s);return o}toString(t,i,r){if(!t)return JSON.stringify(this);for(let o of this.items)if(!Uo.isPair(o))throw new Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),k7.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:i})}};QR.YAMLMap=XR;QR.findPair=nl});var bc=B(PN=>{"use strict";var O7=ye(),EN=Fo(),w7={collection:"map",default:!0,nodeClass:EN.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return O7.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,i)=>EN.YAMLMap.from(e,t,i)};PN.map=w7});var qo=B(kN=>{"use strict";var T7=Xu(),C7=WR(),L7=Uf(),ig=ye(),D7=Et(),$7=$o(),ZR=class extends L7.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(ig.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let i=ng(t);return typeof i!="number"?!1:this.items.splice(i,1).length>0}get(t,i){let r=ng(t);if(typeof r!="number")return;let o=this.items[r];return!i&&ig.isScalar(o)?o.value:o}has(t){let i=ng(t);return typeof i=="number"&&i<this.items.length}set(t,i){let r=ng(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let o=this.items[r];ig.isScalar(o)&&D7.isScalarValue(i)?o.value=i:this.items[r]=i}toJSON(t,i){let r=[];i?.onCreate&&i.onCreate(r);let o=0;for(let s of this.items)r.push($7.toJS(s,String(o++),i));return r}toString(t,i,r){return t?C7.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:i}):JSON.stringify(this)}static from(t,i,r){let{replacer:o}=r,s=new this(t);if(i&&Symbol.iterator in Object(i)){let a=0;for(let c of i){if(typeof o=="function"){let d=i instanceof Set?c:String(a++);c=o.call(i,d,c)}s.items.push(T7.createNode(c,void 0,r))}}return s}};function ng(e){let t=ig.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}kN.YAMLSeq=ZR});var Rc=B(_N=>{"use strict";var N7=ye(),vN=qo(),j7={collection:"seq",default:!0,nodeClass:vN.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return N7.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,i)=>vN.YAMLSeq.from(e,t,i)};_N.seq=j7});var il=B(AN=>{"use strict";var B7=Yu(),M7={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,i,r){return t=Object.assign({actualString:!0},t),B7.stringifyString(e,t,i,r)}};AN.string=M7});var rg=B(TN=>{"use strict";var ON=Et(),wN={identify:e=>e==null,createNode:()=>new ON.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ON.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&wN.test.test(e)?e:t.options.nullStr};TN.nullTag=wN});var JR=B(LN=>{"use strict";var U7=Et(),CN={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new U7.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},i){if(e&&CN.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?i.options.trueStr:i.options.falseStr}};LN.boolTag=CN});var xc=B(DN=>{"use strict";function F7({format:e,minFractionDigits:t,tag:i,value:r}){if(typeof r=="bigint")return String(r);let o=typeof r=="number"?r:Number(r);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!i||i==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let a=s.indexOf(".");a<0&&(a=s.length,s+=".");let c=t-(s.length-a-1);for(;c-- >0;)s+="0"}return s}DN.stringifyNumber=F7});var ex=B(og=>{"use strict";var q7=Et(),YR=xc(),z7={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:YR.stringifyNumber},G7={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():YR.stringifyNumber(e)}},K7={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new q7.Scalar(parseFloat(e)),i=e.indexOf(".");return i!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-i-1),t},stringify:YR.stringifyNumber};og.float=K7;og.floatExp=G7;og.floatNaN=z7});var nx=B(ag=>{"use strict";var $N=xc(),sg=e=>typeof e=="bigint"||Number.isInteger(e),tx=(e,t,i,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),i);function NN(e,t,i){let{value:r}=e;return sg(r)&&r>=0?i+r.toString(t):$N.stringifyNumber(e)}var V7={identify:e=>sg(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,i)=>tx(e,2,8,i),stringify:e=>NN(e,8,"0o")},H7={identify:sg,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,i)=>tx(e,0,10,i),stringify:$N.stringifyNumber},W7={identify:e=>sg(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,i)=>tx(e,2,16,i),stringify:e=>NN(e,16,"0x")};ag.int=H7;ag.intHex=W7;ag.intOct=V7});var BN=B(jN=>{"use strict";var X7=bc(),Q7=rg(),Z7=Rc(),J7=il(),Y7=JR(),ix=ex(),rx=nx(),eee=[X7.map,Z7.seq,J7.string,Q7.nullTag,Y7.boolTag,rx.intOct,rx.int,rx.intHex,ix.floatNaN,ix.floatExp,ix.float];jN.schema=eee});var FN=B(UN=>{"use strict";var tee=Et(),nee=bc(),iee=Rc();function MN(e){return typeof e=="bigint"||Number.isInteger(e)}var cg=({value:e})=>JSON.stringify(e),ree=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:cg},{identify:e=>e==null,createNode:()=>new tee.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:cg},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:cg},{identify:MN,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:i})=>i?BigInt(e):parseInt(e,10),stringify:({value:e})=>MN(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:cg}],oee={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},see=[nee.map,iee.seq].concat(ree,oee);UN.schema=see});var sx=B(qN=>{"use strict";var rl=Wm("buffer"),ox=Et(),aee=Yu(),cee={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof rl.Buffer=="function")return rl.Buffer.from(e,"base64");if(typeof atob=="function"){let i=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(i.length);for(let o=0;o<i.length;++o)r[o]=i.charCodeAt(o);return r}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:i},r,o,s){if(!i)return"";let a=i,c;if(typeof rl.Buffer=="function")c=a instanceof rl.Buffer?a.toString("base64"):rl.Buffer.from(a.buffer).toString("base64");else if(typeof btoa=="function"){let d="";for(let u=0;u<a.length;++u)d+=String.fromCharCode(a[u]);c=btoa(d)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=ox.Scalar.BLOCK_LITERAL),t!==ox.Scalar.QUOTE_DOUBLE){let d=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),u=Math.ceil(c.length/d),l=new Array(u);for(let p=0,m=0;p<u;++p,m+=d)l[p]=c.substr(m,d);c=l.join(t===ox.Scalar.BLOCK_LITERAL?`
|
|
54
|
+
`:" ")}return aee.stringifyString({comment:e,type:t,value:c},r,o,s)}};qN.binary=cee});var lg=B(ug=>{"use strict";var dg=ye(),ax=Mo(),dee=Et(),uee=qo();function zN(e,t){if(dg.isSeq(e))for(let i=0;i<e.items.length;++i){let r=e.items[i];if(!dg.isPair(r)){if(dg.isMap(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let o=r.items[0]||new ax.Pair(new dee.Scalar(null));if(r.commentBefore&&(o.key.commentBefore=o.key.commentBefore?`${r.commentBefore}
|
|
55
|
+
${o.key.commentBefore}`:r.commentBefore),r.comment){let s=o.value??o.key;s.comment=s.comment?`${r.comment}
|
|
56
|
+
${s.comment}`:r.comment}r=o}e.items[i]=dg.isPair(r)?r:new ax.Pair(r)}}else t("Expected a sequence for this tag");return e}function GN(e,t,i){let{replacer:r}=i,o=new uee.YAMLSeq(e);o.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(s++),a));let c,d;if(Array.isArray(a))if(a.length===2)c=a[0],d=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){let u=Object.keys(a);if(u.length===1)c=u[0],d=a[c];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else c=a;o.items.push(ax.createPair(c,d,i))}return o}var lee={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:zN,createNode:GN};ug.createPairs=GN;ug.pairs=lee;ug.resolvePairs=zN});var ux=B(dx=>{"use strict";var KN=ye(),cx=$o(),ol=Fo(),pee=qo(),VN=lg(),Gs=class e extends pee.YAMLSeq{constructor(){super(),this.add=ol.YAMLMap.prototype.add.bind(this),this.delete=ol.YAMLMap.prototype.delete.bind(this),this.get=ol.YAMLMap.prototype.get.bind(this),this.has=ol.YAMLMap.prototype.has.bind(this),this.set=ol.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,i){if(!i)return super.toJSON(t);let r=new Map;i?.onCreate&&i.onCreate(r);for(let o of this.items){let s,a;if(KN.isPair(o)?(s=cx.toJS(o.key,"",i),a=cx.toJS(o.value,s,i)):s=cx.toJS(o,"",i),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,a)}return r}static from(t,i,r){let o=VN.createPairs(t,i,r),s=new this;return s.items=o.items,s}};Gs.tag="tag:yaml.org,2002:omap";var mee={collection:"seq",identify:e=>e instanceof Map,nodeClass:Gs,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let i=VN.resolvePairs(e,t),r=[];for(let{key:o}of i.items)KN.isScalar(o)&&(r.includes(o.value)?t(`Ordered maps must not include duplicate keys: ${o.value}`):r.push(o.value));return Object.assign(new Gs,i)},createNode:(e,t,i)=>Gs.from(e,t,i)};dx.YAMLOMap=Gs;dx.omap=mee});var ZN=B(lx=>{"use strict";var HN=Et();function WN({value:e,source:t},i){return t&&(e?XN:QN).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}var XN={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new HN.Scalar(!0),stringify:WN},QN={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new HN.Scalar(!1),stringify:WN};lx.falseTag=QN;lx.trueTag=XN});var JN=B(pg=>{"use strict";var fee=Et(),px=xc(),gee={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:px.stringifyNumber},See={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():px.stringifyNumber(e)}},yee={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new fee.Scalar(parseFloat(e.replace(/_/g,""))),i=e.indexOf(".");if(i!==-1){let r=e.substring(i+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:px.stringifyNumber};pg.float=yee;pg.floatExp=See;pg.floatNaN=gee});var ej=B(al=>{"use strict";var YN=xc(),sl=e=>typeof e=="bigint"||Number.isInteger(e);function mg(e,t,i,{intAsBigInt:r}){let o=e[0];if((o==="-"||o==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(i){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let a=BigInt(e);return o==="-"?BigInt(-1)*a:a}let s=parseInt(e,i);return o==="-"?-1*s:s}function mx(e,t,i){let{value:r}=e;if(sl(r)){let o=r.toString(t);return r<0?"-"+i+o.substr(1):i+o}return YN.stringifyNumber(e)}var hee={identify:sl,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,i)=>mg(e,2,2,i),stringify:e=>mx(e,2,"0b")},Iee={identify:sl,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,i)=>mg(e,1,8,i),stringify:e=>mx(e,8,"0")},bee={identify:sl,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,i)=>mg(e,0,10,i),stringify:YN.stringifyNumber},Ree={identify:sl,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,i)=>mg(e,2,16,i),stringify:e=>mx(e,16,"0x")};al.int=bee;al.intBin=hee;al.intHex=Ree;al.intOct=Iee});var gx=B(fx=>{"use strict";var Sg=ye(),fg=Mo(),gg=Fo(),Ks=class e extends gg.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let i;Sg.isPair(t)?i=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?i=new fg.Pair(t.key,null):i=new fg.Pair(t,null),gg.findPair(this.items,i.key)||this.items.push(i)}get(t,i){let r=gg.findPair(this.items,t);return!i&&Sg.isPair(r)?Sg.isScalar(r.key)?r.key.value:r.key:r}set(t,i){if(typeof i!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof i}`);let r=gg.findPair(this.items,t);r&&!i?this.items.splice(this.items.indexOf(r),1):!r&&i&&this.items.push(new fg.Pair(t))}toJSON(t,i){return super.toJSON(t,i,Set)}toString(t,i,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),i,r);throw new Error("Set items must all have null values")}static from(t,i,r){let{replacer:o}=r,s=new this(t);if(i&&Symbol.iterator in Object(i))for(let a of i)typeof o=="function"&&(a=o.call(i,a,a)),s.items.push(fg.createPair(a,null,r));return s}};Ks.tag="tag:yaml.org,2002:set";var xee={collection:"map",identify:e=>e instanceof Set,nodeClass:Ks,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,i)=>Ks.from(e,t,i),resolve(e,t){if(Sg.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Ks,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};fx.YAMLSet=Ks;fx.set=xee});var yx=B(yg=>{"use strict";var Eee=xc();function Sx(e,t){let i=e[0],r=i==="-"||i==="+"?e.substring(1):e,o=a=>t?BigInt(a):Number(a),s=r.replace(/_/g,"").split(":").reduce((a,c)=>a*o(60)+o(c),o(0));return i==="-"?o(-1)*s:s}function tj(e){let{value:t}=e,i=a=>a;if(typeof t=="bigint")i=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Eee.stringifyNumber(e);let r="";t<0&&(r="-",t*=i(-1));let o=i(60),s=[t%o];return t<60?s.unshift(0):(t=(t-s[0])/o,s.unshift(t%o),t>=60&&(t=(t-s[0])/o,s.unshift(t))),r+s.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Pee={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:i})=>Sx(e,i),stringify:tj},kee={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Sx(e,!1),stringify:tj},nj={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(nj.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,i,r,o,s,a,c]=t.map(Number),d=t[7]?Number((t[7]+"00").substr(1,3)):0,u=Date.UTC(i,r-1,o,s||0,a||0,c||0,d),l=t[8];if(l&&l!=="Z"){let p=Sx(l,!1);Math.abs(p)<30&&(p*=60),u-=6e4*p}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};yg.floatTime=kee;yg.intTime=Pee;yg.timestamp=nj});var oj=B(rj=>{"use strict";var vee=bc(),_ee=rg(),Aee=Rc(),Oee=il(),wee=sx(),ij=ZN(),hx=JN(),hg=ej(),Tee=Qf(),Cee=ux(),Lee=lg(),Dee=gx(),Ix=yx(),$ee=[vee.map,Aee.seq,Oee.string,_ee.nullTag,ij.trueTag,ij.falseTag,hg.intBin,hg.intOct,hg.int,hg.intHex,hx.floatNaN,hx.floatExp,hx.float,wee.binary,Tee.merge,Cee.omap,Lee.pairs,Dee.set,Ix.intTime,Ix.floatTime,Ix.timestamp];rj.schema=$ee});var gj=B(xx=>{"use strict";var dj=bc(),Nee=rg(),uj=Rc(),jee=il(),Bee=JR(),bx=ex(),Rx=nx(),Mee=BN(),Uee=FN(),lj=sx(),cl=Qf(),pj=ux(),mj=lg(),sj=oj(),fj=gx(),Ig=yx(),aj=new Map([["core",Mee.schema],["failsafe",[dj.map,uj.seq,jee.string]],["json",Uee.schema],["yaml11",sj.schema],["yaml-1.1",sj.schema]]),cj={binary:lj.binary,bool:Bee.boolTag,float:bx.float,floatExp:bx.floatExp,floatNaN:bx.floatNaN,floatTime:Ig.floatTime,int:Rx.int,intHex:Rx.intHex,intOct:Rx.intOct,intTime:Ig.intTime,map:dj.map,merge:cl.merge,null:Nee.nullTag,omap:pj.omap,pairs:mj.pairs,seq:uj.seq,set:fj.set,timestamp:Ig.timestamp},Fee={"tag:yaml.org,2002:binary":lj.binary,"tag:yaml.org,2002:merge":cl.merge,"tag:yaml.org,2002:omap":pj.omap,"tag:yaml.org,2002:pairs":mj.pairs,"tag:yaml.org,2002:set":fj.set,"tag:yaml.org,2002:timestamp":Ig.timestamp};function qee(e,t,i){let r=aj.get(t);if(r&&!e)return i&&!r.includes(cl.merge)?r.concat(cl.merge):r.slice();let o=r;if(!o)if(Array.isArray(e))o=[];else{let s=Array.from(aj.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(let s of e)o=o.concat(s);else typeof e=="function"&&(o=e(o.slice()));return i&&(o=o.concat(cl.merge)),o.reduce((s,a)=>{let c=typeof a=="string"?cj[a]:a;if(!c){let d=JSON.stringify(a),u=Object.keys(cj).map(l=>JSON.stringify(l)).join(", ");throw new Error(`Unknown custom tag ${d}; use one of ${u}`)}return s.includes(c)||s.push(c),s},[])}xx.coreKnownTags=Fee;xx.getTags=qee});var kx=B(Sj=>{"use strict";var Ex=ye(),zee=bc(),Gee=Rc(),Kee=il(),bg=gj(),Vee=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,Px=class e{constructor({compat:t,customTags:i,merge:r,resolveKnownTags:o,schema:s,sortMapEntries:a,toStringDefaults:c}){this.compat=Array.isArray(t)?bg.getTags(t,"compat"):t?bg.getTags(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=o?bg.coreKnownTags:{},this.tags=bg.getTags(i,this.name,r),this.toStringOptions=c??null,Object.defineProperty(this,Ex.MAP,{value:zee.map}),Object.defineProperty(this,Ex.SCALAR,{value:Kee.string}),Object.defineProperty(this,Ex.SEQ,{value:Gee.seq}),this.sortMapEntries=typeof a=="function"?a:a===!0?Vee:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Sj.Schema=Px});var hj=B(yj=>{"use strict";var Hee=ye(),vx=el(),dl=Qu();function Wee(e,t){let i=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let d=e.directives.toString(e);d?(i.push(d),r=!0):e.directives.docStart&&(r=!0)}r&&i.push("---");let o=vx.createStringifyContext(e,t),{commentString:s}=o.options;if(e.commentBefore){i.length!==1&&i.unshift("");let d=s(e.commentBefore);i.unshift(dl.indentComment(d,""))}let a=!1,c=null;if(e.contents){if(Hee.isNode(e.contents)){if(e.contents.spaceBefore&&r&&i.push(""),e.contents.commentBefore){let l=s(e.contents.commentBefore);i.push(dl.indentComment(l,""))}o.forceBlockIndent=!!e.comment,c=e.contents.comment}let d=c?void 0:()=>a=!0,u=vx.stringify(e.contents,o,()=>c=null,d);c&&(u+=dl.lineComment(u,"",s(c))),(u[0]==="|"||u[0]===">")&&i[i.length-1]==="---"?i[i.length-1]=`--- ${u}`:i.push(u)}else i.push(vx.stringify(e.contents,o));if(e.directives?.docEnd)if(e.comment){let d=s(e.comment);d.includes(`
|
|
57
|
+
`)?(i.push("..."),i.push(dl.indentComment(d,""))):i.push(`... ${d}`)}else i.push("...");else{let d=e.comment;d&&a&&(d=d.replace(/^\n+/,"")),d&&((!a||c)&&i[i.length-1]!==""&&i.push(""),i.push(dl.indentComment(s(d),"")))}return i.join(`
|
|
58
|
+
`)+`
|
|
59
|
+
`}yj.stringifyDocument=Wee});var ul=B(Ij=>{"use strict";var Xee=Wu(),Ec=Uf(),gi=ye(),Qee=Mo(),Zee=$o(),Jee=kx(),Yee=hj(),_x=Nf(),ete=TR(),tte=Xu(),Ax=wR(),Ox=class e{constructor(t,i,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,gi.NODE_TYPE,{value:gi.DOC});let o=null;typeof i=="function"||Array.isArray(i)?o=i:r===void 0&&i&&(r=i,i=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:a}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Ax.Directives({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,o,r)}clone(){let t=Object.create(e.prototype,{[gi.NODE_TYPE]:{value:gi.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=gi.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Pc(this.contents)&&this.contents.add(t)}addIn(t,i){Pc(this.contents)&&this.contents.addIn(t,i)}createAlias(t,i){if(!t.anchor){let r=_x.anchorNames(this);t.anchor=!i||r.has(i)?_x.findNewAnchor(i||"a",r):i}return new Xee.Alias(t.anchor)}createNode(t,i,r){let o;if(typeof i=="function")t=i.call({"":t},"",t),o=i;else if(Array.isArray(i)){let R=D=>typeof D=="number"||D instanceof String||D instanceof Number,A=i.filter(R).map(String);A.length>0&&(i=i.concat(A)),o=i}else r===void 0&&i&&(r=i,i=void 0);let{aliasDuplicateObjects:s,anchorPrefix:a,flow:c,keepUndefined:d,onTagObj:u,tag:l}=r??{},{onAnchor:p,setAnchors:m,sourceObjects:f}=_x.createNodeAnchors(this,a||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:d??!1,onAnchor:p,onTagObj:u,replacer:o,schema:this.schema,sourceObjects:f},y=tte.createNode(t,l,g);return c&&gi.isCollection(y)&&(y.flow=!0),m(),y}createPair(t,i,r={}){let o=this.createNode(t,null,r),s=this.createNode(i,null,r);return new Qee.Pair(o,s)}delete(t){return Pc(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Ec.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):Pc(this.contents)?this.contents.deleteIn(t):!1}get(t,i){return gi.isCollection(this.contents)?this.contents.get(t,i):void 0}getIn(t,i){return Ec.isEmptyPath(t)?!i&&gi.isScalar(this.contents)?this.contents.value:this.contents:gi.isCollection(this.contents)?this.contents.getIn(t,i):void 0}has(t){return gi.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return Ec.isEmptyPath(t)?this.contents!==void 0:gi.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,i){this.contents==null?this.contents=Ec.collectionFromPath(this.schema,[t],i):Pc(this.contents)&&this.contents.set(t,i)}setIn(t,i){Ec.isEmptyPath(t)?this.contents=i:this.contents==null?this.contents=Ec.collectionFromPath(this.schema,Array.from(t),i):Pc(this.contents)&&this.contents.setIn(t,i)}setSchema(t,i={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ax.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Ax.Directives({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let o=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${o}`)}}if(i.schema instanceof Object)this.schema=i.schema;else if(r)this.schema=new Jee.Schema(Object.assign(r,i));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:i,mapAsMap:r,maxAliasCount:o,onAnchor:s,reviver:a}={}){let c={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},d=Zee.toJS(this.contents,i??"",c);if(typeof s=="function")for(let{count:u,res:l}of c.anchors.values())s(l,u);return typeof a=="function"?ete.applyReviver(a,{"":d},"",d):d}toJSON(t,i){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:i})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let i=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${i}`)}return Yee.stringifyDocument(this,t)}};function Pc(e){if(gi.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}Ij.Document=Ox});var ml=B(pl=>{"use strict";var ll=class extends Error{constructor(t,i,r,o){super(),this.name=t,this.code=r,this.message=o,this.pos=i}},wx=class extends ll{constructor(t,i,r){super("YAMLParseError",t,i,r)}},Tx=class extends ll{constructor(t,i,r){super("YAMLWarning",t,i,r)}},nte=(e,t)=>i=>{if(i.pos[0]===-1)return;i.linePos=i.pos.map(c=>t.linePos(c));let{line:r,col:o}=i.linePos[0];i.message+=` at line ${r}, column ${o}`;let s=o-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&a.length>80){let c=Math.min(s-39,a.length-79);a="\u2026"+a.substring(c),s-=c-1}if(a.length>80&&(a=a.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(a.substring(0,s))){let c=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);c.length>80&&(c=c.substring(0,79)+`\u2026
|
|
60
|
+
`),a=c+a}if(/[^ ]/.test(a)){let c=1,d=i.linePos[1];d?.line===r&&d.col>o&&(c=Math.max(1,Math.min(d.col-o,80-s)));let u=" ".repeat(s)+"^".repeat(c);i.message+=`:
|
|
61
|
+
|
|
62
|
+
${a}
|
|
63
|
+
${u}
|
|
64
|
+
`}};pl.YAMLError=ll;pl.YAMLParseError=wx;pl.YAMLWarning=Tx;pl.prettifyError=nte});var fl=B(bj=>{"use strict";function ite(e,{flow:t,indicator:i,next:r,offset:o,onError:s,parentIndent:a,startOnNewline:c}){let d=!1,u=c,l=c,p="",m="",f=!1,g=!1,y=null,R=null,A=null,D=null,_=null,$=null,M=null;for(let F of e)switch(g&&(F.type!=="space"&&F.type!=="newline"&&F.type!=="comma"&&s(F.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),y&&(u&&F.type!=="comment"&&F.type!=="newline"&&s(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),y=null),F.type){case"space":!t&&(i!=="doc-start"||r?.type!=="flow-collection")&&F.source.includes(" ")&&(y=F),l=!0;break;case"comment":{l||s(F,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let St=F.source.substring(1)||" ";p?p+=m+St:p=St,m="",u=!1;break}case"newline":u?p?p+=F.source:(!$||i!=="seq-item-ind")&&(d=!0):m+=F.source,u=!0,f=!0,(R||A)&&(D=F),l=!0;break;case"anchor":R&&s(F,"MULTIPLE_ANCHORS","A node can have at most one anchor"),F.source.endsWith(":")&&s(F.offset+F.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),R=F,M??(M=F.offset),u=!1,l=!1,g=!0;break;case"tag":{A&&s(F,"MULTIPLE_TAGS","A node can have at most one tag"),A=F,M??(M=F.offset),u=!1,l=!1,g=!0;break}case i:(R||A)&&s(F,"BAD_PROP_ORDER",`Anchors and tags must be after the ${F.source} indicator`),$&&s(F,"UNEXPECTED_TOKEN",`Unexpected ${F.source} in ${t??"collection"}`),$=F,u=i==="seq-item-ind"||i==="explicit-key-ind",l=!1;break;case"comma":if(t){_&&s(F,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),_=F,u=!1,l=!1;break}default:s(F,"UNEXPECTED_TOKEN",`Unexpected ${F.type} token`),u=!1,l=!1}let G=e[e.length-1],H=G?G.offset+G.source.length:o;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y&&(u&&y.indent<=a||r?.type==="block-map"||r?.type==="block-seq")&&s(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:_,found:$,spaceBefore:d,comment:p,hasNewline:f,anchor:R,tag:A,newlineAfterProp:D,end:H,start:M??H}}bj.resolveProps=ite});var Rg=B(Rj=>{"use strict";function Cx(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
65
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let i of t.start)if(i.type==="newline")return!0;if(t.sep){for(let i of t.sep)if(i.type==="newline")return!0}if(Cx(t.key)||Cx(t.value))return!0}return!1;default:return!0}}Rj.containsNewline=Cx});var Lx=B(xj=>{"use strict";var rte=Rg();function ote(e,t,i){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&rte.containsNewline(t)&&i(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}xj.flowIndentCheck=ote});var Dx=B(Pj=>{"use strict";var Ej=ye();function ste(e,t,i){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let o=typeof r=="function"?r:(s,a)=>s===a||Ej.isScalar(s)&&Ej.isScalar(a)&&s.value===a.value;return t.some(s=>o(s.key,i))}Pj.mapIncludes=ste});var wj=B(Oj=>{"use strict";var kj=Mo(),ate=Fo(),vj=fl(),cte=Rg(),_j=Lx(),dte=Dx(),Aj="All mapping items must start at the same column";function ute({composeNode:e,composeEmptyNode:t},i,r,o,s){let a=s?.nodeClass??ate.YAMLMap,c=new a(i.schema);i.atRoot&&(i.atRoot=!1);let d=r.offset,u=null;for(let l of r.items){let{start:p,key:m,sep:f,value:g}=l,y=vj.resolveProps(p,{indicator:"explicit-key-ind",next:m??f?.[0],offset:d,onError:o,parentIndent:r.indent,startOnNewline:!0}),R=!y.found;if(R){if(m&&(m.type==="block-seq"?o(d,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in m&&m.indent!==r.indent&&o(d,"BAD_INDENT",Aj)),!y.anchor&&!y.tag&&!f){u=y.end,y.comment&&(c.comment?c.comment+=`
|
|
66
|
+
`+y.comment:c.comment=y.comment);continue}(y.newlineAfterProp||cte.containsNewline(m))&&o(m??p[p.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else y.found?.indent!==r.indent&&o(d,"BAD_INDENT",Aj);i.atKey=!0;let A=y.end,D=m?e(i,m,y,o):t(i,A,p,null,y,o);i.schema.compat&&_j.flowIndentCheck(r.indent,m,o),i.atKey=!1,dte.mapIncludes(i,c.items,D)&&o(A,"DUPLICATE_KEY","Map keys must be unique");let _=vj.resolveProps(f??[],{indicator:"map-value-ind",next:g,offset:D.range[2],onError:o,parentIndent:r.indent,startOnNewline:!m||m.type==="block-scalar"});if(d=_.end,_.found){R&&(g?.type==="block-map"&&!_.hasNewline&&o(d,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),i.options.strict&&y.start<_.found.offset-1024&&o(D.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let $=g?e(i,g,_,o):t(i,d,f,null,_,o);i.schema.compat&&_j.flowIndentCheck(r.indent,g,o),d=$.range[2];let M=new kj.Pair(D,$);i.options.keepSourceTokens&&(M.srcToken=l),c.items.push(M)}else{R&&o(D.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),_.comment&&(D.comment?D.comment+=`
|
|
67
|
+
`+_.comment:D.comment=_.comment);let $=new kj.Pair(D);i.options.keepSourceTokens&&($.srcToken=l),c.items.push($)}}return u&&u<d&&o(u,"IMPOSSIBLE","Map comment with trailing content"),c.range=[r.offset,d,u??d],c}Oj.resolveBlockMap=ute});var Cj=B(Tj=>{"use strict";var lte=qo(),pte=fl(),mte=Lx();function fte({composeNode:e,composeEmptyNode:t},i,r,o,s){let a=s?.nodeClass??lte.YAMLSeq,c=new a(i.schema);i.atRoot&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let d=r.offset,u=null;for(let{start:l,value:p}of r.items){let m=pte.resolveProps(l,{indicator:"seq-item-ind",next:p,offset:d,onError:o,parentIndent:r.indent,startOnNewline:!0});if(!m.found)if(m.anchor||m.tag||p)p?.type==="block-seq"?o(m.end,"BAD_INDENT","All sequence items must start at the same column"):o(d,"MISSING_CHAR","Sequence item without - indicator");else{u=m.end,m.comment&&(c.comment=m.comment);continue}let f=p?e(i,p,m,o):t(i,m.end,l,null,m,o);i.schema.compat&&mte.flowIndentCheck(r.indent,p,o),d=f.range[2],c.items.push(f)}return c.range=[r.offset,d,u??d],c}Tj.resolveBlockSeq=fte});var kc=B(Lj=>{"use strict";function gte(e,t,i,r){let o="";if(e){let s=!1,a="";for(let c of e){let{source:d,type:u}=c;switch(u){case"space":s=!0;break;case"comment":{i&&!s&&r(c,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let l=d.substring(1)||" ";o?o+=a+l:o=l,a="";break}case"newline":o&&(a+=d),s=!0;break;default:r(c,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}t+=d.length}}return{comment:o,offset:t}}Lj.resolveEnd=gte});var jj=B(Nj=>{"use strict";var Ste=ye(),yte=Mo(),Dj=Fo(),hte=qo(),Ite=kc(),$j=fl(),bte=Rg(),Rte=Dx(),$x="Block collections are not allowed within flow collections",Nx=e=>e&&(e.type==="block-map"||e.type==="block-seq");function xte({composeNode:e,composeEmptyNode:t},i,r,o,s){let a=r.start.source==="{",c=a?"flow map":"flow sequence",d=s?.nodeClass??(a?Dj.YAMLMap:hte.YAMLSeq),u=new d(i.schema);u.flow=!0;let l=i.atRoot;l&&(i.atRoot=!1),i.atKey&&(i.atKey=!1);let p=r.offset+r.start.source.length;for(let R=0;R<r.items.length;++R){let A=r.items[R],{start:D,key:_,sep:$,value:M}=A,G=$j.resolveProps(D,{flow:c,indicator:"explicit-key-ind",next:_??$?.[0],offset:p,onError:o,parentIndent:r.indent,startOnNewline:!1});if(!G.found){if(!G.anchor&&!G.tag&&!$&&!M){R===0&&G.comma?o(G.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${c}`):R<r.items.length-1&&o(G.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${c}`),G.comment&&(u.comment?u.comment+=`
|
|
68
|
+
`+G.comment:u.comment=G.comment),p=G.end;continue}!a&&i.options.strict&&bte.containsNewline(_)&&o(_,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(R===0)G.comma&&o(G.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${c}`);else if(G.comma||o(G.start,"MISSING_CHAR",`Missing , between ${c} items`),G.comment){let H="";e:for(let F of D)switch(F.type){case"comma":case"space":break;case"comment":H=F.source.substring(1);break e;default:break e}if(H){let F=u.items[u.items.length-1];Ste.isPair(F)&&(F=F.value??F.key),F.comment?F.comment+=`
|
|
69
|
+
`+H:F.comment=H,G.comment=G.comment.substring(H.length+1)}}if(!a&&!$&&!G.found){let H=M?e(i,M,G,o):t(i,G.end,$,null,G,o);u.items.push(H),p=H.range[2],Nx(M)&&o(H.range,"BLOCK_IN_FLOW",$x)}else{i.atKey=!0;let H=G.end,F=_?e(i,_,G,o):t(i,H,D,null,G,o);Nx(_)&&o(F.range,"BLOCK_IN_FLOW",$x),i.atKey=!1;let St=$j.resolveProps($??[],{flow:c,indicator:"map-value-ind",next:M,offset:F.range[2],onError:o,parentIndent:r.indent,startOnNewline:!1});if(St.found){if(!a&&!G.found&&i.options.strict){if($)for(let Le of $){if(Le===St.found)break;if(Le.type==="newline"){o(Le,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}G.start<St.found.offset-1024&&o(St.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else M&&("source"in M&&M.source?.[0]===":"?o(M,"MISSING_CHAR",`Missing space after : in ${c}`):o(St.start,"MISSING_CHAR",`Missing , or : between ${c} items`));let ur=M?e(i,M,St,o):St.found?t(i,St.end,$,null,St,o):null;ur?Nx(M)&&o(ur.range,"BLOCK_IN_FLOW",$x):St.comment&&(F.comment?F.comment+=`
|
|
70
|
+
`+St.comment:F.comment=St.comment);let z=new yte.Pair(F,ur);if(i.options.keepSourceTokens&&(z.srcToken=A),a){let Le=u;Rte.mapIncludes(i,Le.items,F)&&o(H,"DUPLICATE_KEY","Map keys must be unique"),Le.items.push(z)}else{let Le=new Dj.YAMLMap(i.schema);Le.flow=!0,Le.items.push(z);let ML=(ur??F).range;Le.range=[F.range[0],ML[1],ML[2]],u.items.push(Le)}p=ur?ur.range[2]:St.end}}let m=a?"}":"]",[f,...g]=r.end,y=p;if(f?.source===m)y=f.offset+f.source.length;else{let R=c[0].toUpperCase()+c.substring(1),A=l?`${R} must end with a ${m}`:`${R} in block collection must be sufficiently indented and end with a ${m}`;o(p,l?"MISSING_CHAR":"BAD_INDENT",A),f&&f.source.length!==1&&g.unshift(f)}if(g.length>0){let R=Ite.resolveEnd(g,y,i.options.strict,o);R.comment&&(u.comment?u.comment+=`
|
|
71
|
+
`+R.comment:u.comment=R.comment),u.range=[r.offset,y,R.offset]}else u.range=[r.offset,y,y];return u}Nj.resolveFlowCollection=xte});var Mj=B(Bj=>{"use strict";var Ete=ye(),Pte=Et(),kte=Fo(),vte=qo(),_te=wj(),Ate=Cj(),Ote=jj();function jx(e,t,i,r,o,s){let a=i.type==="block-map"?_te.resolveBlockMap(e,t,i,r,s):i.type==="block-seq"?Ate.resolveBlockSeq(e,t,i,r,s):Ote.resolveFlowCollection(e,t,i,r,s),c=a.constructor;return o==="!"||o===c.tagName?(a.tag=c.tagName,a):(o&&(a.tag=o),a)}function wte(e,t,i,r,o){let s=r.tag,a=s?t.directives.tagName(s.source,m=>o(s,"TAG_RESOLVE_FAILED",m)):null;if(i.type==="block-seq"){let{anchor:m,newlineAfterProp:f}=r,g=m&&s?m.offset>s.offset?m:s:m??s;g&&(!f||f.offset<g.offset)&&o(g,"MISSING_CHAR","Missing newline after block sequence props")}let c=i.type==="block-map"?"map":i.type==="block-seq"?"seq":i.start.source==="{"?"map":"seq";if(!s||!a||a==="!"||a===kte.YAMLMap.tagName&&c==="map"||a===vte.YAMLSeq.tagName&&c==="seq")return jx(e,t,i,o,a);let d=t.schema.tags.find(m=>m.tag===a&&m.collection===c);if(!d){let m=t.schema.knownTags[a];if(m?.collection===c)t.schema.tags.push(Object.assign({},m,{default:!1})),d=m;else return m?o(s,"BAD_COLLECTION_TYPE",`${m.tag} used for ${c} collection, but expects ${m.collection??"scalar"}`,!0):o(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),jx(e,t,i,o,a)}let u=jx(e,t,i,o,a,d),l=d.resolve?.(u,m=>o(s,"TAG_RESOLVE_FAILED",m),t.options)??u,p=Ete.isNode(l)?l:new Pte.Scalar(l);return p.range=u.range,p.tag=a,d?.format&&(p.format=d.format),p}Bj.composeCollection=wte});var Mx=B(Uj=>{"use strict";var Bx=Et();function Tte(e,t,i){let r=t.offset,o=Cte(t,e.options.strict,i);if(!o)return{value:"",type:null,comment:"",range:[r,r,r]};let s=o.mode===">"?Bx.Scalar.BLOCK_FOLDED:Bx.Scalar.BLOCK_LITERAL,a=t.source?Lte(t.source):[],c=a.length;for(let y=a.length-1;y>=0;--y){let R=a[y][1];if(R===""||R==="\r")c=y;else break}if(c===0){let y=o.chomp==="+"&&a.length>0?`
|
|
72
|
+
`.repeat(Math.max(1,a.length-1)):"",R=r+o.length;return t.source&&(R+=t.source.length),{value:y,type:s,comment:o.comment,range:[r,R,R]}}let d=t.indent+o.indent,u=t.offset+o.length,l=0;for(let y=0;y<c;++y){let[R,A]=a[y];if(A===""||A==="\r")o.indent===0&&R.length>d&&(d=R.length);else{R.length<d&&i(u+R.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),o.indent===0&&(d=R.length),l=y,d===0&&!e.atRoot&&i(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=R.length+A.length+1}for(let y=a.length-1;y>=c;--y)a[y][0].length>d&&(c=y+1);let p="",m="",f=!1;for(let y=0;y<l;++y)p+=a[y][0].slice(d)+`
|
|
73
|
+
`;for(let y=l;y<c;++y){let[R,A]=a[y];u+=R.length+A.length+1;let D=A[A.length-1]==="\r";if(D&&(A=A.slice(0,-1)),A&&R.length<d){let $=`Block scalar lines must not be less indented than their ${o.indent?"explicit indentation indicator":"first line"}`;i(u-A.length-(D?2:1),"BAD_INDENT",$),R=""}s===Bx.Scalar.BLOCK_LITERAL?(p+=m+R.slice(d)+A,m=`
|
|
74
|
+
`):R.length>d||A[0]===" "?(m===" "?m=`
|
|
75
|
+
`:!f&&m===`
|
|
76
|
+
`&&(m=`
|
|
77
|
+
|
|
78
|
+
`),p+=m+R.slice(d)+A,m=`
|
|
79
|
+
`,f=!0):A===""?m===`
|
|
80
|
+
`?p+=`
|
|
81
|
+
`:m=`
|
|
82
|
+
`:(p+=m+A,m=" ",f=!1)}switch(o.chomp){case"-":break;case"+":for(let y=c;y<a.length;++y)p+=`
|
|
83
|
+
`+a[y][0].slice(d);p[p.length-1]!==`
|
|
84
|
+
`&&(p+=`
|
|
85
|
+
`);break;default:p+=`
|
|
86
|
+
`}let g=r+o.length+t.source.length;return{value:p,type:s,comment:o.comment,range:[r,g,g]}}function Cte({offset:e,props:t},i,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:o}=t[0],s=o[0],a=0,c="",d=-1;for(let m=1;m<o.length;++m){let f=o[m];if(!c&&(f==="-"||f==="+"))c=f;else{let g=Number(f);!a&&g?a=g:d===-1&&(d=e+m)}}d!==-1&&r(d,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${o}`);let u=!1,l="",p=o.length;for(let m=1;m<t.length;++m){let f=t[m];switch(f.type){case"space":u=!0;case"newline":p+=f.source.length;break;case"comment":i&&!u&&r(f,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),p+=f.source.length,l=f.source.substring(1);break;case"error":r(f,"UNEXPECTED_TOKEN",f.message),p+=f.source.length;break;default:{let g=`Unexpected token in block scalar header: ${f.type}`;r(f,"UNEXPECTED_TOKEN",g);let y=f.source;y&&typeof y=="string"&&(p+=y.length)}}}return{mode:s,indent:a,chomp:c,comment:l,length:p}}function Lte(e){let t=e.split(/\n( *)/),i=t[0],r=i.match(/^( *)/),s=[r?.[1]?[r[1],i.slice(r[1].length)]:["",i]];for(let a=1;a<t.length;a+=2)s.push([t[a],t[a+1]]);return s}Uj.resolveBlockScalar=Tte});var Fx=B(qj=>{"use strict";var Ux=Et(),Dte=kc();function $te(e,t,i){let{offset:r,type:o,source:s,end:a}=e,c,d,u=(m,f,g)=>i(r+m,f,g);switch(o){case"scalar":c=Ux.Scalar.PLAIN,d=Nte(s,u);break;case"single-quoted-scalar":c=Ux.Scalar.QUOTE_SINGLE,d=jte(s,u);break;case"double-quoted-scalar":c=Ux.Scalar.QUOTE_DOUBLE,d=Bte(s,u);break;default:return i(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${o}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let l=r+s.length,p=Dte.resolveEnd(a,l,t,i);return{value:d,type:c,comment:p.comment,range:[r,l,p.offset]}}function Nte(e,t){let i="";switch(e[0]){case" ":i="a tab character";break;case",":i="flow indicator character ,";break;case"%":i="directive indicator character %";break;case"|":case">":{i=`block scalar indicator ${e[0]}`;break}case"@":case"`":{i=`reserved character ${e[0]}`;break}}return i&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${i}`),Fj(e)}function jte(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Fj(e.slice(1,-1)).replace(/''/g,"'")}function Fj(e){let t,i;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
87
|
+
`,"sy"),i=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
88
|
+
`,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,i=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let o=r[1],s=" ",a=t.lastIndex;for(i.lastIndex=a;r=i.exec(e);)r[1]===""?s===`
|
|
89
|
+
`?o+=s:s=`
|
|
90
|
+
`:(o+=s+r[1],s=" "),a=i.lastIndex;let c=/[ \t]*(.*)/sy;return c.lastIndex=a,r=c.exec(e),o+s+(r?.[1]??"")}function Bte(e,t){let i="";for(let r=1;r<e.length-1;++r){let o=e[r];if(!(o==="\r"&&e[r+1]===`
|
|
91
|
+
`))if(o===`
|
|
92
|
+
`){let{fold:s,offset:a}=Mte(e,r);i+=s,r=a}else if(o==="\\"){let s=e[++r],a=Ute[s];if(a)i+=a;else if(s===`
|
|
93
|
+
`)for(s=e[r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="\r"&&e[r+1]===`
|
|
94
|
+
`)for(s=e[++r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="x"||s==="u"||s==="U"){let c=s==="x"?2:s==="u"?4:8;i+=Fte(e,r+1,c,t),r+=c}else{let c=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${c}`),i+=c}}else if(o===" "||o===" "){let s=r,a=e[r+1];for(;a===" "||a===" ";)a=e[++r+1];a!==`
|
|
95
|
+
`&&!(a==="\r"&&e[r+2]===`
|
|
96
|
+
`)&&(i+=r>s?e.slice(s,r+1):o)}else i+=o}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),i}function Mte(e,t){let i="",r=e[t+1];for(;(r===" "||r===" "||r===`
|
|
97
|
+
`||r==="\r")&&!(r==="\r"&&e[t+2]!==`
|
|
98
|
+
`);)r===`
|
|
99
|
+
`&&(i+=`
|
|
100
|
+
`),t+=1,r=e[t+1];return i||(i=" "),{fold:i,offset:t}}var Ute={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
101
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Fte(e,t,i,r){let o=e.substr(t,i),a=o.length===i&&/^[0-9a-fA-F]+$/.test(o)?parseInt(o,16):NaN;try{return String.fromCodePoint(a)}catch{let c=e.substr(t-2,i+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${c}`),c}}qj.resolveFlowScalar=$te});var Kj=B(Gj=>{"use strict";var Vs=ye(),zj=Et(),qte=Mx(),zte=Fx();function Gte(e,t,i,r){let{value:o,type:s,comment:a,range:c}=t.type==="block-scalar"?qte.resolveBlockScalar(e,t,r):zte.resolveFlowScalar(t,e.options.strict,r),d=i?e.directives.tagName(i.source,p=>r(i,"TAG_RESOLVE_FAILED",p)):null,u;e.options.stringKeys&&e.atKey?u=e.schema[Vs.SCALAR]:d?u=Kte(e.schema,o,d,i,r):t.type==="scalar"?u=Vte(e,o,t,r):u=e.schema[Vs.SCALAR];let l;try{let p=u.resolve(o,m=>r(i??t,"TAG_RESOLVE_FAILED",m),e.options);l=Vs.isScalar(p)?p:new zj.Scalar(p)}catch(p){let m=p instanceof Error?p.message:String(p);r(i??t,"TAG_RESOLVE_FAILED",m),l=new zj.Scalar(o)}return l.range=c,l.source=o,s&&(l.type=s),d&&(l.tag=d),u.format&&(l.format=u.format),a&&(l.comment=a),l}function Kte(e,t,i,r,o){if(i==="!")return e[Vs.SCALAR];let s=[];for(let c of e.tags)if(!c.collection&&c.tag===i)if(c.default&&c.test)s.push(c);else return c;for(let c of s)if(c.test?.test(t))return c;let a=e.knownTags[i];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(o(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,i!=="tag:yaml.org,2002:str"),e[Vs.SCALAR])}function Vte({atKey:e,directives:t,schema:i},r,o,s){let a=i.tags.find(c=>(c.default===!0||e&&c.default==="key")&&c.test?.test(r))||i[Vs.SCALAR];if(i.compat){let c=i.compat.find(d=>d.default&&d.test?.test(r))??i[Vs.SCALAR];if(a.tag!==c.tag){let d=t.tagString(a.tag),u=t.tagString(c.tag),l=`Value may be parsed as either ${d} or ${u}`;s(o,"TAG_RESOLVE_FAILED",l,!0)}}return a}Gj.composeScalar=Gte});var Hj=B(Vj=>{"use strict";function Hte(e,t,i){if(t){i??(i=t.length);for(let r=i-1;r>=0;--r){let o=t[r];switch(o.type){case"space":case"comment":case"newline":e-=o.source.length;continue}for(o=t[++r];o?.type==="space";)e+=o.source.length,o=t[++r];break}}return e}Vj.emptyScalarPosition=Hte});var Qj=B(zx=>{"use strict";var Wte=Wu(),Xte=ye(),Qte=Mj(),Wj=Kj(),Zte=kc(),Jte=Hj(),Yte={composeNode:Xj,composeEmptyNode:qx};function Xj(e,t,i,r){let o=e.atKey,{spaceBefore:s,comment:a,anchor:c,tag:d}=i,u,l=!0;switch(t.type){case"alias":u=ene(e,t,r),(c||d)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=Wj.composeScalar(e,t,d,r),c&&(u.anchor=c.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=Qte.composeCollection(Yte,e,t,i,r),c&&(u.anchor=c.source.substring(1))}catch(p){let m=p instanceof Error?p.message:String(p);r(t,"RESOURCE_EXHAUSTION",m)}break;default:{let p=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",p),l=!1}}return u??(u=qx(e,t.offset,void 0,null,i,r)),c&&u.anchor===""&&r(c,"BAD_ALIAS","Anchor cannot be an empty string"),o&&e.options.stringKeys&&(!Xte.isScalar(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(d??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&l&&(u.srcToken=t),u}function qx(e,t,i,r,{spaceBefore:o,comment:s,anchor:a,tag:c,end:d},u){let l={type:"scalar",offset:Jte.emptyScalarPosition(t,i,r),indent:-1,source:""},p=Wj.composeScalar(e,l,c,u);return a&&(p.anchor=a.source.substring(1),p.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),o&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=d),p}function ene({options:e},{offset:t,source:i,end:r},o){let s=new Wte.Alias(i.substring(1));s.source===""&&o(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&o(t+i.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let a=t+i.length,c=Zte.resolveEnd(r,a,e.strict,o);return s.range=[t,a,c.offset],c.comment&&(s.comment=c.comment),s}zx.composeEmptyNode=qx;zx.composeNode=Xj});var Yj=B(Jj=>{"use strict";var tne=ul(),Zj=Qj(),nne=kc(),ine=fl();function rne(e,t,{offset:i,start:r,value:o,end:s},a){let c=Object.assign({_directives:t},e),d=new tne.Document(void 0,c),u={atKey:!1,atRoot:!0,directives:d.directives,options:d.options,schema:d.schema},l=ine.resolveProps(r,{indicator:"doc-start",next:o??s?.[0],offset:i,onError:a,parentIndent:0,startOnNewline:!0});l.found&&(d.directives.docStart=!0,o&&(o.type==="block-map"||o.type==="block-seq")&&!l.hasNewline&&a(l.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),d.contents=o?Zj.composeNode(u,o,l,a):Zj.composeEmptyNode(u,l.end,r,null,l,a);let p=d.contents.range[2],m=nne.resolveEnd(s,p,!1,a);return m.comment&&(d.comment=m.comment),d.range=[i,p,m.offset],d}Jj.composeDoc=rne});var Kx=B(nB=>{"use strict";var one=Wm("process"),sne=wR(),ane=ul(),gl=ml(),eB=ye(),cne=Yj(),dne=kc();function Sl(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:i}=e;return[t,t+(typeof i=="string"?i.length:1)]}function tB(e){let t="",i=!1,r=!1;for(let o=0;o<e.length;++o){let s=e[o];switch(s[0]){case"#":t+=(t===""?"":r?`
|
|
102
|
+
|
|
103
|
+
`:`
|
|
104
|
+
`)+(s.substring(1)||" "),i=!0,r=!1;break;case"%":e[o+1]?.[0]!=="#"&&(o+=1),i=!1;break;default:i||(r=!0),i=!1}}return{comment:t,afterEmptyLine:r}}var Gx=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(i,r,o,s)=>{let a=Sl(i);s?this.warnings.push(new gl.YAMLWarning(a,r,o)):this.errors.push(new gl.YAMLParseError(a,r,o))},this.directives=new sne.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,i){let{comment:r,afterEmptyLine:o}=tB(this.prelude);if(r){let s=t.contents;if(i)t.comment=t.comment?`${t.comment}
|
|
105
|
+
${r}`:r;else if(o||t.directives.docStart||!s)t.commentBefore=r;else if(eB.isCollection(s)&&!s.flow&&s.items.length>0){let a=s.items[0];eB.isPair(a)&&(a=a.key);let c=a.commentBefore;a.commentBefore=c?`${r}
|
|
106
|
+
${c}`:r}else{let a=s.commentBefore;s.commentBefore=a?`${r}
|
|
107
|
+
${a}`:r}}if(i){for(let s=0;s<this.errors.length;++s)t.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)t.warnings.push(this.warnings[s])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:tB(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,i=!1,r=-1){for(let o of t)yield*this.next(o);yield*this.end(i,r)}*next(t){switch(one.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(i,r,o)=>{let s=Sl(t);s[0]+=i,this.onError(s,"BAD_DIRECTIVE",r,o)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let i=cne.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!i.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(i,!1),this.doc&&(yield this.doc),this.doc=i,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let i=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new gl.YAMLParseError(Sl(t),"UNEXPECTED_TOKEN",i);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new gl.YAMLParseError(Sl(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let i=dne.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),i.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
108
|
+
${i.comment}`:i.comment}this.doc.range[2]=i.offset;break}default:this.errors.push(new gl.YAMLParseError(Sl(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,i=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),o=new ane.Document(void 0,r);this.atDirectives&&this.onError(i,"MISSING_CHAR","Missing directives-end indicator line"),o.range=[0,i,i],this.decorate(o,!1),yield o}}};nB.Composer=Gx});var oB=B(xg=>{"use strict";var une=Mx(),lne=Fx(),pne=ml(),iB=Yu();function mne(e,t=!0,i){if(e){let r=(o,s,a)=>{let c=typeof o=="number"?o:Array.isArray(o)?o[0]:o.offset;if(i)i(c,s,a);else throw new pne.YAMLParseError([c,c+1],s,a)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return lne.resolveFlowScalar(e,t,r);case"block-scalar":return une.resolveBlockScalar({options:{strict:t}},e,r)}}return null}function fne(e,t){let{implicitKey:i=!1,indent:r,inFlow:o=!1,offset:s=-1,type:a="PLAIN"}=t,c=iB.stringifyString({type:a,value:e},{implicitKey:i,indent:r>0?" ".repeat(r):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}}),d=t.end??[{type:"newline",offset:-1,indent:r,source:`
|
|
109
|
+
`}];switch(c[0]){case"|":case">":{let u=c.indexOf(`
|
|
110
|
+
`),l=c.substring(0,u),p=c.substring(u+1)+`
|
|
111
|
+
`,m=[{type:"block-scalar-header",offset:s,indent:r,source:l}];return rB(m,d)||m.push({type:"newline",offset:-1,indent:r,source:`
|
|
112
|
+
`}),{type:"block-scalar",offset:s,indent:r,props:m,source:p}}case'"':return{type:"double-quoted-scalar",offset:s,indent:r,source:c,end:d};case"'":return{type:"single-quoted-scalar",offset:s,indent:r,source:c,end:d};default:return{type:"scalar",offset:s,indent:r,source:c,end:d}}}function gne(e,t,i={}){let{afterKey:r=!1,implicitKey:o=!1,inFlow:s=!1,type:a}=i,c="indent"in e?e.indent:null;if(r&&typeof c=="number"&&(c+=2),!a)switch(e.type){case"single-quoted-scalar":a="QUOTE_SINGLE";break;case"double-quoted-scalar":a="QUOTE_DOUBLE";break;case"block-scalar":{let u=e.props[0];if(u.type!=="block-scalar-header")throw new Error("Invalid block scalar header");a=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:a="PLAIN"}let d=iB.stringifyString({type:a,value:t},{implicitKey:o||c===null,indent:c!==null&&c>0?" ".repeat(c):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(d[0]){case"|":case">":Sne(e,d);break;case'"':Vx(e,d,"double-quoted-scalar");break;case"'":Vx(e,d,"single-quoted-scalar");break;default:Vx(e,d,"scalar")}}function Sne(e,t){let i=t.indexOf(`
|
|
113
|
+
`),r=t.substring(0,i),o=t.substring(i+1)+`
|
|
114
|
+
`;if(e.type==="block-scalar"){let s=e.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=r,e.source=o}else{let{offset:s}=e,a="indent"in e?e.indent:-1,c=[{type:"block-scalar-header",offset:s,indent:a,source:r}];rB(c,"end"in e?e.end:void 0)||c.push({type:"newline",offset:-1,indent:a,source:`
|
|
115
|
+
`});for(let d of Object.keys(e))d!=="type"&&d!=="offset"&&delete e[d];Object.assign(e,{type:"block-scalar",indent:a,props:c,source:o})}}function rB(e,t){if(t)for(let i of t)switch(i.type){case"space":case"comment":e.push(i);break;case"newline":return e.push(i),!0}return!1}function Vx(e,t,i){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=i,e.source=t;break;case"block-scalar":{let r=e.props.slice(1),o=t.length;e.props[0].type==="block-scalar-header"&&(o-=e.props[0].source.length);for(let s of r)s.offset+=o;delete e.props,Object.assign(e,{type:i,source:t,end:r});break}case"block-map":case"block-seq":{let o={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
116
|
+
`};delete e.items,Object.assign(e,{type:i,source:t,end:[o]});break}default:{let r="indent"in e?e.indent:-1,o="end"in e&&Array.isArray(e.end)?e.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(e))s!=="type"&&s!=="offset"&&delete e[s];Object.assign(e,{type:i,indent:r,source:t,end:o})}}}xg.createScalarToken=fne;xg.resolveAsScalar=mne;xg.setScalarValue=gne});var aB=B(sB=>{"use strict";var yne=e=>"type"in e?Pg(e):Eg(e);function Pg(e){switch(e.type){case"block-scalar":{let t="";for(let i of e.props)t+=Pg(i);return t+e.source}case"block-map":case"block-seq":{let t="";for(let i of e.items)t+=Eg(i);return t}case"flow-collection":{let t=e.start.source;for(let i of e.items)t+=Eg(i);for(let i of e.end)t+=i.source;return t}case"document":{let t=Eg(e);if(e.end)for(let i of e.end)t+=i.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let i of e.end)t+=i.source;return t}}}function Eg({start:e,key:t,sep:i,value:r}){let o="";for(let s of e)o+=s.source;if(t&&(o+=Pg(t)),i)for(let s of i)o+=s.source;return r&&(o+=Pg(r)),o}sB.stringify=yne});var lB=B(uB=>{"use strict";var Hx=Symbol("break visit"),hne=Symbol("skip children"),cB=Symbol("remove item");function Hs(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),dB(Object.freeze([]),e,t)}Hs.BREAK=Hx;Hs.SKIP=hne;Hs.REMOVE=cB;Hs.itemAtPath=(e,t)=>{let i=e;for(let[r,o]of t){let s=i?.[r];if(s&&"items"in s)i=s.items[o];else return}return i};Hs.parentCollection=(e,t)=>{let i=Hs.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],o=i?.[r];if(o&&"items"in o)return o;throw new Error("Parent collection not found")};function dB(e,t,i){let r=i(t,e);if(typeof r=="symbol")return r;for(let o of["key","value"]){let s=t[o];if(s&&"items"in s){for(let a=0;a<s.items.length;++a){let c=dB(Object.freeze(e.concat([[o,a]])),s.items[a],i);if(typeof c=="number")a=c-1;else{if(c===Hx)return Hx;c===cB&&(s.items.splice(a,1),a-=1)}}typeof r=="function"&&o==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}uB.visit=Hs});var kg=B(Pn=>{"use strict";var Wx=oB(),Ine=aB(),bne=lB(),Xx="\uFEFF",Qx="",Zx="",Jx="",Rne=e=>!!e&&"items"in e,xne=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function Ene(e){switch(e){case Xx:return"<BOM>";case Qx:return"<DOC>";case Zx:return"<FLOW_END>";case Jx:return"<SCALAR>";default:return JSON.stringify(e)}}function Pne(e){switch(e){case Xx:return"byte-order-mark";case Qx:return"doc-mode";case Zx:return"flow-error-end";case Jx:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
117
|
+
`:case`\r
|
|
118
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Pn.createScalarToken=Wx.createScalarToken;Pn.resolveAsScalar=Wx.resolveAsScalar;Pn.setScalarValue=Wx.setScalarValue;Pn.stringify=Ine.stringify;Pn.visit=bne.visit;Pn.BOM=Xx;Pn.DOCUMENT=Qx;Pn.FLOW_END=Zx;Pn.SCALAR=Jx;Pn.isCollection=Rne;Pn.isScalar=xne;Pn.prettyToken=Ene;Pn.tokenType=Pne});var tE=B(mB=>{"use strict";var yl=kg();function Gi(e){switch(e){case void 0:case" ":case`
|
|
119
|
+
`:case"\r":case" ":return!0;default:return!1}}var pB=new Set("0123456789ABCDEFabcdef"),kne=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),vg=new Set(",[]{}"),vne=new Set(` ,[]{}
|
|
120
|
+
\r `),Yx=e=>!e||vne.has(e),eE=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,i=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!i;let r=this.next??"stream";for(;r&&(i||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,i=this.buffer[t];for(;i===" "||i===" ";)i=this.buffer[++t];return!i||i==="#"||i===`
|
|
121
|
+
`?!0:i==="\r"?this.buffer[t+1]===`
|
|
122
|
+
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let i=this.buffer[t];if(this.indentNext>0){let r=0;for(;i===" ";)i=this.buffer[++r+t];if(i==="\r"){let o=this.buffer[r+t+1];if(o===`
|
|
123
|
+
`||!o&&!this.atEnd)return t+r+1}return i===`
|
|
124
|
+
`||r>=this.indentNext||!i&&!this.atEnd?t+r:-1}if(i==="-"||i==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&Gi(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
|
125
|
+
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===yl.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let i=t.length,r=t.indexOf("#");for(;r!==-1;){let s=t[r-1];if(s===" "||s===" "){i=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let s=t[i-1];if(s===" "||s===" ")i-=1;else break}let o=(yield*this.pushCount(i))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-o),this.pushNewline(),"stream"}if(this.atLineEnd()){let i=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-i),yield*this.pushNewline(),"stream"}return yield yl.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let i=this.peek(3);if((i==="---"||i==="...")&&Gi(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,i==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Gi(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,i]=this.peek(2);if(!i&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Gi(i)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let i=yield*this.pushIndicators();switch(t[i]){case"#":yield*this.pushCount(t.length-i);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Yx),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return i+=yield*this.parseBlockScalarHeader(),i+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-i),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,i,r=-1;do t=yield*this.pushNewline(),t>0?(i=yield*this.pushSpaces(!1),this.indentValue=r=i):i=0,i+=yield*this.pushSpaces(!0);while(t+i>0);let o=this.getLine();if(o===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&o[0]!=="#"||r===0&&(o.startsWith("---")||o.startsWith("..."))&&Gi(o[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(o[0]==="]"||o[0]==="}")))return this.flowLevel=0,yield yl.FLOW_END,yield*this.parseLineStart();let s=0;for(;o[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),o[s]){case void 0:return"flow";case"#":return yield*this.pushCount(o.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Yx),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||Gi(a)||a===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),i=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;i!==-1&&this.buffer[i+1]==="'";)i=this.buffer.indexOf("'",i+2);else for(;i!==-1;){let s=0;for(;this.buffer[i-1-s]==="\\";)s+=1;if(s%2===0)break;i=this.buffer.indexOf('"',i+1)}let r=this.buffer.substring(0,i),o=r.indexOf(`
|
|
126
|
+
`,this.pos);if(o!==-1){for(;o!==-1;){let s=this.continueScalar(o+1);if(s===-1)break;o=r.indexOf(`
|
|
127
|
+
`,s)}o!==-1&&(i=o-(r[o-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let i=this.buffer[++t];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>Gi(i)||i==="#")}*parseBlockScalar(){let t=this.pos-1,i=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":i+=1;break;case`
|
|
128
|
+
`:t=s,i=0;break;case"\r":{let a=this.buffer[s+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===`
|
|
129
|
+
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(t+1);if(s===-1)break;t=this.buffer.indexOf(`
|
|
130
|
+
`,s)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let o=t+1;for(r=this.buffer[o];r===" ";)r=this.buffer[++o];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
131
|
+
`;)r=this.buffer[++o];t=o-1}else if(!this.blockScalarKeep)do{let s=t-1,a=this.buffer[s];a==="\r"&&(a=this.buffer[--s]);let c=s;for(;a===" ";)a=this.buffer[--s];if(a===`
|
|
132
|
+
`&&s>=this.pos&&s+1+i>c)t=s;else break}while(!0);return yield yl.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,i=this.pos-1,r=this.pos-1,o;for(;o=this.buffer[++r];)if(o===":"){let s=this.buffer[r+1];if(Gi(s)||t&&vg.has(s))break;i=r}else if(Gi(o)){let s=this.buffer[r+1];if(o==="\r"&&(s===`
|
|
133
|
+
`?(r+=1,o=`
|
|
134
|
+
`,s=this.buffer[r+1]):i=r),s==="#"||t&&vg.has(s))break;if(o===`
|
|
135
|
+
`){let a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&vg.has(o))break;i=r}return!o&&!this.atEnd?this.setNext("plain-scalar"):(yield yl.SCALAR,yield*this.pushToIndex(i+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,i){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(i&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Yx),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let i=this.flowLevel>0,r=this.charAt(1);if(Gi(r)||i&&vg.has(r)){i?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,i=this.buffer[t];for(;!Gi(i)&&i!==">";)i=this.buffer[++t];return yield*this.pushToIndex(i===">"?t+1:t,!1)}else{let t=this.pos+1,i=this.buffer[t];for(;i;)if(kne.has(i))i=this.buffer[++t];else if(i==="%"&&pB.has(this.buffer[t+1])&&pB.has(this.buffer[t+2]))i=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
|
|
136
|
+
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
|
137
|
+
`?yield*this.pushCount(2):0}*pushSpaces(t){let i=this.pos-1,r;do r=this.buffer[++i];while(r===" "||t&&r===" ");let o=i-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=i),o}*pushUntil(t){let i=this.pos,r=this.buffer[i];for(;!t(r);)r=this.buffer[++i];return yield*this.pushToIndex(i,!1)}};mB.Lexer=eE});var iE=B(fB=>{"use strict";var nE=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let i=0,r=this.lineStarts.length;for(;i<r;){let s=i+r>>1;this.lineStarts[s]<t?i=s+1:r=s}if(this.lineStarts[i]===t)return{line:i+1,col:1};if(i===0)return{line:0,col:t};let o=this.lineStarts[i-1];return{line:i,col:t-o+1}}}};fB.LineCounter=nE});var oE=B(IB=>{"use strict";var _ne=Wm("process"),gB=kg(),Ane=tE();function zo(e,t){for(let i=0;i<e.length;++i)if(e[i].type===t)return!0;return!1}function SB(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function hB(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function _g(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function vc(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Ag(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let i=0;i<t.length;++i)e.push(t[i])}function yB(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!zo(t.start,"explicit-key-ind")&&!zo(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,hB(t.value)?t.value.end?Ag(t.value.end,t.sep):t.value.end=t.sep:Ag(t.start,t.sep),delete t.sep)}var rE=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ane.Lexer,this.onNewLine=t}*parse(t,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,i))yield*this.next(r);i||(yield*this.end())}*next(t){if(this.source=t,_ne.env.LOG_TOKENS&&console.log("|",gB.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let i=gB.tokenType(t);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let i=t??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{let r=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in r?r.indent:0:i.type==="flow-collection"&&r.type==="document"&&(i.indent=0),i.type==="flow-collection"&&yB(i),r.type){case"document":r.value=i;break;case"block-scalar":r.props.push(i);break;case"block-map":{let o=r.items[r.items.length-1];if(o.value){r.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(o.sep)o.value=i;else{Object.assign(o,{key:i,sep:[]}),this.onKeyLine=!o.explicitKey;return}break}case"block-seq":{let o=r.items[r.items.length-1];o.value?r.items.push({start:[],value:i}):o.value=i;break}case"flow-collection":{let o=r.items[r.items.length-1];!o||o.value?r.items.push({start:[],key:i,sep:[]}):o.sep?o.value=i:Object.assign(o,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){let o=i.items[i.items.length-1];o&&!o.sep&&!o.value&&o.start.length>0&&SB(o.start)===-1&&(i.indent===0||o.start.every(s=>s.type!=="comment"||s.indent<i.indent))&&(r.type==="document"?r.end=o.start:r.items.push({start:o.start}),i.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{SB(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let i=_g(this.peek(2)),r=vc(i),o;t.end?(o=t.end,o.push(this.sourceToken),delete t.end):o=[this.sourceToken];let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let i=this.source.indexOf(`
|
|
138
|
+
`)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
|
|
139
|
+
`,i)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let i=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else if(i.sep)i.sep.push(this.sourceToken);else{if(this.atIndentedComment(i.start,t.indent)){let o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){Ag(o,i.start),o.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,o=r&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind",s=[];if(o&&i.sep&&!i.value){let a=[];for(let c=0;c<i.sep.length;++c){let d=i.sep[c];switch(d.type){case"newline":a.push(c);break;case"space":break;case"comment":d.indent>t.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(s=i.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":o||i.value?(s.push(this.sourceToken),t.items.push({start:s}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):o||i.value?(s.push(this.sourceToken),t.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(i.explicitKey)if(i.sep)if(i.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(zo(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(hB(i.key)&&!zo(i.sep,"newline")){let a=vc(i.start),c=i.key,d=i.sep;d.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:c,sep:d}]})}else s.length>0?i.sep=i.sep.concat(s,this.sourceToken):i.sep.push(this.sourceToken);else if(zo(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{let a=vc(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||o?t.items.push({start:s,key:null,sep:[this.sourceToken]}):zo(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);o||i.value?(t.items.push({start:s,key:a,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(a):(Object.assign(i,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(t);if(a){if(a.type==="block-seq"){if(!i.explicitKey&&i.sep&&!zo(i.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:s});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let i=t.items[t.items.length-1];switch(this.type){case"newline":if(i.value){let r="end"in i.value?i.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,t.indent)){let o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){Ag(o,i.start),o.push(this.sourceToken),t.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=t.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;i.value||zo(i.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let i=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?t.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?t.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);!i||i.value?t.items.push({start:[],key:o,sep:[]}):i.sep?this.stack.push(o):Object.assign(i,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let o=_g(r),s=vc(o);yB(t);let a=t.end.splice(1,t.end.length);a.push(this.sourceToken);let c={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=c}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let i=this.source.indexOf(`
|
|
140
|
+
`)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(`
|
|
141
|
+
`,i)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let i=_g(t),r=vc(i);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let i=_g(t),r=vc(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,i){return this.type!=="comment"||this.indent<=i?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};IB.Parser=rE});var PB=B(Il=>{"use strict";var bB=Kx(),One=ul(),hl=ml(),wne=zR(),Tne=ye(),Cne=iE(),RB=oE();function xB(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Cne.LineCounter||null,prettyErrors:t}}function Lne(e,t={}){let{lineCounter:i,prettyErrors:r}=xB(t),o=new RB.Parser(i?.addNewLine),s=new bB.Composer(t),a=Array.from(s.compose(o.parse(e)));if(r&&i)for(let c of a)c.errors.forEach(hl.prettifyError(e,i)),c.warnings.forEach(hl.prettifyError(e,i));return a.length>0?a:Object.assign([],{empty:!0},s.streamInfo())}function EB(e,t={}){let{lineCounter:i,prettyErrors:r}=xB(t),o=new RB.Parser(i?.addNewLine),s=new bB.Composer(t),a=null;for(let c of s.compose(o.parse(e),!0,e.length))if(!a)a=c;else if(a.options.logLevel!=="silent"){a.errors.push(new hl.YAMLParseError(c.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&i&&(a.errors.forEach(hl.prettifyError(e,i)),a.warnings.forEach(hl.prettifyError(e,i))),a}function Dne(e,t,i){let r;typeof t=="function"?r=t:i===void 0&&t&&typeof t=="object"&&(i=t);let o=EB(e,i);if(!o)return null;if(o.warnings.forEach(s=>wne.warn(o.options.logLevel,s)),o.errors.length>0){if(o.options.logLevel!=="silent")throw o.errors[0];o.errors=[]}return o.toJS(Object.assign({reviver:r},i))}function $ne(e,t,i){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:i===void 0&&t&&(i=t),typeof i=="string"&&(i=i.length),typeof i=="number"){let o=Math.round(i);i=o<1?void 0:o>8?{indent:8}:{indent:o}}if(e===void 0){let{keepUndefined:o}=i??t??{};if(!o)return}return Tne.isDocument(e)&&!r?e.toString(i):new One.Document(e,r,i).toString(i)}Il.parse=Dne;Il.parseAllDocuments=Lne;Il.parseDocument=EB;Il.stringify=$ne});var Zr=B(Oe=>{"use strict";var Nne=Kx(),jne=ul(),Bne=kx(),sE=ml(),Mne=Wu(),Go=ye(),Une=Mo(),Fne=Et(),qne=Fo(),zne=qo(),Gne=kg(),Kne=tE(),Vne=iE(),Hne=oE(),Og=PB(),kB=Gu();Oe.Composer=Nne.Composer;Oe.Document=jne.Document;Oe.Schema=Bne.Schema;Oe.YAMLError=sE.YAMLError;Oe.YAMLParseError=sE.YAMLParseError;Oe.YAMLWarning=sE.YAMLWarning;Oe.Alias=Mne.Alias;Oe.isAlias=Go.isAlias;Oe.isCollection=Go.isCollection;Oe.isDocument=Go.isDocument;Oe.isMap=Go.isMap;Oe.isNode=Go.isNode;Oe.isPair=Go.isPair;Oe.isScalar=Go.isScalar;Oe.isSeq=Go.isSeq;Oe.Pair=Une.Pair;Oe.Scalar=Fne.Scalar;Oe.YAMLMap=qne.YAMLMap;Oe.YAMLSeq=zne.YAMLSeq;Oe.CST=Gne;Oe.Lexer=Kne.Lexer;Oe.LineCounter=Vne.LineCounter;Oe.Parser=Hne.Parser;Oe.parse=Og.parse;Oe.parseAllDocuments=Og.parseAllDocuments;Oe.parseDocument=Og.parseDocument;Oe.stringify=Og.stringify;Oe.visit=kB.visit;Oe.visitAsync=kB.visitAsync});function Xm(e){return J(e)&&globalThis.Symbol.asyncIterator in e}function Qm(e){return J(e)&&globalThis.Symbol.iterator in e}function Fb(e){return J(e)&&(globalThis.Object.getPrototypeOf(e)===Object.prototype||globalThis.Object.getPrototypeOf(e)===null)}function Zm(e){return e instanceof globalThis.Promise}function sn(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function UL(e){return e instanceof globalThis.Map}function FL(e){return e instanceof globalThis.Set}function ci(e){return globalThis.ArrayBuffer.isView(e)}function Za(e){return e instanceof globalThis.Uint8Array}function K(e,t){return t in e}function J(e){return e!==null&&typeof e=="object"}function W(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function We(e){return e===void 0}function Br(e){return e===null}function lr(e){return typeof e=="boolean"}function Xe(e){return typeof e=="number"}function Jm(e){return globalThis.Number.isInteger(e)}function _i(e){return typeof e=="bigint"}function _e(e){return typeof e=="string"}function ko(e){return typeof e=="function"}function Mr(e){return typeof e=="symbol"}function jn(e){return _i(e)||lr(e)||Br(e)||Xe(e)||_e(e)||Mr(e)||We(e)}var bt;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(a,c){return e.ExactOptionalPropertyTypes?c in a:a[c]!==void 0}e.IsExactOptionalProperty=t;function i(a){let c=J(a);return e.AllowArrayObject?c:c&&!W(a)}e.IsObjectLike=i;function r(a){return i(a)&&!(a instanceof Date)&&!(a instanceof Uint8Array)}e.IsRecordLike=r;function o(a){return e.AllowNaN?Xe(a):Number.isFinite(a)}e.IsNumberLike=o;function s(a){let c=We(a);return e.AllowNullVoid?c||a===null:c}e.IsVoidLike=s})(bt||(bt={}));var Bn={};Ht(Bn,{Clear:()=>zX,Delete:()=>GX,Entries:()=>qX,Get:()=>HX,Has:()=>KX,Set:()=>VX});var Ja=new Map;function qX(){return new Map(Ja)}function zX(){return Ja.clear()}function GX(e){return Ja.delete(e)}function KX(e){return Ja.has(e)}function VX(e,t){Ja.set(e,t)}function HX(e){return Ja.get(e)}var Ai={};Ht(Ai,{Clear:()=>XX,Delete:()=>QX,Entries:()=>WX,Get:()=>YX,Has:()=>ZX,Set:()=>JX});var Ya=new Map;function WX(){return new Map(Ya)}function XX(){return Ya.clear()}function QX(e){return Ya.delete(e)}function ZX(e){return Ya.has(e)}function JX(e,t){Ya.set(e,t)}function YX(e){return Ya.get(e)}var Wt={};Ht(Wt,{HasPropertyKey:()=>Ym,IsArray:()=>yt,IsAsyncIterator:()=>qb,IsBigInt:()=>vu,IsBoolean:()=>Ur,IsDate:()=>Ts,IsFunction:()=>zb,IsIterator:()=>Gb,IsNull:()=>Kb,IsNumber:()=>Mn,IsObject:()=>De,IsRegExp:()=>_u,IsString:()=>Fe,IsSymbol:()=>Vb,IsUint8Array:()=>Fr,IsUndefined:()=>ht});function Ym(e,t){return t in e}function qb(e){return De(e)&&!yt(e)&&!Fr(e)&&Symbol.asyncIterator in e}function yt(e){return Array.isArray(e)}function vu(e){return typeof e=="bigint"}function Ur(e){return typeof e=="boolean"}function Ts(e){return e instanceof globalThis.Date}function zb(e){return typeof e=="function"}function Gb(e){return De(e)&&!yt(e)&&!Fr(e)&&Symbol.iterator in e}function Kb(e){return e===null}function Mn(e){return typeof e=="number"}function De(e){return typeof e=="object"&&e!==null}function _u(e){return e instanceof globalThis.RegExp}function Fe(e){return typeof e=="string"}function Vb(e){return typeof e=="symbol"}function Fr(e){return e instanceof globalThis.Uint8Array}function ht(e){return e===void 0}function eQ(e){return globalThis.Object.freeze(e).map(t=>Au(t))}function tQ(e){let t={};for(let i of Object.getOwnPropertyNames(e))t[i]=Au(e[i]);for(let i of Object.getOwnPropertySymbols(e))t[i]=Au(e[i]);return globalThis.Object.freeze(t)}function Au(e){return yt(e)?eQ(e):Ts(e)?e:Fr(e)?e:_u(e)?e:De(e)?tQ(e):e}function nQ(e){return e.map(t=>ef(t))}function iQ(e){return new Date(e.getTime())}function rQ(e){return new Uint8Array(e)}function oQ(e){return new RegExp(e.source,e.flags)}function sQ(e){let t={};for(let i of Object.getOwnPropertyNames(e))t[i]=ef(e[i]);for(let i of Object.getOwnPropertySymbols(e))t[i]=ef(e[i]);return t}function ef(e){return yt(e)?nQ(e):Ts(e)?iQ(e):Fr(e)?rQ(e):_u(e)?oQ(e):De(e)?sQ(e):e}function Qe(e){return ef(e)}function E(e,t){let i=t!==void 0?{...t,...e}:e;switch(bt.InstanceMode){case"freeze":return Au(i);case"clone":return Qe(i);default:return i}}var Ye=Symbol.for("TypeBox.Transform"),Oi=Symbol.for("TypeBox.Readonly"),Bt=Symbol.for("TypeBox.Optional"),di=Symbol.for("TypeBox.Hint"),P=Symbol.for("TypeBox.Kind");function qL(e={}){return E({[P]:e[P]??"Unsafe"},e)}var Q=class extends Error{constructor(t){super(t)}};function fe(e){return E({[P]:"MappedResult",properties:e})}function aQ(e,t){let{[t]:i,...r}=e;return r}function st(e,t){return t.reduce((i,r)=>aQ(i,r),e)}function ec(e,t){return E({[P]:"Array",type:"array",items:e},t)}function tc(e,t){return E({[P]:"AsyncIterator",type:"AsyncIterator",items:e},t)}function nc(e,t,i){return E({[P]:"Constructor",type:"Constructor",parameters:e,returns:t},i)}function pr(e,t,i){return E({[P]:"Function",type:"Function",parameters:e,returns:t},i)}function Ke(e,t,i){return E({[P]:"Computed",target:e,parameters:t},i)}function oe(e){return E({[P]:"Never",not:{}},e)}function ic(e){return De(e)&&e[Oi]==="Readonly"}function yn(e){return De(e)&&e[Bt]==="Optional"}function Hb(e){return ue(e,"Any")}function Wb(e){return ue(e,"Argument")}function wi(e){return ue(e,"Array")}function Cs(e){return ue(e,"AsyncIterator")}function Ls(e){return ue(e,"BigInt")}function qr(e){return ue(e,"Boolean")}function Ti(e){return ue(e,"Computed")}function Ci(e){return ue(e,"Constructor")}function cQ(e){return ue(e,"Date")}function Li(e){return ue(e,"Function")}function Di(e){return ue(e,"Integer")}function at(e){return ue(e,"Intersect")}function Ds(e){return ue(e,"Iterator")}function ue(e,t){return De(e)&&P in e&&e[P]===t}function tf(e){return Ur(e)||Mn(e)||Fe(e)}function Un(e){return ue(e,"Literal")}function Fn(e){return ue(e,"MappedKey")}function Ze(e){return ue(e,"MappedResult")}function vo(e){return ue(e,"Never")}function dQ(e){return ue(e,"Not")}function Ou(e){return ue(e,"Null")}function $i(e){return ue(e,"Number")}function It(e){return ue(e,"Object")}function $s(e){return ue(e,"Promise")}function Ns(e){return ue(e,"Record")}function pt(e){return ue(e,"Ref")}function Xb(e){return ue(e,"RegExp")}function zr(e){return ue(e,"String")}function wu(e){return ue(e,"Symbol")}function qn(e){return ue(e,"TemplateLiteral")}function uQ(e){return ue(e,"This")}function Ie(e){return De(e)&&Ye in e}function zn(e){return ue(e,"Tuple")}function Gr(e){return ue(e,"Undefined")}function pe(e){return ue(e,"Union")}function lQ(e){return ue(e,"Uint8Array")}function pQ(e){return ue(e,"Unknown")}function mQ(e){return ue(e,"Unsafe")}function fQ(e){return ue(e,"Void")}function _o(e){return De(e)&&P in e&&Fe(e[P])}function et(e){return Hb(e)||Wb(e)||wi(e)||qr(e)||Ls(e)||Cs(e)||Ti(e)||Ci(e)||cQ(e)||Li(e)||Di(e)||at(e)||Ds(e)||Un(e)||Fn(e)||Ze(e)||vo(e)||dQ(e)||Ou(e)||$i(e)||It(e)||$s(e)||Ns(e)||pt(e)||Xb(e)||zr(e)||wu(e)||qn(e)||uQ(e)||zn(e)||Gr(e)||pe(e)||lQ(e)||pQ(e)||mQ(e)||fQ(e)||_o(e)}function gQ(e){return E(st(e,[Bt]))}function SQ(e){return E({...e,[Bt]:"Optional"})}function yQ(e,t){return t===!1?gQ(e):SQ(e)}function Xt(e,t){let i=t??!0;return Ze(e)?zL(e,i):yQ(e,i)}function hQ(e,t){let i={};for(let r of globalThis.Object.getOwnPropertyNames(e))i[r]=Xt(e[r],t);return i}function IQ(e,t){return hQ(e.properties,t)}function zL(e,t){let i=IQ(e,t);return fe(i)}function Tu(e,t={}){let i=e.every(o=>It(o)),r=et(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return E(t.unevaluatedProperties===!1||et(t.unevaluatedProperties)||i?{...r,[P]:"Intersect",type:"object",allOf:e}:{...r,[P]:"Intersect",allOf:e},t)}function bQ(e){return e.every(t=>yn(t))}function RQ(e){return st(e,[Bt])}function GL(e){return e.map(t=>yn(t)?RQ(t):t)}function xQ(e,t){return bQ(e)?Xt(Tu(GL(e),t)):Tu(GL(e),t)}function nf(e,t={}){if(e.length===1)return E(e[0],t);if(e.length===0)return oe(t);if(e.some(i=>Ie(i)))throw new Error("Cannot intersect transform types");return xQ(e,t)}function Qt(e,t){if(e.length===1)return E(e[0],t);if(e.length===0)return oe(t);if(e.some(i=>Ie(i)))throw new Error("Cannot intersect transform types");return Tu(e,t)}function Cu(e,t){return E({[P]:"Union",anyOf:e},t)}function EQ(e){return e.some(t=>yn(t))}function KL(e){return e.map(t=>yn(t)?PQ(t):t)}function PQ(e){return st(e,[Bt])}function kQ(e,t){return EQ(e)?Xt(Cu(KL(e),t)):Cu(KL(e),t)}function mr(e,t){return e.length===1?E(e[0],t):e.length===0?oe(t):kQ(e,t)}function be(e,t){return e.length===0?oe(t):e.length===1?E(e[0],t):Cu(e,t)}var rf=class extends Q{};function vQ(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function Qb(e,t,i){return e[t]===i&&e.charCodeAt(t-1)!==92}function Vr(e,t){return Qb(e,t,"(")}function Lu(e,t){return Qb(e,t,")")}function VL(e,t){return Qb(e,t,"|")}function _Q(e){if(!(Vr(e,0)&&Lu(e,e.length-1)))return!1;let t=0;for(let i=0;i<e.length;i++)if(Vr(e,i)&&(t+=1),Lu(e,i)&&(t-=1),t===0&&i!==e.length-1)return!1;return!0}function AQ(e){return e.slice(1,e.length-1)}function OQ(e){let t=0;for(let i=0;i<e.length;i++)if(Vr(e,i)&&(t+=1),Lu(e,i)&&(t-=1),VL(e,i)&&t===0)return!0;return!1}function wQ(e){for(let t=0;t<e.length;t++)if(Vr(e,t))return!0;return!1}function TQ(e){let[t,i]=[0,0],r=[];for(let s=0;s<e.length;s++)if(Vr(e,s)&&(t+=1),Lu(e,s)&&(t-=1),VL(e,s)&&t===0){let a=e.slice(i,s);a.length>0&&r.push(rc(a)),i=s+1}let o=e.slice(i);return o.length>0&&r.push(rc(o)),r.length===0?{type:"const",const:""}:r.length===1?r[0]:{type:"or",expr:r}}function CQ(e){function t(o,s){if(!Vr(o,s))throw new rf("TemplateLiteralParser: Index must point to open parens");let a=0;for(let c=s;c<o.length;c++)if(Vr(o,c)&&(a+=1),Lu(o,c)&&(a-=1),a===0)return[s,c];throw new rf("TemplateLiteralParser: Unclosed group parens in expression")}function i(o,s){for(let a=s;a<o.length;a++)if(Vr(o,a))return[s,a];return[s,o.length]}let r=[];for(let o=0;o<e.length;o++)if(Vr(e,o)){let[s,a]=t(e,o),c=e.slice(s,a+1);r.push(rc(c)),o=a}else{let[s,a]=i(e,o),c=e.slice(s,a);c.length>0&&r.push(rc(c)),o=a-1}return r.length===0?{type:"const",const:""}:r.length===1?r[0]:{type:"and",expr:r}}function rc(e){return _Q(e)?rc(AQ(e)):OQ(e)?TQ(e):wQ(e)?CQ(e):{type:"const",const:vQ(e)}}function oc(e){return rc(e.slice(1,e.length-1))}var Zb=class extends Q{};function LQ(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="0"&&e.expr[1].type==="const"&&e.expr[1].const==="[1-9][0-9]*"}function DQ(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="true"&&e.expr[1].type==="const"&&e.expr[1].const==="false"}function $Q(e){return e.type==="const"&&e.const===".*"}function js(e){return LQ(e)||$Q(e)?!1:DQ(e)?!0:e.type==="and"?e.expr.every(t=>js(t)):e.type==="or"?e.expr.every(t=>js(t)):e.type==="const"?!0:(()=>{throw new Zb("Unknown expression type")})()}function of(e){let t=oc(e.pattern);return js(t)}var Jb=class extends Q{};function*HL(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let i of HL(e.slice(1)))yield`${t}${i}`}function*NQ(e){return yield*HL(e.expr.map(t=>[...Du(t)]))}function*jQ(e){for(let t of e.expr)yield*Du(t)}function*BQ(e){return yield e.const}function*Du(e){return e.type==="and"?yield*NQ(e):e.type==="or"?yield*jQ(e):e.type==="const"?yield*BQ(e):(()=>{throw new Jb("Unknown expression")})()}function sc(e){let t=oc(e.pattern);return js(t)?[...Du(t)]:[]}function le(e,t){return E({[P]:"Literal",const:e,type:typeof e},t)}function sf(e){return E({[P]:"Boolean",type:"boolean"},e)}function ac(e){return E({[P]:"BigInt",type:"bigint"},e)}function ui(e){return E({[P]:"Number",type:"number"},e)}function an(e){return E({[P]:"String",type:"string"},e)}function*MQ(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield sf():t==="number"?yield ui():t==="bigint"?yield ac():t==="string"?yield an():yield(()=>{let i=t.split("|").map(r=>le(r.trim()));return i.length===0?oe():i.length===1?i[0]:mr(i)})()}function*UQ(e){if(e[1]!=="{"){let t=le("$"),i=Yb(e.slice(1));return yield*[t,...i]}for(let t=2;t<e.length;t++)if(e[t]==="}"){let i=MQ(e.slice(2,t)),r=Yb(e.slice(t+1));return yield*[...i,...r]}yield le(e)}function*Yb(e){for(let t=0;t<e.length;t++)if(e[t]==="$"){let i=le(e.slice(0,t)),r=UQ(e.slice(t));return yield*[i,...r]}yield le(e)}function WL(e){return[...Yb(e)]}var eR="(true|false)",$u="(0|[1-9][0-9]*)",tR="(.*)",FQ="(?!.*)",Lve=`^${eR}$`,Ao=`^${$u}$`,Oo=`^${tR}$`,XL=`^${FQ}$`;var nR=class extends Q{};function qQ(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function QL(e,t){return qn(e)?e.pattern.slice(1,e.pattern.length-1):pe(e)?`(${e.anyOf.map(i=>QL(i,t)).join("|")})`:$i(e)?`${t}${$u}`:Di(e)?`${t}${$u}`:Ls(e)?`${t}${$u}`:zr(e)?`${t}${tR}`:Un(e)?`${t}${qQ(e.const.toString())}`:qr(e)?`${t}${eR}`:(()=>{throw new nR(`Unexpected Kind '${e[P]}'`)})()}function iR(e){return`^${e.map(t=>QL(t,"")).join("")}$`}function Bs(e){let i=sc(e).map(r=>le(r));return mr(i)}function af(e,t){let i=Fe(e)?iR(WL(e)):iR(e);return E({[P]:"TemplateLiteral",type:"string",pattern:i},t)}function zQ(e){return sc(e).map(i=>i.toString())}function GQ(e){let t=[];for(let i of e)t.push(...hn(i));return t}function KQ(e){return[e.toString()]}function hn(e){return[...new Set(qn(e)?zQ(e):pe(e)?GQ(e.anyOf):Un(e)?KQ(e.const):$i(e)?["[number]"]:Di(e)?["[number]"]:[])]}function VQ(e,t,i){let r={};for(let o of Object.getOwnPropertyNames(t))r[o]=wo(e,hn(t[o]),i);return r}function HQ(e,t,i){return VQ(e,t.properties,i)}function ZL(e,t,i){let r=HQ(e,t,i);return fe(r)}function YL(e,t){return e.map(i=>eD(i,t))}function WQ(e){return e.filter(t=>!vo(t))}function XQ(e,t){return nf(WQ(YL(e,t)))}function QQ(e){return e.some(t=>vo(t))?[]:e}function ZQ(e,t){return mr(QQ(YL(e,t)))}function JQ(e,t){return t in e?e[t]:t==="[number]"?mr(e):oe()}function YQ(e,t){return t==="[number]"?e:oe()}function eZ(e,t){return t in e?e[t]:oe()}function eD(e,t){return at(e)?XQ(e.allOf,t):pe(e)?ZQ(e.anyOf,t):zn(e)?JQ(e.items??[],t):wi(e)?YQ(e.items,t):It(e)?eZ(e.properties,t):oe()}function Nu(e,t){return t.map(i=>eD(e,i))}function JL(e,t){return mr(Nu(e,t))}function wo(e,t,i){if(pt(e)||pt(t)){let r="Index types using Ref parameters require both Type and Key to be of TSchema";if(!et(e)||!et(t))throw new Q(r);return Ke("Index",[e,t])}return Ze(t)?ZL(e,t,i):Fn(t)?tD(e,t,i):E(et(t)?JL(e,hn(t)):JL(e,t),i)}function tZ(e,t,i){return{[t]:wo(e,[t],Qe(i))}}function nZ(e,t,i){return t.reduce((r,o)=>({...r,...tZ(e,o,i)}),{})}function iZ(e,t,i){return nZ(e,t.keys,i)}function tD(e,t,i){let r=iZ(e,t,i);return fe(r)}function cc(e,t){return E({[P]:"Iterator",type:"Iterator",items:e},t)}function rZ(e){return globalThis.Object.keys(e).filter(t=>!yn(e[t]))}function oZ(e,t){let i=rZ(e),r=i.length>0?{[P]:"Object",type:"object",required:i,properties:e}:{[P]:"Object",type:"object",properties:e};return E(r,t)}var Re=oZ;function cf(e,t){return E({[P]:"Promise",type:"Promise",item:e},t)}function sZ(e){return E(st(e,[Oi]))}function aZ(e){return E({...e,[Oi]:"Readonly"})}function cZ(e,t){return t===!1?sZ(e):aZ(e)}function In(e,t){let i=t??!0;return Ze(e)?nD(e,i):cZ(e,i)}function dZ(e,t){let i={};for(let r of globalThis.Object.getOwnPropertyNames(e))i[r]=In(e[r],t);return i}function uZ(e,t){return dZ(e.properties,t)}function nD(e,t){let i=uZ(e,t);return fe(i)}function li(e,t){return E(e.length>0?{[P]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[P]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function iD(e,t){return e.includes(t)}function rD(e){return[...new Set(e)]}function lZ(e,t){return e.filter(i=>t.includes(i))}function pZ(e,t){return e.reduce((i,r)=>lZ(i,r),t)}function oD(e){return e.length===1?e[0]:e.length>1?pZ(e.slice(1),e[0]):[]}function sD(e){let t=[];for(let i of e)t.push(...i);return t}function aD(e,t){return e in t?pi(e,t[e]):fe(t)}function mZ(e){return{[e]:le(e)}}function fZ(e){let t={};for(let i of e)t[i]=le(i);return t}function gZ(e,t){return iD(t,e)?mZ(e):fZ(t)}function SZ(e,t){let i=gZ(e,t);return aD(e,i)}function ju(e,t){return t.map(i=>pi(e,i))}function yZ(e,t){let i={};for(let r of globalThis.Object.getOwnPropertyNames(t))i[r]=pi(e,t[r]);return i}function pi(e,t){let i={...t};return yn(t)?Xt(pi(e,st(t,[Bt]))):ic(t)?In(pi(e,st(t,[Oi]))):Ze(t)?aD(e,t.properties):Fn(t)?SZ(e,t.keys):Ci(t)?nc(ju(e,t.parameters),pi(e,t.returns),i):Li(t)?pr(ju(e,t.parameters),pi(e,t.returns),i):Cs(t)?tc(pi(e,t.items),i):Ds(t)?cc(pi(e,t.items),i):at(t)?Qt(ju(e,t.allOf),i):pe(t)?be(ju(e,t.anyOf),i):zn(t)?li(ju(e,t.items??[]),i):It(t)?Re(yZ(e,t.properties),i):wi(t)?ec(pi(e,t.items),i):$s(t)?cf(pi(e,t.item),i):t}function hZ(e,t){let i={};for(let r of e)i[r]=pi(r,t);return i}function cD(e,t,i){let r=et(e)?hn(e):e,o=t({[P]:"MappedKey",keys:r}),s=hZ(r,o);return Re(s,i)}function fr(...e){let[t,i]=typeof e[0]=="string"?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!="string")throw new Q("Ref: $ref must be a string");return E({[P]:"Ref",$ref:t},i)}function dD(e){let t=[];for(let i of e)t.push(bn(i));return t}function IZ(e){let t=dD(e);return sD(t)}function bZ(e){let t=dD(e);return oD(t)}function RZ(e){return e.map((t,i)=>i.toString())}function xZ(e){return["[number]"]}function EZ(e){return globalThis.Object.getOwnPropertyNames(e)}function PZ(e){return rR?globalThis.Object.getOwnPropertyNames(e).map(i=>i[0]==="^"&&i[i.length-1]==="$"?i.slice(1,i.length-1):i):[]}function bn(e){return at(e)?IZ(e.allOf):pe(e)?bZ(e.anyOf):zn(e)?RZ(e.items??[]):wi(e)?xZ(e.items):It(e)?EZ(e.properties):Ns(e)?PZ(e.patternProperties):[]}var rR=!1;function dc(e){rR=!0;let t=bn(e);return rR=!1,`^(${t.map(r=>`(${r})`).join("|")})$`}function kZ(e,t){return Ke("KeyOf",[Ke(e,t)])}function vZ(e){return Ke("KeyOf",[fr(e)])}function _Z(e,t){let i=bn(e),r=AZ(i),o=mr(r);return E(o,t)}function AZ(e){return e.map(t=>t==="[number]"?ui():le(t))}function uc(e,t){return Ti(e)?kZ(e.target,e.parameters):pt(e)?vZ(e.$ref):Ze(e)?uD(e,t):_Z(e,t)}function OZ(e,t){let i={};for(let r of globalThis.Object.getOwnPropertyNames(e))i[r]=uc(e[r],Qe(t));return i}function wZ(e,t){return OZ(e.properties,t)}function uD(e,t){let i=wZ(e,t);return fe(i)}function df(e){let t=bn(e),i=Nu(e,t);return t.map((r,o)=>[t[o],i[o]])}function TZ(e){return e.allOf.every(t=>Ms(t))}function CZ(e){return e.anyOf.some(t=>Ms(t))}function LZ(e){return!Ms(e.not)}function Ms(e){return e[P]==="Intersect"?TZ(e):e[P]==="Union"?CZ(e):e[P]==="Not"?LZ(e):e[P]==="Undefined"}function DZ(e){switch(e.errorType){case x.ArrayContains:return"Expected array to contain at least one matching value";case x.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case x.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case x.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case x.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case x.ArrayUniqueItems:return"Expected array elements to be unique";case x.Array:return"Expected array";case x.AsyncIterator:return"Expected AsyncIterator";case x.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case x.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case x.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case x.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case x.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case x.BigInt:return"Expected bigint";case x.Boolean:return"Expected boolean";case x.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case x.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case x.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case x.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case x.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case x.Date:return"Expected Date";case x.Function:return"Expected function";case x.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case x.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case x.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case x.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case x.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case x.Integer:return"Expected integer";case x.IntersectUnevaluatedProperties:return"Unexpected property";case x.Intersect:return"Expected all values to match";case x.Iterator:return"Expected Iterator";case x.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case x.Never:return"Never";case x.Not:return"Value should not match";case x.Null:return"Expected null";case x.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case x.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case x.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case x.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case x.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case x.Number:return"Expected number";case x.Object:return"Expected object";case x.ObjectAdditionalProperties:return"Unexpected property";case x.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case x.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case x.ObjectRequiredProperty:return"Expected required property";case x.Promise:return"Expected Promise";case x.RegExp:return"Expected string to match regular expression";case x.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case x.StringFormat:return`Expected string to match '${e.schema.format}' format`;case x.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case x.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case x.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case x.String:return"Expected string";case x.Symbol:return"Expected symbol";case x.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case x.Tuple:return"Expected tuple";case x.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case x.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case x.Uint8Array:return"Expected Uint8Array";case x.Undefined:return"Expected undefined";case x.Union:return"Expected union value";case x.Void:return"Expected void";case x.Kind:return`Expected kind '${e.schema[P]}'`;default:return"Unknown error type"}}var $Z=DZ;function lD(){return $Z}var oR=class extends Q{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}};function NZ(e,t){let i=t.find(r=>r.$id===e.$ref);if(i===void 0)throw new oR(e);return xe(i,t)}function Tt(e,t){return!_e(e.$id)||t.some(i=>i.$id===e.$id)||t.push(e),t}function xe(e,t){return e[P]==="This"||e[P]==="Ref"?NZ(e,t):e}var sR=class extends Q{constructor(t){super("Unable to hash value"),this.value=t}},Gn;(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(Gn||(Gn={}));var lc=BigInt("14695981039346656037"),[jZ,BZ]=[BigInt("1099511628211"),BigInt("18446744073709551616")],MZ=Array.from({length:256}).map((e,t)=>BigInt(t)),pD=new Float64Array(1),mD=new DataView(pD.buffer),fD=new Uint8Array(pD.buffer);function*UZ(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let i=0;i<t;i++)yield e>>8*(t-1-i)&255}function FZ(e){Zt(Gn.Array);for(let t of e)pc(t)}function qZ(e){Zt(Gn.Boolean),Zt(e?1:0)}function zZ(e){Zt(Gn.BigInt),mD.setBigInt64(0,e);for(let t of fD)Zt(t)}function GZ(e){Zt(Gn.Date),pc(e.getTime())}function KZ(e){Zt(Gn.Null)}function VZ(e){Zt(Gn.Number),mD.setFloat64(0,e);for(let t of fD)Zt(t)}function HZ(e){Zt(Gn.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())pc(t),pc(e[t])}function WZ(e){Zt(Gn.String);for(let t=0;t<e.length;t++)for(let i of UZ(e.charCodeAt(t)))Zt(i)}function XZ(e){Zt(Gn.Symbol),pc(e.description)}function QZ(e){Zt(Gn.Uint8Array);for(let t=0;t<e.length;t++)Zt(e[t])}function ZZ(e){return Zt(Gn.Undefined)}function pc(e){if(W(e))return FZ(e);if(lr(e))return qZ(e);if(_i(e))return zZ(e);if(sn(e))return GZ(e);if(Br(e))return KZ(e);if(Xe(e))return VZ(e);if(J(e))return HZ(e);if(_e(e))return WZ(e);if(Mr(e))return XZ(e);if(Za(e))return QZ(e);if(We(e))return ZZ(e);throw new sR(e)}function Zt(e){lc=lc^MZ[e],lc=lc*jZ%BZ}function mc(e){return lc=BigInt("14695981039346656037"),pc(e),lc}function To(e){return E({[P]:"Any"},e)}function Ni(e){return E({[P]:"Unknown"},e)}var h={};Ht(h,{IsAny:()=>hD,IsArgument:()=>ID,IsArray:()=>bD,IsAsyncIterator:()=>RD,IsBigInt:()=>xD,IsBoolean:()=>ED,IsComputed:()=>PD,IsConstructor:()=>kD,IsDate:()=>vD,IsFunction:()=>_D,IsImport:()=>iJ,IsInteger:()=>AD,IsIntersect:()=>OD,IsIterator:()=>wD,IsKind:()=>n$,IsKindOf:()=>ae,IsLiteral:()=>Mu,IsLiteralBoolean:()=>rJ,IsLiteralNumber:()=>CD,IsLiteralString:()=>TD,IsLiteralValue:()=>LD,IsMappedKey:()=>DD,IsMappedResult:()=>$D,IsNever:()=>ND,IsNot:()=>jD,IsNull:()=>BD,IsNumber:()=>MD,IsObject:()=>UD,IsOptional:()=>nJ,IsPromise:()=>FD,IsProperties:()=>uf,IsReadonly:()=>tJ,IsRecord:()=>qD,IsRecursive:()=>oJ,IsRef:()=>zD,IsRegExp:()=>GD,IsSchema:()=>Ct,IsString:()=>KD,IsSymbol:()=>VD,IsTemplateLiteral:()=>HD,IsThis:()=>WD,IsTransform:()=>XD,IsTuple:()=>QD,IsUint8Array:()=>JD,IsUndefined:()=>ZD,IsUnion:()=>uR,IsUnionLiteral:()=>sJ,IsUnknown:()=>YD,IsUnsafe:()=>e$,IsVoid:()=>t$,TypeGuardUnknownTypeError:()=>aR});var aR=class extends Q{},JZ=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function gD(e){try{return new RegExp(e),!0}catch{return!1}}function cR(e){if(!Fe(e))return!1;for(let t=0;t<e.length;t++){let i=e.charCodeAt(t);if(i>=7&&i<=13||i===27||i===127)return!1}return!0}function SD(e){return dR(e)||Ct(e)}function Bu(e){return ht(e)||vu(e)}function qe(e){return ht(e)||Mn(e)}function dR(e){return ht(e)||Ur(e)}function $e(e){return ht(e)||Fe(e)}function YZ(e){return ht(e)||Fe(e)&&cR(e)&&gD(e)}function eJ(e){return ht(e)||Fe(e)&&cR(e)}function yD(e){return ht(e)||Ct(e)}function tJ(e){return De(e)&&e[Oi]==="Readonly"}function nJ(e){return De(e)&&e[Bt]==="Optional"}function hD(e){return ae(e,"Any")&&$e(e.$id)}function ID(e){return ae(e,"Argument")&&Mn(e.index)}function bD(e){return ae(e,"Array")&&e.type==="array"&&$e(e.$id)&&Ct(e.items)&&qe(e.minItems)&&qe(e.maxItems)&&dR(e.uniqueItems)&&yD(e.contains)&&qe(e.minContains)&&qe(e.maxContains)}function RD(e){return ae(e,"AsyncIterator")&&e.type==="AsyncIterator"&&$e(e.$id)&&Ct(e.items)}function xD(e){return ae(e,"BigInt")&&e.type==="bigint"&&$e(e.$id)&&Bu(e.exclusiveMaximum)&&Bu(e.exclusiveMinimum)&&Bu(e.maximum)&&Bu(e.minimum)&&Bu(e.multipleOf)}function ED(e){return ae(e,"Boolean")&&e.type==="boolean"&&$e(e.$id)}function PD(e){return ae(e,"Computed")&&Fe(e.target)&&yt(e.parameters)&&e.parameters.every(t=>Ct(t))}function kD(e){return ae(e,"Constructor")&&e.type==="Constructor"&&$e(e.$id)&&yt(e.parameters)&&e.parameters.every(t=>Ct(t))&&Ct(e.returns)}function vD(e){return ae(e,"Date")&&e.type==="Date"&&$e(e.$id)&&qe(e.exclusiveMaximumTimestamp)&&qe(e.exclusiveMinimumTimestamp)&&qe(e.maximumTimestamp)&&qe(e.minimumTimestamp)&&qe(e.multipleOfTimestamp)}function _D(e){return ae(e,"Function")&&e.type==="Function"&&$e(e.$id)&&yt(e.parameters)&&e.parameters.every(t=>Ct(t))&&Ct(e.returns)}function iJ(e){return ae(e,"Import")&&Ym(e,"$defs")&&De(e.$defs)&&uf(e.$defs)&&Ym(e,"$ref")&&Fe(e.$ref)&&e.$ref in e.$defs}function AD(e){return ae(e,"Integer")&&e.type==="integer"&&$e(e.$id)&&qe(e.exclusiveMaximum)&&qe(e.exclusiveMinimum)&&qe(e.maximum)&&qe(e.minimum)&&qe(e.multipleOf)}function uf(e){return De(e)&&Object.entries(e).every(([t,i])=>cR(t)&&Ct(i))}function OD(e){return ae(e,"Intersect")&&!(Fe(e.type)&&e.type!=="object")&&yt(e.allOf)&&e.allOf.every(t=>Ct(t)&&!XD(t))&&$e(e.type)&&(dR(e.unevaluatedProperties)||yD(e.unevaluatedProperties))&&$e(e.$id)}function wD(e){return ae(e,"Iterator")&&e.type==="Iterator"&&$e(e.$id)&&Ct(e.items)}function ae(e,t){return De(e)&&P in e&&e[P]===t}function TD(e){return Mu(e)&&Fe(e.const)}function CD(e){return Mu(e)&&Mn(e.const)}function rJ(e){return Mu(e)&&Ur(e.const)}function Mu(e){return ae(e,"Literal")&&$e(e.$id)&&LD(e.const)}function LD(e){return Ur(e)||Mn(e)||Fe(e)}function DD(e){return ae(e,"MappedKey")&&yt(e.keys)&&e.keys.every(t=>Mn(t)||Fe(t))}function $D(e){return ae(e,"MappedResult")&&uf(e.properties)}function ND(e){return ae(e,"Never")&&De(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function jD(e){return ae(e,"Not")&&Ct(e.not)}function BD(e){return ae(e,"Null")&&e.type==="null"&&$e(e.$id)}function MD(e){return ae(e,"Number")&&e.type==="number"&&$e(e.$id)&&qe(e.exclusiveMaximum)&&qe(e.exclusiveMinimum)&&qe(e.maximum)&&qe(e.minimum)&&qe(e.multipleOf)}function UD(e){return ae(e,"Object")&&e.type==="object"&&$e(e.$id)&&uf(e.properties)&&SD(e.additionalProperties)&&qe(e.minProperties)&&qe(e.maxProperties)}function FD(e){return ae(e,"Promise")&&e.type==="Promise"&&$e(e.$id)&&Ct(e.item)}function qD(e){return ae(e,"Record")&&e.type==="object"&&$e(e.$id)&&SD(e.additionalProperties)&&De(e.patternProperties)&&(t=>{let i=Object.getOwnPropertyNames(t.patternProperties);return i.length===1&&gD(i[0])&&De(t.patternProperties)&&Ct(t.patternProperties[i[0]])})(e)}function oJ(e){return De(e)&&di in e&&e[di]==="Recursive"}function zD(e){return ae(e,"Ref")&&$e(e.$id)&&Fe(e.$ref)}function GD(e){return ae(e,"RegExp")&&$e(e.$id)&&Fe(e.source)&&Fe(e.flags)&&qe(e.maxLength)&&qe(e.minLength)}function KD(e){return ae(e,"String")&&e.type==="string"&&$e(e.$id)&&qe(e.minLength)&&qe(e.maxLength)&&YZ(e.pattern)&&eJ(e.format)}function VD(e){return ae(e,"Symbol")&&e.type==="symbol"&&$e(e.$id)}function HD(e){return ae(e,"TemplateLiteral")&&e.type==="string"&&Fe(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function WD(e){return ae(e,"This")&&$e(e.$id)&&Fe(e.$ref)}function XD(e){return De(e)&&Ye in e}function QD(e){return ae(e,"Tuple")&&e.type==="array"&&$e(e.$id)&&Mn(e.minItems)&&Mn(e.maxItems)&&e.minItems===e.maxItems&&(ht(e.items)&&ht(e.additionalItems)&&e.minItems===0||yt(e.items)&&e.items.every(t=>Ct(t)))}function ZD(e){return ae(e,"Undefined")&&e.type==="undefined"&&$e(e.$id)}function sJ(e){return uR(e)&&e.anyOf.every(t=>TD(t)||CD(t))}function uR(e){return ae(e,"Union")&&$e(e.$id)&&De(e)&&yt(e.anyOf)&&e.anyOf.every(t=>Ct(t))}function JD(e){return ae(e,"Uint8Array")&&e.type==="Uint8Array"&&$e(e.$id)&&qe(e.minByteLength)&&qe(e.maxByteLength)}function YD(e){return ae(e,"Unknown")&&$e(e.$id)}function e$(e){return ae(e,"Unsafe")}function t$(e){return ae(e,"Void")&&e.type==="void"&&$e(e.$id)}function n$(e){return De(e)&&P in e&&Fe(e[P])&&!JZ.includes(e[P])}function Ct(e){return De(e)&&(hD(e)||ID(e)||bD(e)||ED(e)||xD(e)||RD(e)||PD(e)||kD(e)||vD(e)||_D(e)||AD(e)||OD(e)||wD(e)||Mu(e)||DD(e)||$D(e)||ND(e)||jD(e)||BD(e)||MD(e)||UD(e)||FD(e)||qD(e)||zD(e)||GD(e)||KD(e)||VD(e)||HD(e)||WD(e)||QD(e)||ZD(e)||uR(e)||JD(e)||YD(e)||e$(e)||t$(e)||n$(e))}var pR=class extends Q{},k;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(k||(k={}));function mi(e){return e===k.False?e:k.True}function fc(e){throw new pR(e)}function Rt(e){return h.IsNever(e)||h.IsIntersect(e)||h.IsUnion(e)||h.IsUnknown(e)||h.IsAny(e)}function xt(e,t){return h.IsNever(t)?d$(e,t):h.IsIntersect(t)?lf(e,t):h.IsUnion(t)?SR(e,t):h.IsUnknown(t)?m$(e,t):h.IsAny(t)?gR(e,t):fc("StructuralRight")}function gR(e,t){return k.True}function aJ(e,t){return h.IsIntersect(t)?lf(e,t):h.IsUnion(t)&&t.anyOf.some(i=>h.IsAny(i)||h.IsUnknown(i))?k.True:h.IsUnion(t)?k.Union:h.IsUnknown(t)||h.IsAny(t)?k.True:k.Union}function cJ(e,t){return h.IsUnknown(e)?k.False:h.IsAny(e)?k.Union:h.IsNever(e)?k.True:k.False}function dJ(e,t){return h.IsObject(t)&&pf(t)?k.True:Rt(t)?xt(e,t):h.IsArray(t)?mi(Ne(e.items,t.items)):k.False}function uJ(e,t){return Rt(t)?xt(e,t):h.IsAsyncIterator(t)?mi(Ne(e.items,t.items)):k.False}function lJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?fi(e,t):h.IsBigInt(t)?k.True:k.False}function a$(e,t){return h.IsLiteralBoolean(e)||h.IsBoolean(e)?k.True:k.False}function pJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?fi(e,t):h.IsBoolean(t)?k.True:k.False}function mJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsConstructor(t)?e.parameters.length>t.parameters.length?k.False:e.parameters.every((i,r)=>mi(Ne(t.parameters[r],i))===k.True)?mi(Ne(e.returns,t.returns)):k.False:k.False}function fJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?fi(e,t):h.IsDate(t)?k.True:k.False}function gJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsFunction(t)?e.parameters.length>t.parameters.length?k.False:e.parameters.every((i,r)=>mi(Ne(t.parameters[r],i))===k.True)?mi(Ne(e.returns,t.returns)):k.False:k.False}function c$(e,t){return h.IsLiteral(e)&&Wt.IsNumber(e.const)||h.IsNumber(e)||h.IsInteger(e)?k.True:k.False}function SJ(e,t){return h.IsInteger(t)||h.IsNumber(t)?k.True:Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?fi(e,t):k.False}function lf(e,t){return t.allOf.every(i=>Ne(e,i)===k.True)?k.True:k.False}function yJ(e,t){return e.allOf.some(i=>Ne(i,t)===k.True)?k.True:k.False}function hJ(e,t){return Rt(t)?xt(e,t):h.IsIterator(t)?mi(Ne(e.items,t.items)):k.False}function IJ(e,t){return h.IsLiteral(t)&&t.const===e.const?k.True:Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?fi(e,t):h.IsString(t)?p$(e,t):h.IsNumber(t)?u$(e,t):h.IsInteger(t)?c$(e,t):h.IsBoolean(t)?a$(e,t):k.False}function d$(e,t){return k.False}function bJ(e,t){return k.True}function i$(e){let[t,i]=[e,0];for(;h.IsNot(t);)t=t.not,i+=1;return i%2===0?t:Ni()}function RJ(e,t){return h.IsNot(e)?Ne(i$(e),t):h.IsNot(t)?Ne(e,i$(t)):fc("Invalid fallthrough for Not")}function xJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?fi(e,t):h.IsNull(t)?k.True:k.False}function u$(e,t){return h.IsLiteralNumber(e)||h.IsNumber(e)||h.IsInteger(e)?k.True:k.False}function EJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?fi(e,t):h.IsInteger(t)||h.IsNumber(t)?k.True:k.False}function Rn(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function r$(e){return pf(e)}function o$(e){return Rn(e,0)||Rn(e,1)&&"description"in e.properties&&h.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(h.IsString(e.properties.description.anyOf[0])&&h.IsUndefined(e.properties.description.anyOf[1])||h.IsString(e.properties.description.anyOf[1])&&h.IsUndefined(e.properties.description.anyOf[0]))}function lR(e){return Rn(e,0)}function s$(e){return Rn(e,0)}function PJ(e){return Rn(e,0)}function kJ(e){return Rn(e,0)}function vJ(e){return pf(e)}function _J(e){let t=ui();return Rn(e,0)||Rn(e,1)&&"length"in e.properties&&mi(Ne(e.properties.length,t))===k.True}function AJ(e){return Rn(e,0)}function pf(e){let t=ui();return Rn(e,0)||Rn(e,1)&&"length"in e.properties&&mi(Ne(e.properties.length,t))===k.True}function OJ(e){let t=pr([To()],To());return Rn(e,0)||Rn(e,1)&&"then"in e.properties&&mi(Ne(e.properties.then,t))===k.True}function l$(e,t){return Ne(e,t)===k.False||h.IsOptional(e)&&!h.IsOptional(t)?k.False:k.True}function Jt(e,t){return h.IsUnknown(e)?k.False:h.IsAny(e)?k.Union:h.IsNever(e)||h.IsLiteralString(e)&&r$(t)||h.IsLiteralNumber(e)&&lR(t)||h.IsLiteralBoolean(e)&&s$(t)||h.IsSymbol(e)&&o$(t)||h.IsBigInt(e)&&PJ(t)||h.IsString(e)&&r$(t)||h.IsSymbol(e)&&o$(t)||h.IsNumber(e)&&lR(t)||h.IsInteger(e)&&lR(t)||h.IsBoolean(e)&&s$(t)||h.IsUint8Array(e)&&vJ(t)||h.IsDate(e)&&kJ(t)||h.IsConstructor(e)&&AJ(t)||h.IsFunction(e)&&_J(t)?k.True:h.IsRecord(e)&&h.IsString(mR(e))?t[di]==="Record"?k.True:k.False:h.IsRecord(e)&&h.IsNumber(mR(e))&&Rn(t,0)?k.True:k.False}function wJ(e,t){return Rt(t)?xt(e,t):h.IsRecord(t)?fi(e,t):h.IsObject(t)?(()=>{for(let i of Object.getOwnPropertyNames(t.properties)){if(!(i in e.properties)&&!h.IsOptional(t.properties[i]))return k.False;if(h.IsOptional(t.properties[i]))return k.True;if(l$(e.properties[i],t.properties[i])===k.False)return k.False}return k.True})():k.False}function TJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)&&OJ(t)?k.True:h.IsPromise(t)?mi(Ne(e.item,t.item)):k.False}function mR(e){return Ao in e.patternProperties?ui():Oo in e.patternProperties?an():fc("Unknown record key pattern")}function fR(e){return Ao in e.patternProperties?e.patternProperties[Ao]:Oo in e.patternProperties?e.patternProperties[Oo]:fc("Unable to get record value schema")}function fi(e,t){let[i,r]=[mR(t),fR(t)];return h.IsLiteralString(e)&&h.IsNumber(i)&&mi(Ne(e,r))===k.True?k.True:h.IsUint8Array(e)&&h.IsNumber(i)||h.IsString(e)&&h.IsNumber(i)||h.IsArray(e)&&h.IsNumber(i)?Ne(e,r):h.IsObject(e)?(()=>{for(let o of Object.getOwnPropertyNames(e.properties))if(l$(r,e.properties[o])===k.False)return k.False;return k.True})():k.False}function CJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?Ne(fR(e),fR(t)):k.False}function LJ(e,t){let i=h.IsRegExp(e)?an():e,r=h.IsRegExp(t)?an():t;return Ne(i,r)}function p$(e,t){return h.IsLiteral(e)&&Wt.IsString(e.const)||h.IsString(e)?k.True:k.False}function DJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?fi(e,t):h.IsString(t)?k.True:k.False}function $J(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?fi(e,t):h.IsSymbol(t)?k.True:k.False}function NJ(e,t){return h.IsTemplateLiteral(e)?Ne(Bs(e),t):h.IsTemplateLiteral(t)?Ne(e,Bs(t)):fc("Invalid fallthrough for TemplateLiteral")}function jJ(e,t){return h.IsArray(t)&&e.items!==void 0&&e.items.every(i=>Ne(i,t.items)===k.True)}function BJ(e,t){return h.IsNever(e)?k.True:h.IsUnknown(e)?k.False:h.IsAny(e)?k.Union:k.False}function MJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)&&pf(t)||h.IsArray(t)&&jJ(e,t)?k.True:h.IsTuple(t)?Wt.IsUndefined(e.items)&&!Wt.IsUndefined(t.items)||!Wt.IsUndefined(e.items)&&Wt.IsUndefined(t.items)?k.False:Wt.IsUndefined(e.items)&&!Wt.IsUndefined(t.items)||e.items.every((i,r)=>Ne(i,t.items[r])===k.True)?k.True:k.False:k.False}function UJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?fi(e,t):h.IsUint8Array(t)?k.True:k.False}function FJ(e,t){return Rt(t)?xt(e,t):h.IsObject(t)?Jt(e,t):h.IsRecord(t)?fi(e,t):h.IsVoid(t)?GJ(e,t):h.IsUndefined(t)?k.True:k.False}function SR(e,t){return t.anyOf.some(i=>Ne(e,i)===k.True)?k.True:k.False}function qJ(e,t){return e.anyOf.every(i=>Ne(i,t)===k.True)?k.True:k.False}function m$(e,t){return k.True}function zJ(e,t){return h.IsNever(t)?d$(e,t):h.IsIntersect(t)?lf(e,t):h.IsUnion(t)?SR(e,t):h.IsAny(t)?gR(e,t):h.IsString(t)?p$(e,t):h.IsNumber(t)?u$(e,t):h.IsInteger(t)?c$(e,t):h.IsBoolean(t)?a$(e,t):h.IsArray(t)?cJ(e,t):h.IsTuple(t)?BJ(e,t):h.IsObject(t)?Jt(e,t):h.IsUnknown(t)?k.True:k.False}function GJ(e,t){return h.IsUndefined(e)||h.IsUndefined(e)?k.True:k.False}function KJ(e,t){return h.IsIntersect(t)?lf(e,t):h.IsUnion(t)?SR(e,t):h.IsUnknown(t)?m$(e,t):h.IsAny(t)?gR(e,t):h.IsObject(t)?Jt(e,t):h.IsVoid(t)?k.True:k.False}function Ne(e,t){return h.IsTemplateLiteral(e)||h.IsTemplateLiteral(t)?NJ(e,t):h.IsRegExp(e)||h.IsRegExp(t)?LJ(e,t):h.IsNot(e)||h.IsNot(t)?RJ(e,t):h.IsAny(e)?aJ(e,t):h.IsArray(e)?dJ(e,t):h.IsBigInt(e)?lJ(e,t):h.IsBoolean(e)?pJ(e,t):h.IsAsyncIterator(e)?uJ(e,t):h.IsConstructor(e)?mJ(e,t):h.IsDate(e)?fJ(e,t):h.IsFunction(e)?gJ(e,t):h.IsInteger(e)?SJ(e,t):h.IsIntersect(e)?yJ(e,t):h.IsIterator(e)?hJ(e,t):h.IsLiteral(e)?IJ(e,t):h.IsNever(e)?bJ(e,t):h.IsNull(e)?xJ(e,t):h.IsNumber(e)?EJ(e,t):h.IsObject(e)?wJ(e,t):h.IsRecord(e)?CJ(e,t):h.IsString(e)?DJ(e,t):h.IsSymbol(e)?$J(e,t):h.IsTuple(e)?MJ(e,t):h.IsPromise(e)?TJ(e,t):h.IsUint8Array(e)?UJ(e,t):h.IsUndefined(e)?FJ(e,t):h.IsUnion(e)?qJ(e,t):h.IsUnknown(e)?zJ(e,t):h.IsVoid(e)?KJ(e,t):fc(`Unknown left type operand '${e[P]}'`)}function Co(e,t){return Ne(e,t)}function VJ(e,t,i,r,o){let s={};for(let a of globalThis.Object.getOwnPropertyNames(e))s[a]=gc(e[a],t,i,r,Qe(o));return s}function HJ(e,t,i,r,o){return VJ(e.properties,t,i,r,o)}function f$(e,t,i,r,o){let s=HJ(e,t,i,r,o);return fe(s)}function WJ(e,t,i,r){let o=Co(e,t);return o===k.Union?be([i,r]):o===k.True?i:r}function gc(e,t,i,r,o){return Ze(e)?f$(e,t,i,r,o):Fn(e)?E(g$(e,t,i,r,o)):E(WJ(e,t,i,r),o)}function XJ(e,t,i,r,o){return{[e]:gc(le(e),t,i,r,Qe(o))}}function QJ(e,t,i,r,o){return e.reduce((s,a)=>({...s,...XJ(a,t,i,r,o)}),{})}function ZJ(e,t,i,r,o){return QJ(e.keys,t,i,r,o)}function g$(e,t,i,r,o){let s=ZJ(e,t,i,r,o);return fe(s)}var yR=class extends Q{constructor(t){super("Unknown type"),this.schema=t}};function JJ(e){return e[P]==="Any"||e[P]==="Unknown"}function ce(e){return e!==void 0}function YJ(e,t,i){return!0}function e5(e,t,i){return!0}function t5(e,t,i){if(!W(i)||ce(e.minItems)&&!(i.length>=e.minItems)||ce(e.maxItems)&&!(i.length<=e.maxItems))return!1;for(let s of i)if(!Lt(e.items,t,s))return!1;if(e.uniqueItems===!0&&!(function(){let s=new Set;for(let a of i){let c=mc(a);if(s.has(c))return!1;s.add(c)}return!0})())return!1;if(!(ce(e.contains)||Xe(e.minContains)||Xe(e.maxContains)))return!0;let r=ce(e.contains)?e.contains:oe(),o=i.reduce((s,a)=>Lt(r,t,a)?s+1:s,0);return!(o===0||Xe(e.minContains)&&o<e.minContains||Xe(e.maxContains)&&o>e.maxContains)}function n5(e,t,i){return Xm(i)}function i5(e,t,i){return!(!_i(i)||ce(e.exclusiveMaximum)&&!(i<e.exclusiveMaximum)||ce(e.exclusiveMinimum)&&!(i>e.exclusiveMinimum)||ce(e.maximum)&&!(i<=e.maximum)||ce(e.minimum)&&!(i>=e.minimum)||ce(e.multipleOf)&&i%e.multipleOf!==BigInt(0))}function r5(e,t,i){return lr(i)}function o5(e,t,i){return Lt(e.returns,t,i.prototype)}function s5(e,t,i){return!(!sn(i)||ce(e.exclusiveMaximumTimestamp)&&!(i.getTime()<e.exclusiveMaximumTimestamp)||ce(e.exclusiveMinimumTimestamp)&&!(i.getTime()>e.exclusiveMinimumTimestamp)||ce(e.maximumTimestamp)&&!(i.getTime()<=e.maximumTimestamp)||ce(e.minimumTimestamp)&&!(i.getTime()>=e.minimumTimestamp)||ce(e.multipleOfTimestamp)&&i.getTime()%e.multipleOfTimestamp!==0)}function a5(e,t,i){return ko(i)}function c5(e,t,i){let r=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return Lt(o,[...t,...r],i)}function d5(e,t,i){return!(!Jm(i)||ce(e.exclusiveMaximum)&&!(i<e.exclusiveMaximum)||ce(e.exclusiveMinimum)&&!(i>e.exclusiveMinimum)||ce(e.maximum)&&!(i<=e.maximum)||ce(e.minimum)&&!(i>=e.minimum)||ce(e.multipleOf)&&i%e.multipleOf!==0)}function u5(e,t,i){let r=e.allOf.every(o=>Lt(o,t,i));if(e.unevaluatedProperties===!1){let o=new RegExp(dc(e)),s=Object.getOwnPropertyNames(i).every(a=>o.test(a));return r&&s}else if(et(e.unevaluatedProperties)){let o=new RegExp(dc(e)),s=Object.getOwnPropertyNames(i).every(a=>o.test(a)||Lt(e.unevaluatedProperties,t,i[a]));return r&&s}else return r}function l5(e,t,i){return Qm(i)}function p5(e,t,i){return i===e.const}function m5(e,t,i){return!1}function f5(e,t,i){return!Lt(e.not,t,i)}function g5(e,t,i){return Br(i)}function S5(e,t,i){return!(!bt.IsNumberLike(i)||ce(e.exclusiveMaximum)&&!(i<e.exclusiveMaximum)||ce(e.exclusiveMinimum)&&!(i>e.exclusiveMinimum)||ce(e.minimum)&&!(i>=e.minimum)||ce(e.maximum)&&!(i<=e.maximum)||ce(e.multipleOf)&&i%e.multipleOf!==0)}function y5(e,t,i){if(!bt.IsObjectLike(i)||ce(e.minProperties)&&!(Object.getOwnPropertyNames(i).length>=e.minProperties)||ce(e.maxProperties)&&!(Object.getOwnPropertyNames(i).length<=e.maxProperties))return!1;let r=Object.getOwnPropertyNames(e.properties);for(let o of r){let s=e.properties[o];if(e.required&&e.required.includes(o)){if(!Lt(s,t,i[o])||(Ms(s)||JJ(s))&&!(o in i))return!1}else if(bt.IsExactOptionalProperty(i,o)&&!Lt(s,t,i[o]))return!1}if(e.additionalProperties===!1){let o=Object.getOwnPropertyNames(i);return e.required&&e.required.length===r.length&&o.length===r.length?!0:o.every(s=>r.includes(s))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(i).every(s=>r.includes(s)||Lt(e.additionalProperties,t,i[s])):!0}function h5(e,t,i){return Zm(i)}function I5(e,t,i){if(!bt.IsRecordLike(i)||ce(e.minProperties)&&!(Object.getOwnPropertyNames(i).length>=e.minProperties)||ce(e.maxProperties)&&!(Object.getOwnPropertyNames(i).length<=e.maxProperties))return!1;let[r,o]=Object.entries(e.patternProperties)[0],s=new RegExp(r),a=Object.entries(i).every(([u,l])=>s.test(u)?Lt(o,t,l):!0),c=typeof e.additionalProperties=="object"?Object.entries(i).every(([u,l])=>s.test(u)?!0:Lt(e.additionalProperties,t,l)):!0,d=e.additionalProperties===!1?Object.getOwnPropertyNames(i).every(u=>s.test(u)):!0;return a&&c&&d}function b5(e,t,i){return Lt(xe(e,t),t,i)}function R5(e,t,i){let r=new RegExp(e.source,e.flags);return ce(e.minLength)&&!(i.length>=e.minLength)||ce(e.maxLength)&&!(i.length<=e.maxLength)?!1:r.test(i)}function x5(e,t,i){return!_e(i)||ce(e.minLength)&&!(i.length>=e.minLength)||ce(e.maxLength)&&!(i.length<=e.maxLength)||ce(e.pattern)&&!new RegExp(e.pattern).test(i)?!1:ce(e.format)?Bn.Has(e.format)?Bn.Get(e.format)(i):!1:!0}function E5(e,t,i){return Mr(i)}function P5(e,t,i){return _e(i)&&new RegExp(e.pattern).test(i)}function k5(e,t,i){return Lt(xe(e,t),t,i)}function v5(e,t,i){if(!W(i)||e.items===void 0&&i.length!==0||i.length!==e.maxItems)return!1;if(!e.items)return!0;for(let r=0;r<e.items.length;r++)if(!Lt(e.items[r],t,i[r]))return!1;return!0}function _5(e,t,i){return We(i)}function A5(e,t,i){return e.anyOf.some(r=>Lt(r,t,i))}function O5(e,t,i){return!(!Za(i)||ce(e.maxByteLength)&&!(i.length<=e.maxByteLength)||ce(e.minByteLength)&&!(i.length>=e.minByteLength))}function w5(e,t,i){return!0}function T5(e,t,i){return bt.IsVoidLike(i)}function C5(e,t,i){return Ai.Has(e[P])?Ai.Get(e[P])(e,i):!1}function Lt(e,t,i){let r=ce(e.$id)?Tt(e,t):t,o=e;switch(o[P]){case"Any":return YJ(o,r,i);case"Argument":return e5(o,r,i);case"Array":return t5(o,r,i);case"AsyncIterator":return n5(o,r,i);case"BigInt":return i5(o,r,i);case"Boolean":return r5(o,r,i);case"Constructor":return o5(o,r,i);case"Date":return s5(o,r,i);case"Function":return a5(o,r,i);case"Import":return c5(o,r,i);case"Integer":return d5(o,r,i);case"Intersect":return u5(o,r,i);case"Iterator":return l5(o,r,i);case"Literal":return p5(o,r,i);case"Never":return m5(o,r,i);case"Not":return f5(o,r,i);case"Null":return g5(o,r,i);case"Number":return S5(o,r,i);case"Object":return y5(o,r,i);case"Promise":return h5(o,r,i);case"Record":return I5(o,r,i);case"Ref":return b5(o,r,i);case"RegExp":return R5(o,r,i);case"String":return x5(o,r,i);case"Symbol":return E5(o,r,i);case"TemplateLiteral":return P5(o,r,i);case"This":return k5(o,r,i);case"Tuple":return v5(o,r,i);case"Undefined":return _5(o,r,i);case"Union":return A5(o,r,i);case"Uint8Array":return O5(o,r,i);case"Unknown":return w5(o,r,i);case"Void":return T5(o,r,i);default:if(!Ai.Has(o[P]))throw new yR(o);return C5(o,r,i)}}function ne(...e){return e.length===3?Lt(e[0],e[1],e[2]):Lt(e[0],[],e[1])}var x;(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(x||(x={}));var hR=class extends Q{constructor(t){super("Unknown type"),this.schema=t}};function Hr(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function de(e){return e!==void 0}var Lo=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){let t=this.iterator.next();return t.done?void 0:t.value}};function N(e,t,i,r,o=[]){return{type:e,schema:t,path:i,value:r,message:lD()({errorType:e,path:i,schema:t,value:r,errors:o}),errors:o}}function*L5(e,t,i,r){}function*D5(e,t,i,r){}function*$5(e,t,i,r){if(!W(r))return yield N(x.Array,e,i,r);de(e.minItems)&&!(r.length>=e.minItems)&&(yield N(x.ArrayMinItems,e,i,r)),de(e.maxItems)&&!(r.length<=e.maxItems)&&(yield N(x.ArrayMaxItems,e,i,r));for(let a=0;a<r.length;a++)yield*Dt(e.items,t,`${i}/${a}`,r[a]);if(e.uniqueItems===!0&&!(function(){let a=new Set;for(let c of r){let d=mc(c);if(a.has(d))return!1;a.add(d)}return!0})()&&(yield N(x.ArrayUniqueItems,e,i,r)),!(de(e.contains)||de(e.minContains)||de(e.maxContains)))return;let o=de(e.contains)?e.contains:oe(),s=r.reduce((a,c,d)=>Dt(o,t,`${i}${d}`,c).next().done===!0?a+1:a,0);s===0&&(yield N(x.ArrayContains,e,i,r)),Xe(e.minContains)&&s<e.minContains&&(yield N(x.ArrayMinContains,e,i,r)),Xe(e.maxContains)&&s>e.maxContains&&(yield N(x.ArrayMaxContains,e,i,r))}function*N5(e,t,i,r){Xm(r)||(yield N(x.AsyncIterator,e,i,r))}function*j5(e,t,i,r){if(!_i(r))return yield N(x.BigInt,e,i,r);de(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield N(x.BigIntExclusiveMaximum,e,i,r)),de(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield N(x.BigIntExclusiveMinimum,e,i,r)),de(e.maximum)&&!(r<=e.maximum)&&(yield N(x.BigIntMaximum,e,i,r)),de(e.minimum)&&!(r>=e.minimum)&&(yield N(x.BigIntMinimum,e,i,r)),de(e.multipleOf)&&r%e.multipleOf!==BigInt(0)&&(yield N(x.BigIntMultipleOf,e,i,r))}function*B5(e,t,i,r){lr(r)||(yield N(x.Boolean,e,i,r))}function*M5(e,t,i,r){yield*Dt(e.returns,t,i,r.prototype)}function*U5(e,t,i,r){if(!sn(r))return yield N(x.Date,e,i,r);de(e.exclusiveMaximumTimestamp)&&!(r.getTime()<e.exclusiveMaximumTimestamp)&&(yield N(x.DateExclusiveMaximumTimestamp,e,i,r)),de(e.exclusiveMinimumTimestamp)&&!(r.getTime()>e.exclusiveMinimumTimestamp)&&(yield N(x.DateExclusiveMinimumTimestamp,e,i,r)),de(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)&&(yield N(x.DateMaximumTimestamp,e,i,r)),de(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)&&(yield N(x.DateMinimumTimestamp,e,i,r)),de(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0&&(yield N(x.DateMultipleOfTimestamp,e,i,r))}function*F5(e,t,i,r){ko(r)||(yield N(x.Function,e,i,r))}function*q5(e,t,i,r){let o=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref];yield*Dt(s,[...t,...o],i,r)}function*z5(e,t,i,r){if(!Jm(r))return yield N(x.Integer,e,i,r);de(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield N(x.IntegerExclusiveMaximum,e,i,r)),de(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield N(x.IntegerExclusiveMinimum,e,i,r)),de(e.maximum)&&!(r<=e.maximum)&&(yield N(x.IntegerMaximum,e,i,r)),de(e.minimum)&&!(r>=e.minimum)&&(yield N(x.IntegerMinimum,e,i,r)),de(e.multipleOf)&&r%e.multipleOf!==0&&(yield N(x.IntegerMultipleOf,e,i,r))}function*G5(e,t,i,r){let o=!1;for(let s of e.allOf)for(let a of Dt(s,t,i,r))o=!0,yield a;if(o)return yield N(x.Intersect,e,i,r);if(e.unevaluatedProperties===!1){let s=new RegExp(dc(e));for(let a of Object.getOwnPropertyNames(r))s.test(a)||(yield N(x.IntersectUnevaluatedProperties,e,`${i}/${a}`,r))}if(typeof e.unevaluatedProperties=="object"){let s=new RegExp(dc(e));for(let a of Object.getOwnPropertyNames(r))if(!s.test(a)){let c=Dt(e.unevaluatedProperties,t,`${i}/${a}`,r[a]).next();c.done||(yield c.value)}}}function*K5(e,t,i,r){Qm(r)||(yield N(x.Iterator,e,i,r))}function*V5(e,t,i,r){r!==e.const&&(yield N(x.Literal,e,i,r))}function*H5(e,t,i,r){yield N(x.Never,e,i,r)}function*W5(e,t,i,r){Dt(e.not,t,i,r).next().done===!0&&(yield N(x.Not,e,i,r))}function*X5(e,t,i,r){Br(r)||(yield N(x.Null,e,i,r))}function*Q5(e,t,i,r){if(!bt.IsNumberLike(r))return yield N(x.Number,e,i,r);de(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield N(x.NumberExclusiveMaximum,e,i,r)),de(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield N(x.NumberExclusiveMinimum,e,i,r)),de(e.maximum)&&!(r<=e.maximum)&&(yield N(x.NumberMaximum,e,i,r)),de(e.minimum)&&!(r>=e.minimum)&&(yield N(x.NumberMinimum,e,i,r)),de(e.multipleOf)&&r%e.multipleOf!==0&&(yield N(x.NumberMultipleOf,e,i,r))}function*Z5(e,t,i,r){if(!bt.IsObjectLike(r))return yield N(x.Object,e,i,r);de(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield N(x.ObjectMinProperties,e,i,r)),de(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield N(x.ObjectMaxProperties,e,i,r));let o=Array.isArray(e.required)?e.required:[],s=Object.getOwnPropertyNames(e.properties),a=Object.getOwnPropertyNames(r);for(let c of o)a.includes(c)||(yield N(x.ObjectRequiredProperty,e.properties[c],`${i}/${Hr(c)}`,void 0));if(e.additionalProperties===!1)for(let c of a)s.includes(c)||(yield N(x.ObjectAdditionalProperties,e,`${i}/${Hr(c)}`,r[c]));if(typeof e.additionalProperties=="object")for(let c of a)s.includes(c)||(yield*Dt(e.additionalProperties,t,`${i}/${Hr(c)}`,r[c]));for(let c of s){let d=e.properties[c];e.required&&e.required.includes(c)?(yield*Dt(d,t,`${i}/${Hr(c)}`,r[c]),Ms(e)&&!(c in r)&&(yield N(x.ObjectRequiredProperty,d,`${i}/${Hr(c)}`,void 0))):bt.IsExactOptionalProperty(r,c)&&(yield*Dt(d,t,`${i}/${Hr(c)}`,r[c]))}}function*J5(e,t,i,r){Zm(r)||(yield N(x.Promise,e,i,r))}function*Y5(e,t,i,r){if(!bt.IsRecordLike(r))return yield N(x.Object,e,i,r);de(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield N(x.ObjectMinProperties,e,i,r)),de(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield N(x.ObjectMaxProperties,e,i,r));let[o,s]=Object.entries(e.patternProperties)[0],a=new RegExp(o);for(let[c,d]of Object.entries(r))a.test(c)&&(yield*Dt(s,t,`${i}/${Hr(c)}`,d));if(typeof e.additionalProperties=="object")for(let[c,d]of Object.entries(r))a.test(c)||(yield*Dt(e.additionalProperties,t,`${i}/${Hr(c)}`,d));if(e.additionalProperties===!1){for(let[c,d]of Object.entries(r))if(!a.test(c))return yield N(x.ObjectAdditionalProperties,e,`${i}/${Hr(c)}`,d)}}function*eY(e,t,i,r){yield*Dt(xe(e,t),t,i,r)}function*tY(e,t,i,r){if(!_e(r))return yield N(x.String,e,i,r);if(de(e.minLength)&&!(r.length>=e.minLength)&&(yield N(x.StringMinLength,e,i,r)),de(e.maxLength)&&!(r.length<=e.maxLength)&&(yield N(x.StringMaxLength,e,i,r)),!new RegExp(e.source,e.flags).test(r))return yield N(x.RegExp,e,i,r)}function*nY(e,t,i,r){if(!_e(r))return yield N(x.String,e,i,r);de(e.minLength)&&!(r.length>=e.minLength)&&(yield N(x.StringMinLength,e,i,r)),de(e.maxLength)&&!(r.length<=e.maxLength)&&(yield N(x.StringMaxLength,e,i,r)),_e(e.pattern)&&(new RegExp(e.pattern).test(r)||(yield N(x.StringPattern,e,i,r))),_e(e.format)&&(Bn.Has(e.format)?Bn.Get(e.format)(r)||(yield N(x.StringFormat,e,i,r)):yield N(x.StringFormatUnknown,e,i,r))}function*iY(e,t,i,r){Mr(r)||(yield N(x.Symbol,e,i,r))}function*rY(e,t,i,r){if(!_e(r))return yield N(x.String,e,i,r);new RegExp(e.pattern).test(r)||(yield N(x.StringPattern,e,i,r))}function*oY(e,t,i,r){yield*Dt(xe(e,t),t,i,r)}function*sY(e,t,i,r){if(!W(r))return yield N(x.Tuple,e,i,r);if(e.items===void 0&&r.length!==0)return yield N(x.TupleLength,e,i,r);if(r.length!==e.maxItems)return yield N(x.TupleLength,e,i,r);if(e.items)for(let o=0;o<e.items.length;o++)yield*Dt(e.items[o],t,`${i}/${o}`,r[o])}function*aY(e,t,i,r){We(r)||(yield N(x.Undefined,e,i,r))}function*cY(e,t,i,r){if(ne(e,t,r))return;let o=e.anyOf.map(s=>new Lo(Dt(s,t,i,r)));yield N(x.Union,e,i,r,o)}function*dY(e,t,i,r){if(!Za(r))return yield N(x.Uint8Array,e,i,r);de(e.maxByteLength)&&!(r.length<=e.maxByteLength)&&(yield N(x.Uint8ArrayMaxByteLength,e,i,r)),de(e.minByteLength)&&!(r.length>=e.minByteLength)&&(yield N(x.Uint8ArrayMinByteLength,e,i,r))}function*uY(e,t,i,r){}function*lY(e,t,i,r){bt.IsVoidLike(r)||(yield N(x.Void,e,i,r))}function*pY(e,t,i,r){Ai.Get(e[P])(e,r)||(yield N(x.Kind,e,i,r))}function*Dt(e,t,i,r){let o=de(e.$id)?[...t,e]:t,s=e;switch(s[P]){case"Any":return yield*L5(s,o,i,r);case"Argument":return yield*D5(s,o,i,r);case"Array":return yield*$5(s,o,i,r);case"AsyncIterator":return yield*N5(s,o,i,r);case"BigInt":return yield*j5(s,o,i,r);case"Boolean":return yield*B5(s,o,i,r);case"Constructor":return yield*M5(s,o,i,r);case"Date":return yield*U5(s,o,i,r);case"Function":return yield*F5(s,o,i,r);case"Import":return yield*q5(s,o,i,r);case"Integer":return yield*z5(s,o,i,r);case"Intersect":return yield*G5(s,o,i,r);case"Iterator":return yield*K5(s,o,i,r);case"Literal":return yield*V5(s,o,i,r);case"Never":return yield*H5(s,o,i,r);case"Not":return yield*W5(s,o,i,r);case"Null":return yield*X5(s,o,i,r);case"Number":return yield*Q5(s,o,i,r);case"Object":return yield*Z5(s,o,i,r);case"Promise":return yield*J5(s,o,i,r);case"Record":return yield*Y5(s,o,i,r);case"Ref":return yield*eY(s,o,i,r);case"RegExp":return yield*tY(s,o,i,r);case"String":return yield*nY(s,o,i,r);case"Symbol":return yield*iY(s,o,i,r);case"TemplateLiteral":return yield*rY(s,o,i,r);case"This":return yield*oY(s,o,i,r);case"Tuple":return yield*sY(s,o,i,r);case"Undefined":return yield*aY(s,o,i,r);case"Union":return yield*cY(s,o,i,r);case"Uint8Array":return yield*dY(s,o,i,r);case"Unknown":return yield*uY(s,o,i,r);case"Void":return yield*lY(s,o,i,r);default:if(!Ai.Has(s[P]))throw new hR(e);return yield*pY(s,o,i,r)}}function Do(...e){let t=e.length===3?Dt(e[0],e[1],"",e[2]):Dt(e[0],[],"",e[1]);return new Lo(t)}var mY=function(e,t,i,r,o){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?o.call(e,i):o?o.value=i:t.set(e,i),i},y$=function(e,t,i,r){if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?r:i==="a"?r.call(e):r?r.value:t.get(e)},IR,mf,h$,bR=class extends Q{constructor(t){let i=t.First();super(i===void 0?"Invalid Value":i.message),IR.add(this),mf.set(this,void 0),mY(this,mf,t,"f"),this.error=i}Errors(){return new Lo(y$(this,IR,"m",h$).call(this))}};mf=new WeakMap,IR=new WeakSet,h$=function*(){this.error&&(yield this.error),yield*y$(this,mf,"f")};function S$(e,t,i){if(!ne(e,t,i))throw new bR(Do(e,t,i))}function ff(...e){return e.length===3?S$(e[0],e[1],e[2]):S$(e[0],[],e[1])}function fY(e){let t={};for(let i of Object.getOwnPropertyNames(e))t[i]=ge(e[i]);for(let i of Object.getOwnPropertySymbols(e))t[i]=ge(e[i]);return t}function gY(e){return e.map(t=>ge(t))}function SY(e){return e.slice()}function yY(e){return new Map(ge([...e.entries()]))}function hY(e){return new Set(ge([...e.entries()]))}function IY(e){return new Date(e.toISOString())}function ge(e){if(W(e))return gY(e);if(sn(e))return IY(e);if(ci(e))return SY(e);if(UL(e))return yY(e);if(FL(e))return hY(e);if(J(e))return fY(e);if(jn(e))return e;throw new Error("ValueClone: Unable to clone value")}var Kn=class extends Q{constructor(t,i){super(i),this.schema=t}};function Se(e){return ko(e)?e():ge(e)}function bY(e,t){return K(e,"default")?Se(e.default):{}}function RY(e,t){return{}}function xY(e,t){if(e.uniqueItems===!0&&!K(e,"default"))throw new Kn(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!K(e,"default"))throw new Kn(e,"Array with the contains constraint requires a default value");return"default"in e?Se(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(i=>Vn(e.items,t)):[]}function EY(e,t){return K(e,"default")?Se(e.default):(async function*(){})()}function PY(e,t){return K(e,"default")?Se(e.default):BigInt(0)}function kY(e,t){return K(e,"default")?Se(e.default):!1}function vY(e,t){if(K(e,"default"))return Se(e.default);{let i=Vn(e.returns,t);return typeof i=="object"&&!Array.isArray(i)?class{constructor(){for(let[r,o]of Object.entries(i)){let s=this;s[r]=o}}}:class{}}}function _Y(e,t){return K(e,"default")?Se(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function AY(e,t){return K(e,"default")?Se(e.default):()=>Vn(e.returns,t)}function OY(e,t){let i=globalThis.Object.values(e.$defs),r=e.$defs[e.$ref];return Vn(r,[...t,...i])}function wY(e,t){return K(e,"default")?Se(e.default):e.minimum!==void 0?e.minimum:0}function TY(e,t){if(K(e,"default"))return Se(e.default);{let i=e.allOf.reduce((r,o)=>{let s=Vn(o,t);return typeof s=="object"?{...r,...s}:s},{});if(!ne(e,t,i))throw new Kn(e,"Intersect produced invalid value. Consider using a default value.");return i}}function CY(e,t){return K(e,"default")?Se(e.default):(function*(){})()}function LY(e,t){return K(e,"default")?Se(e.default):e.const}function DY(e,t){if(K(e,"default"))return Se(e.default);throw new Kn(e,"Never types cannot be created. Consider using a default value.")}function $Y(e,t){if(K(e,"default"))return Se(e.default);throw new Kn(e,"Not types must have a default value")}function NY(e,t){return K(e,"default")?Se(e.default):null}function jY(e,t){return K(e,"default")?Se(e.default):e.minimum!==void 0?e.minimum:0}function BY(e,t){if(K(e,"default"))return Se(e.default);{let i=new Set(e.required),r={};for(let[o,s]of Object.entries(e.properties))i.has(o)&&(r[o]=Vn(s,t));return r}}function MY(e,t){return K(e,"default")?Se(e.default):Promise.resolve(Vn(e.item,t))}function UY(e,t){return K(e,"default")?Se(e.default):{}}function FY(e,t){return K(e,"default")?Se(e.default):Vn(xe(e,t),t)}function qY(e,t){if(K(e,"default"))return Se(e.default);throw new Kn(e,"RegExp types cannot be created. Consider using a default value.")}function zY(e,t){if(e.pattern!==void 0){if(K(e,"default"))return Se(e.default);throw new Kn(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(K(e,"default"))return Se(e.default);throw new Kn(e,"String types with formats must specify a default value")}else return K(e,"default")?Se(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function GY(e,t){return K(e,"default")?Se(e.default):"value"in e?Symbol.for(e.value):Symbol()}function KY(e,t){if(K(e,"default"))return Se(e.default);if(!of(e))throw new Kn(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return sc(e)[0]}function VY(e,t){if(I$++>e8)throw new Kn(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return K(e,"default")?Se(e.default):Vn(xe(e,t),t)}function HY(e,t){return K(e,"default")?Se(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((i,r)=>Vn(e.items[r],t))}function WY(e,t){if(K(e,"default"))return Se(e.default)}function XY(e,t){if(K(e,"default"))return Se(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return Vn(e.anyOf[0],t)}function QY(e,t){return K(e,"default")?Se(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function ZY(e,t){return K(e,"default")?Se(e.default):{}}function JY(e,t){if(K(e,"default"))return Se(e.default)}function YY(e,t){if(K(e,"default"))return Se(e.default);throw new Error("User defined types must specify a default value")}function Vn(e,t){let i=Tt(e,t),r=e;switch(r[P]){case"Any":return bY(r,i);case"Argument":return RY(r,i);case"Array":return xY(r,i);case"AsyncIterator":return EY(r,i);case"BigInt":return PY(r,i);case"Boolean":return kY(r,i);case"Constructor":return vY(r,i);case"Date":return _Y(r,i);case"Function":return AY(r,i);case"Import":return OY(r,i);case"Integer":return wY(r,i);case"Intersect":return TY(r,i);case"Iterator":return CY(r,i);case"Literal":return LY(r,i);case"Never":return DY(r,i);case"Not":return $Y(r,i);case"Null":return NY(r,i);case"Number":return jY(r,i);case"Object":return BY(r,i);case"Promise":return MY(r,i);case"Record":return UY(r,i);case"Ref":return FY(r,i);case"RegExp":return qY(r,i);case"String":return zY(r,i);case"Symbol":return GY(r,i);case"TemplateLiteral":return KY(r,i);case"This":return VY(r,i);case"Tuple":return HY(r,i);case"Undefined":return WY(r,i);case"Union":return XY(r,i);case"Uint8Array":return QY(r,i);case"Unknown":return ZY(r,i);case"Void":return JY(r,i);default:if(!Ai.Has(r[P]))throw new Kn(r,"Unknown type");return YY(r,i)}}var e8=512,I$=0;function ji(...e){return I$=0,e.length===2?Vn(e[0],e[1]):Vn(e[0],[])}var gf=class extends Q{constructor(t,i){super(i),this.schema=t}};function b$(e,t,i){if(e[P]==="Object"&&typeof i=="object"&&!Br(i)){let r=e,o=Object.getOwnPropertyNames(i);return Object.entries(r.properties).reduce((a,[c,d])=>{let u=d[P]==="Literal"&&d.const===i[c]?100:0,l=ne(d,t,i[c])?10:0,p=o.includes(c)?1:0;return a+(u+l+p)},0)}else if(e[P]==="Union"){let o=e.anyOf.map(s=>xe(s,t)).map(s=>b$(s,t,i));return Math.max(...o)}else return ne(e,t,i)?1:0}function t8(e,t,i){let r=e.anyOf.map(a=>xe(a,t)),[o,s]=[r[0],0];for(let a of r){let c=b$(a,t,i);c>s&&(o=a,s=c)}return o}function n8(e,t,i){if("default"in e)return typeof i=="function"?e.default:ge(e.default);{let r=t8(e,t,i);return Uu(r,t,i)}}function i8(e,t,i){return ne(e,t,i)?ge(i):ji(e,t)}function r8(e,t,i){return ne(e,t,i)?i:ji(e,t)}function o8(e,t,i){if(ne(e,t,i))return ge(i);let r=W(i)?ge(i):ji(e,t),o=Xe(e.minItems)&&r.length<e.minItems?[...r,...Array.from({length:e.minItems-r.length},()=>null)]:r,a=(Xe(e.maxItems)&&o.length>e.maxItems?o.slice(0,e.maxItems):o).map(d=>Bi(e.items,t,d));if(e.uniqueItems!==!0)return a;let c=[...new Set(a)];if(!ne(e,t,c))throw new gf(e,"Array cast produced invalid data due to uniqueItems constraint");return c}function s8(e,t,i){if(ne(e,t,i))return ji(e,t);let r=new Set(e.returns.required||[]),o=function(){};for(let[s,a]of Object.entries(e.returns.properties))!r.has(s)&&i.prototype[s]===void 0||(o.prototype[s]=Bi(a,t,i.prototype[s]));return o}function a8(e,t,i){let r=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return Bi(o,[...t,...r],i)}function R$(e,t){return J(e)&&!J(t)||!J(e)&&J(t)?e:!J(e)||!J(t)?t:globalThis.Object.getOwnPropertyNames(e).reduce((i,r)=>{let o=r in t?R$(e[r],t[r]):e[r];return{...i,[r]:o}},{})}function c8(e,t,i){if(ne(e,t,i))return i;let r=ji(e,t),o=R$(r,i);return ne(e,t,o)?o:r}function d8(e,t,i){throw new gf(e,"Never types cannot be cast")}function u8(e,t,i){if(ne(e,t,i))return i;if(i===null||typeof i!="object")return ji(e,t);let r=new Set(e.required||[]),o={};for(let[s,a]of Object.entries(e.properties))!r.has(s)&&i[s]===void 0||(o[s]=Bi(a,t,i[s]));if(typeof e.additionalProperties=="object"){let s=Object.getOwnPropertyNames(e.properties);for(let a of Object.getOwnPropertyNames(i))s.includes(a)||(o[a]=Bi(e.additionalProperties,t,i[a]))}return o}function l8(e,t,i){if(ne(e,t,i))return ge(i);if(i===null||typeof i!="object"||Array.isArray(i)||i instanceof Date)return ji(e,t);let r=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[r],s={};for(let[a,c]of Object.entries(i))s[a]=Bi(o,t,c);return s}function p8(e,t,i){return Bi(xe(e,t),t,i)}function m8(e,t,i){return Bi(xe(e,t),t,i)}function f8(e,t,i){return ne(e,t,i)?ge(i):W(i)?e.items===void 0?[]:e.items.map((r,o)=>Bi(r,t,i[o])):ji(e,t)}function g8(e,t,i){return ne(e,t,i)?ge(i):n8(e,t,i)}function Bi(e,t,i){let r=_e(e.$id)?Tt(e,t):t,o=e;switch(e[P]){case"Array":return o8(o,r,i);case"Constructor":return s8(o,r,i);case"Import":return a8(o,r,i);case"Intersect":return c8(o,r,i);case"Never":return d8(o,r,i);case"Object":return u8(o,r,i);case"Record":return l8(o,r,i);case"Ref":return p8(o,r,i);case"This":return m8(o,r,i);case"Tuple":return f8(o,r,i);case"Union":return g8(o,r,i);case"Date":case"Symbol":case"Uint8Array":return i8(e,t,i);default:return r8(o,r,i)}}function Uu(...e){return e.length===3?Bi(e[0],e[1],e[2]):Bi(e[0],[],e[1])}function S8(e){return _o(e)&&e[P]!=="Unsafe"}function y8(e,t,i){return W(i)?i.map(r=>xn(e.items,t,r)):i}function h8(e,t,i){let r=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return xn(o,[...t,...r],i)}function I8(e,t,i){let r=e.unevaluatedProperties,s=e.allOf.map(c=>xn(c,t,ge(i))).reduce((c,d)=>J(d)?{...c,...d}:d,{});if(!J(i)||!J(s)||!_o(r))return s;let a=bn(e);for(let c of Object.getOwnPropertyNames(i))a.includes(c)||ne(r,t,i[c])&&(s[c]=xn(r,t,i[c]));return s}function b8(e,t,i){if(!J(i)||W(i))return i;let r=e.additionalProperties;for(let o of Object.getOwnPropertyNames(i)){if(K(e.properties,o)){i[o]=xn(e.properties[o],t,i[o]);continue}if(_o(r)&&ne(r,t,i[o])){i[o]=xn(r,t,i[o]);continue}delete i[o]}return i}function R8(e,t,i){if(!J(i))return i;let r=e.additionalProperties,o=Object.getOwnPropertyNames(i),[s,a]=Object.entries(e.patternProperties)[0],c=new RegExp(s);for(let d of o){if(c.test(d)){i[d]=xn(a,t,i[d]);continue}if(_o(r)&&ne(r,t,i[d])){i[d]=xn(r,t,i[d]);continue}delete i[d]}return i}function x8(e,t,i){return xn(xe(e,t),t,i)}function E8(e,t,i){return xn(xe(e,t),t,i)}function P8(e,t,i){if(!W(i))return i;if(We(e.items))return[];let r=Math.min(i.length,e.items.length);for(let o=0;o<r;o++)i[o]=xn(e.items[o],t,i[o]);return i.length>r?i.slice(0,r):i}function k8(e,t,i){for(let r of e.anyOf)if(S8(r)&&ne(r,t,i))return xn(r,t,i);return i}function xn(e,t,i){let r=_e(e.$id)?Tt(e,t):t,o=e;switch(o[P]){case"Array":return y8(o,r,i);case"Import":return h8(o,r,i);case"Intersect":return I8(o,r,i);case"Object":return b8(o,r,i);case"Record":return R8(o,r,i);case"Ref":return x8(o,r,i);case"This":return E8(o,r,i);case"Tuple":return P8(o,r,i);case"Union":return k8(o,r,i);default:return i}}function Sf(...e){return e.length===3?xn(e[0],e[1],e[2]):xn(e[0],[],e[1])}function yf(e){return _e(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function v8(e){return _i(e)||lr(e)||Xe(e)}function Fu(e){return e===!0||Xe(e)&&e===1||_i(e)&&e===BigInt("1")||_e(e)&&(e.toLowerCase()==="true"||e==="1")}function qu(e){return e===!1||Xe(e)&&(e===0||Object.is(e,-0))||_i(e)&&e===BigInt("0")||_e(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function _8(e){return _e(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function A8(e){return _e(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function O8(e){return _e(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function w8(e){return _e(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function T8(e){return _e(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function C8(e,t){let i=E$(e);return i===t?i:e}function L8(e,t){let i=P$(e);return i===t?i:e}function D8(e,t){let i=x$(e);return i===t?i:e}function $8(e,t){return _e(e.const)?C8(t,e.const):Xe(e.const)?L8(t,e.const):lr(e.const)?D8(t,e.const):t}function x$(e){return Fu(e)?!0:qu(e)?!1:e}function N8(e){let t=i=>i.split(".")[0];return yf(e)?BigInt(t(e)):Xe(e)?BigInt(Math.trunc(e)):qu(e)?BigInt(0):Fu(e)?BigInt(1):e}function E$(e){return Mr(e)&&e.description!==void 0?e.description.toString():v8(e)?e.toString():e}function P$(e){return yf(e)?parseFloat(e):Fu(e)?1:qu(e)?0:e}function j8(e){return yf(e)?parseInt(e):Xe(e)?Math.trunc(e):Fu(e)?1:qu(e)?0:e}function B8(e){return _e(e)&&e.toLowerCase()==="null"?null:e}function M8(e){return _e(e)&&e==="undefined"?void 0:e}function U8(e){return sn(e)?e:Xe(e)?new Date(e):Fu(e)?new Date(1):qu(e)?new Date(0):yf(e)?new Date(parseInt(e)):A8(e)?new Date(`1970-01-01T${e}.000Z`):_8(e)?new Date(`1970-01-01T${e}`):w8(e)?new Date(`${e}.000Z`):O8(e)?new Date(e):T8(e)?new Date(`${e}T00:00:00.000Z`):e}function F8(e,t,i){return(W(i)?i:[i]).map(o=>Mi(e.items,t,o))}function q8(e,t,i){return N8(i)}function z8(e,t,i){return x$(i)}function G8(e,t,i){return U8(i)}function K8(e,t,i){let r=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return Mi(o,[...t,...r],i)}function V8(e,t,i){return j8(i)}function H8(e,t,i){return e.allOf.reduce((r,o)=>Mi(o,t,r),i)}function W8(e,t,i){return $8(e,i)}function X8(e,t,i){return B8(i)}function Q8(e,t,i){return P$(i)}function Z8(e,t,i){if(!J(i)||W(i))return i;for(let r of Object.getOwnPropertyNames(e.properties))K(i,r)&&(i[r]=Mi(e.properties[r],t,i[r]));return i}function J8(e,t,i){if(!(J(i)&&!W(i)))return i;let o=Object.getOwnPropertyNames(e.patternProperties)[0],s=e.patternProperties[o];for(let[a,c]of Object.entries(i))i[a]=Mi(s,t,c);return i}function Y8(e,t,i){return Mi(xe(e,t),t,i)}function e9(e,t,i){return E$(i)}function t9(e,t,i){return _e(i)||Xe(i)?Symbol(i):i}function n9(e,t,i){return Mi(xe(e,t),t,i)}function i9(e,t,i){return W(i)&&!We(e.items)?i.map((o,s)=>s<e.items.length?Mi(e.items[s],t,o):o):i}function r9(e,t,i){return M8(i)}function o9(e,t,i){for(let r of e.anyOf)if(ne(r,t,i))return i;for(let r of e.anyOf){let o=Mi(r,t,ge(i));if(ne(r,t,o))return o}return i}function Mi(e,t,i){let r=Tt(e,t),o=e;switch(e[P]){case"Array":return F8(o,r,i);case"BigInt":return q8(o,r,i);case"Boolean":return z8(o,r,i);case"Date":return G8(o,r,i);case"Import":return K8(o,r,i);case"Integer":return V8(o,r,i);case"Intersect":return H8(o,r,i);case"Literal":return W8(o,r,i);case"Null":return X8(o,r,i);case"Number":return Q8(o,r,i);case"Object":return Z8(o,r,i);case"Record":return J8(o,r,i);case"Ref":return Y8(o,r,i);case"String":return e9(o,r,i);case"Symbol":return t9(o,r,i);case"This":return n9(o,r,i);case"Tuple":return i9(o,r,i);case"Undefined":return r9(o,r,i);case"Union":return o9(o,r,i);default:return i}}function hf(...e){return e.length===3?Mi(e[0],e[1],e[2]):Mi(e[0],[],e[1])}var If=class extends Q{constructor(t,i,r){super("Unable to decode value as it does not match the expected schema"),this.schema=t,this.value=i,this.error=r}},RR=class extends Q{constructor(t,i,r,o){super(o instanceof Error?o.message:"Unknown error"),this.schema=t,this.path=i,this.value=r,this.error=o}};function tt(e,t,i){try{return Ie(e)?e[Ye].Decode(i):i}catch(r){throw new RR(e,t,i,r)}}function s9(e,t,i,r){return W(r)?tt(e,i,r.map((o,s)=>Ui(e.items,t,`${i}/${s}`,o))):tt(e,i,r)}function a9(e,t,i,r){if(!J(r)||jn(r))return tt(e,i,r);let o=df(e),s=o.map(l=>l[0]),a={...r};for(let[l,p]of o)l in a&&(a[l]=Ui(p,t,`${i}/${l}`,a[l]));if(!Ie(e.unevaluatedProperties))return tt(e,i,a);let c=Object.getOwnPropertyNames(a),d=e.unevaluatedProperties,u={...a};for(let l of c)s.includes(l)||(u[l]=tt(d,`${i}/${l}`,u[l]));return tt(e,i,u)}function c9(e,t,i,r){let o=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref],a=Ui(s,[...t,...o],i,r);return tt(e,i,a)}function d9(e,t,i,r){return tt(e,i,Ui(e.not,t,i,r))}function u9(e,t,i,r){if(!J(r))return tt(e,i,r);let o=bn(e),s={...r};for(let u of o)K(s,u)&&(We(s[u])&&(!Gr(e.properties[u])||bt.IsExactOptionalProperty(s,u))||(s[u]=Ui(e.properties[u],t,`${i}/${u}`,s[u])));if(!et(e.additionalProperties))return tt(e,i,s);let a=Object.getOwnPropertyNames(s),c=e.additionalProperties,d={...s};for(let u of a)o.includes(u)||(d[u]=tt(c,`${i}/${u}`,d[u]));return tt(e,i,d)}function l9(e,t,i,r){if(!J(r))return tt(e,i,r);let o=Object.getOwnPropertyNames(e.patternProperties)[0],s=new RegExp(o),a={...r};for(let l of Object.getOwnPropertyNames(r))s.test(l)&&(a[l]=Ui(e.patternProperties[o],t,`${i}/${l}`,a[l]));if(!et(e.additionalProperties))return tt(e,i,a);let c=Object.getOwnPropertyNames(a),d=e.additionalProperties,u={...a};for(let l of c)s.test(l)||(u[l]=tt(d,`${i}/${l}`,u[l]));return tt(e,i,u)}function p9(e,t,i,r){let o=xe(e,t);return tt(e,i,Ui(o,t,i,r))}function m9(e,t,i,r){let o=xe(e,t);return tt(e,i,Ui(o,t,i,r))}function f9(e,t,i,r){return W(r)&&W(e.items)?tt(e,i,e.items.map((o,s)=>Ui(o,t,`${i}/${s}`,r[s]))):tt(e,i,r)}function g9(e,t,i,r){for(let o of e.anyOf){if(!ne(o,t,r))continue;let s=Ui(o,t,i,r);return tt(e,i,s)}return tt(e,i,r)}function Ui(e,t,i,r){let o=Tt(e,t),s=e;switch(e[P]){case"Array":return s9(s,o,i,r);case"Import":return c9(s,o,i,r);case"Intersect":return a9(s,o,i,r);case"Not":return d9(s,o,i,r);case"Object":return u9(s,o,i,r);case"Record":return l9(s,o,i,r);case"Ref":return p9(s,o,i,r);case"Symbol":return tt(s,i,r);case"This":return m9(s,o,i,r);case"Tuple":return f9(s,o,i,r);case"Union":return g9(s,o,i,r);default:return tt(s,i,r)}}function bf(e,t,i){return Ui(e,t,"",i)}var Rf=class extends Q{constructor(t,i,r){super("The encoded value does not match the expected schema"),this.schema=t,this.value=i,this.error=r}},xR=class extends Q{constructor(t,i,r,o){super(`${o instanceof Error?o.message:"Unknown error"}`),this.schema=t,this.path=i,this.value=r,this.error=o}};function Mt(e,t,i){try{return Ie(e)?e[Ye].Encode(i):i}catch(r){throw new xR(e,t,i,r)}}function S9(e,t,i,r){let o=Mt(e,i,r);return W(o)?o.map((s,a)=>Fi(e.items,t,`${i}/${a}`,s)):o}function y9(e,t,i,r){let o=globalThis.Object.values(e.$defs),s=e.$defs[e.$ref],a=Mt(e,i,r);return Fi(s,[...t,...o],i,a)}function h9(e,t,i,r){let o=Mt(e,i,r);if(!J(r)||jn(r))return o;let s=df(e),a=s.map(p=>p[0]),c={...o};for(let[p,m]of s)p in c&&(c[p]=Fi(m,t,`${i}/${p}`,c[p]));if(!Ie(e.unevaluatedProperties))return c;let d=Object.getOwnPropertyNames(c),u=e.unevaluatedProperties,l={...c};for(let p of d)a.includes(p)||(l[p]=Mt(u,`${i}/${p}`,l[p]));return l}function I9(e,t,i,r){return Mt(e.not,i,Mt(e,i,r))}function b9(e,t,i,r){let o=Mt(e,i,r);if(!J(o))return o;let s=bn(e),a={...o};for(let l of s)K(a,l)&&(We(a[l])&&(!Gr(e.properties[l])||bt.IsExactOptionalProperty(a,l))||(a[l]=Fi(e.properties[l],t,`${i}/${l}`,a[l])));if(!et(e.additionalProperties))return a;let c=Object.getOwnPropertyNames(a),d=e.additionalProperties,u={...a};for(let l of c)s.includes(l)||(u[l]=Mt(d,`${i}/${l}`,u[l]));return u}function R9(e,t,i,r){let o=Mt(e,i,r);if(!J(r))return o;let s=Object.getOwnPropertyNames(e.patternProperties)[0],a=new RegExp(s),c={...o};for(let p of Object.getOwnPropertyNames(r))a.test(p)&&(c[p]=Fi(e.patternProperties[s],t,`${i}/${p}`,c[p]));if(!et(e.additionalProperties))return c;let d=Object.getOwnPropertyNames(c),u=e.additionalProperties,l={...c};for(let p of d)a.test(p)||(l[p]=Mt(u,`${i}/${p}`,l[p]));return l}function x9(e,t,i,r){let o=xe(e,t),s=Fi(o,t,i,r);return Mt(e,i,s)}function E9(e,t,i,r){let o=xe(e,t),s=Fi(o,t,i,r);return Mt(e,i,s)}function P9(e,t,i,r){let o=Mt(e,i,r);return W(e.items)?e.items.map((s,a)=>Fi(s,t,`${i}/${a}`,o[a])):[]}function k9(e,t,i,r){for(let o of e.anyOf){if(!ne(o,t,r))continue;let s=Fi(o,t,i,r);return Mt(e,i,s)}for(let o of e.anyOf){let s=Fi(o,t,i,r);if(ne(e,t,s))return Mt(e,i,s)}return Mt(e,i,r)}function Fi(e,t,i,r){let o=Tt(e,t),s=e;switch(e[P]){case"Array":return S9(s,o,i,r);case"Import":return y9(s,o,i,r);case"Intersect":return h9(s,o,i,r);case"Not":return I9(s,o,i,r);case"Object":return b9(s,o,i,r);case"Record":return R9(s,o,i,r);case"Ref":return x9(s,o,i,r);case"This":return E9(s,o,i,r);case"Tuple":return P9(s,o,i,r);case"Union":return k9(s,o,i,r);default:return Mt(s,i,r)}}function xf(e,t,i){return Fi(e,t,"",i)}function v9(e,t){return Ie(e)||Ot(e.items,t)}function _9(e,t){return Ie(e)||Ot(e.items,t)}function A9(e,t){return Ie(e)||Ot(e.returns,t)||e.parameters.some(i=>Ot(i,t))}function O9(e,t){return Ie(e)||Ot(e.returns,t)||e.parameters.some(i=>Ot(i,t))}function w9(e,t){return Ie(e)||Ie(e.unevaluatedProperties)||e.allOf.some(i=>Ot(i,t))}function T9(e,t){let i=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((o,s)=>[...o,e.$defs[s]],[]),r=e.$defs[e.$ref];return Ie(e)||Ot(r,[...i,...t])}function C9(e,t){return Ie(e)||Ot(e.items,t)}function L9(e,t){return Ie(e)||Ot(e.not,t)}function D9(e,t){return Ie(e)||Object.values(e.properties).some(i=>Ot(i,t))||et(e.additionalProperties)&&Ot(e.additionalProperties,t)}function $9(e,t){return Ie(e)||Ot(e.item,t)}function N9(e,t){let i=Object.getOwnPropertyNames(e.patternProperties)[0],r=e.patternProperties[i];return Ie(e)||Ot(r,t)||et(e.additionalProperties)&&Ie(e.additionalProperties)}function j9(e,t){return Ie(e)?!0:Ot(xe(e,t),t)}function B9(e,t){return Ie(e)?!0:Ot(xe(e,t),t)}function M9(e,t){return Ie(e)||!We(e.items)&&e.items.some(i=>Ot(i,t))}function U9(e,t){return Ie(e)||e.anyOf.some(i=>Ot(i,t))}function Ot(e,t){let i=Tt(e,t),r=e;if(e.$id&&ER.has(e.$id))return!1;switch(e.$id&&ER.add(e.$id),e[P]){case"Array":return v9(r,i);case"AsyncIterator":return _9(r,i);case"Constructor":return A9(r,i);case"Function":return O9(r,i);case"Import":return T9(r,i);case"Intersect":return w9(r,i);case"Iterator":return C9(r,i);case"Not":return L9(r,i);case"Object":return D9(r,i);case"Promise":return $9(r,i);case"Record":return N9(r,i);case"Ref":return j9(r,i);case"This":return B9(r,i);case"Tuple":return M9(r,i);case"Union":return U9(r,i);default:return Ie(e)}}var ER=new Set;function Us(e,t){return ER.clear(),Ot(e,t)}function k$(...e){let[t,i,r]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!ne(t,i,r))throw new If(t,r,Do(t,i,r).First());return Us(t,i)?bf(t,i,r):r}function Wr(e,t){let i=K(e,"default")?e.default:void 0,r=ko(i)?i():ge(i);return We(t)?r:J(t)&&J(r)?Object.assign(r,t):t}function PR(e){return _o(e)&&"default"in e}function F9(e,t,i){if(W(i)){for(let o=0;o<i.length;o++)i[o]=cn(e.items,t,i[o]);return i}let r=Wr(e,i);if(!W(r))return r;for(let o=0;o<r.length;o++)r[o]=cn(e.items,t,r[o]);return r}function q9(e,t,i){return sn(i)?i:Wr(e,i)}function z9(e,t,i){let r=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];return cn(o,[...t,...r],i)}function G9(e,t,i){let r=Wr(e,i);return e.allOf.reduce((o,s)=>{let a=cn(s,t,r);return J(a)?{...o,...a}:a},{})}function K9(e,t,i){let r=Wr(e,i);if(!J(r))return r;let o=Object.getOwnPropertyNames(e.properties);for(let s of o){let a=cn(e.properties[s],t,r[s]);We(a)||(r[s]=cn(e.properties[s],t,r[s]))}if(!PR(e.additionalProperties))return r;for(let s of Object.getOwnPropertyNames(r))o.includes(s)||(r[s]=cn(e.additionalProperties,t,r[s]));return r}function V9(e,t,i){let r=Wr(e,i);if(!J(r))return r;let o=e.additionalProperties,[s,a]=Object.entries(e.patternProperties)[0],c=new RegExp(s);for(let d of Object.getOwnPropertyNames(r))c.test(d)&&PR(a)&&(r[d]=cn(a,t,r[d]));if(!PR(o))return r;for(let d of Object.getOwnPropertyNames(r))c.test(d)||(r[d]=cn(o,t,r[d]));return r}function H9(e,t,i){return cn(xe(e,t),t,Wr(e,i))}function W9(e,t,i){return cn(xe(e,t),t,i)}function X9(e,t,i){let r=Wr(e,i);if(!W(r)||We(e.items))return r;let[o,s]=[e.items,Math.max(e.items.length,r.length)];for(let a=0;a<s;a++)a<o.length&&(r[a]=cn(o[a],t,r[a]));return r}function Q9(e,t,i){let r=Wr(e,i);for(let o of e.anyOf){let s=cn(o,t,ge(r));if(ne(o,t,s))return s}return r}function cn(e,t,i){let r=Tt(e,t),o=e;switch(o[P]){case"Array":return F9(o,r,i);case"Date":return q9(o,r,i);case"Import":return z9(o,r,i);case"Intersect":return G9(o,r,i);case"Object":return K9(o,r,i);case"Record":return V9(o,r,i);case"Ref":return H9(o,r,i);case"This":return W9(o,r,i);case"Tuple":return X9(o,r,i);case"Union":return Q9(o,r,i);default:return Wr(o,i)}}function Ef(...e){return e.length===3?cn(e[0],e[1],e[2]):cn(e[0],[],e[1])}var qi={};Ht(qi,{Delete:()=>J9,Format:()=>zu,Get:()=>e3,Has:()=>Y9,Set:()=>Z9,ValuePointerRootDeleteError:()=>kf,ValuePointerRootSetError:()=>Pf});var Pf=class extends Q{constructor(t,i,r){super("Cannot set root value"),this.value=t,this.path=i,this.update=r}},kf=class extends Q{constructor(t,i){super("Cannot delete root value"),this.value=t,this.path=i}};function v$(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*zu(e){if(e==="")return;let[t,i]=[0,0];for(let r=0;r<e.length;r++)e.charAt(r)==="/"?(r===0||(i=r,yield v$(e.slice(t,i))),t=r+1):i=r;yield v$(e.slice(t))}function Z9(e,t,i){if(t==="")throw new Pf(e,t,i);let[r,o,s]=[null,e,""];for(let a of zu(t))o[a]===void 0&&(o[a]={}),r=o,o=o[a],s=a;r[s]=i}function J9(e,t){if(t==="")throw new kf(e,t);let[i,r,o]=[null,e,""];for(let s of zu(t)){if(r[s]===void 0||r[s]===null)return;i=r,r=r[s],o=s}if(Array.isArray(i)){let s=parseInt(o);i.splice(s,1)}else delete i[o]}function Y9(e,t){if(t==="")return!0;let[i,r,o]=[null,e,""];for(let s of zu(t)){if(r[s]===void 0)return!1;i=r,r=r[s],o=s}return Object.getOwnPropertyNames(i).includes(o)}function e3(e,t){if(t==="")return e;let i=e;for(let r of zu(t)){if(i[r]===void 0)return;i=i[r]}return i}function t3(e,t){if(!J(t))return!1;let i=[...Object.keys(e),...Object.getOwnPropertySymbols(e)],r=[...Object.keys(t),...Object.getOwnPropertySymbols(t)];return i.length!==r.length?!1:i.every(o=>Fs(e[o],t[o]))}function n3(e,t){return sn(t)&&e.getTime()===t.getTime()}function i3(e,t){return!W(t)||e.length!==t.length?!1:e.every((i,r)=>Fs(i,t[r]))}function r3(e,t){return!ci(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((i,r)=>Fs(i,t[r]))}function o3(e,t){return e===t}function Fs(e,t){if(sn(e))return n3(e,t);if(ci(e))return r3(e,t);if(W(e))return i3(e,t);if(J(e))return t3(e,t);if(jn(e))return o3(e,t);throw new Error("ValueEquals: Unable to compare value")}var s3=Re({type:le("insert"),path:an(),value:Ni()}),a3=Re({type:le("update"),path:an(),value:Ni()}),c3=Re({type:le("delete"),path:an()}),A$=be([s3,a3,c3]),vf=class extends Q{constructor(t,i){super(i),this.value=t}};function _f(e,t){return{type:"update",path:e,value:t}}function O$(e,t){return{type:"insert",path:e,value:t}}function w$(e){return{type:"delete",path:e}}function _$(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new vf(e,"Cannot diff objects with symbols")}function*d3(e,t,i){if(_$(t),_$(i),!Fb(i))return yield _f(e,i);let r=globalThis.Object.getOwnPropertyNames(t),o=globalThis.Object.getOwnPropertyNames(i);for(let s of o)K(t,s)||(yield O$(`${e}/${s}`,i[s]));for(let s of r)K(i,s)&&(Fs(t,i)||(yield*Af(`${e}/${s}`,t[s],i[s])));for(let s of r)K(i,s)||(yield w$(`${e}/${s}`))}function*u3(e,t,i){if(!W(i))return yield _f(e,i);for(let r=0;r<Math.min(t.length,i.length);r++)yield*Af(`${e}/${r}`,t[r],i[r]);for(let r=0;r<i.length;r++)r<t.length||(yield O$(`${e}/${r}`,i[r]));for(let r=t.length-1;r>=0;r--)r<i.length||(yield w$(`${e}/${r}`))}function*l3(e,t,i){if(!ci(i)||t.length!==i.length||globalThis.Object.getPrototypeOf(t).constructor.name!==globalThis.Object.getPrototypeOf(i).constructor.name)return yield _f(e,i);for(let r=0;r<Math.min(t.length,i.length);r++)yield*Af(`${e}/${r}`,t[r],i[r])}function*p3(e,t,i){t!==i&&(yield _f(e,i))}function*Af(e,t,i){if(Fb(t))return yield*d3(e,t,i);if(W(t))return yield*u3(e,t,i);if(ci(t))return yield*l3(e,t,i);if(jn(t))return yield*p3(e,t,i);throw new vf(t,"Unable to diff value")}function T$(e,t){return[...Af("",e,t)]}function m3(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function f3(e){return e.length===0}function C$(e,t){if(m3(t))return ge(t[0].value);if(f3(t))return ge(e);let i=ge(e);for(let r of t)switch(r.type){case"insert":{qi.Set(i,r.path,r.value);break}case"update":{qi.Set(i,r.path,r.value);break}case"delete":{qi.Delete(i,r.path);break}}return i}function L$(...e){let[t,i,r]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],o=Us(t,i)?xf(t,i,r):r;if(!ne(t,i,o))throw new Rf(t,o,Do(t,i,o).First());return o}function Of(e){return J(e)&&!W(e)}var wf=class extends Q{constructor(t){super(t)}};function g3(e,t,i,r){if(!Of(i))qi.Set(e,t,ge(r));else{let o=Object.getOwnPropertyNames(i),s=Object.getOwnPropertyNames(r);for(let a of o)s.includes(a)||delete i[a];for(let a of s)o.includes(a)||(i[a]=null);for(let a of s)kR(e,`${t}/${a}`,i[a],r[a])}}function S3(e,t,i,r){if(!W(i))qi.Set(e,t,ge(r));else{for(let o=0;o<r.length;o++)kR(e,`${t}/${o}`,i[o],r[o]);i.splice(r.length)}}function y3(e,t,i,r){if(ci(i)&&i.length===r.length)for(let o=0;o<i.length;o++)i[o]=r[o];else qi.Set(e,t,ge(r))}function h3(e,t,i,r){i!==r&&qi.Set(e,t,r)}function kR(e,t,i,r){if(W(r))return S3(e,t,i,r);if(ci(r))return y3(e,t,i,r);if(Of(r))return g3(e,t,i,r);if(jn(r))return h3(e,t,i,r)}function D$(e){return ci(e)||jn(e)}function I3(e,t){return Of(e)&&W(t)||W(e)&&Of(t)}function $$(e,t){if(D$(e)||D$(t))throw new wf("Only object and array types can be mutated at the root level");if(I3(e,t))throw new wf("Cannot assign due type mismatch of assignable values");kR(e,"",e,t)}var Tf=class extends Q{constructor(t){super(t)}},vR;(function(e){let t=new Map([["Assert",(s,a,c)=>(ff(s,a,c),c)],["Cast",(s,a,c)=>Uu(s,a,c)],["Clean",(s,a,c)=>Sf(s,a,c)],["Clone",(s,a,c)=>ge(c)],["Convert",(s,a,c)=>hf(s,a,c)],["Decode",(s,a,c)=>Us(s,a)?bf(s,a,c):c],["Default",(s,a,c)=>Ef(s,a,c)],["Encode",(s,a,c)=>Us(s,a)?xf(s,a,c):c]]);function i(s){t.delete(s)}e.Delete=i;function r(s,a){t.set(s,a)}e.Set=r;function o(s){return t.get(s)}e.Get=o})(vR||(vR={}));var N$=["Clone","Clean","Default","Convert","Assert","Decode"];function b3(e,t,i,r){return e.reduce((o,s)=>{let a=vR.Get(s);if(We(a))throw new Tf(`Unable to find Parse operation '${s}'`);return a(t,i,o)},r)}function j$(...e){let[t,i,r,o]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?W(e[0])?[e[0],e[1],[],e[2]]:[N$,e[0],e[1],e[2]]:e.length===2?[N$,e[0],[],e[1]]:(()=>{throw new Tf("Invalid Arguments")})();return b3(t,i,r,o)}var gr={};Ht(gr,{Assert:()=>ff,Cast:()=>Uu,Check:()=>ne,Clean:()=>Sf,Clone:()=>ge,Convert:()=>hf,Create:()=>ji,Decode:()=>k$,Default:()=>Ef,Diff:()=>T$,Edit:()=>A$,Encode:()=>L$,Equal:()=>Fs,Errors:()=>Do,Hash:()=>mc,Mutate:()=>$$,Parse:()=>j$,Patch:()=>C$,ValueErrorIterator:()=>Lo});var _B=Po(Zr(),1);function Ko(e){return e.errors.map(t=>`${t.path||"(root)"}: ${t.message}`).join(`
|
|
142
|
+
`)}function ze(e,t){if(gr.Check(e,t))return{success:!0,data:t};let i=[...gr.Errors(e,t)].map(o=>({path:o.path,message:o.message}));return{success:!1,error:{message:i.map(o=>`${o.path||"(root)"}: ${o.message}`).join(`
|
|
143
|
+
`),errors:i}}}function hr(e,t){let i=ze(e,t);if(i.success)return i.data;throw new Error(Ko(i.error))}var Wne=new Set(["$id","$schema","~standard","static","params","kind"]);function aE(e){if(Array.isArray(e))return e.map(aE);if(e!==null&&typeof e=="object"){let t={};for(let[i,r]of Object.entries(e))Wne.has(i)||(t[i]=aE(r));return t}return e}var vB=new Map;function cE(e,t){let i=vB.get(e);if(i!==void 0)return i;let r=aE(t),o=(0,_B.stringify)(r);return vB.set(e,o),o}var he={keepAlive:"/api/keep-alive",enqueue:"/api/enqueue",cancel:"/api/cancel/:sessionId",daemonStop:"/api/daemon/stop",autoBuildGet:"/api/auto-build",autoBuildSet:"/api/auto-build",profileList:"/api/profile/list",profileShow:"/api/profile/show",profileUse:"/api/profile/use",profileCreate:"/api/profile/create",profileDelete:"/api/profile/:name",modelProviders:"/api/models/providers",modelList:"/api/models/list",projectContext:"/api/project-context",health:"/api/health",version:"/api/version",configShow:"/api/config/show",configValidate:"/api/config/validate",extensionList:"/api/extensions/list",extensionShow:"/api/extensions/show",extensionValidate:"/api/extensions/validate",extensionTest:"/api/extensions/test",extensionTrust:"/api/extensions/trust",extensionUntrust:"/api/extensions/untrust",extensionNew:"/api/extensions/new",extensionReload:"/api/extensions/reload",extensionInstall:"/api/extensions/install",extensionUpdate:"/api/extensions/update",extensionRemove:"/api/extensions/remove",extensionPromote:"/api/extensions/promote",extensionDemote:"/api/extensions/demote",extensionContributionManifest:"/api/extensions/contributions",extensionWorkstationFrame:"/api/extensions/workstations/:workstationId/frame",extensionWorkstationAsset:"/api/extensions/workstations/:workstationId/assets/:assetId",extensionActionInvoke:"/api/extensions/actions/invoke",extensionAgentTaskStart:"/api/extensions/agent-tasks",extensionAgentTaskGet:"/api/extensions/agent-tasks/:taskId",extensionAgentTaskCancel:"/api/extensions/agent-tasks/:taskId/cancel",queue:"/api/queue",queuePriority:"/api/queue/:prdId/priority",queueRemove:"/api/queue/:prdId",queueDependencyOverride:"/api/queue/:prdId/dependencies/override",queueHold:"/api/queue/:prdId/hold",queueUnhold:"/api/queue/:prdId/unhold",queueCascadePreview:"/api/queue/:prdId/cascade/preview",queueCascadeApply:"/api/queue/:prdId/cascade/apply",queueRecoveryAnalyze:"/api/queue/recovery/analyze",queueRecoveryApply:"/api/queue/recovery/apply",sessionMetadata:"/api/session-metadata",runs:"/api/runs",spend:"/api/spend",efficiencyAnalytics:"/api/efficiency-analytics",events:"/api/events/:runId",runSummary:"/api/run-summary/:id",runState:"/api/run-state/:id",plans:"/api/plans/:runId",diff:"/api/diff/:sessionId/:planId",recover:"/api/recover",recoveryGuidancePrepare:"/api/recover/guidance/prepare",readRecoverySidecar:"/api/recovery/sidecar",applyRecovery:"/api/recover/apply",acceptRecoverySuccessPreview:"/api/recover/accept-success/preview",acceptRecoverySuccess:"/api/recover/accept-success",continueRepair:"/api/recover/continue-repair",continueRepairEligibility:"/api/recover/continue-repair/eligibility",schedulerKick:"/api/scheduler/kick",failedEnqueues:"/api/enqueue/failed",failedEnqueueReenqueue:"/api/enqueue/failed/:runId/reenqueue",failedEnqueueDismiss:"/api/enqueue/failed/:runId/dismiss",schedulerPause:"/api/scheduler/pause",schedulerResume:"/api/scheduler/resume",sessionPlanList:"/api/session-plan/list",sessionPlanShow:"/api/session-plan/show",sessionPlanCreate:"/api/session-plan/create",sessionPlanSetSection:"/api/session-plan/set-section",sessionPlanSkipDimension:"/api/session-plan/skip-dimension",sessionPlanSetStatus:"/api/session-plan/set-status",sessionPlanSelectDimensions:"/api/session-plan/select-dimensions",sessionPlanReadiness:"/api/session-plan/readiness",sessionPlanMigrateLegacy:"/api/session-plan/migrate-legacy",sessionPlanSetList:"/api/session-plan-set/list",sessionPlanSetShow:"/api/session-plan-set/show",sessionPlanSetValidate:"/api/session-plan-set/validate",daemonEvents:"/api/daemon-events",stackLayers:"/api/stack/layers",stackSync:"/api/stack/sync",stackSyncStatus:"/api/stack/sync/status"};function _c(e,t){return t===void 0?Qe(e):Qe({...t,...e})}function AB(e){return E({[P]:"Argument",index:e})}function Xne(e,t){return Ke("Awaited",[Ke(e,t)])}function Qne(e){return Ke("Awaited",[fr(e)])}function Zne(e){return Qt(OB(e))}function Jne(e){return be(OB(e))}function Yne(e){return Ac(e)}function OB(e){return e.map(t=>Ac(t))}function Ac(e,t){return E(Ti(e)?Xne(e.target,e.parameters):at(e)?Zne(e.allOf):pe(e)?Jne(e.anyOf):$s(e)?Yne(e.item):pt(e)?Qne(e.$ref):e,t)}function eie(e){let t=[];for(let i of e)t.push(...bn(i));return rD(t)}function tie(e){return e.filter(t=>!vo(t))}function nie(e,t){let i=[];for(let r of e)i.push(...Nu(r,[t]));return tie(i)}function iie(e,t){let i={};for(let r of t)i[r]=nf(nie(e,r));return i}function wB(e,t){let i=eie(e),r=iie(e,i);return Re(r,t)}function wg(e){return E({[P]:"Date",type:"Date"},e)}function Tg(e){return E({[P]:"Null",type:"null"},e)}function Cg(e){return E({[P]:"Symbol",type:"symbol"},e)}function Lg(e){return E({[P]:"Undefined",type:"undefined"},e)}function Dg(e){return E({[P]:"Uint8Array",type:"Uint8Array"},e)}function rie(e){return e.map(t=>dE(t,!1))}function oie(e){let t={};for(let i of globalThis.Object.getOwnPropertyNames(e))t[i]=In(dE(e[i],!1));return t}function $g(e,t){return t===!0?e:In(e)}function dE(e,t){return qb(e)?$g(To(),t):Gb(e)?$g(To(),t):yt(e)?In(li(rie(e))):Fr(e)?Dg():Ts(e)?wg():De(e)?$g(Re(oie(e)),t):zb(e)?$g(pr([],Ni()),t):ht(e)?Lg():Kb(e)?Tg():Vb(e)?Cg():vu(e)?ac():Mn(e)?le(e):Ur(e)?le(e):Fe(e)?le(e):Re({})}function TB(e,t){return E(dE(e,!0),t)}function CB(e,t){return Ci(e)?li(e.parameters,t):oe(t)}function LB(e,t){if(ht(e))throw new Error("Enum undefined or empty");let i=globalThis.Object.getOwnPropertyNames(e).filter(s=>isNaN(s)).map(s=>e[s]),o=[...new Set(i)].map(s=>le(s));return be(o,{...t,[di]:"Enum"})}function DB(e,t){return Oc(Bs(e),t)}function sie(e,t){let i=e.filter(r=>Co(r,t)===k.False);return i.length===1?i[0]:be(i)}function Oc(e,t,i={}){return qn(e)?E(DB(e,t),i):Ze(e)?E($B(e,t),i):E(pe(e)?sie(e.anyOf,t):Co(e,t)!==k.False?oe():e,i)}function aie(e,t){let i={};for(let r of globalThis.Object.getOwnPropertyNames(e))i[r]=Oc(e[r],t);return i}function cie(e,t){return aie(e.properties,t)}function $B(e,t){let i=cie(e,t);return fe(i)}function NB(e,t){return wc(Bs(e),t)}function die(e,t){let i=e.filter(r=>Co(r,t)!==k.False);return i.length===1?i[0]:be(i)}function wc(e,t,i){return qn(e)?E(NB(e,t),i):Ze(e)?E(jB(e,t),i):E(pe(e)?die(e.anyOf,t):Co(e,t)!==k.False?e:oe(),i)}function uie(e,t){let i={};for(let r of globalThis.Object.getOwnPropertyNames(e))i[r]=wc(e[r],t);return i}function lie(e,t){return uie(e.properties,t)}function jB(e,t){let i=lie(e,t);return fe(i)}function BB(e,t){return Ci(e)?E(e.returns,t):oe(t)}function Ng(e){return In(Xt(e))}function Ws(e,t,i){return E({[P]:"Record",type:"object",patternProperties:{[e]:t}},i)}function uE(e,t,i){let r={};for(let o of e)r[o]=t;return Re(r,{...i,[di]:"Record"})}function pie(e,t,i){return of(e)?uE(hn(e),t,i):Ws(e.pattern,t,i)}function mie(e,t,i){return uE(hn(be(e)),t,i)}function fie(e,t,i){return uE([e.toString()],t,i)}function gie(e,t,i){return Ws(e.source,t,i)}function Sie(e,t,i){let r=ht(e.pattern)?Oo:e.pattern;return Ws(r,t,i)}function yie(e,t,i){return Ws(Oo,t,i)}function hie(e,t,i){return Ws(XL,t,i)}function Iie(e,t,i){return Re({true:t,false:t},i)}function bie(e,t,i){return Ws(Ao,t,i)}function Rie(e,t,i){return Ws(Ao,t,i)}function jg(e,t,i={}){return pe(e)?mie(e.anyOf,t,i):qn(e)?pie(e,t,i):Un(e)?fie(e.const,t,i):qr(e)?Iie(e,t,i):Di(e)?bie(e,t,i):$i(e)?Rie(e,t,i):Xb(e)?gie(e,t,i):zr(e)?Sie(e,t,i):Hb(e)?yie(e,t,i):vo(e)?hie(e,t,i):oe(i)}function Bg(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function MB(e){let t=Bg(e);return t===Oo?an():t===Ao?ui():an({pattern:t})}function Mg(e){return e.patternProperties[Bg(e)]}function xie(e,t){return t.parameters=bl(e,t.parameters),t.returns=Ki(e,t.returns),t}function Eie(e,t){return t.parameters=bl(e,t.parameters),t.returns=Ki(e,t.returns),t}function Pie(e,t){return t.allOf=bl(e,t.allOf),t}function kie(e,t){return t.anyOf=bl(e,t.anyOf),t}function vie(e,t){return ht(t.items)||(t.items=bl(e,t.items)),t}function _ie(e,t){return t.items=Ki(e,t.items),t}function Aie(e,t){return t.items=Ki(e,t.items),t}function Oie(e,t){return t.items=Ki(e,t.items),t}function wie(e,t){return t.item=Ki(e,t.item),t}function Tie(e,t){let i=$ie(e,t.properties);return{...t,...Re(i)}}function Cie(e,t){let i=Ki(e,MB(t)),r=Ki(e,Mg(t)),o=jg(i,r);return{...t,...o}}function Lie(e,t){return t.index in e?e[t.index]:Ni()}function Die(e,t){let i=ic(t),r=yn(t),o=Ki(e,t);return i&&r?Ng(o):i&&!r?In(o):!i&&r?Xt(o):o}function $ie(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((i,r)=>({...i,[r]:Die(e,t[r])}),{})}function bl(e,t){return t.map(i=>Ki(e,i))}function Ki(e,t){return Ci(t)?xie(e,t):Li(t)?Eie(e,t):at(t)?Pie(e,t):pe(t)?kie(e,t):zn(t)?vie(e,t):wi(t)?_ie(e,t):Cs(t)?Aie(e,t):Ds(t)?Oie(e,t):$s(t)?wie(e,t):It(t)?Tie(e,t):Ns(t)?Cie(e,t):Wb(t)?Lie(e,t):t}function UB(e,t){return Ki(t,_c(e))}function FB(e){return E({[P]:"Integer",type:"integer"},e)}function Nie(e,t,i){return{[e]:Vi(le(e),t,Qe(i))}}function jie(e,t,i){return e.reduce((o,s)=>({...o,...Nie(s,t,i)}),{})}function Bie(e,t,i){return jie(e.keys,t,i)}function qB(e,t,i){let r=Bie(e,t,i);return fe(r)}function Mie(e){let[t,i]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),i].join("")}function Uie(e){let[t,i]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),i].join("")}function Fie(e){return e.toUpperCase()}function qie(e){return e.toLowerCase()}function zie(e,t,i){let r=oc(e.pattern);if(!js(r))return{...e,pattern:zB(e.pattern,t)};let a=[...Du(r)].map(u=>le(u)),c=GB(a,t),d=be(c);return af([d],i)}function zB(e,t){return typeof e=="string"?t==="Uncapitalize"?Mie(e):t==="Capitalize"?Uie(e):t==="Uppercase"?Fie(e):t==="Lowercase"?qie(e):e:e.toString()}function GB(e,t){return e.map(i=>Vi(i,t))}function Vi(e,t,i={}){return Fn(e)?qB(e,t,i):qn(e)?zie(e,t,i):pe(e)?be(GB(e.anyOf,t),i):Un(e)?le(zB(e.const,t),i):E(e,i)}function KB(e,t={}){return Vi(e,"Capitalize",t)}function VB(e,t={}){return Vi(e,"Lowercase",t)}function HB(e,t={}){return Vi(e,"Uncapitalize",t)}function WB(e,t={}){return Vi(e,"Uppercase",t)}function Gie(e,t,i){let r={};for(let o of globalThis.Object.getOwnPropertyNames(e))r[o]=Vo(e[o],t,Qe(i));return r}function Kie(e,t,i){return Gie(e.properties,t,i)}function XB(e,t,i){let r=Kie(e,t,i);return fe(r)}function Vie(e,t){return e.map(i=>lE(i,t))}function Hie(e,t){return e.map(i=>lE(i,t))}function Wie(e,t){let{[t]:i,...r}=e;return r}function Xie(e,t){return t.reduce((i,r)=>Wie(i,r),e)}function Qie(e,t,i){let r=st(e,[Ye,"$id","required","properties"]),o=Xie(i,t);return Re(o,r)}function Zie(e){let t=e.reduce((i,r)=>tf(r)?[...i,le(r)]:i,[]);return be(t)}function lE(e,t){return at(e)?Qt(Vie(e.allOf,t)):pe(e)?be(Hie(e.anyOf,t)):It(e)?Qie(e,t,e.properties):Re({})}function Vo(e,t,i){let r=yt(t)?Zie(t):t,o=et(t)?hn(t):t,s=pt(e),a=pt(t);return Ze(e)?XB(e,o,i):Fn(t)?QB(e,t,i):s&&a?Ke("Omit",[e,r],i):!s&&a?Ke("Omit",[e,r],i):s&&!a?Ke("Omit",[e,r],i):E({...lE(e,o),...i})}function Jie(e,t,i){return{[t]:Vo(e,[t],Qe(i))}}function Yie(e,t,i){return t.reduce((r,o)=>({...r,...Jie(e,o,i)}),{})}function ere(e,t,i){return Yie(e,t.keys,i)}function QB(e,t,i){let r=ere(e,t,i);return fe(r)}function tre(e,t,i){let r={};for(let o of globalThis.Object.getOwnPropertyNames(e))r[o]=Ho(e[o],t,Qe(i));return r}function nre(e,t,i){return tre(e.properties,t,i)}function ZB(e,t,i){let r=nre(e,t,i);return fe(r)}function ire(e,t){return e.map(i=>pE(i,t))}function rre(e,t){return e.map(i=>pE(i,t))}function ore(e,t){let i={};for(let r of t)r in e&&(i[r]=e[r]);return i}function sre(e,t,i){let r=st(e,[Ye,"$id","required","properties"]),o=ore(i,t);return Re(o,r)}function are(e){let t=e.reduce((i,r)=>tf(r)?[...i,le(r)]:i,[]);return be(t)}function pE(e,t){return at(e)?Qt(ire(e.allOf,t)):pe(e)?be(rre(e.anyOf,t)):It(e)?sre(e,t,e.properties):Re({})}function Ho(e,t,i){let r=yt(t)?are(t):t,o=et(t)?hn(t):t,s=pt(e),a=pt(t);return Ze(e)?ZB(e,o,i):Fn(t)?JB(e,t,i):s&&a?Ke("Pick",[e,r],i):!s&&a?Ke("Pick",[e,r],i):s&&!a?Ke("Pick",[e,r],i):E({...pE(e,o),...i})}function cre(e,t,i){return{[t]:Ho(e,[t],Qe(i))}}function dre(e,t,i){return t.reduce((r,o)=>({...r,...cre(e,o,i)}),{})}function ure(e,t,i){return dre(e,t.keys,i)}function JB(e,t,i){let r=ure(e,t,i);return fe(r)}function lre(e,t){return Ke("Partial",[Ke(e,t)])}function pre(e){return Ke("Partial",[fr(e)])}function mre(e){let t={};for(let i of globalThis.Object.getOwnPropertyNames(e))t[i]=Xt(e[i]);return t}function fre(e,t){let i=st(e,[Ye,"$id","required","properties"]),r=mre(t);return Re(r,i)}function YB(e){return e.map(t=>e0(t))}function e0(e){return Ti(e)?lre(e.target,e.parameters):pt(e)?pre(e.$ref):at(e)?Qt(YB(e.allOf)):pe(e)?be(YB(e.anyOf)):It(e)?fre(e,e.properties):Ls(e)||qr(e)||Di(e)||Un(e)||Ou(e)||$i(e)||zr(e)||wu(e)||Gr(e)?e:Re({})}function Tc(e,t){return Ze(e)?t0(e,t):E({...e0(e),...t})}function gre(e,t){let i={};for(let r of globalThis.Object.getOwnPropertyNames(e))i[r]=Tc(e[r],Qe(t));return i}function Sre(e,t){return gre(e.properties,t)}function t0(e,t){let i=Sre(e,t);return fe(i)}function yre(e,t){return Ke("Required",[Ke(e,t)])}function hre(e){return Ke("Required",[fr(e)])}function Ire(e){let t={};for(let i of globalThis.Object.getOwnPropertyNames(e))t[i]=st(e[i],[Bt]);return t}function bre(e,t){let i=st(e,[Ye,"$id","required","properties"]),r=Ire(t);return Re(r,i)}function n0(e){return e.map(t=>i0(t))}function i0(e){return Ti(e)?yre(e.target,e.parameters):pt(e)?hre(e.$ref):at(e)?Qt(n0(e.allOf)):pe(e)?be(n0(e.anyOf)):It(e)?bre(e,e.properties):Ls(e)||qr(e)||Di(e)||Un(e)||Ou(e)||$i(e)||zr(e)||wu(e)||Gr(e)?e:Re({})}function Cc(e,t){return Ze(e)?r0(e,t):E({...i0(e),...t})}function Rre(e,t){let i={};for(let r of globalThis.Object.getOwnPropertyNames(e))i[r]=Cc(e[r],t);return i}function xre(e,t){return Rre(e.properties,t)}function r0(e,t){let i=xre(e,t);return fe(i)}function Ere(e,t){return t.map(i=>pt(i)?mE(e,i.$ref):Hn(e,i))}function mE(e,t){return t in e?pt(e[t])?mE(e,e[t].$ref):Hn(e,e[t]):oe()}function Pre(e){return Ac(e[0])}function kre(e){return wo(e[0],e[1])}function vre(e){return uc(e[0])}function _re(e){return Tc(e[0])}function Are(e){return Vo(e[0],e[1])}function Ore(e){return Ho(e[0],e[1])}function wre(e){return Cc(e[0])}function Tre(e,t,i){let r=Ere(e,i);return t==="Awaited"?Pre(r):t==="Index"?kre(r):t==="KeyOf"?vre(r):t==="Partial"?_re(r):t==="Omit"?Are(r):t==="Pick"?Ore(r):t==="Required"?wre(r):oe()}function Cre(e,t){return ec(Hn(e,t))}function Lre(e,t){return tc(Hn(e,t))}function Dre(e,t,i){return nc(Rl(e,t),Hn(e,i))}function $re(e,t,i){return pr(Rl(e,t),Hn(e,i))}function Nre(e,t){return Qt(Rl(e,t))}function jre(e,t){return cc(Hn(e,t))}function Bre(e,t){return Re(globalThis.Object.keys(t).reduce((i,r)=>({...i,[r]:Hn(e,t[r])}),{}))}function Mre(e,t){let[i,r]=[Hn(e,Mg(t)),Bg(t)],o=_c(t);return o.patternProperties[r]=i,o}function Ure(e,t){return pt(t)?{...mE(e,t.$ref),[Ye]:t[Ye]}:t}function Fre(e,t){return li(Rl(e,t))}function qre(e,t){return be(Rl(e,t))}function Rl(e,t){return t.map(i=>Hn(e,i))}function Hn(e,t){return yn(t)?E(Hn(e,st(t,[Bt])),t):ic(t)?E(Hn(e,st(t,[Oi])),t):Ie(t)?E(Ure(e,t),t):wi(t)?E(Cre(e,t.items),t):Cs(t)?E(Lre(e,t.items),t):Ti(t)?E(Tre(e,t.target,t.parameters)):Ci(t)?E(Dre(e,t.parameters,t.returns),t):Li(t)?E($re(e,t.parameters,t.returns),t):at(t)?E(Nre(e,t.allOf),t):Ds(t)?E(jre(e,t.items),t):It(t)?E(Bre(e,t.properties),t):Ns(t)?E(Mre(e,t)):zn(t)?E(Fre(e,t.items||[]),t):pe(t)?E(qre(e,t.anyOf),t):t}function zre(e,t){return t in e?Hn(e,e[t]):oe()}function o0(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,i)=>({...t,[i]:zre(e,i)}),{})}var fE=class{constructor(t){let i=o0(t),r=this.WithIdentifiers(i);this.$defs=r}Import(t,i){let r={...this.$defs,[t]:E(this.$defs[t],i)};return E({[P]:"Import",$defs:r,$ref:t})}WithIdentifiers(t){return globalThis.Object.getOwnPropertyNames(t).reduce((i,r)=>({...i,[r]:{...t[r],$id:r}}),{})}};function s0(e){return new fE(e)}function a0(e,t){return E({[P]:"Not",not:e},t)}function c0(e,t){return Li(e)?li(e.parameters,t):oe()}var Gre=0;function d0(e,t={}){ht(t.$id)&&(t.$id=`T${Gre++}`);let i=_c(e({[P]:"This",$ref:`${t.$id}`}));return i.$id=t.$id,E({[di]:"Recursive",...i},t)}function u0(e,t){let i=Fe(e)?new globalThis.RegExp(e):e;return E({[P]:"RegExp",type:"RegExp",source:i.source,flags:i.flags},t)}function Kre(e){return at(e)?e.allOf:pe(e)?e.anyOf:zn(e)?e.items??[]:[]}function l0(e){return Kre(e)}function p0(e,t){return Li(e)?E(e.returns,t):oe(t)}var gE=class{constructor(t){this.schema=t}Decode(t){return new SE(this.schema,t)}},SE=class{constructor(t,i){this.schema=t,this.decode=i}EncodeTransform(t,i){let s={Encode:a=>i[Ye].Encode(t(a)),Decode:a=>this.decode(i[Ye].Decode(a))};return{...i,[Ye]:s}}EncodeSchema(t,i){let r={Decode:this.decode,Encode:t};return{...i,[Ye]:r}}Encode(t){return Ie(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function m0(e){return new gE(e)}function f0(e){return E({[P]:"Void",type:"void"},e)}var yE={};Ht(yE,{Any:()=>To,Argument:()=>AB,Array:()=>ec,AsyncIterator:()=>tc,Awaited:()=>Ac,BigInt:()=>ac,Boolean:()=>sf,Capitalize:()=>KB,Composite:()=>wB,Const:()=>TB,Constructor:()=>nc,ConstructorParameters:()=>CB,Date:()=>wg,Enum:()=>LB,Exclude:()=>Oc,Extends:()=>gc,Extract:()=>wc,Function:()=>pr,Index:()=>wo,InstanceType:()=>BB,Instantiate:()=>UB,Integer:()=>FB,Intersect:()=>Qt,Iterator:()=>cc,KeyOf:()=>uc,Literal:()=>le,Lowercase:()=>VB,Mapped:()=>cD,Module:()=>s0,Never:()=>oe,Not:()=>a0,Null:()=>Tg,Number:()=>ui,Object:()=>Re,Omit:()=>Vo,Optional:()=>Xt,Parameters:()=>c0,Partial:()=>Tc,Pick:()=>Ho,Promise:()=>cf,Readonly:()=>In,ReadonlyOptional:()=>Ng,Record:()=>jg,Recursive:()=>d0,Ref:()=>fr,RegExp:()=>u0,Required:()=>Cc,Rest:()=>l0,ReturnType:()=>p0,String:()=>an,Symbol:()=>Cg,TemplateLiteral:()=>af,Transform:()=>m0,Tuple:()=>li,Uint8Array:()=>Dg,Uncapitalize:()=>HB,Undefined:()=>Lg,Union:()=>be,Unknown:()=>Ni,Unsafe:()=>qL,Uppercase:()=>WB,Void:()=>f0});var n=yE;var Ug=2e3,Jr=32,Fg=16,Lc=64,El=32,Si=128,qg=32,zg=64,Gg=8,Kg=1e4,Y=n.String({maxLength:Ug}),hE=n.Array(Y,{maxItems:Jr}),ct=n.Integer({minimum:0}),nt=n.Integer({minimum:1}),IE=n.String({pattern:"^[a-f0-9]{64}$"}),Pl=["planning:decomposition:start","planning:decomposition:unit:queued","planning:decomposition:unit:running","planning:decomposition:unit:progress","planning:decomposition:unit:completed","planning:decomposition:unit:skipped","planning:decomposition:unit:failed","planning:decomposition:schedule","planning:decomposition:budget","planning:decomposition:compact-handoff","planning:decomposition:synthesis:complete"],Vg=n.Union([n.Literal("queued"),n.Literal("running"),n.Literal("completed"),n.Literal("skipped"),n.Literal("failed")]),kl=n.Object({parallelism:nt,maxDepth:nt,maxPromptSourceBytes:nt,maxPromptBytes:nt,maxObservedInputTokens:nt,maxObservedTurns:n.Optional(nt),maxCompactHandoffBytes:nt,maxLocalExplorationToolUses:nt,maxCriteriaPerUnit:nt,maxSubsystemsPerUnit:nt,maxSplitAttemptsPerUnit:nt},{additionalProperties:!1}),Dc=n.Object({maxRecursiveDepth:ct,maxPromptSourceBytes:nt,maxPromptBytes:nt,maxObservedInputTokens:nt,maxObservedTurns:n.Optional(nt),maxCompactHandoffBytes:nt,maxLocalExplorationToolUses:nt,maxCriteriaPerUnit:nt,maxSubsystemsPerUnit:nt,maxSplitAttemptsPerUnit:nt},{additionalProperties:!1}),Xs=n.Object({promptSourceBytes:n.Optional(ct),promptBytes:n.Optional(ct),observedInputTokens:n.Optional(ct),observedTurns:n.Optional(ct),compactHandoffBytes:n.Optional(ct),localExplorationToolUses:n.Optional(ct),criteriaCount:n.Optional(ct),subsystemCount:n.Optional(ct),splitAttempts:n.Optional(ct),triggeredLimitKeys:n.Array(Y,{maxItems:Jr})},{additionalProperties:!1}),Hg=n.Object({kind:n.Union([n.Literal("prd"),n.Literal("artifact"),n.Literal("file"),n.Literal("criteria"),n.Literal("other")]),sourceHash:IE,path:n.Optional(Y),headingPath:n.Optional(hE),startLine:n.Optional(nt),endLine:n.Optional(nt),byteStart:n.Optional(ct),byteEnd:n.Optional(ct),criteriaIds:n.Array(Y,{maxItems:Lc}),byteLength:ct},{additionalProperties:!1}),Wg=n.Object({criterionId:Y,sourceHash:n.Optional(IE),coveredByUnitIds:n.Array(Y,{maxItems:Si})},{additionalProperties:!1}),vl=n.Object({criterionId:Y,reason:Y,evidence:n.Optional(Y)},{additionalProperties:!1}),_l=n.Object({totalCriteria:n.Optional(ct),omittedCriteriaCount:n.Optional(n.Integer({minimum:0,maximum:Kg})),coveredCriteria:n.Array(Wg,{maxItems:Lc}),unresolvedCriteria:n.Array(vl,{maxItems:El})},{additionalProperties:!1}),xl=n.Object({path:n.Optional(Y),description:Y},{additionalProperties:!1}),$c=n.Object({unitId:Y,parentUnitId:n.Optional(Y),depth:ct,sourceSlices:n.Array(Hg,{maxItems:Fg}),coverage:_l,subsystemHints:hE,dependencies:n.Array(Y,{maxItems:qg}),interfaceConstraints:n.Array(xl,{maxItems:Jr}),sharedFileConstraints:n.Array(xl,{maxItems:Jr}),budgets:Dc,status:Vg},{additionalProperties:!1}),Xg=n.Object({unitId:Y,blockedByUnitId:Y,reason:n.Optional(Y)},{additionalProperties:!1}),Qg=n.Object({unitId:Y,reasons:n.Array(Y,{maxItems:Jr})},{additionalProperties:!1}),Zg=n.Object({readyUnitIds:n.Array(Y,{maxItems:Si}),runningUnitIds:n.Array(Y,{maxItems:Si}),waitingUnitIds:n.Array(Y,{maxItems:Si}),waitingReasons:n.Array(Qg,{maxItems:Si}),selectedBatchUnitIds:n.Array(Y,{maxItems:Si}),parallelism:nt,blockedPairs:n.Array(Xg,{maxItems:zg})},{additionalProperties:!1}),Jg=n.Object({unitId:n.Optional(Y),attempt:nt,reason:Y,resultingUnitIds:n.Array(Y,{maxItems:Si}),observed:n.Optional(Xs)},{additionalProperties:!1}),Ir=n.Object({unitId:Y,parentUnitId:n.Optional(Y),depth:ct,budgets:Dc,observed:Xs,assignedCriteriaIds:n.Array(Y,{maxItems:Lc}),unresolvedCriteria:n.Array(vl,{maxItems:El}),blockers:hE,splitAttempts:n.Array(Jg,{maxItems:Gg})},{additionalProperties:!1}),g0={runId:n.Optional(n.String()),graphId:Y,rootUnitId:Y,unitCount:ct,edgeCount:ct,limits:kl},Vre=n.Intersect([$c,n.Object({status:n.Literal("queued")})]),Hre=n.Intersect([$c,n.Object({status:n.Literal("completed")})]),Wre=n.Intersect([$c,n.Object({status:n.Literal("skipped")})]),S0={unit:Vre},y0={unitId:Y},h0={unitId:Y,message:Y,observed:n.Optional(Xs)},I0={unit:Hre},b0={unitId:Y,reason:Y,unit:n.Optional(Wre)},R0={unitId:Y,reason:Y,evidence:Ir},x0={decision:Zg},Yg=n.Object({unitId:Y,budget:Dc},{additionalProperties:!1}),E0={limits:kl,unitId:Y,unitBudgets:n.Array(Yg,{maxItems:Si}),observed:n.Optional(Xs)},P0={unitId:Y,artifactPath:Y,byteLength:ct,contentHash:IE,omittedUnitIds:n.Array(Y,{maxItems:Si})},k0={unitCount:ct,completedUnitCount:ct,failedUnitCount:ct,skippedUnitCount:ct,coverage:_l,artifactPaths:n.Array(Y,{maxItems:Jr})};var eS=12,tS=2e3,Al=4096,Ol=4096,nS=40,iS=16,rS=12,oS=16,sS=8,aS=8,cS=3e3,_0="eforge-validation-diagnostic-excerpt-bytes",A0="eforge-validation-diagnostic-message-bytes";Bn.Set(_0,e=>O0(e)<=Al);Bn.Set(A0,e=>O0(e)<=Ol);function O0(e){return new TextEncoder().encode(e).length}var Yt=n.String({maxLength:tS}),v0=n.Array(Yt,{maxItems:eS}),ie=n.Integer({minimum:0}),Wo=n.Integer({minimum:1}),Xre=n.String({pattern:"^[a-f0-9]{64}$"});var Nc=n.String({maxLength:cS}),dS=n.Object({inputTokens:ie,outputTokens:ie,turns:ie,promptBytes:ie}),uS=n.Object({sourceId:n.Optional(Yt),sourceName:n.Optional(Yt),sourcePath:n.Optional(Yt),buildId:n.Optional(Yt),planSetName:n.Optional(Yt),runId:n.Optional(Yt)}),lS=n.Object({sourceSummary:n.Optional(Nc),buildGoal:n.Optional(Nc),promptSourceSnippet:n.Optional(Nc)}),pS=n.Object({relevantFiles:n.Optional(ie),observedFacts:n.Optional(ie),importantFindings:n.Optional(ie),inferredImplementationAreas:n.Optional(ie),unresolvedQuestions:n.Optional(ie),toolUses:n.Optional(ie),toolResults:n.Optional(ie),toolUseSummaryBytes:n.Optional(ie),toolResultSnippetBytes:n.Optional(ie),importantFindingBytes:n.Optional(ie),messageBytes:n.Optional(ie),inferredImplementationAreaBytes:n.Optional(ie),sourceIdBytes:n.Optional(ie),sourceNameBytes:n.Optional(ie),sourcePathBytes:n.Optional(ie),buildIdBytes:n.Optional(ie),planSetNameBytes:n.Optional(ie),runIdBytes:n.Optional(ie),sourceSummaryBytes:n.Optional(ie),buildGoalBytes:n.Optional(ie),promptSourceSnippetBytes:n.Optional(ie),relevantFileBytes:n.Optional(ie),caveatBytes:n.Optional(ie)},{additionalProperties:!1}),mS=n.Union([n.Literal("none"),n.Literal("bounded-decomposition"),n.Literal("manual-reduce-scope"),n.Literal("repair-existing-artifacts")]),jc=n.Union([n.Literal("live-context-guard"),n.Literal("provider"),n.Literal("decomposition")]),Bc=n.Union([n.Literal("context-budget"),n.Literal("context-window"),n.Literal("context-length"),n.Literal("scope-too-broad"),n.Literal("decomposition-exhausted")]),fS=n.Object({orchestrationExists:n.Boolean(),validPlanCount:ie,invalidPlanCount:ie,missingPlanFileCount:ie,missingPlanFiles:v0,invalidPlanFiles:v0}),gS=n.Object({maxPromptBytes:Wo,maxObservedInputTokens:Wo,maxObservedTurns:n.Optional(Wo),maxExplanationBytes:Wo}),SS=n.Union([n.Literal("registry"),n.Literal("builtin"),n.Literal("synthetic"),n.Literal("fallback")]),wl=n.Object({provider:n.Optional(n.String()),modelId:n.Optional(n.String()),metadataSource:SS,fallbackReason:n.Optional(Yt),contextWindow:n.Optional(Wo),outputReserveTokens:Wo,overheadReserveTokens:Wo,safetyMargin:n.Number({exclusiveMinimum:0,maximum:1}),limits:gS}),yS=n.Object({maxObservedInputTokens:ie,softInputTokenThreshold:ie,plannerMaxTurns:Wo,inspectionTurnBudget:ie,softInputTokenRatio:n.Number({minimum:0,maximum:1}),softTurnRatio:n.Number({minimum:0,maximum:1}),guardDiagnostics:n.Optional(wl),observed:dS,toolUseCount:ie,toolResultCount:ie}),Tl=n.Object({kind:n.Literal("planner-inspection-handoff"),version:n.Literal(1),source:uS,relevantFiles:n.Array(Yt,{maxItems:nS}),observedFacts:n.Array(Yt,{maxItems:iS}),importantFindings:n.Array(Yt,{maxItems:rS}),inferredImplementationAreas:n.Array(Yt,{maxItems:oS}),unresolvedQuestions:n.Array(Yt,{maxItems:sS}),sourceBuildContext:lS,budgetDiagnostics:yS,caveats:n.Array(Yt,{maxItems:aS}),omittedCounts:pS}),w0=n.Object({source:jc,failureKind:Bc,stage:n.Union([n.Literal("planner"),n.Literal("compile"),n.Literal("planning-decomposition")]),explanation:Yt,observed:n.Optional(n.Object({inputTokens:n.Optional(ie),outputTokens:n.Optional(ie),turns:n.Optional(ie),promptBytes:n.Optional(ie)})),guardDiagnostics:n.Optional(wl),decompositionEvidence:n.Optional(Ir),recovery:n.Object({action:mS,eligible:n.Boolean(),attempted:n.Boolean(),attempt:n.Integer({minimum:0}),maxAttempts:n.Integer({minimum:1}),reason:Yt}),artifacts:fS}),Qre=n.Union([n.Literal("live-context-guard"),n.Literal("provider")]),Zre=n.Union([n.Literal("context-budget"),n.Literal("context-window"),n.Literal("context-length"),n.Literal("scope-too-broad")]),Mc=n.Intersect([w0,n.Union([n.Object({source:n.Literal("decomposition"),failureKind:n.Literal("decomposition-exhausted"),stage:n.Literal("planning-decomposition"),decompositionEvidence:Ir}),n.Object({source:Qre,failureKind:Zre,decompositionEvidence:n.Optional(n.Never())})])]);Object.assign(Mc,{properties:w0.properties});var bE=n.Object({maxMessageBytes:n.Integer({minimum:1}),maxExcerptBytes:n.Integer({minimum:1})}),RE=n.Object({schemaPath:n.String(),expectedType:n.String(),receivedType:n.String(),excerpt:n.String({maxLength:Al,format:_0}),payloadBytes:ie,payloadSha256:Xre,omittedBytes:ie,truncated:n.Boolean(),message:n.String({maxLength:Ol,format:A0})});var hS=4096;var aMe=new Set(Pl);var $t=n.Union([n.Literal("planner"),n.Literal("builder"),n.Literal("reviewer"),n.Literal("review-fixer"),n.Literal("evaluator"),n.Literal("plan-reviewer"),n.Literal("plan-evaluator"),n.Literal("validation-fixer"),n.Literal("merge-conflict-resolver"),n.Literal("staleness-assessor"),n.Literal("formatter"),n.Literal("doc-author"),n.Literal("doc-syncer"),n.Literal("test-writer"),n.Literal("tester"),n.Literal("prd-validator"),n.Literal("dependency-detector"),n.Literal("gap-closer"),n.Literal("recovery-analyst")]),Xo=n.Union([n.Literal("error_max_turns"),n.Literal("error_max_budget_usd"),n.Literal("error_max_structured_output_retries"),n.Literal("error_during_execution"),n.Literal("error_pi_tool_infrastructure"),n.Literal("error_context_window"),n.Literal("error_transient_transport")]),lMe=n.Union([n.Literal("code"),n.Literal("security"),n.Literal("api"),n.Literal("docs"),n.Literal("test"),n.Literal("verify")]),Pt=n.String({pattern:"^[a-z][a-z0-9-]{0,63}$",description:'A review perspective key: lowercase slug starting with a letter, 1\u201364 chars (e.g. "code", "accessibility")'}),Cl=n.Union([n.Literal("pr"),n.Literal("merge"),n.Literal("leave")]),Fc=n.Union(["resolved","false_positive","unresolved","unresolved_blocking","unresolved_nonblocking","needs_human_review","accepted_risk","split_to_followup"].map(e=>n.Literal(e)),{description:"Evaluator issue disposition separate from patch action. Missing values are interpreted conservatively by the engine."}),Wn={round:n.Optional(n.Integer({minimum:0}))},IS=["builder","test-writer","existing-only"],Yr=n.Union(IS.map(e=>n.Literal(e)),{description:"Exclusive owner of new acceptance-test authoring for a plan"}),Qo=n.String({minLength:1,maxLength:hS,pattern:"\\S"}),bS=n.Union([n.Literal("addressed"),n.Literal("deferred"),n.Literal("obsolete")]),Ll=n.Object({issueId:Qo,status:bS,note:n.Optional(n.String({minLength:1,maxLength:hS}))}),Wi=n.Literal("git-spice"),Dl=n.Union([n.Literal("branch-restack"),n.Literal("stack-restack"),n.Literal("repo-sync"),n.Literal("unknown")]),$l=n.Union([n.Literal("git-rebase"),n.Literal("git-merge"),n.Literal("unknown")]),Zo=n.Union([n.Literal("pr"),n.Literal("merge"),n.Literal("leave")]),qc=n.Union([n.Literal("pending"),n.Literal("building"),n.Literal("built"),n.Literal("merged"),n.Literal("landed"),n.Literal("failed")]),zc=n.Object({branch:n.String(),commitSha:n.Optional(n.String()),prUrl:n.Optional(n.String())}),RS=n.Union([n.Literal("started"),n.Literal("complete"),n.Literal("skipped"),n.Literal("failed")]),C0=n.Object({action:Zo,status:RS,prUrl:n.Optional(n.String()),reason:n.Optional(n.String()),originalBaseBranch:n.Optional(n.String()),effectiveBaseBranch:n.Optional(n.String()),baseRepairReason:n.Optional(n.Literal("parent-artifact-already-integrated")),startedAt:n.String(),completedAt:n.Optional(n.String())}),Nl=n.Object({prdId:n.String(),stackId:n.String(),parentPrdId:n.Optional(n.String()),provider:Wi,branch:n.String(),baseBranch:n.Optional(n.String()),artifact:n.Optional(zc),landingAction:n.Optional(Zo),landing:n.Optional(C0),status:qc,recordedAt:n.String(),updatedAt:n.String()}),L0=n.Union([n.Literal("proceed"),n.Literal("revise"),n.Literal("obsolete")]),D0=n.Object({verdict:n.Union([n.Literal("retry"),n.Literal("continue-repair"),n.Literal("abandon"),n.Literal("manual")]),confidence:n.Union([n.Literal("low"),n.Literal("medium"),n.Literal("high")]),rationale:n.String(),completedWork:n.Array(n.String()),remainingWork:n.Array(n.String()),risks:n.Array(n.String()),partial:n.Optional(n.Boolean()),recoveryError:n.Optional(n.String()),recommendationSource:n.Optional(n.Union([n.Literal("deterministic"),n.Literal("analyst"),n.Literal("manual-fallback")])),recommendationRationale:n.Optional(n.String()),verdictInvalidationReason:n.Optional(n.String())}),Jre=n.Object({id:n.String(),roots:n.Optional(n.Array(n.String())),files:n.Optional(n.Array(n.String()))}),Jo=n.Union([n.String(),n.Array(n.String())]),pMe=n.Union([n.Literal("queue-dispatch"),n.Literal("plan-merge"),n.Literal("final-merge")]),mMe=n.Union([n.Literal("beforeQueueDispatch"),n.Literal("beforePlanMerge"),n.Literal("beforeFinalMerge")]),Yre=n.Union([n.Literal("fail-open"),n.Literal("fail-closed")]),xS={decision:n.Literal("allow"),reason:n.Optional(n.String())},ES={decision:n.Literal("block"),reason:n.String({minLength:1})},PS={decision:n.Literal("require-approval"),reason:n.String({minLength:1})},xE={extensionName:n.String(),extensionPath:n.String(),registrationIndex:n.Integer({minimum:0}),failurePolicy:Yre},Gc={gateKind:n.Literal("queue-dispatch"),method:n.Literal("beforeQueueDispatch"),...xE,prdId:n.String(),prdTitle:n.Optional(n.String())},Kc={gateKind:n.Literal("plan-merge"),method:n.Literal("beforePlanMerge"),...xE,planId:n.String()},Vc={gateKind:n.Literal("final-merge"),method:n.Literal("beforeFinalMerge"),...xE,featureBranch:n.String(),baseBranch:n.String(),planIds:n.Optional(n.Array(n.String()))},Hc=n.Object({strategy:n.Union([n.Literal("auto"),n.Literal("single"),n.Literal("parallel")]),perspectives:n.Array(Pt),maxRounds:n.Number(),evaluatorStrictness:n.Union([n.Literal("strict"),n.Literal("standard"),n.Literal("lenient")])}),eoe=n.Object({compile:n.Array(n.String()),defaultBuild:n.Array(Jo),defaultReview:Hc,rationale:n.String()}),EE=n.Object({requirement:n.String(),explanation:n.String(),complexity:n.Optional(n.Union([n.Literal("trivial"),n.Literal("moderate"),n.Literal("significant")]))}),Wc=n.Object({criterion:n.String({minLength:1}),verdict:n.Union([n.Literal("pass"),n.Literal("fail"),n.Literal("unknown")]),evidence:n.String({minLength:1})}),Xc=n.Object({criterion:n.String({minLength:1}),evidence:n.String({minLength:1}),conflictsWith:n.String({minLength:1}),scope:n.Union([n.Literal("narrow"),n.Literal("broad"),n.Literal("unknown")]),recommendedAction:n.Union([n.Literal("revise_acceptance_criteria"),n.Literal("manual_review")])}),PE=n.Object({status:n.Union([n.Literal("completed"),n.Literal("failed"),n.Literal("skipped")]),summary:n.String()}),$0=n.Object({id:n.String(),question:n.String(),context:n.Optional(n.String()),options:n.Optional(n.Array(n.String())),default:n.Optional(n.String())}),toe=n.Union([n.Literal("narrow"),n.Literal("structural"),n.Literal("manual"),n.Literal("followup")]),noe=n.Union([n.Literal("result"),n.Literal("command"),n.Literal("timeout"),n.Literal("exception"),n.Literal("unexpected-return")]),ioe=n.Recursive(e=>n.Union([n.Null(),n.Boolean(),n.Number(),n.String({maxLength:hS}),n.Array(e),n.Record(n.String(),e)])),Qc=n.Object({issueId:n.Optional(Qo),severity:n.Union([n.Literal("critical"),n.Literal("warning"),n.Literal("suggestion")]),category:n.String(),file:n.String(),line:n.Optional(n.Number()),description:n.String(),fix:n.Optional(n.String()),retryGuidance:n.Optional(n.String()),failureKind:n.Optional(n.String()),repairClass:n.Optional(toe),metadata:n.Optional(n.Record(n.String(),ioe)),validationProviderName:n.Optional(n.String()),runtimeFailureKind:n.Optional(noe)}),N0=n.Object({severity:n.Union([n.Literal("critical"),n.Literal("warning")]),category:n.Union([n.Literal("production-bug"),n.Literal("missing-behavior"),n.Literal("regression")]),file:n.String(),testFile:n.String(),description:n.String(),testOutput:n.Optional(n.String()),fix:n.Optional(n.String())}),j0=n.Object({id:n.String(),name:n.String(),dependsOn:n.Array(n.String()),branch:n.String(),migrations:n.Optional(n.Array(n.Object({timestamp:n.String(),description:n.String()}))),agents:n.Optional(n.Record(n.String(),n.Object({effort:n.Optional(n.String()),thinking:n.Optional(n.Union([n.Boolean(),n.Record(n.String(),n.Unknown())])),rationale:n.Optional(n.String()),tier:n.Optional(n.String()),shards:n.Optional(n.Array(Jre))}))),body:n.String(),filePath:n.String(),warnings:n.Optional(n.Array(n.String()))}),roe=n.Object({id:n.String(),name:n.String(),dependsOn:n.Array(n.String()),branch:n.String(),build:n.Array(Jo),review:Hc,testOwnership:n.Optional(Yr),maxContinuations:n.Optional(n.Number()),allowNoOpMerge:n.Optional(n.Boolean()),agents:n.Optional(n.Record(n.String(),n.Object({effort:n.Optional(n.String()),thinking:n.Optional(n.Union([n.Boolean(),n.Record(n.String(),n.Unknown())])),rationale:n.Optional(n.String()),tier:n.Optional(n.String())})))}),ooe=n.Object({name:n.String(),description:n.String(),created:n.String(),baseBranch:n.String(),diffBaseRef:n.Optional(n.String()),pipeline:eoe,plans:n.Array(roe),validate:n.Optional(n.Array(n.String())),warnings:n.Optional(n.Array(n.String()))}),kS=n.Object({label:n.String(),content:n.Optional(n.String()),path:n.Optional(n.String())}),vS=n.Object({id:n.String(),name:n.String(),body:n.String(),dependsOn:n.Array(n.String()),branch:n.Optional(n.String()),build:n.Optional(n.Array(Jo)),review:n.Optional(Hc),testOwnership:n.Optional(Yr)}),jl=n.Object({type:n.Literal("build:resume:artifacts"),prdId:n.String(),setName:n.String(),featureBranch:n.String(),artifactSource:n.Union([n.Literal("merge-worktree"),n.Literal("branch-history")]),artifactCommit:n.Optional(n.String()),source:kS,orchestration:ooe,plans:n.Array(vS)}),_S=n.Union([n.Literal("pending"),n.Literal("running"),n.Literal("completed"),n.Literal("failed"),n.Literal("blocked"),n.Literal("merged")]),soe=n.Object({status:_S,worktreePath:n.Optional(n.String()),branch:n.String(),dependsOn:n.Array(n.String()),merged:n.Boolean(),error:n.Optional(n.String())}),fMe=n.Object({setName:n.String(),status:n.Union([n.Literal("running"),n.Literal("completed"),n.Literal("failed")]),startedAt:n.String(),completedAt:n.Optional(n.String()),baseBranch:n.String(),featureBranch:n.Optional(n.String()),worktreeBase:n.String(),mergeWorktreePath:n.Optional(n.String()),plans:n.Record(n.String(),soe),completedPlans:n.Array(n.String())}),B0=n.Object({durationMs:n.Number(),durationApiMs:n.Number(),numTurns:n.Number(),totalCostUsd:n.Number(),usage:n.Object({input:n.Number(),output:n.Number(),total:n.Number(),cacheRead:n.Number(),cacheCreation:n.Number()}),modelUsage:n.Record(n.String(),n.Object({inputTokens:n.Number(),outputTokens:n.Number(),cacheReadInputTokens:n.Number(),cacheCreationInputTokens:n.Number(),costUSD:n.Number()})),harness:n.Optional(n.Union([n.Literal("claude-sdk"),n.Literal("pi")])),provider:n.Optional(n.String()),resultText:n.Optional(n.String())}),M0=n.Object({valid:n.Array(n.String()),missing:n.Array(n.String()),corrupt:n.Array(n.String()),cleared:n.Array(n.String())}),gMe=n.Object({running:n.Boolean(),setName:n.Optional(n.String()),plans:n.Record(n.String(),_S),completedPlans:n.Array(n.String())}),aoe=n.Object({sha:n.String(),subject:n.String(),author:n.String(),date:n.String()}),coe=n.Object({planId:n.String(),status:n.String(),mergedAt:n.Optional(n.String()),error:n.Optional(n.String()),terminalSubtype:n.Optional(n.String()),commitSha:n.Optional(n.String()),testPassed:n.Optional(n.Integer({minimum:0})),testFailed:n.Optional(n.Integer({minimum:0})),completedAt:n.Optional(n.String()),toolUseCount:n.Optional(n.Integer({minimum:0}))}),T0=n.Object({planId:n.String(),agentId:n.Optional(n.String()),agentRole:n.Optional(n.String()),errorMessage:n.Optional(n.String()),terminalSubtype:n.Optional(n.String()),toolUseCount:n.Optional(n.Integer({minimum:0}))}),doe=n.Union([n.Literal("accept"),n.Literal("reject"),n.Literal("review")]),uoe=n.Object({file:n.String(),action:doe,reason:n.String(),hunk:n.Optional(n.Integer({minimum:1})),issueOutcome:n.Optional(Fc),retryGuidance:n.Optional(n.String()),issueIds:n.Optional(n.Array(Qo))}),loe=n.Object({planId:n.String(),issues:n.Array(Qc),evaluation:n.Optional(n.Object({accepted:n.Integer({minimum:0}),rejected:n.Integer({minimum:0}),review:n.Integer({minimum:0}),verdicts:n.Array(uoe)}))}),AS=n.Union([n.Literal("plan"),n.Literal("post-merge-validation"),n.Literal("prd-validation"),n.Literal("acceptance-validation"),n.Literal("artifact-recording"),n.Literal("landing"),n.Literal("daemon"),n.Literal("compile"),n.Literal("unknown")]),U0=n.Object({status:n.String(),action:n.Optional(n.String()),reason:n.Optional(n.String())}),Zc=n.Object({scope:AS,message:n.String(),authoritative:n.Boolean(),planId:n.Optional(n.String()),terminalSubtype:n.Optional(Xo),stage:n.Optional(n.String()),phaseSummary:n.Optional(n.String()),phaseStatus:n.Optional(n.String()),eventType:n.Optional(n.String()),sourceEventType:n.Optional(n.String()),sourceEventId:n.Optional(n.Integer()),sourceEventTimestamp:n.Optional(n.String()),landing:n.Optional(U0),validationPassed:n.Optional(n.Boolean()),prdValidationPassed:n.Optional(n.Boolean()),acceptanceValidationPassed:n.Optional(n.Boolean())}),F0=n.Object({prdId:n.String(),setName:n.String(),featureBranch:n.String(),baseBranch:n.String(),plans:n.Array(coe),failingPlan:T0,landedCommits:n.Array(aoe),diffStat:n.String(),modelsUsed:n.Array(n.String()),failedAt:n.String(),partial:n.Optional(n.Boolean()),prdContent:n.Optional(n.String()),terminalFailure:n.Optional(n.Partial(Zc)),acceptanceValidation:n.Optional(n.Object({passed:n.Boolean(),total:n.Number(),pass:n.Number(),fail:n.Number(),unknown:n.Number(),verdicts:n.Array(Wc),waivers:n.Optional(n.Array(n.String())),conflicts:n.Optional(n.Array(Xc))})),validationCommands:n.Optional(n.Array(n.Object({command:n.String(),exitCode:n.Number(),output:n.Optional(n.String())}))),landing:n.Optional(U0),failingPlans:n.Optional(n.Array(T0)),reviewFailure:n.Optional(loe)}),Hi=n.Object({allowed:n.Boolean(),reason:n.Optional(n.String())}),Bl=n.Object({priority:Hi,remove:Hi,dependencyOverride:Hi,hold:Hi,unhold:Hi,cascadeRemove:Hi,cancel:Hi,cascadeCancel:Hi}),Ml=n.Object({held:n.Boolean(),reason:n.Optional(n.String()),heldAt:n.Optional(n.String())}),poe=n.Object({label:n.String()},{additionalProperties:!1}),moe=n.Object({executable:n.String(),args:n.Array(n.String())},{additionalProperties:!1}),Zs=n.Object({runId:n.String(),sessionId:n.Optional(n.String()),sourceLabel:n.String(),provenance:n.Optional(poe),failureReason:n.String(),failedAt:n.String(),canReenqueue:n.Boolean(),disabledReason:n.Optional(n.String()),nextCommand:moe,resolvedAt:n.Optional(n.String())},{additionalProperties:!1}),OS=n.Union([n.Literal("enabled"),n.Literal("disabled")]),Uc=n.Union([n.Literal("disabled"),n.Literal("starting"),n.Literal("running"),n.Literal("paused"),n.Literal("stopping"),n.Literal("restarting"),n.Literal("faulted")]),foe=n.Object({alive:n.Boolean(),paused:n.Boolean(),lastMutationReason:n.Optional(n.String()),runningCount:n.Optional(n.Number()),limit:n.Optional(n.Number())}),goe=n.Object({at:n.String(),previousMode:Uc,nextMode:Uc,desired:OS,reason:n.Optional(n.String()),source:n.String()}),Soe=n.Union([n.Literal("disabled"),n.Literal("attempt-budget-exhausted"),n.Literal("not-continue-repair"),n.Literal("not-high-confidence"),n.Literal("not-eligible"),n.Literal("manual-confirmation-required"),n.Literal("partial-sidecar"),n.Literal("malformed-sidecar"),n.Literal("missing-sidecar"),n.Literal("ineligible-artifacts"),n.Literal("dirty-worktree"),n.Literal("conflicting-worktree"),n.Literal("queue-preflight-blocked"),n.Literal("conflicting-applied-marker"),n.Literal("active-gate-or-hold"),n.Literal("repeated-failure-signature"),n.Literal("error")]),yoe=n.Object({enabled:n.Boolean(),maxAttempts:n.Integer({minimum:0}),attempts:n.Integer({minimum:0}),lastDecision:n.Optional(n.Union([n.Literal("evaluate"),n.Literal("queued"),n.Literal("stopped")])),prdId:n.Optional(n.String()),setName:n.Optional(n.String()),stopReason:n.Optional(Soe),message:n.Optional(n.String())}),Ul={desired:n.Optional(OS),mode:n.Optional(Uc),scheduler:n.Optional(foe),lastTransition:n.Optional(goe),reason:n.Optional(n.String()),recoveryAutoResume:n.Optional(yoe)};var wS=n.Union([n.Object({kind:n.Literal("build-pipeline-chosen"),rationale:n.String(),defaultBuild:n.Array(Jo,{minItems:1})}),n.Object({kind:n.Literal("review-profile-chosen"),rationale:n.String(),strategy:n.Union([n.Literal("auto"),n.Literal("single"),n.Literal("parallel")]),perspectives:n.Array(Pt,{minItems:1}),maxRounds:n.Integer({minimum:1}),evaluatorStrictness:n.Union([n.Literal("strict"),n.Literal("standard"),n.Literal("lenient")])}),n.Object({kind:n.Literal("plan-set-shape"),rationale:n.String(),planCount:n.Integer({minimum:1}),planIds:n.Array(n.String(),{minItems:1})})]),kE=n.Object({type:n.Literal("planning:decision"),planId:n.Optional(n.String()),decision:wS}),Fl=n.Union([n.Object({kind:n.Literal("review-strategy"),rationale:n.String(),strategy:n.Union([n.Literal("single"),n.Literal("parallel")]),source:n.Union([n.Literal("config"),n.Literal("auto-threshold")]),auto:n.Optional(n.Object({files:n.Integer({minimum:0}),lines:n.Integer({minimum:0}),threshold:n.Object({files:n.Integer({minimum:0}),lines:n.Integer({minimum:0})})}))}),n.Object({kind:n.Literal("perspectives-inferred"),rationale:n.String(),perspectives:n.Array(Pt),categories:n.Array(n.String()),rules:n.Array(n.String())}),n.Object({kind:n.Literal("cycle-terminated"),rationale:n.String(),round:n.Integer({minimum:0}),reason:n.Union([n.Literal("no-issues"),n.Literal("max-rounds")]),issuesRemaining:n.Integer({minimum:0}),lastReviewIssueCount:n.Optional(n.Integer({minimum:0})),finalEvaluationAccepted:n.Optional(n.Integer({minimum:0})),finalEvaluationRejected:n.Optional(n.Integer({minimum:0})),finalEvaluationRan:n.Optional(n.Boolean()),finalEvaluationResolved:n.Optional(n.Integer({minimum:0})),finalEvaluationFalsePositive:n.Optional(n.Integer({minimum:0})),finalEvaluationUnresolved:n.Optional(n.Integer({minimum:0})),finalEvaluationNeedsHumanReview:n.Optional(n.Integer({minimum:0})),finalEvaluationBlocking:n.Optional(n.Integer({minimum:0}))}),n.Object({kind:n.Literal("perspectives-respawned"),rationale:n.String(),round:n.Integer({minimum:0}),perspectives:n.Array(Pt),dropped:n.Array(Pt)}),n.Object({kind:n.Literal("evaluator-strictness"),rationale:n.String(),strictness:n.Union([n.Literal("strict"),n.Literal("standard"),n.Literal("lenient")]),source:n.Union([n.Literal("config"),n.Literal("default")])}),n.Object({kind:n.Literal("recovery-verdict"),rationale:n.String(),verdict:n.Union([n.Literal("retry"),n.Literal("continue-repair"),n.Literal("abandon"),n.Literal("manual")])}),n.Object({kind:n.Literal("merge-conflict-resolution"),rationale:n.String(),strategy:n.String(),files:n.Array(n.String())})]);var vE=n.Union([n.Literal("stacking-validation"),n.Literal("policy-gate"),n.Literal("profile-routing"),n.Literal("dispatch")]),_E=[n.Object({type:n.Literal("queue:start"),prdCount:n.Number(),dir:n.String()}),n.Object({type:n.Literal("queue:prd:start"),prdId:n.String(),title:n.String()}),n.Object({type:n.Literal("queue:prd:discovered"),prdId:n.String(),title:n.String(),dependsOn:n.Optional(n.Array(n.String()))}),n.Object({type:n.Literal("queue:prd:dependency-overridden"),prdId:n.String(),title:n.String(),removedDependency:n.String(),previousDependsOn:n.Array(n.String()),currentDependsOn:n.Array(n.String()),reason:n.Optional(n.String())}),n.Object({type:n.Literal("queue:prd:removed"),prdId:n.String(),previousStatus:n.Union([n.Literal("pending"),n.Literal("waiting"),n.Literal("failed"),n.Literal("skipped")]),removedSidecars:n.Optional(n.Array(n.String()))}),n.Object({type:n.Literal("queue:prd:stale"),prdId:n.String(),title:n.String(),verdict:L0,justification:n.String(),revision:n.Optional(n.String())}),n.Object({type:n.Literal("queue:prd:skip"),prdId:n.String(),reason:n.String()}),n.Object({type:n.Literal("queue:prd:dispatch-failed"),prdId:n.String(),title:n.String(),reason:n.String(),stage:vE}),n.Object({type:n.Literal("queue:prd:commit-failed"),prdId:n.String(),title:n.String(),error:n.String()}),n.Object({type:n.Literal("queue:prd:complete"),prdId:n.String(),status:n.Union([n.Literal("completed"),n.Literal("failed"),n.Literal("skipped")])}),n.Object({type:n.Literal("queue:complete"),processed:n.Number(),skipped:n.Number()})],xMe=n.Union([..._E]);var q0=n.Union([n.Literal("default"),n.Literal("rule"),n.Literal("extension-router"),n.Literal("fallback")]),z0=n.Union([n.Literal("no-match"),n.Literal("router-declined"),n.Literal("router-timeout"),n.Literal("router-error"),n.Literal("router-invalid-choice")]),G0={planId:n.Optional(n.String()),agentId:n.String(),agent:$t,model:n.String(),harness:n.Union([n.Literal("claude-sdk"),n.Literal("pi")]),harnessSource:n.Literal("tier"),tier:n.String(),tierSource:n.Union([n.Literal("tier"),n.Literal("role"),n.Literal("plan")]),runtimeChoice:n.String(),runtimeChoiceQualified:n.String(),runtimeChoiceSource:q0,runtimeChoiceRule:n.Optional(n.String()),runtimeChoiceRouter:n.Optional(n.String()),runtimeChoiceFallbackReason:n.Optional(z0),effort:n.Optional(n.String()),effortSource:n.Optional(n.Union([n.Literal("tier"),n.Literal("role"),n.Literal("plan")])),thinking:n.Optional(n.Record(n.String(),n.Unknown())),thinkingSource:n.Optional(n.Union([n.Literal("tier"),n.Literal("role"),n.Literal("plan")])),effortClamped:n.Optional(n.Boolean()),effortOriginal:n.Optional(n.String()),thinkingCoerced:n.Optional(n.Boolean()),thinkingOriginal:n.Optional(n.Record(n.String(),n.Unknown())),perspective:n.Optional(Pt),toolbelt:n.Optional(n.Union([n.String(),n.Null()])),toolbeltSource:n.Optional(n.Union([n.Literal("tier"),n.Literal("role"),n.Literal("plan"),n.Literal("default")])),projectMcpSelection:n.Optional(n.Union([n.Literal("all"),n.Literal("none"),n.Literal("toolbelt")])),projectMcpServerNames:n.Optional(n.Array(n.String()))};var AE=n.Object({sessionId:n.Optional(n.String()),runId:n.Optional(n.String()),timestamp:n.String()});var K0=[n.Object({type:n.Literal("agent:start"),...G0}),n.Object({type:n.Literal("agent:warning"),planId:n.Optional(n.String()),agentId:n.String(),agent:$t,code:n.String(),message:n.String()}),n.Object({type:n.Literal("agent:stop"),planId:n.Optional(n.String()),agentId:n.String(),agent:$t,error:n.Optional(n.String())}),n.Object({type:n.Literal("agent:usage"),planId:n.Optional(n.String()),agentId:n.String(),agent:$t,usage:n.Object({input:n.Number(),output:n.Number(),total:n.Number(),cacheRead:n.Number(),cacheCreation:n.Number()}),costUsd:n.Number(),numTurns:n.Number(),final:n.Optional(n.Boolean())}),n.Object({type:n.Literal("agent:message"),planId:n.Optional(n.String()),agentId:n.String(),agent:$t,content:n.String()}),n.Object({type:n.Literal("agent:tool_use"),planId:n.Optional(n.String()),agentId:n.String(),agent:$t,tool:n.String(),toolUseId:n.String(),input:n.Unknown()}),n.Object({type:n.Literal("agent:tool_result"),planId:n.Optional(n.String()),agentId:n.String(),agent:$t,tool:n.String(),toolUseId:n.String(),output:n.String()}),n.Object({type:n.Literal("agent:result"),planId:n.Optional(n.String()),agentId:n.Optional(n.String()),agent:$t,result:B0}),n.Object({type:n.Literal("agent:activity"),planId:n.Optional(n.String()),agentId:n.String(),agent:$t,files:n.Optional(n.Array(n.Object({path:n.String(),status:n.Optional(n.String()),additions:n.Optional(n.Number()),deletions:n.Optional(n.Number()),binary:n.Optional(n.Boolean())}))),totals:n.Optional(n.Object({filesChanged:n.Number(),additions:n.Number(),deletions:n.Number()})),attribution:n.Union([n.Literal("exact"),n.Literal("best_effort"),n.Literal("unavailable")]),notes:n.Optional(n.Array(n.String()))}),n.Object({type:n.Literal("agent:retry"),agent:$t,attempt:n.Number(),maxAttempts:n.Number(),subtype:Xo,label:n.String(),planId:n.Optional(n.String()),shardId:n.Optional(n.String())})];var V0=[n.Object({type:n.Literal("plan:build:start"),planId:n.String()}),n.Object({type:n.Literal("plan:build:implement:start"),planId:n.String()}),n.Object({type:n.Literal("plan:build:implement:progress"),planId:n.String(),message:n.String()}),n.Object({type:n.Literal("plan:build:implement:continuation"),planId:n.String(),attempt:n.Number(),maxContinuations:n.Number(),shardId:n.Optional(n.String())}),n.Object({type:n.Literal("plan:build:implement:complete"),planId:n.String()}),n.Object({type:n.Literal("plan:build:files_changed"),planId:n.String(),files:n.Array(n.String()),diffs:n.Optional(n.Array(n.Object({path:n.String(),diff:n.String()}))),baseBranch:n.Optional(n.String())}),n.Object({type:n.Literal("plan:build:review:start"),planId:n.String(),...Wn}),n.Object({type:n.Literal("plan:build:review:complete"),planId:n.String(),issues:n.Array(Qc),...Wn}),n.Object({type:n.Literal("plan:build:review:parallel:start"),planId:n.String(),perspectives:n.Array(Pt),...Wn}),n.Object({type:n.Literal("plan:build:review:parallel:perspective:start"),planId:n.String(),perspective:Pt,...Wn}),n.Object({type:n.Literal("plan:build:review:parallel:perspective:complete"),planId:n.String(),perspective:Pt,issues:n.Array(Qc),...Wn}),n.Object({type:n.Literal("plan:build:review:parallel:perspective:error"),planId:n.String(),perspective:Pt,error:n.String(),...Wn}),n.Object({type:n.Literal("plan:build:review:fix:start"),planId:n.String(),issueCount:n.Number(),...Wn}),n.Object({type:n.Literal("plan:build:review:fix:complete"),planId:n.String(),...Wn,issueReferences:n.Optional(n.Array(Ll))}),n.Object({type:n.Literal("plan:build:review:fix:continuation"),planId:n.String(),attempt:n.Number(),maxContinuations:n.Number(),...Wn}),n.Object({type:n.Literal("plan:build:evaluate:start"),planId:n.String(),...Wn}),n.Object({type:n.Literal("plan:build:evaluate:continuation"),planId:n.String(),attempt:n.Number(),maxContinuations:n.Number(),...Wn}),n.Object({type:n.Literal("plan:build:evaluate:complete"),planId:n.String(),accepted:n.Number(),rejected:n.Number(),...Wn,resolvedIssueOutcomes:n.Optional(n.Number()),falsePositiveIssueOutcomes:n.Optional(n.Number()),unresolvedIssueOutcomes:n.Optional(n.Number()),unresolvedNonBlockingIssueOutcomes:n.Optional(n.Number()),needsHumanReviewIssueOutcomes:n.Optional(n.Number()),acceptedRiskIssueOutcomes:n.Optional(n.Number()),splitToFollowupIssueOutcomes:n.Optional(n.Number()),blockingIssueOutcomes:n.Optional(n.Number()),verdicts:n.Optional(n.Array(n.Object({file:n.String(),action:n.Union([n.Literal("accept"),n.Literal("reject"),n.Literal("review")]),reason:n.String(),hunk:n.Optional(n.Integer({minimum:1})),issueOutcome:n.Optional(Fc),retryGuidance:n.Optional(n.String()),issueIds:n.Optional(n.Array(Qo))})))}),n.Object({type:n.Literal("plan:build:doc-author:start"),planId:n.String()}),n.Object({type:n.Literal("plan:build:doc-author:complete"),planId:n.String(),docsAuthored:n.Number()}),n.Object({type:n.Literal("plan:build:doc-sync:start"),planId:n.String()}),n.Object({type:n.Literal("plan:build:doc-sync:complete"),planId:n.String(),docsSynced:n.Number()}),n.Object({type:n.Literal("plan:build:test:ownership:violation"),planId:n.String(),stage:n.Union([n.Literal("implement"),n.Literal("test-write"),n.Literal("test")]),declaredOwner:n.Union([Yr,n.Literal("unspecified")]),changedPaths:n.Array(n.String()),reason:n.String()}),n.Object({type:n.Literal("plan:build:test:write:start"),planId:n.String()}),n.Object({type:n.Literal("plan:build:test:write:complete"),planId:n.String(),testsWritten:n.Number()}),n.Object({type:n.Literal("plan:build:test:start"),planId:n.String()}),n.Object({type:n.Literal("plan:build:test:complete"),planId:n.String(),passed:n.Number(),failed:n.Number(),testBugsFixed:n.Number(),productionIssues:n.Array(N0)}),n.Object({type:n.Literal("plan:build:complete"),planId:n.String()}),n.Object({type:n.Literal("plan:build:recovery:start"),planId:n.String(),blockerKind:n.Union([n.Literal("review"),n.Literal("test")]),issueCount:n.Number(),maxAttempts:n.Number(),attemptsRemaining:n.Number()}),n.Object({type:n.Literal("plan:build:recovery:attempt:start"),planId:n.String(),blockerKind:n.Union([n.Literal("review"),n.Literal("test")]),attempt:n.Number(),maxAttempts:n.Number(),attemptsRemaining:n.Number()}),n.Object({type:n.Literal("plan:build:recovery:attempt:result"),planId:n.String(),blockerKind:n.Union([n.Literal("review"),n.Literal("test")]),attempt:n.Number(),maxAttempts:n.Number(),blockersCleared:n.Boolean(),attemptsRemaining:n.Number()}),n.Object({type:n.Literal("plan:build:recovery:skip"),planId:n.String(),blockerKind:n.Union([n.Literal("review"),n.Literal("test")]),reason:n.Union([n.Literal("not-active-plan"),n.Literal("manual-gate"),n.Literal("human-review-gate"),n.Literal("cross-plan-blocker"),n.Literal("upstream-or-base-owned"),n.Literal("low-confidence"),n.Literal("incomplete-classification"),n.Literal("unsupported-blocker"),n.Literal("unsafe-worktree"),n.Literal("budget-exhausted"),n.Literal("stale-pass-data")]),details:n.String(),attemptsRemaining:n.Number()}),n.Object({type:n.Literal("plan:build:recovery:exhausted"),planId:n.String(),blockerKind:n.Union([n.Literal("review"),n.Literal("test")]),attemptsUsed:n.Number(),maxAttempts:n.Number(),details:n.String()}),n.Object({type:n.Literal("plan:build:failed"),planId:n.String(),error:n.String(),terminalSubtype:n.Optional(Xo)}),n.Object({type:n.Literal("plan:build:progress"),planId:n.String(),message:n.String()}),n.Object({type:n.Literal("plan:status:change"),planId:n.String(),status:_S}),n.Object({type:n.Literal("plan:error:set"),planId:n.String(),error:n.String()}),n.Object({type:n.Literal("plan:error:clear"),planId:n.String()}),n.Object({type:n.Literal("schedule:start"),planIds:n.Array(n.String())}),n.Object({type:n.Literal("plan:schedule:ready"),planId:n.String(),reason:n.String()}),n.Object({type:n.Literal("plan:merge:start"),planId:n.String()}),n.Object({type:n.Literal("plan:merge:complete"),planId:n.String(),commitSha:n.Optional(n.String())}),n.Object({type:n.Literal("plan:merge:resolve:start"),planId:n.String()}),n.Object({type:n.Literal("plan:merge:resolve:complete"),planId:n.String(),resolved:n.Boolean()}),n.Object({type:n.Literal("merge:finalize:start"),featureBranch:n.String(),baseBranch:n.String()}),n.Object({type:n.Literal("merge:finalize:complete"),featureBranch:n.String(),baseBranch:n.String(),commitSha:n.Optional(n.String())}),n.Object({type:n.Literal("merge:finalize:skipped"),featureBranch:n.String(),baseBranch:n.String(),reason:n.String()}),n.Object({type:n.Literal("landing:start"),action:Cl,featureBranch:n.String(),baseBranch:n.String(),trunkBranch:n.Optional(n.String()),workflow:n.Optional(n.Union([n.Literal("trunk-pr"),n.Literal("trunk-local-merge"),n.Literal("feature-pr"),n.Literal("feature-local-merge"),n.Literal("leave-branch")]))}),n.Object({type:n.Literal("landing:complete"),action:Cl,featureBranch:n.String(),baseBranch:n.String(),commitSha:n.Optional(n.String()),prUrl:n.Optional(n.String())}),n.Object({type:n.Literal("landing:skipped"),action:Cl,featureBranch:n.String(),baseBranch:n.String(),reason:n.String()}),n.Object({type:n.Literal("landing:auto-merge:start"),featureBranch:n.String(),baseBranch:n.Optional(n.String()),prUrl:n.String()}),n.Object({type:n.Literal("landing:auto-merge:complete"),featureBranch:n.String(),baseBranch:n.Optional(n.String()),prUrl:n.String()}),n.Object({type:n.Literal("landing:auto-merge:skipped"),featureBranch:n.String(),baseBranch:n.Optional(n.String()),prUrl:n.Optional(n.String()),reason:n.String()}),n.Object({type:n.Literal("merge:worktree:set"),path:n.String()}),n.Object({type:n.Literal("merge:worktree:clear")})],H0=[n.Object({type:n.Literal("build:terminal-failure"),runId:n.String(),failure:Zc}),n.Object({type:n.Literal("build:resume:start"),prdId:n.String(),setName:n.String(),featureBranch:n.String()}),n.Object({type:n.Literal("build:resume:state"),seededMerged:n.Array(n.String()),seededPending:n.Array(n.String()),featureBranch:n.String(),landedCommitCount:n.Number(),diffStat:n.String()}),n.Object({type:n.Literal("build:resume:ineligible"),reason:n.String(),checkedPath:n.Optional(n.String())}),jl,n.Object({type:n.Literal("build:resume:complete"),prdId:n.String(),setName:n.String()})];var W0=[n.Object({type:n.Literal("daemon:run:upsert"),run:n.Object({id:n.String(),sessionId:n.Optional(n.String()),planSet:n.String(),command:n.String(),status:n.String(),startedAt:n.String(),completedAt:n.Optional(n.String()),cwd:n.String(),pid:n.Optional(n.Number())})}),n.Object({type:n.Literal("daemon:auto-build:paused"),reason:n.String()}),n.Object({type:n.Literal("daemon:lifecycle:starting"),pid:n.Number(),port:n.Number(),version:n.String(),mode:n.String()}),n.Object({type:n.Literal("daemon:lifecycle:ready"),pid:n.Number(),port:n.Number(),version:n.String(),mode:n.String(),recoveryDurationMs:n.Number()}),n.Object({type:n.Literal("daemon:lifecycle:shutdown:start"),signal:n.String(),reason:n.String()}),n.Object({type:n.Literal("daemon:lifecycle:shutdown:complete"),durationMs:n.Number()}),n.Object({type:n.Literal("daemon:heartbeat"),uptime:n.Number(),queueDepth:n.Number(),runningBuilds:n.Number(),autoBuild:n.Object({enabled:n.Boolean(),paused:n.Boolean(),...Ul}),subscribers:n.Number()}),n.Object({type:n.Literal("daemon:scheduler:dequeued"),prdId:n.String(),queueDepth:n.Number(),capacityRemaining:n.Number()}),n.Object({type:n.Literal("daemon:scheduler:capacity-blocked"),queueDepth:n.Number(),runningCount:n.Number(),limit:n.Number()}),n.Object({type:n.Literal("daemon:scheduler:dependency-blocked"),prdId:n.String(),blockedBy:n.Array(n.String())}),n.Object({type:n.Literal("daemon:scheduler:paused")}),n.Object({type:n.Literal("daemon:scheduler:resumed")}),n.Object({type:n.Literal("daemon:auto-build:enabled")}),n.Object({type:n.Literal("daemon:auto-build:disabled")}),n.Object({type:n.Literal("daemon:auto-build:resumed")}),n.Object({type:n.Literal("daemon:auto-build:triggered"),trigger:n.String(),prdsEnqueued:n.Number()}),n.Object({type:n.Literal("daemon:auto-build:transition"),previousMode:Uc,nextMode:Uc,desired:OS,reason:n.Optional(n.String()),source:n.String()}),n.Object({type:n.Literal("daemon:recovery:start")}),n.Object({type:n.Literal("daemon:recovery:run-marked-failed"),runId:n.String(),planSet:n.String(),reason:n.String()}),n.Object({type:n.Literal("daemon:recovery:lock-removed"),path:n.String(),pid:n.Number()}),n.Object({type:n.Literal("daemon:recovery:lock-adopted"),path:n.String(),pid:n.Number(),prdId:n.String()}),n.Object({type:n.Literal("daemon:recovery:complete"),runsFailed:n.Number(),locksRemoved:n.Number(),durationMs:n.Number()}),n.Object({type:n.Literal("daemon:orphan:reaped"),runId:n.String(),sessionId:n.String(),planSet:n.String(),pid:n.Number()}),n.Object({type:n.Literal("daemon:failed-enqueue:upsert"),failedEnqueue:Zs}),n.Object({type:n.Literal("daemon:failed-enqueue:resolved"),runId:n.String(),resolvedAt:n.String(),spawnedSessionId:n.Optional(n.String())}),n.Object({type:n.Literal("daemon:warning"),source:n.String(),message:n.String(),details:n.Optional(n.String())}),n.Object({type:n.Literal("daemon:error"),source:n.String(),message:n.String(),stack:n.Optional(n.String())})];var CS=1,hoe=1,Ioe="[^/?#]+",J0="^sha256-[a-f0-9]{64}-path-[a-f0-9]{64}$",boe="^[a-f0-9]{64}$",Roe=Y0(he.extensionWorkstationFrame,{},"(?:\\?[^#]*)?"),xoe=Y0(he.extensionWorkstationAsset,{assetId:J0.slice(1,-1)}),X0="(?:\\.|%2[eE]){1,2}",Q0=`^(?!\\s)(?!.*\\s$)(?!.*[#\\\\\\u0000-\\u001F\\u007F])(?:\\?[^#\\\\\\u0000-\\u001F\\u007F]*|(?!(?:[A-Za-z][A-Za-z0-9+.-]*:|/))(?![^?]*%(?![0-9A-Fa-f]{2}))(?:(?!${X0}(?:/|\\?|$))[^/?#\\\\\\u0000-\\u001F\\u007F]+/)*(?!${X0}(?:\\?|$))[^/?#\\\\\\u0000-\\u001F\\u007F]+(?:\\?[^#\\\\\\u0000-\\u001F\\u007F]*)?)$`;var Eoe="^(?=.*\\S)(?!/)(?![A-Za-z]:[\\\\/])(?!.*\\u0000)(?:(?!\\.{1,2}(?:[\\\\/]|$))[^\\\\/\\u0000]+)(?:[\\\\/](?!\\.{1,2}(?:[\\\\/]|$))[^\\\\/\\u0000]+)*$";function Y0(e,t={},i=""){return`^${Poe(e).replace(/:([A-Za-z][A-Za-z0-9_]*)/g,(s,a)=>t[a]??Ioe)}${i}$`}function Poe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var LS=n.Recursive(e=>n.Union([n.Null(),n.Boolean(),n.Number(),n.String(),n.Array(e),n.Record(n.String(),e)])),Jc=n.Record(n.String(),LS),koe=n.Union([n.Literal("console"),n.Literal("pi"),n.Literal("claude"),n.Literal("mcp"),n.Literal("cli")]),DS=n.Object({host:koe,surface:n.Optional(n.String()),sessionId:n.Optional(n.String()),commandId:n.Optional(n.String()),deepLinkId:n.Optional(n.String())},{additionalProperties:!1}),voe=n.Union([n.Literal("none"),n.Literal("local-read"),n.Literal("local-write"),n.Literal("network"),n.Literal("daemon-state"),n.Literal("build-queue")]),_oe=n.Union([n.Literal("agent-compact"),n.Literal("agent-paginated"),n.Literal("markdown"),n.Literal("ui-rich"),n.Literal("debug-rich")]),wE="^(?:[<>]=?|=)?\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?(?:\\s*,\\s*(?:[<>]=?|=)?\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?)*$",TE=n.Object({name:n.String({minLength:1}),version:n.Optional(n.String({minLength:1,pattern:wE}))},{additionalProperties:!1}),Aoe=n.Union([n.Object({name:n.String({minLength:1}),version:n.Optional(n.String({minLength:1,pattern:wE})),capabilities:n.Optional(n.Array(TE))},{additionalProperties:!1}),n.Object({version:n.Optional(n.String({minLength:1,pattern:wE})),capabilities:n.Array(TE,{minItems:1})},{additionalProperties:!1})]),Js=n.Object({dependencies:n.Optional(n.Array(Aoe)),capabilities:n.Optional(n.Array(TE))},{additionalProperties:!1}),Ooe=n.Object({code:n.String(),message:n.String(),severity:n.Optional(n.Union([n.Literal("warning"),n.Literal("error")])),dependencyName:n.Optional(n.String()),providerName:n.Optional(n.String()),capabilityName:n.Optional(n.String()),requiredVersion:n.Optional(n.String()),actualVersion:n.Optional(n.String())},{additionalProperties:!1}),Ys=n.Object({available:n.Boolean(),message:n.Optional(n.String()),diagnostics:n.Optional(n.Array(Ooe))},{additionalProperties:!1}),TS=n.Object({actionId:n.String(),inputDefaults:n.Optional(Jc)},{additionalProperties:!1}),$Fe=n.Union([n.Literal("text"),n.Literal("markdown"),n.Literal("status-badge"),n.Literal("link"),n.Literal("action-button"),n.Literal("action-form")]),woe=n.Union([n.Object({rendererId:n.Literal("text"),title:n.Optional(n.String()),content:n.String()},{additionalProperties:!1}),n.Object({rendererId:n.Literal("markdown"),title:n.Optional(n.String()),content:n.String()},{additionalProperties:!1}),n.Object({rendererId:n.Literal("status-badge"),title:n.Optional(n.String()),content:n.String(),status:n.String()},{additionalProperties:!1}),n.Object({rendererId:n.Literal("link"),title:n.Optional(n.String()),content:n.String(),href:n.String()},{additionalProperties:!1}),n.Object({rendererId:n.Literal("action-button"),title:n.Optional(n.String()),content:n.String(),action:TS},{additionalProperties:!1}),n.Object({rendererId:n.Literal("action-form"),title:n.Optional(n.String()),content:n.String(),action:TS},{additionalProperties:!1})]),eM=Jc,CE=n.Intersect([Jc,n.Object({type:n.Literal("object")})]),Toe=n.Union([n.Object({kind:n.Literal("asset"),asset:n.String({minLength:1,pattern:Eoe})},{additionalProperties:!1}),n.Object({kind:n.Literal("export"),module:n.String({minLength:1}),exportName:n.Optional(n.String({minLength:1}))},{additionalProperties:!1})]),Coe=n.Object({id:n.String(),localId:n.String(),extensionName:n.String(),extensionPath:n.String(),title:n.String(),description:n.Optional(n.String()),inputSchema:CE,outputSchema:n.Optional(eM),prompt:Toe,requirements:n.Optional(Js),availability:n.Optional(Ys)},{additionalProperties:!1}),Loe=n.Object({id:n.String(),localId:n.String(),extensionName:n.String(),extensionPath:n.String(),title:n.String(),description:n.Optional(n.String()),inputSchema:CE,outputSchema:n.Optional(eM),outputProfile:n.Optional(_oe),sideEffects:n.Optional(n.Array(voe)),requirements:n.Optional(Js),availability:n.Optional(Ys)},{additionalProperties:!1}),Doe=n.Object({id:n.String(),localId:n.String(),extensionName:n.String(),extensionPath:n.String(),title:n.String(),description:n.Optional(n.String()),schemaVersion:n.Literal(CS),requirements:n.Optional(Js),availability:n.Optional(Ys),blocks:n.Array(woe)},{additionalProperties:!1}),OE=n.Object({id:n.String({pattern:J0}),url:n.String({pattern:xoe}),relativePath:n.String(),sha256:n.String({pattern:boe})},{additionalProperties:!1}),$oe=n.Object({browserSdkVersion:n.Literal(hoe),frameUrl:n.String({pattern:Roe}),entrypoint:OE,styles:n.Array(OE),assets:n.Array(OE)},{additionalProperties:!1}),Z0={id:n.String({pattern:"^[a-z][a-z0-9-]{0,63}$"}),label:n.String({minLength:1,pattern:"\\S"}),description:n.Optional(n.String())},tM=n.Union([n.Object({...Z0,path:n.String({minLength:1,pattern:Q0})},{additionalProperties:!1}),n.Object({...Z0,subPath:n.String({minLength:1,pattern:Q0})},{additionalProperties:!1})]),Noe=n.Object({id:n.String(),localId:n.String(),extensionName:n.String(),extensionPath:n.String(),title:n.String(),description:n.Optional(n.String()),schemaVersion:n.Literal(CS),requirements:n.Optional(Js),availability:n.Optional(Ys),subviews:n.Optional(n.Array(tM)),srcDoc:n.String(),allowedActions:n.Array(n.String())},{additionalProperties:!1}),joe=n.Object({id:n.String(),localId:n.String(),extensionName:n.String(),extensionPath:n.String(),title:n.String(),description:n.Optional(n.String()),schemaVersion:n.Literal(CS),requirements:n.Optional(Js),availability:n.Optional(Ys),subviews:n.Optional(n.Array(tM)),frameBundle:$oe,allowedActions:n.Array(n.String())},{additionalProperties:!1}),Boe=n.Union([Noe,joe]),Moe=n.Object({id:n.String(),localId:n.String(),extensionName:n.String(),extensionPath:n.String(),title:n.Optional(n.String()),description:n.Optional(n.String()),label:n.String(),inputSchema:n.Optional(CE),requirements:n.Optional(Js),availability:n.Optional(Ys),action:TS},{additionalProperties:!1}),Uoe=n.Object({id:n.String(),localId:n.String(),extensionName:n.String(),extensionPath:n.String(),title:n.Optional(n.String()),description:n.Optional(n.String()),label:n.String(),urlTemplate:n.Optional(n.String()),requirements:n.Optional(Js),availability:n.Optional(Ys),action:n.Optional(TS)},{additionalProperties:!1}),Foe=n.Object({extensionName:n.Optional(n.String()),extensionPath:n.Optional(n.String()),severity:n.Union([n.Literal("info"),n.Literal("warning"),n.Literal("error")]),message:n.String(),code:n.String(),name:n.Optional(n.String()),dependencyName:n.Optional(n.String()),providerName:n.Optional(n.String()),capabilityName:n.Optional(n.String()),requiredVersion:n.Optional(n.String()),actualVersion:n.Optional(n.String()),dependencyKind:n.Optional(n.Union([n.Literal("required"),n.Literal("optional")]))},{additionalProperties:!1}),NFe=n.Object({schemaVersion:n.Literal(CS),generatedAt:n.String(),actions:n.Array(Loe),agentTasks:n.Optional(n.Array(Coe)),consoleContributions:n.Array(Doe),consoleWorkstations:n.Array(Boe),integrationCommands:n.Array(Moe),deepLinks:n.Array(Uoe),diagnostics:n.Optional(n.Array(Foe))},{additionalProperties:!1}),jFe=n.Object({actionId:n.String({minLength:1,pattern:"\\S"}),input:Jc,requestedBy:DS},{additionalProperties:!1}),nM=n.Union([n.Literal("unknown-action"),n.Literal("invalid-request"),n.Literal("invalid-input"),n.Literal("daemon-unavailable"),n.Literal("unavailable"),n.Literal("handler-error"),n.Literal("timeout"),n.Literal("invalid-output"),n.Literal("output-schema-failed")]),iM=n.Object({path:n.String(),message:n.String()},{additionalProperties:LS}),qoe=n.Object({ok:n.Literal(!0),invocationId:n.String(),output:LS},{additionalProperties:!1}),zoe=n.Object({ok:n.Literal(!1),invocationId:n.String(),error:n.Object({code:nM,message:n.String(),details:n.Optional(LS)},{additionalProperties:!1})},{additionalProperties:!1}),BFe=n.Union([qoe,zoe]);var Yc=n.Optional(n.Union([n.Literal("manual"),n.Literal("after-build"),n.Literal("scheduled"),n.Literal("retry-deferred")])),rM=iM,oM=n.Union([n.Literal("invalid-input"),n.Literal("daemon-unavailable"),n.Literal("handler-error"),n.Literal("invalid-output"),n.Literal("output-schema-failed")]),ql={invocationId:n.String(),actionId:n.String(),extensionName:n.String(),extensionPath:n.String(),requestedBy:DS};var Ft=n.String({minLength:1,pattern:"\\S"}),it=n.String({pattern:"^[a-f0-9]{64}$"}),dn=n.String({minLength:1,pattern:"^(?!\\.\\.?$)(?!.*[\\\\/\\u0000]).+$"});var LE=n.Union([n.Literal("item"),n.Literal("epic")]),DE={id:dn,origin:n.Optional(n.Union([n.Literal("private"),n.Literal("legacy")])),relativePath:n.Optional(Ft),bodySha256:it,sourceFingerprint:n.Optional(it),updated:n.Optional(n.String()),recordSha256:n.Optional(it)},HFe=n.Object({...DE,kind:LE},{additionalProperties:!1}),sM=n.Object({...DE,kind:n.Literal("item")},{additionalProperties:!1}),aM=n.Object({...DE,kind:n.Literal("epic")},{additionalProperties:!1}),Goe=n.Union([n.Literal("candidate"),n.Literal("planned"),n.Literal("active"),n.Literal("shipped"),n.Literal("stale"),n.Literal("superseded")]),Koe=n.Object({status:n.Optional(Goe),priority:n.Optional(n.String()),tags:n.Optional(n.Array(n.String())),depends_on:n.Optional(n.Array(dn)),epic:n.Optional(n.Union([dn,n.Null()])),last_checked:n.Optional(n.String()),stale_after:n.Optional(n.String())},{additionalProperties:!1}),Voe=n.Object({heading:Ft,action:n.Union([n.Literal("replace"),n.Literal("append")]),content:n.String()},{additionalProperties:!1}),cM={id:dn,metadata:n.Optional(Koe),sectionOperations:n.Optional(n.Array(Voe)),rationale:Ft,evidence:n.Optional(n.Array(n.String()))},dM=n.Object({...cM,kind:n.Literal("item"),precondition:sM},{additionalProperties:!1}),uM=n.Object({...cM,kind:n.Literal("epic"),precondition:aM},{additionalProperties:!1}),WFe=n.Union([dM,uM]),lM={id:dn,last_checked:n.String(),stale_after:n.String(),rationale:n.Optional(n.String())},Hoe=n.Object({...lM,kind:n.Literal("item"),precondition:sM},{additionalProperties:!1}),Woe=n.Object({...lM,kind:n.Literal("epic"),precondition:aM},{additionalProperties:!1}),Xoe=n.Union([Hoe,Woe]),$E=n.Object({id:n.Optional(dn),kind:n.Optional(LE),reason:Ft},{additionalProperties:!1}),NE=n.Object({id:n.Optional(dn),kind:n.Optional(LE),question:Ft,reason:n.Optional(Ft)},{additionalProperties:!1}),ea=n.Object({schemaVersion:n.Literal(1),sourceFingerprint:it,generatedAt:n.Optional(n.String()),summary:n.Array(n.String()),itemChanges:n.Array(dM),epicChanges:n.Array(uM),noOpRechecks:n.Array(Xoe),skipped:n.Array($E),needsInput:n.Array(NE)},{additionalProperties:!1});var Qoe=n.Object({dimension:Ft,sha256:it},{additionalProperties:!1}),Zoe=n.Object({dimension:Ft,content:Ft,rationale:n.Optional(n.String())},{additionalProperties:!1}),Joe=n.Object({openQuestions:n.Optional(n.Array(Ft))},{additionalProperties:!1}),Yoe=n.Object({dimension:Ft,reason:Ft},{additionalProperties:!1}),ese=n.Object({sections:n.Optional(n.Array(Zoe,{minItems:1})),metadata:n.Optional(Joe),skippedDimensions:n.Optional(n.Array(Yoe))},{additionalProperties:!1}),tse=n.Object({label:Ft,excerpt:n.Optional(n.String()),path:n.Optional(n.String()),url:n.Optional(n.String())},{additionalProperties:!1}),zl=n.Object({schemaVersion:n.Literal(1),targetSession:Ft,assistantMessage:Ft,basePlanFingerprint:it,baseSectionHashes:n.Optional(n.Array(Qoe)),proposedPatch:n.Optional(ese),citations:n.Optional(n.Array(tse)),applyGuidance:n.Optional(n.String()),noPatchReason:n.Optional(n.String())},{additionalProperties:!1});var pM="^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$",iqe=new RegExp(pM),nse=n.Object({itemId:n.String({minLength:1,maxLength:240}),title:n.Optional(n.String({maxLength:300})),status:n.Union([n.Literal("pending"),n.Literal("running"),n.Literal("cache-hit"),n.Literal("completed"),n.Literal("failed"),n.Literal("cancelled")]),outcome:n.Optional(n.String({maxLength:80})),verdict:n.Optional(n.String({maxLength:80})),summary:n.Optional(n.String({maxLength:500})),startedAt:n.Optional(n.String({maxLength:120})),completedAt:n.Optional(n.String({maxLength:120}))},{additionalProperties:!1}),mM=n.Object({total:n.Integer({minimum:0}),cacheHits:n.Integer({minimum:0}),misses:n.Integer({minimum:0}),running:n.Integer({minimum:0}),completed:n.Integer({minimum:0}),remaining:n.Integer({minimum:0}),items:n.Array(nse,{maxItems:1e3})},{additionalProperties:!1}),fM=n.Object({timestamp:n.String({minLength:1,pattern:pM}),message:n.String({minLength:1,maxLength:500,pattern:"\\S"})},{additionalProperties:!1});var ta=1,SM="backlog-curation-item-audit-v2-source-readonly",NS=24e3,Kl=1e3,ME=8,yM=8,jS=8,hM=12,UE=8,FE=12,Vl=12e3,ise=1e3,BS=14e4,IM=2e3,kt=(e=2e3)=>n.String({maxLength:e}),br=(e=2e3)=>n.String({minLength:1,pattern:"\\S",maxLength:e}),$S=n.Union([n.String({maxLength:500}),n.Number(),n.Boolean(),n.Null()]),gM=n.Union([$S,n.Array($S,{maxItems:20}),n.Object({},{additionalProperties:$S,maxProperties:20})]),rse=n.Union([$S,n.Array(gM,{maxItems:20}),n.Object({},{additionalProperties:gM,maxProperties:20})]),Gl=n.Object({},{additionalProperties:rse,maxProperties:24}),ose=n.Object({kind:n.Literal("item"),id:dn,origin:n.Optional(n.Union([n.Literal("private"),n.Literal("legacy")])),relativePath:n.Optional(br(500)),bodySha256:it,sourceFingerprint:it,updated:n.Optional(n.String({maxLength:120})),recordSha256:it},{additionalProperties:!1}),MS=n.Object({provider:br(120),modelId:br(200),agentProfile:n.Optional(n.String({maxLength:200}))},{additionalProperties:!1}),Wl=n.Object({code:br(160),severity:n.Union([n.Literal("info"),n.Literal("warning"),n.Literal("error")]),message:n.Optional(kt(800)),path:n.Optional(kt(300))},{additionalProperties:!1}),bM=n.Object({code:br(160),cap:n.Integer({minimum:0}),observed:n.Integer({minimum:0}),retained:n.Integer({minimum:0}),message:n.Optional(kt(800))},{additionalProperties:!1}),sse=n.Object({id:dn,relationship:n.Union([n.Literal("open-dependency"),n.Literal("closed-dependency"),n.Literal("missing-dependency")]),status:n.Optional(n.String({maxLength:80})),title:n.Optional(kt(300))},{additionalProperties:!1}),RM=n.Object({kind:n.Union([n.Literal("implementation"),n.Literal("product-surface"),n.Literal("supporting"),n.Literal("current-source")]),source:br(200),confidence:n.Optional(n.String({maxLength:80})),path:n.Optional(kt(400)),excerpt:n.Optional(kt(1e3)),matchedBy:n.Optional(n.Array(n.String({maxLength:120}),{maxItems:12}))},{additionalProperties:!1}),ase=n.Object({source:br(200),closureAuthority:n.Literal(!1),intent:n.Optional(n.String({maxLength:120})),confidence:n.Optional(n.String({maxLength:80})),citation:n.Optional(kt(600)),evidence:n.Optional(kt(1e3)),path:n.Optional(kt(400))},{additionalProperties:!1}),xM=n.Object({source:br(200),ref:n.Optional(n.String({maxLength:160})),signal:kt(1e3)},{additionalProperties:!1}),EM=n.Object({schemaVersion:n.Literal(ta),purpose:n.Literal("backlog-curation-map-reduce"),sourceFingerprint:it,generatedAt:n.Optional(n.String()),curationGuidance:n.Array(kt(1200),{maxItems:8}),caps:n.Object({},{additionalProperties:n.Number()}),itemCount:n.Integer({minimum:0,maximum:Kl}),openItemIds:n.Array(dn,{maxItems:Kl}),roadmapSummaries:n.Array(Gl,{maxItems:20}),dependencySummaries:n.Array(Gl,{maxItems:50}),recommendationSummaries:n.Array(Gl,{maxItems:50}),redraftSummary:n.Optional(Gl),diagnostics:n.Array(Wl,{maxItems:40})},{additionalProperties:!1}),US=n.Object({schemaVersion:n.Literal(ta),kind:n.Literal("item"),sourceFingerprint:it,itemId:dn,itemTitle:kt(300),metadata:Gl,precondition:ose,bodySha256:it,recordSha256:it,sectionSummaries:n.Array(n.Object({heading:kt(160),text:kt(2e3)},{additionalProperties:!1}),{maxItems:12}),dependencyFacts:n.Array(sse,{maxItems:hM}),currentSourceCitations:n.Array(RM,{maxItems:ME}),historicalHints:n.Array(ase,{maxItems:yM}),recommendationSignals:n.Array(xM,{maxItems:UE}),diagnostics:n.Array(bM,{maxItems:jS})},{additionalProperties:!1}),cse=n.Union([n.Literal("shipped"),n.Literal("superseded"),n.Literal("partial"),n.Literal("still-needed"),n.Literal("stale-invalid"),n.Literal("needs-product-input"),n.Literal("skip")]),dse=n.Union([n.Literal("implementation"),n.Literal("product-surface"),n.Literal("replacement"),n.Literal("supporting")]),use=n.Object({path:br(400),reason:n.Optional(kt(500))},{additionalProperties:!1}),PM={schemaVersion:n.Literal(ta),itemId:dn,sourceFingerprint:it,packetSha256:it,bodySha256:it,promptVersion:br(120),runtimeIdentity:MS,disposition:n.Union([n.Literal("change"),n.Literal("recheck"),n.Literal("skip"),n.Literal("needs-input")]),verdict:n.Optional(cse),closureEvidenceRoles:n.Optional(n.Array(dse,{maxItems:8})),checkedPaths:n.Optional(n.Array(use,{maxItems:20})),summary:kt(2e3),rationale:kt(3e3),citations:n.Array(RM,{maxItems:ME}),recommendationSignals:n.Array(xM,{maxItems:UE}),diagnostics:n.Array(Wl,{maxItems:jS})},Hl=n.Object(PM,{additionalProperties:!1}),qE=n.Object({...PM,runtimeIdentity:n.Optional(MS)},{additionalProperties:!1});function zE(e){let t=ze(Hl,e);if(!t.success)return t;let i=fse(JSON.stringify(t.data));return i<=Vl?t:es("",`Finding is ${i} bytes; cap is ${Vl}.`)}var ed={schemaVersion:n.Literal(ta),itemId:dn,sourceFingerprint:it,packetSha256:n.Optional(it),bodySha256:n.Optional(it),diagnostics:n.Array(Wl,{maxItems:jS})},kM=n.Union([n.Object({...ed,outcome:n.Literal("cache-hit"),finding:Hl},{additionalProperties:!1}),n.Object({...ed,outcome:n.Literal("audited-finding"),finding:Hl},{additionalProperties:!1}),n.Object({...ed,outcome:n.Literal("oversized-packet"),byteLength:n.Integer({minimum:0}),byteCap:n.Integer({minimum:0})},{additionalProperties:!1}),n.Object({...ed,outcome:n.Literal("item-agent-failure"),error:kt(IM)},{additionalProperties:!1}),n.Object({...ed,outcome:n.Literal("invalid-finding"),validationErrors:n.Array(kt(400),{maxItems:FE})},{additionalProperties:!1}),n.Object({...ed,outcome:n.Literal("cancelled"),reason:n.Optional(kt(400))},{additionalProperties:!1})]);var FS=n.Object({schemaVersion:n.Literal(ta),sourceFingerprint:it,generatedAt:n.Optional(n.String()),globalContext:EM,outcomes:n.Array(kM,{maxItems:ise}),diagnostics:n.Array(Wl,{maxItems:40})},{additionalProperties:!1});function vM(e){let t=ze(FS,e);if(!t.success)return t;let i=mse(t.data,"");if(!i.success)return i;for(let[r,o]of t.data.outcomes.entries()){let s=pse(o,`outcomes/${r}/finding`);if(!s.success)return s}return t}var lse=n.Object({schemaVersion:n.Literal(ta),sourceFingerprint:it,generatedAt:n.Optional(n.String()),globalContext:EM,packets:n.Array(US,{maxItems:Kl}),degradedOutcomes:n.Array(kM,{maxItems:Kl}),reducerInput:FS},{additionalProperties:!1});function pse(e,t){if(e.outcome!=="cache-hit"&&e.outcome!=="audited-finding")return{success:!0,data:e};let i=zE(e.finding);return i.success?i.data.sourceFingerprint!==e.sourceFingerprint?es(`${t}/sourceFingerprint`,`sourceFingerprint must match ${e.sourceFingerprint}.`):i.data.itemId!==e.itemId?es(`${t}/itemId`,`itemId must match ${e.itemId}.`):i.data.packetSha256!==e.packetSha256?es(`${t}/packetSha256`,`packetSha256 must match ${e.packetSha256}.`):i.data.bodySha256!==e.bodySha256?es(`${t}/bodySha256`,`bodySha256 must match ${e.bodySha256}.`):{success:!0,data:e}:gse(i,t)}function mse(e,t){let i=t?`${t}/`:"";if(e.globalContext.sourceFingerprint!==e.sourceFingerprint)return es(`${i}globalContext/sourceFingerprint`,`sourceFingerprint must match ${e.sourceFingerprint}.`);for(let[r,o]of e.outcomes.entries()){if(o.sourceFingerprint!==e.sourceFingerprint)return es(`${i}outcomes/${r}/sourceFingerprint`,`sourceFingerprint must match ${e.sourceFingerprint}.`);if((o.outcome==="cache-hit"||o.outcome==="audited-finding")&&o.finding.sourceFingerprint!==e.sourceFingerprint)return es(`${i}outcomes/${r}/finding/sourceFingerprint`,`sourceFingerprint must match ${e.sourceFingerprint}.`)}return{success:!0,data:e}}function es(e,t){return{success:!1,error:{message:`${e||"(root)"}: ${t}`,errors:[{path:e,message:t}]}}}function fse(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e).length:unescape(encodeURIComponent(e)).length}function gse(e,t){if(e.success)return{success:!1,error:{message:`${t}: unexpected validation success`,errors:[{path:t,message:"unexpected validation success"}]}};let i=e.error.errors.map(r=>({path:`${t}${r.path?`/${r.path.replace(/^\//,"")}`:""}`,message:r.message}));return{success:!1,error:{message:i.map(r=>`${r.path||"(root)"}: ${r.message}`).join(`
|
|
144
|
+
`),errors:i}}}var ia="eforge-plan.planning-draft",Xi=n.Literal(ia),nd=n.Union([n.Literal("queued"),n.Literal("running"),n.Literal("completed"),n.Literal("failed"),n.Literal("cancelled")]),AM=n.Object({host:n.Union([n.Literal("console"),n.Literal("pi"),n.Literal("claude"),n.Literal("mcp"),n.Literal("cli")]),surface:n.Optional(n.String()),sessionId:n.Optional(n.String())},{additionalProperties:!1}),Ql=n.Union([n.Literal("recommendations"),n.Literal("handoffDrafts"),n.Literal("planDrafts"),n.Literal("sessionPlanPatch"),n.Literal("sessionPlanCreationDraft"),n.Literal("backlogCurationDraft"),n.Literal("planRevisionTurn")]),Sse="^[A-Za-z0-9._-]{1,128}$",yse="^(?:[A-Za-z0-9._:-]{1,128}|(?=.{1,256}$)(?!.*[/\\\\\\u0000-\\u001F\\u007F-\\u009F])(?!(?:\\.|\\.\\.):).+:[a-z][a-z0-9-]{0,63})$",hse="^[a-z0-9]+(?:-[a-z0-9]+)*$",me=n.String({minLength:1,maxLength:128,pattern:Sse}),Zl=n.String({minLength:1,pattern:hse}),Ise=n.Object({id:n.String({minLength:1,maxLength:256,pattern:yse}),extensionName:n.Optional(n.String({minLength:1,pattern:"\\S"}))},{additionalProperties:!1}),bse=n.String({minLength:1,pattern:"\\S"}),Rse=n.Object({module:n.String({minLength:1,pattern:"\\S"}),exportName:n.Optional(n.String({minLength:1,pattern:"\\S"})),input:n.Optional(n.Object({},{additionalProperties:!0}))},{additionalProperties:!1}),HE=n.Union([n.Literal("bugfix"),n.Literal("feature"),n.Literal("refactor"),n.Literal("architecture"),n.Literal("docs"),n.Literal("maintenance"),n.Literal("unknown")]),WE=n.Union([n.Literal("quick"),n.Literal("focused"),n.Literal("deep")]),td=n.String({minLength:1,pattern:"^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"}),GE=n.Object({requiredDimensions:n.Array(td),optionalDimensions:n.Array(td)},{additionalProperties:!1}),na=n.Object({quick:GE,focused:GE,deep:GE},{additionalProperties:!1}),xse=n.Object({dimensionContract:n.Object({bugfix:na,feature:na,refactor:na,architecture:na,docs:na,maintenance:na,unknown:na},{additionalProperties:!1}),resolved:n.Optional(n.Object({planningType:HE,planningDepth:WE,requiredDimensions:n.Array(td),optionalDimensions:n.Array(td)},{additionalProperties:!1}))},{additionalProperties:!1}),XE=n.Object({topic:bse,session:n.Optional(n.String()),planningType:n.Optional(n.String()),planningDepth:n.Optional(n.String()),sourceText:n.Optional(n.String()),sourceProvider:n.Optional(Rse),existingSessionPlan:n.Optional(n.String()),requestedOutputSections:n.Optional(n.Array(Ql,{minItems:1})),sessionPlanCreationReadiness:n.Optional(xse),includeRoadmap:n.Optional(n.Boolean())},{additionalProperties:!1}),eo=n.Object({title:n.String(),body:n.String()},{additionalProperties:!1}),to=n.Object({sections:n.Array(n.Object({dimension:n.String(),content:n.String()},{additionalProperties:!1}),{minItems:1}),skippedDimensions:n.Optional(n.Array(n.Object({dimension:n.String(),reason:n.String()},{additionalProperties:!1})))},{additionalProperties:!1}),QE=n.Object({session:Zl,topic:n.String({minLength:1,pattern:"\\S"}),planningType:HE,planningDepth:WE,profile:n.Optional(n.Union([n.Literal("errand"),n.Literal("excursion"),n.Literal("expedition")])),agentProfile:n.Optional(n.String()),sections:n.Array(n.Object({dimension:td,content:n.String()},{additionalProperties:!1}),{minItems:1}),skippedDimensions:n.Optional(n.Array(n.Object({dimension:td,reason:n.String()},{additionalProperties:!1})))},{additionalProperties:!1}),Ese=n.Object({question:n.String({minLength:1,pattern:"\\S"}),why:n.Optional(n.String()),options:n.Optional(n.Array(n.String()))},{additionalProperties:!1}),yqe=n.Union([n.Literal("ready"),n.Literal("needs-input")]),Pse=500,_M=50,KE=n.String({maxLength:Pse}),kse=n.Object({currentSection:n.Optional(KE),coveredSections:n.Optional(n.Array(KE,{maxItems:_M})),remainingSections:n.Optional(n.Array(KE,{maxItems:_M}))},{additionalProperties:!1}),VE=n.Object({ref:n.Optional(n.String()),itemId:n.String(),rationale:n.Optional(n.String()),confidence:n.Optional(n.String())},{additionalProperties:!1}),vse=n.Object({ref:n.String(),title:n.Optional(n.String()),itemIds:n.Array(n.String(),{minItems:1}),epicIds:n.Optional(n.Array(n.String())),safeToPlanTogether:n.Optional(n.Boolean()),rationale:n.Optional(n.String()),recommendedProfile:n.Optional(n.Union([n.Literal("errand"),n.Literal("excursion"),n.Literal("expedition")]))},{additionalProperties:!1}),_se=n.Object({ref:n.Optional(n.String()),itemIds:n.Array(n.String()),blockedBy:n.Array(n.String()),rationale:n.Optional(n.String())},{additionalProperties:!1}),OM=n.Object({schemaVersion:n.Literal(1),updatedAt:n.Optional(n.String()),activeWork:n.Array(VE),readyCandidates:n.Array(VE),recommendedNextSequence:n.Array(VE),safeParallelizableGroups:n.Array(vse),blockedChains:n.Array(_se),rationaleAndAssumptions:n.Array(n.String())},{additionalProperties:!1}),qS=n.Object({selection:n.Object({},{additionalProperties:!0}),session:n.Optional(n.String()),title:n.Optional(n.String()),profile:n.Optional(n.Union([n.Literal("errand"),n.Literal("excursion"),n.Literal("expedition")]))},{additionalProperties:!1}),wM={summary:n.String(),assumptionsOpenQuestions:n.Array(n.String()),nextSteps:n.Optional(n.Array(n.String()))},Ase={recommendations:n.Optional(OM),backlogCurationDraft:n.Optional(ea),handoffDraft:n.Optional(qS),handoffDrafts:n.Optional(n.Array(qS,{minItems:1})),planRevisionTurn:n.Optional(zl)},Rr={...wM,...Ase},hqe=n.Object(Rr,{additionalProperties:!1}),Ose=n.Object({session:n.String({minLength:1,pattern:"\\S"}),topic:n.String({minLength:1,pattern:"\\S"}),planningType:HE,planningDepth:WE,profile:n.Optional(n.Union([n.Literal("errand"),n.Literal("excursion"),n.Literal("expedition")])),agentProfile:n.Optional(n.String()),sections:n.Array(n.Object({dimension:n.String({minLength:1}),content:n.String()},{additionalProperties:!1}),{minItems:1}),skippedDimensions:n.Optional(n.Array(n.Object({dimension:n.String({minLength:1}),reason:n.String()},{additionalProperties:!1})))},{additionalProperties:!1}),wse=n.Object({...Rr,decision:n.Literal("ready"),sessionPlanCreationDraft:Ose,planDrafts:n.Optional(n.Array(eo,{minItems:1})),sessionPlanPatch:n.Optional(to)},{additionalProperties:!1}),ts=n.Union([n.Object({...Rr,planRevisionTurn:zl,planDrafts:n.Optional(n.Array(eo,{minItems:1})),sessionPlanPatch:n.Optional(to)},{additionalProperties:!1}),n.Object({...Rr,backlogCurationDraft:ea,planDrafts:n.Optional(n.Array(eo,{minItems:1})),sessionPlanPatch:n.Optional(to)},{additionalProperties:!1}),n.Object({...Rr,recommendations:OM,planDrafts:n.Optional(n.Array(eo,{minItems:1})),sessionPlanPatch:n.Optional(to)},{additionalProperties:!1}),n.Object({...Rr,handoffDraft:qS,planDrafts:n.Optional(n.Array(eo,{minItems:1})),sessionPlanPatch:n.Optional(to)},{additionalProperties:!1}),n.Object({...Rr,handoffDrafts:n.Array(qS,{minItems:1}),planDrafts:n.Optional(n.Array(eo,{minItems:1})),sessionPlanPatch:n.Optional(to)},{additionalProperties:!1}),n.Object({...Rr,planDrafts:n.Array(eo,{minItems:1}),sessionPlanPatch:n.Optional(to)},{additionalProperties:!1}),n.Object({...Rr,planDrafts:n.Optional(n.Array(eo,{minItems:1})),sessionPlanPatch:to},{additionalProperties:!1}),n.Object({...Rr,decision:n.Literal("ready"),sessionPlanCreationDraft:QE,planDrafts:n.Optional(n.Array(eo,{minItems:1})),sessionPlanPatch:n.Optional(to)},{additionalProperties:!1}),n.Object({...wM,decision:n.Literal("needs-input"),clarificationQuestions:n.Array(Ese,{minItems:1}),rationale:n.String({minLength:1,pattern:"\\S"})},{additionalProperties:!1})]),Tse=n.Union([ts,wse]),Cse=n.Object({kind:Xi,input:XE,requestedBy:n.Optional(AM)},{additionalProperties:!1}),Lse=n.Object({task:Ise,input:Jc,requestedBy:n.Optional(AM)},{additionalProperties:!1}),Iqe=n.Union([Lse,Cse]),bqe=n.Object({taskId:me},{additionalProperties:!1}),Rqe=n.Object({reason:n.Optional(n.String())},{additionalProperties:!1}),ra=n.Object({label:n.Optional(n.String()),summary:n.Optional(n.String()),progressMessage:n.Optional(n.String()),outputSectionCount:n.Optional(n.Integer({minimum:0})),warningCount:n.Optional(n.Integer({minimum:0})),sectionProgress:n.Optional(kse),backlogCurationProgress:n.Optional(mM),activityLog:n.Optional(n.Array(fM,{maxItems:50}))},{additionalProperties:!1}),Xl={taskId:me,kind:Xi,createdAt:n.String(),updatedAt:n.String(),metadata:n.Optional(ra)},yi=n.Union([n.Object({...Xl,status:n.Literal("queued")},{additionalProperties:!1}),n.Object({...Xl,status:n.Literal("running"),startedAt:n.String()},{additionalProperties:!1}),n.Object({...Xl,status:n.Literal("completed"),startedAt:n.Optional(n.String()),completedAt:n.String(),result:Tse},{additionalProperties:!1}),n.Object({...Xl,status:n.Literal("failed"),startedAt:n.Optional(n.String()),completedAt:n.Optional(n.String()),errorCode:n.String(),errorMessage:n.String()},{additionalProperties:!1}),n.Object({...Xl,status:n.Literal("cancelled"),startedAt:n.Optional(n.String()),cancelledAt:n.String(),errorMessage:n.Optional(n.String())},{additionalProperties:!1})]),TM=n.Object({task:yi},{additionalProperties:!1}),CM=n.Object({task:yi},{additionalProperties:!1}),LM=n.Object({task:yi},{additionalProperties:!1});function Dse(e){return ze(ts,e)}function Jl(e){let t=Dse(e);if(t.success)return t.data;throw new Error(Ko(t.error))}var DM=[n.Object({type:n.Literal("extension:event-handler:failed"),extensionName:n.String(),extensionPath:n.String(),pattern:n.String(),triggeringEventType:n.String(),message:n.String(),stack:n.Optional(n.String())}),n.Object({type:n.Literal("extension:event-handler:timeout"),extensionName:n.String(),extensionPath:n.String(),pattern:n.String(),triggeringEventType:n.String(),timeoutMs:n.Number()}),n.Object({type:n.Literal("extension:action:start"),...ql}),n.Object({type:n.Literal("extension:action:complete"),...ql,durationMs:n.Number()}),n.Object({type:n.Literal("extension:action:failed"),...ql,durationMs:n.Number(),errorCode:oM,message:n.String(),validationErrors:n.Optional(n.Array(rM))}),n.Object({type:n.Literal("extension:action:timeout"),...ql,durationMs:n.Number(),timeoutMs:n.Number(),message:n.String()}),n.Object({type:n.Literal("extension:agent-task:start"),taskId:n.String(),taskKind:Xi,extensionName:n.String(),status:n.Literal("running"),metadata:n.Optional(ra)}),n.Object({type:n.Literal("extension:agent-task:progress"),taskId:n.String(),taskKind:Xi,extensionName:n.String(),status:n.Literal("running"),message:n.String(),metadata:n.Optional(ra)}),n.Object({type:n.Literal("extension:agent-task:complete"),taskId:n.String(),taskKind:Xi,extensionName:n.String(),status:n.Literal("completed"),durationMs:n.Integer({minimum:0}),metadata:n.Optional(ra)}),n.Object({type:n.Literal("extension:agent-task:failed"),taskId:n.String(),taskKind:Xi,extensionName:n.String(),status:n.Literal("failed"),durationMs:n.Optional(n.Integer({minimum:0})),errorCode:n.String(),message:n.String(),metadata:n.Optional(ra)}),n.Object({type:n.Literal("extension:agent-task:cancelled"),taskId:n.String(),taskKind:Xi,extensionName:n.String(),status:n.Literal("cancelled"),reason:n.Optional(n.String()),metadata:n.Optional(ra)}),n.Object({type:n.Literal("extension:agent-context:applied"),extensionName:n.String(),extensionPath:n.String(),role:$t,tier:n.Optional(n.String()),phase:n.Optional(n.String()),stage:n.Optional(n.String()),profile:n.String(),planId:n.Optional(n.String()),harness:n.Optional(n.Union([n.Literal("claude-sdk"),n.Literal("pi")])),toolbelt:n.Optional(n.Union([n.String(),n.Null()])),projectMcpSelection:n.Optional(n.Union([n.Literal("all"),n.Literal("none"),n.Literal("toolbelt")])),promptCharCount:n.Integer({minimum:0}),fragmentCount:n.Integer({minimum:0})}),n.Object({type:n.Literal("extension:agent-context:failed"),extensionName:n.String(),extensionPath:n.String(),role:$t,tier:n.Optional(n.String()),phase:n.Optional(n.String()),stage:n.Optional(n.String()),profile:n.String(),planId:n.Optional(n.String()),harness:n.Optional(n.Union([n.Literal("claude-sdk"),n.Literal("pi")])),toolbelt:n.Optional(n.Union([n.String(),n.Null()])),projectMcpSelection:n.Optional(n.Union([n.Literal("all"),n.Literal("none"),n.Literal("toolbelt")])),message:n.String(),stack:n.Optional(n.String())}),n.Object({type:n.Literal("extension:agent-context:timeout"),extensionName:n.String(),extensionPath:n.String(),role:$t,tier:n.Optional(n.String()),phase:n.Optional(n.String()),stage:n.Optional(n.String()),profile:n.String(),planId:n.Optional(n.String()),harness:n.Optional(n.Union([n.Literal("claude-sdk"),n.Literal("pi")])),toolbelt:n.Optional(n.Union([n.String(),n.Null()])),projectMcpSelection:n.Optional(n.Union([n.Literal("all"),n.Literal("none"),n.Literal("toolbelt")])),timeoutMs:n.Integer({minimum:0})}),n.Object({type:n.Literal("extension:agent-context:unsupported"),extensionName:n.String(),extensionPath:n.String(),role:$t,tier:n.Optional(n.String()),phase:n.Optional(n.String()),stage:n.Optional(n.String()),profile:n.String(),planId:n.Optional(n.String()),harness:n.Optional(n.Union([n.Literal("claude-sdk"),n.Literal("pi")])),toolbelt:n.Optional(n.Union([n.String(),n.Null()])),projectMcpSelection:n.Optional(n.Union([n.Literal("all"),n.Literal("none"),n.Literal("toolbelt")])),fields:n.Array(n.Union([n.Literal("tools"),n.Literal("allowedTools"),n.Literal("disallowedTools")]),{minItems:1})}),n.Object({type:n.Literal("extension:agent-tools:applied"),extensionName:n.String(),extensionPath:n.String(),role:$t,tier:n.Optional(n.String()),phase:n.Optional(n.String()),stage:n.Optional(n.String()),profile:n.String(),planId:n.Optional(n.String()),harness:n.Optional(n.Union([n.Literal("claude-sdk"),n.Literal("pi")])),toolbelt:n.Optional(n.Union([n.String(),n.Null()])),projectMcpSelection:n.Optional(n.Union([n.Literal("all"),n.Literal("none"),n.Literal("toolbelt")])),projectMcpServerNames:n.Optional(n.Array(n.String())),toolNames:n.Array(n.String()),effectiveToolNames:n.Array(n.String()),registeredToolNames:n.Array(n.String()),inlineToolNames:n.Array(n.String()),allowedToolsAdded:n.Array(n.String()),disallowedToolsAdded:n.Array(n.String()),excludedToolNames:n.Array(n.String()),toolCount:n.Integer({minimum:0}),allowedToolCount:n.Integer({minimum:0}),disallowedToolCount:n.Integer({minimum:0}),excludedToolCount:n.Integer({minimum:0})}),n.Object({type:n.Literal("queue:profile:selected"),prdId:n.String(),prdTitle:n.Optional(n.String()),profile:n.String(),baseProfile:n.Union([n.String(),n.Null()]),routerName:n.String(),extensionName:n.String(),extensionPath:n.String(),reason:n.Optional(n.String()),confidence:n.Optional(n.Union([n.Literal("low"),n.Literal("medium"),n.Literal("high")]))}),n.Object({type:n.Literal("queue:profile:router-failed"),prdId:n.String(),routerName:n.String(),extensionName:n.String(),extensionPath:n.String(),message:n.String(),stack:n.Optional(n.String())}),n.Object({type:n.Literal("queue:profile:router-timeout"),prdId:n.String(),routerName:n.String(),extensionName:n.String(),extensionPath:n.String(),timeoutMs:n.Integer({minimum:0})}),n.Object({type:n.Literal("queue:profile:invalid-selection"),prdId:n.String(),routerName:n.String(),extensionName:n.String(),extensionPath:n.String(),requestedProfile:n.String(),reason:n.Union([n.Literal("not-found"),n.Literal("load-error")]),message:n.String()}),n.Object({type:n.Literal("extension:policy:decision"),...Gc,...xS}),n.Object({type:n.Literal("extension:policy:decision"),...Gc,...ES}),n.Object({type:n.Literal("extension:policy:decision"),...Gc,...PS}),n.Object({type:n.Literal("extension:policy:decision"),...Kc,...xS}),n.Object({type:n.Literal("extension:policy:decision"),...Kc,...ES}),n.Object({type:n.Literal("extension:policy:decision"),...Kc,...PS}),n.Object({type:n.Literal("extension:policy:decision"),...Vc,...xS}),n.Object({type:n.Literal("extension:policy:decision"),...Vc,...ES}),n.Object({type:n.Literal("extension:policy:decision"),...Vc,...PS}),n.Object({type:n.Literal("extension:policy:failed"),...Gc,message:n.String(),stack:n.Optional(n.String())}),n.Object({type:n.Literal("extension:policy:failed"),...Kc,message:n.String(),stack:n.Optional(n.String())}),n.Object({type:n.Literal("extension:policy:failed"),...Vc,message:n.String(),stack:n.Optional(n.String())}),n.Object({type:n.Literal("extension:policy:timeout"),...Gc,timeoutMs:n.Integer({minimum:0})}),n.Object({type:n.Literal("extension:policy:timeout"),...Kc,timeoutMs:n.Integer({minimum:0})}),n.Object({type:n.Literal("extension:policy:timeout"),...Vc,timeoutMs:n.Integer({minimum:0})}),n.Object({type:n.Literal("extension:input-source:fetched"),extensionPath:n.String(),extensionName:n.String(),adapterName:n.String(),sourceId:n.String(),contentLength:n.Integer({minimum:0})}),n.Object({type:n.Literal("extension:input-source:failed"),extensionPath:n.String(),extensionName:n.String(),adapterName:n.String(),sourceId:n.String(),reason:n.Union([n.Literal("not-found"),n.Literal("error"),n.Literal("timeout"),n.Literal("invalid-result")]),message:n.String(),stack:n.Optional(n.String()),timeoutMs:n.Optional(n.Integer({minimum:0}))}),n.Object({type:n.Literal("extension:prd-enricher:applied"),extensionPath:n.String(),extensionName:n.String(),enricherName:n.String(),sourceId:n.String(),changed:n.Boolean(),inputLength:n.Integer({minimum:0}),outputLength:n.Integer({minimum:0})}),n.Object({type:n.Literal("extension:prd-enricher:failed"),extensionPath:n.String(),extensionName:n.String(),enricherName:n.String(),sourceId:n.String(),reason:n.Union([n.Literal("error"),n.Literal("timeout"),n.Literal("invalid-result")]),message:n.String(),stack:n.Optional(n.String()),timeoutMs:n.Optional(n.Integer({minimum:0}))}),n.Object({type:n.Literal("extension:reviewer-perspective:applied"),extensionPath:n.String(),extensionName:n.String(),perspectiveKey:Pt,perspectiveLabel:n.String(),planId:n.Optional(n.String())}),n.Union([n.Object({type:n.Literal("extension:reviewer-perspective:skipped"),extensionPath:n.String(),extensionName:n.String(),perspectiveKey:Pt,reason:n.Union([n.Literal("not-applicable"),n.Literal("applicability-error"),n.Literal("applicability-timeout")]),message:n.Optional(n.String()),planId:n.Optional(n.String()),timeoutMs:n.Optional(n.Integer({minimum:0}))}),n.Object({type:n.Literal("extension:reviewer-perspective:skipped"),extensionPath:n.Optional(n.String()),extensionName:n.Optional(n.String()),perspectiveKey:Pt,reason:n.Literal("unknown-key"),message:n.Optional(n.String()),planId:n.Optional(n.String())})]),n.Object({type:n.Literal("extension:validation-provider:start"),planId:n.String(),providerName:n.String(),extensionName:n.String(),extensionPath:n.String(),kind:n.Union([n.Literal("validate"),n.Literal("commands")]),commandCount:n.Optional(n.Integer({minimum:0}))}),n.Object({type:n.Literal("extension:validation-provider:complete"),planId:n.String(),providerName:n.String(),extensionName:n.String(),extensionPath:n.String(),status:n.Union([n.Literal("passed"),n.Literal("skipped")]),message:n.Optional(n.String())}),n.Object({type:n.Literal("extension:validation-provider:error"),planId:n.String(),providerName:n.String(),extensionName:n.String(),extensionPath:n.String(),status:n.Literal("failed"),message:n.String(),details:n.Optional(n.String()),command:n.Optional(n.String()),exitCode:n.Optional(n.Integer())}),n.Object({type:n.Literal("extension:validation-provider:timeout"),planId:n.String(),providerName:n.String(),extensionName:n.String(),extensionPath:n.String(),timeoutMs:n.Integer({minimum:0}),command:n.Optional(n.String())})];var ZE=2e3,JE=1024,YE=2048,eP=1024,tP=128,kn=n.String({maxLength:ZE}),zS=n.Array(kn,{maxItems:tP}),Yl=n.Integer({minimum:0});var nP=n.Union([n.Literal("foundation-contract"),n.Literal("subsystem"),n.Literal("oversized-criterion"),n.Literal("general"),n.Literal("rescope-split")]),iP=n.Object({atomId:kn,title:kn,reason:nP,criterionIds:zS,dependencyAtomIds:zS},{additionalProperties:!1}),rP=n.Object({fromAtomId:kn,toAtomId:kn,reason:kn},{additionalProperties:!1}),oP=n.Union([n.Literal("queued"),n.Literal("running"),n.Literal("completed"),n.Literal("skipped"),n.Literal("failed")]),sP=n.Object({nodeId:kn,depth:Yl,inputAtomIds:zS,inputNodeIds:zS},{additionalProperties:!1}),aP=n.Union([n.Literal("queued"),n.Literal("running"),n.Literal("completed"),n.Literal("failed"),n.Literal("incomplete")]),$M=[n.Object({type:n.Literal("planning:map-reduce:atoms"),graphId:kn,atomCount:Yl,edgeCount:Yl,atoms:n.Array(iP,{maxItems:JE}),edges:n.Array(rP,{maxItems:YE})}),n.Object({type:n.Literal("planning:map-reduce:atom:status"),atomId:kn,status:oP,reason:n.Optional(kn)}),n.Object({type:n.Literal("planning:map-reduce:reduce-tree"),graphId:kn,rootNodeId:n.Optional(kn),maxDepth:Yl,nodeCount:Yl,nodes:n.Array(sP,{maxItems:eP})}),n.Object({type:n.Literal("planning:map-reduce:reduce:status"),nodeId:kn,status:aP,reason:n.Optional(kn)})];var NM=[n.Object({type:n.Literal("session:start"),sessionId:n.String()}),n.Object({type:n.Literal("session:end"),sessionId:n.String(),result:PE}),n.Object({type:n.Literal("session:profile"),profileName:n.Union([n.String(),n.Null()]),source:n.Union([n.Literal("local"),n.Literal("project"),n.Literal("user-local"),n.Literal("missing"),n.Literal("none"),n.Literal("override")]),scope:n.Union([n.Literal("local"),n.Literal("project"),n.Literal("user"),n.Null()]),config:n.Union([n.Unknown(),n.Null()])}),n.Object({type:n.Literal("phase:start"),runId:n.String(),planSet:n.String(),command:n.Union([n.Literal("compile"),n.Literal("build"),n.Literal("continue-repair")])}),n.Object({type:n.Literal("phase:end"),runId:n.String(),result:PE}),n.Object({type:n.Literal("config:warning"),message:n.String(),source:n.String(),details:n.Optional(n.String())}),n.Object({type:n.Literal("planning:warning"),planId:n.Optional(n.String()),message:n.String(),source:n.String(),details:n.Optional(n.String())}),n.Object({type:n.Literal("planning:module:build-config:invalid"),moduleId:n.String(),reason:n.Union([n.Literal("invalid-json"),n.Literal("invalid-schema")]),errors:n.Array(n.String())})],Qi={timestamp:n.String(),sessionId:n.Optional(n.String()),runId:n.Optional(n.String())},jM=[n.Object({type:n.Literal("planning:start"),source:n.String(),label:n.Optional(n.String())}),n.Object({type:n.Literal("planning:inspection-summary"),summary:Tl,artifactPath:n.Optional(n.String())}),n.Object({type:n.Literal("planning:skip"),reason:n.String()}),n.Object({type:n.Literal("planning:submission"),planCount:n.Number(),totalBodySize:n.Number(),hasMigrations:n.Boolean()}),n.Object({type:n.Literal("planning:error"),reason:n.String()}),n.Object({type:n.Literal("planning:scope-context:failure"),runId:n.Optional(n.String()),failure:Mc}),n.Object({...Qi,type:n.Literal("planning:decomposition:start"),...g0},{additionalProperties:!1}),n.Object({...Qi,type:n.Literal("planning:decomposition:unit:queued"),...S0},{additionalProperties:!1}),n.Object({...Qi,type:n.Literal("planning:decomposition:unit:running"),...y0},{additionalProperties:!1}),n.Object({...Qi,type:n.Literal("planning:decomposition:unit:progress"),...h0},{additionalProperties:!1}),n.Object({...Qi,type:n.Literal("planning:decomposition:unit:completed"),...I0},{additionalProperties:!1}),n.Object({...Qi,type:n.Literal("planning:decomposition:unit:skipped"),...b0},{additionalProperties:!1}),n.Object({...Qi,type:n.Literal("planning:decomposition:unit:failed"),...R0},{additionalProperties:!1}),n.Object({...Qi,type:n.Literal("planning:decomposition:schedule"),...x0},{additionalProperties:!1}),n.Object({...Qi,type:n.Literal("planning:decomposition:budget"),...E0},{additionalProperties:!1}),n.Object({...Qi,type:n.Literal("planning:decomposition:compact-handoff"),...P0},{additionalProperties:!1}),n.Object({...Qi,type:n.Literal("planning:decomposition:synthesis:complete"),...k0},{additionalProperties:!1}),n.Object({type:n.Literal("planning:clarification"),questions:n.Array($0)}),n.Object({type:n.Literal("planning:clarification:answer"),answers:n.Record(n.String(),n.String())}),n.Object({type:n.Literal("planning:progress"),message:n.String()}),n.Object({type:n.Literal("planning:continuation"),attempt:n.Number(),maxContinuations:n.Number(),reason:n.Optional(n.Union([n.Literal("max_turns"),n.Literal("dropped_submission"),n.Literal("compact_inspection")]))}),n.Object({type:n.Literal("planning:pipeline"),compile:n.Array(n.String()),defaultBuild:n.Array(Jo),defaultReview:Hc,rationale:n.String()}),n.Object({type:n.Literal("planning:complete"),plans:n.Array(j0),planConfigs:n.Optional(n.Array(n.Object({id:n.String(),build:n.Optional(n.Array(Jo)),review:n.Optional(Hc),testOwnership:n.Optional(Yr)})))}),n.Object({type:n.Literal("planning:review:start")}),n.Object({type:n.Literal("planning:review:complete"),issues:n.Array(Qc)}),n.Object({type:n.Literal("planning:evaluate:start")}),n.Object({type:n.Literal("planning:evaluate:continuation"),attempt:n.Number(),maxContinuations:n.Number()}),n.Object({type:n.Literal("planning:evaluate:complete"),accepted:n.Number(),rejected:n.Number(),verdicts:n.Optional(n.Array(n.Object({file:n.String(),action:n.Union([n.Literal("accept"),n.Literal("reject"),n.Literal("review")]),reason:n.String(),hunk:n.Optional(n.Integer({minimum:1}))})))})];var BM=[n.Object({type:n.Literal("stack:layer:recorded"),prdId:n.String(),stackId:n.String(),parentPrdId:n.Optional(n.String()),provider:Wi,branch:n.String(),baseBranch:n.Optional(n.String()),artifact:n.Optional(zc),landingAction:n.Optional(Zo),status:qc}),n.Object({type:n.Literal("stack:provider:command"),provider:Wi,command:n.String(),args:n.Optional(n.Array(n.String())),exitCode:n.Union([n.Integer(),n.Null()]),branch:n.Optional(n.String())}),n.Object({type:n.Literal("stack:landing:update"),prdId:n.String(),stackId:n.String(),action:Zo,branch:n.String(),status:RS,prUrl:n.Optional(n.String()),reason:n.Optional(n.String()),originalBaseBranch:n.Optional(n.String()),effectiveBaseBranch:n.Optional(n.String()),baseRepairReason:n.Optional(n.Literal("parent-artifact-already-integrated"))}),n.Object({type:n.Literal("stack:landing:conflict:detected"),prdId:n.String(),stackId:n.String(),provider:Wi,branch:n.String(),operation:Dl,conflictKind:$l,conflictedFiles:n.Array(n.String())}),n.Object({type:n.Literal("stack:landing:conflict:recovery:start"),prdId:n.String(),stackId:n.String(),provider:Wi,branch:n.String(),attempt:n.Integer({minimum:1}),maxAttempts:n.Integer({minimum:1})}),n.Object({type:n.Literal("stack:landing:conflict:recovery:complete"),prdId:n.String(),stackId:n.String(),provider:Wi,branch:n.String(),attempts:n.Integer({minimum:1})}),n.Object({type:n.Literal("stack:landing:conflict:recovery:failed"),prdId:n.String(),stackId:n.String(),provider:Wi,branch:n.String(),attempts:n.Integer({minimum:0}),reason:n.String(),abortAttempted:n.Boolean(),abortSucceeded:n.Boolean()}),n.Object({type:n.Literal("stack:sync:start"),syncId:n.String(),trigger:Yc,dryRun:n.Boolean()}),n.Object({type:n.Literal("stack:sync:complete"),syncId:n.String(),trigger:Yc,dryRun:n.Boolean(),restackCandidates:n.Array(n.String()),excludedCandidates:n.Array(n.String()),localTrunkSha:n.Optional(n.String()),originTrunkSha:n.Optional(n.String()),fastForward:n.Optional(n.Boolean()),reason:n.Optional(n.String())}),n.Object({type:n.Literal("stack:sync:failed"),syncId:n.String(),trigger:Yc,dryRun:n.Boolean(),outcome:n.Union([n.Literal("failed"),n.Literal("conflict")]),reason:n.String(),error:n.Optional(n.String())}),n.Object({type:n.Literal("stack:sync:deferred"),syncId:n.String(),trigger:Yc,reason:n.String(),excludedCandidates:n.Array(n.String())}),n.Object({type:n.Literal("stack:sync:skipped"),syncId:n.String(),trigger:Yc,dryRun:n.Boolean(),reason:n.String(),restackCandidates:n.Array(n.String()),excludedCandidates:n.Array(n.String())}),n.Object({type:n.Literal("base-sync:start"),remote:n.String(),baseBranch:n.String(),featureBranch:n.String(),maxAttempts:n.Integer({minimum:1})}),n.Object({type:n.Literal("base-sync:conflict:attempt"),remote:n.String(),baseBranch:n.String(),featureBranch:n.String(),attempt:n.Integer({minimum:1}),maxAttempts:n.Integer({minimum:1}),conflictedFiles:n.Array(n.String())}),n.Object({type:n.Literal("base-sync:resolver:start"),remote:n.String(),baseBranch:n.String(),featureBranch:n.String(),attempt:n.Integer({minimum:1}),maxAttempts:n.Integer({minimum:1})}),n.Object({type:n.Literal("base-sync:resolver:complete"),remote:n.String(),baseBranch:n.String(),featureBranch:n.String(),attempt:n.Integer({minimum:1}),maxAttempts:n.Integer({minimum:1}),resolved:n.Boolean(),remainingConflicts:n.Integer({minimum:0})}),n.Object({type:n.Literal("base-sync:rebase:continue"),remote:n.String(),baseBranch:n.String(),featureBranch:n.String(),attempt:n.Integer({minimum:1}),maxAttempts:n.Integer({minimum:1})}),n.Object({type:n.Literal("base-sync:success"),remote:n.String(),baseBranch:n.String(),featureBranch:n.String(),baseSha:n.String(),featureSha:n.String(),rebased:n.Boolean()}),n.Object({type:n.Literal("base-sync:budget:exhausted"),remote:n.String(),baseBranch:n.String(),featureBranch:n.String(),attempts:n.Integer({minimum:0}),maxAttempts:n.Integer({minimum:1}),conflictedFiles:n.Array(n.String())})];var MM=[n.Object({type:n.Literal("validation:start"),commands:n.Array(n.String())}),n.Object({type:n.Literal("validation:command:start"),command:n.String()}),n.Object({type:n.Literal("validation:command:complete"),command:n.String(),exitCode:n.Number(),output:n.String()}),n.Object({type:n.Literal("validation:command:timeout"),command:n.String(),timeoutMs:n.Number(),pid:n.Number()}),n.Object({type:n.Literal("validation:complete"),passed:n.Boolean()}),n.Object({type:n.Literal("validation:fix:start"),attempt:n.Number(),maxAttempts:n.Number()}),n.Object({type:n.Literal("validation:fix:complete"),attempt:n.Number()}),n.Object({type:n.Literal("prd_validation:start")}),n.Object({type:n.Literal("prd_validation:complete"),passed:n.Boolean(),gaps:n.Array(EE),completionPercent:n.Optional(n.Number())}),n.Object({type:n.Literal("gap_close:start"),gapCount:n.Optional(n.Number()),completionPercent:n.Optional(n.Number())}),n.Object({type:n.Literal("gap_close:plan_ready"),planBody:n.String(),gaps:n.Array(EE)}),n.Object({type:n.Literal("gap_close:complete"),passed:n.Boolean()}),n.Object({type:n.Literal("acceptance_validation:complete"),passed:n.Boolean(),verdicts:n.Array(Wc,{minItems:1}),waivers:n.Optional(n.Array(n.String())),acceptanceConflicts:n.Optional(n.Array(Xc)),source:n.String({minLength:1})}),n.Object({type:n.Literal("reconciliation:start")}),n.Object({type:n.Literal("reconciliation:complete"),report:M0}),n.Object({type:n.Literal("cleanup:start"),planSet:n.String()}),n.Object({type:n.Literal("cleanup:complete"),planSet:n.String()}),n.Object({type:n.Literal("approval:needed"),planId:n.Optional(n.String()),action:n.String(),details:n.String()}),n.Object({type:n.Literal("approval:response"),approved:n.Boolean()}),n.Object({type:n.Literal("enqueue:start"),source:n.String()}),n.Object({type:n.Literal("enqueue:complete"),id:n.String(),filePath:n.String(),title:n.String(),planSet:n.String()}),n.Object({type:n.Literal("enqueue:failed"),error:n.String()}),n.Object({type:n.Literal("enqueue:commit-failed"),error:n.String()}),n.Object({type:n.Literal("recovery:start"),prdId:n.String(),setName:n.String()}),n.Object({type:n.Literal("recovery:summary"),prdId:n.String(),summary:F0}),n.Object({type:n.Literal("recovery:complete"),prdId:n.String(),verdict:D0,sidecarMdPath:n.Optional(n.String()),sidecarJsonPath:n.Optional(n.String())}),n.Object({type:n.Literal("recovery:error"),prdId:n.String(),error:n.String(),rawOutput:n.Optional(n.String())}),n.Object({type:n.Literal("recovery:auto-resume:evaluate"),prdId:n.String(),setName:n.String(),enabled:n.Boolean(),attempt:n.Integer({minimum:0}),maxAttempts:n.Integer({minimum:0,maximum:3})}),n.Object({type:n.Literal("recovery:auto-resume:queued"),prdId:n.String(),setName:n.String(),action:n.Literal("continue-repair"),attempt:n.Integer({minimum:1}),maxAttempts:n.Integer({minimum:1,maximum:3})}),n.Object({type:n.Literal("recovery:auto-resume:stopped"),prdId:n.String(),setName:n.String(),reason:n.Union([n.Literal("disabled"),n.Literal("attempt-budget-exhausted"),n.Literal("not-continue-repair"),n.Literal("not-high-confidence"),n.Literal("not-eligible"),n.Literal("manual-confirmation-required"),n.Literal("partial-sidecar"),n.Literal("malformed-sidecar"),n.Literal("missing-sidecar"),n.Literal("ineligible-artifacts"),n.Literal("dirty-worktree"),n.Literal("conflicting-worktree"),n.Literal("queue-preflight-blocked"),n.Literal("conflicting-applied-marker"),n.Literal("active-gate-or-hold"),n.Literal("repeated-failure-signature"),n.Literal("error")]),attempt:n.Integer({minimum:0}),maxAttempts:n.Integer({minimum:0,maximum:3}),message:n.Optional(n.String())}),n.Object({type:n.Literal("recovery:apply:start"),prdId:n.String()}),n.Object({type:n.Literal("recovery:apply:complete"),prdId:n.String(),verdict:n.Union([n.Literal("retry"),n.Literal("continue-repair"),n.Literal("abandon"),n.Literal("manual")]),noAction:n.Boolean()}),n.Object({type:n.Literal("recovery:apply:error"),prdId:n.String(),message:n.String()})];var $se=[...NM,...DM,...jM,...$M,...V0,...K0,...MM,...W0,..._E,n.Object({type:n.Literal("plan:build:decision"),planId:n.String(),decision:Fl}),kE,...BM,...H0],cP=n.Union([...$se]);var ns=n.Intersect([AE,cP]);var Nse=n.Object({type:n.Literal("daemon:heartbeat"),timestamp:n.String(),uptime:n.Number(),queueDepth:n.Number(),runningBuilds:n.Number(),autoBuild:n.Object({enabled:n.Boolean(),paused:n.Boolean(),...Ul}),subscribers:n.Number()}),jse=n.Object({id:n.Number(),event:ns}),Bse=n.Object({id:n.String(),sessionId:n.Optional(n.String()),planSet:n.String(),command:n.String(),status:n.String(),startedAt:n.String(),completedAt:n.Optional(n.String()),cwd:n.String(),pid:n.Optional(n.Number())}),Mse=n.Object({id:n.String(),title:n.String(),status:n.String(),priority:n.Optional(n.Number()),created:n.Optional(n.String()),dependsOn:n.Optional(n.Array(n.String())),dispatchFailure:n.Optional(n.Object({reason:n.String(),stage:n.Union([n.Literal("stacking-validation"),n.Literal("policy-gate"),n.Literal("profile-routing"),n.Literal("dispatch")]),timestamp:n.String()})),recoveryVerdict:n.Optional(n.Object({verdict:n.Union([n.Literal("retry"),n.Literal("continue-repair"),n.Literal("abandon"),n.Literal("manual")]),confidence:n.Union([n.Literal("low"),n.Literal("medium"),n.Literal("high")])})),hold:n.Optional(Ml),capabilities:Bl,recoveryApplied:n.Optional(n.Union([n.Object({action:n.Union([n.Literal("retry"),n.Literal("continue-repair"),n.Literal("abandon")]),appliedAt:n.String(),commitSha:n.Optional(n.String())}),n.Object({action:n.Literal("accepted-success"),acceptedAt:n.String(),reasonCategory:n.Union([n.Literal("bad_acceptance_criterion"),n.Literal("manual_verification_passed"),n.Literal("external_or_inconclusive_criterion_waived"),n.Literal("other")]),reason:n.String(),cleanup:n.Object({status:n.Union([n.Literal("committed"),n.Literal("noop")]),commitSha:n.Optional(n.String())}),landing:n.Object({action:n.Union([n.Literal("pr"),n.Literal("merge"),n.Literal("leave")]),status:n.Union([n.Literal("complete"),n.Literal("skipped"),n.Literal("failed")]),prUrl:n.Optional(n.String()),mergeCommitSha:n.Optional(n.String()),branch:n.Optional(n.String()),reason:n.Optional(n.String()),autoMerge:n.Optional(n.Union([n.Object({status:n.Literal("complete")}),n.Object({status:n.Literal("skipped"),reason:n.String()}),n.Object({status:n.Literal("failed"),reason:n.String()})]))}),dependents:n.Object({unblocked:n.Array(n.String()),remainedBlocked:n.Array(n.String()),notFound:n.Array(n.String())})})]))}),Use=n.Object({planCount:n.Union([n.Number(),n.Null()]),baseProfile:n.Union([n.String(),n.Null()])}),Fse=n.Object({enabled:n.Boolean(),watcher:n.Object({running:n.Boolean(),pid:n.Union([n.Number(),n.Null()]),sessionId:n.Union([n.String(),n.Null()])}),...Ul}),dP=n.Object({cursor:n.Number(),liveness:Nse,recentActivity:n.Array(jse),runs:n.Array(Bse),queue:n.Array(Mse),sessionMetadata:n.Record(n.String(),Use),autoBuild:Fse,stackLayers:n.Array(Nl),failedEnqueues:n.Array(Zs),stackSyncStatus:n.Optional(n.Object({last:n.Optional(n.Object({id:n.String(),trigger:n.Optional(n.Union([n.Literal("manual"),n.Literal("after-build"),n.Literal("scheduled"),n.Literal("retry-deferred")])),activeBuildPolicy:n.Optional(n.Union([n.Literal("skip"),n.Literal("defer")])),startedAt:n.String(),completedAt:n.Optional(n.String()),outcome:n.Union([n.Literal("skipped"),n.Literal("complete"),n.Literal("failed"),n.Literal("conflict"),n.Literal("deferred")]),reason:n.Optional(n.String()),error:n.Optional(n.String()),dryRun:n.Boolean(),localTrunkSha:n.Optional(n.String()),originTrunkSha:n.Optional(n.String()),fastForward:n.Optional(n.Boolean()),restackCandidates:n.Array(n.String()),activeBuildSkips:n.Optional(n.Array(n.Object({branch:n.String(),worktree:n.Optional(n.String()),reason:n.String()}))),providerCommands:n.Optional(n.Array(n.Object({command:n.String(),args:n.Array(n.String()),dryRun:n.Boolean(),ran:n.Boolean(),stdout:n.Optional(n.String()),stderr:n.Optional(n.String()),exitCode:n.Optional(n.Number())})))})),current:n.Optional(n.Object({id:n.String(),trigger:n.Optional(n.Union([n.Literal("manual"),n.Literal("after-build"),n.Literal("scheduled"),n.Literal("retry-deferred")])),activeBuildPolicy:n.Optional(n.Union([n.Literal("skip"),n.Literal("defer")])),startedAt:n.String(),completedAt:n.Optional(n.String()),outcome:n.Optional(n.Union([n.Literal("skipped"),n.Literal("complete"),n.Literal("failed"),n.Literal("conflict"),n.Literal("deferred")])),reason:n.Optional(n.String()),error:n.Optional(n.String()),dryRun:n.Boolean(),localTrunkSha:n.Optional(n.String()),originTrunkSha:n.Optional(n.String()),fastForward:n.Optional(n.Boolean()),restackCandidates:n.Array(n.String()),activeBuildSkips:n.Optional(n.Array(n.Object({branch:n.String(),worktree:n.Optional(n.String()),reason:n.String()}))),providerCommands:n.Optional(n.Array(n.Object({command:n.String(),args:n.Array(n.String()),dryRun:n.Boolean(),ran:n.Boolean(),stdout:n.Optional(n.String()),stderr:n.Optional(n.String()),exitCode:n.Optional(n.Number())})))}))}))}),UM=n.Object({cursor:n.Number(),status:n.Union([n.Literal("pending"),n.Literal("running"),n.Literal("completed"),n.Literal("failed")]),events:n.Array(n.Object({id:n.Number(),data:n.String()}))});var KS=1e3,WM="eforge-recovery-sidecar-compile-scope-context-reason-bytes";Bn.Set(WM,e=>new TextEncoder().encode(e).length<=KS);var Vse=n.Integer({minimum:0}),Hse=n.Integer({minimum:1}),lP=n.Object({kind:n.Literal("continue-repair"),action:n.Literal("continue-repair"),recommended:n.Boolean(),reason:n.String()}),pP=n.Union([n.Literal("bounded-decomposition"),n.Literal("manual-reduce-scope")]),XM=n.Object({kind:n.Literal("compile-scope-context"),action:pP,recommended:n.Boolean(),eligible:n.Boolean(),reason:n.String({minLength:1,maxLength:KS,format:WM}),attempted:n.Boolean(),attempt:Vse,maxAttempts:Hse,source:jc,failureKind:Bc,decompositionEvidence:n.Optional(Ir)}),Wse=n.Union([n.Literal("preflight"),n.Literal("live-context-guard"),n.Literal("provider")]),Xse=n.Union([n.Literal("context-budget"),n.Literal("context-window"),n.Literal("context-length"),n.Literal("scope-too-broad")]),VS=n.Intersect([XM,n.Union([n.Object({source:n.Literal("decomposition"),failureKind:n.Literal("decomposition-exhausted"),decompositionEvidence:Ir}),n.Object({source:Wse,failureKind:Xse,decompositionEvidence:n.Optional(n.Never())})])]);Object.assign(VS,{properties:XM.properties});var QM=n.Union([lP,VS]);import{readFileSync as TKe,writeFileSync as CKe,unlinkSync as LKe,mkdirSync as DKe,renameSync as $Ke}from"fs";import{dirname as jKe,resolve as BKe}from"path";import{randomBytes as UKe}from"crypto";import{spawn as JKe,execFile as Yse}from"child_process";import{promisify as eae}from"util";import{basename as tVe,resolve as nVe,dirname as iVe}from"path";var rVe=eae(Yse);var tU=n.Object({description:n.Optional(n.String()),whenToUse:n.Optional(n.Array(n.String())),tags:n.Optional(n.Array(n.String()))},{additionalProperties:!0}),nU=n.Object({name:n.String(),harness:n.Optional(n.Union([n.Literal("claude-sdk"),n.Literal("pi")])),path:n.String(),scope:n.Union([n.Literal("local"),n.Literal("project"),n.Literal("user")]),shadowedBy:n.Optional(n.Union([n.Literal("local"),n.Literal("project")])),metadata:n.Optional(tU)},{additionalProperties:!0}),iU=n.Union([n.Literal("local"),n.Literal("project"),n.Literal("user-local"),n.Literal("missing"),n.Literal("none")]),mP=n.Object({profiles:n.Array(nU),active:n.Union([n.String(),n.Null()]),source:iU},{additionalProperties:!0});function fP(e){let t=[];for(let i of e)t.includes(i)||t.push(i);return t}function rae(e,t){if(!(t===void 0&&e===void 0))return fP([...e??[],...t??[]])}function oae(e,t){let i=rae(e.dependsOn,t);return i===void 0?e:{...e,dependsOn:i}}function rU(e,t){if(t===void 0)return e;let i=fP(t);if(i.length===0){let{dependsOn:r,...o}=e;return o}return{...e,dependsOn:i}}function sae(e){let{recoveryVerdict:t,recoveryApplied:i,dispatchFailure:r,...o}=e;return o}function oU(e){return e==="failed"||e==="skipped"}function ep(e,t){if(e.dependsOn===void 0&&e.status===t)return e;let{dependsOn:i,...r}=e;return{...r,status:t}}function sU(e,t){if(!t.queue.some(i=>i.id===e.id))return{queue:[...t.queue,{id:e.id,title:e.title,status:"pending"}]}}function aU(e,t){let i=t.queue.findIndex(c=>c.id===e.prdId);if(i===-1){let c=rU({id:e.prdId,title:e.title,status:"pending"},e.dependsOn);return{queue:[...t.queue,c]}}let r=sae(t.queue[i]),o=r.status==="running"?r.status:"pending",s=rU({...r,title:e.title,status:o},e.dependsOn),a=[...t.queue];return a[i]=s,{queue:a}}function cU(e,t){let i=t.queue.findIndex(a=>a.id===e.prdId);if(i===-1)return;let r=t.queue[i];if(oU(r.status))return;let o=oae(r,e.blockedBy);if(o===r)return;let s=[...t.queue];return s[i]=o,{queue:s}}function dU(e,t){let i={reason:e.reason,stage:e.stage,timestamp:e.timestamp},r=t.queue.findIndex(s=>s.id===e.prdId);if(r===-1)return{queue:[...t.queue,{id:e.prdId,title:e.title,status:"failed",dispatchFailure:i}]};let o=[...t.queue];return o[r]={...ep(o[r],"failed"),title:e.title,dispatchFailure:i},{queue:o}}function uU(e,t){let i=t.queue.findIndex(s=>s.id===e.prdId);if(i===-1)return;let r=t.queue[i];if(oU(r.status))return;let o=[...t.queue];if(e.currentDependsOn.length===0){let{dependsOn:s,...a}=r;o[i]=r.status==="waiting"?{...a,status:"pending"}:a}else o[i]={...r,dependsOn:fP(e.currentDependsOn)};return{queue:o}}var gP={"session:start":{scope:"daemon",persist:!0,summary:"Session started",project:()=>{}},"session:end":{scope:"daemon",persist:!0,summary:e=>`Session ended: ${e.result.status}`,project:()=>{}},"session:profile":{scope:"session",persist:!1},"phase:start":{scope:"session",persist:!1,summary:e=>`Phase: ${e.command} starting`},"phase:end":{scope:"session",persist:!1,summary:e=>`Phase complete: ${e.result.status}`},"config:warning":{scope:"session",persist:!1,summary:e=>`Config warning: ${e.message}`},"planning:warning":{scope:"session",persist:!1,summary:e=>e.planId?`Plan warning (${e.planId}): ${e.message}`:`Plan warning: ${e.message}`},"planning:module:build-config:invalid":{scope:"session",persist:!1,summary:e=>`Module ${e.moduleId} emitted invalid <build-config> (${e.reason}): ${e.errors.join("; ")}`},"extension:event-handler:failed":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} event hook failed (${e.pattern} on ${e.triggeringEventType}): ${e.message}`},"extension:event-handler:timeout":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} event hook timed out after ${e.timeoutMs}ms (${e.pattern} on ${e.triggeringEventType})`},"extension:action:start":{scope:"daemon",persist:!0,summary:e=>`Extension action ${e.actionId} started for ${e.extensionName}`},"extension:action:complete":{scope:"daemon",persist:!0,summary:e=>`Extension action ${e.actionId} completed for ${e.extensionName}`},"extension:action:failed":{scope:"daemon",persist:!0,summary:e=>`Extension action ${e.actionId} failed for ${e.extensionName}: ${e.errorCode}`},"extension:action:timeout":{scope:"daemon",persist:!0,summary:e=>`Extension action ${e.actionId} timed out for ${e.extensionName} after ${e.timeoutMs}ms`},"extension:agent-task:start":{scope:"daemon",persist:!0,summary:e=>`Extension agent task ${e.taskId} started (${e.taskKind})`},"extension:agent-task:progress":{scope:"daemon",persist:!0,summary:e=>`Extension agent task ${e.taskId} progress: ${e.message}`},"extension:agent-task:complete":{scope:"daemon",persist:!0,summary:e=>`Extension agent task ${e.taskId} completed (${e.taskKind})`},"extension:agent-task:failed":{scope:"daemon",persist:!0,summary:e=>`Extension agent task ${e.taskId} failed (${e.errorCode}): ${e.message}`},"extension:agent-task:cancelled":{scope:"daemon",persist:!0,summary:e=>`Extension agent task ${e.taskId} cancelled${e.reason?`: ${e.reason}`:""}`},"extension:agent-context:applied":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} appended ${e.promptCharCount} chars to ${e.role}${e.tier?` (${e.tier})`:""}`},"extension:agent-context:failed":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} agent-context hook failed for ${e.role}: ${e.message}`},"extension:agent-context:timeout":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} agent-context hook timed out after ${e.timeoutMs}ms for ${e.role}`},"extension:agent-context:unsupported":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} returned unsupported fields for ${e.role}: ${e.fields.join(", ")} (deferred to EXTEND_08B)`},"extension:agent-tools:applied":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} applied tools for ${e.role}: ${e.toolCount} accepted, ${e.excludedToolCount} excluded`},"queue:profile:selected":{scope:"session",persist:!1,summary:e=>`Queue routed ${e.prdId} to profile "${e.profile}" via ${e.extensionName}:${e.routerName}${e.reason?` (${e.reason})`:""}`},"queue:profile:router-failed":{scope:"session",persist:!1,summary:e=>`Profile router "${e.routerName}" (${e.extensionName}) failed for ${e.prdId}: ${e.message}`},"queue:profile:router-timeout":{scope:"session",persist:!1,summary:e=>`Profile router "${e.routerName}" (${e.extensionName}) timed out after ${e.timeoutMs}ms for ${e.prdId}`},"queue:profile:invalid-selection":{scope:"session",persist:!1,summary:e=>`Profile router "${e.routerName}" (${e.extensionName}) returned unknown profile "${e.requestedProfile}" for ${e.prdId}: ${e.message}`},"extension:policy:decision":{scope:"session",persist:!1,summary:e=>`Policy gate ${e.method} (${e.extensionName}) returned ${e.decision}${e.reason?`: ${e.reason}`:""}`},"extension:policy:failed":{scope:"session",persist:!1,summary:e=>`Policy gate ${e.method} (${e.extensionName}) failed under ${e.failurePolicy}: ${e.message}`},"extension:policy:timeout":{scope:"session",persist:!1,summary:e=>`Policy gate ${e.method} (${e.extensionName}) timed out after ${e.timeoutMs}ms under ${e.failurePolicy}`},"extension:input-source:fetched":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} input source "${e.adapterName}" fetched "${e.sourceId}" (${e.contentLength} chars)`},"extension:input-source:failed":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} input source "${e.adapterName}" failed for "${e.sourceId}" (${e.reason}): ${e.message}`},"extension:prd-enricher:applied":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} PRD enricher "${e.enricherName}" applied to "${e.sourceId}" (changed: ${e.changed})`},"extension:prd-enricher:failed":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} PRD enricher "${e.enricherName}" failed for "${e.sourceId}" (${e.reason}): ${e.message}`},"extension:reviewer-perspective:applied":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} reviewer perspective "${e.perspectiveKey}" applied${e.planId?` (plan: ${e.planId})`:""}`},"extension:reviewer-perspective:skipped":{scope:"session",persist:!1,summary:e=>`${e.extensionName?`Extension ${e.extensionName} reviewer perspective`:"Reviewer perspective"} "${e.perspectiveKey}" skipped (${e.reason})${e.message?`: ${e.message}`:""}`},"extension:validation-provider:start":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} validation provider "${e.providerName}" started (${e.kind}${e.commandCount!==void 0?`, ${e.commandCount} command(s)`:""})`},"extension:validation-provider:complete":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} validation provider "${e.providerName}" ${e.status}${e.message?`: ${e.message}`:""}`},"extension:validation-provider:error":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} validation provider "${e.providerName}" failed${e.command?` (command: ${e.command})`:""}: ${e.message}`},"extension:validation-provider:timeout":{scope:"session",persist:!1,summary:e=>`Extension ${e.extensionName} validation provider "${e.providerName}" timed out after ${e.timeoutMs}ms${e.command?` (command: ${e.command})`:""}`},"planning:start":{scope:"session",persist:!1,summary:e=>`Planning from ${e.label??e.source}`},"planning:inspection-summary":{scope:"session",persist:!0,summary:e=>`Planner compact inspection summary: ${e.summary.relevantFiles.length} file(s), ${e.summary.observedFacts.length} fact(s), ${e.summary.importantFindings.length} finding(s)`},"planning:skip":{scope:"session",persist:!1,summary:e=>`Planning skipped: ${e.reason}`},"planning:submission":{scope:"session",persist:!1,summary:e=>`Planning submitted ${e.planCount} plan(s)`},"planning:error":{scope:"session",persist:!1,summary:e=>`Planning error: ${e.reason}`},"planning:scope-context:failure":{scope:"session",persist:!0,summary:e=>`Compile scope/context failure: ${e.failure.failureKind} from ${e.failure.source}; recovery ${e.failure.recovery.action}`},"planning:decomposition:start":{scope:"session",persist:!0,summary:e=>`Context-managed planning: ${e.unitCount} unit(s), ${e.edgeCount} edge(s), parallelism ${e.limits.parallelism}`},"planning:decomposition:unit:queued":{scope:"session",persist:!0,summary:e=>`Planning unit queued: ${e.unit.unitId}${e.unit.subsystemHints.length?` (${e.unit.subsystemHints.join(", ")})`:""}`},"planning:decomposition:unit:running":{scope:"session",persist:!0,summary:e=>`Planning unit running: ${e.unitId}`},"planning:decomposition:unit:progress":{scope:"session",persist:!1,summary:e=>`Planning unit ${e.unitId}: ${e.message}`},"planning:decomposition:unit:completed":{scope:"session",persist:!0,summary:e=>`Planning unit completed: ${e.unit.unitId} (${e.unit.coverage.coveredCriteria.length} criteria)`},"planning:decomposition:unit:skipped":{scope:"session",persist:!0,summary:e=>`Planning unit skipped: ${e.unitId} \u2014 ${e.reason}`},"planning:decomposition:unit:failed":{scope:"session",persist:!0,summary:e=>`Planning unit failed: ${e.unitId} \u2014 ${e.reason||e.evidence.observed.triggeredLimitKeys.join(", ")}`},"planning:decomposition:schedule":{scope:"session",persist:!0,summary:e=>`Planning schedule: running [${e.decision.runningUnitIds.join(", ")}]; waiting ${e.decision.waitingUnitIds.length}; selected [${e.decision.selectedBatchUnitIds.join(", ")}]`},"planning:decomposition:budget":{scope:"session",persist:!0,summary:e=>`Planning budget: ${e.unitId} ${e.observed?.triggeredLimitKeys.length?`triggered ${e.observed.triggeredLimitKeys.join(", ")}`:"within limits"}`},"planning:decomposition:compact-handoff":{scope:"session",persist:!0,summary:e=>`Planning unit handoff: ${e.unitId??"unknown"} \u2192 ${e.artifactPath??"artifact"} (${e.byteLength} B)`},"planning:decomposition:synthesis:complete":{scope:"session",persist:!0,summary:e=>`Context-managed synthesis complete: ${e.artifactPaths.length} artifact(s), ${e.completedUnitCount}/${e.failedUnitCount}/${e.skippedUnitCount} units`},"planning:map-reduce:atoms":{scope:"session",persist:!0,summary:e=>`Map plan: ${e.atomCount} atom(s), ${e.edgeCount} edge(s)`},"planning:map-reduce:atom:status":{scope:"session",persist:!0,summary:e=>`Atom ${e.atomId}: ${e.status}${e.reason?` (${e.reason})`:""}`},"planning:map-reduce:reduce-tree":{scope:"session",persist:!0,summary:e=>`Reduce tree: ${e.nodeCount} node(s), max level ${e.maxDepth+1}`},"planning:map-reduce:reduce:status":{scope:"session",persist:!0,summary:e=>`Reduce ${e.nodeId}: ${e.status}${e.reason?` (${e.reason})`:""}`},"planning:clarification":{scope:"session",persist:!1,summary:e=>`Planning clarification needed (${e.questions.length} question(s))`},"planning:clarification:answer":{scope:"session",persist:!1,summary:"Clarification answered, resuming planning"},"planning:progress":{scope:"session",persist:!1},"planning:continuation":{scope:"session",persist:!1,summary:e=>`Planning continuation attempt ${e.attempt}/${e.maxContinuations}${e.reason?` (${e.reason})`:""}`},"planning:pipeline":{scope:"session",persist:!1,summary:e=>`Pipeline: ${e.compile.join(" \u2192 ")}`},"planning:complete":{scope:"session",persist:!1,summary:e=>e.plans.length===0?"Planning complete: nothing to plan":`Planning complete: ${e.plans.length} plan(s) created`},"planning:review:start":{scope:"session",persist:!1,summary:"Reviewing plan files"},"planning:review:complete":{scope:"session",persist:!1,summary:e=>e.issues.length===0?"Plan review complete: no issues":`Plan review: ${e.issues.length} issue(s)`},"planning:evaluate:start":{scope:"session",persist:!1,summary:"Evaluating plan review fixes"},"planning:evaluate:continuation":{scope:"session",persist:!1,summary:e=>`Plan evaluation continuation attempt ${e.attempt}/${e.maxContinuations}`},"planning:evaluate:complete":{scope:"session",persist:!1,summary:e=>`Plan evaluation: ${e.accepted} accepted, ${e.rejected} rejected`},"plan:build:start":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: starting`},"plan:build:implement:start":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: implementing`},"plan:build:implement:progress":{scope:"session",persist:!1},"plan:build:implement:continuation":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: implementation continuation attempt ${e.attempt}/${e.maxContinuations}`},"plan:build:implement:complete":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: implementation complete`},"plan:build:files_changed":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: ${e.files.length} file(s) changed`},"plan:build:review:start":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: reviewing`},"plan:build:review:complete":{scope:"session",persist:!1,summary:e=>e.issues.length===0?`Plan ${e.planId}: review complete, no issues`:`Plan ${e.planId}: review complete, ${e.issues.length} issue(s)`},"plan:build:review:parallel:start":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: parallel review (${e.perspectives.join(", ")})`},"plan:build:review:parallel:perspective:start":{scope:"session",persist:!1},"plan:build:review:parallel:perspective:complete":{scope:"session",persist:!1,summary:e=>e.issues.length>0?`Plan ${e.planId}: ${e.perspective} review, ${e.issues.length} issue(s)`:void 0},"plan:build:review:parallel:perspective:error":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: ${e.perspective} review failed: ${e.error}`},"plan:build:review:fix:start":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: applying ${e.issueCount} fix(es)`},"plan:build:review:fix:complete":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: fixes applied`},"plan:build:review:fix:continuation":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: review-fixer continuation attempt ${e.attempt}/${e.maxContinuations}`},"plan:build:evaluate:start":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: evaluating fixes`},"plan:build:evaluate:continuation":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: evaluation continuation attempt ${e.attempt}/${e.maxContinuations}`},"plan:build:evaluate:complete":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: evaluation complete, ${e.accepted} accepted, ${e.rejected} rejected`},"plan:build:doc-author:start":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: authoring docs`},"plan:build:doc-author:complete":{scope:"session",persist:!1,summary:e=>e.docsAuthored>0?`Plan ${e.planId}: ${e.docsAuthored} doc(s) authored`:void 0},"plan:build:doc-sync:start":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: syncing docs`},"plan:build:doc-sync:complete":{scope:"session",persist:!1,summary:e=>e.docsSynced>0?`Plan ${e.planId}: ${e.docsSynced} doc(s) synced`:void 0},"plan:build:test:ownership:violation":{scope:"session",persist:!0,summary:e=>`Plan ${e.planId}: ${e.stage} violated test ownership (${e.declaredOwner}): ${e.reason}`},"plan:build:test:write:start":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: writing tests`},"plan:build:test:write:complete":{scope:"session",persist:!1,summary:e=>e.testsWritten>0?`Plan ${e.planId}: ${e.testsWritten} test file(s) written`:void 0},"plan:build:test:start":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: running tests`},"plan:build:test:complete":{scope:"session",persist:!1,summary:e=>{let t=[`${e.passed} passed`];return e.failed>0&&t.push(`${e.failed} failed`),e.testBugsFixed>0&&t.push(`${e.testBugsFixed} test bugs fixed`),`Plan ${e.planId}: tests ${t.join(", ")}`}},"plan:build:complete":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: complete`},"plan:build:recovery:start":{scope:"session",persist:!0,summary:e=>`Plan ${e.planId}: same-plan ${e.blockerKind} recovery started (${e.maxAttempts} attempt(s))`},"plan:build:recovery:attempt:start":{scope:"session",persist:!0,summary:e=>`Plan ${e.planId}: same-plan recovery attempt ${e.attempt}/${e.maxAttempts}`},"plan:build:recovery:attempt:result":{scope:"session",persist:!0,summary:e=>`Plan ${e.planId}: same-plan recovery attempt ${e.attempt}/${e.maxAttempts} ${e.blockersCleared?"cleared blockers":"left blockers"}`},"plan:build:recovery:skip":{scope:"session",persist:!0,summary:e=>`Plan ${e.planId}: same-plan ${e.blockerKind} recovery skipped (${e.reason})`},"plan:build:recovery:exhausted":{scope:"session",persist:!0,summary:e=>`Plan ${e.planId}: same-plan ${e.blockerKind} recovery exhausted`},"plan:build:failed":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: failed \u2014 ${e.error}`},"plan:build:progress":{scope:"session",persist:!1},"plan:status:change":{scope:"session",persist:!0,summary:e=>`Plan ${e.planId}: status \u2192 ${e.status}`,project:()=>{}},"plan:error:set":{scope:"session",persist:!0,summary:e=>`Plan ${e.planId}: error set`,project:()=>{}},"plan:error:clear":{scope:"session",persist:!0,summary:e=>`Plan ${e.planId}: error cleared`,project:()=>{}},"schedule:start":{scope:"session",persist:!1,summary:e=>`Scheduling ${e.planIds.length} plan(s)`},"plan:schedule:ready":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId} ready to schedule: ${e.reason}`},"plan:merge:start":{scope:"session",persist:!1,summary:e=>`Merging plan ${e.planId}`},"plan:merge:complete":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId} merged`},"plan:build:decision":{scope:"session",persist:!1,summary:e=>`Plan ${e.planId}: decision (${e.decision.kind})`},"planning:decision":{scope:"session",persist:!1,summary:e=>e.planId?`Planning decision (${e.decision.kind}) for plan ${e.planId}`:`Planning decision (${e.decision.kind})`},"plan:merge:resolve:start":{scope:"session",persist:!1,summary:e=>`Resolving merge conflicts for plan ${e.planId}`},"plan:merge:resolve:complete":{scope:"session",persist:!1,summary:e=>e.resolved?`Merge conflicts resolved for plan ${e.planId}`:`Failed to resolve merge conflicts for plan ${e.planId}`},"landing:start":{scope:"session",persist:!1,summary:e=>`Landing (${e.action}): starting ${e.featureBranch} \u2192 ${e.baseBranch}`},"landing:complete":{scope:"session",persist:!1,summary:e=>e.action==="pr"?e.prUrl?`Landing (${e.action}): PR ${e.prUrl}`:`Landing (${e.action}): PR created for ${e.featureBranch}`:e.action==="merge"?`Landing (${e.action}): merged ${e.featureBranch} into ${e.baseBranch}`:e.action==="leave"?`Landing (${e.action}): ${e.featureBranch} left for manual workflow`:`Landing (${e.action}): completed`},"landing:skipped":{scope:"session",persist:!1,summary:e=>`Landing (${e.action}) skipped: ${e.reason}`},"landing:auto-merge:start":{scope:"session",persist:!1,summary:e=>`PR auto-merge: enabling for ${e.prUrl}`},"landing:auto-merge:complete":{scope:"session",persist:!1,summary:e=>`PR auto-merge: enabled for ${e.prUrl}`},"landing:auto-merge:skipped":{scope:"session",persist:!1,summary:e=>`PR auto-merge skipped: ${e.reason}`},"stack:layer:recorded":{scope:"session",persist:!0,summary:e=>`Stack layer recorded: ${e.prdId} (${e.status}) on ${e.branch}`,project:(e,t)=>t.stackLayers.find(r=>r.prdId===e.prdId)?{stackLayers:t.stackLayers.map(r=>r.prdId===e.prdId?{...r,stackId:e.stackId,parentPrdId:e.parentPrdId,provider:e.provider,branch:e.branch,baseBranch:e.baseBranch,...e.artifact!==void 0&&{artifact:e.artifact},...e.landingAction!==void 0&&{landingAction:e.landingAction},status:e.status,updatedAt:e.timestamp}:r)}:{stackLayers:[...t.stackLayers,{prdId:e.prdId,stackId:e.stackId,parentPrdId:e.parentPrdId,provider:e.provider,branch:e.branch,baseBranch:e.baseBranch,...e.artifact!==void 0&&{artifact:e.artifact},...e.landingAction!==void 0&&{landingAction:e.landingAction},status:e.status,recordedAt:e.timestamp,updatedAt:e.timestamp}]}},"stack:provider:command":{scope:"session",persist:!0,summary:e=>{let t=e.args?[e.command,...e.args].join(" "):e.command;return`Stack provider (${e.provider}): ${t} \u2192 exit ${e.exitCode}`}},"stack:landing:update":{scope:"session",persist:!0,summary:e=>{let t=`Stack landing: ${e.prdId} (${e.action}) ${e.status}`,i=e.baseRepairReason?` (base repaired: ${e.originalBaseBranch??"?"} \u2192 ${e.effectiveBaseBranch??"?"})`:"";return e.prUrl?`${t}${i} \u2014 ${e.prUrl}`:e.reason?`${t}${i} \u2014 ${e.reason}`:`${t}${i}`},project:(e,t)=>{let i=t.stackLayers.find(o=>o.prdId===e.prdId);if(!i)return;let r=i.status;return e.status==="complete"?r=e.action==="merge"?"merged":"landed":e.status==="failed"?r="failed":e.status==="skipped"&&(e.action==="merge"?r="merged":e.action==="leave"?r="landed":r="failed"),{stackLayers:t.stackLayers.map(o=>o.prdId===e.prdId?{...o,status:r,landing:{action:e.action,status:e.status,prUrl:e.prUrl,reason:e.reason,originalBaseBranch:e.originalBaseBranch,effectiveBaseBranch:e.effectiveBaseBranch,baseRepairReason:e.baseRepairReason,startedAt:o.landing?.startedAt??e.timestamp,completedAt:e.status==="complete"||e.status==="failed"||e.status==="skipped"?e.timestamp:void 0},updatedAt:e.timestamp}:o)}}},"stack:landing:conflict:detected":{scope:"session",persist:!0,summary:e=>`Stack landing conflict: ${e.prdId} ${e.operation} (${e.conflictedFiles.length} file(s))`},"stack:landing:conflict:recovery:start":{scope:"session",persist:!0,summary:e=>`Stack landing recovery attempt ${e.attempt}/${e.maxAttempts}: ${e.prdId}`},"stack:landing:conflict:recovery:complete":{scope:"session",persist:!0,summary:e=>`Stack landing recovery complete: ${e.prdId} after ${e.attempts} attempt(s)`},"stack:landing:conflict:recovery:failed":{scope:"session",persist:!0,summary:e=>`Stack landing recovery failed: ${e.prdId} \u2014 ${e.reason}`},"merge:finalize:start":{scope:"session",persist:!1,summary:e=>`Merging ${e.featureBranch} into ${e.baseBranch}`},"merge:finalize:complete":{scope:"session",persist:!1,summary:e=>`Merged ${e.featureBranch} into ${e.baseBranch}`},"merge:finalize:skipped":{scope:"session",persist:!1,summary:e=>`Feature branch merge skipped: ${e.reason}`},"merge:worktree:set":{scope:"session",persist:!0,project:()=>{}},"merge:worktree:clear":{scope:"session",persist:!0,project:()=>{}},"agent:start":{scope:"session",persist:!1,summary:e=>e.planId?`Agent ${e.agent} started (plan ${e.planId})`:`Agent ${e.agent} started`},"agent:warning":{scope:"session",persist:!1,summary:e=>`Agent ${e.agent} warning: ${e.message}`},"agent:stop":{scope:"session",persist:!1,summary:e=>e.error?`Agent ${e.agent} stopped with error`:`Agent ${e.agent} stopped`},"agent:usage":{scope:"session",persist:!1},"agent:message":{scope:"session",persist:!1},"agent:tool_use":{scope:"session",persist:!1},"agent:tool_result":{scope:"session",persist:!1},"agent:result":{scope:"session",persist:!1},"agent:activity":{scope:"session",persist:!1,summary:e=>`Agent ${e.agent} activity (${e.totals?.filesChanged??0} files, ${e.attribution})`},"agent:retry":{scope:"session",persist:!1,summary:e=>`Agent ${e.agent} retry attempt ${e.attempt}/${e.maxAttempts} (${e.subtype})`},"validation:start":{scope:"session",persist:!1,summary:e=>`Running post-merge validation (${e.commands.length} command(s))`},"validation:command:start":{scope:"session",persist:!1,summary:e=>`Running: ${e.command}`},"validation:command:complete":{scope:"session",persist:!1,summary:e=>e.exitCode===0?`${e.command} passed`:`${e.command} failed (exit ${e.exitCode})`},"validation:command:timeout":{scope:"session",persist:!1,summary:e=>`${e.command} timed out after ${Math.round(e.timeoutMs/1e3)}s`},"validation:complete":{scope:"session",persist:!1,summary:e=>e.passed?"All validation commands passed":"Validation failed"},"validation:fix:start":{scope:"session",persist:!1,summary:e=>`Validation fix attempt ${e.attempt}/${e.maxAttempts}`},"validation:fix:complete":{scope:"session",persist:!1,summary:e=>`Validation fix attempt ${e.attempt} complete`},"prd_validation:start":{scope:"session",persist:!1,summary:"PRD validation starting"},"prd_validation:complete":{scope:"session",persist:!1,summary:e=>e.passed?"PRD validation passed":`PRD validation failed: ${e.gaps.length} gap(s)`},"gap_close:start":{scope:"session",persist:!1,summary:e=>e.gapCount!==void 0?`Closing ${e.gapCount} gap(s)`:"Closing PRD validation gaps"},"gap_close:plan_ready":{scope:"session",persist:!1},"gap_close:complete":{scope:"session",persist:!1,summary:e=>e.passed?"Gap closing complete: all gaps resolved":"Gap closing complete: gaps remain"},"acceptance_validation:complete":{scope:"session",persist:!1,summary:e=>{let t=e.verdicts.reduce((s,a)=>(s[a.verdict]+=1,s),{pass:0,fail:0,unknown:0}),i=e.acceptanceConflicts?.length??0,r=i>0?` (${i} conflict(s) reported)`:"";if(e.passed)return`Acceptance validation passed: ${e.verdicts.length} criterion/criteria verified${r}`;if(t.fail>0){let s=t.unknown>0?`, ${t.unknown} unknown`:"";return`Acceptance validation failed: ${t.fail} criterion/criteria failed${s}${r}`}let o=t.unknown===e.verdicts.length?"; no criterion was verified":"";return`Acceptance validation inconclusive: ${t.unknown} criterion/criteria unknown${o}${r}`}},"reconciliation:start":{scope:"session",persist:!1,summary:"Reconciling worktree state"},"reconciliation:complete":{scope:"session",persist:!1,summary:e=>{let t=[];return e.report.valid.length>0&&t.push(`${e.report.valid.length} valid`),e.report.missing.length>0&&t.push(`${e.report.missing.length} missing`),e.report.corrupt.length>0&&t.push(`${e.report.corrupt.length} corrupt`),`Reconciliation complete: ${t.join(", ")}`}},"cleanup:start":{scope:"session",persist:!1,summary:e=>`Cleaning up plan files for ${e.planSet}`},"cleanup:complete":{scope:"session",persist:!1,summary:e=>`Plan files removed for ${e.planSet}`},"approval:needed":{scope:"session",persist:!1,summary:e=>`Approval needed: ${e.action}`},"approval:response":{scope:"session",persist:!1,summary:e=>e.approved?"Approved":"Denied"},"enqueue:start":{scope:"daemon",persist:!0,summary:e=>`Enqueueing from ${e.source}`},"enqueue:complete":{scope:"daemon",persist:!0,summary:e=>`Enqueued: ${e.title}`,project:sU},"enqueue:failed":{scope:"daemon",persist:!0,summary:e=>`Enqueue failed: ${e.error}`},"enqueue:commit-failed":{scope:"daemon",persist:!0,summary:e=>`Enqueue commit failed: ${e.error}`},"build:terminal-failure":{scope:"session",persist:!0,summary:e=>`Build terminal failure (${e.failure.scope}): ${e.failure.message}`},"build:resume:start":{scope:"session",persist:!0,summary:e=>`Resuming compiled build for PRD ${e.prdId} on ${e.featureBranch}`},"build:resume:state":{scope:"session",persist:!0,summary:e=>`Resume state seeded: ${e.seededMerged.length} merged, ${e.seededPending.length} pending on ${e.featureBranch}`},"build:resume:ineligible":{scope:"session",persist:!0,summary:e=>`Resume ineligible: ${e.reason}`},"build:resume:artifacts":{scope:"session",persist:!0,summary:e=>`Recovered ${e.plans.length} compiled plan artifact(s) for PRD ${e.prdId}`},"build:resume:complete":{scope:"session",persist:!0,summary:e=>`Build resume complete for PRD ${e.prdId}`},"recovery:start":{scope:"session",persist:!1,summary:e=>`Analysing failed build for PRD ${e.prdId}`},"recovery:summary":{scope:"session",persist:!1},"recovery:complete":{scope:"session",persist:!1,summary:e=>`Recovery analysis complete: ${e.verdict.verdict.toUpperCase()}`},"recovery:error":{scope:"session",persist:!1,summary:e=>`Recovery parse failed: ${e.error}`},"recovery:auto-resume:evaluate":{scope:"daemon",persist:!0,summary:e=>`Recovery auto-resume policy evaluated for ${e.prdId}: ${e.enabled?"enabled":"disabled"} (${e.attempt}/${e.maxAttempts})`,project:(e,t)=>t.autoBuild?{autoBuild:{...t.autoBuild,recoveryAutoResume:{enabled:e.enabled,maxAttempts:e.maxAttempts,attempts:e.attempt,lastDecision:"evaluate",prdId:e.prdId,setName:e.setName}}}:void 0},"recovery:auto-resume:queued":{scope:"daemon",persist:!0,summary:e=>`Recovery auto-resume queued continue-repair for ${e.prdId} (${e.attempt}/${e.maxAttempts})`,project:(e,t)=>t.autoBuild?{autoBuild:{...t.autoBuild,recoveryAutoResume:{enabled:!0,maxAttempts:e.maxAttempts,attempts:e.attempt,lastDecision:"queued",prdId:e.prdId,setName:e.setName}}}:void 0},"recovery:auto-resume:stopped":{scope:"daemon",persist:!0,summary:e=>`Recovery auto-resume stopped for ${e.prdId}: ${e.reason}`,project:(e,t)=>t.autoBuild?{autoBuild:{...t.autoBuild,recoveryAutoResume:{enabled:e.reason!=="disabled",maxAttempts:e.maxAttempts,attempts:e.attempt,lastDecision:"stopped",prdId:e.prdId,setName:e.setName,stopReason:e.reason,...e.message!==void 0?{message:e.message}:{}}}}:void 0},"recovery:apply:start":{scope:"session",persist:!1},"recovery:apply:complete":{scope:"session",persist:!1,summary:e=>e.noAction?"Recovery verdict is manual \u2014 no changes made":`Recovery applied: ${e.verdict.toUpperCase()}`},"recovery:apply:error":{scope:"session",persist:!1,summary:e=>`Recovery apply failed: ${e.message}`},"daemon:run:upsert":{scope:"daemon",persist:!0,summary:e=>`Run ${e.run.id}: ${e.run.command} \u2192 ${e.run.status}`,project(e,t){let i=t.runs.findIndex(r=>r.id===e.run.id);if(i!==-1){let r=[...t.runs];return r[i]=e.run,{runs:r}}return{runs:[e.run,...t.runs]}}},"daemon:auto-build:paused":{scope:"daemon",persist:!0,summary:e=>`Auto-build paused: ${e.reason}`,project(e,t){if(t.autoBuild&&!(!t.autoBuild.enabled&&t.autoBuild.desired!=="enabled"))return{autoBuild:{...t.autoBuild,enabled:!0,desired:"enabled",mode:"paused",scheduler:{...t.autoBuild.scheduler??{alive:!1},paused:!0}}}}},"daemon:lifecycle:starting":{scope:"daemon",persist:!0,summary:e=>`Daemon starting (pid ${e.pid}, port ${e.port})`},"daemon:lifecycle:ready":{scope:"daemon",persist:!0,summary:e=>`Daemon ready (pid ${e.pid}, port ${e.port})`},"daemon:lifecycle:shutdown:start":{scope:"daemon",persist:!0,summary:e=>`Daemon shutting down (${e.signal}: ${e.reason})`},"daemon:lifecycle:shutdown:complete":{scope:"daemon",persist:!0,summary:"Daemon shutdown complete"},"daemon:heartbeat":{scope:"daemon",persist:!1,project(e,t){let i={at:Date.now(),payload:{uptime:e.uptime,queueDepth:e.queueDepth,runningBuilds:e.runningBuilds,autoBuild:e.autoBuild,subscribers:e.subscribers}};if(t.autoBuild){let r={...t.autoBuild,enabled:e.autoBuild.enabled,...e.autoBuild.desired!==void 0&&{desired:e.autoBuild.desired},...e.autoBuild.mode!==void 0&&{mode:e.autoBuild.mode},...e.autoBuild.lastTransition!==void 0&&{lastTransition:e.autoBuild.lastTransition},...e.autoBuild.reason!==void 0&&{reason:e.autoBuild.reason},...e.autoBuild.recoveryAutoResume!==void 0&&{recoveryAutoResume:e.autoBuild.recoveryAutoResume},...e.autoBuild.scheduler!==void 0&&{scheduler:{...t.autoBuild.scheduler??{},...e.autoBuild.scheduler}}};return{latestHeartbeat:i,autoBuild:r}}return{latestHeartbeat:i}}},"daemon:scheduler:dequeued":{scope:"daemon",persist:!0,summary:e=>`Dequeued PRD ${e.prdId} (queue depth: ${e.queueDepth})`},"daemon:scheduler:capacity-blocked":{scope:"daemon",persist:!0,summary:e=>`Scheduler capacity blocked (${e.runningCount}/${e.limit} running)`},"daemon:scheduler:dependency-blocked":{scope:"daemon",persist:!0,summary:e=>`PRD ${e.prdId} blocked by: ${e.blockedBy.join(", ")}`,project:cU},"daemon:scheduler:paused":{scope:"daemon",persist:!0,summary:()=>"Scheduler paused: new PRD launches suspended"},"daemon:scheduler:resumed":{scope:"daemon",persist:!0,summary:()=>"Scheduler resumed: PRD launch discovery re-triggered"},"daemon:auto-build:enabled":{scope:"daemon",persist:!0,summary:"Auto-build enabled",project(e,t){if(t.autoBuild&&!t.autoBuild.enabled)return{autoBuild:{...t.autoBuild,enabled:!0}}}},"daemon:auto-build:disabled":{scope:"daemon",persist:!0,summary:"Auto-build disabled",project(e,t){if(t.autoBuild&&t.autoBuild.enabled)return{autoBuild:{...t.autoBuild,enabled:!1}}}},"daemon:auto-build:resumed":{scope:"daemon",persist:!0,summary:"Auto-build resumed",project(e,t){if(t.autoBuild&&!t.autoBuild.enabled)return{autoBuild:{...t.autoBuild,enabled:!0}}}},"daemon:auto-build:triggered":{scope:"daemon",persist:!0,summary:e=>`Auto-build triggered: ${e.prdsEnqueued} PRD(s) enqueued`},"daemon:auto-build:transition":{scope:"daemon",persist:!0,summary:e=>`Auto-build ${e.previousMode} \u2192 ${e.nextMode} (${e.desired})${e.reason?`: ${e.reason}`:""}`,project(e,t){if(!t.autoBuild)return;let i=e.desired==="enabled";return{autoBuild:{...t.autoBuild,enabled:i,desired:e.desired,mode:e.nextMode,...e.nextMode==="paused"&&{scheduler:{...t.autoBuild.scheduler??{alive:!1},paused:!0}},lastTransition:{at:e.timestamp,previousMode:e.previousMode,nextMode:e.nextMode,desired:e.desired,reason:e.reason,source:e.source},reason:e.reason}}}},"daemon:recovery:start":{scope:"daemon",persist:!0,summary:"Daemon recovery started"},"daemon:recovery:run-marked-failed":{scope:"daemon",persist:!0,summary:e=>`Run ${e.runId} marked failed: ${e.reason}`},"daemon:recovery:lock-removed":{scope:"daemon",persist:!0,summary:e=>`Stale lock removed: ${e.path} (pid ${e.pid})`},"daemon:recovery:lock-adopted":{scope:"daemon",persist:!0,summary:e=>`Live queue lock adopted: ${e.path} (pid ${e.pid}, PRD ${e.prdId})`},"daemon:recovery:complete":{scope:"daemon",persist:!0,summary:e=>`Daemon recovery complete: ${e.runsFailed} failed, ${e.locksRemoved} lock(s) removed`},"daemon:orphan:reaped":{scope:"daemon",persist:!0,summary:e=>`Orphaned build reaped: ${e.runId} (pid ${e.pid})`},"daemon:failed-enqueue:upsert":{scope:"daemon",persist:!0,summary:e=>`Failed enqueue ${e.failedEnqueue.runId}: ${e.failedEnqueue.failureReason}`,project(e,t){let r=(t.failedEnqueues??[]).filter(o=>o.runId!==e.failedEnqueue.runId);return{failedEnqueues:[e.failedEnqueue,...r].sort((o,s)=>s.failedAt.localeCompare(o.failedAt)||o.runId.localeCompare(s.runId))}}},"daemon:failed-enqueue:resolved":{scope:"daemon",persist:!0,summary:e=>`Failed enqueue ${e.runId} resolved${e.spawnedSessionId?` as ${e.spawnedSessionId}`:""}`,project(e,t){let i=t.failedEnqueues??[],r=i.filter(o=>o.runId!==e.runId);if(r.length!==i.length)return{failedEnqueues:r}}},"daemon:warning":{scope:"daemon",persist:!0,summary:e=>`Daemon warning [${e.source}]: ${e.message}`},"daemon:error":{scope:"daemon",persist:!0,summary:e=>`Daemon error [${e.source}]: ${e.message}`},"queue:start":{scope:"daemon",persist:!0,summary:e=>`PRD queue started: ${e.prdCount} PRD(s) in ${e.dir}`},"queue:prd:start":{scope:"daemon",persist:!0,summary:e=>`Processing PRD: ${e.title} (${e.prdId})`,project(e,t){let i=t.queue.findIndex(o=>o.id===e.prdId);if(i===-1)return;let r=[...t.queue];return r[i]={...r[i],status:"running"},{queue:r}}},"queue:prd:discovered":{scope:"daemon",persist:!0,summary:e=>`Discovered PRD: ${e.title} (${e.prdId})`,project:aU},"queue:prd:dependency-overridden":{scope:"daemon",persist:!0,summary:e=>`PRD ${e.prdId} dependency override: removed ${e.removedDependency}`,project:uU},"queue:prd:removed":{scope:"daemon",persist:!0,summary:e=>`PRD ${e.prdId} removed from queue (was ${e.previousStatus})`,project:(e,t)=>t.queue.some(i=>i.id===e.prdId)?{queue:t.queue.filter(i=>i.id!==e.prdId)}:void 0},"queue:prd:stale":{scope:"daemon",persist:!0,summary:e=>`PRD staleness (${e.prdId}): ${e.verdict} \u2014 ${e.justification}`,project(e,t){if(e.verdict==="proceed")return;let i=t.queue.filter(r=>r.id!==e.prdId);if(i.length!==t.queue.length)return{queue:i}}},"queue:prd:skip":{scope:"daemon",persist:!0,summary:e=>`PRD ${e.prdId} skipped: ${e.reason}`,project(e,t){let i=t.queue.filter(r=>r.id!==e.prdId);if(i.length!==t.queue.length)return{queue:i}}},"queue:prd:dispatch-failed":{scope:"daemon",persist:!0,summary:e=>`PRD ${e.prdId} dispatch failed (${e.stage}): ${e.reason}`,project:dU},"queue:prd:commit-failed":{scope:"daemon",persist:!0,summary:e=>`PRD ${e.prdId} commit failed: ${e.error}`,project(e,t){let i=t.queue.findIndex(o=>o.id===e.prdId);if(i===-1)return;let r=[...t.queue];return r[i]=ep(r[i],"failed"),{queue:r}}},"queue:prd:complete":{scope:"daemon",persist:!0,summary:e=>`PRD ${e.prdId} complete: ${e.status}`,project(e,t){let i=t.queue.findIndex(r=>r.id===e.prdId);if(i!==-1){if(e.status==="failed"){let r=[...t.queue];return r[i]=ep(r[i],"failed"),{queue:r}}return{queue:t.queue.filter(r=>r.id!==e.prdId)}}}},"queue:complete":{scope:"daemon",persist:!0,summary:e=>`Queue complete: ${e.processed} processed, ${e.skipped} skipped`,project(e,t){let i=t.queue.filter(r=>r.status==="failed").map(r=>ep(r,"failed"));if(!(i.length===t.queue.length&&i.every((r,o)=>r===t.queue[o])))return{queue:i}}},"stack:sync:start":{scope:"daemon",persist:!0,summary:e=>e.trigger?`Stack sync started (${e.trigger}, syncId: ${e.syncId})`:`Stack sync started (syncId: ${e.syncId})`},"stack:sync:complete":{scope:"daemon",persist:!0,summary:e=>e.restackCandidates.length>0?`Stack sync complete: ${e.restackCandidates.length} branch(es) restacked`:`Stack sync complete (syncId: ${e.syncId})`},"stack:sync:failed":{scope:"daemon",persist:!0,summary:e=>`Stack sync ${e.outcome}: ${e.reason}`},"stack:sync:deferred":{scope:"daemon",persist:!0,summary:e=>`Stack sync deferred: ${e.reason}`},"stack:sync:skipped":{scope:"daemon",persist:!0,summary:e=>`Stack sync skipped: ${e.reason}`},"base-sync:start":{scope:"session",persist:!1,summary:e=>`Direct PR base sync started: ${e.remote}/${e.baseBranch}`},"base-sync:conflict:attempt":{scope:"session",persist:!1,summary:e=>`Direct PR base sync conflict attempt ${e.attempt}/${e.maxAttempts}`},"base-sync:resolver:start":{scope:"session",persist:!1,summary:e=>`Direct PR base sync resolver started (${e.attempt}/${e.maxAttempts})`},"base-sync:resolver:complete":{scope:"session",persist:!1,summary:e=>`Direct PR base sync resolver ${e.resolved?"completed":"failed"} (${e.attempt}/${e.maxAttempts})`},"base-sync:rebase:continue":{scope:"session",persist:!1,summary:e=>`Direct PR base sync continuing rebase (${e.attempt}/${e.maxAttempts})`},"base-sync:success":{scope:"session",persist:!1,summary:e=>`Direct PR base sync ${e.rebased?"rebased":"already current"}: ${e.remote}/${e.baseBranch}`},"base-sync:budget:exhausted":{scope:"session",persist:!1,summary:e=>`Direct PR base sync exhausted ${e.attempts}/${e.maxAttempts} conflict attempts`}};var aae=Object.keys(gP).filter(e=>{let t=gP[e];return t.scope==="daemon"&&t.persist});import{resolve as SU}from"path";import{isAbsolute as fU,relative as lae,resolve as np,sep as pU,win32 as pae}from"path";import{resolve as SP}from"path";import{homedir as cae}from"os";var dae=".eforge";function lU(){let e=process.env.XDG_CONFIG_HOME||SP(cae(),".config");return SP(e,"eforge")}function tp(e,t){switch(e){case"user":return lU();case"project-team":return t.configDir;case"project-local":return SP(t.cwd,dae)}}import{readdir as pQe}from"fs/promises";import{resolve as fQe,basename as gQe,extname as SQe}from"path";import{access as bQe}from"fs/promises";import{resolve as xQe}from"path";function mae(e,t){return np(e,t??"eforge")}function gU(e,t){if(e.length===0)throw new Error(`${t} must not be empty`);if(e==="."||e==="..")throw new Error(`Unsafe ${t} "${e}": traversal segments are not allowed`);if(e.includes("\0"))throw new Error(`Unsafe ${t}: null bytes are not allowed`);if(e.includes("/")||e.includes("\\"))throw new Error(`Unsafe ${t} "${e}": path separators are not allowed`);if(fU(e)||pae.isAbsolute(e))throw new Error(`Unsafe ${t} "${e}": absolute paths are not allowed`)}function yP(e,t="storage path segments"){if(e.length===0)throw new Error(`${t} require at least one segment`);for(let i of e)gU(i,"storage path segment")}function fae(e){gU(e,"extension name")}function hP(e,t){let i=lae(e,t);if(i===""||i===".."||i.startsWith(".."+pU)||fU(i))throw new Error(`Resolved storage path "${t}" escapes ${e}${pU}`)}function mU(e,t){yP(t);let i=np(e,...t);return hP(e,i),i}function ut(e){let t=np(e.cwd),i=mae(t,e.configDir),r={cwd:t,configDir:i},o=c=>tp(c,r),s=c=>np(o(c),"storage"),a=(c,d=e.extensionName)=>{if(d===void 0)throw new Error("extensionStorageRoot requires an extension name");return fae(d),np(s(c),"extensions",d)};return{cwd:t,configDir:i,scopeRoot:o,storageRoot:s,storagePath(c,d){return mU(s(c),d)},extensionStorageRoot:a,extensionStoragePath(c,d,u){return mU(a(c,u),d)}}}function xr(e){yP(e.segments,"Project-local storage path");let t=SU(e.cwd,".eforge"),i=SU(t,...e.segments);return hP(t,i),i}var Pe={agentCompact:"agent-compact",agentPaginated:"agent-paginated",markdown:"markdown",uiRich:"ui-rich",debugRich:"debug-rich"};var yU=20,IP=100;function oa(e={}){let t=HS(e.maxLimit,IP);return{limit:n.Optional(n.Integer({minimum:1,maximum:t})),offset:n.Optional(n.Integer({minimum:0}))}}function hU(e,t={}){let i=HS(t.maxLimit,IP),r=Math.min(HS(t.defaultLimit,yU),i),o=HS(e.limit,r),s=gae(e.offset,0);return{limit:Math.min(o,i),offset:s}}function sa(e,t,i={}){let{limit:r,offset:o}=hU(t,i);return{items:e.slice(o,o+r),total:e.length,limit:r,offset:o}}function HS(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>0?e:t}function gae(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:t}var Xn=class extends Error{details;constructor(t,i){super(t),this.name="ExtensionActionInputValidationError",this.details=i}},ip=class extends Error{details;constructor(t,i=[{path:"",message:t}]){super(t),this.name="ExtensionActionUserError",this.details=i}};var id=20,RP=240,rp=120,is=4e4,WS=16e3,xP=40,EP=200,XS=5,PP=2e3,kP=40,vP=1e3,_P=10,AP=500,Rae=n.Union([n.Literal("local-focus"),n.Literal("configured-shared"),n.Literal("discovered-conventional")]),xae=n.Union([n.Literal("local-steering"),n.Literal("shared-context")]),bU=n.Object({id:n.String({minLength:1,maxLength:rp}),path:n.String({minLength:1,maxLength:RP}),label:n.Optional(n.String({maxLength:rp})),enabled:n.Optional(n.Boolean())},{additionalProperties:!1}),OP=n.Object({schemaVersion:n.Literal(1),sharedSources:n.Array(bU,{maxItems:id})},{additionalProperties:!1}),bP=n.Object({kind:Rae,role:xae,path:n.String({maxLength:RP}),id:n.Optional(n.String({maxLength:rp})),label:n.Optional(n.String({maxLength:rp})),configured:n.Boolean(),editable:n.Boolean(),exists:n.Boolean(),sha256:n.Optional(n.String({pattern:"^[a-f0-9]{64}$",maxLength:64})),headings:n.Array(n.String({maxLength:EP}),{maxItems:xP}),excerpts:n.Array(n.String({maxLength:PP}),{maxItems:XS}),content:n.Optional(n.String({maxLength:is})),contentTruncated:n.Optional(n.Boolean()),updatedAt:n.Optional(n.String()),maxContentBytes:n.Optional(n.Number()),readError:n.Optional(n.String({maxLength:WS}))},{additionalProperties:!1}),Eae=n.Object({code:n.Union([n.Literal("configured-source-missing"),n.Literal("duplicate-source"),n.Literal("source-read-error"),n.Literal("invalid-config")]),message:n.String({maxLength:vP}),path:n.Optional(n.String({maxLength:RP})),sourceId:n.Optional(n.String({maxLength:rp}))},{additionalProperties:!1}),wP=n.Object({schemaVersion:n.Literal(1),localSteering:bP,sharedContextSources:n.Array(bP,{maxItems:id}),discoveredContextSources:n.Array(bP,{maxItems:1}),assumptions:n.Array(n.String({maxLength:AP}),{maxItems:_P}),conflicts:n.Array(Eae,{maxItems:kP}),truncation:n.Object({sourceExcerpts:n.Number(),sourceContent:n.Number()},{additionalProperties:!1})},{additionalProperties:!1}),RU=n.Object({includeLocalFocusContent:n.Optional(n.Boolean())},{additionalProperties:!1}),xU=n.Object({localFocusContent:n.Optional(n.String({maxLength:is})),expectedLocalFocusSha256:n.Optional(n.String({pattern:"^[a-f0-9]{64}$",maxLength:64})),sharedSources:n.Optional(n.Array(bU,{maxItems:id}))},{additionalProperties:!1,anyOf:[{required:["localFocusContent"]},{required:["sharedSources"]}]}),TP=n.Object({schemaVersion:n.Literal(1),config:OP,context:wP,storagePaths:n.Object({localFocus:n.String(),config:n.String()},{additionalProperties:!1})},{additionalProperties:!1});var EU=n.Union([n.Literal("actionable"),n.Literal("non-actionable")]),PU=n.Union([n.Literal("actionable"),n.Literal("partially-actionable"),n.Literal("non-actionable")]),kU=n.Union([n.Literal("planned-session-plan"),n.Literal("submitted-session-plan"),n.Literal("active-planning-task"),n.Literal("queued-trace"),n.Literal("building-trace"),n.Literal("active-build-session-trace"),n.Literal("open-pr-trace"),n.Literal("queued-build"),n.Literal("running-build"),n.Literal("active-build-session"),n.Literal("open-pr"),n.Literal("merged-result"),n.Literal("shipped-result"),n.Literal("failed-result"),n.Literal("partial-plan"),n.Literal("unresolved-dependency"),n.Literal("explicit-active-status"),n.Literal("explicit-planned-status"),n.Literal("explicit-shipped-status"),n.Literal("explicit-archive-status"),n.Literal("candidate-no-evidence")]),vU=n.Object({kind:n.String(),label:n.Optional(n.String()),id:n.Optional(n.String()),itemIds:n.Array(n.String()),affectedItemIds:n.Optional(n.Array(n.String())),status:n.Optional(n.String()),session:n.Optional(n.String()),taskId:n.Optional(n.String()),prdId:n.Optional(n.String()),runId:n.Optional(n.String()),sessionId:n.Optional(n.String()),buildSessionId:n.Optional(n.String()),featureBranch:n.Optional(n.String()),commitSha:n.Optional(n.String()),prUrl:n.Optional(n.String()),url:n.Optional(n.String()),path:n.Optional(n.String()),timestamp:n.Optional(n.String()),reasonCode:n.Optional(n.String()),missing:n.Optional(n.Boolean()),metadata:n.Optional(n.Unknown())},{additionalProperties:!1}),_U=n.Union([n.Literal("none"),n.Literal("planned"),n.Literal("active"),n.Literal("queue"),n.Literal("queued"),n.Literal("submitted"),n.Literal("build"),n.Literal("pr-open"),n.Literal("merged"),n.Literal("shipped"),n.Literal("failed"),n.Literal("partial")]),CP=n.Object({itemId:n.String(),state:EU,disposition:n.Optional(n.Union([n.Literal("actionable"),n.Literal("suppressed"),n.Literal("de-actioned"),n.Literal("relocated")])),lifecycleState:_U,reasonCode:n.Optional(kU),reasonMessage:n.Optional(n.String()),associatedLinks:n.Array(vU)},{additionalProperties:!1}),QS=n.Object({lane:n.String(),ref:n.Optional(n.String()),itemId:n.String(),actionability:CP},{additionalProperties:!1}),AU=n.Object({ref:n.String(),state:PU,itemIds:n.Array(n.String()),actionableItemIds:n.Array(n.String()),suppressedItemIds:n.Array(n.String()),items:n.Array(CP)},{additionalProperties:!1}),ZS=n.Object({schemaVersion:n.Literal(1),activeWork:n.Array(QS),readyCandidates:n.Array(QS),recommendedNextSequence:n.Array(QS),safeParallelizableGroups:n.Array(AU)},{additionalProperties:!1});var LP=["candidate","planned","active","shipped","stale","superseded"],JS=["inbox","ready","blocked","in-progress","done","archive"],no=["bugfix","feature","refactor","architecture","docs","maintenance","unknown"],io=["quick","focused","deep"],wU=["errand","excursion","expedition"],yZe=n.String({minLength:1,pattern:"^(?!\\.\\.?$)(?!.*[\\\\/\\u0000]).+$"}),Je=n.Union([n.Literal("candidate"),n.Literal("planned"),n.Literal("active"),n.Literal("shipped"),n.Literal("stale"),n.Literal("superseded")]),ro=n.Union([n.Literal("inbox"),n.Literal("ready"),n.Literal("blocked"),n.Literal("in-progress"),n.Literal("done"),n.Literal("archive")]),hZe=n.Object({id:n.String(),status:Je,priority:n.Optional(n.String()),source:n.Optional(n.String()),created:n.Optional(n.String()),updated:n.Optional(n.String()),last_checked:n.Optional(n.String()),stale_after:n.Optional(n.String()),tags:n.Optional(n.Array(n.String())),depends_on:n.Optional(n.Array(n.String())),epic:n.Optional(n.String()),eforge_plan:n.Optional(n.Record(n.String(),n.Unknown()))}),IZe=n.Object({id:n.String(),status:Je,priority:n.Optional(n.String()),source:n.Optional(n.String()),created:n.Optional(n.String()),updated:n.Optional(n.String()),last_checked:n.Optional(n.String()),stale_after:n.Optional(n.String()),tags:n.Optional(n.Array(n.String())),eforge_plan:n.Optional(n.Record(n.String(),n.Unknown()))}),An=n.Recursive(e=>n.Union([n.Null(),n.Boolean(),n.Number(),n.String(),n.Array(e),n.Record(n.String(),e)])),TU=n.Object({},{additionalProperties:An}),CU=n.Object({markdown:n.String()}),qt=n.Union([n.Literal("errand"),n.Literal("excursion"),n.Literal("expedition")]),Zi=n.Object({ref:n.Optional(n.String()),itemId:n.String(),rationale:n.Optional(n.String()),confidence:n.Optional(n.String())},{additionalProperties:!1}),op=qt,LU=n.Object({ref:n.String(),title:n.Optional(n.String()),itemIds:n.Array(n.String(),{minItems:1}),epicIds:n.Optional(n.Array(n.String())),safeToPlanTogether:n.Optional(n.Boolean()),rationale:n.Optional(n.String()),recommendedProfile:n.Optional(op)},{additionalProperties:!1}),sp=n.Object({ref:n.Optional(n.String()),itemIds:n.Array(n.String()),blockedBy:n.Array(n.String()),rationale:n.Optional(n.String())},{additionalProperties:!1}),oo=n.Object({schemaVersion:n.Literal(1),updatedAt:n.Optional(n.String()),activeWork:n.Array(Zi),readyCandidates:n.Array(Zi),recommendedNextSequence:n.Array(Zi),safeParallelizableGroups:n.Array(LU),blockedChains:n.Array(sp),rationaleAndAssumptions:n.Array(n.String())},{additionalProperties:!1}),od=n.Object({recommendedNextItemIds:n.Array(n.String()),safeParallelizableGroups:n.Array(LU),blockedChainCount:n.Number(),rationaleAndAssumptions:n.Array(n.String())},{additionalProperties:!1}),rd=n.Object({eventType:n.Optional(n.String()),itemIds:n.Optional(n.Array(n.String())),correlationKind:n.Optional(n.Union([n.Literal("single"),n.Literal("multi"),n.Literal("bootstrapped")])),timestamp:n.Optional(n.String()),summary:n.Optional(n.String()),code:n.Optional(n.String()),message:n.Optional(n.String()),refs:n.Optional(n.Array(n.String())),sourceFingerprint:n.Optional(n.String()),lastAppliedSourceFingerprint:n.Optional(n.String())},{additionalProperties:!1}),YS=n.Object({schemaVersion:n.Literal(1),lastAppliedAt:n.Optional(n.String()),freshAt:n.Optional(n.String()),staleSince:n.Optional(n.String()),lastRefreshedBy:n.Optional(n.String()),lastAppliedSourceFingerprint:n.Optional(n.String()),sourceFingerprint:n.Optional(n.String()),reasons:n.Optional(n.Array(rd)),staleReasons:n.Optional(n.Array(rd))},{additionalProperties:!1}),aa=n.Object({state:n.Union([n.Literal("missing"),n.Literal("fresh"),n.Literal("stale")]),currentPath:n.String(),statusPath:n.String(),freshAt:n.Optional(n.String()),staleSince:n.Optional(n.String()),lastRefreshedBy:n.Optional(n.String()),sourceFingerprint:n.Optional(n.String()),lastAppliedSourceFingerprint:n.Optional(n.String()),reasons:n.Array(rd),staleReasons:n.Array(rd)},{additionalProperties:!1}),DU=n.Object({}),$U=n.Object({recommendations:n.Union([oo,n.Null()]),recommendationSummary:n.Optional(od),recommendationActionability:n.Optional(ZS),path:n.String(),status:aa,recommendationFreshness:n.Optional(n.Unknown()),activeRefreshTask:n.Optional(yi)},{additionalProperties:!1}),NU=oo,ap=n.Object({recommendations:oo,recommendationSummary:od,path:n.String(),status:aa}),Pae=n.Object({id:n.String(),title:n.String(),status:Je,epic:n.Optional(n.String()),dependsOn:n.Array(n.String())},{additionalProperties:!1}),kae=n.Object({id:n.String(),title:n.String(),status:Je},{additionalProperties:!1}),cp=n.Object({itemIds:n.Optional(n.Array(n.String(),{minItems:1,uniqueItems:!0})),epicId:n.Optional(n.String()),recommendationRef:n.Optional(n.String()),session:n.Optional(n.String()),status:n.Optional(n.Union([n.Literal("active"),n.Literal("planned")])),profile:n.Optional(qt),title:n.Optional(n.String())},{additionalProperties:!1,oneOf:[{required:["itemIds"]},{required:["epicId"]},{required:["recommendationRef"]}]}),ca=n.Object({itemIds:n.Array(n.String()),epicIds:n.Array(n.String()),session:n.String(),sessionPlanPath:n.String(),buildSource:n.String(),status:Je,profile:n.Union([qt,n.Null()]),recommendationRef:n.Optional(n.String()),sources:n.Array(Pae),epics:n.Array(kae)},{additionalProperties:!1}),vae=wP,_ae=n.Object({itemId:n.String(),dependsOn:n.Array(n.String()),internalDependsOn:n.Array(n.String()),externalDependsOn:n.Array(n.String()),blockers:n.Array(n.String()),risks:n.Array(n.String())},{additionalProperties:!1}),Aae=n.Object({kind:n.String(),itemIds:n.Array(n.String()),epicIds:n.Array(n.String()),recommendationRef:n.Optional(n.String()),sourceRecommendationRef:n.Optional(n.String())},{additionalProperties:!1}),Oae=n.Object({id:n.String(),title:n.String(),status:Je,epic:n.Optional(n.String()),tags:n.Array(n.String()),dependencies:n.Array(n.String()),sections:n.Record(n.String(),n.String()),sourceReferences:n.Array(n.String())},{additionalProperties:!1}),wae=n.Object({id:n.String(),title:n.String(),status:Je,tags:n.Array(n.String()),sections:n.Record(n.String(),n.String())},{additionalProperties:!1}),Tae=n.Object({exists:n.Boolean(),model:oo,summary:n.Optional(od)},{additionalProperties:!1}),jU=n.Object({itemIds:n.Optional(n.Array(n.String(),{minItems:1,uniqueItems:!0})),epicId:n.Optional(n.String()),recommendationRef:n.Optional(n.String()),sourceRecommendationRef:n.Optional(n.String()),includeRoadmap:n.Optional(n.Boolean())},{additionalProperties:!1,not:{anyOf:[{required:["itemIds","epicId"]},{required:["itemIds","recommendationRef"]},{required:["epicId","recommendationRef"]}]}}),BU=n.Object({schemaVersion:n.Literal(1),selection:Aae,items:n.Array(Oae),epics:n.Array(wae),recommendations:Tae,recommendationRationale:n.Array(n.String()),dependencies:n.Array(_ae),roadmapContext:vae,traceSummaries:n.Array(n.Unknown())},{additionalProperties:!1}),Cae=n.Object({selection:cp,session:n.Optional(n.String()),title:n.Optional(n.String()),profile:n.Optional(qt)},{additionalProperties:!1}),MU=n.Object({recommendations:n.Optional(oo),handoffDraft:n.Optional(Cae)},{additionalProperties:!1,minProperties:1}),UU=n.Object({schemaVersion:n.Literal(1),recommendations:n.Optional(ap),handoff:n.Optional(ca)},{additionalProperties:!1}),dp=n.Object({epic:n.Optional(n.String()),includeArchive:n.Optional(n.Boolean())}),bZe=n.Object({id:n.String()}),RZe=n.Object({itemId:n.String()}),Lae=n.Object({session:n.String(),path:n.Optional(n.String()),status:n.Optional(n.String()),promotedAt:n.Optional(n.String())}),Dae=n.Object({prdId:n.String(),path:n.Optional(n.String()),status:n.Optional(n.String()),queuedAt:n.Optional(n.String())}),$ae=n.Object({runId:n.String(),sessionId:n.String(),status:n.Optional(n.String()),startedAt:n.Optional(n.String()),completedAt:n.Optional(n.String())}),Nae=n.Object({sessionId:n.String(),runId:n.Optional(n.String()),status:n.Optional(n.String()),startedAt:n.Optional(n.String()),completedAt:n.Optional(n.String())}),jae=n.Union([n.Object({featureBranch:n.String(),commitSha:n.Optional(n.String()),status:n.String(),landedAt:n.Optional(n.String()),prUrl:n.Optional(n.String())}),n.Object({featureBranch:n.Optional(n.String()),commitSha:n.String(),status:n.String(),landedAt:n.Optional(n.String()),prUrl:n.Optional(n.String())})]),FU=n.Object({type:n.Optional(n.String()),timestamp:n.Optional(n.String()),sessionId:n.Optional(n.String()),runId:n.Optional(n.String()),source:n.Optional(n.String()),filePath:n.Optional(n.String()),path:n.Optional(n.String()),id:n.Optional(n.String()),cursor:n.Optional(n.Number())}),xZe=n.Object({schemaVersion:n.Literal(1),itemId:n.String(),epicId:n.Optional(n.String()),promotedSessionPlans:n.Array(Lae),queuePrds:n.Array(Dae),buildRuns:n.Array($ae),buildRunIds:n.Array(n.String()),buildSessions:n.Array(Nae),buildSessionIds:n.Array(n.String()),landingResults:n.Array(jae),lastEvent:n.Optional(FU)}),Er=n.Union([n.Literal("none"),n.Literal("planned"),n.Literal("active"),n.Literal("queue"),n.Literal("build"),n.Literal("pr-open"),n.Literal("merged"),n.Literal("shipped"),n.Literal("failed"),n.Literal("partial")]),_n=n.Object({kind:n.String(),stage:n.String(),status:n.String(),label:n.String(),session:n.Optional(n.String()),prdId:n.Optional(n.String()),runId:n.Optional(n.String()),sessionId:n.Optional(n.String()),buildSessionId:n.Optional(n.String()),featureBranch:n.Optional(n.String()),commitSha:n.Optional(n.String()),prUrl:n.Optional(n.String()),path:n.Optional(n.String()),timestamp:n.Optional(n.String()),completedAt:n.Optional(n.String()),affectedItemIds:n.Array(n.String())},{additionalProperties:!0}),sd=n.Object({sourceItemIds:n.Array(n.String()),sourceEpicIds:n.Array(n.String()),recommendationRef:n.Optional(n.String()),promotedAt:n.Optional(n.String())},{additionalProperties:!1}),ey=n.Object({itemId:n.String(),title:n.String(),status:Je,epic:n.Optional(n.String()),lifecycleState:Er,unresolvedSourceRef:n.Optional(n.Boolean()),missingLifecycleEvidence:n.Optional(n.Boolean()),linkRows:n.Array(_n),failureEvidence:n.Array(_n)},{additionalProperties:!1}),qU=n.Object({sourceRefs:sd,lifecycleState:Er,partialReasons:n.Optional(n.Array(n.Object({code:n.String(),message:n.String()},{additionalProperties:!0}))),itemRows:n.Array(ey),linkRows:n.Array(_n),failureEvidence:n.Array(_n)},{additionalProperties:!0}),Bae=n.Object({epicId:n.String(),title:n.String(),status:Je,lifecycleState:Er,countsByBacklogStatus:n.Record(n.String(),n.Number()),countsByLifecycleState:n.Record(n.String(),n.Number()),itemRows:n.Array(ey)},{additionalProperties:!1}),Mae=n.Object({itemId:n.String(),epicId:n.Optional(n.String()),hasActiveSessionPlan:n.Boolean(),hasActiveQueuePrd:n.Boolean(),hasActiveBuildRun:n.Boolean(),hasActiveBuildSession:n.Boolean(),hasActiveTrace:n.Boolean(),activeReasons:n.Array(n.String()),lastEvent:n.Optional(FU),lifecycleState:Er,linkRows:n.Array(_n),prRefs:n.Array(_n),landingRefs:n.Array(_n),failureEvidence:n.Array(_n)},{additionalProperties:!1}),OU=n.Object({id:n.String(),title:n.String(),status:n.Optional(Je),missing:n.Boolean(),blocking:n.Boolean()}),Uae=n.Object({id:n.String(),title:n.String(),status:n.Optional(Je),missing:n.Boolean()}),Fae=n.Object({claim:n.String(),evidence:n.String(),recheck:n.String(),promotionPaths:n.String()}),zU=n.Object({id:n.String(),title:n.String(),status:Je,priority:n.String(),tags:n.Array(n.String()),lane:ro,reasons:n.Array(n.String()),unresolvedDependsOn:n.Array(n.String()),activeTraceReasons:n.Array(n.String()),blocked:n.Boolean(),ready:n.Boolean(),reviewDue:n.Boolean(),closed:n.Boolean(),epic:n.Optional(n.String()),epicRef:n.Optional(Uae),dependencies:n.Array(OU),dependents:n.Array(OU),notes:Fae,recRank:n.Optional(n.Number()),recLanes:n.Array(n.String()),recUnblock:n.Optional(n.String()),lifecycleState:Er,linkRows:n.Array(_n),failureEvidence:n.Array(_n)}),GU=n.Object({lane:ro,title:n.String(),items:n.Array(zU)}),EZe=n.Object({lanes:n.Array(GU),items:n.Array(zU)}),ty=n.Object({epics:n.Array(n.Unknown()),items:n.Array(n.Unknown()),lanes:n.Array(GU),blockedReasons:n.Array(n.Object({itemId:n.String(),reasons:n.Array(n.String())})),traceSummaries:n.Array(Mae),lifecycleLinks:n.Array(_n),epicProgress:n.Array(Bae),recommendationSummary:n.Optional(od),recommendationStatus:aa});function rs(e){return typeof e=="string"&&LP.includes(e)}function HU(e){if(!rs(e))throw new Error(`Invalid backlog status "${String(e)}"`)}function Ji(e){return e==="shipped"||e==="stale"||e==="superseded"}function hi(e){return!Ji(e)}function DP(e){return e==null?[]:Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):typeof e=="string"&&e.length>0?[e]:[]}function WU(e,t){let i=e.split(/\r?\n/).find(r=>r.startsWith("# "));return i?i.slice(2).trim():t}function zt(e){let t=new Map,i="",r=[];for(let o of e.split(/\r?\n/)){let s=/^(#{2,6})\s+(.+)$/.exec(o);s?(i&&t.set(i,r.join(`
|
|
145
|
+
`).trim()),i=s[2].trim(),r=[]):i&&r.push(o)}return i&&t.set(i,r.join(`
|
|
146
|
+
`).trim()),t}function Pr(e,t){return HU(e.status),{...e,id:ny(e.id,"id"),status:e.status,priority:Qn(e.priority),source:Qn(e.source),created:Qn(e.created),updated:Qn(e.updated),last_checked:Qn(e.last_checked),stale_after:Qn(e.stale_after),tags:DP(e.tags),depends_on:DP(e.depends_on),epic:Qn(e.epic),eforge_plan:tF(e.eforge_plan),title:WU(t,ny(e.id,"id")),body:t}}function os(e,t){return HU(e.status),{...e,id:ny(e.id,"id"),status:e.status,priority:Qn(e.priority),source:Qn(e.source),created:Qn(e.created),updated:Qn(e.updated),last_checked:Qn(e.last_checked),stale_after:Qn(e.stale_after),tags:DP(e.tags),eforge_plan:tF(e.eforge_plan),title:WU(t,ny(e.id,"id")),body:t}}function XU(e,t){let i=new Map(t.map(r=>[r.id,r]));return e.depends_on.filter(r=>{let o=i.get(r);return!o||!Ji(o.status)})}function QU(e){return e?.activeReasons??[]}function ZU(e,t){return e.filter(i=>i.epic===t&&hi(i.status))}function JU(e){return e.map(t=>({id:t.id,title:t.title,status:t.status,...t.epic!==void 0&&{epic:t.epic},dependsOn:t.depends_on}))}function YU(e){return e.map(t=>({id:t.id,title:t.title,status:t.status}))}function ad(e){let t=new Set(e.map(i=>i.id));return e.map(i=>({itemId:i.id,dependsOn:i.depends_on,internalDependsOn:i.depends_on.filter(r=>t.has(r)),externalDependsOn:i.depends_on.filter(r=>!t.has(r))}))}function da(e){return e.map(t=>{let i=zt(t.body);return{itemId:t.id,blockers:VU(KU(i,["Blockers","Blocked By"])),risks:VU(KU(i,["Risks","Risk Notes"]))}})}function iy(e,t){return[...e.map((i,r)=>`${r+1}. backlog item ${i.id}: ${i.title}`),...t.map((i,r)=>`${e.length+r+1}. epic ${i.id}: ${i.title}`)]}function eF(e){let t=new Map(e.map(c=>[c.id,c])),i=[...t.keys()].sort(),r=new Set,o=new Set,s=[],a=c=>{if(o.has(c)||r.has(c))return;r.add(c);let d=t.get(c);for(let u of d?.depends_on??[])t.has(u)&&a(u);r.delete(c),o.add(c),d&&s.push(d)};for(let c of i)a(c);return s}function KU(e,t){for(let i of t){let r=e.get(i);if(r&&r.trim().length>0)return r.trim()}return""}function VU(e){return e.split(/\r?\n/).map(t=>t.replace(/^[-*]\s+/,"").trim()).filter(t=>t.length>0)}function ny(e,t){if(typeof e!="string"||e.length===0)throw new Error(`Backlog frontmatter field "${t}" must be a non-empty string`);return e}function Qn(e){return typeof e=="string"&&e.length>0?e:void 0}function tF(e){if(e&&typeof e=="object"&&!Array.isArray(e))return e}import{readFile as n1,readdir as Gue,writeFile as i1,mkdir as r1,rename as Kue}from"fs/promises";import{resolve as MO,dirname as o1,sep as Fh}from"path";var qh=Po(Zr(),1);var X={};Ht(X,{$brand:()=>NP,$input:()=>i_,$output:()=>n_,NEVER:()=>$P,TimePrecision:()=>a_,ZodAny:()=>QA,ZodArray:()=>eO,ZodBase64:()=>wh,ZodBase64URL:()=>Th,ZodBigInt:()=>Bd,ZodBigIntFormat:()=>Dh,ZodBoolean:()=>jd,ZodCIDRv4:()=>Ah,ZodCIDRv6:()=>Oh,ZodCUID:()=>Rh,ZodCUID2:()=>xh,ZodCatch:()=>xO,ZodCodec:()=>Fp,ZodCustom:()=>qp,ZodCustomStringFormat:()=>$d,ZodDate:()=>Np,ZodDefault:()=>SO,ZodDiscriminatedUnion:()=>nO,ZodE164:()=>Ch,ZodEmail:()=>hh,ZodEmoji:()=>Ih,ZodEnum:()=>Ld,ZodError:()=>hue,ZodExactOptional:()=>mO,ZodFile:()=>lO,ZodFirstPartyTypeKind:()=>$O,ZodFunction:()=>CO,ZodGUID:()=>Tp,ZodIPv4:()=>vh,ZodIPv6:()=>_h,ZodISODate:()=>ph,ZodISODateTime:()=>lh,ZodISODuration:()=>fh,ZodISOTime:()=>mh,ZodIntersection:()=>iO,ZodIssueCode:()=>bue,ZodJWT:()=>Lh,ZodKSUID:()=>kh,ZodLazy:()=>OO,ZodLiteral:()=>uO,ZodMAC:()=>zA,ZodMap:()=>cO,ZodNaN:()=>PO,ZodNanoID:()=>bh,ZodNever:()=>JA,ZodNonOptional:()=>Uh,ZodNull:()=>WA,ZodNullable:()=>gO,ZodNumber:()=>Nd,ZodNumberFormat:()=>ha,ZodObject:()=>Bp,ZodOptional:()=>Mh,ZodPipe:()=>Up,ZodPrefault:()=>hO,ZodPreprocess:()=>kO,ZodPromise:()=>TO,ZodReadonly:()=>vO,ZodRealError:()=>Tn,ZodRecord:()=>Cd,ZodSet:()=>dO,ZodString:()=>Dd,ZodStringFormat:()=>Me,ZodSuccess:()=>RO,ZodSymbol:()=>VA,ZodTemplateLiteral:()=>AO,ZodTransform:()=>pO,ZodTuple:()=>oO,ZodType:()=>te,ZodULID:()=>Eh,ZodURL:()=>$p,ZodUUID:()=>Ar,ZodUndefined:()=>HA,ZodUnion:()=>Mp,ZodUnknown:()=>ZA,ZodVoid:()=>YA,ZodXID:()=>Ph,ZodXor:()=>tO,_ZodString:()=>yh,_default:()=>yO,_function:()=>zz,any:()=>bz,array:()=>jp,base64:()=>iz,base64url:()=>rz,bigint:()=>gz,boolean:()=>KA,catch:()=>EO,check:()=>Gz,cidrv4:()=>tz,cidrv6:()=>nz,clone:()=>un,codec:()=>Mz,coerce:()=>NO,config:()=>mt,core:()=>co,cuid:()=>Hq,cuid2:()=>Wq,custom:()=>Kz,date:()=>xz,decode:()=>NA,decodeAsync:()=>BA,describe:()=>Vz,discriminatedUnion:()=>Az,e164:()=>oz,email:()=>jq,emoji:()=>Kq,encode:()=>$A,encodeAsync:()=>jA,endsWith:()=>xd,enum:()=>jh,exactOptional:()=>fO,file:()=>$z,flattenError:()=>yp,float32:()=>lz,float64:()=>pz,formatError:()=>hp,fromJSONSchema:()=>Yz,function:()=>zz,getErrorMap:()=>xue,globalRegistry:()=>Gt,gt:()=>vr,gte:()=>pn,guid:()=>Bq,hash:()=>uz,hex:()=>dz,hostname:()=>cz,httpUrl:()=>Gq,includes:()=>bd,instanceof:()=>Wz,int:()=>gh,int32:()=>mz,int64:()=>Sz,intersection:()=>rO,invertCodec:()=>Uz,ipv4:()=>Jq,ipv6:()=>ez,iso:()=>Td,json:()=>Qz,jwt:()=>sz,keyof:()=>Ez,ksuid:()=>Zq,lazy:()=>wO,length:()=>Sa,literal:()=>Dz,locales:()=>vp,looseObject:()=>vz,looseRecord:()=>wz,lowercase:()=>hd,lt:()=>kr,lte:()=>Jn,mac:()=>Yq,map:()=>Tz,maxLength:()=>ga,maxSize:()=>ps,meta:()=>Hz,mime:()=>Ed,minLength:()=>ao,minSize:()=>_r,multipleOf:()=>ls,nan:()=>Bz,nanoid:()=>Vq,nativeEnum:()=>Lz,negative:()=>th,never:()=>$h,nonnegative:()=>ih,nonoptional:()=>bO,nonpositive:()=>nh,normalize:()=>Pd,null:()=>XA,nullable:()=>Lp,nullish:()=>Nz,number:()=>GA,object:()=>Pz,optional:()=>Cp,overwrite:()=>er,parse:()=>TA,parseAsync:()=>CA,partialRecord:()=>Oz,pipe:()=>Sh,positive:()=>eh,prefault:()=>IO,preprocess:()=>Zz,prettifyError:()=>XP,promise:()=>qz,property:()=>rh,readonly:()=>_O,record:()=>aO,refine:()=>LO,regex:()=>yd,regexes:()=>Zn,registry:()=>Ly,safeDecode:()=>UA,safeDecodeAsync:()=>qA,safeEncode:()=>MA,safeEncodeAsync:()=>FA,safeParse:()=>LA,safeParseAsync:()=>DA,set:()=>Cz,setErrorMap:()=>Rue,size:()=>fa,slugify:()=>Ad,startsWith:()=>Rd,strictObject:()=>kz,string:()=>wp,stringFormat:()=>az,stringbool:()=>Xz,success:()=>jz,superRefine:()=>DO,symbol:()=>hz,templateLiteral:()=>Fz,toJSONSchema:()=>ch,toLowerCase:()=>vd,toUpperCase:()=>_d,transform:()=>Bh,treeifyError:()=>WP,trim:()=>kd,tuple:()=>sO,uint32:()=>fz,uint64:()=>yz,ulid:()=>Xq,undefined:()=>Iz,union:()=>Nh,unknown:()=>ya,uppercase:()=>Id,url:()=>zq,util:()=>T,uuid:()=>Mq,uuidv4:()=>Uq,uuidv6:()=>Fq,uuidv7:()=>qq,void:()=>Rz,xid:()=>Qq,xor:()=>_z});var co={};Ht(co,{$ZodAny:()=>Pv,$ZodArray:()=>Ov,$ZodAsyncError:()=>Yi,$ZodBase64:()=>fv,$ZodBase64URL:()=>gv,$ZodBigInt:()=>ky,$ZodBigIntFormat:()=>bv,$ZodBoolean:()=>xp,$ZodCIDRv4:()=>lv,$ZodCIDRv6:()=>pv,$ZodCUID:()=>Yk,$ZodCUID2:()=>ev,$ZodCatch:()=>Hv,$ZodCheck:()=>Ge,$ZodCheckBigIntFormat:()=>Ok,$ZodCheckEndsWith:()=>Fk,$ZodCheckGreaterThan:()=>Iy,$ZodCheckIncludes:()=>Mk,$ZodCheckLengthEquals:()=>$k,$ZodCheckLessThan:()=>hy,$ZodCheckLowerCase:()=>jk,$ZodCheckMaxLength:()=>Lk,$ZodCheckMaxSize:()=>wk,$ZodCheckMimeType:()=>zk,$ZodCheckMinLength:()=>Dk,$ZodCheckMinSize:()=>Tk,$ZodCheckMultipleOf:()=>_k,$ZodCheckNumberFormat:()=>Ak,$ZodCheckOverwrite:()=>Gk,$ZodCheckProperty:()=>qk,$ZodCheckRegex:()=>Nk,$ZodCheckSizeEquals:()=>Ck,$ZodCheckStartsWith:()=>Uk,$ZodCheckStringFormat:()=>gd,$ZodCheckUpperCase:()=>Bk,$ZodCodec:()=>Pp,$ZodCustom:()=>t_,$ZodCustomStringFormat:()=>hv,$ZodDate:()=>Av,$ZodDefault:()=>zv,$ZodDiscriminatedUnion:()=>Cv,$ZodE164:()=>Sv,$ZodEmail:()=>Xk,$ZodEmoji:()=>Zk,$ZodEncodeError:()=>ss,$ZodEnum:()=>jv,$ZodError:()=>Sp,$ZodExactOptional:()=>Fv,$ZodFile:()=>Mv,$ZodFunction:()=>Jv,$ZodGUID:()=>Hk,$ZodIPv4:()=>cv,$ZodIPv6:()=>dv,$ZodISODate:()=>ov,$ZodISODateTime:()=>rv,$ZodISODuration:()=>av,$ZodISOTime:()=>sv,$ZodIntersection:()=>Lv,$ZodJWT:()=>yv,$ZodKSUID:()=>iv,$ZodLazy:()=>e_,$ZodLiteral:()=>Bv,$ZodMAC:()=>uv,$ZodMap:()=>$v,$ZodNaN:()=>Wv,$ZodNanoID:()=>Jk,$ZodNever:()=>vv,$ZodNonOptional:()=>Kv,$ZodNull:()=>Ev,$ZodNullable:()=>qv,$ZodNumber:()=>Py,$ZodNumberFormat:()=>Iv,$ZodObject:()=>CF,$ZodObjectJIT:()=>wv,$ZodOptional:()=>_y,$ZodPipe:()=>Ay,$ZodPrefault:()=>Gv,$ZodPreprocess:()=>Xv,$ZodPromise:()=>Yv,$ZodReadonly:()=>Qv,$ZodRealError:()=>wn,$ZodRecord:()=>Dv,$ZodRegistry:()=>Cy,$ZodSet:()=>Nv,$ZodString:()=>ma,$ZodStringFormat:()=>Be,$ZodSuccess:()=>Vv,$ZodSymbol:()=>Rv,$ZodTemplateLiteral:()=>Zv,$ZodTransform:()=>Uv,$ZodTuple:()=>vy,$ZodType:()=>Z,$ZodULID:()=>tv,$ZodURL:()=>Qk,$ZodUUID:()=>Wk,$ZodUndefined:()=>xv,$ZodUnion:()=>Ep,$ZodUnknown:()=>kv,$ZodVoid:()=>_v,$ZodXID:()=>nv,$ZodXor:()=>Tv,$brand:()=>NP,$constructor:()=>I,$input:()=>i_,$output:()=>n_,Doc:()=>Rp,JSONSchema:()=>Dq,JSONSchemaGenerator:()=>dh,NEVER:()=>$P,TimePrecision:()=>a_,_any:()=>A_,_array:()=>$_,_base64:()=>Qy,_base64url:()=>Zy,_bigint:()=>R_,_boolean:()=>I_,_catch:()=>uue,_check:()=>Lq,_cidrv4:()=>Wy,_cidrv6:()=>Xy,_coercedBigint:()=>x_,_coercedBoolean:()=>b_,_coercedDate:()=>L_,_coercedNumber:()=>m_,_coercedString:()=>o_,_cuid:()=>Fy,_cuid2:()=>qy,_custom:()=>j_,_date:()=>C_,_decode:()=>dy,_decodeAsync:()=>ly,_default:()=>aue,_discriminatedUnion:()=>Xde,_e164:()=>Jy,_email:()=>Dy,_emoji:()=>My,_encode:()=>cy,_encodeAsync:()=>uy,_endsWith:()=>xd,_enum:()=>tue,_file:()=>N_,_float32:()=>g_,_float64:()=>S_,_gt:()=>vr,_gte:()=>pn,_guid:()=>_p,_includes:()=>bd,_int:()=>f_,_int32:()=>y_,_int64:()=>E_,_intersection:()=>Qde,_ipv4:()=>Vy,_ipv6:()=>Hy,_isoDate:()=>d_,_isoDateTime:()=>c_,_isoDuration:()=>l_,_isoTime:()=>u_,_jwt:()=>Yy,_ksuid:()=>Ky,_lazy:()=>fue,_length:()=>Sa,_literal:()=>iue,_lowercase:()=>hd,_lt:()=>kr,_lte:()=>Jn,_mac:()=>s_,_map:()=>Yde,_max:()=>Jn,_maxLength:()=>ga,_maxSize:()=>ps,_mime:()=>Ed,_min:()=>pn,_minLength:()=>ao,_minSize:()=>_r,_multipleOf:()=>ls,_nan:()=>D_,_nanoid:()=>Uy,_nativeEnum:()=>nue,_negative:()=>th,_never:()=>w_,_nonnegative:()=>ih,_nonoptional:()=>cue,_nonpositive:()=>nh,_normalize:()=>Pd,_null:()=>__,_nullable:()=>sue,_number:()=>p_,_optional:()=>oue,_overwrite:()=>er,_parse:()=>ld,_parseAsync:()=>pd,_pipe:()=>lue,_positive:()=>eh,_promise:()=>gue,_property:()=>rh,_readonly:()=>pue,_record:()=>Jde,_refine:()=>B_,_regex:()=>yd,_safeDecode:()=>my,_safeDecodeAsync:()=>gy,_safeEncode:()=>py,_safeEncodeAsync:()=>fy,_safeParse:()=>md,_safeParseAsync:()=>fd,_set:()=>eue,_size:()=>fa,_slugify:()=>Ad,_startsWith:()=>Rd,_string:()=>r_,_stringFormat:()=>Od,_stringbool:()=>q_,_success:()=>due,_superRefine:()=>M_,_symbol:()=>k_,_templateLiteral:()=>mue,_toLowerCase:()=>vd,_toUpperCase:()=>_d,_transform:()=>rue,_trim:()=>kd,_tuple:()=>Zde,_uint32:()=>h_,_uint64:()=>P_,_ulid:()=>zy,_undefined:()=>v_,_union:()=>Hde,_unknown:()=>O_,_uppercase:()=>Id,_url:()=>Ap,_uuid:()=>$y,_uuidv4:()=>Ny,_uuidv6:()=>jy,_uuidv7:()=>By,_void:()=>T_,_xid:()=>Gy,_xor:()=>Wde,clone:()=>un,config:()=>mt,createStandardJSONSchemaMethod:()=>wd,createToJSONSchemaMethod:()=>z_,decode:()=>gce,decodeAsync:()=>yce,describe:()=>U_,encode:()=>fce,encodeAsync:()=>Sce,extractDefs:()=>fs,finalize:()=>gs,flattenError:()=>yp,formatError:()=>hp,globalConfig:()=>ua,globalRegistry:()=>Gt,initializeContext:()=>ms,isValidBase64:()=>mv,isValidBase64URL:()=>AF,isValidJWT:()=>OF,locales:()=>vp,meta:()=>F_,parse:()=>sy,parseAsync:()=>ay,prettifyError:()=>XP,process:()=>we,regexes:()=>Zn,registry:()=>Ly,safeDecode:()=>Ice,safeDecodeAsync:()=>Rce,safeEncode:()=>hce,safeEncodeAsync:()=>bce,safeParse:()=>QP,safeParseAsync:()=>ZP,toDotPath:()=>aF,toJSONSchema:()=>ch,treeifyError:()=>WP,util:()=>T,version:()=>Kk});var nF,$P=Object.freeze({status:"aborted"});function I(e,t,i){function r(c,d){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,d);let u=a.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let m=l[p];m in c||(c[m]=u[m].bind(c))}}let o=i?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(c){var d;let u=i?.Parent?new s:this;r(u,c),(d=u._zod).deferred??(d.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>i?.Parent&&c instanceof i.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var NP=Symbol("zod_brand"),Yi=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ss=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(nF=globalThis).__zod_globalConfig??(nF.__zod_globalConfig={});var ua=globalThis.__zod_globalConfig;function mt(e){return e&&Object.assign(ua,e),ua}var T={};Ht(T,{BIGINT_FORMAT_RANGES:()=>VP,Class:()=>BP,NUMBER_FORMAT_RANGES:()=>KP,aborted:()=>us,allowsEval:()=>FP,assert:()=>Vae,assertEqual:()=>qae,assertIs:()=>Gae,assertNever:()=>Kae,assertNotEqual:()=>zae,assignProp:()=>cs,base64ToUint8Array:()=>rF,base64urlToUint8Array:()=>dce,cached:()=>dd,captureStackTrace:()=>oy,cleanEnum:()=>cce,cleanRegex:()=>pp,clone:()=>un,cloneDef:()=>Wae,createTransparentProxy:()=>ece,defineLazy:()=>se,esc:()=>ry,escapeRegex:()=>Ii,explicitlyAborted:()=>HP,extend:()=>ice,finalizeIssue:()=>ln,floatSafeRemainder:()=>MP,getElementAtPath:()=>Xae,getEnumValues:()=>lp,getLengthableOrigin:()=>gp,getParsedType:()=>Yae,getSizableOrigin:()=>fp,hexToUint8Array:()=>lce,isObject:()=>la,isPlainObject:()=>ds,issue:()=>ud,joinValues:()=>b,jsonStringifyReplacer:()=>cd,merge:()=>oce,mergeDefs:()=>so,normalizeParams:()=>L,nullish:()=>as,numKeys:()=>Jae,objectClone:()=>Hae,omit:()=>nce,optionalKeys:()=>GP,parsedType:()=>w,partial:()=>sce,pick:()=>tce,prefixIssues:()=>On,primitiveTypes:()=>zP,promiseAllObject:()=>Qae,propertyKeyTypes:()=>mp,randomString:()=>Zae,required:()=>ace,safeExtend:()=>rce,shallowClone:()=>qP,slugify:()=>UP,stringifyPrimitive:()=>O,uint8ArrayToBase64:()=>oF,uint8ArrayToBase64url:()=>uce,uint8ArrayToHex:()=>pce,unwrapMessage:()=>up});function qae(e){return e}function zae(e){return e}function Gae(e){}function Kae(e){throw new Error("Unexpected value in exhaustive check")}function Vae(e){}function lp(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function b(e,t="|"){return e.map(i=>O(i)).join(t)}function cd(e,t){return typeof t=="bigint"?t.toString():t}function dd(e){return{get value(){{let i=e();return Object.defineProperty(this,"value",{value:i}),i}throw new Error("cached value already set")}}}function as(e){return e==null}function pp(e){let t=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(t,i)}function MP(e,t){let i=e/t,r=Math.round(i),o=Number.EPSILON*Math.max(Math.abs(i),1);return Math.abs(i-r)<o?0:i-r}var iF=Symbol("evaluating");function se(e,t,i){let r;Object.defineProperty(e,t,{get(){if(r!==iF)return r===void 0&&(r=iF,r=i()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Hae(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function cs(e,t,i){Object.defineProperty(e,t,{value:i,writable:!0,enumerable:!0,configurable:!0})}function so(...e){let t={};for(let i of e){let r=Object.getOwnPropertyDescriptors(i);Object.assign(t,r)}return Object.defineProperties({},t)}function Wae(e){return so(e._zod.def)}function Xae(e,t){return t?t.reduce((i,r)=>i?.[r],e):e}function Qae(e){let t=Object.keys(e),i=t.map(r=>e[r]);return Promise.all(i).then(r=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=r[s];return o})}function Zae(e=10){let t="abcdefghijklmnopqrstuvwxyz",i="";for(let r=0;r<e;r++)i+=t[Math.floor(Math.random()*t.length)];return i}function ry(e){return JSON.stringify(e)}function UP(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var oy="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function la(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var FP=dd(()=>{if(ua.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ds(e){if(la(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let i=t.prototype;return!(la(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function qP(e){return ds(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Jae(e){let t=0;for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&t++;return t}var Yae=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}`)}},mp=new Set(["string","number","symbol"]),zP=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ii(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function un(e,t,i){let r=new e._zod.constr(t??e._zod.def);return(!t||i?.parent)&&(r._zod.parent=e),r}function L(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 ece(e){let t;return new Proxy({},{get(i,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(i,r,o,s){return t??(t=e()),Reflect.set(t,r,o,s)},has(i,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(i,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(i){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(i,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(i,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function O(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function GP(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var KP={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]},VP={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function tce(e,t){let i=e._zod.def,r=i.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=so(e._zod.def,{get shape(){let a={};for(let c in t){if(!(c in i.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(a[c]=i.shape[c])}return cs(this,"shape",a),a},checks:[]});return un(e,s)}function nce(e,t){let i=e._zod.def,r=i.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=so(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let c in t){if(!(c in i.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete a[c]}return cs(this,"shape",a),a},checks:[]});return un(e,s)}function ice(e,t){if(!ds(t))throw new Error("Invalid input to extend: expected a plain object");let i=e._zod.def.checks;if(i&&i.length>0){let s=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=so(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return cs(this,"shape",s),s}});return un(e,o)}function rce(e,t){if(!ds(t))throw new Error("Invalid input to safeExtend: expected a plain object");let i=so(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return cs(this,"shape",r),r}});return un(e,i)}function oce(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let i=so(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return cs(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return un(e,i)}function sce(e,t,i){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=so(t._zod.def,{get shape(){let c=t._zod.def.shape,d={...c};if(i)for(let u in i){if(!(u in c))throw new Error(`Unrecognized key: "${u}"`);i[u]&&(d[u]=e?new e({type:"optional",innerType:c[u]}):c[u])}else for(let u in c)d[u]=e?new e({type:"optional",innerType:c[u]}):c[u];return cs(this,"shape",d),d},checks:[]});return un(t,a)}function ace(e,t,i){let r=so(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(i)for(let a in i){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);i[a]&&(s[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)s[a]=new e({type:"nonoptional",innerType:o[a]});return cs(this,"shape",s),s}});return un(t,r)}function us(e,t=0){if(e.aborted===!0)return!0;for(let i=t;i<e.issues.length;i++)if(e.issues[i]?.continue!==!0)return!0;return!1}function HP(e,t=0){if(e.aborted===!0)return!0;for(let i=t;i<e.issues.length;i++)if(e.issues[i]?.continue===!1)return!0;return!1}function On(e,t){return t.map(i=>{var r;return(r=i).path??(r.path=[]),i.path.unshift(e),i})}function up(e){return typeof e=="string"?e:e?.message}function ln(e,t,i){let r=e.message?e.message:up(e.inst?._zod.def?.error?.(e))??up(t?.error?.(e))??up(i.customError?.(e))??up(i.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:a,...c}=e;return c.path??(c.path=[]),c.message=r,t?.reportInput&&(c.input=a),c}function fp(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function gp(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function w(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 i=e;if(i&&Object.getPrototypeOf(i)!==Object.prototype&&"constructor"in i&&i.constructor)return i.constructor.name}}return t}function ud(...e){let[t,i,r]=e;return typeof t=="string"?{message:t,code:"custom",input:i,inst:r}:{...t}}function cce(e){return Object.entries(e).filter(([t,i])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function rF(e){let t=atob(e),i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return i}function oF(e){let t="";for(let i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return btoa(t)}function dce(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),i="=".repeat((4-t.length%4)%4);return rF(t+i)}function uce(e){return oF(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function lce(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let i=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)i[r/2]=Number.parseInt(t.slice(r,r+2),16);return i}function pce(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var BP=class{constructor(...t){}};var sF=(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,cd,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Sp=I("$ZodError",sF),wn=I("$ZodError",sF,{Parent:Error});function yp(e,t=i=>i.message){let i={},r=[];for(let o of e.issues)o.path.length>0?(i[o.path[0]]=i[o.path[0]]||[],i[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:i}}function hp(e,t=i=>i.message){let i={_errors:[]},r=(o,s=[])=>{for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...s,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...s,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...s,...a.path]);else{let c=[...s,...a.path];if(c.length===0)i._errors.push(t(a));else{let d=i,u=0;for(;u<c.length;){let l=c[u];u===c.length-1?(d[l]=d[l]||{_errors:[]},d[l]._errors.push(t(a))):d[l]=d[l]||{_errors:[]},d=d[l],u++}}}};return r(e),i}function WP(e,t=i=>i.message){let i={errors:[]},r=(o,s=[])=>{var a,c;for(let d of o.issues)if(d.code==="invalid_union"&&d.errors.length)d.errors.map(u=>r({issues:u},[...s,...d.path]));else if(d.code==="invalid_key")r({issues:d.issues},[...s,...d.path]);else if(d.code==="invalid_element")r({issues:d.issues},[...s,...d.path]);else{let u=[...s,...d.path];if(u.length===0){i.errors.push(t(d));continue}let l=i,p=0;for(;p<u.length;){let m=u[p],f=p===u.length-1;typeof m=="string"?(l.properties??(l.properties={}),(a=l.properties)[m]??(a[m]={errors:[]}),l=l.properties[m]):(l.items??(l.items=[]),(c=l.items)[m]??(c[m]={errors:[]}),l=l.items[m]),f&&l.errors.push(t(d)),p++}}};return r(e),i}function aF(e){let t=[],i=e.map(r=>typeof r=="object"?r.key:r);for(let r of i)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function XP(e){let t=[],i=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of i)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${aF(r.path)}`);return t.join(`
|
|
147
|
+
`)}var ld=e=>(t,i,r,o)=>{let s=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:i,issues:[]},s);if(a instanceof Promise)throw new Yi;if(a.issues.length){let c=new(o?.Err??e)(a.issues.map(d=>ln(d,s,mt())));throw oy(c,o?.callee),c}return a.value},sy=ld(wn),pd=e=>async(t,i,r,o)=>{let s=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:i,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(o?.Err??e)(a.issues.map(d=>ln(d,s,mt())));throw oy(c,o?.callee),c}return a.value},ay=pd(wn),md=e=>(t,i,r)=>{let o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:i,issues:[]},o);if(s instanceof Promise)throw new Yi;return s.issues.length?{success:!1,error:new(e??Sp)(s.issues.map(a=>ln(a,o,mt())))}:{success:!0,data:s.value}},QP=md(wn),fd=e=>async(t,i,r)=>{let o=r?{...r,async:!0}:{async:!0},s=t._zod.run({value:i,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(a=>ln(a,o,mt())))}:{success:!0,data:s.value}},ZP=fd(wn),cy=e=>(t,i,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return ld(e)(t,i,o)},fce=cy(wn),dy=e=>(t,i,r)=>ld(e)(t,i,r),gce=dy(wn),uy=e=>async(t,i,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return pd(e)(t,i,o)},Sce=uy(wn),ly=e=>async(t,i,r)=>pd(e)(t,i,r),yce=ly(wn),py=e=>(t,i,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return md(e)(t,i,o)},hce=py(wn),my=e=>(t,i,r)=>md(e)(t,i,r),Ice=my(wn),fy=e=>async(t,i,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return fd(e)(t,i,o)},bce=fy(wn),gy=e=>async(t,i,r)=>fd(e)(t,i,r),Rce=gy(wn);var Zn={};Ht(Zn,{base64:()=>mk,base64url:()=>Sy,bigint:()=>bk,boolean:()=>xk,browserEmail:()=>Oce,cidrv4:()=>lk,cidrv6:()=>pk,cuid:()=>JP,cuid2:()=>YP,date:()=>Sk,datetime:()=>hk,domain:()=>Cce,duration:()=>rk,e164:()=>gk,email:()=>sk,emoji:()=>ak,extendedDuration:()=>xce,guid:()=>ok,hex:()=>Lce,hostname:()=>Tce,html5Email:()=>vce,httpProtocol:()=>fk,idnEmail:()=>Ace,integer:()=>Rk,ipv4:()=>ck,ipv6:()=>dk,ksuid:()=>nk,lowercase:()=>kk,mac:()=>uk,md5_base64:()=>$ce,md5_base64url:()=>Nce,md5_hex:()=>Dce,nanoid:()=>ik,null:()=>Ek,number:()=>yy,rfc5322Email:()=>_ce,sha1_base64:()=>Bce,sha1_base64url:()=>Mce,sha1_hex:()=>jce,sha256_base64:()=>Fce,sha256_base64url:()=>qce,sha256_hex:()=>Uce,sha384_base64:()=>Gce,sha384_base64url:()=>Kce,sha384_hex:()=>zce,sha512_base64:()=>Hce,sha512_base64url:()=>Wce,sha512_hex:()=>Vce,string:()=>Ik,time:()=>yk,ulid:()=>ek,undefined:()=>Pk,unicodeEmail:()=>cF,uppercase:()=>vk,uuid:()=>pa,uuid4:()=>Ece,uuid6:()=>Pce,uuid7:()=>kce,xid:()=>tk});var JP=/^[cC][0-9a-z]{6,}$/,YP=/^[0-9a-z]+$/,ek=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tk=/^[0-9a-vA-V]{20}$/,nk=/^[A-Za-z0-9]{27}$/,ik=/^[a-zA-Z0-9_-]{21}$/,rk=/^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)?)??$/,ok=/^([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})$/,pa=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)$/,Ece=pa(4),Pce=pa(6),kce=pa(7),sk=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vce=/^[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])?)*$/,_ce=/^(([^<>()\[\]\\.,;:\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,}))$/,cF=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Ace=cF,Oce=/^[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])?)*$/,wce="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ak(){return new RegExp(wce,"u")}var ck=/^(?:(?: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])$/,dk=/^(([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}|:))$/,uk=e=>{let t=Ii(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},lk=/^((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])$/,pk=/^(([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])$/,mk=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Sy=/^[A-Za-z0-9_-]*$/,Tce=/^(?=.{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])?)*\.?$/,Cce=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,fk=/^https?$/,gk=/^\+[1-9]\d{6,14}$/,dF="(?:(?:\\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])))",Sk=new RegExp(`^${dF}$`);function uF(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 yk(e){return new RegExp(`^${uF(e)}$`)}function hk(e){let t=uF({precision:e.precision}),i=["Z"];e.local&&i.push(""),e.offset&&i.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${t}(?:${i.join("|")})`;return new RegExp(`^${dF}T(?:${r})$`)}var Ik=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},bk=/^-?\d+n?$/,Rk=/^-?\d+$/,yy=/^-?\d+(?:\.\d+)?$/,xk=/^(?:true|false)$/i,Ek=/^null$/i;var Pk=/^undefined$/i;var kk=/^[^A-Z]*$/,vk=/^[^a-z]*$/,Lce=/^[0-9a-fA-F]*$/;function Ip(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function bp(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Dce=/^[0-9a-fA-F]{32}$/,$ce=Ip(22,"=="),Nce=bp(22),jce=/^[0-9a-fA-F]{40}$/,Bce=Ip(27,"="),Mce=bp(27),Uce=/^[0-9a-fA-F]{64}$/,Fce=Ip(43,"="),qce=bp(43),zce=/^[0-9a-fA-F]{96}$/,Gce=Ip(64,""),Kce=bp(64),Vce=/^[0-9a-fA-F]{128}$/,Hce=Ip(86,"=="),Wce=bp(86);var Ge=I("$ZodCheck",(e,t)=>{var i;e._zod??(e._zod={}),e._zod.def=t,(i=e._zod).onattach??(i.onattach=[])}),pF={number:"number",bigint:"bigint",object:"date"},hy=I("$ZodCheckLessThan",(e,t)=>{Ge.init(e,t);let i=pF[typeof t.value];e._zod.onattach.push(r=>{let o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:i,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Iy=I("$ZodCheckGreaterThan",(e,t)=>{Ge.init(e,t);let i=pF[typeof t.value];e._zod.onattach.push(r=>{let o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:i,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_k=I("$ZodCheckMultipleOf",(e,t)=>{Ge.init(e,t),e._zod.onattach.push(i=>{var r;(r=i._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=i=>{if(typeof i.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?i.value%t.value===BigInt(0):MP(i.value,t.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:t.value,input:i.value,inst:e,continue:!t.abort})}}),Ak=I("$ZodCheckNumberFormat",(e,t)=>{Ge.init(e,t),t.format=t.format||"float64";let i=t.format?.includes("int"),r=i?"int":"number",[o,s]=KP[t.format];e._zod.onattach.push(a=>{let c=a._zod.bag;c.format=t.format,c.minimum=o,c.maximum=s,i&&(c.pattern=Rk)}),e._zod.check=a=>{let c=a.value;if(i){if(!Number.isInteger(c)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}c<o&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Ok=I("$ZodCheckBigIntFormat",(e,t)=>{Ge.init(e,t);let[i,r]=VP[t.format];e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,s.minimum=i,s.maximum=r}),e._zod.check=o=>{let s=o.value;s<i&&o.issues.push({origin:"bigint",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>r&&o.issues.push({origin:"bigint",input:s,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),wk=I("$ZodCheckMaxSize",(e,t)=>{var i;Ge.init(e,t),(i=e._zod.def).when??(i.when=r=>{let o=r.value;return!as(o)&&o.size!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let o=r.value;o.size<=t.maximum||r.issues.push({origin:fp(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Tk=I("$ZodCheckMinSize",(e,t)=>{var i;Ge.init(e,t),(i=e._zod.def).when??(i.when=r=>{let o=r.value;return!as(o)&&o.size!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let o=r.value;o.size>=t.minimum||r.issues.push({origin:fp(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ck=I("$ZodCheckSizeEquals",(e,t)=>{var i;Ge.init(e,t),(i=e._zod.def).when??(i.when=r=>{let o=r.value;return!as(o)&&o.size!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=r=>{let o=r.value,s=o.size;if(s===t.size)return;let a=s>t.size;r.issues.push({origin:fp(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Lk=I("$ZodCheckMaxLength",(e,t)=>{var i;Ge.init(e,t),(i=e._zod.def).when??(i.when=r=>{let o=r.value;return!as(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let o=r.value;if(o.length<=t.maximum)return;let a=gp(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Dk=I("$ZodCheckMinLength",(e,t)=>{var i;Ge.init(e,t),(i=e._zod.def).when??(i.when=r=>{let o=r.value;return!as(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let o=r.value;if(o.length>=t.minimum)return;let a=gp(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$k=I("$ZodCheckLengthEquals",(e,t)=>{var i;Ge.init(e,t),(i=e._zod.def).when??(i.when=r=>{let o=r.value;return!as(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{let o=r.value,s=o.length;if(s===t.length)return;let a=gp(o),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),gd=I("$ZodCheckStringFormat",(e,t)=>{var i,r;Ge.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(i=e._zod).check??(i.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Nk=I("$ZodCheckRegex",(e,t)=>{gd.init(e,t),e._zod.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),jk=I("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=kk),gd.init(e,t)}),Bk=I("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=vk),gd.init(e,t)}),Mk=I("$ZodCheckIncludes",(e,t)=>{Ge.init(e,t);let i=Ii(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${i}`:i);t.pattern=r,e._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Uk=I("$ZodCheckStartsWith",(e,t)=>{Ge.init(e,t);let i=new RegExp(`^${Ii(t.prefix)}.*`);t.pattern??(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.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Fk=I("$ZodCheckEndsWith",(e,t)=>{Ge.init(e,t);let i=new RegExp(`.*${Ii(t.suffix)}$`);t.pattern??(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.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function lF(e,t,i){e.issues.length&&t.issues.push(...On(i,e.issues))}var qk=I("$ZodCheckProperty",(e,t)=>{Ge.init(e,t),e._zod.check=i=>{let r=t.schema._zod.run({value:i.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>lF(o,i,t.property));lF(r,i,t.property)}}),zk=I("$ZodCheckMimeType",(e,t)=>{Ge.init(e,t);let i=new Set(t.mime);e._zod.onattach.push(r=>{r._zod.bag.mime=t.mime}),e._zod.check=r=>{i.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),Gk=I("$ZodCheckOverwrite",(e,t)=>{Ge.init(e,t),e._zod.check=i=>{i.value=t.tx(i.value)}});var Rp=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split(`
|
|
148
|
+
`).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),s=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of s)this.content.push(a)}compile(){let t=Function,i=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...i,o.join(`
|
|
149
|
+
`))}};var Kk={major:4,minor:4,patch:3};var Z=I("$ZodType",(e,t)=>{var i;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Kk;let r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(let o of r)for(let s of o._zod.onattach)s(e);if(r.length===0)(i=e._zod).deferred??(i.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,c,d)=>{let u=us(a),l;for(let p of c){if(p._zod.def.when){if(HP(a)||!p._zod.def.when(a))continue}else if(u)continue;let m=a.issues.length,f=p._zod.check(a);if(f instanceof Promise&&d?.async===!1)throw new Yi;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==m&&(u||(u=us(a,m)))});else{if(a.issues.length===m)continue;u||(u=us(a,m))}}return l?l.then(()=>a):a},s=(a,c,d)=>{if(us(a))return a.aborted=!0,a;let u=o(c,r,d);if(u instanceof Promise){if(d.async===!1)throw new Yi;return u.then(l=>e._zod.parse(l,d))}return e._zod.parse(u,d)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,a,c)):s(u,a,c)}let d=e._zod.parse(a,c);if(d instanceof Promise){if(c.async===!1)throw new Yi;return d.then(u=>o(u,r,c))}return o(d,r,c)}}se(e,"~standard",()=>({validate:o=>{try{let s=QP(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return ZP(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),ma=I("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ik(e._zod.bag),e._zod.parse=(i,r)=>{if(t.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),Be=I("$ZodStringFormat",(e,t)=>{gd.init(e,t),ma.init(e,t)}),Hk=I("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ok),Be.init(e,t)}),Wk=I("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=pa(r))}else t.pattern??(t.pattern=pa());Be.init(e,t)}),Xk=I("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=sk),Be.init(e,t)}),Qk=I("$ZodURL",(e,t)=>{Be.init(e,t),e._zod.check=i=>{try{let r=i.value.trim();if(!t.normalize&&t.protocol?.source===fk.source&&!/^https?:\/\//i.test(r)){i.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:i.value,inst:e,continue:!t.abort});return}let o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:i.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:i.value,inst:e,continue:!t.abort})),t.normalize?i.value=o.href:i.value=r;return}catch{i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!t.abort})}}}),Zk=I("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ak()),Be.init(e,t)}),Jk=I("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ik),Be.init(e,t)}),Yk=I("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=JP),Be.init(e,t)}),ev=I("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=YP),Be.init(e,t)}),tv=I("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ek),Be.init(e,t)}),nv=I("$ZodXID",(e,t)=>{t.pattern??(t.pattern=tk),Be.init(e,t)}),iv=I("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=nk),Be.init(e,t)}),rv=I("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=hk(t)),Be.init(e,t)}),ov=I("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Sk),Be.init(e,t)}),sv=I("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=yk(t)),Be.init(e,t)}),av=I("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=rk),Be.init(e,t)}),cv=I("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ck),Be.init(e,t),e._zod.bag.format="ipv4"}),dv=I("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=dk),Be.init(e,t),e._zod.bag.format="ipv6",e._zod.check=i=>{try{new URL(`http://[${i.value}]`)}catch{i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:e,continue:!t.abort})}}}),uv=I("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=uk(t.delimiter)),Be.init(e,t),e._zod.bag.format="mac"}),lv=I("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=lk),Be.init(e,t)}),pv=I("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=pk),Be.init(e,t),e._zod.check=i=>{let r=i.value.split("/");try{if(r.length!==2)throw new Error;let[o,s]=r;if(!s)throw new Error;let a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:e,continue:!t.abort})}}});function mv(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var fv=I("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mk),Be.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=i=>{mv(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:e,continue:!t.abort})}});function AF(e){if(!Sy.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),i=t.padEnd(Math.ceil(t.length/4)*4,"=");return mv(i)}var gv=I("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Sy),Be.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=i=>{AF(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:e,continue:!t.abort})}}),Sv=I("$ZodE164",(e,t)=>{t.pattern??(t.pattern=gk),Be.init(e,t)});function OF(e,t=null){try{let i=e.split(".");if(i.length!==3)return!1;let[r]=i;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var yv=I("$ZodJWT",(e,t)=>{Be.init(e,t),e._zod.check=i=>{OF(i.value,t.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:e,continue:!t.abort})}}),hv=I("$ZodCustomStringFormat",(e,t)=>{Be.init(e,t),e._zod.check=i=>{t.fn(i.value)||i.issues.push({code:"invalid_format",format:t.format,input:i.value,inst:e,continue:!t.abort})}}),Py=I("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=e._zod.bag.pattern??yy,e._zod.parse=(i,r)=>{if(t.coerce)try{i.value=Number(i.value)}catch{}let o=i.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return i;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return i.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),i}}),Iv=I("$ZodNumberFormat",(e,t)=>{Ak.init(e,t),Py.init(e,t)}),xp=I("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=xk,e._zod.parse=(i,r)=>{if(t.coerce)try{i.value=!!i.value}catch{}let o=i.value;return typeof o=="boolean"||i.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),i}}),ky=I("$ZodBigInt",(e,t)=>{Z.init(e,t),e._zod.pattern=bk,e._zod.parse=(i,r)=>{if(t.coerce)try{i.value=BigInt(i.value)}catch{}return typeof i.value=="bigint"||i.issues.push({expected:"bigint",code:"invalid_type",input:i.value,inst:e}),i}}),bv=I("$ZodBigIntFormat",(e,t)=>{Ok.init(e,t),ky.init(e,t)}),Rv=I("$ZodSymbol",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>{let o=i.value;return typeof o=="symbol"||i.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),i}}),xv=I("$ZodUndefined",(e,t)=>{Z.init(e,t),e._zod.pattern=Pk,e._zod.values=new Set([void 0]),e._zod.parse=(i,r)=>{let o=i.value;return typeof o>"u"||i.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),i}}),Ev=I("$ZodNull",(e,t)=>{Z.init(e,t),e._zod.pattern=Ek,e._zod.values=new Set([null]),e._zod.parse=(i,r)=>{let o=i.value;return o===null||i.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),i}}),Pv=I("$ZodAny",(e,t)=>{Z.init(e,t),e._zod.parse=i=>i}),kv=I("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=i=>i}),vv=I("$ZodNever",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>(i.issues.push({expected:"never",code:"invalid_type",input:i.value,inst:e}),i)}),_v=I("$ZodVoid",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>{let o=i.value;return typeof o>"u"||i.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),i}}),Av=I("$ZodDate",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>{if(t.coerce)try{i.value=new Date(i.value)}catch{}let o=i.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||i.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),i}});function fF(e,t,i){e.issues.length&&t.issues.push(...On(i,e.issues)),t.value[i]=e.value}var Ov=I("$ZodArray",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),i;i.value=Array(o.length);let s=[];for(let a=0;a<o.length;a++){let c=o[a],d=t.element._zod.run({value:c,issues:[]},r);d instanceof Promise?s.push(d.then(u=>fF(u,i,a))):fF(d,i,a)}return s.length?Promise.all(s).then(()=>i):i}});function Ey(e,t,i,r,o,s){let a=i in r;if(e.issues.length){if(o&&s&&!a)return;t.issues.push(...On(i,e.issues))}if(!a&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[i]});return}e.value===void 0?a&&(t.value[i]=void 0):t.value[i]=e.value}function wF(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);let i=GP(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function TF(e,t,i,r,o,s){let a=[],c=o.keySet,d=o.catchall._zod,u=d.def.type,l=d.optin==="optional",p=d.optout==="optional";for(let m in t){if(m==="__proto__"||c.has(m))continue;if(u==="never"){a.push(m);continue}let f=d.run({value:t[m],issues:[]},r);f instanceof Promise?e.push(f.then(g=>Ey(g,i,m,t,l,p))):Ey(f,i,m,t,l,p)}return a.length&&i.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),e.length?Promise.all(e).then(()=>i):i}var CF=I("$ZodObject",(e,t)=>{if(Z.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let d={...c};return Object.defineProperty(t,"shape",{value:d}),d}})}let r=dd(()=>wF(t));se(e._zod,"propValues",()=>{let c=t.shape,d={};for(let u in c){let l=c[u]._zod;if(l.values){d[u]??(d[u]=new Set);for(let p of l.values)d[u].add(p)}}return d});let o=la,s=t.catchall,a;e._zod.parse=(c,d)=>{a??(a=r.value);let u=c.value;if(!o(u))return c.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),c;c.value={};let l=[],p=a.shape;for(let m of a.keys){let f=p[m],g=f._zod.optin==="optional",y=f._zod.optout==="optional",R=f._zod.run({value:u[m],issues:[]},d);R instanceof Promise?l.push(R.then(A=>Ey(A,c,m,u,g,y))):Ey(R,c,m,u,g,y)}return s?TF(l,u,c,d,r.value,e):l.length?Promise.all(l).then(()=>c):c}}),wv=I("$ZodObjectJIT",(e,t)=>{CF.init(e,t);let i=e._zod.parse,r=dd(()=>wF(t)),o=m=>{let f=new Rp(["shape","payload","ctx"]),g=r.value,y=_=>{let $=ry(_);return`shape[${$}]._zod.run({ value: input[${$}], issues: [] }, ctx)`};f.write("const input = payload.value;");let R=Object.create(null),A=0;for(let _ of g.keys)R[_]=`key_${A++}`;f.write("const newResult = {};");for(let _ of g.keys){let $=R[_],M=ry(_),G=m[_],H=G?._zod?.optin==="optional",F=G?._zod?.optout==="optional";f.write(`const ${$} = ${y(_)};`),H&&F?f.write(`
|
|
150
|
+
if (${$}.issues.length) {
|
|
151
|
+
if (${M} in input) {
|
|
152
|
+
payload.issues = payload.issues.concat(${$}.issues.map(iss => ({
|
|
153
|
+
...iss,
|
|
154
|
+
path: iss.path ? [${M}, ...iss.path] : [${M}]
|
|
155
|
+
})));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (${$}.value === undefined) {
|
|
160
|
+
if (${M} in input) {
|
|
161
|
+
newResult[${M}] = undefined;
|
|
162
|
+
}
|
|
163
|
+
} else {
|
|
164
|
+
newResult[${M}] = ${$}.value;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
`):H?f.write(`
|
|
168
|
+
if (${$}.issues.length) {
|
|
169
|
+
payload.issues = payload.issues.concat(${$}.issues.map(iss => ({
|
|
170
|
+
...iss,
|
|
171
|
+
path: iss.path ? [${M}, ...iss.path] : [${M}]
|
|
172
|
+
})));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (${$}.value === undefined) {
|
|
176
|
+
if (${M} in input) {
|
|
177
|
+
newResult[${M}] = undefined;
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
newResult[${M}] = ${$}.value;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
`):f.write(`
|
|
184
|
+
const ${$}_present = ${M} in input;
|
|
185
|
+
if (${$}.issues.length) {
|
|
186
|
+
payload.issues = payload.issues.concat(${$}.issues.map(iss => ({
|
|
187
|
+
...iss,
|
|
188
|
+
path: iss.path ? [${M}, ...iss.path] : [${M}]
|
|
189
|
+
})));
|
|
190
|
+
}
|
|
191
|
+
if (!${$}_present && !${$}.issues.length) {
|
|
192
|
+
payload.issues.push({
|
|
193
|
+
code: "invalid_type",
|
|
194
|
+
expected: "nonoptional",
|
|
195
|
+
input: undefined,
|
|
196
|
+
path: [${M}]
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (${$}_present) {
|
|
201
|
+
if (${$}.value === undefined) {
|
|
202
|
+
newResult[${M}] = undefined;
|
|
203
|
+
} else {
|
|
204
|
+
newResult[${M}] = ${$}.value;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let D=f.compile();return(_,$)=>D(m,_,$)},s,a=la,c=!ua.jitless,u=c&&FP.value,l=t.catchall,p;e._zod.parse=(m,f)=>{p??(p=r.value);let g=m.value;return a(g)?c&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=o(t.shape)),m=s(m,f),l?TF([],g,m,f,p,e):m):i(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function gF(e,t,i,r){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!us(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:i,errors:e.map(s=>s.issues.map(a=>ln(a,r,mt())))}),t)}var Ep=I("$ZodUnion",(e,t)=>{Z.init(e,t),se(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),se(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),se(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),se(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){let r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>pp(o.source)).join("|")})$`)}});let i=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(i)return i(r,o);let s=!1,a=[];for(let c of t.options){let d=c._zod.run({value:r.value,issues:[]},o);if(d instanceof Promise)a.push(d),s=!0;else{if(d.issues.length===0)return d;a.push(d)}}return s?Promise.all(a).then(c=>gF(c,r,e,o)):gF(a,r,e,o)}});function SF(e,t,i,r){let o=e.filter(s=>s.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:i,errors:e.map(s=>s.issues.map(a=>ln(a,r,mt())))}):t.issues.push({code:"invalid_union",input:t.value,inst:i,errors:[],inclusive:!1}),t)}var Tv=I("$ZodXor",(e,t)=>{Ep.init(e,t),t.inclusive=!1;let i=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(i)return i(r,o);let s=!1,a=[];for(let c of t.options){let d=c._zod.run({value:r.value,issues:[]},o);d instanceof Promise?(a.push(d),s=!0):a.push(d)}return s?Promise.all(a).then(c=>SF(c,r,e,o)):SF(a,r,e,o)}}),Cv=I("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ep.init(e,t);let i=e._zod.parse;se(e._zod,"propValues",()=>{let o={};for(let s of t.options){let a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[c,d]of Object.entries(a)){o[c]||(o[c]=new Set);for(let u of d)o[c].add(u)}}return o});let r=dd(()=>{let o=t.options,s=new Map;for(let a of o){let c=a._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let d of c){if(s.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);s.set(d,a)}}return s});e._zod.parse=(o,s)=>{let a=o.value;if(!la(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let c=r.value.get(a?.[t.discriminator]);return c?c._zod.run(o,s):t.unionFallback||s.direction==="backward"?i(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:a,path:[t.discriminator],inst:e}),o)}}),Lv=I("$ZodIntersection",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>{let o=i.value,s=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([d,u])=>yF(i,d,u)):yF(i,s,a)}});function Vk(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(ds(e)&&ds(t)){let i=Object.keys(t),r=Object.keys(e).filter(s=>i.indexOf(s)!==-1),o={...e,...t};for(let s of r){let a=Vk(e[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let i=[];for(let r=0;r<e.length;r++){let o=e[r],s=t[r],a=Vk(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};i.push(a.data)}return{valid:!0,data:i}}return{valid:!1,mergeErrorPath:[]}}function yF(e,t,i){let r=new Map,o;for(let c of t.issues)if(c.code==="unrecognized_keys"){o??(o=c);for(let d of c.keys)r.has(d)||r.set(d,{}),r.get(d).l=!0}else e.issues.push(c);for(let c of i.issues)if(c.code==="unrecognized_keys")for(let d of c.keys)r.has(d)||r.set(d,{}),r.get(d).r=!0;else e.issues.push(c);let s=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(s.length&&o&&e.issues.push({...o,keys:s}),us(e))return e;let a=Vk(t.value,i.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var vy=I("$ZodTuple",(e,t)=>{Z.init(e,t);let i=t.items;e._zod.parse=(r,o)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];let a=[],c=hF(i,"optin"),d=hF(i,"optout");if(!t.rest){if(s.length<c)return r.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),r;s.length>i.length&&r.issues.push({code:"too_big",maximum:i.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=new Array(i.length);for(let l=0;l<i.length;l++){let p=i[l]._zod.run({value:s[l],issues:[]},o);p instanceof Promise?a.push(p.then(m=>{u[l]=m})):u[l]=p}if(t.rest){let l=i.length-1,p=s.slice(i.length);for(let m of p){l++;let f=t.rest._zod.run({value:m,issues:[]},o);f instanceof Promise?a.push(f.then(g=>IF(g,r,l))):IF(f,r,l)}}return a.length?Promise.all(a).then(()=>bF(u,r,i,s,d)):bF(u,r,i,s,d)}});function hF(e,t){for(let i=e.length-1;i>=0;i--)if(e[i]._zod[t]!=="optional")return i+1;return 0}function IF(e,t,i){e.issues.length&&t.issues.push(...On(i,e.issues)),t.value[i]=e.value}function bF(e,t,i,r,o){for(let s=0;s<i.length;s++){let a=e[s],c=s<r.length;if(a.issues.length){if(!c&&s>=o){t.value.length=s;break}t.issues.push(...On(s,a.issues))}t.value[s]=a.value}for(let s=t.value.length-1;s>=r.length&&(i[s]._zod.optout==="optional"&&t.value[s]===void 0);s--)t.value.length=s;return t}var Dv=I("$ZodRecord",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>{let o=i.value;if(!ds(o))return i.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),i;let s=[],a=t.keyType._zod.values;if(a){i.value={};let c=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){c.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){i.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>ln(f,r,mt())),input:u,path:[u],inst:e});continue}let p=l.value,m=t.valueType._zod.run({value:o[u],issues:[]},r);m instanceof Promise?s.push(m.then(f=>{f.issues.length&&i.issues.push(...On(u,f.issues)),i.value[p]=f.value})):(m.issues.length&&i.issues.push(...On(u,m.issues)),i.value[p]=m.value)}let d;for(let u in o)c.has(u)||(d=d??[],d.push(u));d&&d.length>0&&i.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{i.value={};for(let c of Reflect.ownKeys(o)){if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,c))continue;let d=t.keyType._zod.run({value:c,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&yy.test(c)&&d.issues.length){let p=t.keyType._zod.run({value:Number(c),issues:[]},r);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(d=p)}if(d.issues.length){t.mode==="loose"?i.value[c]=o[c]:i.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(p=>ln(p,r,mt())),input:c,path:[c],inst:e});continue}let l=t.valueType._zod.run({value:o[c],issues:[]},r);l instanceof Promise?s.push(l.then(p=>{p.issues.length&&i.issues.push(...On(c,p.issues)),i.value[d.value]=p.value})):(l.issues.length&&i.issues.push(...On(c,l.issues)),i.value[d.value]=l.value)}}return s.length?Promise.all(s).then(()=>i):i}}),$v=I("$ZodMap",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>{let o=i.value;if(!(o instanceof Map))return i.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),i;let s=[];i.value=new Map;for(let[a,c]of o){let d=t.keyType._zod.run({value:a,issues:[]},r),u=t.valueType._zod.run({value:c,issues:[]},r);d instanceof Promise||u instanceof Promise?s.push(Promise.all([d,u]).then(([l,p])=>{RF(l,p,i,a,o,e,r)})):RF(d,u,i,a,o,e,r)}return s.length?Promise.all(s).then(()=>i):i}});function RF(e,t,i,r,o,s,a){e.issues.length&&(mp.has(typeof r)?i.issues.push(...On(r,e.issues)):i.issues.push({code:"invalid_key",origin:"map",input:o,inst:s,issues:e.issues.map(c=>ln(c,a,mt()))})),t.issues.length&&(mp.has(typeof r)?i.issues.push(...On(r,t.issues)):i.issues.push({origin:"map",code:"invalid_element",input:o,inst:s,key:r,issues:t.issues.map(c=>ln(c,a,mt()))})),i.value.set(e.value,t.value)}var Nv=I("$ZodSet",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>{let o=i.value;if(!(o instanceof Set))return i.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),i;let s=[];i.value=new Set;for(let a of o){let c=t.valueType._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(d=>xF(d,i))):xF(c,i)}return s.length?Promise.all(s).then(()=>i):i}});function xF(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var jv=I("$ZodEnum",(e,t)=>{Z.init(e,t);let i=lp(t.entries),r=new Set(i);e._zod.values=r,e._zod.pattern=new RegExp(`^(${i.filter(o=>mp.has(typeof o)).map(o=>typeof o=="string"?Ii(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:i,input:a,inst:e}),o}}),Bv=I("$ZodLiteral",(e,t)=>{if(Z.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let i=new Set(t.values);e._zod.values=i,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Ii(r):r?Ii(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{let s=r.value;return i.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),Mv=I("$ZodFile",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>{let o=i.value;return o instanceof File||i.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),i}}),Uv=I("$ZodTransform",(e,t)=>{Z.init(e,t),e._zod.optin="optional",e._zod.parse=(i,r)=>{if(r.direction==="backward")throw new ss(e.constructor.name);let o=t.transform(i.value,i);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(i.value=a,i.fallback=!0,i));if(o instanceof Promise)throw new Yi;return i.value=o,i.fallback=!0,i}});function EF(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var _y=I("$ZodOptional",(e,t)=>{Z.init(e,t),e._zod.optin="optional",e._zod.optout="optional",se(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),se(e._zod,"pattern",()=>{let i=t.innerType._zod.pattern;return i?new RegExp(`^(${pp(i.source)})?$`):void 0}),e._zod.parse=(i,r)=>{if(t.innerType._zod.optin==="optional"){let o=i.value,s=t.innerType._zod.run(i,r);return s instanceof Promise?s.then(a=>EF(a,o)):EF(s,o)}return i.value===void 0?i:t.innerType._zod.run(i,r)}}),Fv=I("$ZodExactOptional",(e,t)=>{_y.init(e,t),se(e._zod,"values",()=>t.innerType._zod.values),se(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(i,r)=>t.innerType._zod.run(i,r)}),qv=I("$ZodNullable",(e,t)=>{Z.init(e,t),se(e._zod,"optin",()=>t.innerType._zod.optin),se(e._zod,"optout",()=>t.innerType._zod.optout),se(e._zod,"pattern",()=>{let i=t.innerType._zod.pattern;return i?new RegExp(`^(${pp(i.source)}|null)$`):void 0}),se(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(i,r)=>i.value===null?i:t.innerType._zod.run(i,r)}),zv=I("$ZodDefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(i,r)=>{if(r.direction==="backward")return t.innerType._zod.run(i,r);if(i.value===void 0)return i.value=t.defaultValue,i;let o=t.innerType._zod.run(i,r);return o instanceof Promise?o.then(s=>PF(s,t)):PF(o,t)}});function PF(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Gv=I("$ZodPrefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(i,r)=>(r.direction==="backward"||i.value===void 0&&(i.value=t.defaultValue),t.innerType._zod.run(i,r))}),Kv=I("$ZodNonOptional",(e,t)=>{Z.init(e,t),se(e._zod,"values",()=>{let i=t.innerType._zod.values;return i?new Set([...i].filter(r=>r!==void 0)):void 0}),e._zod.parse=(i,r)=>{let o=t.innerType._zod.run(i,r);return o instanceof Promise?o.then(s=>kF(s,e)):kF(o,e)}});function kF(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Vv=I("$ZodSuccess",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>{if(r.direction==="backward")throw new ss("ZodSuccess");let o=t.innerType._zod.run(i,r);return o instanceof Promise?o.then(s=>(i.value=s.issues.length===0,i)):(i.value=o.issues.length===0,i)}}),Hv=I("$ZodCatch",(e,t)=>{Z.init(e,t),e._zod.optin="optional",se(e._zod,"optout",()=>t.innerType._zod.optout),se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(i,r)=>{if(r.direction==="backward")return t.innerType._zod.run(i,r);let o=t.innerType._zod.run(i,r);return o instanceof Promise?o.then(s=>(i.value=s.value,s.issues.length&&(i.value=t.catchValue({...i,error:{issues:s.issues.map(a=>ln(a,r,mt()))},input:i.value}),i.issues=[],i.fallback=!0),i)):(i.value=o.value,o.issues.length&&(i.value=t.catchValue({...i,error:{issues:o.issues.map(s=>ln(s,r,mt()))},input:i.value}),i.issues=[],i.fallback=!0),i)}}),Wv=I("$ZodNaN",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>((typeof i.value!="number"||!Number.isNaN(i.value))&&i.issues.push({input:i.value,inst:e,expected:"nan",code:"invalid_type"}),i)}),Ay=I("$ZodPipe",(e,t)=>{Z.init(e,t),se(e._zod,"values",()=>t.in._zod.values),se(e._zod,"optin",()=>t.in._zod.optin),se(e._zod,"optout",()=>t.out._zod.optout),se(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(i,r)=>{if(r.direction==="backward"){let s=t.out._zod.run(i,r);return s instanceof Promise?s.then(a=>by(a,t.in,r)):by(s,t.in,r)}let o=t.in._zod.run(i,r);return o instanceof Promise?o.then(s=>by(s,t.out,r)):by(o,t.out,r)}});function by(e,t,i){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},i)}var Pp=I("$ZodCodec",(e,t)=>{Z.init(e,t),se(e._zod,"values",()=>t.in._zod.values),se(e._zod,"optin",()=>t.in._zod.optin),se(e._zod,"optout",()=>t.out._zod.optout),se(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(i,r)=>{if((r.direction||"forward")==="forward"){let s=t.in._zod.run(i,r);return s instanceof Promise?s.then(a=>Ry(a,t,r)):Ry(s,t,r)}else{let s=t.out._zod.run(i,r);return s instanceof Promise?s.then(a=>Ry(a,t,r)):Ry(s,t,r)}}});function Ry(e,t,i){if(e.issues.length)return e.aborted=!0,e;if((i.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(s=>xy(e,s,t.out,i)):xy(e,o,t.out,i)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(s=>xy(e,s,t.in,i)):xy(e,o,t.in,i)}}function xy(e,t,i,r){return e.issues.length?(e.aborted=!0,e):i._zod.run({value:t,issues:e.issues},r)}var Xv=I("$ZodPreprocess",(e,t)=>{Ay.init(e,t)}),Qv=I("$ZodReadonly",(e,t)=>{Z.init(e,t),se(e._zod,"propValues",()=>t.innerType._zod.propValues),se(e._zod,"values",()=>t.innerType._zod.values),se(e._zod,"optin",()=>t.innerType?._zod?.optin),se(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(i,r)=>{if(r.direction==="backward")return t.innerType._zod.run(i,r);let o=t.innerType._zod.run(i,r);return o instanceof Promise?o.then(vF):vF(o)}});function vF(e){return e.value=Object.freeze(e.value),e}var Zv=I("$ZodTemplateLiteral",(e,t)=>{Z.init(e,t);let i=[];for(let r of t.parts)if(typeof r=="object"&&r!==null){if(!r._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);let o=r._zod.pattern instanceof RegExp?r._zod.pattern.source:r._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${r._zod.traits}`);let s=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;i.push(o.slice(s,a))}else if(r===null||zP.has(typeof r))i.push(Ii(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${i.join("")}$`),e._zod.parse=(r,o)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),Jv=I("$ZodFunction",(e,t)=>(Z.init(e,t),e._def=t,e._zod.def=t,e.implement=i=>{if(typeof i!="function")throw new Error("implement() must be called with a function");return function(...r){let o=e._def.input?sy(e._def.input,r):r,s=Reflect.apply(i,this,o);return e._def.output?sy(e._def.output,s):s}},e.implementAsync=i=>{if(typeof i!="function")throw new Error("implementAsync() must be called with a function");return async function(...r){let o=e._def.input?await ay(e._def.input,r):r,s=await Reflect.apply(i,this,o);return e._def.output?await ay(e._def.output,s):s}},e._zod.parse=(i,r)=>typeof i.value!="function"?(i.issues.push({code:"invalid_type",expected:"function",input:i.value,inst:e}),i):(e._def.output&&e._def.output._zod.def.type==="promise"?i.value=e.implementAsync(i.value):i.value=e.implement(i.value),i),e.input=(...i)=>{let r=e.constructor;return Array.isArray(i[0])?new r({type:"function",input:new vy({type:"tuple",items:i[0],rest:i[1]}),output:e._def.output}):new r({type:"function",input:i[0],output:e._def.output})},e.output=i=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:i})},e)),Yv=I("$ZodPromise",(e,t)=>{Z.init(e,t),e._zod.parse=(i,r)=>Promise.resolve(i.value).then(o=>t.innerType._zod.run({value:o,issues:[]},r))}),e_=I("$ZodLazy",(e,t)=>{Z.init(e,t),se(e._zod,"innerType",()=>{let i=t;return i._cachedInner||(i._cachedInner=t.getter()),i._cachedInner}),se(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),se(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),se(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),se(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(i,r)=>e._zod.innerType._zod.run(i,r)}),t_=I("$ZodCustom",(e,t)=>{Ge.init(e,t),Z.init(e,t),e._zod.parse=(i,r)=>i,e._zod.check=i=>{let r=i.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>_F(s,i,r,e));_F(o,i,r,e)}});function _F(e,t,i,r){if(!e){let o={code:"custom",input:i,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(ud(o))}}var vp={};Ht(vp,{ar:()=>LF,az:()=>DF,be:()=>NF,bg:()=>jF,ca:()=>BF,cs:()=>MF,da:()=>UF,de:()=>FF,el:()=>qF,en:()=>Oy,eo:()=>zF,es:()=>GF,fa:()=>KF,fi:()=>VF,fr:()=>HF,frCA:()=>WF,he:()=>XF,hr:()=>QF,hu:()=>ZF,hy:()=>YF,id:()=>eq,is:()=>tq,it:()=>nq,ja:()=>iq,ka:()=>rq,kh:()=>oq,km:()=>wy,ko:()=>sq,lt:()=>cq,mk:()=>dq,ms:()=>uq,nl:()=>lq,no:()=>pq,ota:()=>mq,pl:()=>gq,ps:()=>fq,pt:()=>Sq,ro:()=>yq,ru:()=>Iq,sl:()=>bq,sv:()=>Rq,ta:()=>xq,th:()=>Eq,tr:()=>Pq,ua:()=>kq,uk:()=>Ty,ur:()=>vq,uz:()=>_q,vi:()=>Aq,yo:()=>Tq,zhCN:()=>Oq,zhTW:()=>wq});var Qce=()=>{let e={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function t(o){return e[o]??null}let i={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${o.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${c}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${s}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${c}`}case"invalid_value":return o.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${O(o.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${s} ${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${o.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${s} ${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${s} ${o.minimum.toString()} ${a.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${o.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${s} ${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${o.prefix}"`:s.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${s.suffix}"`:s.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${s.includes}"`:s.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${s.pattern}`:`${i[s.format]??o.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${o.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${o.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${o.keys.length>1?"\u0629":""}: ${b(o.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${o.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}};function LF(){return{localeError:Qce()}}var Zce=()=>{let e={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function t(o){return e[o]??null}let i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${o.expected}, daxil olan ${c}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${s}, daxil olan ${c}`}case"invalid_value":return o.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${O(o.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${s}${o.maximum.toString()} ${a.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${o.origin??"d\u0259y\u0259r"} ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${s}${o.minimum.toString()} ${a.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${o.origin} ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${s.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:s.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${s.suffix}" il\u0259 bitm\u0259lidir`:s.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${s.includes}" daxil olmal\u0131d\u0131r`:s.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${s.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${i[s.format]??o.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${o.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${o.keys.length>1?"lar":""}: ${b(o.keys,", ")}`;case"invalid_key":return`${o.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${o.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}};function DF(){return{localeError:Zce()}}function $F(e,t,i,r){let o=Math.abs(e),s=o%10,a=o%100;return a>=11&&a<=19?r:s===1?t:s>=2&&s<=4?i:r}var Jce=()=>{let e={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function t(o){return e[o]??null}let i={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},r={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${o.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${c}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${s}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${c}`}case"invalid_value":return o.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${O(o.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);if(a){let c=Number(o.maximum),d=$F(c,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${s}${o.maximum.toString()} ${d}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);if(a){let c=Number(o.minimum),d=$F(c,a.unit.one,a.unit.few,a.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${a.verb} ${s}${o.minimum.toString()} ${d}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${o.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${s.prefix}"`:s.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${s.suffix}"`:s.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${s.includes}"`:s.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${s.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${i[s.format]??o.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${o.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${b(o.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${o.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}};function NF(){return{localeError:Jce()}}var Yce=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function t(o){return e[o]??null}let i={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},r={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${o.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${c}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${s}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${c}`}case"invalid_value":return o.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${O(o.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${o.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${s}${o.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${o.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${o.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${s}${o.minimum.toString()} ${a.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${o.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;if(s.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${s.prefix}"`;if(s.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${s.suffix}"`;if(s.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${s.includes}"`;if(s.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${s.pattern}`;let a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return s.format==="emoji"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),s.format==="datetime"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),s.format==="date"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),s.format==="time"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),s.format==="duration"&&(a="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${a} ${i[s.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${o.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${o.keys.length>1?"\u043E\u0432\u0435":""}: ${b(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${o.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}};function jF(){return{localeError:Yce()}}var ede=()=>{let e={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(o){return e[o]??null}let i={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${o.expected}, s'ha rebut ${c}`:`Tipus inv\xE0lid: s'esperava ${s}, s'ha rebut ${c}`}case"invalid_value":return o.values.length===1?`Valor inv\xE0lid: s'esperava ${O(o.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${b(o.values," o ")}`;case"too_big":{let s=o.inclusive?"com a m\xE0xim":"menys de",a=t(o.origin);return a?`Massa gran: s'esperava que ${o.origin??"el valor"} contingu\xE9s ${s} ${o.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${o.origin??"el valor"} fos ${s} ${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?"com a m\xEDnim":"m\xE9s de",a=t(o.origin);return a?`Massa petit: s'esperava que ${o.origin} contingu\xE9s ${s} ${o.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${o.origin} fos ${s} ${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${s.prefix}"`:s.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${s.suffix}"`:s.format==="includes"?`Format inv\xE0lid: ha d'incloure "${s.includes}"`:s.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${s.pattern}`:`Format inv\xE0lid per a ${i[s.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${o.divisor}`;case"unrecognized_keys":return`Clau${o.keys.length>1?"s":""} no reconeguda${o.keys.length>1?"s":""}: ${b(o.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${o.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${o.origin}`;default:return"Entrada inv\xE0lida"}}};function BF(){return{localeError:ede()}}var tde=()=>{let e={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function t(o){return e[o]??null}let i={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},r={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${o.expected}, obdr\u017Eeno ${c}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${s}, obdr\u017Eeno ${c}`}case"invalid_value":return o.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${O(o.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${s}${o.maximum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED m\xEDt ${s}${o.minimum.toString()} ${a.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${o.origin??"hodnota"} mus\xED b\xFDt ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${s.prefix}"`:s.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${s.suffix}"`:s.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${s.includes}"`:s.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${s.pattern}`:`Neplatn\xFD form\xE1t ${i[s.format]??o.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${o.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${b(o.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${o.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${o.origin}`;default:return"Neplatn\xFD vstup"}}};function MF(){return{localeError:tde()}}var nde=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(o){return e[o]??null}let i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},r={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Ugyldigt input: forventede instanceof ${o.expected}, fik ${c}`:`Ugyldigt input: forventede ${s}, fik ${c}`}case"invalid_value":return o.values.length===1?`Ugyldig v\xE6rdi: forventede ${O(o.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin),c=r[o.origin]??o.origin;return a?`For stor: forventede ${c??"value"} ${a.verb} ${s} ${o.maximum.toString()} ${a.unit??"elementer"}`:`For stor: forventede ${c??"value"} havde ${s} ${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin),c=r[o.origin]??o.origin;return a?`For lille: forventede ${c} ${a.verb} ${s} ${o.minimum.toString()} ${a.unit}`:`For lille: forventede ${c} havde ${s} ${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Ugyldig streng: skal starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: skal ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: skal indeholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${s.pattern}`:`Ugyldig ${i[s.format]??o.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${b(o.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${o.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${o.origin}`;default:return"Ugyldigt input"}}};function UF(){return{localeError:nde()}}var ide=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(o){return e[o]??null}let i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},r={nan:"NaN",number:"Zahl",array:"Array"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${o.expected}, erhalten ${c}`:`Ung\xFCltige Eingabe: erwartet ${s}, erhalten ${c}`}case"invalid_value":return o.values.length===1?`Ung\xFCltige Eingabe: erwartet ${O(o.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${s}${o.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${o.origin??"Wert"} ${s}${o.maximum.toString()} ist`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Zu klein: erwartet, dass ${o.origin} ${s}${o.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${o.origin} ${s}${o.minimum.toString()} ist`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Ung\xFCltiger String: muss mit "${s.prefix}" beginnen`:s.format==="ends_with"?`Ung\xFCltiger String: muss mit "${s.suffix}" enden`:s.format==="includes"?`Ung\xFCltiger String: muss "${s.includes}" enthalten`:s.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${s.pattern} entsprechen`:`Ung\xFCltig: ${i[s.format]??o.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${o.divisor} sein`;case"unrecognized_keys":return`${o.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${b(o.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${o.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${o.origin}`;default:return"Ung\xFCltige Eingabe"}}};function FF(){return{localeError:ide()}}var rde=()=>{let e={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function t(o){return e[o]??null}let i={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return typeof o.expected=="string"&&/^[A-Z]/.test(o.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${o.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${c}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${s}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${c}`}case"invalid_value":return o.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${O(o.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${o.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${s}${o.maximum.toString()} ${a.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${o.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${o.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${s}${o.minimum.toString()} ${a.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${o.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${s.prefix}"`:s.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${s.suffix}"`:s.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${s.includes}"`:s.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${s.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${i[s.format]??o.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${o.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${o.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${o.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${b(o.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${o.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${o.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}};function qF(){return{localeError:rde()}}var ode=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${O(o.values[0])}`:`Invalid option: expected one of ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${s}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${s}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${i[s.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${b(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return o.options&&Array.isArray(o.options)&&o.options.length>0?`Invalid discriminator value. Expected ${o.options.map(a=>`'${a}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Oy(){return{localeError:ode()}}var sde=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(o){return e[o]??null}let i={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},r={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${o.expected}, ricevi\u011Dis ${c}`:`Nevalida enigo: atendi\u011Dis ${s}, ricevi\u011Dis ${c}`}case"invalid_value":return o.values.length===1?`Nevalida enigo: atendi\u011Dis ${O(o.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Tro granda: atendi\u011Dis ke ${o.origin??"valoro"} havu ${s}${o.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${o.origin??"valoro"} havu ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Tro malgranda: atendi\u011Dis ke ${o.origin} havu ${s}${o.minimum.toString()} ${a.unit}`:`Tro malgranda: atendi\u011Dis ke ${o.origin} estu ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${s.prefix}"`:s.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${s.suffix}"`:s.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${s.includes}"`:s.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${s.pattern}`:`Nevalida ${i[s.format]??o.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${o.divisor}`;case"unrecognized_keys":return`Nekonata${o.keys.length>1?"j":""} \u015Dlosilo${o.keys.length>1?"j":""}: ${b(o.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${o.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${o.origin}`;default:return"Nevalida enigo"}}};function zF(){return{localeError:sde()}}var ade=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(o){return e[o]??null}let i={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${o.expected}, recibido ${c}`:`Entrada inv\xE1lida: se esperaba ${s}, recibido ${c}`}case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: se esperaba ${O(o.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin),c=r[o.origin]??o.origin;return a?`Demasiado grande: se esperaba que ${c??"valor"} tuviera ${s}${o.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${c??"valor"} fuera ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin),c=r[o.origin]??o.origin;return a?`Demasiado peque\xF1o: se esperaba que ${c} tuviera ${s}${o.minimum.toString()} ${a.unit}`:`Demasiado peque\xF1o: se esperaba que ${c} fuera ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${s.prefix}"`:s.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${s.suffix}"`:s.format==="includes"?`Cadena inv\xE1lida: debe incluir "${s.includes}"`:s.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${s.pattern}`:`Inv\xE1lido ${i[s.format]??o.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Llave${o.keys.length>1?"s":""} desconocida${o.keys.length>1?"s":""}: ${b(o.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${r[o.origin]??o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${r[o.origin]??o.origin}`;default:return"Entrada inv\xE1lida"}}};function GF(){return{localeError:ade()}}var cde=()=>{let e={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function t(o){return e[o]??null}let i={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},r={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${o.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${c} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${s} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${c} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return o.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${O(o.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${b(o.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${s}${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${o.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${s}${o.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${s}${o.minimum.toString()} ${a.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${o.origin} \u0628\u0627\u06CC\u062F ${s}${o.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${s.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:s.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${s.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:s.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${s.includes}" \u0628\u0627\u0634\u062F`:s.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${s.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${i[s.format]??o.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${o.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${o.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${b(o.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${o.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${o.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}};function KF(){return{localeError:cde()}}var dde=()=>{let e={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function t(o){return e[o]??null}let i={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Virheellinen tyyppi: odotettiin instanceof ${o.expected}, oli ${c}`:`Virheellinen tyyppi: odotettiin ${s}, oli ${c}`}case"invalid_value":return o.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${O(o.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Liian suuri: ${a.subject} t\xE4ytyy olla ${s}${o.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Liian pieni: ${a.subject} t\xE4ytyy olla ${s}${o.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${s.prefix}"`:s.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${s.suffix}"`:s.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${s.includes}"`:s.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${s.pattern}`:`Virheellinen ${i[s.format]??o.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${o.divisor} monikerta`;case"unrecognized_keys":return`${o.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${b(o.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}};function VF(){return{localeError:dde()}}var ude=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(o){return e[o]??null}let i={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},r={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Entr\xE9e invalide : instanceof ${o.expected} attendu, ${c} re\xE7u`:`Entr\xE9e invalide : ${s} attendu, ${c} re\xE7u`}case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : ${O(o.values[0])} attendu`:`Option invalide : une valeur parmi ${b(o.values,"|")} attendue`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Trop grand : ${r[o.origin]??"valeur"} doit ${a.verb} ${s}${o.maximum.toString()} ${a.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${r[o.origin]??"valeur"} doit \xEAtre ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Trop petit : ${r[o.origin]??"valeur"} doit ${a.verb} ${s}${o.minimum.toString()} ${a.unit}`:`Trop petit : ${r[o.origin]??"valeur"} doit \xEAtre ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Cha\xEEne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${s.pattern}`:`${i[s.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${b(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function HF(){return{localeError:ude()}}var lde=()=>{let e={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function t(o){return e[o]??null}let i={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Entr\xE9e invalide : attendu instanceof ${o.expected}, re\xE7u ${c}`:`Entr\xE9e invalide : attendu ${s}, re\xE7u ${c}`}case"invalid_value":return o.values.length===1?`Entr\xE9e invalide : attendu ${O(o.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"\u2264":"<",a=t(o.origin);return a?`Trop grand : attendu que ${o.origin??"la valeur"} ait ${s}${o.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${o.origin??"la valeur"} soit ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?"\u2265":">",a=t(o.origin);return a?`Trop petit : attendu que ${o.origin} ait ${s}${o.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${o.origin} soit ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Cha\xEEne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${s.pattern}`:`${i[s.format]??o.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${o.divisor}`;case"unrecognized_keys":return`Cl\xE9${o.keys.length>1?"s":""} non reconnue${o.keys.length>1?"s":""} : ${b(o.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${o.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${o.origin}`;default:return"Entr\xE9e invalide"}}};function WF(){return{localeError:lde()}}var pde=()=>{let e={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},t={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},i=u=>u?e[u]:void 0,r=u=>{let l=i(u);return l?l.label:u??e.unknown.label},o=u=>`\u05D4${r(u)}`,s=u=>(i(u)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",a=u=>u?t[u]??null:null,c={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},d={nan:"NaN"};return u=>{switch(u.code){case"invalid_type":{let l=u.expected,p=d[l??""]??r(l),m=w(u.input),f=d[m]??e[m]?.label??m;return/^[A-Z]/.test(u.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${u.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${p}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`}case"invalid_value":{if(u.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${O(u.values[0])}`;let l=u.values.map(f=>O(f));if(u.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l[0]} \u05D0\u05D5 ${l[1]}`;let p=l[l.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${l.slice(0,-1).join(", ")} \u05D0\u05D5 ${p}`}case"too_big":{let l=a(u.origin),p=o(u.origin??"value");if(u.origin==="string")return`${l?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.maximum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(u.origin==="number"){let g=u.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${u.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${g}`}if(u.origin==="array"||u.origin==="set"){let g=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",y=u.inclusive?`${u.maximum} ${l?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${u.maximum} ${l?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${p} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`.trim()}let m=u.inclusive?"<=":"<",f=s(u.origin??"value");return l?.unit?`${l.longLabel} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.maximum.toString()} ${l.unit}`:`${l?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.maximum.toString()}`}case"too_small":{let l=a(u.origin),p=o(u.origin??"value");if(u.origin==="string")return`${l?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${u.minimum.toString()} ${l?.unit??""} ${u.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(u.origin==="number"){let g=u.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${u.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${u.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${g}`}if(u.origin==="array"||u.origin==="set"){let g=u.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(u.minimum===1&&u.inclusive){let R=(u.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${R}`}let y=u.inclusive?`${u.minimum} ${l?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${u.minimum} ${l?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${p} ${g} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`.trim()}let m=u.inclusive?">=":">",f=s(u.origin??"value");return l?.unit?`${l.shortLabel} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.minimum.toString()} ${l.unit}`:`${l?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${p} ${f} ${m}${u.minimum.toString()}`}case"invalid_format":{let l=u;if(l.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${l.prefix}"`;if(l.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${l.suffix}"`;if(l.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${l.includes}"`;if(l.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${l.pattern}`;let p=c[l.format],m=p?.label??l.format,g=(p?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${m} \u05DC\u05D0 ${g}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${u.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${u.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${u.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${b(u.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${o(u.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}};function XF(){return{localeError:pde()}}var mde=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(o){return e[o]??null}let i={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},r={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${o.expected}, a primljeno je ${c}`:`Neispravan unos: o\u010Dekuje se ${s}, a primljeno je ${c}`}case"invalid_value":return o.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${O(o.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin),c=r[o.origin]??o.origin;return a?`Preveliko: o\u010Dekivano da ${c??"vrijednost"} ima ${s}${o.maximum.toString()} ${a.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${c??"vrijednost"} bude ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin),c=r[o.origin]??o.origin;return a?`Premalo: o\u010Dekivano da ${c} ima ${s}${o.minimum.toString()} ${a.unit}`:`Premalo: o\u010Dekivano da ${c} bude ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${s.prefix}"`:s.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${s.suffix}"`:s.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${s.includes}"`:s.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${s.pattern}`:`Neispravna ${i[s.format]??o.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${o.divisor}`;case"unrecognized_keys":return`Neprepoznat${o.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${b(o.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${r[o.origin]??o.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${r[o.origin]??o.origin}`;default:return"Neispravan unos"}}};function QF(){return{localeError:mde()}}var fde=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(o){return e[o]??null}let i={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},r={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${o.expected}, a kapott \xE9rt\xE9k ${c}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${s}, a kapott \xE9rt\xE9k ${c}`}case"invalid_value":return o.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${O(o.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`T\xFAl nagy: ${o.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${s}${o.maximum.toString()} ${a.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${o.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} m\xE9rete t\xFAl kicsi ${s}${o.minimum.toString()} ${a.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${o.origin} t\xFAl kicsi ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\xC9rv\xE9nytelen string: "${s.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:s.format==="ends_with"?`\xC9rv\xE9nytelen string: "${s.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:s.format==="includes"?`\xC9rv\xE9nytelen string: "${s.includes}" \xE9rt\xE9ket kell tartalmaznia`:s.format==="regex"?`\xC9rv\xE9nytelen string: ${s.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${i[s.format]??o.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${o.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${o.keys.length>1?"s":""}: ${b(o.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${o.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${o.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}};function ZF(){return{localeError:fde()}}function JF(e,t,i){return Math.abs(e)===1?t:i}function Sd(e){if(!e)return"";let t=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],i=e[e.length-1];return e+(t.includes(i)?"\u0576":"\u0568")}var gde=()=>{let e={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function t(o){return e[o]??null}let i={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},r={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${o.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${c}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${s}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${c}`}case"invalid_value":return o.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${O(o.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);if(a){let c=Number(o.maximum),d=JF(c,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Sd(o.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${s}${o.maximum.toString()} ${d}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Sd(o.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);if(a){let c=Number(o.minimum),d=JF(c,a.unit.one,a.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Sd(o.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${s}${o.minimum.toString()} ${d}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${Sd(o.origin)} \u056C\u056B\u0576\u056B ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${s.prefix}"-\u0578\u057E`:s.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${s.suffix}"-\u0578\u057E`:s.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${s.includes}"`:s.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${s.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${i[s.format]??o.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${o.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${o.keys.length>1?"\u0576\u0565\u0580":""}. ${b(o.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${Sd(o.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${Sd(o.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}};function YF(){return{localeError:gde()}}var Sde=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(o){return e[o]??null}let i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Input tidak valid: diharapkan instanceof ${o.expected}, diterima ${c}`:`Input tidak valid: diharapkan ${s}, diterima ${c}`}case"invalid_value":return o.values.length===1?`Input tidak valid: diharapkan ${O(o.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Terlalu besar: diharapkan ${o.origin??"value"} memiliki ${s}${o.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${o.origin??"value"} menjadi ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Terlalu kecil: diharapkan ${o.origin} memiliki ${s}${o.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${o.origin} menjadi ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`String tidak valid: harus dimulai dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak valid: harus berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak valid: harus menyertakan "${s.includes}"`:s.format==="regex"?`String tidak valid: harus sesuai pola ${s.pattern}`:`${i[s.format]??o.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${o.keys.length>1?"s":""}: ${b(o.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${o.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${o.origin}`;default:return"Input tidak valid"}}};function eq(){return{localeError:Sde()}}var yde=()=>{let e={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function t(o){return e[o]??null}let i={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},r={nan:"NaN",number:"n\xFAmer",array:"fylki"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${c} \xFEar sem \xE1 a\xF0 vera instanceof ${o.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${c} \xFEar sem \xE1 a\xF0 vera ${s}`}case"invalid_value":return o.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${O(o.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${o.origin??"gildi"} hafi ${s}${o.maximum.toString()} ${a.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${o.origin??"gildi"} s\xE9 ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${o.origin} hafi ${s}${o.minimum.toString()} ${a.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${o.origin} s\xE9 ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${s.prefix}"`:s.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${s.suffix}"`:s.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${s.includes}"`:s.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${s.pattern}`:`Rangt ${i[s.format]??o.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${o.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${o.keys.length>1?"ir lyklar":"ur lykill"}: ${b(o.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${o.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${o.origin}`;default:return"Rangt gildi"}}};function tq(){return{localeError:yde()}}var hde=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(o){return e[o]??null}let i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"numero",array:"vettore"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Input non valido: atteso instanceof ${o.expected}, ricevuto ${c}`:`Input non valido: atteso ${s}, ricevuto ${c}`}case"invalid_value":return o.values.length===1?`Input non valido: atteso ${O(o.values[0])}`:`Opzione non valida: atteso uno tra ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Troppo grande: ${o.origin??"valore"} deve avere ${s}${o.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${o.origin??"valore"} deve essere ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Troppo piccolo: ${o.origin} deve avere ${s}${o.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${o.origin} deve essere ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Stringa non valida: deve iniziare con "${s.prefix}"`:s.format==="ends_with"?`Stringa non valida: deve terminare con "${s.suffix}"`:s.format==="includes"?`Stringa non valida: deve includere "${s.includes}"`:s.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${s.pattern}`:`Input non valido: ${i[s.format]??o.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${o.divisor}`;case"unrecognized_keys":return`Chiav${o.keys.length>1?"i":"e"} non riconosciut${o.keys.length>1?"e":"a"}: ${b(o.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${o.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${o.origin}`;default:return"Input non valido"}}};function nq(){return{localeError:hde()}}var Ide=()=>{let e={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function t(o){return e[o]??null}let i={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},r={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${o.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${c}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${s}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${c}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return o.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${O(o.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${b(o.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let s=o.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",a=t(o.origin);return a?`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${a.unit??"\u8981\u7D20"}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${o.origin??"\u5024"}\u306F${o.maximum.toString()}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let s=o.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",a=t(o.origin);return a?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${a.unit}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${o.origin}\u306F${o.minimum.toString()}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${s.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:s.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${s.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:s.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${s.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:s.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${s.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${i[s.format]??o.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${o.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${o.keys.length>1?"\u7FA4":""}: ${b(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${o.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}};function iq(){return{localeError:Ide()}}var bde=()=>{let e={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function t(o){return e[o]??null}let i={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},r={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${o.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${c}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${s}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${c}`}case"invalid_value":return o.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${O(o.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${b(o.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${o.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${a.verb} ${s}${o.maximum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${o.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${o.origin} ${a.verb} ${s}${o.minimum.toString()} ${a.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${o.origin} \u10D8\u10E7\u10DD\u10E1 ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${s.prefix}"-\u10D8\u10D7`:s.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${s.suffix}"-\u10D8\u10D7`:s.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${s.includes}"-\u10E1`:s.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${s.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${i[s.format]??o.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${o.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${o.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${b(o.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${o.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${o.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}};function rq(){return{localeError:bde()}}var Rde=()=>{let e={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function t(o){return e[o]??null}let i={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},r={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${o.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${c}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${s} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${c}`}case"invalid_value":return o.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${O(o.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${s} ${o.maximum.toString()} ${a.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${s} ${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${s} ${o.minimum.toString()} ${a.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${o.origin} ${s} ${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${s.prefix}"`:s.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${s.suffix}"`:s.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${s.includes}"`:s.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${s.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${i[s.format]??o.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${o.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${b(o.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${o.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}};function wy(){return{localeError:Rde()}}function oq(){return wy()}var xde=()=>{let e={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function t(o){return e[o]??null}let i={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${o.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${c}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${s}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${c}\uC785\uB2C8\uB2E4`}case"invalid_value":return o.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${O(o.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${b(o.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let s=o.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",a=s==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",c=t(o.origin),d=c?.unit??"\uC694\uC18C";return c?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()}${d} ${s}${a}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${o.maximum.toString()} ${s}${a}`}case"too_small":{let s=o.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",a=s==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",c=t(o.origin),d=c?.unit??"\uC694\uC18C";return c?`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()}${d} ${s}${a}`:`${o.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${o.minimum.toString()} ${s}${a}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${s.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:s.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${s.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:s.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${s.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:s.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${s.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${i[s.format]??o.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${o.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${b(o.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${o.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${o.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}};function sq(){return{localeError:xde()}}var kp=e=>e.charAt(0).toUpperCase()+e.slice(1);function aq(e){let t=Math.abs(e),i=t%10,r=t%100;return r>=11&&r<=19||i===0?"many":i===1?"one":"few"}var Ede=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function t(o,s,a,c){let d=e[o]??null;return d===null?d:{unit:d.unit[s],verb:d.verb[c][a?"inclusive":"notInclusive"]}}let i={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},r={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Gautas tipas ${c}, o tik\u0117tasi - instanceof ${o.expected}`:`Gautas tipas ${c}, o tik\u0117tasi - ${s}`}case"invalid_value":return o.values.length===1?`Privalo b\u016Bti ${O(o.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${b(o.values,"|")} pasirinkim\u0173`;case"too_big":{let s=r[o.origin]??o.origin,a=t(o.origin,aq(Number(o.maximum)),o.inclusive??!1,"smaller");if(a?.verb)return`${kp(s??o.origin??"reik\u0161m\u0117")} ${a.verb} ${o.maximum.toString()} ${a.unit??"element\u0173"}`;let c=o.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${kp(s??o.origin??"reik\u0161m\u0117")} turi b\u016Bti ${c} ${o.maximum.toString()} ${a?.unit}`}case"too_small":{let s=r[o.origin]??o.origin,a=t(o.origin,aq(Number(o.minimum)),o.inclusive??!1,"bigger");if(a?.verb)return`${kp(s??o.origin??"reik\u0161m\u0117")} ${a.verb} ${o.minimum.toString()} ${a.unit??"element\u0173"}`;let c=o.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${kp(s??o.origin??"reik\u0161m\u0117")} turi b\u016Bti ${c} ${o.minimum.toString()} ${a?.unit}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${s.prefix}"`:s.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${s.suffix}"`:s.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${s.includes}"`:s.format==="regex"?`Eilut\u0117 privalo atitikti ${s.pattern}`:`Neteisingas ${i[s.format]??o.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${o.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${o.keys.length>1?"i":"as"} rakt${o.keys.length>1?"ai":"as"}: ${b(o.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let s=r[o.origin]??o.origin;return`${kp(s??o.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}};function cq(){return{localeError:Ede()}}var Pde=()=>{let e={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function t(o){return e[o]??null}let i={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},r={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${o.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${c}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${s}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${c}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${O(o.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${s}${o.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0438\u043C\u0430 ${s}${o.minimum.toString()} ${a.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${o.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${s.prefix}"`:s.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${s.suffix}"`:s.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${s.includes}"`:s.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${s.pattern}`:`Invalid ${i[s.format]??o.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${b(o.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${o.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${o.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}};function dq(){return{localeError:Pde()}}var kde=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(o){return e[o]??null}let i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"nombor"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Input tidak sah: dijangka instanceof ${o.expected}, diterima ${c}`:`Input tidak sah: dijangka ${s}, diterima ${c}`}case"invalid_value":return o.values.length===1?`Input tidak sah: dijangka ${O(o.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Terlalu besar: dijangka ${o.origin??"nilai"} ${a.verb} ${s}${o.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${o.origin??"nilai"} adalah ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Terlalu kecil: dijangka ${o.origin} ${a.verb} ${s}${o.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${o.origin} adalah ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`String tidak sah: mesti bermula dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak sah: mesti mengandungi "${s.includes}"`:s.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${s.pattern}`:`${i[s.format]??o.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${o.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${b(o.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${o.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${o.origin}`;default:return"Input tidak sah"}}};function uq(){return{localeError:kde()}}var vde=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(o){return e[o]??null}let i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},r={nan:"NaN",number:"getal"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Ongeldige invoer: verwacht instanceof ${o.expected}, ontving ${c}`:`Ongeldige invoer: verwacht ${s}, ontving ${c}`}case"invalid_value":return o.values.length===1?`Ongeldige invoer: verwacht ${O(o.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin),c=o.origin==="date"?"laat":o.origin==="string"?"lang":"groot";return a?`Te ${c}: verwacht dat ${o.origin??"waarde"} ${s}${o.maximum.toString()} ${a.unit??"elementen"} ${a.verb}`:`Te ${c}: verwacht dat ${o.origin??"waarde"} ${s}${o.maximum.toString()} is`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin),c=o.origin==="date"?"vroeg":o.origin==="string"?"kort":"klein";return a?`Te ${c}: verwacht dat ${o.origin} ${s}${o.minimum.toString()} ${a.unit} ${a.verb}`:`Te ${c}: verwacht dat ${o.origin} ${s}${o.minimum.toString()} is`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Ongeldige tekst: moet met "${s.prefix}" beginnen`:s.format==="ends_with"?`Ongeldige tekst: moet op "${s.suffix}" eindigen`:s.format==="includes"?`Ongeldige tekst: moet "${s.includes}" bevatten`:s.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${s.pattern}`:`Ongeldig: ${i[s.format]??o.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${o.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${o.keys.length>1?"s":""}: ${b(o.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${o.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${o.origin}`;default:return"Ongeldige invoer"}}};function lq(){return{localeError:vde()}}var _de=()=>{let e={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function t(o){return e[o]??null}let i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"tall",array:"liste"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Ugyldig input: forventet instanceof ${o.expected}, fikk ${c}`:`Ugyldig input: forventet ${s}, fikk ${c}`}case"invalid_value":return o.values.length===1?`Ugyldig verdi: forventet ${O(o.values[0])}`:`Ugyldig valg: forventet en av ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${s}${o.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${o.origin??"value"} til \xE5 ha ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`For lite(n): forventet ${o.origin} til \xE5 ha ${s}${o.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${o.origin} til \xE5 ha ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${s.pattern}`:`Ugyldig ${i[s.format]??o.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${b(o.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${o.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${o.origin}`;default:return"Ugyldig input"}}};function pq(){return{localeError:_de()}}var Ade=()=>{let e={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function t(o){return e[o]??null}let i={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},r={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`F\xE2sit giren: umulan instanceof ${o.expected}, al\u0131nan ${c}`:`F\xE2sit giren: umulan ${s}, al\u0131nan ${c}`}case"invalid_value":return o.values.length===1?`F\xE2sit giren: umulan ${O(o.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${s}${o.maximum.toString()} ${a.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${o.origin??"value"}, ${s}${o.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${s}${o.minimum.toString()} ${a.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${o.origin}, ${s}${o.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let s=o;return s.format==="starts_with"?`F\xE2sit metin: "${s.prefix}" ile ba\u015Flamal\u0131.`:s.format==="ends_with"?`F\xE2sit metin: "${s.suffix}" ile bitmeli.`:s.format==="includes"?`F\xE2sit metin: "${s.includes}" ihtiv\xE2 etmeli.`:s.format==="regex"?`F\xE2sit metin: ${s.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${i[s.format]??o.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${o.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${o.keys.length>1?"s":""}: ${b(o.keys,", ")}`;case"invalid_key":return`${o.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${o.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}};function mq(){return{localeError:Ade()}}var Ode=()=>{let e={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function t(o){return e[o]??null}let i={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},r={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${o.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${c} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${s} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${c} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return o.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${O(o.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${b(o.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${s}${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${o.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${s}${o.maximum.toString()} \u0648\u064A`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${s}${o.minimum.toString()} ${a.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${o.origin} \u0628\u0627\u06CC\u062F ${s}${o.minimum.toString()} \u0648\u064A`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${s.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:s.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${s.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:s.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${s.includes}" \u0648\u0644\u0631\u064A`:s.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${s.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${i[s.format]??o.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${o.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${o.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${b(o.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${o.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${o.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}};function fq(){return{localeError:Ode()}}var wde=()=>{let e={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function t(o){return e[o]??null}let i={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},r={nan:"NaN",number:"liczba",array:"tablica"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${o.expected}, otrzymano ${c}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${s}, otrzymano ${c}`}case"invalid_value":return o.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${O(o.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${s}${o.maximum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${s}${o.minimum.toString()} ${a.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${o.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${s.prefix}"`:s.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${s.suffix}"`:s.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${s.includes}"`:s.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${s.pattern}`:`Nieprawid\u0142ow(y/a/e) ${i[s.format]??o.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${o.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${o.keys.length>1?"s":""}: ${b(o.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${o.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${o.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}};function gq(){return{localeError:wde()}}var Tde=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(o){return e[o]??null}let i={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},r={nan:"NaN",number:"n\xFAmero",null:"nulo"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Tipo inv\xE1lido: esperado instanceof ${o.expected}, recebido ${c}`:`Tipo inv\xE1lido: esperado ${s}, recebido ${c}`}case"invalid_value":return o.values.length===1?`Entrada inv\xE1lida: esperado ${O(o.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Muito grande: esperado que ${o.origin??"valor"} tivesse ${s}${o.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${o.origin??"valor"} fosse ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Muito pequeno: esperado que ${o.origin} tivesse ${s}${o.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${o.origin} fosse ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${s.prefix}"`:s.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${s.suffix}"`:s.format==="includes"?`Texto inv\xE1lido: deve incluir "${s.includes}"`:s.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${s.pattern}`:`${i[s.format]??o.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${o.divisor}`;case"unrecognized_keys":return`Chave${o.keys.length>1?"s":""} desconhecida${o.keys.length>1?"s":""}: ${b(o.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${o.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${o.origin}`;default:return"Campo inv\xE1lido"}}};function Sq(){return{localeError:Tde()}}var Cde=()=>{let e={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function t(o){return e[o]??null}let i={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},r={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return`Intrare invalid\u0103: a\u0219teptat ${s}, primit ${c}`}case"invalid_value":return o.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${O(o.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Prea mare: a\u0219teptat ca ${o.origin??"valoarea"} ${a.verb} ${s}${o.maximum.toString()} ${a.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${o.origin??"valoarea"} s\u0103 fie ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Prea mic: a\u0219teptat ca ${o.origin} ${a.verb} ${s}${o.minimum.toString()} ${a.unit}`:`Prea mic: a\u0219teptat ca ${o.origin} s\u0103 fie ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${s.prefix}"`:s.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${s.suffix}"`:s.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${s.includes}"`:s.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${s.pattern}`:`Format invalid: ${i[s.format]??o.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${o.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${b(o.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${o.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${o.origin}`;default:return"Intrare invalid\u0103"}}};function yq(){return{localeError:Cde()}}function hq(e,t,i,r){let o=Math.abs(e),s=o%10,a=o%100;return a>=11&&a<=19?r:s===1?t:s>=2&&s<=4?i:r}var Lde=()=>{let e={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function t(o){return e[o]??null}let i={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},r={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${o.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${c}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${s}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${c}`}case"invalid_value":return o.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${O(o.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);if(a){let c=Number(o.maximum),d=hq(c,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${s}${o.maximum.toString()} ${d}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);if(a){let c=Number(o.minimum),d=hq(c,a.unit.one,a.unit.few,a.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${s}${o.minimum.toString()} ${d}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${o.origin} \u0431\u0443\u0434\u0435\u0442 ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${s.prefix}"`:s.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${s.suffix}"`:s.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${s.includes}"`:s.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${s.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${i[s.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${o.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0438":""}: ${b(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${o.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}};function Iq(){return{localeError:Lde()}}var Dde=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(o){return e[o]??null}let i={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},r={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${o.expected}, prejeto ${c}`:`Neveljaven vnos: pri\u010Dakovano ${s}, prejeto ${c}`}case"invalid_value":return o.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${O(o.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} imelo ${s}${o.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${o.origin??"vrednost"} ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Premajhno: pri\u010Dakovano, da bo ${o.origin} imelo ${s}${o.minimum.toString()} ${a.unit}`:`Premajhno: pri\u010Dakovano, da bo ${o.origin} ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${s.prefix}"`:s.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${s.suffix}"`:s.format==="includes"?`Neveljaven niz: mora vsebovati "${s.includes}"`:s.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${s.pattern}`:`Neveljaven ${i[s.format]??o.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${o.divisor}`;case"unrecognized_keys":return`Neprepoznan${o.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${b(o.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${o.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${o.origin}`;default:return"Neveljaven vnos"}}};function bq(){return{localeError:Dde()}}var $de=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function t(o){return e[o]??null}let i={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},r={nan:"NaN",number:"antal",array:"lista"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${o.expected}, fick ${c}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${s}, fick ${c}`}case"invalid_value":return o.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${O(o.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`F\xF6r stor(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${s}${o.maximum.toString()} ${a.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${o.origin??"v\xE4rdet"} att ha ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${s}${o.minimum.toString()} ${a.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${o.origin??"v\xE4rdet"} att ha ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${s.prefix}"`:s.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${s.suffix}"`:s.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${s.includes}"`:s.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${s.pattern}"`:`Ogiltig(t) ${i[s.format]??o.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${o.divisor}`;case"unrecognized_keys":return`${o.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${b(o.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${o.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${o.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}};function Rq(){return{localeError:$de()}}var Nde=()=>{let e={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function t(o){return e[o]??null}let i={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},r={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${o.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${c}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${c}`}case"invalid_value":return o.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${O(o.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${b(o.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${s}${o.maximum.toString()} ${a.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${s}${o.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${s}${o.minimum.toString()} ${a.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${o.origin} ${s}${o.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${s.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:s.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${s.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:s.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${s.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:s.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${s.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${i[s.format]??o.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${o.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${o.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${b(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${o.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}};function xq(){return{localeError:Nde()}}var jde=()=>{let e={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function t(o){return e[o]??null}let i={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},r={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${o.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${c}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${s} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${c}`}case"invalid_value":return o.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${O(o.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",a=t(o.origin);return a?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${o.maximum.toString()} ${a.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",a=t(o.origin);return a?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${o.minimum.toString()} ${a.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${o.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${s.prefix}"`:s.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${s.suffix}"`:s.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${s.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:s.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${s.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${i[s.format]??o.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${o.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${b(o.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${o.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}};function Eq(){return{localeError:jde()}}var Bde=()=>{let e={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function t(o){return e[o]??null}let i={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${o.expected}, al\u0131nan ${c}`:`Ge\xE7ersiz de\u011Fer: beklenen ${s}, al\u0131nan ${c}`}case"invalid_value":return o.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${O(o.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\xC7ok b\xFCy\xFCk: beklenen ${o.origin??"de\u011Fer"} ${s}${o.maximum.toString()} ${a.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${o.origin??"de\u011Fer"} ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\xC7ok k\xFC\xE7\xFCk: beklenen ${o.origin} ${s}${o.minimum.toString()} ${a.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${o.origin} ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Ge\xE7ersiz metin: "${s.prefix}" ile ba\u015Flamal\u0131`:s.format==="ends_with"?`Ge\xE7ersiz metin: "${s.suffix}" ile bitmeli`:s.format==="includes"?`Ge\xE7ersiz metin: "${s.includes}" i\xE7ermeli`:s.format==="regex"?`Ge\xE7ersiz metin: ${s.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${i[s.format]??o.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${o.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${o.keys.length>1?"lar":""}: ${b(o.keys,", ")}`;case"invalid_key":return`${o.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${o.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}};function Pq(){return{localeError:Bde()}}var Mde=()=>{let e={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function t(o){return e[o]??null}let i={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},r={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${o.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${c}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${s}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${c}`}case"invalid_value":return o.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${O(o.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${a.verb} ${s}${o.maximum.toString()} ${a.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} ${a.verb} ${s}${o.minimum.toString()} ${a.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${o.origin} \u0431\u0443\u0434\u0435 ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${s.prefix}"`:s.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${s.suffix}"`:s.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${s.includes}"`:s.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${s.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${i[s.format]??o.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${o.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${o.keys.length>1?"\u0456":""}: ${b(o.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${o.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${o.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}};function Ty(){return{localeError:Mde()}}function kq(){return Ty()}var Ude=()=>{let e={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function t(o){return e[o]??null}let i={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},r={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${o.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${c} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${s} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${c} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return o.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${O(o.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${b(o.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${s}${o.maximum.toString()} ${a.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${o.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${s}${o.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u06D2 ${s}${o.minimum.toString()} ${a.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${o.origin} \u06A9\u0627 ${s}${o.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${s.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:s.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${s.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:s.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${s.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:s.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${s.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${i[s.format]??o.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${o.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${o.keys.length>1?"\u0632":""}: ${b(o.keys,"\u060C ")}`;case"invalid_key":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${o.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}};function vq(){return{localeError:Ude()}}var Fde=()=>{let e={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function t(o){return e[o]??null}let i={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},r={nan:"NaN",number:"raqam",array:"massiv"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${o.expected}, qabul qilingan ${c}`:`Noto\u2018g\u2018ri kirish: kutilgan ${s}, qabul qilingan ${c}`}case"invalid_value":return o.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${O(o.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Juda katta: kutilgan ${o.origin??"qiymat"} ${s}${o.maximum.toString()} ${a.unit} ${a.verb}`:`Juda katta: kutilgan ${o.origin??"qiymat"} ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Juda kichik: kutilgan ${o.origin} ${s}${o.minimum.toString()} ${a.unit} ${a.verb}`:`Juda kichik: kutilgan ${o.origin} ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${s.prefix}" bilan boshlanishi kerak`:s.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${s.suffix}" bilan tugashi kerak`:s.format==="includes"?`Noto\u2018g\u2018ri satr: "${s.includes}" ni o\u2018z ichiga olishi kerak`:s.format==="regex"?`Noto\u2018g\u2018ri satr: ${s.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${i[s.format]??o.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${o.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${o.keys.length>1?"lar":""}: ${b(o.keys,", ")}`;case"invalid_key":return`${o.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${o.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}};function _q(){return{localeError:Fde()}}var qde=()=>{let e={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function t(o){return e[o]??null}let i={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},r={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${o.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${c}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${s}, nh\u1EADn \u0111\u01B0\u1EE3c ${c}`}case"invalid_value":return o.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${O(o.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${a.verb} ${s}${o.maximum.toString()} ${a.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${o.origin??"gi\xE1 tr\u1ECB"} ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${a.verb} ${s}${o.minimum.toString()} ${a.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${o.origin} ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${s.prefix}"`:s.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${s.suffix}"`:s.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${s.includes}"`:s.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${s.pattern}`:`${i[s.format]??o.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${o.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${b(o.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${o.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}};function Aq(){return{localeError:qde()}}var zde=()=>{let e={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function t(o){return e[o]??null}let i={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},r={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${o.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${c}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${s}\uFF0C\u5B9E\u9645\u63A5\u6536 ${c}`}case"invalid_value":return o.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${O(o.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${s}${o.maximum.toString()} ${a.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${o.origin??"\u503C"} ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${s}${o.minimum.toString()} ${a.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${o.origin} ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${s.prefix}" \u5F00\u5934`:s.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${s.suffix}" \u7ED3\u5C3E`:s.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${s.includes}"`:s.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${s.pattern}`:`\u65E0\u6548${i[s.format]??o.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${o.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${b(o.keys,", ")}`;case"invalid_key":return`${o.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${o.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}};function Oq(){return{localeError:zde()}}var Gde=()=>{let e={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function t(o){return e[o]??null}let i={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${o.expected}\uFF0C\u4F46\u6536\u5230 ${c}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${s}\uFF0C\u4F46\u6536\u5230 ${c}`}case"invalid_value":return o.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${O(o.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${s}${o.maximum.toString()} ${a.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${o.origin??"\u503C"} \u61C9\u70BA ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${s}${o.minimum.toString()} ${a.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${o.origin} \u61C9\u70BA ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${s.prefix}" \u958B\u982D`:s.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${s.suffix}" \u7D50\u5C3E`:s.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${s.includes}"`:s.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${s.pattern}`:`\u7121\u6548\u7684 ${i[s.format]??o.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${o.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${o.keys.length>1?"\u5011":""}\uFF1A${b(o.keys,"\u3001")}`;case"invalid_key":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${o.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}};function wq(){return{localeError:Gde()}}var Kde=()=>{let e={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function t(o){return e[o]??null}let i={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},r={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return o=>{switch(o.code){case"invalid_type":{let s=r[o.expected]??o.expected,a=w(o.input),c=r[a]??a;return/^[A-Z]/.test(o.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${o.expected}, \xE0m\u1ECD\u0300 a r\xED ${c}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${s}, \xE0m\u1ECD\u0300 a r\xED ${c}`}case"invalid_value":return o.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${O(o.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${b(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",a=t(o.origin);return a?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin??"iye"} ${a.verb} ${s}${o.maximum} ${a.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${s}${o.maximum}`}case"too_small":{let s=o.inclusive?">=":">",a=t(o.origin);return a?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${o.origin} ${a.verb} ${s}${o.minimum} ${a.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${s}${o.minimum}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${s.prefix}"`:s.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${s.suffix}"`:s.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${s.includes}"`:s.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${s.pattern}`:`A\u1E63\xEC\u1E63e: ${i[s.format]??o.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${o.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${b(o.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${o.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}};function Tq(){return{localeError:Kde()}}var Cq,n_=Symbol("ZodOutput"),i_=Symbol("ZodInput"),Cy=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...i){let r=i[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let i=this._map.get(t);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(t),this}get(t){let i=t._zod.parent;if(i){let r={...this.get(i)??{}};delete r.id;let o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Ly(){return new Cy}(Cq=globalThis).__zod_globalRegistry??(Cq.__zod_globalRegistry=Ly());var Gt=globalThis.__zod_globalRegistry;function r_(e,t){return new e({type:"string",...L(t)})}function o_(e,t){return new e({type:"string",coerce:!0,...L(t)})}function Dy(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...L(t)})}function _p(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...L(t)})}function $y(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...L(t)})}function Ny(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...L(t)})}function jy(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...L(t)})}function By(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...L(t)})}function Ap(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...L(t)})}function My(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...L(t)})}function Uy(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...L(t)})}function Fy(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...L(t)})}function qy(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...L(t)})}function zy(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...L(t)})}function Gy(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...L(t)})}function Ky(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...L(t)})}function Vy(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...L(t)})}function Hy(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...L(t)})}function s_(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...L(t)})}function Wy(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...L(t)})}function Xy(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...L(t)})}function Qy(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...L(t)})}function Zy(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...L(t)})}function Jy(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...L(t)})}function Yy(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...L(t)})}var a_={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function c_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...L(t)})}function d_(e,t){return new e({type:"string",format:"date",check:"string_format",...L(t)})}function u_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...L(t)})}function l_(e,t){return new e({type:"string",format:"duration",check:"string_format",...L(t)})}function p_(e,t){return new e({type:"number",checks:[],...L(t)})}function m_(e,t){return new e({type:"number",coerce:!0,checks:[],...L(t)})}function f_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...L(t)})}function g_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...L(t)})}function S_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...L(t)})}function y_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...L(t)})}function h_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...L(t)})}function I_(e,t){return new e({type:"boolean",...L(t)})}function b_(e,t){return new e({type:"boolean",coerce:!0,...L(t)})}function R_(e,t){return new e({type:"bigint",...L(t)})}function x_(e,t){return new e({type:"bigint",coerce:!0,...L(t)})}function E_(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...L(t)})}function P_(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...L(t)})}function k_(e,t){return new e({type:"symbol",...L(t)})}function v_(e,t){return new e({type:"undefined",...L(t)})}function __(e,t){return new e({type:"null",...L(t)})}function A_(e){return new e({type:"any"})}function O_(e){return new e({type:"unknown"})}function w_(e,t){return new e({type:"never",...L(t)})}function T_(e,t){return new e({type:"void",...L(t)})}function C_(e,t){return new e({type:"date",...L(t)})}function L_(e,t){return new e({type:"date",coerce:!0,...L(t)})}function D_(e,t){return new e({type:"nan",...L(t)})}function kr(e,t){return new hy({check:"less_than",...L(t),value:e,inclusive:!1})}function Jn(e,t){return new hy({check:"less_than",...L(t),value:e,inclusive:!0})}function vr(e,t){return new Iy({check:"greater_than",...L(t),value:e,inclusive:!1})}function pn(e,t){return new Iy({check:"greater_than",...L(t),value:e,inclusive:!0})}function eh(e){return vr(0,e)}function th(e){return kr(0,e)}function nh(e){return Jn(0,e)}function ih(e){return pn(0,e)}function ls(e,t){return new _k({check:"multiple_of",...L(t),value:e})}function ps(e,t){return new wk({check:"max_size",...L(t),maximum:e})}function _r(e,t){return new Tk({check:"min_size",...L(t),minimum:e})}function fa(e,t){return new Ck({check:"size_equals",...L(t),size:e})}function ga(e,t){return new Lk({check:"max_length",...L(t),maximum:e})}function ao(e,t){return new Dk({check:"min_length",...L(t),minimum:e})}function Sa(e,t){return new $k({check:"length_equals",...L(t),length:e})}function yd(e,t){return new Nk({check:"string_format",format:"regex",...L(t),pattern:e})}function hd(e){return new jk({check:"string_format",format:"lowercase",...L(e)})}function Id(e){return new Bk({check:"string_format",format:"uppercase",...L(e)})}function bd(e,t){return new Mk({check:"string_format",format:"includes",...L(t),includes:e})}function Rd(e,t){return new Uk({check:"string_format",format:"starts_with",...L(t),prefix:e})}function xd(e,t){return new Fk({check:"string_format",format:"ends_with",...L(t),suffix:e})}function rh(e,t,i){return new qk({check:"property",property:e,schema:t,...L(i)})}function Ed(e,t){return new zk({check:"mime_type",mime:e,...L(t)})}function er(e){return new Gk({check:"overwrite",tx:e})}function Pd(e){return er(t=>t.normalize(e))}function kd(){return er(e=>e.trim())}function vd(){return er(e=>e.toLowerCase())}function _d(){return er(e=>e.toUpperCase())}function Ad(){return er(e=>UP(e))}function $_(e,t,i){return new e({type:"array",element:t,...L(i)})}function Hde(e,t,i){return new e({type:"union",options:t,...L(i)})}function Wde(e,t,i){return new e({type:"union",options:t,inclusive:!1,...L(i)})}function Xde(e,t,i,r){return new e({type:"union",options:i,discriminator:t,...L(r)})}function Qde(e,t,i){return new e({type:"intersection",left:t,right:i})}function Zde(e,t,i,r){let o=i instanceof Z,s=o?r:i,a=o?i:null;return new e({type:"tuple",items:t,rest:a,...L(s)})}function Jde(e,t,i,r){return new e({type:"record",keyType:t,valueType:i,...L(r)})}function Yde(e,t,i,r){return new e({type:"map",keyType:t,valueType:i,...L(r)})}function eue(e,t,i){return new e({type:"set",valueType:t,...L(i)})}function tue(e,t,i){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:r,...L(i)})}function nue(e,t,i){return new e({type:"enum",entries:t,...L(i)})}function iue(e,t,i){return new e({type:"literal",values:Array.isArray(t)?t:[t],...L(i)})}function N_(e,t){return new e({type:"file",...L(t)})}function rue(e,t){return new e({type:"transform",transform:t})}function oue(e,t){return new e({type:"optional",innerType:t})}function sue(e,t){return new e({type:"nullable",innerType:t})}function aue(e,t,i){return new e({type:"default",innerType:t,get defaultValue(){return typeof i=="function"?i():qP(i)}})}function cue(e,t,i){return new e({type:"nonoptional",innerType:t,...L(i)})}function due(e,t){return new e({type:"success",innerType:t})}function uue(e,t,i){return new e({type:"catch",innerType:t,catchValue:typeof i=="function"?i:()=>i})}function lue(e,t,i){return new e({type:"pipe",in:t,out:i})}function pue(e,t){return new e({type:"readonly",innerType:t})}function mue(e,t,i){return new e({type:"template_literal",parts:t,...L(i)})}function fue(e,t){return new e({type:"lazy",getter:t})}function gue(e,t){return new e({type:"promise",innerType:t})}function j_(e,t,i){let r=L(i);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function B_(e,t,i){return new e({type:"custom",check:"custom",fn:t,...L(i)})}function M_(e,t){let i=Lq(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(ud(o,r.value,i._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=i),s.continue??(s.continue=!i._zod.def.abort),r.issues.push(ud(s))}},e(r.value,r)),t);return i}function Lq(e,t){let i=new Ge({check:"custom",...L(t)});return i._zod.check=e,i}function U_(e){let t=new Ge({check:"describe"});return t._zod.onattach=[i=>{let r=Gt.get(i)??{};Gt.add(i,{...r,description:e})}],t._zod.check=()=>{},t}function F_(e){let t=new Ge({check:"meta"});return t._zod.onattach=[i=>{let r=Gt.get(i)??{};Gt.add(i,{...r,...e})}],t._zod.check=()=>{},t}function q_(e,t){let i=L(t),r=i.truthy??["true","1","yes","on","y","enabled"],o=i.falsy??["false","0","no","off","n","disabled"];i.case!=="sensitive"&&(r=r.map(f=>typeof f=="string"?f.toLowerCase():f),o=o.map(f=>typeof f=="string"?f.toLowerCase():f));let s=new Set(r),a=new Set(o),c=e.Codec??Pp,d=e.Boolean??xp,u=e.String??ma,l=new u({type:"string",error:i.error}),p=new d({type:"boolean",error:i.error}),m=new c({type:"pipe",in:l,out:p,transform:((f,g)=>{let y=f;return i.case!=="sensitive"&&(y=y.toLowerCase()),s.has(y)?!0:a.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...s,...a],input:g.value,inst:m,continue:!1}),{})}),reverseTransform:((f,g)=>f===!0?r[0]||"true":o[0]||"false"),error:i.error});return m}function Od(e,t,i,r={}){let o=L(r),s={...L(r),check:"string_format",type:"string",format:t,fn:typeof i=="function"?i:c=>i.test(c),...o};return i instanceof RegExp&&(s.pattern=i),new e(s)}function ms(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Gt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function we(e,t,i={path:[],schemaPath:[]}){var r;let o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,i.schemaPath.includes(e)&&(s.cycle=i.path),s.schema;let a={schema:{},count:1,cycle:void 0,path:i.path};t.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let l={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let m=a.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let p=e._zod.parent;p&&(a.ref||(a.ref=p),we(p,t,l),t.seen.get(p).isParent=!0)}let d=t.metadataRegistry.get(e);return d&&Object.assign(a.schema,d),t.io==="input"&&mn(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function fs(e,t){let i=e.seen.get(t);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let a of e.seen.entries()){let c=e.metadataRegistry.get(a[0])?.id;if(c){let d=r.get(c);if(d&&d!==a[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,a[0])}}let o=a=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(a[0])?.id,m=e.external.uri??(g=>g);if(p)return{ref:m(p)};let f=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=f,{defId:f,ref:`${m("__shared")}#/${c}/${f}`}}if(a[1]===i)return{ref:"#"};let u=`#/${c}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=a=>{if(a[1].schema.$ref)return;let c=a[1],{ref:d,defId:u}=o(a);c.def={...c.schema},u&&(c.defId=u);let l=c.schema;for(let p in l)delete l[p];l.$ref=d};if(e.cycles==="throw")for(let a of e.seen.entries()){let c=a[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
209
|
+
|
|
210
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let c=a[1];if(t===a[0]){s(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){s(a);continue}}if(e.metadataRegistry.get(a[0])?.id){s(a);continue}if(c.cycle){s(a);continue}if(c.count>1&&e.reused==="ref"){s(a);continue}}}function gs(e,t){let i=e.seen.get(t);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=c=>{let d=e.seen.get(c);if(d.ref===null)return;let u=d.def??d.schema,l={...u},p=d.ref;if(d.ref=null,p){r(p);let f=e.seen.get(p),g=f.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):Object.assign(u,g),Object.assign(u,l),c._zod.parent===p)for(let R in u)R==="$ref"||R==="allOf"||R in l||delete u[R];if(g.$ref&&f.def)for(let R in u)R==="$ref"||R==="allOf"||R in f.def&&JSON.stringify(u[R])===JSON.stringify(f.def[R])&&delete u[R]}let m=c._zod.parent;if(m&&m!==p){r(m);let f=e.seen.get(m);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let g in u)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(u[g])===JSON.stringify(f.def[g])&&delete u[g]}e.override({zodSchema:c,jsonSchema:u,path:d.path??[]})};for(let c of[...e.seen.entries()].reverse())r(c[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Object.assign(o,i.def??i.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;let a=e.external?.defs??{};for(let c of e.seen.entries()){let d=c[1];d.def&&d.defId&&(d.def.id===d.defId&&delete d.def.id,a[d.defId]=d.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?o.$defs=a:o.definitions=a);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:wd(t,"input",e.processors),output:wd(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function mn(e,t){let i=t??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return mn(r.element,i);if(r.type==="set")return mn(r.valueType,i);if(r.type==="lazy")return mn(r.getter(),i);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return mn(r.innerType,i);if(r.type==="intersection")return mn(r.left,i)||mn(r.right,i);if(r.type==="record"||r.type==="map")return mn(r.keyType,i)||mn(r.valueType,i);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:mn(r.in,i)||mn(r.out,i);if(r.type==="object"){for(let o in r.shape)if(mn(r.shape[o],i))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(mn(o,i))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(mn(o,i))return!0;return!!(r.rest&&mn(r.rest,i))}return!1}var z_=(e,t={})=>i=>{let r=ms({...i,processors:t});return we(e,r),fs(r,e),gs(r,e)},wd=(e,t,i={})=>r=>{let{libraryOptions:o,target:s}=r??{},a=ms({...o??{},target:s,io:t,processors:i});return we(e,a),fs(a,e),gs(a,e)};var Sue={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},G_=(e,t,i,r)=>{let o=i;o.type="string";let{minimum:s,maximum:a,format:c,patterns:d,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),c&&(o.format=Sue[c]??c,o.format===""&&delete o.format,c==="time"&&delete o.format),u&&(o.contentEncoding=u),d&&d.size>0){let l=[...d];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},K_=(e,t,i,r)=>{let o=i,{minimum:s,maximum:a,format:c,multipleOf:d,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof c=="string"&&c.includes("int")?o.type="integer":o.type="number";let p=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(a??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";p?f?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof s=="number"&&(o.minimum=s),m?f?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof a=="number"&&(o.maximum=a),typeof d=="number"&&(o.multipleOf=d)},V_=(e,t,i,r)=>{i.type="boolean"},H_=(e,t,i,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},W_=(e,t,i,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},X_=(e,t,i,r)=>{t.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},Q_=(e,t,i,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Z_=(e,t,i,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},J_=(e,t,i,r)=>{i.not={}},Y_=(e,t,i,r)=>{},eA=(e,t,i,r)=>{},tA=(e,t,i,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},nA=(e,t,i,r)=>{let o=e._zod.def,s=lp(o.entries);s.every(a=>typeof a=="number")&&(i.type="number"),s.every(a=>typeof a=="string")&&(i.type="string"),i.enum=s},iA=(e,t,i,r)=>{let o=e._zod.def,s=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){let a=s[0];i.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?i.enum=[a]:i.const=a}else s.every(a=>typeof a=="number")&&(i.type="number"),s.every(a=>typeof a=="string")&&(i.type="string"),s.every(a=>typeof a=="boolean")&&(i.type="boolean"),s.every(a=>a===null)&&(i.type="null"),i.enum=s},rA=(e,t,i,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},oA=(e,t,i,r)=>{let o=i,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=s.source},sA=(e,t,i,r)=>{let o=i,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:c,mime:d}=e._zod.bag;a!==void 0&&(s.minLength=a),c!==void 0&&(s.maxLength=c),d?d.length===1?(s.contentMediaType=d[0],Object.assign(o,s)):(Object.assign(o,s),o.anyOf=d.map(u=>({contentMediaType:u}))):Object.assign(o,s)},aA=(e,t,i,r)=>{i.type="boolean"},cA=(e,t,i,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},dA=(e,t,i,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},uA=(e,t,i,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},lA=(e,t,i,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},pA=(e,t,i,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},mA=(e,t,i,r)=>{let o=i,s=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=we(s.element,t,{...r,path:[...r.path,"items"]})},fA=(e,t,i,r)=>{let o=i,s=e._zod.def;o.type="object",o.properties={};let a=s.shape;for(let u in a)o.properties[u]=we(a[u],t,{...r,path:[...r.path,"properties",u]});let c=new Set(Object.keys(a)),d=new Set([...c].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));d.size>0&&(o.required=Array.from(d)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=we(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},sh=(e,t,i,r)=>{let o=e._zod.def,s=o.inclusive===!1,a=o.options.map((c,d)=>we(c,t,{...r,path:[...r.path,s?"oneOf":"anyOf",d]}));s?i.oneOf=a:i.anyOf=a},gA=(e,t,i,r)=>{let o=e._zod.def,s=we(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=we(o.right,t,{...r,path:[...r.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,d=[...c(s)?s.allOf:[s],...c(a)?a.allOf:[a]];i.allOf=d},SA=(e,t,i,r)=>{let o=i,s=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",d=s.items.map((m,f)=>we(m,t,{...r,path:[...r.path,a,f]})),u=s.rest?we(s.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=d,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:d},u&&o.items.anyOf.push(u),o.minItems=d.length,u||(o.maxItems=d.length)):(o.items=d,u&&(o.additionalItems=u));let{minimum:l,maximum:p}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof p=="number"&&(o.maxItems=p)},yA=(e,t,i,r)=>{let o=i,s=e._zod.def;o.type="object";let a=s.keyType,d=a._zod.bag?.patterns;if(s.mode==="loose"&&d&&d.size>0){let l=we(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let p of d)o.patternProperties[p.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=we(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=we(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(o.required=l)}},hA=(e,t,i,r)=>{let o=e._zod.def,s=we(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,i.nullable=!0):i.anyOf=[s,{type:"null"}]},IA=(e,t,i,r)=>{let o=e._zod.def;we(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType},bA=(e,t,i,r)=>{let o=e._zod.def;we(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType,i.default=JSON.parse(JSON.stringify(o.defaultValue))},RA=(e,t,i,r)=>{let o=e._zod.def;we(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(i._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},xA=(e,t,i,r)=>{let o=e._zod.def;we(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}i.default=a},EA=(e,t,i,r)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?s?o.out:o.in:o.out;we(a,t,r);let c=t.seen.get(e);c.ref=a},PA=(e,t,i,r)=>{let o=e._zod.def;we(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType,i.readOnly=!0},kA=(e,t,i,r)=>{let o=e._zod.def;we(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType},ah=(e,t,i,r)=>{let o=e._zod.def;we(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType},vA=(e,t,i,r)=>{let o=e._zod.innerType;we(o,t,r);let s=t.seen.get(e);s.ref=o},oh={string:G_,number:K_,boolean:V_,bigint:H_,symbol:W_,null:X_,undefined:Q_,void:Z_,never:J_,any:Y_,unknown:eA,date:tA,enum:nA,literal:iA,nan:rA,template_literal:oA,file:sA,success:aA,custom:cA,function:dA,transform:uA,map:lA,set:pA,array:mA,object:fA,union:sh,intersection:gA,tuple:SA,record:yA,nullable:hA,nonoptional:IA,default:bA,prefault:RA,catch:xA,pipe:EA,readonly:PA,promise:kA,optional:ah,lazy:vA};function ch(e,t){if("_idmap"in e){let r=e,o=ms({...t,processors:oh}),s={};for(let d of r._idmap.entries()){let[u,l]=d;we(l,o)}let a={},c={registry:r,uri:t?.uri,defs:s};o.external=c;for(let d of r._idmap.entries()){let[u,l]=d;fs(o,l),a[u]=gs(o,l)}if(Object.keys(s).length>0){let d=o.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[d]:s}}return{schemas:a}}let i=ms({...t,processors:oh});return we(e,i),fs(i,e),gs(i,e)}var dh=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let i=t?.target??"draft-2020-12";i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),this.ctx=ms({processors:oh,target:i,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,i={path:[],schemaPath:[]}){return we(t,this.ctx,i)}emit(t,i){i&&(i.cycles&&(this.ctx.cycles=i.cycles),i.reused&&(this.ctx.reused=i.reused),i.external&&(this.ctx.external=i.external)),fs(this.ctx,t);let r=gs(this.ctx,t),{"~standard":o,...s}=r;return s}};var Dq={};var Op={};Ht(Op,{ZodAny:()=>QA,ZodArray:()=>eO,ZodBase64:()=>wh,ZodBase64URL:()=>Th,ZodBigInt:()=>Bd,ZodBigIntFormat:()=>Dh,ZodBoolean:()=>jd,ZodCIDRv4:()=>Ah,ZodCIDRv6:()=>Oh,ZodCUID:()=>Rh,ZodCUID2:()=>xh,ZodCatch:()=>xO,ZodCodec:()=>Fp,ZodCustom:()=>qp,ZodCustomStringFormat:()=>$d,ZodDate:()=>Np,ZodDefault:()=>SO,ZodDiscriminatedUnion:()=>nO,ZodE164:()=>Ch,ZodEmail:()=>hh,ZodEmoji:()=>Ih,ZodEnum:()=>Ld,ZodExactOptional:()=>mO,ZodFile:()=>lO,ZodFunction:()=>CO,ZodGUID:()=>Tp,ZodIPv4:()=>vh,ZodIPv6:()=>_h,ZodIntersection:()=>iO,ZodJWT:()=>Lh,ZodKSUID:()=>kh,ZodLazy:()=>OO,ZodLiteral:()=>uO,ZodMAC:()=>zA,ZodMap:()=>cO,ZodNaN:()=>PO,ZodNanoID:()=>bh,ZodNever:()=>JA,ZodNonOptional:()=>Uh,ZodNull:()=>WA,ZodNullable:()=>gO,ZodNumber:()=>Nd,ZodNumberFormat:()=>ha,ZodObject:()=>Bp,ZodOptional:()=>Mh,ZodPipe:()=>Up,ZodPrefault:()=>hO,ZodPreprocess:()=>kO,ZodPromise:()=>TO,ZodReadonly:()=>vO,ZodRecord:()=>Cd,ZodSet:()=>dO,ZodString:()=>Dd,ZodStringFormat:()=>Me,ZodSuccess:()=>RO,ZodSymbol:()=>VA,ZodTemplateLiteral:()=>AO,ZodTransform:()=>pO,ZodTuple:()=>oO,ZodType:()=>te,ZodULID:()=>Eh,ZodURL:()=>$p,ZodUUID:()=>Ar,ZodUndefined:()=>HA,ZodUnion:()=>Mp,ZodUnknown:()=>ZA,ZodVoid:()=>YA,ZodXID:()=>Ph,ZodXor:()=>tO,_ZodString:()=>yh,_default:()=>yO,_function:()=>zz,any:()=>bz,array:()=>jp,base64:()=>iz,base64url:()=>rz,bigint:()=>gz,boolean:()=>KA,catch:()=>EO,check:()=>Gz,cidrv4:()=>tz,cidrv6:()=>nz,codec:()=>Mz,cuid:()=>Hq,cuid2:()=>Wq,custom:()=>Kz,date:()=>xz,describe:()=>Vz,discriminatedUnion:()=>Az,e164:()=>oz,email:()=>jq,emoji:()=>Kq,enum:()=>jh,exactOptional:()=>fO,file:()=>$z,float32:()=>lz,float64:()=>pz,function:()=>zz,guid:()=>Bq,hash:()=>uz,hex:()=>dz,hostname:()=>cz,httpUrl:()=>Gq,instanceof:()=>Wz,int:()=>gh,int32:()=>mz,int64:()=>Sz,intersection:()=>rO,invertCodec:()=>Uz,ipv4:()=>Jq,ipv6:()=>ez,json:()=>Qz,jwt:()=>sz,keyof:()=>Ez,ksuid:()=>Zq,lazy:()=>wO,literal:()=>Dz,looseObject:()=>vz,looseRecord:()=>wz,mac:()=>Yq,map:()=>Tz,meta:()=>Hz,nan:()=>Bz,nanoid:()=>Vq,nativeEnum:()=>Lz,never:()=>$h,nonoptional:()=>bO,null:()=>XA,nullable:()=>Lp,nullish:()=>Nz,number:()=>GA,object:()=>Pz,optional:()=>Cp,partialRecord:()=>Oz,pipe:()=>Sh,prefault:()=>IO,preprocess:()=>Zz,promise:()=>qz,readonly:()=>_O,record:()=>aO,refine:()=>LO,set:()=>Cz,strictObject:()=>kz,string:()=>wp,stringFormat:()=>az,stringbool:()=>Xz,success:()=>jz,superRefine:()=>DO,symbol:()=>hz,templateLiteral:()=>Fz,transform:()=>Bh,tuple:()=>sO,uint32:()=>fz,uint64:()=>yz,ulid:()=>Xq,undefined:()=>Iz,union:()=>Nh,unknown:()=>ya,url:()=>zq,uuid:()=>Mq,uuidv4:()=>Uq,uuidv6:()=>Fq,uuidv7:()=>qq,void:()=>Rz,xid:()=>Qq,xor:()=>_z});var uh={};Ht(uh,{endsWith:()=>xd,gt:()=>vr,gte:()=>pn,includes:()=>bd,length:()=>Sa,lowercase:()=>hd,lt:()=>kr,lte:()=>Jn,maxLength:()=>ga,maxSize:()=>ps,mime:()=>Ed,minLength:()=>ao,minSize:()=>_r,multipleOf:()=>ls,negative:()=>th,nonnegative:()=>ih,nonpositive:()=>nh,normalize:()=>Pd,overwrite:()=>er,positive:()=>eh,property:()=>rh,regex:()=>yd,size:()=>fa,slugify:()=>Ad,startsWith:()=>Rd,toLowerCase:()=>vd,toUpperCase:()=>_d,trim:()=>kd,uppercase:()=>Id});var Td={};Ht(Td,{ZodISODate:()=>ph,ZodISODateTime:()=>lh,ZodISODuration:()=>fh,ZodISOTime:()=>mh,date:()=>AA,datetime:()=>_A,duration:()=>wA,time:()=>OA});var lh=I("ZodISODateTime",(e,t)=>{rv.init(e,t),Me.init(e,t)});function _A(e){return c_(lh,e)}var ph=I("ZodISODate",(e,t)=>{ov.init(e,t),Me.init(e,t)});function AA(e){return d_(ph,e)}var mh=I("ZodISOTime",(e,t)=>{sv.init(e,t),Me.init(e,t)});function OA(e){return u_(mh,e)}var fh=I("ZodISODuration",(e,t)=>{av.init(e,t),Me.init(e,t)});function wA(e){return l_(fh,e)}var $q=(e,t)=>{Sp.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:i=>hp(e,i)},flatten:{value:i=>yp(e,i)},addIssue:{value:i=>{e.issues.push(i),e.message=JSON.stringify(e.issues,cd,2)}},addIssues:{value:i=>{e.issues.push(...i),e.message=JSON.stringify(e.issues,cd,2)}},isEmpty:{get(){return e.issues.length===0}}})},hue=I("ZodError",$q),Tn=I("ZodError",$q,{Parent:Error});var TA=ld(Tn),CA=pd(Tn),LA=md(Tn),DA=fd(Tn),$A=cy(Tn),NA=dy(Tn),jA=uy(Tn),BA=ly(Tn),MA=py(Tn),UA=my(Tn),FA=fy(Tn),qA=gy(Tn);var Nq=new WeakMap;function Dp(e,t,i){let r=Object.getPrototypeOf(e),o=Nq.get(r);if(o||(o=new Set,Nq.set(r,o)),!o.has(t)){o.add(t);for(let s in i){let a=i[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){let c=a.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}var te=I("ZodType",(e,t)=>(Z.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:wd(e,"input"),output:wd(e,"output")}}),e.toJSONSchema=z_(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(i,r)=>TA(e,i,r,{callee:e.parse}),e.safeParse=(i,r)=>LA(e,i,r),e.parseAsync=async(i,r)=>CA(e,i,r,{callee:e.parseAsync}),e.safeParseAsync=async(i,r)=>DA(e,i,r),e.spa=e.safeParseAsync,e.encode=(i,r)=>$A(e,i,r),e.decode=(i,r)=>NA(e,i,r),e.encodeAsync=async(i,r)=>jA(e,i,r),e.decodeAsync=async(i,r)=>BA(e,i,r),e.safeEncode=(i,r)=>MA(e,i,r),e.safeDecode=(i,r)=>UA(e,i,r),e.safeEncodeAsync=async(i,r)=>FA(e,i,r),e.safeDecodeAsync=async(i,r)=>qA(e,i,r),Dp(e,"ZodType",{check(...i){let r=this.def;return this.clone(T.mergeDefs(r,{checks:[...r.checks??[],...i.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...i){return this.check(...i)},clone(i,r){return un(this,i,r)},brand(){return this},register(i,r){return i.add(this,r),this},refine(i,r){return this.check(LO(i,r))},superRefine(i,r){return this.check(DO(i,r))},overwrite(i){return this.check(er(i))},optional(){return Cp(this)},exactOptional(){return fO(this)},nullable(){return Lp(this)},nullish(){return Cp(Lp(this))},nonoptional(i){return bO(this,i)},array(){return jp(this)},or(i){return Nh([this,i])},and(i){return rO(this,i)},transform(i){return Sh(this,Bh(i))},default(i){return yO(this,i)},prefault(i){return IO(this,i)},catch(i){return EO(this,i)},pipe(i){return Sh(this,i)},readonly(){return _O(this)},describe(i){let r=this.clone();return Gt.add(r,{description:i}),r},meta(...i){if(i.length===0)return Gt.get(this);let r=this.clone();return Gt.add(r,i[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(i){return i(this)}}),Object.defineProperty(e,"description",{get(){return Gt.get(e)?.description},configurable:!0}),e)),yh=I("_ZodString",(e,t)=>{ma.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,s)=>G_(e,r,o,s);let i=e._zod.bag;e.format=i.format??null,e.minLength=i.minimum??null,e.maxLength=i.maximum??null,Dp(e,"_ZodString",{regex(...r){return this.check(yd(...r))},includes(...r){return this.check(bd(...r))},startsWith(...r){return this.check(Rd(...r))},endsWith(...r){return this.check(xd(...r))},min(...r){return this.check(ao(...r))},max(...r){return this.check(ga(...r))},length(...r){return this.check(Sa(...r))},nonempty(...r){return this.check(ao(1,...r))},lowercase(r){return this.check(hd(r))},uppercase(r){return this.check(Id(r))},trim(){return this.check(kd())},normalize(...r){return this.check(Pd(...r))},toLowerCase(){return this.check(vd())},toUpperCase(){return this.check(_d())},slugify(){return this.check(Ad())}})}),Dd=I("ZodString",(e,t)=>{ma.init(e,t),yh.init(e,t),e.email=i=>e.check(Dy(hh,i)),e.url=i=>e.check(Ap($p,i)),e.jwt=i=>e.check(Yy(Lh,i)),e.emoji=i=>e.check(My(Ih,i)),e.guid=i=>e.check(_p(Tp,i)),e.uuid=i=>e.check($y(Ar,i)),e.uuidv4=i=>e.check(Ny(Ar,i)),e.uuidv6=i=>e.check(jy(Ar,i)),e.uuidv7=i=>e.check(By(Ar,i)),e.nanoid=i=>e.check(Uy(bh,i)),e.guid=i=>e.check(_p(Tp,i)),e.cuid=i=>e.check(Fy(Rh,i)),e.cuid2=i=>e.check(qy(xh,i)),e.ulid=i=>e.check(zy(Eh,i)),e.base64=i=>e.check(Qy(wh,i)),e.base64url=i=>e.check(Zy(Th,i)),e.xid=i=>e.check(Gy(Ph,i)),e.ksuid=i=>e.check(Ky(kh,i)),e.ipv4=i=>e.check(Vy(vh,i)),e.ipv6=i=>e.check(Hy(_h,i)),e.cidrv4=i=>e.check(Wy(Ah,i)),e.cidrv6=i=>e.check(Xy(Oh,i)),e.e164=i=>e.check(Jy(Ch,i)),e.datetime=i=>e.check(_A(i)),e.date=i=>e.check(AA(i)),e.time=i=>e.check(OA(i)),e.duration=i=>e.check(wA(i))});function wp(e){return r_(Dd,e)}var Me=I("ZodStringFormat",(e,t)=>{Be.init(e,t),yh.init(e,t)}),hh=I("ZodEmail",(e,t)=>{Xk.init(e,t),Me.init(e,t)});function jq(e){return Dy(hh,e)}var Tp=I("ZodGUID",(e,t)=>{Hk.init(e,t),Me.init(e,t)});function Bq(e){return _p(Tp,e)}var Ar=I("ZodUUID",(e,t)=>{Wk.init(e,t),Me.init(e,t)});function Mq(e){return $y(Ar,e)}function Uq(e){return Ny(Ar,e)}function Fq(e){return jy(Ar,e)}function qq(e){return By(Ar,e)}var $p=I("ZodURL",(e,t)=>{Qk.init(e,t),Me.init(e,t)});function zq(e){return Ap($p,e)}function Gq(e){return Ap($p,{protocol:Zn.httpProtocol,hostname:Zn.domain,...T.normalizeParams(e)})}var Ih=I("ZodEmoji",(e,t)=>{Zk.init(e,t),Me.init(e,t)});function Kq(e){return My(Ih,e)}var bh=I("ZodNanoID",(e,t)=>{Jk.init(e,t),Me.init(e,t)});function Vq(e){return Uy(bh,e)}var Rh=I("ZodCUID",(e,t)=>{Yk.init(e,t),Me.init(e,t)});function Hq(e){return Fy(Rh,e)}var xh=I("ZodCUID2",(e,t)=>{ev.init(e,t),Me.init(e,t)});function Wq(e){return qy(xh,e)}var Eh=I("ZodULID",(e,t)=>{tv.init(e,t),Me.init(e,t)});function Xq(e){return zy(Eh,e)}var Ph=I("ZodXID",(e,t)=>{nv.init(e,t),Me.init(e,t)});function Qq(e){return Gy(Ph,e)}var kh=I("ZodKSUID",(e,t)=>{iv.init(e,t),Me.init(e,t)});function Zq(e){return Ky(kh,e)}var vh=I("ZodIPv4",(e,t)=>{cv.init(e,t),Me.init(e,t)});function Jq(e){return Vy(vh,e)}var zA=I("ZodMAC",(e,t)=>{uv.init(e,t),Me.init(e,t)});function Yq(e){return s_(zA,e)}var _h=I("ZodIPv6",(e,t)=>{dv.init(e,t),Me.init(e,t)});function ez(e){return Hy(_h,e)}var Ah=I("ZodCIDRv4",(e,t)=>{lv.init(e,t),Me.init(e,t)});function tz(e){return Wy(Ah,e)}var Oh=I("ZodCIDRv6",(e,t)=>{pv.init(e,t),Me.init(e,t)});function nz(e){return Xy(Oh,e)}var wh=I("ZodBase64",(e,t)=>{fv.init(e,t),Me.init(e,t)});function iz(e){return Qy(wh,e)}var Th=I("ZodBase64URL",(e,t)=>{gv.init(e,t),Me.init(e,t)});function rz(e){return Zy(Th,e)}var Ch=I("ZodE164",(e,t)=>{Sv.init(e,t),Me.init(e,t)});function oz(e){return Jy(Ch,e)}var Lh=I("ZodJWT",(e,t)=>{yv.init(e,t),Me.init(e,t)});function sz(e){return Yy(Lh,e)}var $d=I("ZodCustomStringFormat",(e,t)=>{hv.init(e,t),Me.init(e,t)});function az(e,t,i={}){return Od($d,e,t,i)}function cz(e){return Od($d,"hostname",Zn.hostname,e)}function dz(e){return Od($d,"hex",Zn.hex,e)}function uz(e,t){let i=t?.enc??"hex",r=`${e}_${i}`,o=Zn[r];if(!o)throw new Error(`Unrecognized hash format: ${r}`);return Od($d,r,o,t)}var Nd=I("ZodNumber",(e,t)=>{Py.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,s)=>K_(e,r,o,s),Dp(e,"ZodNumber",{gt(r,o){return this.check(vr(r,o))},gte(r,o){return this.check(pn(r,o))},min(r,o){return this.check(pn(r,o))},lt(r,o){return this.check(kr(r,o))},lte(r,o){return this.check(Jn(r,o))},max(r,o){return this.check(Jn(r,o))},int(r){return this.check(gh(r))},safe(r){return this.check(gh(r))},positive(r){return this.check(vr(0,r))},nonnegative(r){return this.check(pn(0,r))},negative(r){return this.check(kr(0,r))},nonpositive(r){return this.check(Jn(0,r))},multipleOf(r,o){return this.check(ls(r,o))},step(r,o){return this.check(ls(r,o))},finite(){return this}});let i=e._zod.bag;e.minValue=Math.max(i.minimum??Number.NEGATIVE_INFINITY,i.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(i.maximum??Number.POSITIVE_INFINITY,i.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(i.format??"").includes("int")||Number.isSafeInteger(i.multipleOf??.5),e.isFinite=!0,e.format=i.format??null});function GA(e){return p_(Nd,e)}var ha=I("ZodNumberFormat",(e,t)=>{Iv.init(e,t),Nd.init(e,t)});function gh(e){return f_(ha,e)}function lz(e){return g_(ha,e)}function pz(e){return S_(ha,e)}function mz(e){return y_(ha,e)}function fz(e){return h_(ha,e)}var jd=I("ZodBoolean",(e,t)=>{xp.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>V_(e,i,r,o)});function KA(e){return I_(jd,e)}var Bd=I("ZodBigInt",(e,t)=>{ky.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,s)=>H_(e,r,o,s),e.gte=(r,o)=>e.check(pn(r,o)),e.min=(r,o)=>e.check(pn(r,o)),e.gt=(r,o)=>e.check(vr(r,o)),e.gte=(r,o)=>e.check(pn(r,o)),e.min=(r,o)=>e.check(pn(r,o)),e.lt=(r,o)=>e.check(kr(r,o)),e.lte=(r,o)=>e.check(Jn(r,o)),e.max=(r,o)=>e.check(Jn(r,o)),e.positive=r=>e.check(vr(BigInt(0),r)),e.negative=r=>e.check(kr(BigInt(0),r)),e.nonpositive=r=>e.check(Jn(BigInt(0),r)),e.nonnegative=r=>e.check(pn(BigInt(0),r)),e.multipleOf=(r,o)=>e.check(ls(r,o));let i=e._zod.bag;e.minValue=i.minimum??null,e.maxValue=i.maximum??null,e.format=i.format??null});function gz(e){return R_(Bd,e)}var Dh=I("ZodBigIntFormat",(e,t)=>{bv.init(e,t),Bd.init(e,t)});function Sz(e){return E_(Dh,e)}function yz(e){return P_(Dh,e)}var VA=I("ZodSymbol",(e,t)=>{Rv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>W_(e,i,r,o)});function hz(e){return k_(VA,e)}var HA=I("ZodUndefined",(e,t)=>{xv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>Q_(e,i,r,o)});function Iz(e){return v_(HA,e)}var WA=I("ZodNull",(e,t)=>{Ev.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>X_(e,i,r,o)});function XA(e){return __(WA,e)}var QA=I("ZodAny",(e,t)=>{Pv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>Y_(e,i,r,o)});function bz(){return A_(QA)}var ZA=I("ZodUnknown",(e,t)=>{kv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>eA(e,i,r,o)});function ya(){return O_(ZA)}var JA=I("ZodNever",(e,t)=>{vv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>J_(e,i,r,o)});function $h(e){return w_(JA,e)}var YA=I("ZodVoid",(e,t)=>{_v.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>Z_(e,i,r,o)});function Rz(e){return T_(YA,e)}var Np=I("ZodDate",(e,t)=>{Av.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,s)=>tA(e,r,o,s),e.min=(r,o)=>e.check(pn(r,o)),e.max=(r,o)=>e.check(Jn(r,o));let i=e._zod.bag;e.minDate=i.minimum?new Date(i.minimum):null,e.maxDate=i.maximum?new Date(i.maximum):null});function xz(e){return C_(Np,e)}var eO=I("ZodArray",(e,t)=>{Ov.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>mA(e,i,r,o),e.element=t.element,Dp(e,"ZodArray",{min(i,r){return this.check(ao(i,r))},nonempty(i){return this.check(ao(1,i))},max(i,r){return this.check(ga(i,r))},length(i,r){return this.check(Sa(i,r))},unwrap(){return this.element}})});function jp(e,t){return $_(eO,e,t)}function Ez(e){let t=e._zod.def.shape;return jh(Object.keys(t))}var Bp=I("ZodObject",(e,t)=>{wv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>fA(e,i,r,o),T.defineLazy(e,"shape",()=>t.shape),Dp(e,"ZodObject",{keyof(){return jh(Object.keys(this._zod.def.shape))},catchall(i){return this.clone({...this._zod.def,catchall:i})},passthrough(){return this.clone({...this._zod.def,catchall:ya()})},loose(){return this.clone({...this._zod.def,catchall:ya()})},strict(){return this.clone({...this._zod.def,catchall:$h()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(i){return T.extend(this,i)},safeExtend(i){return T.safeExtend(this,i)},merge(i){return T.merge(this,i)},pick(i){return T.pick(this,i)},omit(i){return T.omit(this,i)},partial(...i){return T.partial(Mh,this,i[0])},required(...i){return T.required(Uh,this,i[0])}})});function Pz(e,t){let i={type:"object",shape:e??{},...T.normalizeParams(t)};return new Bp(i)}function kz(e,t){return new Bp({type:"object",shape:e,catchall:$h(),...T.normalizeParams(t)})}function vz(e,t){return new Bp({type:"object",shape:e,catchall:ya(),...T.normalizeParams(t)})}var Mp=I("ZodUnion",(e,t)=>{Ep.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>sh(e,i,r,o),e.options=t.options});function Nh(e,t){return new Mp({type:"union",options:e,...T.normalizeParams(t)})}var tO=I("ZodXor",(e,t)=>{Mp.init(e,t),Tv.init(e,t),e._zod.processJSONSchema=(i,r,o)=>sh(e,i,r,o),e.options=t.options});function _z(e,t){return new tO({type:"union",options:e,inclusive:!1,...T.normalizeParams(t)})}var nO=I("ZodDiscriminatedUnion",(e,t)=>{Mp.init(e,t),Cv.init(e,t)});function Az(e,t,i){return new nO({type:"union",options:t,discriminator:e,...T.normalizeParams(i)})}var iO=I("ZodIntersection",(e,t)=>{Lv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>gA(e,i,r,o)});function rO(e,t){return new iO({type:"intersection",left:e,right:t})}var oO=I("ZodTuple",(e,t)=>{vy.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>SA(e,i,r,o),e.rest=i=>e.clone({...e._zod.def,rest:i})});function sO(e,t,i){let r=t instanceof Z,o=r?i:t,s=r?t:null;return new oO({type:"tuple",items:e,rest:s,...T.normalizeParams(o)})}var Cd=I("ZodRecord",(e,t)=>{Dv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>yA(e,i,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function aO(e,t,i){return!t||!t._zod?new Cd({type:"record",keyType:wp(),valueType:e,...T.normalizeParams(t)}):new Cd({type:"record",keyType:e,valueType:t,...T.normalizeParams(i)})}function Oz(e,t,i){let r=un(e);return r._zod.values=void 0,new Cd({type:"record",keyType:r,valueType:t,...T.normalizeParams(i)})}function wz(e,t,i){return new Cd({type:"record",keyType:e,valueType:t,mode:"loose",...T.normalizeParams(i)})}var cO=I("ZodMap",(e,t)=>{$v.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>lA(e,i,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...i)=>e.check(_r(...i)),e.nonempty=i=>e.check(_r(1,i)),e.max=(...i)=>e.check(ps(...i)),e.size=(...i)=>e.check(fa(...i))});function Tz(e,t,i){return new cO({type:"map",keyType:e,valueType:t,...T.normalizeParams(i)})}var dO=I("ZodSet",(e,t)=>{Nv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>pA(e,i,r,o),e.min=(...i)=>e.check(_r(...i)),e.nonempty=i=>e.check(_r(1,i)),e.max=(...i)=>e.check(ps(...i)),e.size=(...i)=>e.check(fa(...i))});function Cz(e,t){return new dO({type:"set",valueType:e,...T.normalizeParams(t)})}var Ld=I("ZodEnum",(e,t)=>{jv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,s)=>nA(e,r,o,s),e.enum=t.entries,e.options=Object.values(t.entries);let i=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let s={};for(let a of r)if(i.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Ld({...t,checks:[],...T.normalizeParams(o),entries:s})},e.exclude=(r,o)=>{let s={...t.entries};for(let a of r)if(i.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new Ld({...t,checks:[],...T.normalizeParams(o),entries:s})}});function jh(e,t){let i=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ld({type:"enum",entries:i,...T.normalizeParams(t)})}function Lz(e,t){return new Ld({type:"enum",entries:e,...T.normalizeParams(t)})}var uO=I("ZodLiteral",(e,t)=>{Bv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>iA(e,i,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Dz(e,t){return new uO({type:"literal",values:Array.isArray(e)?e:[e],...T.normalizeParams(t)})}var lO=I("ZodFile",(e,t)=>{Mv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>sA(e,i,r,o),e.min=(i,r)=>e.check(_r(i,r)),e.max=(i,r)=>e.check(ps(i,r)),e.mime=(i,r)=>e.check(Ed(Array.isArray(i)?i:[i],r))});function $z(e){return N_(lO,e)}var pO=I("ZodTransform",(e,t)=>{Uv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>uA(e,i,r,o),e._zod.parse=(i,r)=>{if(r.direction==="backward")throw new ss(e.constructor.name);i.addIssue=s=>{if(typeof s=="string")i.issues.push(T.issue(s,i.value,t));else{let a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=i.value),a.inst??(a.inst=e),i.issues.push(T.issue(a))}};let o=t.transform(i.value,i);return o instanceof Promise?o.then(s=>(i.value=s,i.fallback=!0,i)):(i.value=o,i.fallback=!0,i)}});function Bh(e){return new pO({type:"transform",transform:e})}var Mh=I("ZodOptional",(e,t)=>{_y.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>ah(e,i,r,o),e.unwrap=()=>e._zod.def.innerType});function Cp(e){return new Mh({type:"optional",innerType:e})}var mO=I("ZodExactOptional",(e,t)=>{Fv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>ah(e,i,r,o),e.unwrap=()=>e._zod.def.innerType});function fO(e){return new mO({type:"optional",innerType:e})}var gO=I("ZodNullable",(e,t)=>{qv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>hA(e,i,r,o),e.unwrap=()=>e._zod.def.innerType});function Lp(e){return new gO({type:"nullable",innerType:e})}function Nz(e){return Cp(Lp(e))}var SO=I("ZodDefault",(e,t)=>{zv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>bA(e,i,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function yO(e,t){return new SO({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():T.shallowClone(t)}})}var hO=I("ZodPrefault",(e,t)=>{Gv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>RA(e,i,r,o),e.unwrap=()=>e._zod.def.innerType});function IO(e,t){return new hO({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():T.shallowClone(t)}})}var Uh=I("ZodNonOptional",(e,t)=>{Kv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>IA(e,i,r,o),e.unwrap=()=>e._zod.def.innerType});function bO(e,t){return new Uh({type:"nonoptional",innerType:e,...T.normalizeParams(t)})}var RO=I("ZodSuccess",(e,t)=>{Vv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>aA(e,i,r,o),e.unwrap=()=>e._zod.def.innerType});function jz(e){return new RO({type:"success",innerType:e})}var xO=I("ZodCatch",(e,t)=>{Hv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>xA(e,i,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function EO(e,t){return new xO({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var PO=I("ZodNaN",(e,t)=>{Wv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>rA(e,i,r,o)});function Bz(e){return D_(PO,e)}var Up=I("ZodPipe",(e,t)=>{Ay.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>EA(e,i,r,o),e.in=t.in,e.out=t.out});function Sh(e,t){return new Up({type:"pipe",in:e,out:t})}var Fp=I("ZodCodec",(e,t)=>{Up.init(e,t),Pp.init(e,t)});function Mz(e,t,i){return new Fp({type:"pipe",in:e,out:t,transform:i.decode,reverseTransform:i.encode})}function Uz(e){let t=e._zod.def;return new Fp({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var kO=I("ZodPreprocess",(e,t)=>{Up.init(e,t),Xv.init(e,t)}),vO=I("ZodReadonly",(e,t)=>{Qv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>PA(e,i,r,o),e.unwrap=()=>e._zod.def.innerType});function _O(e){return new vO({type:"readonly",innerType:e})}var AO=I("ZodTemplateLiteral",(e,t)=>{Zv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>oA(e,i,r,o)});function Fz(e,t){return new AO({type:"template_literal",parts:e,...T.normalizeParams(t)})}var OO=I("ZodLazy",(e,t)=>{e_.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>vA(e,i,r,o),e.unwrap=()=>e._zod.def.getter()});function wO(e){return new OO({type:"lazy",getter:e})}var TO=I("ZodPromise",(e,t)=>{Yv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>kA(e,i,r,o),e.unwrap=()=>e._zod.def.innerType});function qz(e){return new TO({type:"promise",innerType:e})}var CO=I("ZodFunction",(e,t)=>{Jv.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>dA(e,i,r,o)});function zz(e){return new CO({type:"function",input:Array.isArray(e?.input)?sO(e?.input):e?.input??jp(ya()),output:e?.output??ya()})}var qp=I("ZodCustom",(e,t)=>{t_.init(e,t),te.init(e,t),e._zod.processJSONSchema=(i,r,o)=>cA(e,i,r,o)});function Gz(e){let t=new Ge({check:"custom"});return t._zod.check=e,t}function Kz(e,t){return j_(qp,e??(()=>!0),t)}function LO(e,t={}){return B_(qp,e,t)}function DO(e,t){return M_(e,t)}var Vz=U_,Hz=F_;function Wz(e,t={}){let i=new qp({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...T.normalizeParams(t)});return i._zod.bag.Class=e,i._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:i,path:[...i._zod.def.path??[]]})},i}var Xz=(...e)=>q_({Codec:Fp,Boolean:jd,String:Dd},...e);function Qz(e){let t=wO(()=>Nh([wp(e),GA(),KA(),XA(),jp(t),aO(wp(),t)]));return t}function Zz(e,t){return new kO({type:"pipe",in:Bh(e),out:t})}var bue={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Rue(e){mt({customError:e})}function xue(){return mt().customError}var $O;$O||($O={});var j={...Op,...uh,iso:Td},Eue=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Pue(e,t){let i=e.$schema;return i==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":i==="http://json-schema.org/draft-07/schema#"?"draft-7":i==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function kue(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let i=e.slice(1).split("/").filter(Boolean);if(i.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(i[0]===r){let o=i[1];if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}function Jz(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return j.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return j.lazy(()=>{if(!t.refs.has(o))throw new Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);let s=kue(o,t),a=en(s,t);return t.refs.set(o,a),t.processing.delete(o),a}if(e.enum!==void 0){let o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return j.null();if(o.length===0)return j.never();if(o.length===1)return j.literal(o[0]);if(o.every(a=>typeof a=="string"))return j.enum(o);let s=o.map(a=>j.literal(a));return s.length<2?s[0]:j.union([s[0],s[1],...s.slice(2)])}if(e.const!==void 0)return j.literal(e.const);let i=e.type;if(Array.isArray(i)){let o=i.map(s=>{let a={...e,type:s};return Jz(a,t)});return o.length===0?j.never():o.length===1?o[0]:j.union(o)}if(!i)return j.any();let r;switch(i){case"string":{let o=j.string();if(e.format){let s=e.format;s==="email"?o=o.check(j.email()):s==="uri"||s==="uri-reference"?o=o.check(j.url()):s==="uuid"||s==="guid"?o=o.check(j.uuid()):s==="date-time"?o=o.check(j.iso.datetime()):s==="date"?o=o.check(j.iso.date()):s==="time"?o=o.check(j.iso.time()):s==="duration"?o=o.check(j.iso.duration()):s==="ipv4"?o=o.check(j.ipv4()):s==="ipv6"?o=o.check(j.ipv6()):s==="mac"?o=o.check(j.mac()):s==="cidr"?o=o.check(j.cidrv4()):s==="cidr-v6"?o=o.check(j.cidrv6()):s==="base64"?o=o.check(j.base64()):s==="base64url"?o=o.check(j.base64url()):s==="e164"?o=o.check(j.e164()):s==="jwt"?o=o.check(j.jwt()):s==="emoji"?o=o.check(j.emoji()):s==="nanoid"?o=o.check(j.nanoid()):s==="cuid"?o=o.check(j.cuid()):s==="cuid2"?o=o.check(j.cuid2()):s==="ulid"?o=o.check(j.ulid()):s==="xid"?o=o.check(j.xid()):s==="ksuid"&&(o=o.check(j.ksuid()))}typeof e.minLength=="number"&&(o=o.min(e.minLength)),typeof e.maxLength=="number"&&(o=o.max(e.maxLength)),e.pattern&&(o=o.regex(new RegExp(e.pattern))),r=o;break}case"number":case"integer":{let o=i==="integer"?j.number().int():j.number();typeof e.minimum=="number"&&(o=o.min(e.minimum)),typeof e.maximum=="number"&&(o=o.max(e.maximum)),typeof e.exclusiveMinimum=="number"?o=o.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(o=o.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?o=o.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(o=o.lt(e.maximum)),typeof e.multipleOf=="number"&&(o=o.multipleOf(e.multipleOf)),r=o;break}case"boolean":{r=j.boolean();break}case"null":{r=j.null();break}case"object":{let o={},s=e.properties||{},a=new Set(e.required||[]);for(let[d,u]of Object.entries(s)){let l=en(u,t);o[d]=a.has(d)?l:l.optional()}if(e.propertyNames){let d=en(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties=="object"?en(e.additionalProperties,t):j.any();if(Object.keys(o).length===0){r=j.record(d,u);break}let l=j.object(o).passthrough(),p=j.looseRecord(d,u);r=j.intersection(l,p);break}if(e.patternProperties){let d=e.patternProperties,u=Object.keys(d),l=[];for(let m of u){let f=en(d[m],t),g=j.string().regex(new RegExp(m));l.push(j.looseRecord(g,f))}let p=[];if(Object.keys(o).length>0&&p.push(j.object(o).passthrough()),p.push(...l),p.length===0)r=j.object({}).passthrough();else if(p.length===1)r=p[0];else{let m=j.intersection(p[0],p[1]);for(let f=2;f<p.length;f++)m=j.intersection(m,p[f]);r=m}break}let c=j.object(o);e.additionalProperties===!1?r=c.strict():typeof e.additionalProperties=="object"?r=c.catchall(en(e.additionalProperties,t)):r=c.passthrough();break}case"array":{let o=e.prefixItems,s=e.items;if(o&&Array.isArray(o)){let a=o.map(d=>en(d,t)),c=s&&typeof s=="object"&&!Array.isArray(s)?en(s,t):void 0;c?r=j.tuple(a).rest(c):r=j.tuple(a),typeof e.minItems=="number"&&(r=r.check(j.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(j.maxLength(e.maxItems)))}else if(Array.isArray(s)){let a=s.map(d=>en(d,t)),c=e.additionalItems&&typeof e.additionalItems=="object"?en(e.additionalItems,t):void 0;c?r=j.tuple(a).rest(c):r=j.tuple(a),typeof e.minItems=="number"&&(r=r.check(j.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(j.maxLength(e.maxItems)))}else if(s!==void 0){let a=en(s,t),c=j.array(a);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),r=c}else r=j.array(j.any());break}default:throw new Error(`Unsupported type: ${i}`)}return r}function en(e,t){if(typeof e=="boolean")return e?j.any():j.never();let i=Jz(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(u=>en(u,t)),d=j.union(c);i=r?j.intersection(i,d):d}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(u=>en(u,t)),d=j.xor(c);i=r?j.intersection(i,d):d}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)i=r?i:j.any();else{let c=r?i:en(e.allOf[0],t),d=r?0:1;for(let u=d;u<e.allOf.length;u++)c=j.intersection(c,en(e.allOf[u],t));i=c}e.nullable===!0&&t.version==="openapi-3.0"&&(i=j.nullable(i)),e.readOnly===!0&&(i=j.readonly(i)),e.default!==void 0&&(i=i.default(e.default));let o={},s=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of s)c in e&&(o[c]=e[c]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let c of a)c in e&&(o[c]=e[c]);for(let c of Object.keys(e))Eue.has(c)||(o[c]=e[c]);return Object.keys(o).length>0&&t.registry.add(i,o),e.description&&(i=i.describe(e.description)),i}function Yz(e,t){if(typeof e=="boolean")return e?j.any():j.never();let i;try{i=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=Pue(i,t?.defaultTarget),o=i.$defs||i.definitions||{},s={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:i,registry:t?.registry??Gt};return en(i,s)}var NO={};Ht(NO,{bigint:()=>Oue,boolean:()=>Aue,date:()=>wue,number:()=>_ue,string:()=>vue});function vue(e){return o_(Dd,e)}function _ue(e){return m_(Nd,e)}function Aue(e){return b_(jd,e)}function Oue(e){return x_(Bd,e)}function wue(e){return L_(Np,e)}mt(Oy());function Tue(e){let t=e.replace(/^\[[ xX]\]\s*/,"");return t=t.replace(/^\d+[.)]\s+/,""),t=t.replace(/^[-*+]\s+/,""),t=t.replace(/^\[[ xX]\]\s*/,""),t}function Cue(e){return Tue(e.trim()).replace(/\s+/g," ").trim()}function Lue(e){return e.endsWith(":")}function Due(e){return/^`[^`]+`\.?\s*$/.test(e)||/^run\s+(?:pnpm|npm|yarn|bun)\s+[\w:-]+\.?$/i.test(e)}var $ue=/\b(?:manually\s+(?:verify|check|inspect|confirm)|manual\s+(?:verification|check|inspection)(?!\s+notes)|visually\s+(?:verify|inspect|check|confirm)|visual\s+(?:inspection|verification|check)|(?:check|inspect|verify)\s+in\s+(?:the\s+)?browser)\b/i,Nue=/(?:`[^`]+`.*\b(?:exits?\s+0|passes?|completes?\s+without\s+errors?|returns?\s+HTTP\s+\d{3}|responds?\s+with)\b|\b(?:exits?\s+0|completes?\s+without\s+errors?|returns?\s+HTTP\s+\d{3}|responds?\s+with|API\s+returns?|route\s+(?:responds?|returns?)|(?:API|route|endpoint)\s+returns?\s+status\s+\d{3}|emits?\s+(?:an?\s+)?(?:`[^`]+`|[\w:-]+)\s+event|(?:tests?|test\s+suite|type\s+checking|validation(?:\s+command)?|command|build|lint|compile)\s+passes?|(?:file|directory|path|`[^`]+`|[./\w-]+\/[./\w-]+|[\w-]+\.[\w-]+)\s+contains?|JSON\s+matches?|schema\s+validates?|validation\s+command\s+(?:exits?\s+0|completes?\s+without\s+errors?))\b)/i;function jue(e){return Nue.test(e)}function Bue(e){return/^manual\s+verification\s+notes:?$/i.test(e)?!1:$ue.test(e)&&!jue(e)}var Mue=/^(works?|improves?|handles?|fixes?|addresses?|makes?\s+\w+\s+(?:faster|better|more\s+\w+)|ensures?\s+(?:it\s+works|correct|proper|better)|allows?|supports?|provides?\s+better)\b/i;function Uue(e){return/`[^`]+`/.test(e)||/[A-Z][a-z]+[A-Z]|[a-z][A-Z]/.test(e)||/\d/.test(e)||/\/|\.(?:[a-z]{2,4})\b/.test(e)?!1:Mue.test(e)}function e1(e){let t=Cue(e);return t===""?null:Lue(t)?{kind:"grouping-label",line:e,message:`"${t}" is a grouping label, not a standalone criterion. Acceptance criteria must not use bullets ending in ":" to introduce nested sub-criteria.`,suggestion:"Replace this grouping label with individual standalone criterion bullets \u2014 each a complete, verifiable statement."}:Due(t)?{kind:"bare-command",line:e,message:`"${t}" is a bare command fragment. Acceptance criteria must state the expected outcome, not just a command to run.`,suggestion:'Append the expected outcome after the command, e.g., change "`pnpm type-check`." to "`pnpm type-check` exits 0."'}:Bue(t)?{kind:"manual-only",line:e,message:`"${t}" depends on manual or visual verification without objective automation evidence. Hard-gated acceptance criteria must be automatable and objectively verifiable.`,suggestion:"Replace this item with an automatable criterion that states a concrete command, API, file, event, JSON/schema, or route outcome; or move the manual/visual detail to non-gating Manual Verification Notes."}:Uue(t)?{kind:"vague",line:e,message:`"${t}" is too vague to be objectively verified. Acceptance criteria must state a specific, observable behavior or outcome.`,suggestion:"Replace with a concrete, testable criterion that names a specific behavior, command, event, file, or API response."}:null}function zp(e){let t=[],i=e.split(`
|
|
211
|
+
`);for(let r of i){let o=r.trim();if(o==="")continue;let s=/^[-*+]\s/.test(o),a=/^\d+[.)]\s/.test(o),c=/^\[[ xX]\]/.test(o);if(!s&&!a&&!c)continue;let d=e1(o);d&&t.push(d)}return{valid:t.length===0,diagnostics:t}}import{realpath as t1}from"fs/promises";import{isAbsolute as Fue,relative as que,sep as zue}from"path";async function jO(e,t){let i=await t1(xr({cwd:e,segments:["session-plans"]})),r=await t1(t),o=que(i,r);if(o===".."||o.startsWith(".."+zue)||Fue(o))throw new Error(`Resolved path "${t}" escapes .eforge/session-plans/ via a symlink`)}var Vue=X.object({name:X.string(),reason:X.string()}),s1=X.object({session:X.string(),topic:X.string(),created:X.string().optional(),status:X.enum(["planning","ready","abandoned","submitted"]),planning_type:X.enum(["bugfix","feature","refactor","architecture","docs","maintenance","unknown"]),planning_depth:X.enum(["quick","focused","deep"]),confidence:X.enum(["high","medium","low"]).optional(),eforge_session:X.string().optional(),required_dimensions:X.array(X.string()).default([]),optional_dimensions:X.array(X.string()).default([]),skipped_dimensions:X.array(Vue).default([]),open_questions:X.array(X.string()).default([]),profile:X.enum(["errand","excursion","expedition"]).nullable().default(null),agent_profile:X.string().optional()}).passthrough();function Md(e){return xr({cwd:e,segments:["session-plans"]})}function Hue(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)/);if(!t)return[{},e];let i=(0,qh.parse)(t[1]);return[i&&typeof i=="object"?i:{},t[2]]}function UO(e){let t=new Map,i=e.split(/\r?\n/),r=null,o=[];function s(){r!==null&&t.set(r,o.join(`
|
|
212
|
+
`).trim()),o.length=0}for(let a of i){let c=a.match(/^##\s+(.+)$/);c?(s(),r=c[1].trim().toLowerCase()):r!==null&&o.push(a)}return s(),t}function a1(e){return e.toLowerCase().replace(/-/g," ")}var Wue=/^(tbd|n\/a|none|todo|placeholder|\s*)$/i;function Xue(e){return e.split(`
|
|
213
|
+
`).some(t=>t.trim()!==""&&!Wue.test(t.trim()))}function Que(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Zue(e,t,i){let r=Que(t),o=a1(t),s=e.split(`
|
|
214
|
+
`),a=[];for(let m=0;m<s.length;m++){let f=s[m].match(/^##\s+(.+)$/);f&&a.push({idx:m,key:f[1].trim().toLowerCase()})}let c=[];for(let m=0;m<a.length;m++)if(a[m].key===o){let f=a[m].idx,g=a[m+1]?.idx??s.length;c.push({start:f,end:g})}let d=[`## ${r}`,"",...i.trim().split(`
|
|
215
|
+
`),""];if(c.length===0)return e.trimEnd()+`
|
|
216
|
+
|
|
217
|
+
`+d.join(`
|
|
218
|
+
`);let u=c[0].start,l=new Set;for(let m of c)for(let f=m.start;f<m.end;f++)l.add(f);let p=[];for(let m=0;m<s.length;m++)m===u&&p.push(...d),l.has(m)||p.push(s[m]);return p.join(`
|
|
219
|
+
`)}var BO=["acceptance-criteria","assumptions-and-validation"],Jue={bugfix:{required:["problem-statement","reproduction-steps","root-cause","acceptance-criteria","assumptions-and-validation"],optional:["code-impact","risks"]},feature:{required:["problem-statement","scope","acceptance-criteria","code-impact","design-decisions","assumptions-and-validation"],optional:["architecture-impact","documentation-impact","risks"]},refactor:{required:["scope","code-impact","acceptance-criteria","assumptions-and-validation"],optional:["design-decisions","risks"]},architecture:{required:["scope","architecture-impact","design-decisions","acceptance-criteria","assumptions-and-validation"],optional:["code-impact","documentation-impact","risks"]},docs:{required:["scope","documentation-impact","acceptance-criteria","assumptions-and-validation"],optional:["code-impact"]},maintenance:{required:["scope","code-impact","acceptance-criteria","assumptions-and-validation"],optional:["risks"]},unknown:{required:["scope","code-impact","architecture-impact","design-decisions","documentation-impact","risks","acceptance-criteria","assumptions-and-validation"],optional:[]}};function Ia(e,t){let i=Jue[e];if(t==="quick"){let r=i.required[0]??"scope",o=i.required.filter(a=>a!==r&&!BO.includes(a)).slice(0,1);return{required:[...new Set([r,...o,...BO])],optional:[...i.optional]}}return t==="deep"?{required:[...i.required],optional:[...i.optional]}:{required:[...i.required],optional:[]}}var Yue=["scope","code-impact","architecture-impact","design-decisions","documentation-impact","risks",...BO];function zh(e){let[t,i]=Hue(e),r=s1.safeParse(t);if(!r.success){let s=r.error.issues.map(a=>(a.path.length>0?a.path.join(".")+": ":"")+a.message);throw new Error(`Invalid session plan frontmatter: ${s.join("; ")}`)}let o=UO(i);return{...r.data,body:i,sections:o}}function FO(e){let{body:t,sections:i,...r}=e,o=r;delete o.dimensions;for(let a of Object.keys(o))a.startsWith("seeded_from_")&&delete o[a];return`---
|
|
220
|
+
${(0,qh.stringify)(o,{lineWidth:0})}---
|
|
221
|
+
${t}`}async function qO(e){let t=Md(e.cwd),i;try{i=await Gue(t)}catch{return[]}let r=i.filter(a=>a.endsWith(".md")).sort(),o=new Set(e.statuses),s=[];return await Promise.all(r.map(async a=>{let c=MO(t,a);try{await jO(e.cwd,c);let d=await n1(c,"utf-8"),u=zh(d);o.has(u.status)&&s.push({session:u.session,topic:u.topic,status:u.status,path:c,...u.status==="submitted"&&u.eforge_session!==void 0&&{eforge_session:u.eforge_session}})}catch{}})),s.sort((a,c)=>a.session.localeCompare(c.session)),s}function Gh(e){let t=e.skipped_dimensions.map(r=>r.name);if(e.required_dimensions.length>0)return{required:e.required_dimensions,optional:e.optional_dimensions,skipped:t};let i=Ia(e.planning_type,e.planning_depth);return{required:[...i.required],optional:[...i.optional],skipped:t}}function Yn(e){let t=new Set(e.skipped_dimensions.map(c=>c.name)),{required:i}=Gh(e),r=[],o=[],s;for(let c of i){if(t.has(c))continue;let d=a1(c),u=e.sections.get(d)??"";if(Xue(u)){if(o.push(c),c==="acceptance-criteria"){let l=zp(u);l.valid||(s=l.diagnostics)}}else r.push(c)}return{ready:r.length===0&&s===void 0,missingDimensions:r,coveredDimensions:o,skippedDimensions:e.skipped_dimensions.map(c=>c.name),...s!==void 0&&{acDiagnostics:s}}}function ba(e){let t=e.planningType??"unknown",i=e.planningDepth??"focused",r=`
|
|
222
|
+
# ${e.topic}
|
|
223
|
+
`,o=e.agentProfile?.trim();return{session:e.session,topic:e.topic,status:"planning",planning_type:t,planning_depth:i,required_dimensions:[],optional_dimensions:[],skipped_dimensions:[],open_questions:[],profile:e.profile??null,...o!==void 0&&o.length>0&&{agent_profile:o},body:r,sections:UO(r)}}function Or(e,t,i){let r=Zue(e.body,t,i);return{...e,body:r,sections:UO(r)}}function Ra(e,t,i){let r=e.skipped_dimensions.filter(o=>o.name!==t);return{...e,skipped_dimensions:[...r,{name:t,reason:i}]}}function zO(e,t,i){if(t==="submitted"){if(!i?.eforge_session)throw new Error('eforge_session is required in metadata when setting status to "submitted"');return{...e,status:t,eforge_session:i.eforge_session}}return{...e,status:t}}function xa(e,t){let i=t.planningType??e.planning_type,r=t.planningDepth??e.planning_depth;if(!t.overwrite&&e.required_dimensions.length>0)return{...e,planning_type:i,planning_depth:r};let o=Ia(i,r);return{...e,planning_type:i,planning_depth:r,required_dimensions:[...o.required],optional_dimensions:[...o.optional]}}function Ea(e){if(e.session.length===0||e.session.includes("/")||e.session.includes("\\")||e.session==="."||e.session==="..")throw new Error(`Invalid session identifier "${e.session}": must be a flat filename without path separators`);let t=Md(e.cwd),i=MO(t,`${e.session}.md`),r=t.endsWith(Fh)?t:t+Fh;if(!i.startsWith(r))throw new Error(`Session identifier "${e.session}" would escape .eforge/session-plans/`);return i}async function ei(e){let t=Ea(e);await jO(e.cwd,t);let i=await n1(t,"utf-8");return zh(i)}function c1(e){let t=Md(e.cwd),i=t.endsWith(Fh)?t:t+Fh;if(e.path!==void 0){let o=MO(e.path);if(!o.startsWith(i))throw new Error(`writeSessionPlan: path "${e.path}" would escape .eforge/session-plans/`);return{sessionPlansDir:t,filePath:o}}let r=e.session??e.plan.session;return{sessionPlansDir:t,filePath:Ea({cwd:e.cwd,session:r})}}async function Cn(e){let{filePath:t}=c1(e),i=FO(e.plan);await r1(o1(t),{recursive:!0});let r=t+".tmp";await i1(r,i,"utf-8"),await Kue(r,t)}async function d1(e){let{filePath:t}=c1(e),i=FO(e.plan);await r1(o1(t),{recursive:!0}),await i1(t,i,{encoding:"utf-8",flag:"wx"})}function GO(e){let i=e.dimensions;return!i||typeof i!="object"||i===null||Array.isArray(i)?e:{...e,planning_type:"unknown",planning_depth:e.planning_depth==="unknown"?"focused":e.planning_depth,required_dimensions:Yue,optional_dimensions:[]}}function u1(e){let t=e.body.replace(/^\s*#[^\n]*\n*/,"").trim(),i=[`# ${e.topic}`];return t&&i.push("",t),i.join(`
|
|
224
|
+
`)}function ele(e){let t=e.replace(/\\/g,"/");return/\/.eforge\/session-plans\/[^/]+\.md$/.test(t)}function Pa(e){if(!ele(e.sourcePath))return{sourcePath:e.sourcePath,content:e.content};let t=zh(e.content),i=u1(t),r={sourcePath:e.sourcePath,content:i};if(typeof t.agent_profile=="string"){let o=t.agent_profile.trim();o.length>0&&(r.agentProfile=o)}return r}function KO(e){let t=Ia(e.planningType,e.planningDepth),i=new Set(t.required),r=l1([...e.sections.map(p=>p.dimension).filter(p=>!i.has(p)),...(e.skippedDimensions??[]).map(p=>p.dimension).filter(p=>!i.has(p))]),o=l1((e.skippedDimensions??[]).filter(p=>i.has(p.dimension)&&p.reason.trim().length===0).map(p=>p.dimension)),s=ba({session:e.session,topic:e.topic,planningType:e.planningType,planningDepth:e.planningDepth});s=xa(s,{planningType:e.planningType,planningDepth:e.planningDepth,overwrite:!0});let c=e.sections.filter(p=>p.dimension==="acceptance-criteria").flatMap(p=>{let m=zp(p.content);return m.valid?[]:m.diagnostics});for(let p of e.sections)i.has(p.dimension)&&(s=Or(s,p.dimension,p.content));for(let p of e.skippedDimensions??[])i.has(p.dimension)&&p.reason.trim().length>0&&(s=Ra(s,p.dimension,p.reason));let d=Yn(s),u=tle({planningType:e.planningType,planningDepth:e.planningDepth,requiredDimensions:[...t.required],unknownDimensions:r,missingDimensions:d.missingDimensions,blankSkippedDimensions:o,acDiagnostics:c.length>0?c:d.acDiagnostics}),l=r.length===0&&d.missingDimensions.length===0&&o.length===0&&c.length===0&&d.acDiagnostics===void 0;return{valid:l,planningType:e.planningType,planningDepth:e.planningDepth,requiredDimensions:[...t.required],optionalDimensions:[...t.optional],unknownDimensions:r,missingDimensions:d.missingDimensions,skippedDimensions:d.skippedDimensions,coveredDimensions:d.coveredDimensions,blankSkippedDimensions:o,...c.length>0?{acDiagnostics:c}:d.acDiagnostics!==void 0?{acDiagnostics:d.acDiagnostics}:{},messages:l?[]:u}}function tle(e){let t=[`sessionPlanCreationDraft readiness failed for ${e.planningType}/${e.planningDepth}.`,`expected required dimension ids: ${e.requiredDimensions.join(", ")}`];return e.unknownDimensions.length>0&&t.push(`unknown dimension ids: ${e.unknownDimensions.join(", ")}`),e.missingDimensions.length>0&&t.push(`missing required dimension ids: ${e.missingDimensions.join(", ")}`),e.blankSkippedDimensions.length>0&&t.push(`${e.blankSkippedDimensions.join(", ")} has a blank skip reason; skipped required dimensions need non-empty reasons.`),e.acDiagnostics!==void 0&&t.push(`acceptance criteria diagnostics: ${e.acDiagnostics.map(nle).join("; ")}`),t.push("Do not use display-heading aliases as dimension ids; use exact kebab-case ids, not Goal, Scope, or Validation."),t}function nle(e){return`${e.message} (${e.line}) ${e.suggestion}`}function l1(e){return[...new Set(e)]}var Ud="plan-set.yaml",VO=["planning","ready","submitted","abandoned"],HO=["sequential","parallel","dag"],WO=["plan","note","reference"],p1=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Kh=X.enum(VO),XO=X.enum(HO),QO=X.enum(WO),Vh=X.object({kind:X.string(),ref:X.string(),url:X.string().optional(),title:X.string().optional()}).passthrough(),ZO=X.object({id:X.string().regex(p1,"must be a lower-case slug"),title:X.string(),file:X.string(),kind:QO,buildable:X.boolean(),status:Kh,profile:X.string().optional(),dependsOn:X.array(X.string()).default([]),externalRefs:X.array(Vh).default([])}).passthrough(),Hh=X.object({id:X.string().regex(p1,"must be a lower-case slug"),title:X.string(),status:Kh,strategy:XO,anchor:X.string().optional(),children:X.array(ZO).default([]),externalRefs:X.array(Vh).default([])}).passthrough();var JO=Po(Zr(),1);function Gp(e){let t;try{t=(0,JO.parse)(e)}catch(r){throw new Error(`Invalid session plan-set manifest YAML: ${r.message}`)}let i=Hh.safeParse(t);if(!i.success){let r=i.error.issues.map(o=>(o.path.length>0?o.path.join(".")+": ":"")+o.message);throw new Error(`Invalid session plan-set manifest: ${r.join("; ")}`)}return i.data}import{resolve as YO,isAbsolute as ile,sep as m1}from"path";var rle=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function Fd(e){return xr({cwd:e,segments:["session-plans"]})}function ew(e){return e.length>0&&e!=="."&&e!==".."&&!e.includes("/")&&!e.includes("\\")&&rle.test(e)}function ole(e){if(!ew(e))throw new Error(`Invalid session plan-set id "${e}": must be a lower-case slug without path separators`)}function f1(e){return e.endsWith(m1)?e:e+m1}function ka(e){ole(e.planSetId);let t=Fd(e.cwd),i=YO(t,e.planSetId);if(!i.startsWith(f1(t)))throw new Error(`Session plan-set id "${e.planSetId}" would escape .eforge/session-plans/`);return i}function Wh(e){return YO(ka(e),Ud)}function sle(e,t){if(e.length===0)throw new Error(`Invalid ${t} "${e}": must not be empty`);if(ile(e)||e.startsWith("/"))throw new Error(`Invalid ${t} "${e}": must be a relative path`);if(e.includes("\\"))throw new Error(`Invalid ${t} "${e}": must not contain backslash separators`);let i=e.split("/");for(let o of i){if(o==="")throw new Error(`Invalid ${t} "${e}": must not contain empty path segments`);if(o==="."||o==="..")throw new Error(`Invalid ${t} "${e}": must not contain "." or ".." segments`)}if(!i[i.length-1].toLowerCase().endsWith(".md"))throw new Error(`Invalid ${t} "${e}": must be a markdown (.md) file`)}function g1(e,t,i){sle(t,i);let r=YO(e,t);if(!r.startsWith(f1(e)))throw new Error(`Invalid ${i} "${t}": would escape the plan-set directory`);return r}function Xh(e){let t=ka(e);return g1(t,e.anchor,"session plan-set anchor")}function Qh(e){let t=ka(e);return g1(t,e.childFile,"session plan-set child file")}var h1=Po(Zr(),1);import{readFile as Zh,readdir as ale,realpath as S1}from"fs/promises";import{isAbsolute as cle,relative as dle,resolve as y1,sep as ule}from"path";async function Jh(e){let t=Fd(e.cwd),i;try{i=await ale(t,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return[];throw o}let r=[];return await Promise.all(i.map(async o=>{if(!o.isDirectory()||!ew(o.name))return;let s=y1(t,o.name),a=y1(s,Ud),c;try{c=await Zh(a,"utf-8")}catch{return}let d;try{d=Gp(c)}catch{return}r.push({id:d.id,planSetId:o.name,title:d.title,status:d.status,strategy:d.strategy,dir:s,manifestPath:a,childCount:d.children.length})})),r.sort((o,s)=>o.id.localeCompare(s.id)),r}async function I1(e,t){let i=await S1(Fd(e)),r=await S1(t),o=dle(i,r);if(o===".."||o.startsWith(".."+ule)||cle(o))throw new Error(`Resolved path "${t}" escapes .eforge/session-plans/ via a symlink`)}function lle(e){let t=e.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);if(!t)return{};try{let i=(0,h1.parse)(t[1]);return i&&typeof i=="object"&&!Array.isArray(i)?{frontmatter:i}:{}}catch(i){return{error:i.message}}}async function ple(e,t,i){let r;try{r=Xh({cwd:e,planSetId:t,anchor:i})}catch(o){return{anchor:i,path:"",exists:!1,pathError:o.message}}try{await I1(e,r)}catch(o){return o.code==="ENOENT"?{anchor:i,path:r,exists:!1}:{anchor:i,path:r,exists:!1,pathError:o.message}}try{let o=await Zh(r,"utf-8");return{anchor:i,path:r,exists:!0,content:o}}catch{return{anchor:i,path:r,exists:!1}}}async function mle(e,t,i){let r;try{r=Qh({cwd:e,planSetId:t,childFile:i.file})}catch(c){return{child:i,path:"",file:i.file,exists:!1,pathError:c.message}}try{await I1(e,r)}catch(c){return c.code==="ENOENT"?{child:i,path:r,file:i.file,exists:!1}:{child:i,path:r,file:i.file,exists:!1,pathError:c.message}}let o;try{o=await Zh(r,"utf-8")}catch{return{child:i,path:r,file:i.file,exists:!1}}let s={child:i,path:r,file:i.file,exists:!0,content:o},a=lle(o);return"error"in a?s.frontmatterError=a.error:a.frontmatter!==void 0&&(s.frontmatter=a.frontmatter),s}async function qd(e){let t=ka(e),i=Wh(e),r=await Zh(i,"utf-8"),o=Gp(r),s;o.anchor!==void 0&&(s=await ple(e.cwd,e.planSetId,o.anchor));let a=await Promise.all(o.children.map(d=>mle(e.cwd,e.planSetId,d))),c={id:o.id,dir:t,manifestPath:i,manifest:o,children:a};return s!==void 0&&(c.anchor=s),c}function b1(e){return e.map(t=>{let i={kind:t.kind,ref:t.ref};return t.url!==void 0&&(i.url=t.url),t.title!==void 0&&(i.title=t.title),i})}function fle(e){let t=[],i=new Set;for(let r of e.manifest.children)i.has(r.id)?t.push({severity:"error",code:"duplicate-child-id",message:`Duplicate child id "${r.id}"`,childId:r.id}):i.add(r.id);return t}function gle(e){let t=[],i=new Set;for(let r of e.manifest.children)i.has(r.file)?t.push({severity:"error",code:"duplicate-child-file",message:`Duplicate child file "${r.file}"`,childId:r.id,file:r.file}):i.add(r.file);return t}function Sle(e){let t=[],i=new Set(e.manifest.children.map(r=>r.id));for(let r of e.manifest.children)for(let o of r.dependsOn)i.has(o)||t.push({severity:"error",code:"unknown-child-dependency",message:`Child "${r.id}" depends on unknown child "${o}"`,childId:r.id,dependency:o});return t}function yle(e){let t=e.anchor;return t===void 0?[]:t.pathError!==void 0?[{severity:"error",code:"invalid-anchor-path",message:`Invalid umbrella anchor path "${t.anchor}": ${t.pathError}`,file:t.anchor}]:t.exists?[]:[{severity:"error",code:"missing-anchor",message:`Umbrella anchor file "${t.anchor}" does not exist`,file:t.anchor,path:t.path}]}function hle(e){let t=[];for(let i of e.children)i.pathError!==void 0?t.push({severity:"error",code:"invalid-child-path",message:`Invalid child path "${i.file}": ${i.pathError}`,childId:i.child.id,file:i.file}):i.exists?i.frontmatterError!==void 0&&t.push({severity:"error",code:"child-frontmatter-parse-error",message:`Child "${i.child.id}" has malformed frontmatter: ${i.frontmatterError}`,childId:i.child.id,file:i.file}):t.push({severity:"error",code:"missing-child-file",message:`Child file "${i.file}" does not exist`,childId:i.child.id,file:i.file,path:i.path});return t}function Ile(e){return[...fle(e),...gle(e),...Sle(e),...yle(e),...hle(e)]}function tw(e,t=[]){let i=e.children.map(o=>{let s=t.filter(c=>c.childId===o.child.id).length,a={id:o.child.id,file:o.file,kind:o.child.kind,buildable:o.child.buildable,status:o.child.status,dependsOn:o.child.dependsOn,exists:o.exists,externalRefs:b1(o.child.externalRefs),validation:{ok:s===0,diagnosticCount:s}};return o.child.profile!==void 0&&(a.profile=o.child.profile),a}),r={id:e.manifest.id,title:e.manifest.title,status:e.manifest.status,strategy:e.manifest.strategy,children:i,diagnostics:t,externalRefs:b1(e.manifest.externalRefs)};return e.anchor!==void 0&&(r.anchor={file:e.anchor.anchor,path:e.anchor.path,exists:e.anchor.exists}),r}function Kp(e){let t=Ile(e),i=tw(e,t);return{ok:t.length===0,diagnostics:t,summary:i}}async function Yh(e){let t=await qd(e);return Kp(t)}var R1={id:"builtin:session-planning",kind:"workflow-input-adapter",sourceScope:"project-local"},eI=class extends Error{code="session-plan-readiness-failed";readiness;constructor(t,i="Session plan readiness failed"){super(i),this.name="SessionPlanReadinessError",this.readiness=t}};function Rle(e){return e===!0?["planning","ready","submitted"]:["planning","ready"]}async function xle(e){let t=await qO({cwd:e.cwd,statuses:Rle(e.includeSubmitted)});return Promise.all(t.map(async i=>{try{let r=await ei({cwd:e.cwd,session:i.session}),o=Yn(r);return{...i,ready:o.ready,missingDimensions:o.missingDimensions}}catch{return{...i,ready:!1,missingDimensions:[]}}}))}async function Ele(e){let t=await ei(e);return{plan:t,readiness:Yn(t),path:Ea(e)}}async function Ple(e){let t=ba(e);return await d1({cwd:e.cwd,plan:t}),{plan:t,path:Ea({cwd:e.cwd,session:t.session})}}async function kle(e){let t=await ei(e),i=Or(t,e.dimension,e.content);return await Cn({cwd:e.cwd,plan:i}),{plan:i,readiness:Yn(i)}}async function vle(e){let t=await ei(e),i=Ra(t,e.dimension,e.reason);return await Cn({cwd:e.cwd,plan:i}),{plan:i,readiness:Yn(i)}}function _le(e){let t=Yn(e);if(!t.ready){let i=[];throw t.missingDimensions.length&&i.push(`missing required dimensions: ${t.missingDimensions.join(", ")}`),t.acDiagnostics?.length&&i.push(`acceptance criteria quality issues: ${t.acDiagnostics.map(r=>r.message).join("; ")}`),new eI(t,`Cannot mark session plan ready${i.length?`: ${i.join("; ")}`:": readiness checks failed"}`)}}async function Ale(e){let t=await ei(e);e.status==="ready"&&_le(t);let i=e.metadata??(e.eforge_session!==void 0?{eforge_session:e.eforge_session}:void 0),r=zO(t,e.status,i);return await Cn({cwd:e.cwd,plan:r}),{plan:r}}async function Ole(e){let t=await ei(e),i=xa(t,e);return await Cn({cwd:e.cwd,plan:i}),{plan:i,readiness:Yn(i)}}async function wle(e){let t=await ei(e),i=GO(t),r=i!==t;return r&&await Cn({cwd:e.cwd,plan:i}),{plan:i,migrated:r}}async function Tle(e){return(await Jh(e)).filter(i=>i.status!=="abandoned"&&(e.includeSubmitted===!0||i.status!=="submitted"))}function Ve(){return{descriptor:R1,flat:{resolveStorageRoot:Md,resolvePath:Ea,list:xle,load:Ele,create:Ple,setSection:kle,skipDimension:vle,setStatus:Ale,selectDimensions:Ole,readiness:async e=>Yn(await ei(e)),migrateLegacy:wle,normalizeBuildSource:Pa},planSets:{list:Tle,load:qd,validate:Yh,validateLoaded:Kp}}}import{readFile as l8e,stat as p8e}from"fs/promises";import{resolve as f8e}from"path";var DG=Po(Zr(),1);import{readFileSync as spe}from"fs";import{readFile as ape}from"fs/promises";import{relative as cpe}from"path";var je=class extends Error{code;cause;constructor(t,i,r){super(i),this.name="EforgePlanStoreError",this.code=t,this.cause=r?.cause}};var nw=new WeakMap;function x1(e,t){nw.set(e,t)}function Vp(e){let t=nw.get(e);if(!t||t.closed)throw new je("store-closed","eforge-plan SQLite store is closed");return t}function re(e){return Vp(e).db}function iw(e){if(Vp(e).readonly)throw new je("readonly-store","eforge-plan SQLite store was opened read-only")}function rw(e){let t=nw.get(e);t&&(t.closed=!0)}function ow(e){let t=re(e);t.exec("DROP TABLE IF EXISTS temp.eforge_plan_fts5_probe");try{t.exec("CREATE VIRTUAL TABLE temp.eforge_plan_fts5_probe USING fts5(content)")}catch(i){throw new je("missing-fts5","SQLite FTS5 is not available. Use a Node.js build whose node:sqlite module includes FTS5 support.",{cause:i})}finally{try{t.exec("DROP TABLE IF EXISTS temp.eforge_plan_fts5_probe")}catch{}}}function E1(e){if(!re(e).prepare("SELECT sql FROM sqlite_master WHERE name = 'search_documents_fts'").get()?.sql?.toLowerCase().includes("fts5"))throw new je("missing-fts5","search_documents_fts FTS5 table is missing from the eforge-plan store schema")}import{existsSync as L1,mkdirSync as jle}from"fs";import{dirname as D1,join as Ble}from"path";import{DatabaseSync as $1}from"node:sqlite";var P1="eforge-plan-private.sqlite",tI=".eforge/storage/extensions/eforge-plan";var k1="1_initial_schema",v1="initial eforge-plan SQLite schema";var _1="2_drop_legacy_import_tables",A1="drop one-time legacy importer SQLite tables";import{createHash as Dle}from"crypto";var O1=`
|
|
225
|
+
CREATE TABLE IF NOT EXISTS backlog_items (
|
|
226
|
+
id TEXT PRIMARY KEY,
|
|
227
|
+
title TEXT NOT NULL,
|
|
228
|
+
body TEXT NOT NULL DEFAULT '',
|
|
229
|
+
user_status TEXT NOT NULL CHECK (user_status IN ('candidate','planned','active','shipped','stale','superseded')),
|
|
230
|
+
priority TEXT,
|
|
231
|
+
source TEXT,
|
|
232
|
+
created_at TEXT,
|
|
233
|
+
updated_at TEXT,
|
|
234
|
+
last_checked_at TEXT,
|
|
235
|
+
stale_after TEXT,
|
|
236
|
+
epic_ref TEXT,
|
|
237
|
+
epic_id TEXT REFERENCES epics(id) ON DELETE SET NULL,
|
|
238
|
+
frontmatter_json TEXT NOT NULL DEFAULT '{}',
|
|
239
|
+
body_sha256 TEXT,
|
|
240
|
+
record_sha256 TEXT,
|
|
241
|
+
import_origin TEXT,
|
|
242
|
+
import_path TEXT
|
|
243
|
+
);
|
|
244
|
+
CREATE INDEX IF NOT EXISTS idx_backlog_items_status ON backlog_items(user_status);
|
|
245
|
+
CREATE INDEX IF NOT EXISTS idx_backlog_items_updated ON backlog_items(updated_at);
|
|
246
|
+
CREATE INDEX IF NOT EXISTS idx_backlog_items_epic_ref ON backlog_items(epic_ref);
|
|
247
|
+
CREATE INDEX IF NOT EXISTS idx_backlog_items_epic_id ON backlog_items(epic_id);
|
|
248
|
+
|
|
249
|
+
CREATE TABLE IF NOT EXISTS backlog_item_tags (
|
|
250
|
+
item_id TEXT NOT NULL REFERENCES backlog_items(id) ON DELETE CASCADE,
|
|
251
|
+
tag TEXT NOT NULL,
|
|
252
|
+
PRIMARY KEY (item_id, tag)
|
|
253
|
+
);
|
|
254
|
+
CREATE INDEX IF NOT EXISTS idx_backlog_item_tags_tag ON backlog_item_tags(tag);
|
|
255
|
+
|
|
256
|
+
CREATE TABLE IF NOT EXISTS backlog_item_sections (
|
|
257
|
+
item_id TEXT NOT NULL REFERENCES backlog_items(id) ON DELETE CASCADE,
|
|
258
|
+
section_name TEXT NOT NULL,
|
|
259
|
+
content TEXT NOT NULL DEFAULT '',
|
|
260
|
+
content_sha256 TEXT,
|
|
261
|
+
PRIMARY KEY (item_id, section_name)
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
CREATE TABLE IF NOT EXISTS epics (
|
|
265
|
+
id TEXT PRIMARY KEY,
|
|
266
|
+
title TEXT NOT NULL,
|
|
267
|
+
body TEXT NOT NULL DEFAULT '',
|
|
268
|
+
user_status TEXT NOT NULL CHECK (user_status IN ('candidate','planned','active','shipped','stale','superseded')),
|
|
269
|
+
priority TEXT,
|
|
270
|
+
source TEXT,
|
|
271
|
+
created_at TEXT,
|
|
272
|
+
updated_at TEXT,
|
|
273
|
+
last_checked_at TEXT,
|
|
274
|
+
stale_after TEXT,
|
|
275
|
+
frontmatter_json TEXT NOT NULL DEFAULT '{}',
|
|
276
|
+
body_sha256 TEXT,
|
|
277
|
+
record_sha256 TEXT,
|
|
278
|
+
import_origin TEXT,
|
|
279
|
+
import_path TEXT
|
|
280
|
+
);
|
|
281
|
+
CREATE INDEX IF NOT EXISTS idx_epics_status ON epics(user_status);
|
|
282
|
+
CREATE INDEX IF NOT EXISTS idx_epics_updated ON epics(updated_at);
|
|
283
|
+
|
|
284
|
+
CREATE TABLE IF NOT EXISTS epic_tags (
|
|
285
|
+
epic_id TEXT NOT NULL REFERENCES epics(id) ON DELETE CASCADE,
|
|
286
|
+
tag TEXT NOT NULL,
|
|
287
|
+
PRIMARY KEY (epic_id, tag)
|
|
288
|
+
);
|
|
289
|
+
CREATE INDEX IF NOT EXISTS idx_epic_tags_tag ON epic_tags(tag);
|
|
290
|
+
|
|
291
|
+
CREATE TABLE IF NOT EXISTS epic_sections (
|
|
292
|
+
epic_id TEXT NOT NULL REFERENCES epics(id) ON DELETE CASCADE,
|
|
293
|
+
section_name TEXT NOT NULL,
|
|
294
|
+
content TEXT NOT NULL DEFAULT '',
|
|
295
|
+
content_sha256 TEXT,
|
|
296
|
+
PRIMARY KEY (epic_id, section_name)
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
CREATE TABLE IF NOT EXISTS item_dependencies (
|
|
300
|
+
item_id TEXT NOT NULL REFERENCES backlog_items(id) ON DELETE CASCADE,
|
|
301
|
+
dependency_ref TEXT NOT NULL,
|
|
302
|
+
dependency_kind TEXT NOT NULL DEFAULT 'depends-on',
|
|
303
|
+
dependency_status TEXT NOT NULL DEFAULT 'unknown' CHECK (dependency_status IN ('unknown','open','closed','external','missing')),
|
|
304
|
+
resolved_dependency_item_id TEXT REFERENCES backlog_items(id) ON DELETE SET NULL,
|
|
305
|
+
source_path TEXT,
|
|
306
|
+
diagnostic_json TEXT,
|
|
307
|
+
PRIMARY KEY (item_id, dependency_ref)
|
|
308
|
+
);
|
|
309
|
+
CREATE INDEX IF NOT EXISTS idx_item_dependencies_ref ON item_dependencies(dependency_ref);
|
|
310
|
+
CREATE INDEX IF NOT EXISTS idx_item_dependencies_resolved ON item_dependencies(resolved_dependency_item_id);
|
|
311
|
+
|
|
312
|
+
CREATE TABLE IF NOT EXISTS recommendation_runs (
|
|
313
|
+
run_id TEXT PRIMARY KEY,
|
|
314
|
+
source_fingerprint TEXT,
|
|
315
|
+
created_at TEXT,
|
|
316
|
+
applied_at TEXT,
|
|
317
|
+
last_refreshed_by TEXT,
|
|
318
|
+
is_current INTEGER NOT NULL DEFAULT 0 CHECK (is_current IN (0,1)),
|
|
319
|
+
raw_model_json TEXT,
|
|
320
|
+
summary_json TEXT,
|
|
321
|
+
freshness_json TEXT,
|
|
322
|
+
import_origin TEXT,
|
|
323
|
+
import_path TEXT
|
|
324
|
+
);
|
|
325
|
+
CREATE INDEX IF NOT EXISTS idx_recommendation_runs_current ON recommendation_runs(is_current);
|
|
326
|
+
|
|
327
|
+
CREATE TABLE IF NOT EXISTS recommendation_lanes (
|
|
328
|
+
lane_id TEXT PRIMARY KEY,
|
|
329
|
+
run_id TEXT NOT NULL REFERENCES recommendation_runs(run_id) ON DELETE CASCADE,
|
|
330
|
+
lane_kind TEXT NOT NULL CHECK (lane_kind IN ('activeWork','readyCandidates','recommendedNextSequence','safeParallelizableGroup','blockedChain')),
|
|
331
|
+
lane_ref TEXT NOT NULL DEFAULT '',
|
|
332
|
+
title TEXT,
|
|
333
|
+
sequence INTEGER NOT NULL DEFAULT 0,
|
|
334
|
+
profile TEXT,
|
|
335
|
+
rationale TEXT,
|
|
336
|
+
UNIQUE (run_id, lane_kind, lane_ref)
|
|
337
|
+
);
|
|
338
|
+
CREATE INDEX IF NOT EXISTS idx_recommendation_lanes_run_kind ON recommendation_lanes(run_id, lane_kind);
|
|
339
|
+
|
|
340
|
+
CREATE TABLE IF NOT EXISTS recommendation_lane_items (
|
|
341
|
+
lane_id TEXT NOT NULL REFERENCES recommendation_lanes(lane_id) ON DELETE CASCADE,
|
|
342
|
+
item_ref TEXT NOT NULL,
|
|
343
|
+
item_id TEXT REFERENCES backlog_items(id) ON DELETE SET NULL,
|
|
344
|
+
role TEXT NOT NULL CHECK (role IN ('member','blocked','blocker')),
|
|
345
|
+
sequence INTEGER,
|
|
346
|
+
rationale TEXT,
|
|
347
|
+
confidence REAL,
|
|
348
|
+
PRIMARY KEY (lane_id, item_ref, role)
|
|
349
|
+
);
|
|
350
|
+
CREATE INDEX IF NOT EXISTS idx_recommendation_lane_items_ref ON recommendation_lane_items(item_ref);
|
|
351
|
+
CREATE INDEX IF NOT EXISTS idx_recommendation_lane_items_item ON recommendation_lane_items(item_id);
|
|
352
|
+
|
|
353
|
+
CREATE TABLE IF NOT EXISTS planning_tasks (
|
|
354
|
+
task_id TEXT PRIMARY KEY,
|
|
355
|
+
purpose TEXT,
|
|
356
|
+
status_snapshot TEXT,
|
|
357
|
+
source_fingerprint TEXT,
|
|
358
|
+
requested_sections_json TEXT,
|
|
359
|
+
selection_summary_json TEXT,
|
|
360
|
+
compact_result_summary_json TEXT,
|
|
361
|
+
raw_request_json TEXT,
|
|
362
|
+
raw_result_json TEXT,
|
|
363
|
+
raw_payload_prunable INTEGER NOT NULL DEFAULT 1 CHECK (raw_payload_prunable IN (0,1)),
|
|
364
|
+
created_at TEXT,
|
|
365
|
+
updated_at TEXT,
|
|
366
|
+
applied_at TEXT,
|
|
367
|
+
parent_task_id TEXT REFERENCES planning_tasks(task_id) ON DELETE SET NULL
|
|
368
|
+
);
|
|
369
|
+
CREATE INDEX IF NOT EXISTS idx_planning_tasks_purpose ON planning_tasks(purpose);
|
|
370
|
+
CREATE INDEX IF NOT EXISTS idx_planning_tasks_source ON planning_tasks(source_fingerprint);
|
|
371
|
+
CREATE INDEX IF NOT EXISTS idx_planning_tasks_status ON planning_tasks(status_snapshot);
|
|
372
|
+
|
|
373
|
+
CREATE TABLE IF NOT EXISTS planning_task_items (task_id TEXT NOT NULL REFERENCES planning_tasks(task_id) ON DELETE CASCADE, item_ref TEXT NOT NULL, item_id TEXT REFERENCES backlog_items(id) ON DELETE SET NULL, role TEXT, sequence INTEGER, source_path TEXT, metadata_json TEXT, PRIMARY KEY (task_id, item_ref, role));
|
|
374
|
+
CREATE INDEX IF NOT EXISTS idx_planning_task_items_ref ON planning_task_items(item_ref);
|
|
375
|
+
CREATE INDEX IF NOT EXISTS idx_planning_task_items_item ON planning_task_items(item_id);
|
|
376
|
+
CREATE TABLE IF NOT EXISTS planning_task_epics (task_id TEXT NOT NULL REFERENCES planning_tasks(task_id) ON DELETE CASCADE, epic_ref TEXT NOT NULL, epic_id TEXT REFERENCES epics(id) ON DELETE SET NULL, role TEXT, sequence INTEGER, source_path TEXT, metadata_json TEXT, PRIMARY KEY (task_id, epic_ref, role));
|
|
377
|
+
CREATE INDEX IF NOT EXISTS idx_planning_task_epics_ref ON planning_task_epics(epic_ref);
|
|
378
|
+
CREATE INDEX IF NOT EXISTS idx_planning_task_epics_epic ON planning_task_epics(epic_id);
|
|
379
|
+
CREATE TABLE IF NOT EXISTS planning_task_recommendation_refs (task_id TEXT NOT NULL REFERENCES planning_tasks(task_id) ON DELETE CASCADE, recommendation_ref TEXT NOT NULL, role TEXT, sequence INTEGER, source_path TEXT, metadata_json TEXT, PRIMARY KEY (task_id, recommendation_ref, role));
|
|
380
|
+
CREATE INDEX IF NOT EXISTS idx_planning_task_recommendation_refs_ref ON planning_task_recommendation_refs(recommendation_ref);
|
|
381
|
+
|
|
382
|
+
CREATE TABLE IF NOT EXISTS session_plans (
|
|
383
|
+
session TEXT PRIMARY KEY,
|
|
384
|
+
path TEXT,
|
|
385
|
+
topic TEXT,
|
|
386
|
+
status TEXT,
|
|
387
|
+
planning_type TEXT,
|
|
388
|
+
planning_depth TEXT,
|
|
389
|
+
profile TEXT,
|
|
390
|
+
agent_profile TEXT,
|
|
391
|
+
eforge_session_id TEXT,
|
|
392
|
+
submitted_at TEXT,
|
|
393
|
+
created_at TEXT,
|
|
394
|
+
updated_at TEXT,
|
|
395
|
+
summary_text TEXT,
|
|
396
|
+
artifact_body_hash TEXT,
|
|
397
|
+
frontmatter_json TEXT NOT NULL DEFAULT '{}',
|
|
398
|
+
readiness_summary_json TEXT,
|
|
399
|
+
import_origin TEXT,
|
|
400
|
+
import_path TEXT
|
|
401
|
+
);
|
|
402
|
+
CREATE INDEX IF NOT EXISTS idx_session_plans_status ON session_plans(status);
|
|
403
|
+
CREATE INDEX IF NOT EXISTS idx_session_plans_submitted ON session_plans(submitted_at);
|
|
404
|
+
CREATE INDEX IF NOT EXISTS idx_session_plans_updated ON session_plans(updated_at);
|
|
405
|
+
|
|
406
|
+
CREATE TABLE IF NOT EXISTS session_plan_items (session TEXT NOT NULL REFERENCES session_plans(session) ON DELETE CASCADE, item_ref TEXT NOT NULL, item_id TEXT REFERENCES backlog_items(id) ON DELETE SET NULL, role TEXT NOT NULL, provenance TEXT NOT NULL, source_task_id TEXT, source_recommendation_ref TEXT, promoted_at TEXT, sequence INTEGER, PRIMARY KEY (session, item_ref, role, provenance));
|
|
407
|
+
CREATE INDEX IF NOT EXISTS idx_session_plan_items_ref ON session_plan_items(item_ref);
|
|
408
|
+
CREATE INDEX IF NOT EXISTS idx_session_plan_items_item ON session_plan_items(item_id);
|
|
409
|
+
CREATE INDEX IF NOT EXISTS idx_session_plan_items_recommendation ON session_plan_items(source_recommendation_ref);
|
|
410
|
+
CREATE TABLE IF NOT EXISTS session_plan_epics (session TEXT NOT NULL REFERENCES session_plans(session) ON DELETE CASCADE, epic_ref TEXT NOT NULL, epic_id TEXT REFERENCES epics(id) ON DELETE SET NULL, role TEXT NOT NULL, provenance TEXT NOT NULL, source_task_id TEXT, source_recommendation_ref TEXT, promoted_at TEXT, sequence INTEGER, PRIMARY KEY (session, epic_ref, role, provenance));
|
|
411
|
+
CREATE INDEX IF NOT EXISTS idx_session_plan_epics_ref ON session_plan_epics(epic_ref);
|
|
412
|
+
CREATE INDEX IF NOT EXISTS idx_session_plan_epics_epic ON session_plan_epics(epic_id);
|
|
413
|
+
|
|
414
|
+
CREATE TABLE IF NOT EXISTS queue_prds (prd_id TEXT PRIMARY KEY, session TEXT REFERENCES session_plans(session) ON DELETE SET NULL, source_id TEXT, source_path TEXT, external_ref TEXT, status TEXT, created_at TEXT, updated_at TEXT, submitted_at TEXT, status_summary TEXT, error_summary TEXT, import_fingerprint TEXT);
|
|
415
|
+
CREATE INDEX IF NOT EXISTS idx_queue_prds_session ON queue_prds(session); CREATE INDEX IF NOT EXISTS idx_queue_prds_status ON queue_prds(status);
|
|
416
|
+
CREATE TABLE IF NOT EXISTS build_runs (run_id TEXT PRIMARY KEY, session TEXT REFERENCES session_plans(session) ON DELETE SET NULL, queue_prd_id TEXT REFERENCES queue_prds(prd_id) ON DELETE SET NULL, build_session_id TEXT, status TEXT, started_at TEXT, finished_at TEXT, plan_set TEXT, cwd TEXT, status_summary TEXT, error_summary TEXT, import_fingerprint TEXT);
|
|
417
|
+
CREATE INDEX IF NOT EXISTS idx_build_runs_session ON build_runs(session); CREATE INDEX IF NOT EXISTS idx_build_runs_queue ON build_runs(queue_prd_id); CREATE INDEX IF NOT EXISTS idx_build_runs_status ON build_runs(status);
|
|
418
|
+
CREATE TABLE IF NOT EXISTS build_sessions (build_session_id TEXT PRIMARY KEY, session TEXT REFERENCES session_plans(session) ON DELETE SET NULL, status TEXT, started_at TEXT, finished_at TEXT, status_summary TEXT, error_summary TEXT, import_fingerprint TEXT);
|
|
419
|
+
CREATE INDEX IF NOT EXISTS idx_build_sessions_session ON build_sessions(session); CREATE INDEX IF NOT EXISTS idx_build_sessions_status ON build_sessions(status);
|
|
420
|
+
CREATE TABLE IF NOT EXISTS landing_links (landing_id TEXT PRIMARY KEY, session TEXT REFERENCES session_plans(session) ON DELETE SET NULL, item_id TEXT REFERENCES backlog_items(id) ON DELETE SET NULL, queue_prd_id TEXT REFERENCES queue_prds(prd_id) ON DELETE SET NULL, run_id TEXT REFERENCES build_runs(run_id) ON DELETE SET NULL, build_session_id TEXT REFERENCES build_sessions(build_session_id) ON DELETE SET NULL, status TEXT, pr_url TEXT, feature_branch TEXT, commit_sha TEXT, merge_ref TEXT, created_at TEXT, completed_at TEXT, summary_json TEXT);
|
|
421
|
+
CREATE INDEX IF NOT EXISTS idx_landing_links_session ON landing_links(session); CREATE INDEX IF NOT EXISTS idx_landing_links_status ON landing_links(status); CREATE INDEX IF NOT EXISTS idx_landing_links_item ON landing_links(item_id); CREATE INDEX IF NOT EXISTS idx_landing_links_pr ON landing_links(pr_url); CREATE INDEX IF NOT EXISTS idx_landing_links_branch ON landing_links(feature_branch); CREATE INDEX IF NOT EXISTS idx_landing_links_commit ON landing_links(commit_sha);
|
|
422
|
+
|
|
423
|
+
CREATE TABLE IF NOT EXISTS lifecycle_events (event_key TEXT PRIMARY KEY, event_type TEXT NOT NULL, timestamp TEXT, session TEXT, run_id TEXT, build_session_id TEXT, queue_prd_id TEXT, landing_id TEXT, affected_item_refs_json TEXT NOT NULL DEFAULT '[]', payload_json TEXT, payload_prunable INTEGER NOT NULL DEFAULT 1 CHECK (payload_prunable IN (0,1)), source_fingerprint TEXT);
|
|
424
|
+
CREATE INDEX IF NOT EXISTS idx_lifecycle_events_session ON lifecycle_events(session); CREATE INDEX IF NOT EXISTS idx_lifecycle_events_run ON lifecycle_events(run_id);
|
|
425
|
+
CREATE TABLE IF NOT EXISTS lifecycle_evidence (evidence_key TEXT PRIMARY KEY, item_id TEXT REFERENCES backlog_items(id) ON DELETE CASCADE, item_ref TEXT NOT NULL, session TEXT REFERENCES session_plans(session) ON DELETE SET NULL, planning_task_id TEXT REFERENCES planning_tasks(task_id) ON DELETE SET NULL, queue_prd_id TEXT REFERENCES queue_prds(prd_id) ON DELETE SET NULL, run_id TEXT REFERENCES build_runs(run_id) ON DELETE SET NULL, build_session_id TEXT REFERENCES build_sessions(build_session_id) ON DELETE SET NULL, landing_id TEXT REFERENCES landing_links(landing_id) ON DELETE SET NULL, source_event_key TEXT REFERENCES lifecycle_events(event_key) ON DELETE SET NULL, lifecycle_state TEXT NOT NULL CHECK (lifecycle_state IN ('none','planned','active','submitted','queued','build','pr-open','merged','shipped','failed','partial')), reason_code TEXT, evidence_kind TEXT, status TEXT, is_current INTEGER NOT NULL DEFAULT 1 CHECK (is_current IN (0,1)), is_terminal INTEGER NOT NULL DEFAULT 0 CHECK (is_terminal IN (0,1)), occurred_at TEXT, superseded_at TEXT, summary TEXT, links_json TEXT, retained_summary_json TEXT);
|
|
426
|
+
CREATE INDEX IF NOT EXISTS idx_lifecycle_evidence_current_item ON lifecycle_evidence(item_id, is_current); CREATE INDEX IF NOT EXISTS idx_lifecycle_evidence_state ON lifecycle_evidence(lifecycle_state); CREATE INDEX IF NOT EXISTS idx_lifecycle_evidence_session ON lifecycle_evidence(session); CREATE INDEX IF NOT EXISTS idx_lifecycle_evidence_queue ON lifecycle_evidence(queue_prd_id); CREATE INDEX IF NOT EXISTS idx_lifecycle_evidence_run ON lifecycle_evidence(run_id); CREATE INDEX IF NOT EXISTS idx_lifecycle_evidence_build_session ON lifecycle_evidence(build_session_id); CREATE INDEX IF NOT EXISTS idx_lifecycle_evidence_landing ON lifecycle_evidence(landing_id); CREATE INDEX IF NOT EXISTS idx_lifecycle_evidence_event ON lifecycle_evidence(source_event_key);
|
|
427
|
+
|
|
428
|
+
CREATE TABLE IF NOT EXISTS import_runs (run_id TEXT PRIMARY KEY, dry_run INTEGER NOT NULL DEFAULT 0 CHECK (dry_run IN (0,1)), applied INTEGER NOT NULL DEFAULT 0 CHECK (applied IN (0,1)), replaced_existing INTEGER NOT NULL DEFAULT 0 CHECK (replaced_existing IN (0,1)), started_at TEXT, finished_at TEXT, counts_json TEXT, summary_json TEXT, verbose_report_json TEXT, verbose_report_prunable INTEGER NOT NULL DEFAULT 1 CHECK (verbose_report_prunable IN (0,1)));
|
|
429
|
+
CREATE TABLE IF NOT EXISTS import_diagnostics (diagnostic_id TEXT PRIMARY KEY, run_id TEXT NOT NULL REFERENCES import_runs(run_id) ON DELETE CASCADE, severity TEXT NOT NULL, code TEXT NOT NULL, message TEXT NOT NULL, ref TEXT, path TEXT, details_json TEXT);
|
|
430
|
+
CREATE INDEX IF NOT EXISTS idx_import_diagnostics_run ON import_diagnostics(run_id); CREATE INDEX IF NOT EXISTS idx_import_diagnostics_severity ON import_diagnostics(severity);
|
|
431
|
+
CREATE TABLE IF NOT EXISTS store_maintenance_runs (run_id TEXT PRIMARY KEY, categories_json TEXT, started_at TEXT, finished_at TEXT, pruned_counts_json TEXT, archived_counts_json TEXT, preserved_evidence_counts_json TEXT, status TEXT, error_summary TEXT);
|
|
432
|
+
|
|
433
|
+
CREATE TABLE IF NOT EXISTS search_documents (document_type TEXT NOT NULL CHECK (document_type IN ('backlog_item','epic','session_plan','recommendation')), document_id TEXT NOT NULL, title TEXT, tags_text TEXT, summary_text TEXT, body_text TEXT, item_ids_text TEXT, epic_ids_text TEXT, recommendation_refs_text TEXT, source_sha256 TEXT, updated_at TEXT, dirty INTEGER NOT NULL DEFAULT 0 CHECK (dirty IN (0,1)), PRIMARY KEY (document_type, document_id));
|
|
434
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS search_documents_fts USING fts5(document_type UNINDEXED, document_id UNINDEXED, title, tags_text, summary_text, body_text, item_ids_text, epic_ids_text, recommendation_refs_text);
|
|
435
|
+
CREATE TABLE IF NOT EXISTS search_index_state (id INTEGER PRIMARY KEY CHECK (id = 1), dirty INTEGER NOT NULL DEFAULT 0 CHECK (dirty IN (0,1)), dirty_since TEXT, dirty_reason TEXT, last_rebuilt_at TEXT);
|
|
436
|
+
INSERT OR IGNORE INTO search_index_state (id, dirty) VALUES (1, 0);
|
|
437
|
+
CREATE TABLE IF NOT EXISTS search_index_dirty_records (document_type TEXT NOT NULL, document_id TEXT NOT NULL, reason TEXT, marked_at TEXT, PRIMARY KEY (document_type, document_id));
|
|
438
|
+
CREATE INDEX IF NOT EXISTS idx_search_dirty_records_marked ON search_index_dirty_records(marked_at);
|
|
439
|
+
`;var $le=`
|
|
440
|
+
DROP TABLE IF EXISTS import_diagnostics;
|
|
441
|
+
DROP TABLE IF EXISTS import_runs;
|
|
442
|
+
`,w1=[{id:"1",name:k1,description:v1,version:1,sql:O1},{id:"2",name:_1,description:A1,version:2,sql:$le}];function T1(e){return Dle("sha256").update(e).digest("hex")}function Nle(e){re(e).exec("CREATE TABLE IF NOT EXISTS schema_migrations (id TEXT PRIMARY KEY, name TEXT NOT NULL, checksum TEXT NOT NULL, applied_at TEXT NOT NULL, description TEXT NOT NULL)")}function C1(e){let t=re(e);Nle(e);for(let i of w1){let r=T1(i.sql),o=t.prepare("SELECT checksum FROM schema_migrations WHERE id = ?").get(i.id);if(o){if(o.checksum!==r)throw new je("migration-checksum-mismatch",`Migration ${i.id} checksum mismatch`);continue}t.exec(i.sql),t.prepare("INSERT INTO schema_migrations (id, name, checksum, applied_at, description) VALUES (?, ?, ?, ?, ?)").run(i.id,i.name,r,new Date().toISOString(),i.description),t.exec(`PRAGMA user_version = ${i.version}`)}iI(e)}function iI(e){let t=re(e);if(!t.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'schema_migrations'").get())throw new je("schema-mismatch","Missing schema_migrations metadata");for(let o of w1){let s=t.prepare("SELECT checksum FROM schema_migrations WHERE id = ?").get(o.id);if(!s)throw new je("schema-mismatch",`Missing migration ${o.id}`);let a=T1(o.sql);if(s.checksum!==a)throw new je("migration-checksum-mismatch",`Migration ${o.id} checksum mismatch`)}let r=t.prepare("PRAGMA user_version").get().user_version;if(r!==2)throw new je("schema-mismatch",`Expected schema version ${2}, found ${r}`)}function Ln(e){return Ble(e,tI,P1)}function rI(e){return re(e).prepare("PRAGMA user_version").get().user_version}function Kt(e,t={}){let i=t.create??!0,r=t.migrate??!0,o=t.readonly??!1,s=Ln(e);if(!i&&!L1(s))throw new je("open-failed",`eforge-plan SQLite store does not exist: ${s}`);try{o||jle(D1(s),{recursive:!0})}catch(d){throw d instanceof je?d:new je("open-failed",`Failed to create eforge-plan SQLite store directory: ${D1(s)}`,{cause:d})}o&&r&&L1(s)&&Kt(e,{create:!1,migrate:!0,readonly:!1}).close();let a,c;try{c=o?new $1(s,{readOnly:!0}):new $1(s)}catch(d){throw d instanceof je?d:new je("open-failed",`Failed to open eforge-plan SQLite store: ${s}`,{cause:d})}a={path:s,readonly:o,transaction(d){let u=Vp(a);if(u.transactionDepth>0){u.transactionDepth+=1;try{return d()}finally{u.transactionDepth-=1}}u.db.exec(o?"BEGIN":"BEGIN IMMEDIATE"),u.transactionDepth=1;try{let l=d();return u.db.exec("COMMIT"),l}catch(l){try{u.db.exec("ROLLBACK")}finally{u.transactionDepth=0}throw l}finally{u.transactionDepth>0&&(u.transactionDepth=0)}},close(){Vp(a).db.close(),rw(a)}},x1(a,{db:c,readonly:o,closed:!1,transactionDepth:0});try{if(c.exec("PRAGMA busy_timeout = 5000"),c.exec("PRAGMA foreign_keys = ON"),ow(a),o?iI(a):(c.exec("PRAGMA journal_mode = WAL"),c.exec("PRAGMA synchronous = NORMAL"),r?C1(a):iI(a)),rI(a)!==2)throw new je("schema-mismatch","eforge-plan SQLite schema version mismatch");return E1(a),a}catch(d){try{c.close()}finally{rw(a)}throw d}}var oI=["candidate","planned","active","shipped","stale","superseded"],N1=["unknown","open","closed","external","missing"],j1=["activeWork","readyCandidates","recommendedNextSequence","safeParallelizableGroup","blockedChain"],B1=["member","blocked","blocker"],M1=["none","planned","active","submitted","queued","build","pr-open","merged","shipped","failed","partial"],Hp=["backlog_item","epic","session_plan","recommendation"];function ti(e,t,i){if(!i.includes(t))throw new je("invalid-input",`Invalid ${e}: ${t}. Allowed values: ${i.join(", ")}`)}function V(e,t,...i){return re(e).prepare(t).get(...i)}function q(e,t,...i){return re(e).prepare(t).all(...i)}function U(e,t,...i){iw(e),re(e).prepare(t).run(...i)}function Wp(e,t){iw(e),re(e).exec(t)}function wr(e,t){return e??t?1:0}function tr(e){return Number(e)===1}function S(e){return typeof e=="string"?e:void 0}function ke(e,t){return e===void 0?t===void 0?null:JSON.stringify(t):JSON.stringify(e)}function ee(e,t,i,r){if(i==null)return r!==void 0?r:void 0;if(typeof i!="string")throw new je("invalid-json-column",`${e}.${t} is not text JSON`);try{return JSON.parse(i)}catch(o){throw new je("invalid-json-column",`Invalid JSON in ${e}.${t}`,{cause:o})}}function sw(){return new Date().toISOString()}function Ue(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}function aw(e){return Ue({id:e.id,title:e.title,body:e.body,userStatus:e.user_status,priority:S(e.priority),source:S(e.source),createdAt:S(e.created_at),updatedAt:S(e.updated_at),lastCheckedAt:S(e.last_checked_at),staleAfter:S(e.stale_after),epicRef:S(e.epic_ref),epicId:S(e.epic_id),frontmatter:ee("backlog_items","frontmatter_json",e.frontmatter_json,{}),bodySha256:S(e.body_sha256),recordSha256:S(e.record_sha256),importOrigin:S(e.import_origin),importPath:S(e.import_path)})}function Xp(e,t){return ti("userStatus",t.userStatus,oI),U(e,`INSERT INTO backlog_items (id,title,body,user_status,priority,source,created_at,updated_at,last_checked_at,stale_after,epic_ref,epic_id,frontmatter_json,body_sha256,record_sha256,import_origin,import_path)
|
|
443
|
+
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
|
|
444
|
+
ON CONFLICT(id) DO UPDATE SET title=excluded.title, body=excluded.body, user_status=excluded.user_status, priority=excluded.priority, source=excluded.source, created_at=excluded.created_at, updated_at=excluded.updated_at, last_checked_at=excluded.last_checked_at, stale_after=excluded.stale_after, epic_ref=excluded.epic_ref, epic_id=excluded.epic_id, frontmatter_json=excluded.frontmatter_json, body_sha256=excluded.body_sha256, record_sha256=excluded.record_sha256, import_origin=excluded.import_origin, import_path=excluded.import_path`,t.id,t.title,t.body??"",t.userStatus,t.priority??null,t.source??null,t.createdAt??null,t.updatedAt??null,t.lastCheckedAt??null,t.staleAfter??null,t.epicRef??null,t.epicId??null,ke(t.frontmatter,{}),t.bodySha256??null,t.recordSha256??null,t.importOrigin??null,t.importPath??null),Nt(e,t.id)}function Nt(e,t){let i=V(e,"SELECT * FROM backlog_items WHERE id = ?",t);return i?aw(i):void 0}function cw(e){return q(e,"SELECT * FROM backlog_items ORDER BY id").map(aw)}function dw(e,t,i){e.transaction(()=>{U(e,"DELETE FROM backlog_item_tags WHERE item_id = ?",t);for(let r of i)U(e,"INSERT OR IGNORE INTO backlog_item_tags (item_id, tag) VALUES (?, ?)",t,r)})}function uw(e,t,i){e.transaction(()=>{U(e,"DELETE FROM backlog_item_sections WHERE item_id = ?",t);for(let r of i)U(e,"INSERT INTO backlog_item_sections (item_id, section_name, content, content_sha256) VALUES (?, ?, ?, ?)",t,r.sectionName,r.content??"",r.contentSha256??null)})}function lw(e,t,i){e.transaction(()=>{U(e,"DELETE FROM item_dependencies WHERE item_id = ?",t);for(let r of i){let o=r.dependencyStatus??"unknown";ti("dependencyStatus",o,N1),U(e,"INSERT INTO item_dependencies (item_id, dependency_ref, dependency_kind, dependency_status, resolved_dependency_item_id, source_path, diagnostic_json) VALUES (?, ?, ?, ?, ?, ?, ?)",t,r.dependencyRef,r.dependencyKind??"depends-on",o,r.resolvedDependencyItemId??null,r.sourcePath??null,ke(r.diagnostic))}})}function pw(e){return Ue({id:e.id,title:e.title,body:e.body,userStatus:e.user_status,priority:S(e.priority),source:S(e.source),createdAt:S(e.created_at),updatedAt:S(e.updated_at),lastCheckedAt:S(e.last_checked_at),staleAfter:S(e.stale_after),frontmatter:ee("epics","frontmatter_json",e.frontmatter_json,{}),bodySha256:S(e.body_sha256),recordSha256:S(e.record_sha256),importOrigin:S(e.import_origin),importPath:S(e.import_path)})}function mw(e,t){return ti("userStatus",t.userStatus,oI),U(e,"INSERT INTO epics (id,title,body,user_status,priority,source,created_at,updated_at,last_checked_at,stale_after,frontmatter_json,body_sha256,record_sha256,import_origin,import_path) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(id) DO UPDATE SET title=excluded.title, body=excluded.body, user_status=excluded.user_status, priority=excluded.priority, source=excluded.source, created_at=excluded.created_at, updated_at=excluded.updated_at, last_checked_at=excluded.last_checked_at, stale_after=excluded.stale_after, frontmatter_json=excluded.frontmatter_json, body_sha256=excluded.body_sha256, record_sha256=excluded.record_sha256, import_origin=excluded.import_origin, import_path=excluded.import_path",t.id,t.title,t.body??"",t.userStatus,t.priority??null,t.source??null,t.createdAt??null,t.updatedAt??null,t.lastCheckedAt??null,t.staleAfter??null,ke(t.frontmatter,{}),t.bodySha256??null,t.recordSha256??null,t.importOrigin??null,t.importPath??null),va(e,t.id)}function va(e,t){let i=V(e,"SELECT * FROM epics WHERE id = ?",t);return i?pw(i):void 0}function fw(e){return q(e,"SELECT * FROM epics ORDER BY id").map(pw)}function gw(e,t,i){e.transaction(()=>{U(e,"DELETE FROM epic_tags WHERE epic_id = ?",t);for(let r of i)U(e,"INSERT OR IGNORE INTO epic_tags (epic_id, tag) VALUES (?, ?)",t,r)})}function Sw(e,t,i){e.transaction(()=>{U(e,"DELETE FROM epic_sections WHERE epic_id = ?",t);for(let r of i)U(e,"INSERT INTO epic_sections (epic_id, section_name, content, content_sha256) VALUES (?, ?, ?, ?)",t,r.sectionName,r.content??"",r.contentSha256??null)})}function yw(e){return Ue({runId:e.run_id,sourceFingerprint:S(e.source_fingerprint),createdAt:S(e.created_at),appliedAt:S(e.applied_at),lastRefreshedBy:S(e.last_refreshed_by),isCurrent:tr(e.is_current),rawModel:ee("recommendation_runs","raw_model_json",e.raw_model_json),summary:ee("recommendation_runs","summary_json",e.summary_json),freshness:ee("recommendation_runs","freshness_json",e.freshness_json),importOrigin:S(e.import_origin),importPath:S(e.import_path)})}function zd(e,t){return U(e,"INSERT INTO recommendation_runs (run_id,source_fingerprint,created_at,applied_at,last_refreshed_by,is_current,raw_model_json,summary_json,freshness_json,import_origin,import_path) VALUES (?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(run_id) DO UPDATE SET source_fingerprint=excluded.source_fingerprint, created_at=excluded.created_at, applied_at=excluded.applied_at, last_refreshed_by=excluded.last_refreshed_by, is_current=excluded.is_current, raw_model_json=excluded.raw_model_json, summary_json=excluded.summary_json, freshness_json=excluded.freshness_json, import_origin=excluded.import_origin, import_path=excluded.import_path",t.runId,t.sourceFingerprint??null,t.createdAt??null,t.appliedAt??null,t.lastRefreshedBy??null,wr(t.isCurrent,!1),ke(t.rawModel),ke(t.summary),ke(t.freshness),t.importOrigin??null,t.importPath??null),yw(V(e,"SELECT * FROM recommendation_runs WHERE run_id = ?",t.runId))}function U1(e){return Ue({laneId:e.lane_id,runId:e.run_id,laneKind:e.lane_kind,laneRef:e.lane_ref===""?void 0:S(e.lane_ref),title:S(e.title),sequence:e.sequence,profile:S(e.profile),rationale:S(e.rationale)})}function Qp(e,t){return ti("laneKind",t.laneKind,j1),U(e,"INSERT INTO recommendation_lanes (lane_id,run_id,lane_kind,lane_ref,title,sequence,profile,rationale) VALUES (?,?,?,?,?,?,?,?) ON CONFLICT(lane_id) DO UPDATE SET run_id=excluded.run_id, lane_kind=excluded.lane_kind, lane_ref=excluded.lane_ref, title=excluded.title, sequence=excluded.sequence, profile=excluded.profile, rationale=excluded.rationale",t.laneId,t.runId,t.laneKind,t.laneRef??"",t.title??null,t.sequence??0,t.profile??null,t.rationale??null),U1(V(e,"SELECT * FROM recommendation_lanes WHERE lane_id = ?",t.laneId))}function Zp(e,t,i){e.transaction(()=>{U(e,"DELETE FROM recommendation_lane_items WHERE lane_id = ?",t);for(let r of i)ti("role",r.role,B1),U(e,"INSERT INTO recommendation_lane_items (lane_id,item_ref,item_id,role,sequence,rationale,confidence) VALUES (?,?,?,?,?,?,?)",t,r.itemRef,r.itemId??null,r.role,r.sequence??null,r.rationale??null,r.confidence??null)})}function hw(e){U(e,"UPDATE recommendation_runs SET is_current = 0 WHERE is_current = 1")}function Gd(e){let t=V(e,"SELECT * FROM recommendation_runs WHERE is_current = 1 ORDER BY created_at DESC LIMIT 1");return t?yw(t):void 0}function sI(e){return Ue({taskId:e.task_id,purpose:S(e.purpose),statusSnapshot:S(e.status_snapshot),sourceFingerprint:S(e.source_fingerprint),requestedSections:ee("planning_tasks","requested_sections_json",e.requested_sections_json),selectionSummary:ee("planning_tasks","selection_summary_json",e.selection_summary_json),compactResultSummary:ee("planning_tasks","compact_result_summary_json",e.compact_result_summary_json),rawRequest:ee("planning_tasks","raw_request_json",e.raw_request_json),rawResult:ee("planning_tasks","raw_result_json",e.raw_result_json),rawPayloadPrunable:tr(e.raw_payload_prunable),createdAt:S(e.created_at),updatedAt:S(e.updated_at),appliedAt:S(e.applied_at),parentTaskId:S(e.parent_task_id)})}function Jp(e,t){return U(e,"INSERT INTO planning_tasks (task_id,purpose,status_snapshot,source_fingerprint,requested_sections_json,selection_summary_json,compact_result_summary_json,raw_request_json,raw_result_json,raw_payload_prunable,created_at,updated_at,applied_at,parent_task_id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(task_id) DO UPDATE SET purpose=excluded.purpose, status_snapshot=excluded.status_snapshot, source_fingerprint=excluded.source_fingerprint, requested_sections_json=excluded.requested_sections_json, selection_summary_json=excluded.selection_summary_json, compact_result_summary_json=excluded.compact_result_summary_json, raw_request_json=excluded.raw_request_json, raw_result_json=excluded.raw_result_json, raw_payload_prunable=excluded.raw_payload_prunable, created_at=excluded.created_at, updated_at=excluded.updated_at, applied_at=excluded.applied_at, parent_task_id=excluded.parent_task_id",t.taskId,t.purpose??null,t.statusSnapshot??null,t.sourceFingerprint??null,ke(t.requestedSections),ke(t.selectionSummary),ke(t.compactResultSummary),ke(t.rawRequest),ke(t.rawResult),wr(t.rawPayloadPrunable,!0),t.createdAt??null,t.updatedAt??null,t.appliedAt??null,t.parentTaskId??null),sI(V(e,"SELECT * FROM planning_tasks WHERE task_id = ?",t.taskId))}function Iw(e,t){e.transaction(()=>{U(e,"DELETE FROM planning_task_items WHERE task_id = ?",t.taskId);for(let i of t.items??[])U(e,"INSERT INTO planning_task_items (task_id,item_ref,item_id,role,sequence,source_path,metadata_json) VALUES (?,?,?,?,?,?,?)",t.taskId,i.ref,i.resolvedId??null,i.role??"",i.sequence??null,i.sourcePath??null,ke(i.metadata));U(e,"DELETE FROM planning_task_epics WHERE task_id = ?",t.taskId);for(let i of t.epics??[])U(e,"INSERT INTO planning_task_epics (task_id,epic_ref,epic_id,role,sequence,source_path,metadata_json) VALUES (?,?,?,?,?,?,?)",t.taskId,i.ref,i.resolvedId??null,i.role??"",i.sequence??null,i.sourcePath??null,ke(i.metadata));U(e,"DELETE FROM planning_task_recommendation_refs WHERE task_id = ?",t.taskId);for(let i of t.recommendationRefs??[])U(e,"INSERT INTO planning_task_recommendation_refs (task_id,recommendation_ref,role,sequence,source_path,metadata_json) VALUES (?,?,?,?,?,?)",t.taskId,i.ref,i.role??"",i.sequence??null,i.sourcePath??null,ke(i.metadata))})}function bw(e){return Ue({session:e.session,path:S(e.path),topic:S(e.topic),status:S(e.status),planningType:S(e.planning_type),planningDepth:S(e.planning_depth),profile:S(e.profile),agentProfile:S(e.agent_profile),eforgeSessionId:S(e.eforge_session_id),submittedAt:S(e.submitted_at),createdAt:S(e.created_at),updatedAt:S(e.updated_at),summaryText:S(e.summary_text),artifactBodyHash:S(e.artifact_body_hash),frontmatter:ee("session_plans","frontmatter_json",e.frontmatter_json,{}),readinessSummary:ee("session_plans","readiness_summary_json",e.readiness_summary_json),importOrigin:S(e.import_origin),importPath:S(e.import_path)})}function aI(e,t){return U(e,"INSERT INTO session_plans (session,path,topic,status,planning_type,planning_depth,profile,agent_profile,eforge_session_id,submitted_at,created_at,updated_at,summary_text,artifact_body_hash,frontmatter_json,readiness_summary_json,import_origin,import_path) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(session) DO UPDATE SET path=excluded.path, topic=excluded.topic, status=excluded.status, planning_type=excluded.planning_type, planning_depth=excluded.planning_depth, profile=excluded.profile, agent_profile=excluded.agent_profile, eforge_session_id=excluded.eforge_session_id, submitted_at=excluded.submitted_at, created_at=excluded.created_at, updated_at=excluded.updated_at, summary_text=excluded.summary_text, artifact_body_hash=excluded.artifact_body_hash, frontmatter_json=excluded.frontmatter_json, readiness_summary_json=excluded.readiness_summary_json, import_origin=excluded.import_origin, import_path=excluded.import_path",t.session,t.path??null,t.topic??null,t.status??null,t.planningType??null,t.planningDepth??null,t.profile??null,t.agentProfile??null,t.eforgeSessionId??null,t.submittedAt??null,t.createdAt??null,t.updatedAt??null,t.summaryText??null,t.artifactBodyHash??null,ke(t.frontmatter,{}),ke(t.readinessSummary),t.importOrigin??null,t.importPath??null),bw(V(e,"SELECT * FROM session_plans WHERE session = ?",t.session))}function cI(e,t){let i=V(e,"SELECT * FROM session_plans WHERE session = ?",t);return i?bw(i):void 0}function Rw(e,t){e.transaction(()=>{U(e,"DELETE FROM session_plan_items WHERE session = ?",t.session),F1(e,t)})}function xw(e,t){e.transaction(()=>{U(e,"DELETE FROM session_plan_epics WHERE session = ?",t.session),q1(e,t)})}function F1(e,t){e.transaction(()=>{for(let i of t.items)U(e,"INSERT INTO session_plan_items (session,item_ref,item_id,role,provenance,source_task_id,source_recommendation_ref,promoted_at,sequence) VALUES (?,?,?,?,?,?,?,?,?) ON CONFLICT(session,item_ref,role,provenance) DO UPDATE SET item_id=excluded.item_id, source_task_id=excluded.source_task_id, source_recommendation_ref=excluded.source_recommendation_ref, promoted_at=excluded.promoted_at, sequence=excluded.sequence",t.session,i.itemRef,i.itemId??null,i.role,i.provenance,i.sourceTaskId??null,i.sourceRecommendationRef??null,i.promotedAt??null,i.sequence??null)})}function q1(e,t){e.transaction(()=>{for(let i of t.epics)U(e,"INSERT INTO session_plan_epics (session,epic_ref,epic_id,role,provenance,source_task_id,source_recommendation_ref,promoted_at,sequence) VALUES (?,?,?,?,?,?,?,?,?) ON CONFLICT(session,epic_ref,role,provenance) DO UPDATE SET epic_id=excluded.epic_id, source_task_id=excluded.source_task_id, source_recommendation_ref=excluded.source_recommendation_ref, promoted_at=excluded.promoted_at, sequence=excluded.sequence",t.session,i.epicRef,i.epicId??null,i.role,i.provenance,i.sourceTaskId??null,i.sourceRecommendationRef??null,i.promotedAt??null,i.sequence??null)})}function z1(e){return Ue({eventKey:e.event_key,eventType:e.event_type,timestamp:S(e.timestamp),session:S(e.session),runId:S(e.run_id),buildSessionId:S(e.build_session_id),queuePrdId:S(e.queue_prd_id),landingId:S(e.landing_id),affectedItemRefs:ee("lifecycle_events","affected_item_refs_json",e.affected_item_refs_json,[]),payload:ee("lifecycle_events","payload_json",e.payload_json),payloadPrunable:tr(e.payload_prunable),sourceFingerprint:S(e.source_fingerprint)})}function Ew(e,t){return U(e,"INSERT INTO lifecycle_events (event_key,event_type,timestamp,session,run_id,build_session_id,queue_prd_id,landing_id,affected_item_refs_json,payload_json,payload_prunable,source_fingerprint) VALUES (?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(event_key) DO UPDATE SET event_type=excluded.event_type, timestamp=excluded.timestamp, session=excluded.session, run_id=excluded.run_id, build_session_id=excluded.build_session_id, queue_prd_id=excluded.queue_prd_id, landing_id=excluded.landing_id, affected_item_refs_json=excluded.affected_item_refs_json, payload_json=excluded.payload_json, payload_prunable=excluded.payload_prunable, source_fingerprint=excluded.source_fingerprint",t.eventKey,t.eventType,t.timestamp??null,t.session??null,t.runId??null,t.buildSessionId??null,t.queuePrdId??null,t.landingId??null,JSON.stringify(t.affectedItemRefs??[]),ke(t.payload),wr(t.payloadPrunable,!0),t.sourceFingerprint??null),z1(V(e,"SELECT * FROM lifecycle_events WHERE event_key = ?",t.eventKey))}function G1(e){return Ue({evidenceKey:e.evidence_key,itemId:S(e.item_id),itemRef:e.item_ref,session:S(e.session),planningTaskId:S(e.planning_task_id),queuePrdId:S(e.queue_prd_id),runId:S(e.run_id),buildSessionId:S(e.build_session_id),landingId:S(e.landing_id),sourceEventKey:S(e.source_event_key),lifecycleState:e.lifecycle_state,reasonCode:S(e.reason_code),evidenceKind:S(e.evidence_kind),status:S(e.status),isCurrent:tr(e.is_current),isTerminal:tr(e.is_terminal),occurredAt:S(e.occurred_at),supersededAt:S(e.superseded_at),summary:S(e.summary),links:ee("lifecycle_evidence","links_json",e.links_json),retainedSummary:ee("lifecycle_evidence","retained_summary_json",e.retained_summary_json)})}function Kd(e,t){return ti("lifecycleState",t.lifecycleState,M1),U(e,"INSERT INTO lifecycle_evidence (evidence_key,item_id,item_ref,session,planning_task_id,queue_prd_id,run_id,build_session_id,landing_id,source_event_key,lifecycle_state,reason_code,evidence_kind,status,is_current,is_terminal,occurred_at,superseded_at,summary,links_json,retained_summary_json) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(evidence_key) DO UPDATE SET item_id=excluded.item_id, item_ref=excluded.item_ref, session=excluded.session, planning_task_id=excluded.planning_task_id, queue_prd_id=excluded.queue_prd_id, run_id=excluded.run_id, build_session_id=excluded.build_session_id, landing_id=excluded.landing_id, source_event_key=excluded.source_event_key, lifecycle_state=excluded.lifecycle_state, reason_code=excluded.reason_code, evidence_kind=excluded.evidence_kind, status=excluded.status, is_current=excluded.is_current, is_terminal=excluded.is_terminal, occurred_at=excluded.occurred_at, superseded_at=excluded.superseded_at, summary=excluded.summary, links_json=excluded.links_json, retained_summary_json=excluded.retained_summary_json",t.evidenceKey,t.itemId??null,t.itemRef,t.session??null,t.planningTaskId??null,t.queuePrdId??null,t.runId??null,t.buildSessionId??null,t.landingId??null,t.sourceEventKey??null,t.lifecycleState,t.reasonCode??null,t.evidenceKind??null,t.status??null,wr(t.isCurrent,!0),wr(t.isTerminal,!1),t.occurredAt??null,t.supersededAt??null,t.summary??null,ke(t.links),ke(t.retainedSummary)),G1(V(e,"SELECT * FROM lifecycle_evidence WHERE evidence_key = ?",t.evidenceKey))}function K1(e){return Ue({prdId:e.prd_id,session:S(e.session),sourceId:S(e.source_id),sourcePath:S(e.source_path),externalRef:S(e.external_ref),status:S(e.status),createdAt:S(e.created_at),updatedAt:S(e.updated_at),submittedAt:S(e.submitted_at),statusSummary:S(e.status_summary),errorSummary:S(e.error_summary),importFingerprint:S(e.import_fingerprint)})}function Yp(e,t){return U(e,"INSERT INTO queue_prds (prd_id,session,source_id,source_path,external_ref,status,created_at,updated_at,submitted_at,status_summary,error_summary,import_fingerprint) VALUES (?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(prd_id) DO UPDATE SET session=COALESCE(excluded.session, session), source_id=COALESCE(excluded.source_id, source_id), source_path=COALESCE(excluded.source_path, source_path), external_ref=COALESCE(excluded.external_ref, external_ref), status=COALESCE(excluded.status, status), created_at=COALESCE(excluded.created_at, created_at), updated_at=COALESCE(excluded.updated_at, updated_at), submitted_at=COALESCE(excluded.submitted_at, submitted_at), status_summary=COALESCE(excluded.status_summary, status_summary), error_summary=COALESCE(excluded.error_summary, error_summary), import_fingerprint=COALESCE(excluded.import_fingerprint, import_fingerprint)",t.prdId,t.session??null,t.sourceId??null,t.sourcePath??null,t.externalRef??null,t.status??null,t.createdAt??null,t.updatedAt??null,t.submittedAt??null,t.statusSummary??null,t.errorSummary??null,t.importFingerprint??null),K1(V(e,"SELECT * FROM queue_prds WHERE prd_id = ?",t.prdId))}function V1(e){return Ue({runId:e.run_id,session:S(e.session),queuePrdId:S(e.queue_prd_id),buildSessionId:S(e.build_session_id),status:S(e.status),startedAt:S(e.started_at),finishedAt:S(e.finished_at),planSet:S(e.plan_set),cwd:S(e.cwd),statusSummary:S(e.status_summary),errorSummary:S(e.error_summary),importFingerprint:S(e.import_fingerprint)})}function Pw(e,t){return U(e,"INSERT INTO build_runs (run_id,session,queue_prd_id,build_session_id,status,started_at,finished_at,plan_set,cwd,status_summary,error_summary,import_fingerprint) VALUES (?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(run_id) DO UPDATE SET session=COALESCE(excluded.session, session), queue_prd_id=COALESCE(excluded.queue_prd_id, queue_prd_id), build_session_id=COALESCE(excluded.build_session_id, build_session_id), status=COALESCE(excluded.status, status), started_at=COALESCE(excluded.started_at, started_at), finished_at=COALESCE(excluded.finished_at, finished_at), plan_set=COALESCE(excluded.plan_set, plan_set), cwd=COALESCE(excluded.cwd, cwd), status_summary=COALESCE(excluded.status_summary, status_summary), error_summary=COALESCE(excluded.error_summary, error_summary), import_fingerprint=COALESCE(excluded.import_fingerprint, import_fingerprint)",t.runId,t.session??null,t.queuePrdId??null,t.buildSessionId??null,t.status??null,t.startedAt??null,t.finishedAt??null,t.planSet??null,t.cwd??null,t.statusSummary??null,t.errorSummary??null,t.importFingerprint??null),V1(V(e,"SELECT * FROM build_runs WHERE run_id = ?",t.runId))}function H1(e){return Ue({buildSessionId:e.build_session_id,session:S(e.session),status:S(e.status),startedAt:S(e.started_at),finishedAt:S(e.finished_at),statusSummary:S(e.status_summary),errorSummary:S(e.error_summary),importFingerprint:S(e.import_fingerprint)})}function kw(e,t){return U(e,"INSERT INTO build_sessions (build_session_id,session,status,started_at,finished_at,status_summary,error_summary,import_fingerprint) VALUES (?,?,?,?,?,?,?,?) ON CONFLICT(build_session_id) DO UPDATE SET session=COALESCE(excluded.session, session), status=COALESCE(excluded.status, status), started_at=COALESCE(excluded.started_at, started_at), finished_at=COALESCE(excluded.finished_at, finished_at), status_summary=COALESCE(excluded.status_summary, status_summary), error_summary=COALESCE(excluded.error_summary, error_summary), import_fingerprint=COALESCE(excluded.import_fingerprint, import_fingerprint)",t.buildSessionId,t.session??null,t.status??null,t.startedAt??null,t.finishedAt??null,t.statusSummary??null,t.errorSummary??null,t.importFingerprint??null),H1(V(e,"SELECT * FROM build_sessions WHERE build_session_id = ?",t.buildSessionId))}function W1(e){return Ue({landingId:e.landing_id,session:S(e.session),itemId:S(e.item_id),queuePrdId:S(e.queue_prd_id),runId:S(e.run_id),buildSessionId:S(e.build_session_id),status:S(e.status),prUrl:S(e.pr_url),featureBranch:S(e.feature_branch),commitSha:S(e.commit_sha),mergeRef:S(e.merge_ref),createdAt:S(e.created_at),completedAt:S(e.completed_at),summary:ee("landing_links","summary_json",e.summary_json)})}function vw(e,t){return U(e,"INSERT INTO landing_links (landing_id,session,item_id,queue_prd_id,run_id,build_session_id,status,pr_url,feature_branch,commit_sha,merge_ref,created_at,completed_at,summary_json) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(landing_id) DO UPDATE SET session=COALESCE(excluded.session, session), item_id=COALESCE(excluded.item_id, item_id), queue_prd_id=COALESCE(excluded.queue_prd_id, queue_prd_id), run_id=COALESCE(excluded.run_id, run_id), build_session_id=COALESCE(excluded.build_session_id, build_session_id), status=COALESCE(excluded.status, status), pr_url=COALESCE(excluded.pr_url, pr_url), feature_branch=COALESCE(excluded.feature_branch, feature_branch), commit_sha=COALESCE(excluded.commit_sha, commit_sha), merge_ref=COALESCE(excluded.merge_ref, merge_ref), created_at=COALESCE(excluded.created_at, created_at), completed_at=COALESCE(excluded.completed_at, completed_at), summary_json=COALESCE(excluded.summary_json, summary_json)",t.landingId,t.session??null,t.itemId??null,t.queuePrdId??null,t.runId??null,t.buildSessionId??null,t.status??null,t.prUrl??null,t.featureBranch??null,t.commitSha??null,t.mergeRef??null,t.createdAt??null,t.completedAt??null,ke(t.summary)),W1(V(e,"SELECT * FROM landing_links WHERE landing_id = ?",t.landingId))}function _w(e){return Ue({runId:e.run_id,categories:ee("store_maintenance_runs","categories_json",e.categories_json),startedAt:S(e.started_at),finishedAt:S(e.finished_at),prunedCounts:ee("store_maintenance_runs","pruned_counts_json",e.pruned_counts_json),archivedCounts:ee("store_maintenance_runs","archived_counts_json",e.archived_counts_json),preservedEvidenceCounts:ee("store_maintenance_runs","preserved_evidence_counts_json",e.preserved_evidence_counts_json),status:S(e.status),errorSummary:S(e.error_summary)})}function bi(e,t){return U(e,"INSERT INTO store_maintenance_runs (run_id,categories_json,started_at,finished_at,pruned_counts_json,archived_counts_json,preserved_evidence_counts_json,status,error_summary) VALUES (?,?,?,?,?,?,?,?,?) ON CONFLICT(run_id) DO UPDATE SET categories_json=excluded.categories_json, started_at=excluded.started_at, finished_at=excluded.finished_at, pruned_counts_json=excluded.pruned_counts_json, archived_counts_json=excluded.archived_counts_json, preserved_evidence_counts_json=excluded.preserved_evidence_counts_json, status=excluded.status, error_summary=excluded.error_summary",t.runId,ke(t.categories),t.startedAt??null,t.finishedAt??null,ke(t.prunedCounts),ke(t.archivedCounts),ke(t.preservedEvidenceCounts),t.status??null,t.errorSummary??null),_w(V(e,"SELECT * FROM store_maintenance_runs WHERE run_id = ?",t.runId))}function Aw(e,t=10){return q(e,"SELECT * FROM store_maintenance_runs ORDER BY COALESCE(finished_at, started_at) DESC, run_id DESC LIMIT ?",Math.max(0,Math.min(Math.trunc(t),100))).map(_w)}var X1="'applied','dismissed','failed','complete','completed','cancelled','canceled','terminal','merged','shipped'",Q1=`NOT EXISTS (
|
|
445
|
+
SELECT 1 FROM recommendation_lanes prl
|
|
446
|
+
WHERE prl.run_id = rr.run_id AND (
|
|
447
|
+
EXISTS (SELECT 1 FROM session_plan_items spi JOIN session_plans sp ON sp.session = spi.session WHERE spi.source_recommendation_ref IN (prl.lane_id, prl.lane_ref) AND lower(COALESCE(sp.status,'')) NOT IN (${X1}))
|
|
448
|
+
OR EXISTS (SELECT 1 FROM session_plan_epics spe JOIN session_plans sp ON sp.session = spe.session WHERE spe.source_recommendation_ref IN (prl.lane_id, prl.lane_ref) AND lower(COALESCE(sp.status,'')) NOT IN (${X1}))
|
|
449
|
+
OR EXISTS (SELECT 1 FROM lifecycle_evidence le, json_tree(CASE WHEN json_valid(le.links_json) THEN le.links_json ELSE '[]' END) jt WHERE le.is_current = 1 AND jt.type IN ('text','integer','real') AND CAST(jt.value AS TEXT) IN (prl.lane_id, prl.lane_ref))
|
|
450
|
+
)
|
|
451
|
+
)`,dI={"lifecycle-event-payloads":(e,t,i)=>`SELECT event_key AS id,${i?"*":"event_key,event_type,timestamp"} FROM lifecycle_events WHERE payload_prunable = 1 AND payload_json IS NOT NULL AND timestamp IS NOT NULL AND timestamp < '${ww(e)}' ORDER BY timestamp,event_key`,"planning-task-payloads":(e,t,i)=>`SELECT task_id AS id,${i?"*":"task_id,purpose,status_snapshot,updated_at,(raw_request_json IS NOT NULL) AS has_raw_request,(raw_result_json IS NOT NULL) AS has_raw_result"} FROM planning_tasks WHERE raw_payload_prunable = 1 AND COALESCE(updated_at,created_at) IS NOT NULL AND COALESCE(updated_at,created_at) < '${ww(e)}' AND (raw_request_json IS NOT NULL OR raw_result_json IS NOT NULL) AND lower(COALESCE(status_snapshot,'')) IN ('applied','dismissed','failed','complete','completed','cancelled','canceled','terminal') ORDER BY updated_at,task_id`,"superseded-recommendation-runs":(e,t,i)=>`SELECT rr.run_id AS id, ${i?"rr.*":"rr.run_id,rr.created_at"}, (SELECT count(*) FROM recommendation_lanes rl WHERE rl.run_id=rr.run_id) AS lane_count, (SELECT count(*) FROM recommendation_lane_items rli JOIN recommendation_lanes rl ON rl.lane_id=rli.lane_id WHERE rl.run_id=rr.run_id) AS lane_item_count FROM recommendation_runs rr WHERE rr.is_current = 0 AND rr.created_at IS NOT NULL AND rr.created_at < '${ww(e)}' AND ${Q1} AND ${rG("rr.run_id",t)} ORDER BY rr.created_at,rr.run_id`};function Z1(e,t,i){let r=dI[t](i.cutoff,i.keepLatestRecommendationRuns,!1),o=V(e,`SELECT count(*) AS count FROM (${r})`)?.count??0,s=q(e,`${r} LIMIT ?`,i.rowLimit),a=i.archive&&!i.dryRun?Ule(e,t,q(e,`${dI[t](i.cutoff,i.keepLatestRecommendationRuns,!0)} LIMIT ?`,i.rowLimit)):[];return{count:o,ids:s.map(c=>String(c.id)),samples:s.slice(0,i.sampleLimit).map(c=>Mle(t,c)),archiveRows:a}}function J1(e,t){let i={};for(let r of Object.keys(dI))i[r]=V(e,`SELECT count(*) AS count FROM (${dI[r](t.cutoff,t.keepLatestRecommendationRuns,!1)})`)?.count??0;return i}function Y1(e,t,i,r,o){if(i.length===0)return 0;let s=0;for(let a of i){let c=0;t==="lifecycle-event-payloads"&&U(e,"UPDATE lifecycle_events SET payload_json = NULL WHERE event_key = ? AND payload_prunable = 1 AND payload_json IS NOT NULL AND timestamp IS NOT NULL AND timestamp < ?",a,r),t==="planning-task-payloads"&&U(e,"UPDATE planning_tasks SET raw_request_json = NULL, raw_result_json = NULL WHERE task_id = ? AND raw_payload_prunable = 1 AND COALESCE(updated_at,created_at) IS NOT NULL AND COALESCE(updated_at,created_at) < ? AND (raw_request_json IS NOT NULL OR raw_result_json IS NOT NULL) AND lower(COALESCE(status_snapshot,'')) IN ('applied','dismissed','failed','complete','completed','cancelled','canceled','terminal')",a,r),t==="superseded-recommendation-runs"&&U(e,`DELETE FROM recommendation_runs AS rr WHERE run_id = ? AND is_current = 0 AND created_at IS NOT NULL AND created_at < ? AND ${Q1} AND ${rG("rr.run_id",o)}`,a,r),c=V(e,"SELECT changes() AS changes")?.changes??0,s+=c}return s}function eG(e){let t=q(e,"SELECT * FROM lifecycle_evidence WHERE is_current = 1");for(let i of t){let r={lifecycleState:i.lifecycle_state,reasonCode:tn(i.reason_code),status:tn(i.status),summary:tn(i.summary),occurredAt:tn(i.occurred_at),itemRef:i.item_ref,session:tn(i.session),planningTaskId:tn(i.planning_task_id),queuePrdId:tn(i.queue_prd_id),runId:tn(i.run_id),buildSessionId:tn(i.build_session_id),landingId:tn(i.landing_id),sourceEventKey:tn(i.source_event_key),links:ee("lifecycle_evidence","links_json",i.links_json,null)};U(e,"UPDATE lifecycle_evidence SET retained_summary_json = ? WHERE evidence_key = ?",JSON.stringify(r),i.evidence_key)}return t.length}function Tw(e){let i=["backlog_items","epics","item_dependencies","session_plans","session_plan_items","session_plan_epics","queue_prds","build_runs","build_sessions","landing_links"].map(r=>({name:r,count:V(e,`SELECT count(*) AS count FROM ${r}`)?.count??0}));return i.push({name:"current_lifecycle_evidence",count:V(e,"SELECT count(*) AS count FROM lifecycle_evidence WHERE is_current = 1")?.count??0}),i.push({name:"current_recommendation_runs",count:V(e,"SELECT count(*) AS count FROM recommendation_runs WHERE is_current = 1")?.count??0}),i.push({name:"current_recommendation_lanes",count:V(e,"SELECT count(*) AS count FROM recommendation_lanes rl JOIN recommendation_runs rr ON rr.run_id = rl.run_id WHERE rr.is_current = 1")?.count??0}),i.push({name:"current_recommendation_lane_items",count:V(e,"SELECT count(*) AS count FROM recommendation_lane_items rli JOIN recommendation_lanes rl ON rl.lane_id = rli.lane_id JOIN recommendation_runs rr ON rr.run_id = rl.run_id WHERE rr.is_current = 1")?.count??0}),i}function tG(e,t){let i=new Map(t.map(r=>[r.name,r.count]));for(let r of e)if(i.get(r.name)!==r.count)throw new Error(`Protected count changed for ${r.name}: ${r.count} -> ${i.get(r.name)}`)}function nG(e){return q(e,"SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name").map(i=>({table:i.name,count:V(e,`SELECT count(*) AS count FROM ${i.name}`)?.count??0}))}function uI(e){Wp(e,"PRAGMA wal_checkpoint(TRUNCATE)")}function iG(e){Wp(e,"VACUUM")}function Mle(e,t){return e==="lifecycle-event-payloads"?{eventKey:t.event_key,eventType:t.event_type,occurredAt:tn(t.timestamp),summary:t.event_type}:e==="planning-task-payloads"?{taskId:t.task_id,purpose:tn(t.purpose),status:tn(t.status_snapshot),updatedAt:tn(t.updated_at),hasRawRequest:t.has_raw_request!=null?!!t.has_raw_request:t.raw_request_json!=null,hasRawResult:t.has_raw_result!=null?!!t.has_raw_result:t.raw_result_json!=null}:{runId:t.run_id,createdAt:tn(t.created_at),isCurrent:!1,laneCount:Number(t.lane_count??0),laneItemCount:Number(t.lane_item_count??0)}}function Ule(e,t,i){let r=i.map(o=>Ow(t,o));if(t!=="superseded-recommendation-runs")return r;for(let o of i){let s=o.run_id;for(let a of q(e,"SELECT * FROM recommendation_lanes WHERE run_id = ? ORDER BY sequence,lane_id",s))r.push(Ow(t,{archive_table:"recommendation_lanes",...a}));for(let a of q(e,"SELECT rli.* FROM recommendation_lane_items rli JOIN recommendation_lanes rl ON rl.lane_id = rli.lane_id WHERE rl.run_id = ? ORDER BY rl.sequence,rli.sequence,rli.item_ref",s))r.push(Ow(t,{archive_table:"recommendation_lane_items",...a}))}return r}function Ow(e,t){let i={category:e};for(let[r,o]of Object.entries(t))i[r]=Fle(o);return i}function Fle(e){return e===void 0?null:typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null?e:JSON.parse(JSON.stringify(e))}function tn(e){return typeof e=="string"?e:void 0}function rG(e,t){return`${e} NOT IN (SELECT run_id FROM recommendation_runs WHERE is_current=0 AND created_at IS NOT NULL ORDER BY created_at DESC, run_id DESC LIMIT ${t})`}function ww(e){return e.replaceAll("'","''")}function oG(e){return Ue({documentType:e.document_type,documentId:e.document_id,title:S(e.title),tagsText:S(e.tags_text),summaryText:S(e.summary_text),bodyText:S(e.body_text),itemIdsText:S(e.item_ids_text),epicIdsText:S(e.epic_ids_text),recommendationRefsText:S(e.recommendation_refs_text),sourceSha256:S(e.source_sha256),updatedAt:S(e.updated_at),dirty:tr(e.dirty)})}function sG(e,t){return ti("documentType",t.documentType,Hp),e.transaction(()=>{U(e,"INSERT INTO search_documents (document_type,document_id,title,tags_text,summary_text,body_text,item_ids_text,epic_ids_text,recommendation_refs_text,source_sha256,updated_at,dirty) VALUES (?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(document_type,document_id) DO UPDATE SET title=excluded.title, tags_text=excluded.tags_text, summary_text=excluded.summary_text, body_text=excluded.body_text, item_ids_text=excluded.item_ids_text, epic_ids_text=excluded.epic_ids_text, recommendation_refs_text=excluded.recommendation_refs_text, source_sha256=excluded.source_sha256, updated_at=excluded.updated_at, dirty=excluded.dirty",t.documentType,t.documentId,t.title??null,t.tagsText??null,t.summaryText??null,t.bodyText??null,t.itemIdsText??null,t.epicIdsText??null,t.recommendationRefsText??null,t.sourceSha256??null,t.updatedAt??null,wr(t.dirty,!1)),U(e,"DELETE FROM search_documents_fts WHERE document_type = ? AND document_id = ?",t.documentType,t.documentId),U(e,"INSERT INTO search_documents_fts (document_type,document_id,title,tags_text,summary_text,body_text,item_ids_text,epic_ids_text,recommendation_refs_text) VALUES (?,?,?,?,?,?,?,?,?)",t.documentType,t.documentId,t.title??"",t.tagsText??"",t.summaryText??"",t.bodyText??"",t.itemIdsText??"",t.epicIdsText??"",t.recommendationRefsText??"")}),oG(V(e,"SELECT * FROM search_documents WHERE document_type = ? AND document_id = ?",t.documentType,t.documentId))}function _a(e,t){Ss(e,[t])}function Ss(e,t){e.transaction(()=>{for(let i of t){ti("documentType",i.documentType,Hp);let r=i.markedAt??sw();U(e,"INSERT INTO search_index_dirty_records (document_type,document_id,reason,marked_at) VALUES (?,?,?,?) ON CONFLICT(document_type,document_id) DO UPDATE SET reason=excluded.reason, marked_at=excluded.marked_at",i.documentType,i.documentId,i.reason??null,r),U(e,"UPDATE search_documents SET dirty = 1 WHERE document_type = ? AND document_id = ?",i.documentType,i.documentId),U(e,"UPDATE search_index_state SET dirty = 1, dirty_since = COALESCE(dirty_since, ?), dirty_reason = ? WHERE id = 1",r,i.reason??null)}})}function Cw(e,t={}){e.transaction(()=>{U(e,"DELETE FROM search_index_dirty_records"),U(e,"UPDATE search_documents SET dirty = 0"),U(e,"UPDATE search_index_state SET dirty = 0, dirty_since = NULL, dirty_reason = NULL, last_rebuilt_at = ? WHERE id = 1",t.rebuiltAt??sw())})}function qle(e){let t=V(e,"SELECT marked_at, reason FROM search_index_dirty_records ORDER BY marked_at, document_type, document_id LIMIT 1");t?U(e,"UPDATE search_index_state SET dirty = 1, dirty_since = ?, dirty_reason = ? WHERE id = 1",t.marked_at??null,t.reason??null):U(e,"UPDATE search_index_state SET dirty = 0, dirty_since = NULL, dirty_reason = NULL WHERE id = 1")}function aG(e,t){if(t.length===0)return 0;let i=t.map(()=>"?").join(","),r=V(e,`SELECT COUNT(*) AS count FROM search_index_dirty_records WHERE document_type IN (${i})`,...t)?.count??0;return e.transaction(()=>{U(e,`DELETE FROM search_index_dirty_records WHERE document_type IN (${i})`,...t),U(e,`UPDATE search_documents SET dirty = 0 WHERE document_type IN (${i})`,...t),qle(e)}),r}function lI(e){let t=V(e,"SELECT * FROM search_index_state WHERE id = 1");return Ue({id:1,dirty:tr(t.dirty),dirtySince:S(t.dirty_since),dirtyReason:S(t.dirty_reason),lastRebuiltAt:S(t.last_rebuilt_at)})}function Lw(e,t){return e.transaction(()=>t.map(i=>sG(e,i)))}function Dw(e,t){e.transaction(()=>{U(e,"DELETE FROM search_documents WHERE document_type = ? AND document_id = ?",t.documentType,t.documentId),U(e,"DELETE FROM search_documents_fts WHERE document_type = ? AND document_id = ?",t.documentType,t.documentId)})}function $w(e,t,i){let r=q(e,"SELECT document_id FROM search_documents WHERE document_type = ?",t),o=new Set(i),s=r.filter(a=>!o.has(a.document_id));return e.transaction(()=>{for(let a of s)Dw(e,{documentType:t,documentId:a.document_id})}),s.length}function cG(e,t){if(!t?.length)return V(e,"SELECT COUNT(*) AS count FROM search_index_dirty_records")?.count??0;let i=t.map(()=>"?").join(",");return V(e,`SELECT COUNT(*) AS count FROM search_index_dirty_records WHERE document_type IN (${i})`,...t)?.count??0}function Nw(e){Wp(e,"INSERT INTO search_documents_fts(search_documents_fts) VALUES('optimize')")}function nr(e,t,i,...r){return q(e,t,...r).map(o=>S(o[i])).filter(o=>!!o)}function dG(e,t,i,r){return q(e,`SELECT section_name, content FROM ${t} WHERE ${i} = ? ORDER BY section_name`,r).map(o=>({name:o.section_name,content:o.content}))}function uG(e,t){return q(e,`SELECT * FROM backlog_items ${t?.length?`WHERE id IN (${t.map(()=>"?").join(",")})`:""} ORDER BY id`,...t??[]).map(r=>({id:r.id,title:r.title,body:r.body,userStatus:r.user_status,priority:S(r.priority),updatedAt:S(r.updated_at),epicRef:S(r.epic_ref),epicId:S(r.epic_id),tags:nr(e,"SELECT tag FROM backlog_item_tags WHERE item_id = ? ORDER BY tag","tag",r.id),sections:dG(e,"backlog_item_sections","item_id",r.id),dependencies:nr(e,"SELECT COALESCE(resolved_dependency_item_id, dependency_ref) AS ref FROM item_dependencies WHERE item_id = ? ORDER BY dependency_ref","ref",r.id)}))}function lG(e,t){return q(e,`SELECT * FROM epics ${t?.length?`WHERE id IN (${t.map(()=>"?").join(",")})`:""} ORDER BY id`,...t??[]).map(r=>({id:r.id,title:r.title,body:r.body,userStatus:r.user_status,priority:S(r.priority),updatedAt:S(r.updated_at),tags:nr(e,"SELECT tag FROM epic_tags WHERE epic_id = ? ORDER BY tag","tag",r.id),sections:dG(e,"epic_sections","epic_id",r.id),itemIds:nr(e,"SELECT id FROM backlog_items WHERE epic_id = ? OR epic_ref = ? ORDER BY id","id",r.id,r.id)}))}function pG(e,t){return q(e,`SELECT * FROM session_plans ${t?.length?`WHERE session IN (${t.map(()=>"?").join(",")})`:""} ORDER BY session`,...t??[]).map(r=>{let o=r.session;return{session:o,path:S(r.path),topic:S(r.topic),status:S(r.status),planningType:S(r.planning_type),planningDepth:S(r.planning_depth),profile:S(r.profile),updatedAt:S(r.updated_at)??S(r.submitted_at)??S(r.created_at),summaryText:S(r.summary_text),readinessSummary:ee("session_plans","readiness_summary_json",r.readiness_summary_json),itemIds:nr(e,"SELECT COALESCE(item_id, item_ref) AS ref FROM session_plan_items WHERE session = ? ORDER BY sequence, item_ref","ref",o),epicIds:nr(e,"SELECT COALESCE(epic_id, epic_ref) AS ref FROM session_plan_epics WHERE session = ? ORDER BY sequence, epic_ref","ref",o),recommendationRefs:nr(e,"SELECT source_recommendation_ref AS ref FROM session_plan_items WHERE session = ? AND source_recommendation_ref IS NOT NULL UNION SELECT source_recommendation_ref AS ref FROM session_plan_epics WHERE session = ? AND source_recommendation_ref IS NOT NULL ORDER BY ref","ref",o,o)}})}function mG(e,t,i=!0){return q(e,`SELECT rl.*, rr.is_current, rr.created_at, rr.summary_json FROM recommendation_lanes rl JOIN recommendation_runs rr ON rr.run_id = rl.run_id WHERE ${i?"1=1":"rr.is_current = 1"} ${t?.length?`AND rl.lane_id IN (${t.map(()=>"?").join(",")})`:""} ORDER BY rr.created_at DESC, rl.sequence, rl.lane_id`,...t??[]).map(o=>{let s=o.lane_id,a=q(e,"SELECT item_ref, item_id, rationale FROM recommendation_lane_items WHERE lane_id = ? ORDER BY sequence, item_ref",s),c=S(o.lane_ref);return{laneId:s,runId:o.run_id,isCurrent:Number(o.is_current)===1,laneKind:o.lane_kind,laneRef:c,title:S(o.title),profile:S(o.profile),rationale:S(o.rationale),updatedAt:S(o.created_at),runSummary:ee("recommendation_runs","summary_json",o.summary_json),itemRefs:a.map(d=>d.item_ref),itemIds:a.map(d=>S(d.item_id)).filter(d=>!!d),itemRationales:a.map(d=>S(d.rationale)).filter(d=>!!d),recommendationRefs:[c,s].filter(d=>!!d)}})}function fG(e,t){return t==="backlog_item"?nr(e,"SELECT id FROM backlog_items ORDER BY id","id"):t==="epic"?nr(e,"SELECT id FROM epics ORDER BY id","id"):t==="session_plan"?nr(e,"SELECT session FROM session_plans ORDER BY session","session"):nr(e,"SELECT lane_id FROM recommendation_lanes ORDER BY lane_id","lane_id")}function zle(e){for(let t of e??[])if(!Hp.includes(t))throw new je("invalid-input",`Invalid search document type: ${t}`)}function jw(e){return(e??"").split(/\s+/).map(t=>t.trim()).filter(Boolean)}function Gle(e){return e.replace(/[\\%_]/g,t=>`\\${t}`)}function Bw(e,t,i){return i.push(...t.map(r=>`% ${Gle(r)} %`)),`(${t.map(()=>`(' ' || COALESCE(${e}, '') || ' ') LIKE ? ESCAPE '\\'`).join(" OR ")})`}function Kle(e,t){zle(e.types);let i=[];return e.match&&(i.push("search_documents_fts MATCH ?"),t.push(e.match)),e.types?.length&&(i.push(`sd.document_type IN (${e.types.map(()=>"?").join(",")})`),t.push(...e.types)),e.sessions?.length&&(i.push(`(sd.document_type = 'session_plan' AND sd.document_id IN (${e.sessions.map(()=>"?").join(",")}))`),t.push(...e.sessions)),e.itemIds?.length&&i.push(Bw("sd.item_ids_text",e.itemIds,t)),e.epicIds?.length&&i.push(Bw("sd.epic_ids_text",e.epicIds,t)),e.recommendationRefs?.length&&i.push(Bw("sd.recommendation_refs_text",e.recommendationRefs,t)),e.includeHistoricalRecommendations!==!0&&i.push("(sd.document_type <> 'recommendation' OR EXISTS (SELECT 1 FROM recommendation_lanes rl JOIN recommendation_runs rr ON rr.run_id = rl.run_id WHERE rl.lane_id = sd.document_id AND rr.is_current = 1))"),i.length?`WHERE ${i.join(" AND ")}`:""}function Mw(e,t){return`FROM search_documents_fts JOIN search_documents sd ON sd.document_type = search_documents_fts.document_type AND sd.document_id = search_documents_fts.document_id ${Kle(e,t)}`}function pI(e,t){let i=[],r=Mw(t,i),o=t.match?"bm25(search_documents_fts, 0, 0, 8, 5, 2, 1, 4, 4, 4)":"NULL",s=t.match?"snippet(search_documents_fts, -1, '<mark>', '</mark>', '\u2026', 24)":"NULL";return q(e,`SELECT sd.document_type, sd.document_id, COALESCE(sd.title, sd.document_id) AS title, ${o} AS rank, ${s} AS snippet, sd.updated_at, sd.item_ids_text, sd.epic_ids_text, sd.recommendation_refs_text, (SELECT rl.run_id FROM recommendation_lanes rl WHERE rl.lane_id = sd.document_id) AS recommendation_run_id ${r} ORDER BY ${t.match?"rank ASC,":""} CASE sd.document_type WHEN 'backlog_item' THEN 0 WHEN 'epic' THEN 1 WHEN 'session_plan' THEN 2 ELSE 3 END, COALESCE(sd.updated_at,'') DESC, sd.document_id ASC LIMIT ? OFFSET ?`,...i,t.limit,t.offset).map(gG)}function Uw(e,t){let i=[],r=Mw({...t,limit:1,offset:0},i);return V(e,`SELECT COUNT(*) AS count ${r}`,...i)?.count??0}function Fw(e,t){let i=[],r=Mw({...t,limit:1,offset:0},i),o=q(e,`SELECT sd.document_type, COUNT(*) AS count ${r} GROUP BY sd.document_type`,...i);return Object.fromEntries(o.map(s=>[s.document_type,s.count]))}function Aa(e){let t=V(e,"SELECT * FROM search_index_state WHERE id = 1"),i=q(e,"SELECT DISTINCT document_type FROM search_index_dirty_records ORDER BY document_type"),r=V(e,"SELECT COUNT(*) AS count FROM search_index_dirty_records")?.count??0;return Ue({dirty:Number(t.dirty)===1||r>0,dirtyCount:r,dirtyTypes:i.map(o=>o.document_type),dirtySince:S(t.dirty_since),dirtyReason:S(t.dirty_reason),lastRebuiltAt:S(t.last_rebuilt_at)})}function gG(e){return Ue({documentType:e.document_type,documentId:e.document_id,title:e.title,rank:typeof e.rank=="number"?e.rank:void 0,snippet:S(e.snippet),updatedAt:S(e.updated_at),itemIdsText:S(e.item_ids_text),epicIdsText:S(e.epic_ids_text),recommendationRefsText:S(e.recommendation_refs_text),recommendationRunId:S(e.recommendation_run_id)})}function qw(e){return Ue({itemIds:jw(e.itemIdsText),epicIds:jw(e.epicIdsText),...e.documentType==="session_plan"?{session:e.documentId}:{},recommendationRef:jw(e.recommendationRefsText)[0],...e.documentType==="recommendation"?{runId:e.recommendationRunId}:{}})}var Vle=new Set(["shipped","stale","superseded"]);function SG(e,t,i,r){return q(e,`SELECT tag FROM ${t} WHERE ${i} = ? ORDER BY tag`,r).map(o=>o.tag)}function yG(e,t){let i=t.id;return{id:i,title:t.title,body:t.body,userStatus:t.user_status,priority:S(t.priority),source:S(t.source),createdAt:S(t.created_at),updatedAt:S(t.updated_at),lastCheckedAt:S(t.last_checked_at),staleAfter:S(t.stale_after),epicId:S(t.epic_id)??S(t.epic_ref),epicRef:S(t.epic_ref),bodySha256:S(t.body_sha256),recordSha256:S(t.record_sha256),importOrigin:S(t.import_origin),importPath:S(t.import_path),frontmatter:ee("backlog_items","frontmatter_json",t.frontmatter_json,{}),tags:SG(e,"backlog_item_tags","item_id",i)}}function hG(e,t){let i=t.id;return{id:i,title:t.title,body:t.body,userStatus:t.user_status,priority:S(t.priority),source:S(t.source),createdAt:S(t.created_at),updatedAt:S(t.updated_at),frontmatter:ee("epics","frontmatter_json",t.frontmatter_json,{}),tags:SG(e,"epic_tags","epic_id",i)}}function mI(e,t){let i=V(e,"SELECT * FROM backlog_items WHERE id = ?",t);return i?yG(e,i):void 0}function ys(e){return q(e,"SELECT * FROM backlog_items ORDER BY id").map(t=>yG(e,t))}function zw(e,t){let i=V(e,"SELECT * FROM epics WHERE id = ?",t);return i?hG(e,i):void 0}function IG(e){return q(e,"SELECT * FROM epics ORDER BY id").map(t=>hG(e,t))}function bG(e,t){return q(e,"SELECT item_id, section_name, content FROM backlog_item_sections WHERE item_id = ? ORDER BY section_name",t).map(i=>({ownerId:i.item_id,sectionName:i.section_name,content:i.content}))}function RG(e,t){return q(e,"SELECT epic_id, section_name, content FROM epic_sections WHERE epic_id = ? ORDER BY section_name",t).map(i=>({ownerId:i.epic_id,sectionName:i.section_name,content:i.content}))}function Gw(e){return q(e,`
|
|
452
|
+
SELECT d.*, target.id AS target_item_id, target.user_status AS target_user_status
|
|
453
|
+
FROM item_dependencies d
|
|
454
|
+
LEFT JOIN backlog_items target ON target.id = COALESCE(d.resolved_dependency_item_id, d.dependency_ref)
|
|
455
|
+
ORDER BY d.item_id, d.dependency_ref
|
|
456
|
+
`).map(Hle)}function Hle(e){let t=e.dependency_status,i=S(e.target_item_id),r=S(e.target_user_status),o=t==="external"?S(e.resolved_dependency_item_id):S(e.resolved_dependency_item_id)??i,s=t==="external"?"external":r?Wle(r):t;return{itemId:e.item_id,dependencyRef:e.dependency_ref,dependencyStatus:s,...o?{resolvedDependencyItemId:o}:{}}}function Wle(e){return Vle.has(e)?"closed":"open"}function xG(e){return{evidenceKey:e.evidence_key,itemId:S(e.item_id)??e.item_ref,itemRef:e.item_ref,lifecycleState:e.lifecycle_state,reasonCode:S(e.reason_code),evidenceKind:S(e.evidence_kind),status:S(e.status),session:S(e.session),planningTaskId:S(e.planning_task_id),queuePrdId:S(e.queue_prd_id),queuePrdStatus:S(e.queue_prd_status),runId:S(e.run_id),buildSessionId:S(e.build_session_id),landingId:S(e.landing_id),occurredAt:S(e.occurred_at),summary:S(e.summary),isCurrent:Number(e.is_current)===1,isTerminal:Number(e.is_terminal)===1,links:ee("lifecycle_evidence","links_json",e.links_json)}}var EG="SELECT le.*, qp.status AS queue_prd_status FROM lifecycle_evidence le LEFT JOIN queue_prds qp ON qp.prd_id = le.queue_prd_id";function em(e){return q(e,`${EG} WHERE le.is_current = 1 ORDER BY le.occurred_at DESC, le.evidence_key`).map(xG)}function fI(e,t){if(t.length===0)return[];let i=t.map(()=>"?").join(",");return q(e,`${EG} WHERE (le.item_id IN (${i}) OR le.item_ref IN (${i})) AND le.is_current = 1 ORDER BY le.occurred_at DESC, le.evidence_key`,...t,...t).map(xG)}function Tr(e){return q(e,"SELECT spi.*, sp.status, sp.path FROM session_plan_items spi JOIN session_plans sp ON sp.session = spi.session ORDER BY spi.session, spi.sequence").map(t=>({session:t.session,itemId:S(t.item_id),itemRef:t.item_ref,role:t.role,provenance:t.provenance,sourceTaskId:S(t.source_task_id),sourceRecommendationRef:S(t.source_recommendation_ref),promotedAt:S(t.promoted_at),sequence:typeof t.sequence=="number"?t.sequence:void 0,status:S(t.status),path:S(t.path)}))}function uo(e){return q(e,"SELECT pti.*, pt.status_snapshot, pt.updated_at, pt.created_at FROM planning_task_items pti JOIN planning_tasks pt ON pt.task_id = pti.task_id ORDER BY pt.updated_at DESC, pti.sequence").map(t=>({taskId:t.task_id,itemId:S(t.item_id),itemRef:t.item_ref,role:S(t.role),status:S(t.status_snapshot),updatedAt:S(t.updated_at),createdAt:S(t.created_at)}))}function lo(e){let t=q(e,"SELECT * FROM queue_prds").map(s=>({kind:"queue-prd",id:s.prd_id,session:S(s.session),status:S(s.status),timestamp:S(s.updated_at)??S(s.submitted_at)??S(s.created_at),path:S(s.source_path),queuePrdId:s.prd_id})),i=q(e,"SELECT * FROM build_runs").map(s=>({kind:"build-run",id:s.run_id,session:S(s.session),status:S(s.status),timestamp:S(s.finished_at)??S(s.started_at),runId:s.run_id,buildSessionId:S(s.build_session_id),queuePrdId:S(s.queue_prd_id)})),r=q(e,"SELECT * FROM build_sessions").map(s=>({kind:"build-session",id:s.build_session_id,session:S(s.session),status:S(s.status),timestamp:S(s.finished_at)??S(s.started_at),buildSessionId:s.build_session_id})),o=q(e,"SELECT * FROM landing_links").map(s=>({kind:"landing",id:s.landing_id,itemId:S(s.item_id),session:S(s.session),status:S(s.status),timestamp:S(s.completed_at)??S(s.created_at),url:S(s.pr_url),runId:S(s.run_id),buildSessionId:S(s.build_session_id),queuePrdId:S(s.queue_prd_id)}));return[...t,...i,...r,...o]}function Kw(e,t){return q(e,"SELECT * FROM recommendation_lanes WHERE run_id = ? ORDER BY sequence, lane_id",t).map(i=>({laneId:i.lane_id,runId:i.run_id,laneKind:i.lane_kind,laneRef:S(i.lane_ref),title:S(i.title),sequence:Number(i.sequence??0),profile:S(i.profile),rationale:S(i.rationale)}))}var gI=["abandoned","canceled","cancelled","complete","completed","deleted","done","merged","removed","shipped","superseded"],Xle=new Set(gI),Qle=new Set(["applied","dismissed","failed","cancelled","canceled","completed","done"]),Zle=new Set(["completed","cancelled","canceled","failed","removed","skipped"]),Jle=new Set(["cancelled","canceled","complete","completed","deleted","done","failed","removed","skipped"]),Yle=new Set(["failed","partial","shipped","merged"]),epe=new Set(["queued","running","active","in-progress"]);function ir(e){let t=e?.trim().toLowerCase();return t&&t.length>0?t:void 0}function tm(e){let t=ir(e);return t!==void 0&&Xle.has(t)}function PG(e){return!tm(e)}function tpe(e){let t=ir(e);return t!==void 0&&Qle.has(t)}function Vw(e){let t=ir(e);return t!==void 0&&epe.has(t)&&!tpe(t)}function vt(e){let t=ir(e);return t!==void 0&&Zle.has(t)}function SI(e){let t=ir(e);return t!==void 0&&Jle.has(t)}function rr(e){return!SI(e)}function yI(e){return typeof e=="string"&&Yle.has(e)}function kG(e){return ir(e)==="submitted"?"submitted-session-plan":"planned-session-plan"}function vG(e){return ir(e)==="submitted"?"submitted":"planned"}function Hw(e){return e.lifecycleState==="planned"&&(e.reasonCode==="planned-session-plan"||e.evidenceKind==="session-plan"||e.session!==void 0)}function _G(e,t,i=!1){if(i)return{planEligible:!1,planEligibilityReasonCode:"unresolved-dependency",planEligibilityReasonMessage:`Item ${e} has unresolved dependencies.`,planEligibilityLinks:[]};let r=t[0];return r===void 0?{planEligible:!0}:{planEligible:!1,planEligibilityReasonCode:r.reasonCode,planEligibilityReasonMessage:`Item ${e} is covered by ${r.reasonCode}.`,planEligibilityLinks:r.associatedLinks}}function Ww(e){return{session:e.session,path:S(e.path),topic:S(e.topic),status:S(e.status),planningType:S(e.planning_type),planningDepth:S(e.planning_depth),profile:S(e.profile),agentProfile:S(e.agent_profile),eforgeSessionId:S(e.eforge_session_id),submittedAt:S(e.submitted_at),createdAt:S(e.created_at),updatedAt:S(e.updated_at),summaryText:S(e.summary_text),artifactBodyHash:S(e.artifact_body_hash),readinessSummary:ee("session_plans","readiness_summary_json",e.readiness_summary_json),frontmatter:ee("session_plans","frontmatter_json",e.frontmatter_json,{})}}function AG(e,t=!1){let r=`COALESCE(lower(trim(status)),'draft') NOT IN (${gI.map(()=>"?").join(",")}) AND COALESCE(import_origin,'') <> 'trace-sidecar'`;return q(e,t?`SELECT * FROM session_plans WHERE ${r} ORDER BY updated_at DESC, session`:`SELECT * FROM session_plans WHERE ${r} AND COALESCE(lower(trim(status)),'draft') <> 'submitted' ORDER BY updated_at DESC, session`,...gI).map(Ww)}function OG(e){return q(e,"SELECT * FROM session_plans WHERE COALESCE(import_origin,'') <> 'trace-sidecar' ORDER BY updated_at DESC, session").map(Ww)}function hI(e,t){let i=V(e,"SELECT * FROM session_plans WHERE session = ?",t);return i?Ww(i):void 0}function wG(e,t){return q(e,`SELECT * FROM session_plan_items${t?" WHERE session = ?":""} ORDER BY session, sequence, item_ref`,...t?[t]:[]).map(i=>({session:i.session,itemRef:i.item_ref,itemId:S(i.item_id),role:i.role,provenance:i.provenance,sourceTaskId:S(i.source_task_id),sourceRecommendationRef:S(i.source_recommendation_ref),promotedAt:S(i.promoted_at),sequence:typeof i.sequence=="number"?i.sequence:void 0}))}function TG(e,t){return q(e,`SELECT * FROM session_plan_epics${t?" WHERE session = ?":""} ORDER BY session, sequence, epic_ref`,...t?[t]:[]).map(i=>({session:i.session,epicRef:i.epic_ref,epicId:S(i.epic_id),role:i.role,provenance:i.provenance}))}import{createHash as rpe}from"crypto";function ope(e,t){let i=Kt(e,{create:!0,migrate:!0});try{return t(i)}finally{i.close()}}function Te(e,t){return ope(e,i=>i.transaction(()=>t(i)))}function lt(e=new Date){return e.toISOString()}function Dn(e){return rpe("sha256").update(e).digest("hex")}function Oa(e){return Dn(JSON.stringify(e)).slice(0,32)}function wa(e,t,i=lt()){Ss(e,t.map(r=>({...r,markedAt:i})))}function CG(e,t,i="canonical-backlog-write"){_a(e,{documentType:"backlog_item",documentId:t,reason:i})}function Xw(e,t,i="canonical-epic-write"){_a(e,{documentType:"epic",documentId:t,reason:i})}function nm(e,t,i="canonical-recommendation-write"){let r=Kw(e,t);if(r.length===0){_a(e,{documentType:"recommendation",documentId:t,reason:i});return}Ss(e,r.map(o=>({documentType:"recommendation",documentId:o.laneId,reason:i})))}function Cr(e,t){return Te(e,i=>dpe(i,e,t))}function dpe(e,t,i){let r=cI(e,i.session),o=i.content??fpe(i.path),s=o?gpe(o):{frontmatter:r?.frontmatter??i.frontmatter??{},body:""},a=Spe(r?.frontmatter??{},s.frontmatter,i.frontmatter??{}),c=ype(a,i),d=lt(),u=o?Dn(o):r?.artifactBodyHash,l=i.readinessSummary??(u===r?.artifactBodyHash?r?.readinessSummary:void 0),p=aI(e,{session:i.session,path:i.path?cpe(t,i.path):r?.path,topic:i.topic??Ta(a.topic)??r?.topic,status:hpe(r?.status,i.status,Ta(a.status)),planningType:i.planningType??Ta(a.planning_type)??r?.planningType,planningDepth:i.planningDepth??Ta(a.planning_depth)??r?.planningDepth,profile:i.profile??Ta(a.profile)??r?.profile,agentProfile:i.agentProfile??Ta(a.agent_profile)??r?.agentProfile,eforgeSessionId:i.eforgeSessionId??r?.eforgeSessionId,submittedAt:i.submittedAt??r?.submittedAt,createdAt:i.createdAt??r?.createdAt??d,updatedAt:i.updatedAt??d,summaryText:i.summaryText??r?.summaryText,artifactBodyHash:u,readinessSummary:l,frontmatter:a});if(upe(e,{session:i.session,itemIds:c.itemIds,epicIds:c.epicIds,sourceRecommendationRef:c.recommendationRef,sourceTaskId:i.sourceTaskId,provenance:i.provenance??"canonical-sync"}),tm(p.status))ppe(e,i.session,p.status,i.updatedAt??d);else for(let m of c.itemIds)Kd(e,{evidenceKey:`planned:${i.session}:${m}`,itemRef:m,itemId:Nt(e,m)?.id,session:i.session,lifecycleState:"planned",reasonCode:"planned-session-plan",evidenceKind:"session-plan",status:p.status,isCurrent:!0,isTerminal:!1,occurredAt:i.updatedAt??d,links:$G({session:i.session,path:p.path,status:p.status})});return wa(e,[{documentType:"session_plan",documentId:i.session,reason:"canonical-session-plan-sync"},...c.itemIds.map(m=>({documentType:"backlog_item",documentId:m,reason:"canonical-session-plan-sync"})),...c.epicIds.map(m=>({documentType:"epic",documentId:m,reason:"canonical-session-plan-sync"}))]),p}async function Qw(e,t,i,r={}){let o=await ape(i,"utf-8");return Cr(e,{...r,session:t,path:i,content:o})}function upe(e,t){let i=lt();Rw(e,{session:t.session,items:(t.itemIds??[]).map((r,o)=>({itemRef:r,itemId:Nt(e,r)?.id,role:"source",provenance:t.provenance??"canonical-sync",sourceTaskId:t.sourceTaskId,sourceRecommendationRef:t.sourceRecommendationRef,promotedAt:i,sequence:o}))}),xw(e,{session:t.session,epics:(t.epicIds??[]).map((r,o)=>({epicRef:r,epicId:va(e,r)?.id,role:"source",provenance:t.provenance??"canonical-sync",sourceTaskId:t.sourceTaskId,sourceRecommendationRef:t.sourceRecommendationRef,promotedAt:i,sequence:o}))})}function Zw(e,t){let i=t.timestamp??lt(),r=cI(e,t.session);mpe(e,t.session,i),aI(e,{session:t.session,path:t.path??r?.path,topic:r?.topic,status:"submitted",planningType:r?.planningType,planningDepth:r?.planningDepth,profile:r?.profile,agentProfile:r?.agentProfile,eforgeSessionId:t.eforgeSessionId??t.queuePrdId??r?.eforgeSessionId,submittedAt:i,createdAt:r?.createdAt??i,updatedAt:i,summaryText:r?.summaryText,artifactBodyHash:r?.artifactBodyHash,readinessSummary:r?.readinessSummary,frontmatter:r?.frontmatter??{}}),Yp(e,{prdId:t.queuePrdId,session:t.session,sourcePath:t.path,status:t.status??"queued",submittedAt:i,updatedAt:i});let o=lpe(e,t.session,t.itemIds);for(let s of o)Kd(e,{evidenceKey:`submitted:${t.queuePrdId}:${s}`,itemRef:s,itemId:Nt(e,s)?.id,session:t.session,queuePrdId:t.queuePrdId,lifecycleState:"submitted",reasonCode:"submitted-session-plan",evidenceKind:"handoff",occurredAt:i,links:$G({session:t.session,queuePrdId:t.queuePrdId,path:t.path})});wa(e,[{documentType:"session_plan",documentId:t.session,reason:"session-plan-submitted"},...o.map(s=>({documentType:"backlog_item",documentId:s,reason:"session-plan-submitted"}))])}function lpe(e,t,i){let r=re(e).prepare("SELECT COALESCE(item_id, item_ref) AS item_id FROM session_plan_items WHERE session = ? AND role = 'source' ORDER BY sequence, item_ref").all(t);return[...new Set([...r.map(o=>o.item_id).filter(o=>typeof o=="string"&&o.length>0),...i??[]])]}function ppe(e,t,i,r){re(e).prepare("UPDATE lifecycle_evidence SET is_current = 0, is_terminal = 1, status = COALESCE(?, status), superseded_at = ? WHERE is_current = 1 AND session = ? AND reason_code = 'planned-session-plan'").run(i??null,r,t)}function mpe(e,t,i){re(e).prepare("UPDATE lifecycle_evidence SET is_current = 0, is_terminal = 1, superseded_at = ? WHERE is_current = 1 AND session = ? AND lifecycle_state IN ('submitted','queued','build','failed') AND landing_id IS NULL").run(i,t)}function fpe(e){if(e!==void 0)try{return spe(e,"utf-8")}catch{return}}function gpe(e){if(!e.startsWith(`---
|
|
457
|
+
`))return{frontmatter:{},body:e};let t=e.indexOf(`
|
|
458
|
+
---`,4);if(t<0)return{frontmatter:{},body:e};let i=e.slice(4,t),r=(0,DG.parse)(i);return{frontmatter:r&&typeof r=="object"&&!Array.isArray(r)?JSON.parse(JSON.stringify(r)):{},body:e.slice(t+5)}}function Spe(...e){let t=Object.assign({},...e),i=e.map(r=>r.eforge_plan).filter(r=>r!==null&&typeof r=="object"&&!Array.isArray(r)).map(r=>r);return i.length>0&&(t.eforge_plan=Object.assign({},...i)),t}function ype(e,t){let i=e.eforge_plan&&typeof e.eforge_plan=="object"&&!Array.isArray(e.eforge_plan)?e.eforge_plan:{};return{itemIds:t.sourceItemIds??LG(i.source_item_ids,i.source_item_id),epicIds:t.sourceEpicIds??LG(i.source_epic_ids,i.source_epic_id),recommendationRef:t.sourceRecommendationRef??Ta(i.source_recommendation_ref)}}function LG(e,t){let i=Array.isArray(e)?e:t?[t]:[];return[...new Set(i.filter(r=>typeof r=="string"&&r.length>0))]}function hpe(e,t,i){let r=t??i;return(e==="submitted"||e==="removed")&&(r===void 0||r==="ready")?e:r??e??"draft"}function Ta(e){return typeof e=="string"&&e.length>0?e:void 0}function $G(e){return JSON.parse(JSON.stringify(e??{},(t,i)=>i===void 0?void 0:i))}async function II(e){let i={...await ei({cwd:e.cwd,session:e.session})};if(e.profile!==void 0&&(i.profile=e.profile),e.agentProfile!==void 0){let r=e.agentProfile?.trim()??"";r.length>0?i.agent_profile=r:delete i.agent_profile}return e.openQuestions!==void 0&&(i.open_questions=e.openQuestions),await Cn({cwd:e.cwd,plan:i}),i}async function BG(e){let t=await ei({cwd:e.cwd,session:e.session}),i=Ipe(t,e);return await Cn({cwd:e.cwd,plan:i}),MG(e.cwd,e.session,i,e),i}async function im(e){let t=Ve(),i=await t.flat.list({cwd:e,includeSubmitted:!0});await Promise.all(i.map(async r=>{try{let{plan:o}=await t.flat.load({cwd:e,session:r.session}),s=rm(o);s!==null&&MG(e,r.session,o,s)}catch{}}))}function rm(e){let t=UG(e.eforge_plan),i=NG(t.source_item_ids),r=NG(t.source_epic_ids),o=jG(t.source_recommendation_ref),s=jG(t.promoted_at);return s===void 0||i.length===0&&r.length===0&&o===void 0?null:{sourceItemIds:i,sourceEpicIds:r,...o!==void 0&&{sourceRecommendationRef:o},promotedAt:s}}function MG(e,t,i,r){Cr(e,{session:t,path:Ve().flat.resolvePath({cwd:e,session:t}),status:i.status??"planning",sourceItemIds:r.sourceItemIds,sourceEpicIds:r.sourceEpicIds,...r.sourceRecommendationRef!==void 0&&{sourceRecommendationRef:r.sourceRecommendationRef},provenance:"metadata-update",updatedAt:r.promotedAt})}function Ipe(e,t){let i={...UG(e.eforge_plan),source_item_ids:[...t.sourceItemIds],source_epic_ids:[...t.sourceEpicIds],promoted_at:t.promotedAt};return t.sourceRecommendationRef!==void 0?i.source_recommendation_ref=t.sourceRecommendationRef:delete i.source_recommendation_ref,t.sourceItemIds.length===1?i.source_item_id=t.sourceItemIds[0]:delete i.source_item_id,t.sourceEpicIds.length===1?i.source_epic_id=t.sourceEpicIds[0]:delete i.source_epic_id,{...e,eforge_plan:i}}function UG(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function NG(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}function jG(e){return typeof e=="string"&&e.length>0?e:void 0}var Jw=new Set(["failed","skipped","cancelled","canceled"]),bpe=new Set(["shipped","landed","auto-merged"]),Rpe=new Set(["merged"]),xpe=new Set(["pr-open"]),zG=new Set(["submitted","abandoned","completed","cancelled","canceled","failed","landed","shipped","skipped","superseded","stale","merged","auto-merged"]),Epe=new Set(["pr-open","started","running"]);function RI(e,t){return e.session===void 0||e.session.length===0||e.status!==void 0&&zG.has(e.status)?!1:t?.liveEditableSessionIds?.has(e.session)===!0}function ni(e){return e.completedAt!==void 0&&e.completedAt.length>0?!1:e.status===void 0||!zG.has(e.status)}function Yw(e){return e.status!==void 0&&Epe.has(e.status)}function GG(e,t){let i=[...e.promotedSessionPlans.map(a=>Vd({kind:"session-plan",stage:"planned",status:a.status??"planned",label:`Session plan ${a.session}`,session:a.session,path:a.path,timestamp:a.promotedAt,affectedItemIds:[e.itemId]})),...e.queuePrds.map(a=>Vd({kind:"queue-prd",stage:"queue",status:a.status??"queued",label:`Queue PRD ${a.prdId}`,prdId:a.prdId,path:a.path,timestamp:a.queuedAt,affectedItemIds:[e.itemId]})),...e.buildRuns.map(a=>Vd({kind:"build-run",stage:"build",status:a.status??"running",label:`Build run ${a.runId}`,runId:a.runId,sessionId:a.sessionId,timestamp:a.completedAt??a.startedAt,completedAt:a.completedAt,affectedItemIds:[e.itemId]})),...e.buildSessions.map(a=>Vd({kind:"build-session",stage:"build",status:a.status??"running",label:`Build session ${a.sessionId}`,sessionId:a.sessionId,runId:a.runId,timestamp:a.completedAt??a.startedAt,completedAt:a.completedAt,affectedItemIds:[e.itemId]})),...e.landingResults.map(a=>kpe(e.itemId,a)),...e.lastEvent?[Vd({kind:"last-event",stage:"event",status:FG(e.lastEvent.type,"recorded"),label:`Last event ${FG(e.lastEvent.type,"recorded")}`,sessionId:e.lastEvent.sessionId,runId:e.lastEvent.runId,timestamp:e.lastEvent.timestamp,affectedItemIds:[e.itemId]})]:[]].sort(WG),r=i.filter(a=>Jw.has(a.status)),o=i.filter(a=>a.kind==="landing"),s=i.filter(a=>a.prUrl!==void 0||a.kind==="pr");return{lifecycleState:HG(i,t),linkRows:i,prRefs:s,landingRefs:o,failureEvidence:r}}function eT(e,t){return Hd({itemId:e.id,title:e.title,status:e.status,epic:e.epic,lifecycleState:t?.lifecycleState??vpe(e.status),linkRows:t?.linkRows??[],failureEvidence:t?.failureEvidence??[]})}function sm(e){let t=rm(e);if(t)return Hd({sourceItemIds:[...t.sourceItemIds].sort(),sourceEpicIds:[...t.sourceEpicIds].sort(),recommendationRef:t.sourceRecommendationRef,promotedAt:t.promotedAt});let i=Ape(e.eforge_plan);return Hd({sourceItemIds:om([...bI(i.source_item_ids),...bI(i.source_item_id)]).sort(),sourceEpicIds:om([...bI(i.source_epic_ids),...bI(i.source_epic_id)]).sort(),recommendationRef:qG(i.source_recommendation_ref),promotedAt:qG(i.promoted_at)})}function KG(e){let t=new Map(e.traceSummaries.map(c=>[c.itemId,c])),i=new Map(e.items.map(c=>[c.id,c])),r=e.traceSummaries.filter(c=>c.linkRows.some(d=>d.session===e.session)).map(c=>c.itemId),o=Hd({sourceItemIds:om([...e.sourceRefs?.sourceItemIds??[],...r]).sort(),sourceEpicIds:om(e.sourceRefs?.sourceEpicIds??[]).sort(),recommendationRef:e.sourceRefs?.recommendationRef,promotedAt:e.sourceRefs?.promotedAt}),s=o.sourceItemIds.map(c=>i.get(c)).filter(c=>c!==void 0).map(c=>eT(c,t.get(c.id))).sort(_pe),a=e.traceSummaries.filter(c=>o.sourceItemIds.includes(c.itemId)||c.linkRows.some(d=>d.session===e.session)).flatMap(c=>c.linkRows.filter(d=>d.session===e.session||o.sourceItemIds.includes(c.itemId))).sort(WG);return{sourceRefs:o,lifecycleState:Ppe(s.map(c=>c.lifecycleState),a),itemRows:s,linkRows:a,failureEvidence:a.filter(c=>Jw.has(c.status))}}function Ppe(e,t){if(e.length===0)return HG(t);let i=om(e);if(i.length===1)return i[0];let r=i.filter(o=>o!=="none");return r.length>1?"partial":r[0]??"none"}function VG(e){return e.map(t=>Hd({kind:t.kind,stage:t.stage,status:t.status,session:t.session,prdId:t.prdId,runId:t.runId,sessionId:t.sessionId,featureBranch:t.featureBranch,commitSha:t.commitSha,prUrl:t.prUrl,completedAt:t.completedAt,affectedItemIds:[...t.affectedItemIds].sort()})).sort((t,i)=>JSON.stringify(t).localeCompare(JSON.stringify(i)))}function kpe(e,t){return Vd({kind:t.prUrl&&t.status==="pr-open"?"pr":"landing",stage:t.status==="pr-open"?"pr-open":"landing",status:t.status,label:t.prUrl?`PR ${t.prUrl}`:`Landing ${t.featureBranch??t.commitSha}`,featureBranch:t.featureBranch,commitSha:t.commitSha,prUrl:t.prUrl,timestamp:t.landedAt,affectedItemIds:[e]})}function HG(e,t){let i=e.map(r=>r.status);return i.some(r=>bpe.has(r))?"shipped":i.some(r=>Rpe.has(r))?"merged":i.some(r=>xpe.has(r))?"pr-open":i.some(r=>Jw.has(r))?"failed":e.some(r=>r.stage==="landing"&&Yw(r))?"active":e.some(r=>r.stage==="build"&&ni(r))?"build":e.some(r=>r.stage==="queue"&&ni(r))?"queue":e.some(r=>r.stage==="planned"&&RI(r,t))?"planned":"none"}function vpe(e){return e==="shipped"?"shipped":e==="active"?"active":e==="planned"?"planned":"none"}function Vd(e){return Hd(e)}function WG(e,t){return[e.timestamp??"",e.kind,e.stage,e.label,e.status].join("\0").localeCompare([t.timestamp??"",t.kind,t.stage,t.label,t.status].join("\0"))}function _pe(e,t){return e.itemId.localeCompare(t.itemId)}function Hd(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function om(e){return[...new Set(e.filter(t=>t.length>0))]}function FG(e,t){return typeof e=="string"&&e.length>0?e:t}function qG(e){return typeof e=="string"&&e.length>0?e:void 0}function bI(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):typeof e=="string"&&e.length>0?[e]:[]}function Ape(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function tT(){return{rankById:new Map,lanesById:new Map,unblockById:new Map}}function XG(e){let t=tT();if(!e)return t;e.recommendedNextSequence.forEach((i,r)=>{t.rankById.has(i.itemId)||t.rankById.set(i.itemId,r+1)});for(let i of e.safeParallelizableGroups){let r=i.title??i.ref;for(let o of i.itemIds){let s=t.lanesById.get(o)??[];s.includes(r)||s.push(r),t.lanesById.set(o,s)}}for(let i of e.blockedChains){let r=i.rationale?.trim();if(r)for(let o of i.itemIds)t.unblockById.has(o)||t.unblockById.set(o,r)}return t}var Ope={inbox:"Inbox",ready:"Ready",blocked:"Blocked","in-progress":"In progress",done:"Done",archive:"Archive"},wpe=new Set(["shipped","superseded"]);function ZG(e,t=[],i={}){let r=new Map(t.map(l=>[l.itemId,l])),o=new Map(e.map(l=>[l.id,l])),s=new Map((i.epics??[]).map(l=>[l.id,l])),a=i.recommendationIndex??tT(),c=i.now??new Date().toISOString().slice(0,10),d=e.filter(l=>i.epic===void 0||l.epic===i.epic).map(l=>Cpe(l,e,o,s,r.get(l.id),a,c));return{lanes:JS.filter(l=>i.includeArchive!==!1||l!=="archive").map(l=>({lane:l,title:Ope[l],items:d.filter(p=>p.lane===l)})),items:d}}function Tpe(e,t,i){let r=QU(i);if(e.status==="shipped")return Ca("done",["status shipped is complete"],[],r);if(e.status==="stale"||e.status==="superseded")return Ca("archive",[`status ${e.status} is archived`],[],r);let o=XU(e,t);return o.length>0?Ca("blocked",[`unresolved dependencies: ${o.join(", ")}`],o,r):r.length>0?Ca("in-progress",r,[],r):e.status==="active"?Ca("in-progress",["status active is in progress"],[],r):e.status==="planned"?Ca("ready",["status planned is ready"],[],r):Ca("inbox",["status candidate starts in inbox"],[],r)}function Cpe(e,t,i,r,o,s,a){let c=Tpe(e,t,o),d=zt(e.body),u=Ji(e.status),l=new Set(e.depends_on.filter(g=>Lpe(g,i))),p=e.depends_on.map(g=>QG(g,i,l.has(g))),m=s.rankById.get(e.id),f=eT(e,o);return{id:e.id,title:e.title,status:e.status,priority:e.priority??"medium",tags:e.tags,lane:c.lane,reasons:c.reasons,unresolvedDependsOn:c.unresolvedDependsOn,activeTraceReasons:c.activeTraceReasons,blocked:l.size>0,ready:!u&&l.size===0,reviewDue:$pe(e,a),closed:u,epic:e.epic,...e.epic!==void 0?{epicRef:Dpe(e.epic,r)}:{},dependencies:p,dependents:t.filter(g=>g.depends_on.includes(e.id)).map(g=>QG(g.id,i,!1)),notes:{claim:d.get("Claim")??"",evidence:d.get("Evidence")??"",recheck:d.get("Recheck")??"",promotionPaths:d.get("Promotion Paths")??""},...m!==void 0?{recRank:m}:{},recLanes:s.lanesById.get(e.id)??[],...s.unblockById.has(e.id)?{recUnblock:s.unblockById.get(e.id)}:{},lifecycleState:f.lifecycleState,linkRows:f.linkRows,failureEvidence:f.failureEvidence}}function Lpe(e,t){let i=t.get(e);return!i||!wpe.has(i.status)}function QG(e,t,i){let r=t.get(e);return{id:e,title:r?.title??`Missing dependency: ${e}`,...r?{status:r.status}:{},missing:!r,blocking:i}}function Dpe(e,t){let i=t.get(e);return{id:e,title:i?.title??`Missing epic: ${e}`,...i?{status:i.status}:{},missing:!i}}function $pe(e,t){return Ji(e.status)?!1:e.stale_after!==void 0&&e.stale_after<t}function Ca(e,t,i,r){return{lane:e,reasons:t,unresolvedDependsOn:i,activeTraceReasons:r}}var PI=Po(Zr(),1);import{mkdir as Mpe,readFile as sK,readdir as Upe,writeFile as Fpe}from"fs/promises";import{existsSync as iT}from"fs";import{dirname as qpe,isAbsolute as zpe,relative as Gpe,resolve as Kpe,sep as rK}from"path";import{createHash as Npe}from"crypto";import{isAbsolute as JG,relative as YG,resolve as jpe,sep as nT,win32 as Bpe}from"path";function fn(e){if(e.length===0)throw new Error("Backlog id must not be empty");if(e==="."||e==="..")throw new Error(`Unsafe backlog id "${e}": traversal segments are not allowed`);if(e.includes("\0"))throw new Error("Unsafe backlog id: null bytes are not allowed");if(e.includes("/")||e.includes("\\"))throw new Error(`Unsafe backlog id "${e}": path separators are not allowed`);if(JG(e)||Bpe.isAbsolute(e))throw new Error(`Unsafe backlog id "${e}": absolute paths are not allowed`)}function eK(e,t){let i={};for(let r of t)e[r]!==void 0&&(i[r]=e[r]);for(let r of Object.keys(e).filter(o=>!t.includes(o)).sort())e[r]!==void 0&&(i[r]=e[r]);return i}function tK(e){return fn(e),e}function nK(e,t){let i=jpe(e,t),r=YG(e,i);if(r===""||r===".."||r.startsWith(".."+nT)||JG(r))throw new Error(`Resolved backlog path "${i}" escapes ${e}${nT}`);return i}function xI(e,t){return YG(e,t).split(nT).join("/")}function iK(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function hs(e){return Npe("sha256").update(e).digest("hex")}function or(e){return Array.isArray(e)?`[${e.map(t=>or(t)).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${or(e[t])}`).join(",")}}`:JSON.stringify(e)}var Vpe=["id","status","priority","source","created","updated","last_checked","stale_after","tags","depends_on","epic","eforge_plan"];function kI(e,t){return dK(e,"item",t)}function sT(e,t){return dK(e,"epic",t)}function cm(e,t){return xI(e,kI(e,t))}function vI(e,t){return xI(e,sT(e,t))}function dm(e){if(!e.startsWith("---"))return{frontmatter:{},body:e};let t=e.replace(/^---\r?\n/,`---
|
|
459
|
+
`),i=t.indexOf(`
|
|
460
|
+
---`,4);if(i===-1)return{frontmatter:{},body:e};let r=t.slice(4,i),o=t.slice(i).replace(/^\n---\r?\n?/,""),s=(0,PI.parse)(r);return{frontmatter:iK(s),body:o}}function Hpe(e,t,i){let r=eK(e,i);return`---
|
|
461
|
+
${(0,PI.stringify)(r,{lineWidth:0}).trimEnd()}
|
|
462
|
+
---
|
|
463
|
+
${t}`}async function ii(e,t){return(await um(e,t))?.record??null}async function Wd(e,t){return(await Wpe(e,t))?.record??null}async function um(e,t){return aT(e,"item",t,EI)}async function Wpe(e,t){return aT(e,"epic",t,aK)}async function nn(e){return(await _I(e)).map(t=>t.record)}async function po(e){return(await AI(e)).map(t=>t.record)}async function _I(e){return cK(e,"item",EI)}async function AI(e){return cK(e,"epic",aK)}async function OI(e,t,i){let r=await Jpe(e,"item",t,EI),o={...r.frontmatter,...i,id:t};Pr(o,r.body);let s=kI(e,t);return await Mpe(qpe(s),{recursive:!0}),await Fpe(s,Hpe(o,r.body,Vpe)),EI(await sK(s,"utf-8"))}function EI(e){let t=dm(e);return Pr(t.frontmatter,t.body)}function aK(e){let t=dm(e);return os(t.frontmatter,t.body)}async function aT(e,t,i,r){fn(i);let o=am(e,t,"private",i);if(iT(o))return rT(e,t,"private",i,o,r);let s=am(e,t,"legacy",i);return iT(s)?rT(e,t,"legacy",i,s,r):null}async function cK(e,t,i){let r=await oK(e,t,"private",i),o=new Set(r.map(a=>a.id)),s=await oK(e,t,"legacy",i,o);return[...r,...s].sort((a,c)=>a.id.localeCompare(c.id))}async function oK(e,t,i,r,o=new Set){let s=(await Xpe(e,t,i)).filter(a=>!o.has(a));return Promise.all(s.map(async a=>rT(e,t,i,a,am(e,t,i,a),r)))}async function Xpe(e,t,i){let r=oT(e,t,i);return iT(r)?(await Upe(r)).filter(o=>o.endsWith(".md")).map(o=>{let s=o.slice(0,-3);return fn(s),s}).sort():[]}async function rT(e,t,i,r,o,s){let a=await sK(o);return Qpe(e,t,i,r,o,s,a)}function Qpe(e,t,i,r,o,s,a){let c=a.toString("utf-8"),d=dm(c),u=s(c);return tme(r,u.id,o),Zpe(e,t,i,o,u,d)}function Zpe(e,t,i,r,o,s){return{kind:t,origin:i,id:o.id,path:r,relativePath:xI(e,r),record:o,frontmatter:s.frontmatter,body:s.body,updated:typeof o.updated=="string"?o.updated:void 0,bodySha256:hs(s.body),recordSha256:hs(or({frontmatter:s.frontmatter,body:s.body}))}}async function Jpe(e,t,i,r){let o=await aT(e,t,i,r);if(!o)throw new Error(`Backlog record not found: ${am(e,t,"private",i)}`);return{frontmatter:o.frontmatter,body:o.body}}function oT(e,t,i){return i==="legacy"?Kpe(e,".backlog",t==="item"?"items":"epics"):ut({cwd:e,extensionName:"eforge-plan"}).extensionStoragePath("project-local",["backlog",t==="item"?"items":"epics"])}function am(e,t,i,r){return Ype(e,t,i,`${tK(r)}.md`)}function Ype(e,t,i,r){if(i==="legacy")return nK(oT(e,t,i),r);let o=ut({cwd:e,extensionName:"eforge-plan"}),s=oT(e,t,i),a=o.extensionStoragePath("project-local",["backlog",t==="item"?"items":"epics",r]);return eme(s,a),a}function dK(e,t,i){return am(e,t,"private",i)}function eme(e,t){let i=Gpe(e,t);if(i===""||i===".."||i.startsWith(".."+rK)||zpe(i))throw new Error(`Resolved backlog path "${t}" escapes ${e}${rK}`)}function tme(e,t,i){if(fn(t),t!==e)throw new Error(`Backlog record id mismatch in ${i}: frontmatter id "${t}" does not match filename id "${e}"`)}import{mkdir as nme,readFile as pK,readdir as ime,writeFile as rme}from"fs/promises";import{existsSync as mK}from"fs";import{dirname as ome,isAbsolute as sme,relative as ame,sep as uK}from"path";var fK=1;function gK(e,t){fn(t);let i=ut({cwd:e,extensionName:"eforge-plan"}),r=i.extensionStoragePath("project-local",["traces"]),o=i.extensionStoragePath("project-local",["traces",`${t}.json`]);return yK(r,o),o}function wI(e,t){return fn(e),{schemaVersion:fK,itemId:e,epicId:t,promotedSessionPlans:[],queuePrds:[],buildRuns:[],buildRunIds:[],buildSessions:[],buildSessionIds:[],landingResults:[]}}async function Xd(e,t){let i=gK(e,t);return mK(i)?cT(JSON.parse(await pK(i,"utf-8")),t):null}async function Qd(e,t){let i=cT(t,t.itemId),r=gK(e,i.itemId);return await nme(ome(r),{recursive:!0}),await rme(r,`${JSON.stringify(i,null,2)}
|
|
464
|
+
`),i}async function Ri(e){let t=ut({cwd:e,extensionName:"eforge-plan"}),i=t.extensionStoragePath("project-local",["traces"]);if(!mK(i))return[];let r=(await ime(i)).filter(o=>o.endsWith(".json")).sort();return Promise.all(r.map(async o=>{let s=t.extensionStoragePath("project-local",["traces",o]);return yK(i,s),cT(JSON.parse(await pK(s,"utf-8")),o.slice(0,-5))}))}function SK(e,t){if(!e)return;let i=[...e.promotedSessionPlans.filter(o=>RI(o,t)).map(o=>`active session-plan trace ${o.session}`),...e.queuePrds.filter(ni).map(o=>`active queue trace ${o.prdId}`),...e.buildRuns.filter(ni).map(o=>`active build run trace ${o.runId}`),...e.buildSessions.filter(ni).map(o=>`active build session trace ${o.sessionId}`),...e.landingResults.filter(Yw).map(o=>cme(o))],r=GG(e,t);return{itemId:e.itemId,epicId:e.epicId,hasActiveSessionPlan:e.promotedSessionPlans.some(o=>RI(o,t)),hasActiveQueuePrd:e.queuePrds.some(ni),hasActiveBuildRun:e.buildRuns.some(ni),hasActiveBuildSession:e.buildSessions.some(ni),hasActiveTrace:i.length>0,activeReasons:i,lastEvent:e.lastEvent,...r}}function cme(e){return e.prUrl!==void 0?`active PR trace ${e.prUrl}`:`active landing trace ${e.featureBranch??e.commitSha}`}function cT(e,t){let i=dT(e),r=ri(i.itemId);if(r!==void 0&&r!==t)throw new Error(`Trace sidecar itemId mismatch: expected ${t}, found ${r}`);fn(t);let o=lm(i.promotedSessionPlans).flatMap(dme),s=lm(i.queuePrds).flatMap(ume),a=lm(i.buildRuns).flatMap(lme),c=lm(i.buildSessions).flatMap(pme),d=lm(i.landingResults).flatMap(mme);return{schemaVersion:fK,itemId:t,epicId:ri(i.epicId),promotedSessionPlans:o,queuePrds:s,buildRuns:a,buildRunIds:lK(i.buildRunIds,a.map(u=>u.runId)),buildSessions:c,buildSessionIds:lK(i.buildSessionIds,[...a.map(u=>u.sessionId),...c.map(u=>u.sessionId)]),landingResults:d,lastEvent:fme(i.lastEvent)}}function dme(e){let t=ri(e.session);return t?[{session:t,...pm(e,["path","status","promotedAt"])}]:[]}function ume(e){let t=ri(e.prdId);return t?[{prdId:t,...pm(e,["path","status","queuedAt"])}]:[]}function lme(e){let t=ri(e.runId),i=ri(e.sessionId);return t&&i?[{runId:t,sessionId:i,...pm(e,["status","startedAt","completedAt"])}]:[]}function pme(e){let t=ri(e.sessionId);return t?[{sessionId:t,...pm(e,["runId","status","startedAt","completedAt"])}]:[]}function mme(e){let t=ri(e.status),i=ri(e.featureBranch),r=ri(e.commitSha);if(!t||!i&&!r)return[];let o=ri(e.landedAt),s=ri(e.prUrl);return i?[{status:t,featureBranch:i,...r?{commitSha:r}:{},...o?{landedAt:o}:{},...s?{prUrl:s}:{}}]:r?[{status:t,commitSha:r,...o?{landedAt:o}:{},...s?{prUrl:s}:{}}]:[]}function fme(e){let t=dT(e),i={...pm(t,["type","timestamp","sessionId","runId","source","filePath","path","id"]),...typeof t.cursor=="number"&&Number.isFinite(t.cursor)?{cursor:t.cursor}:{}};return Object.keys(i).length>0?i:void 0}function pm(e,t){return Object.fromEntries(t.flatMap(i=>{let r=ri(e[i]);return r?[[i,r]]:[]}))}function gme(e){return[...new Set(e.filter(t=>t.length>0))]}function yK(e,t){let i=ame(e,t);if(i===""||i===".."||i.startsWith(".."+uK)||sme(i))throw new Error(`Resolved trace path "${t}" escapes ${e}${uK}`)}function dT(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function lm(e){return Array.isArray(e)?e.map(dT):[]}function lK(e,t){let i=Array.isArray(e)?e:t;return gme(i.filter(r=>typeof r=="string"&&r.length>0))}function ri(e){return typeof e=="string"&&e.length>0?e:void 0}var Sme=new Set(["submitted","abandoned"]);async function yme(e){try{let t=await Ve().flat.list({cwd:e,includeSubmitted:!1}),i=new Set;for(let r of t)typeof r.session!="string"||r.session.length===0||typeof r.status=="string"&&Sme.has(r.status)||i.add(r.session);return{liveEditableSessionIds:i}}catch{return{liveEditableSessionIds:new Set}}}async function xi(e,t){let[i,r]=await Promise.all([yme(e),t===void 0?Ri(e):Promise.resolve([...t])]);return r.flatMap(o=>SK(o,i)??[]).sort((o,s)=>o.itemId.localeCompare(s.itemId))}function C(e){let t=IK(e);if(!bK(t))throw new Error("Extension action output must be a JSON object at the root.");return t}function lT(e){let t=IK(e);if(!bK(t))throw new Error("Expected a JSON object at the root.");return t}function IK(e){let i=uT(e,"$",new WeakSet);if(i===void 0)throw new Error("Extension action output must not be undefined at the root.");return i}function uT(e,t,i){if(e===void 0)return;if(e===null||typeof e=="string"||typeof e=="boolean")return e;if(typeof e=="number"){if(!Number.isFinite(e))throw new Error(`Extension action output contains a non-finite number at ${t}.`);return e}if(typeof e=="bigint"||typeof e=="symbol"||typeof e=="function")throw new Error(`Extension action output contains a non-JSON value at ${t}.`);if(e instanceof Date)throw new Error(`Extension action output contains a Date at ${t}.`);if(e instanceof Map||e instanceof Set)throw new Error(`Extension action output contains a collection at ${t}.`);if(Array.isArray(e)){if(hK(e,t),i.has(e))throw new Error(`Extension action output contains a cycle at ${t}.`);i.add(e);let o=e.map((s,a)=>uT(s,`${t}[${a}]`,i)).filter(s=>s!==void 0);return i.delete(e),o}if(!hme(e))throw new Error(`Extension action output contains a non-plain object at ${t}.`);if(hK(e,t),i.has(e))throw new Error(`Extension action output contains a cycle at ${t}.`);i.add(e);let r=Object.create(null);for(let[o,s]of Object.entries(e)){let a=uT(s,`${t}.${o}`,i);a!==void 0&&(r[o]=a)}return i.delete(e),r}function hK(e,t){if(Object.getOwnPropertySymbols(e).length>0)throw new Error(`Extension action output contains a non-JSON symbol key at ${t}.`)}function hme(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function bK(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}import{existsSync as Ime}from"fs";function La(e){return Ime(Ln(e))}async function ft(e,t,i){if(!La(e))return i();let r=Kt(e,{create:!1,migrate:!0,readonly:!0});try{return await t(r)}finally{r.close()}}function Da(e,t={},i=20,r=100){let o=sa(e,t,{defaultLimit:i,maxLimit:r});return{entries:o.items,limit:o.limit,offset:o.offset,total:o.total}}function Zd(e,t){let i=e.offset+e.entries.length;return{limit:e.limit,offset:e.offset,returned:e.entries.length,hasMore:i<t,...i<t?{nextOffset:i}:{}}}function pT(e){return[...new Set(e.filter(t=>typeof t=="string"&&t.length>0))].sort()}var RK={shipped:100,merged:90,"pr-open":80,build:70,queued:60,submitted:55,active:50,planned:40,partial:30,failed:20,none:0},bme=new Set(["shipped","merged","failed","partial"]),Rme=new Set(["abandoned","canceled","cancelled","complete","completed","deleted","done","failed","merged","removed","shipped","superseded"]);function xme(e){return e!==void 0&&bme.has(e)}function $a(e){return e!==void 0&&Rme.has(e.toLowerCase())}function xK(e){return e.queuePrdId===void 0||e.queuePrdStatus===void 0||rr(e.queuePrdStatus)||e.runId!==void 0||e.buildSessionId!==void 0||e.landingId!==void 0}function Eme(e){return e.some(t=>(t.kind==="build-run"||t.kind==="build-session")&&!vt(t.status))}function Pme(e){return xK(e)&&!Hw(e)&&(xme(e.lifecycleState)||!$a(e.status))}function Is(e){return e.reasonCode?TI(e.reasonCode):e.lifecycleState==="shipped"?"shipped-result":e.lifecycleState==="merged"?"merged-result":e.lifecycleState==="pr-open"?"open-pr":e.lifecycleState==="build"?e.buildSessionId&&!e.runId?"active-build-session":"running-build":e.lifecycleState==="queued"?"queued-build":e.lifecycleState==="submitted"?"submitted-session-plan":e.lifecycleState==="planned"?"planned-session-plan":e.lifecycleState==="failed"?"failed-result":e.lifecycleState==="partial"?"partial-plan":"candidate-no-evidence"}function TI(e){return{"queued-trace":"queued-build","building-trace":"running-build","active-build":"running-build","active-build-session-trace":"active-build-session","open-pr-trace":"open-pr","pr-open":"open-pr",shipped:"shipped-result",merged:"merged-result",failed:"failed-result",partial:"partial-plan"}[e]??e}function EK(e){return e==="queued"||e==="submitted"?"queue":e==="active"?"planned":e}function mT(e){let t=e.links??[],i=[];for(let r of e.evidence)!xK(r)&&!Eme(t)||Hw(r)||(yI(r.lifecycleState)?i.push({reasonCode:Is(r),lifecycleState:r.lifecycleState,associatedLinks:t,terminal:!0}):["submitted","queued","build","pr-open"].includes(r.lifecycleState)&&!vt(r.status)&&i.push({reasonCode:Is(r),lifecycleState:r.lifecycleState,associatedLinks:t,terminal:!1}));for(let r of e.sessionItems)PG(r.status)&&i.push({reasonCode:kG(r.status),lifecycleState:vG(r.status),associatedLinks:t,terminal:!1});for(let r of e.taskItems)Vw(r.status)&&i.push({reasonCode:"active-planning-task",lifecycleState:"active",associatedLinks:t,terminal:!1});return i}function mm(e){let t=e.evidence.filter(Pme),i=t.filter(g=>g.lifecycleState==="failed").sort((g,y)=>(y.occurredAt??"").localeCompare(g.occurredAt??""))[0],o=i&&!t.some(g=>g.lifecycleState!=="failed"&&(g.occurredAt??"")>(i.occurredAt??""))?i:[...t].filter(g=>g.lifecycleState!=="failed").sort((g,y)=>(RK[y.lifecycleState]??0)-(RK[g.lifecycleState]??0)||(y.occurredAt??"").localeCompare(g.occurredAt??""))[0],s=o?.lifecycleState,a=o?Is(o):void 0;if(e.userStatus==="shipped"&&s!=="shipped"&&(s="shipped",a="explicit-shipped-status"),(e.userStatus==="stale"||e.userStatus==="superseded")&&(s="none",a="explicit-archive-status"),s||e.taskItems.find(y=>Vw(y.status))&&(s="active",a="active-planning-task"),!s){let g=e.sessionItems.filter(A=>!tm(A.status)),y=g.find(A=>A.status==="submitted"),R=g[0];y?(s="submitted",a="submitted-session-plan"):R&&(s="planned",a="planned-session-plan")}s||(e.userStatus==="active"?(s="active",a="explicit-active-status"):e.userStatus==="planned"?(s="planned",a="explicit-planned-status"):(s="none",a=e.hasUnresolvedDependency?"unresolved-dependency":"candidate-no-evidence")),e.hasUnresolvedDependency&&a==="candidate-no-evidence"&&(a="unresolved-dependency");let c=s==="shipped"||s==="merged"||a==="explicit-shipped-status"||a==="explicit-archive-status",d=s??"none",u=a??"candidate-no-evidence",l=mT({itemId:e.itemId??"",evidence:e.evidence,sessionItems:e.sessionItems,taskItems:e.taskItems,links:e.links}),p=c&&l.length===0?{planEligible:!1,planEligibilityReasonCode:u,planEligibilityReasonMessage:`Item ${e.itemId??""} is closed by ${u}.`,planEligibilityLinks:[]}:_G(e.itemId??"",l,e.hasUnresolvedDependency),m=e.hasUnresolvedDependency||s==="failed"||s==="partial",f=(e.userStatus==="stale"||e.userStatus==="superseded")&&a==="explicit-archive-status"?"archive":m?"blocked":s==="shipped"||s==="merged"?"done":s==="build"||s==="queued"||s==="submitted"||s==="pr-open"||s==="active"?"in-progress":s==="planned"?"ready":"inbox";return{lifecycleState:EK(d),reasonCode:u,reasons:[u],closed:c,lane:f,blocked:m,ready:f==="ready",reviewDue:!1,evidence:o,...p}}function Ei(e,t){let i=new Set(t),r=[];for(let d of Tr(e).filter(u=>i.has(u.itemId??u.itemRef)))r.push({kind:"session-plan",id:d.session,label:`Session plan ${d.session}`,itemIds:[d.itemId??d.itemRef],affectedItemIds:[d.itemId??d.itemRef],session:d.session,status:d.status,path:d.path,timestamp:d.promotedAt,reasonCode:d.status==="submitted"?"submitted-session-plan":"planned-session-plan",metadata:{role:d.role,provenance:d.provenance,...d.sourceRecommendationRef?{sourceRecommendationRef:d.sourceRecommendationRef}:{}}});for(let d of uo(e).filter(u=>i.has(u.itemId??u.itemRef)))r.push({kind:"planning-task",id:d.taskId,label:`Planning task ${d.taskId}`,itemIds:[d.itemId??d.itemRef],status:d.status,timestamp:d.updatedAt??d.createdAt,reasonCode:"active-planning-task"});let o=fI(e,t);for(let d of o)r.push({kind:"lifecycle-evidence",id:d.evidenceKey,itemIds:[d.itemId],session:d.session,status:d.status,timestamp:d.occurredAt,reasonCode:Is(d),metadata:{lifecycleState:d.lifecycleState,...d.summary?{summary:d.summary}:{}}});let s=new Map,a=(d,u)=>{if(!d||!u||!i.has(u))return;let l=s.get(d)??new Set;l.add(u),s.set(d,l)};for(let d of Tr(e))a(d.session,d.itemId??d.itemRef);for(let d of o)a(d.session,d.itemId??d.itemRef);for(let d of r)for(let u of d.itemIds)a(d.session,u);let c=new Set(s.keys());for(let d of lo(e).filter(u=>u.itemId&&i.has(u.itemId)||!u.itemId&&u.session&&c.has(u.session))){if(d.kind==="queue-prd"&&!rr(d.status))continue;let u=d.kind==="queue-prd"?"queued-build":d.kind==="build-session"?"active-build-session":d.kind==="build-run"?"running-build":d.status==="merged"?"merged-result":d.status==="shipped"?"shipped-result":"open-pr",l=d.itemId?[d.itemId]:[...s.get(d.session??"")??[]];l.length!==0&&r.push({kind:d.kind,id:d.id,label:`${d.kind} ${d.id}`,itemIds:l,affectedItemIds:l,session:d.session,status:d.status,timestamp:d.timestamp,path:d.path,url:d.url,runId:d.runId,buildSessionId:d.buildSessionId,prUrl:d.kind==="landing"?d.url:void 0,reasonCode:TI(u)})}return r.sort((d,u)=>(u.timestamp??"").localeCompare(d.timestamp??"")||d.kind.localeCompare(u.kind)||d.id.localeCompare(u.id))}var kK=Po(Zr(),1);import{mkdirSync as kme,writeFileSync as vme}from"fs";import{dirname as PK,resolve as _me}from"path";function gm(e,t){return Te(e,i=>_K(i,t))}var Na=class extends Error{constructor(i){super(`${i} is stale; re-read get-item before retrying update-item.`);this.token=i}token};function vK(e,t,i){return Te(e,r=>{let o=Nt(r,t);if(!o)throw new Error(`Backlog item not found: ${t}`);return Ome(o,i),_K(r,{id:t,title:i.title??o.title,body:i.body??o.body,status:i.status??i.userStatus??o.userStatus,priority:i.priority??o.priority,source:i.source??o.source,tags:i.tags,dependsOn:i.dependsOn,dependencies:i.dependencies,epic:Object.prototype.hasOwnProperty.call(i,"epic")?i.epic:o.epicRef,epicId:Object.prototype.hasOwnProperty.call(i,"epicId")?i.epicId:o.epicId,created:i.created??o.createdAt,updated:i.updated??lt(),lastCheckedAt:i.lastCheckedAt??o.lastCheckedAt,staleAfter:i.staleAfter??o.staleAfter,importOrigin:i.importOrigin??o.importOrigin,importPath:i.importPath??o.importPath,frontmatter:{...o.frontmatter,...i.frontmatter},sections:i.sections})})}function _K(e,t){let i=lt(),r=Nt(e,t.id),o=t.body??r?.body??"",s=AK(t.userStatus??t.status??r?.userStatus??"candidate"),a=t.priority??r?.priority,c=t.source??fT(t.frontmatter?.source)??r?.source,d=Object.prototype.hasOwnProperty.call(t,"epic")?t.epic??void 0:r?.epicRef,u=Object.prototype.hasOwnProperty.call(t,"epicId")?t.epicId??void 0:r?.epicId,l=t.created??r?.createdAt??i,p=t.updated??i,m=t.lastCheckedAt??fT(t.frontmatter?.last_checked)??r?.lastCheckedAt,f=t.staleAfter??fT(t.frontmatter?.stale_after)??r?.staleAfter,g=hT({...r?.frontmatter??{},...t.frontmatter??{},id:t.id,status:s,priority:a,...c!==void 0&&{source:c},tags:t.tags??r?.frontmatter.tags??[],depends_on:t.dependsOn??r?.frontmatter.depends_on??[],epic:d,created:l,updated:p,...m!==void 0&&{last_checked:m},...f!==void 0&&{stale_after:f}}),y=OK({id:t.id,title:t.title,body:o,userStatus:s,priority:a,source:c,createdAt:l,updatedAt:p,lastCheckedAt:m,staleAfter:f,epicRef:d,epicId:u,frontmatter:g,tags:t.tags??r?.frontmatter.tags??[],dependsOn:t.dependsOn??r?.frontmatter.depends_on??[],importOrigin:t.importOrigin??r?.importOrigin,importPath:t.importPath??r?.importPath}),R=Xp(e,{id:t.id,title:t.title,body:o,userStatus:s,priority:a,source:c,createdAt:l,updatedAt:p,lastCheckedAt:m,staleAfter:f,epicRef:d,epicId:u,frontmatter:g,bodySha256:Dn(o),recordSha256:Dn(JSON.stringify(y)),importOrigin:t.importOrigin??r?.importOrigin,importPath:t.importPath??r?.importPath});if(t.tags&&dw(e,t.id,t.tags),t.sections&&uw(e,t.id,t.sections),(t.dependencies??t.dependsOn)&&lw(e,t.id,wme(e,t)),Dme(CK(e),t.id,R.frontmatter,o),CG(e,t.id),r?.epicRef!==d||r?.epicId!==u)for(let A of new Set([r?.epicRef,r?.epicId,d,u].filter(D=>!!D)))Xw(e,A);return R}function CI(e,t){return Te(e,i=>Ame(i,t))}function Ame(e,t){let i=lt(),r=va(e,t.id),o=t.body??r?.body??"",s=AK(t.userStatus??t.status??r?.userStatus??"candidate"),a=t.priority??r?.priority,c=t.created??r?.createdAt??i,d=t.updated??i,u=mw(e,{id:t.id,title:t.title,body:o,userStatus:s,priority:a,createdAt:c,updatedAt:d,frontmatter:hT({...r?.frontmatter??{},...t.frontmatter??{},id:t.id,status:s,priority:a,tags:t.tags??r?.frontmatter.tags??[],created:c,updated:d}),bodySha256:Dn(o),recordSha256:Dn(JSON.stringify({id:t.id,title:t.title,body:o,userStatus:s}))});return t.tags&&gw(e,t.id,t.tags),t.sections&&Sw(e,t.id,t.sections),$me(CK(e),t.id,u.frontmatter,o),Xw(e,t.id),u}function Lr(e,t){return Te(e,i=>Nt(i,t))}function bs(e,t){return Te(e,i=>va(i,t))}function Sm(e){return Te(e,cw)}function ST(e){return Te(e,fw)}function Rs(e){return{id:e.id,title:e.title,body:e.body,status:e.userStatus,priority:e.priority,tags:fm(e.frontmatter.tags),depends_on:fm(e.frontmatter.depends_on),epic:e.epicRef,created:e.createdAt,updated:e.updatedAt,eforge_plan:wK(e.frontmatter.eforge_plan)}}function ja(e){return{id:e.id,title:e.title,body:e.body,status:e.userStatus,priority:e.priority,tags:fm(e.frontmatter.tags),created:e.createdAt,updated:e.updatedAt,eforge_plan:wK(e.frontmatter.eforge_plan)}}function yT(e){let t=e.bodySha256??Dn(e.body),i=OK({id:e.id,title:e.title,body:e.body,userStatus:e.userStatus,priority:e.priority,source:e.source,createdAt:e.createdAt,updatedAt:e.updatedAt,lastCheckedAt:e.lastCheckedAt,staleAfter:e.staleAfter,epicRef:e.epicRef,epicId:e.epicId,frontmatter:e.frontmatter,tags:fm(e.frontmatter.tags),dependsOn:fm(e.frontmatter.depends_on),importOrigin:e.importOrigin,importPath:e.importPath});return{bodySha256:t,recordSha256:e.recordSha256??Dn(JSON.stringify(i))}}function Ome(e,t){let i=yT(e);if(t.expectedBodySha256!==void 0&&t.expectedBodySha256!==i.bodySha256)throw new Na("expectedBodySha256");if(t.expectedRecordSha256!==void 0&&t.expectedRecordSha256!==i.recordSha256)throw new Na("expectedRecordSha256");if(t.expectedUpdatedAt!==void 0&&t.expectedUpdatedAt!==e.updatedAt)throw new Na("expectedUpdatedAt")}function wme(e,t){return(t.dependencies??(t.dependsOn??[]).map(r=>({dependencyRef:r}))).map(r=>{if(r.dependencyStatus==="external")return r;let o=Nt(e,r.resolvedDependencyItemId??r.dependencyRef);return o?{...r,resolvedDependencyItemId:o.id,dependencyStatus:Tme(o.userStatus)?"closed":"open"}:r})}function Tme(e){return e==="shipped"||e==="stale"||e==="superseded"}function AK(e){return e==="active"?"active":e==="planned"?"planned":e==="shipped"?"shipped":e==="stale"?"stale":e==="superseded"?"superseded":"candidate"}function hT(e){return JSON.parse(JSON.stringify(e,(t,i)=>i===void 0?void 0:i))}function OK(e){return gT(hT(e))}function gT(e){return Array.isArray(e)?e.map(gT):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([t],[i])=>t.localeCompare(i)).map(([t,i])=>[t,gT(i)])):e}function fm(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function wK(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function fT(e){return typeof e=="string"&&e.length>0?e:void 0}var Cme=["id","status","priority","source","created","updated","last_checked","stale_after","tags","depends_on","epic","eforge_plan"],Lme=["id","status","priority","source","created","updated","last_checked","stale_after","tags","eforge_plan"];function Dme(e,t,i,r){TK(kI(e,t),i,r,Cme)}function $me(e,t,i,r){TK(sT(e,t),i,r,Lme)}function TK(e,t,i,r){let o=Object.fromEntries([...r.filter(s=>t[s]!==void 0).map(s=>[s,t[s]]),...Object.entries(t).filter(([s,a])=>!r.includes(s)&&a!==void 0)]);kme(PK(e),{recursive:!0}),vme(e,`---
|
|
465
|
+
${(0,kK.stringify)(o,{lineWidth:0}).trimEnd()}
|
|
466
|
+
---
|
|
467
|
+
${i}`)}function CK(e){return _me(PK(e.path),"..","..","..","..")}async function IT(e,t){return ft(e,i=>jme(e,i,t),()=>{throw new Error(`Backlog item "${t.id}" was not found.`)})}async function bT(e,t){return ft(e,i=>Bme(e,i,t),()=>{throw new Error(`Backlog epic "${t.id}" was not found.`)})}function Nme(e,t,i,r,o=lo(e)){let s=new Set(i.map(c=>c.session)),a=r.some(c=>c.lifecycleState==="submitted");return o.flatMap(c=>{if(c.itemId!==t&&(!c.session||!s.has(c.session)))return[];if(c.kind==="queue-prd"&&!rr(c.status))return[];if(c.kind==="queue-prd"&&a)return[];let d=c.status?.toLowerCase(),u=c.kind==="landing"?d==="shipped"?"shipped":d==="merged"?"merged":d&&!$a(d)?"pr-open":void 0:d==="failed"?"failed":$a(d)?void 0:c.kind==="queue-prd"?"queued":"build";if(!u)return[];let l=u==="shipped"?"shipped":u==="merged"?"merged":u==="failed"?"failed":c.kind==="queue-prd"?"queued-trace":c.kind==="build-session"?"active-build-session-trace":u==="pr-open"?"pr-open":"building-trace";return[{evidenceKey:`durable:${c.kind}:${c.id}:${t}`,itemId:t,itemRef:t,lifecycleState:u,reasonCode:l,status:c.status,session:c.session,queuePrdId:c.queuePrdId,runId:c.runId,buildSessionId:c.buildSessionId,landingId:c.kind==="landing"?c.id:void 0,occurredAt:c.timestamp,isCurrent:!0,isTerminal:u==="shipped"||u==="merged"||u==="failed"}]})}function Jd(e,t,i={}){let r=(i.context?.dependencies??Gw(e)).filter(m=>m.itemId===t.id),o=r.filter(m=>m.dependencyStatus!=="closed"&&m.dependencyStatus!=="external").map(m=>m.resolvedDependencyItemId??m.dependencyRef),s=(i.context?.sessionItems??Tr(e)).filter(m=>(m.itemId??m.itemRef)===t.id),a=(i.context?.evidenceRows??em(e)).filter(m=>m.itemId===t.id||m.itemRef===t.id),c=[...a,...Nme(e,t.id,s,a,i.context?.queueBuildLinks)],d=(i.context?.taskItems??uo(e)).filter(m=>(m.itemId??m.itemRef)===t.id),u=Ei(e,[t.id]).slice(0,20),l=mm({userStatus:t.userStatus,evidence:c,sessionItems:s,taskItems:d,hasUnresolvedDependency:o.length>0,itemId:t.id,links:u}),p=i.includeLinks?u:void 0;return{id:t.id,title:t.title,status:t.userStatus,userStatus:t.userStatus,priority:t.priority??"normal",tags:t.tags,lane:l.lane,reasons:l.reasons,reasonCodes:[l.reasonCode],updatedAt:t.updatedAt,planEligible:l.planEligible,...l.planEligibilityReasonCode?{planEligibilityReasonCode:l.planEligibilityReasonCode}:{},...l.planEligibilityReasonMessage?{planEligibilityReasonMessage:l.planEligibilityReasonMessage}:{},...l.planEligibilityLinks?{planEligibilityLinks:l.planEligibilityLinks}:{},...i.includeDependencies===!1?{}:{dependsOn:r.map(m=>m.resolvedDependencyItemId??m.dependencyRef),unresolvedDependsOn:o},activeTraceReasons:[],blocked:l.blocked,ready:l.ready,reviewDue:l.reviewDue,closed:l.closed,...t.epicId?{epic:t.epicId}:{},lifecycleState:l.lifecycleState,effectiveLifecycle:l.lifecycleState,...p?{associatedLinks:p}:{},...i.cwd?{path:cm(i.cwd,t.id)}:{},hasBody:t.body.trim().length>0}}function LI(e,t){let i=t.filter(r=>r.epicId===e.id);return{id:e.id,title:e.title,status:e.userStatus,userStatus:e.userStatus,...e.priority?{priority:e.priority}:{},tags:e.tags,itemCount:i.length,totalItems:i.length,openItemCount:i.filter(r=>r.userStatus!=="shipped"&&r.userStatus!=="stale"&&r.userStatus!=="superseded").length,hasBody:e.body.trim().length>0}}function LK(e){return Object.fromEntries(e.map(t=>[t.sectionName,t.content]))}function jme(e,t,i){let r=mI(t,i.id);if(!r)throw new Error(`Backlog item "${i.id}" was not found.`);let o=yT(r),s=ys(t),a=r.epicId?zw(t,r.epicId):void 0,c=DI(t),d=new Map(s.map(l=>[l.id,Jd(t,l,{includeDependencies:i.includeDependencies!==!1,context:c})])),u=c.dependencies??[];return{schemaVersion:1,item:{...Jd(t,r,{includeDependencies:i.includeDependencies!==!1,includeLinks:i.includeLifecycleRows!==!1,cwd:e,context:c}),bodySha256:o.bodySha256,recordSha256:o.recordSha256,storage:{kind:"canonical-sqlite",id:r.id},...i.includeSections!==!1?{sections:LK(bG(t,r.id))}:{},...i.includeLifecycleRows!==!1?{linkRows:Ei(t,[r.id]),failureEvidence:(c.evidenceRows??[]).filter(l=>(l.itemId===r.id||l.itemRef===r.id)&&l.lifecycleState==="failed")}:{},...i.includeBody?{body:r.body}:{}},...i.includeEpic!==!1&&a?{epic:LI(a,s)}:{},...i.includeDependencies!==!1?{dependencies:pT(u.filter(l=>l.itemId===r.id).map(l=>l.resolvedDependencyItemId)).map(l=>d.get(l)).filter(l=>l!==void 0)}:{},...i.includeDependents!==!1?{dependents:pT(u.filter(l=>l.resolvedDependencyItemId===r.id).map(l=>l.itemId)).map(l=>d.get(l)).filter(l=>l!==void 0)}:{}}}function Bme(e,t,i){let r=zw(t,i.id);if(!r)throw new Error(`Backlog epic "${i.id}" was not found.`);let o=ys(t),s=DI(t),a=i.includeItems===!1?[]:o.filter(d=>d.epicId===r.id).map(d=>Jd(t,d,{includeDependencies:i.includeItemDependencies!==!1,context:s})),c=Da(a,i);return{schemaVersion:1,epic:{...LI(r,o),path:vI(e,r.id),...i.includeSections!==!1?{sections:LK(RG(t,r.id))}:{},...i.includeBody?{body:r.body}:{}},items:c.entries,totalItems:o.filter(d=>d.epicId===r.id).length,itemCount:o.filter(d=>d.epicId===r.id).length,openItemCount:o.filter(d=>d.epicId===r.id&&d.userStatus!=="shipped"&&d.userStatus!=="stale"&&d.userStatus!=="superseded").length,limit:c.limit,offset:c.offset}}function DI(e){return{dependencies:Gw(e),sessionItems:Tr(e),evidenceRows:em(e),taskItems:uo(e),queueBuildLinks:lo(e)}}function ym(e,t={}){let i=DI(e);return ys(e).filter(r=>t.epic===void 0||r.epicId===t.epic).map(r=>Jd(e,r,{includeDependencies:t.includeDependencies!==!1,includeLinks:t.includeLinks===!0,context:i})).filter(r=>t.includeArchive===!0||r.lane!=="archive")}function Yd(e){let t=ys(e);return IG(e).map(i=>LI(i,t))}function RT(e,t){let i=t.ids?new Set(t.ids):void 0,r=new Map((t.ids??[]).map((d,u)=>[d,u])),o=DI(e),s=ys(e).filter(d=>i===void 0||i.has(d.id)).map(d=>Jd(e,d,{includeDependencies:t.includeDependencies!==!1,includeLinks:t.includeLinks===!0,context:o})).filter(d=>t.includeArchive===!0||d.lane!=="archive").filter(d=>t.epic===void 0||d.epic===t.epic).filter(d=>t.status===void 0||d.status===t.status).filter(d=>t.lane===void 0||d.lane===t.lane).filter(d=>t.tags===void 0||t.tags.every(u=>d.tags.includes(u))).sort((d,u)=>(r.get(d.id)??Number.MAX_SAFE_INTEGER)-(r.get(u.id)??Number.MAX_SAFE_INTEGER)||d.id.localeCompare(u.id)),a=Math.min(Math.max(Math.trunc(t.limit??20),1),100),c=Math.max(Math.trunc(t.offset??0),0);return{items:s.slice(c,c+a),total:s.length,limit:a,offset:c}}var xT={inbox:"Inbox",ready:"Planned",blocked:"Blocked","in-progress":"In Progress",done:"Done",archive:"Archive"},hm=["inbox","ready","blocked","in-progress","done","archive"],DK={critical:0,high:1,normal:2,medium:2,low:3};function Mme(e,t){return hm.indexOf(e.lane)-hm.indexOf(t.lane)||Number(e.closed)-Number(t.closed)||(DK[e.priority]??2)-(DK[t.priority]??2)||(t.updatedAt??"").localeCompare(e.updatedAt??"")||e.id.localeCompare(t.id)}function Ume(e){let t=new Map;for(let i of e)for(let r of i.itemIds??[])t.set(r,[...t.get(r)??[],i]);return t}async function ET(e,t){return ft(e,i=>{let r=ym(i,{includeArchive:t.includeArchive===!0,epic:t.epic,includeDependencies:t.includeDependencies!==!1,includeLinks:!1}),o=r.filter(u=>(t.lane===void 0||u.lane===t.lane)&&(t.includeClosed===!0||!u.closed)).sort(Mme),s=Da(o,t),a=Ume(Ei(i,s.entries.map(u=>u.id))),c=s.entries.map(u=>({...u,associatedLinks:(a.get(u.id)??[]).slice(0,20)})),d=new Set(s.entries.map(u=>u.epic).filter(u=>typeof u=="string"));return{schemaVersion:1,items:c,total:o.length,limit:s.limit,offset:s.offset,...t.includeLaneCounts!==!1?{lanes:hm.map(u=>{let l=r.filter(p=>p.lane===u);return{lane:u,title:xT[u],count:l.length,openCount:l.filter(p=>!p.closed).length,closedCount:l.filter(p=>p.closed).length,...t.lane===u?{pagination:Zd(s,o.length)}:{}}}),counts:{total:r.length,open:r.filter(u=>!u.closed).length,closed:r.filter(u=>u.closed).length}}:{},...t.includeEpics===!0?{epics:Yd(i).filter(u=>t.epic===void 0?d.has(u.id):u.id===t.epic)}:{},pagination:Zd(s,o.length)}},()=>({schemaVersion:1,items:[],total:0,limit:Math.min(Math.max(t.limit??20,1),100),offset:Math.max(t.offset??0,0),lanes:[],...t.includeEpics===!0?{epics:[]}:{},counts:{total:0,open:0,closed:0},pagination:{limit:Math.min(Math.max(t.limit??20,1),100),offset:Math.max(t.offset??0,0),returned:0,hasMore:!1}}))}async function Im(e,t){return ft(e,i=>{let r=ym(i,{includeArchive:t.includeArchive,epic:t.epic}),o=Yd(i),s=r.map(({updatedAt:c,...d})=>({...d,unresolvedDependsOn:d.unresolvedDependsOn??[],dependencies:[],dependents:[],notes:{claim:"",evidence:"",recheck:"",promotionPaths:""},recLanes:[],linkRows:[],failureEvidence:[]})),a=hm.map(c=>({lane:c,title:xT[c],items:s.filter(d=>d.lane===c)}));return{epics:o,items:r,lanes:a,blockedReasons:r.filter(c=>c.unresolvedDependsOn&&c.unresolvedDependsOn.length>0).map(c=>({itemId:c.id,reasons:c.reasons})),traceSummaries:[],lifecycleLinks:[],epicProgress:[],recommendationSummary:void 0,recommendationStatus:{state:"missing",currentPath:"",statusPath:"",reasons:[],staleReasons:[]}}},()=>({epics:[],items:[],lanes:hm.map(i=>({lane:i,title:xT[i],items:[]})),blockedReasons:[],traceSummaries:[],lifecycleLinks:[],epicProgress:[],recommendationStatus:{state:"missing",currentPath:"",statusPath:"",reasons:[],staleReasons:[]}}))}function PT(e){let t=["# eforge-plan board",""];for(let i of e.lanes){t.push(`## ${i.title}`,""),i.items.length===0&&t.push("_No items._","");for(let r of i.items)t.push(`- **${r.id}** (${r.status}) ${r.title}${r.reasons.length?` \u2014 ${r.reasons.join("; ")}`:""}`);t.push("")}return t.join(`
|
|
468
|
+
`)}import{existsSync as Sge}from"fs";import{mkdir as yge,readFile as hge,writeFile as Ige}from"fs/promises";import{dirname as bge}from"path";import{createHash as Zfe}from"crypto";import{existsSync as QT}from"fs";import{mkdir as Yfe,readFile as ege,writeFile as tge}from"fs/promises";import{dirname as nge}from"path";function $I(e){return Te(e,t=>Gd(t)?.rawModel??null)}function $K(e,t,i){return Te(e,r=>Fme(r,t,i))}function Fme(e,t,i){let r=Dn(JSON.stringify(t)),o=`rec-${r.slice(0,24)}`,s=t.updatedAt??lt();hw(e);let a=zd(e,{runId:o,sourceFingerprint:r,createdAt:s,isCurrent:!0,rawModel:t,summary:i,freshness:{status:"fresh",updatedAt:s}});return qme(e,o,t),nm(e,o),a}function NK(e,t,i=[]){return Te(e,r=>{let o=Gd(r);if(!o)return;let s=zd(r,{...o,freshness:{status:"stale",reason:t,refs:i,updatedAt:lt()},isCurrent:!0});return nm(r,o.runId,"recommendations-stale"),s})}function qme(e,t,i){let r=[{kind:"activeWork",entries:i.activeWork},{kind:"readyCandidates",entries:i.readyCandidates},{kind:"recommendedNextSequence",entries:i.recommendedNextSequence}],o=0;for(let s of r){let a=`lane-${Oa([t,s.kind,"default"])}`;Qp(e,{laneId:a,runId:t,laneKind:s.kind,sequence:o++}),Zp(e,a,s.entries.map((c,d)=>({itemRef:c.itemId,itemId:Nt(e,c.itemId)?.id,role:"member",sequence:d,rationale:c.rationale,confidence:c.confidence?Number(c.confidence):void 0})))}for(let[s,a]of i.safeParallelizableGroups.entries()){let c=`lane-${Oa([t,"safeParallelizableGroup",a.ref])}`;Qp(e,{laneId:c,runId:t,laneKind:"safeParallelizableGroup",laneRef:a.ref,title:a.title,sequence:o++,profile:a.recommendedProfile,rationale:a.rationale}),Zp(e,c,a.itemIds.map((d,u)=>({itemRef:d,itemId:Nt(e,d)?.id,role:"member",sequence:u+s*100})))}for(let[s,a]of i.blockedChains.entries()){let c=a.ref??`blocked-${s}`,d=`lane-${Oa([t,"blockedChain",c])}`;Qp(e,{laneId:d,runId:t,laneKind:"blockedChain",laneRef:c,sequence:o++,rationale:a.rationale}),Zp(e,d,[...a.itemIds.map((u,l)=>({itemRef:u,itemId:Nt(e,u)?.id,role:"blocked",sequence:l})),...a.blockedBy.map((u,l)=>({itemRef:u,itemId:Nt(e,u)?.id,role:"blocker",sequence:l+a.itemIds.length}))])}}import{createHash as zme,randomUUID as Gme}from"crypto";import{existsSync as wT}from"fs";import{mkdir as Kme,readFile as TT,rename as Vme,stat as Hme,writeFile as Wme}from"fs/promises";import{dirname as Xme,isAbsolute as jK,relative as Qme,resolve as zK,sep as BK}from"path";function v(e,t={}){return new ip(e,[{...t.details??{},path:t.path??"",message:e}])}var kT=".eforge/storage/extensions/eforge-plan/roadmaps/local-focus.md",vT=".eforge/storage/extensions/eforge-plan/roadmaps/config.json",MK="docs/roadmap.md";function CT(e){let t=ut({cwd:e,extensionName:"eforge-plan"});return{localFocus:t.extensionStoragePath("project-local",["roadmaps","local-focus.md"]),config:t.extensionStoragePath("project-local",["roadmaps","config.json"])}}async function LT(e,t={}){let{config:i}=await KK(e);return{schemaVersion:1,config:i,context:await eu(e,{includeLocalFocusContent:t.includeLocalFocusContent}),storagePaths:{localFocus:kT,config:vT}}}async function GK(e,t){if(t.localFocusContent===void 0&&t.sharedSources===void 0)throw v("update-roadmap-state requires localFocusContent or sharedSources.",{path:""});let i=CT(e);if(t.expectedLocalFocusSha256!==void 0){let s=await nfe(i.localFocus);if(OT(s===null?"":s)!==t.expectedLocalFocusSha256)throw v("Local focus roadmap changed before update.",{path:"expectedLocalFocusSha256"})}let r=t.localFocusContent;if(r!==void 0&&Buffer.byteLength(r,"utf-8")>is)throw v(`Local focus roadmap exceeds ${is} bytes.`,{path:"localFocusContent"});let o=t.sharedSources===void 0?void 0:{schemaVersion:1,sharedSources:t.sharedSources.map((s,a)=>VK(e,s,a))};return r!==void 0&&await qK(i.localFocus,r),o!==void 0&&await qK(i.config,`${JSON.stringify(o,null,2)}
|
|
469
|
+
`),LT(e,{includeLocalFocusContent:!0})}async function eu(e,t={}){let i={sourceExcerpts:0,sourceContent:0};if(t.includeRoadmap===!1)return UK({schemaVersion:1,localSteering:{kind:"local-focus",role:"local-steering",path:kT,configured:!0,editable:!0,exists:!1,headings:[],excerpts:[],maxContentBytes:is},sharedContextSources:[],discoveredContextSources:[],assumptions:["Roadmap context omitted because includeRoadmap was false."],conflicts:[],truncation:i});let{config:r,conflicts:o}=await KK(e),s=await AT(e,kT,{absolutePath:CT(e).localFocus,kind:"local-focus",role:"local-steering",configured:!0,editable:!0,includeContent:t.includeLocalFocusContent,truncation:i});_T(o,s);let a=Zme(r,o),c=await Promise.all(a.map(p=>Yme(e,p,i,o))),u=new Set(a.map(p=>p.path)).has(MK)?[]:[await AT(e,MK,{kind:"discovered-conventional",role:"shared-context",configured:!1,editable:!1,truncation:i})].filter(p=>p.exists);for(let p of u)_T(o,p);return UK({schemaVersion:1,localSteering:s,sharedContextSources:c,discoveredContextSources:u,assumptions:["Local focus roadmap is private extension storage and may be edited by eforge-plan actions.","Shared and discovered roadmap sources are read-only context for planning flows."],conflicts:o,truncation:i})}async function KK(e){let t=CT(e).config;if(!wT(t))return{config:{schemaVersion:1,sharedSources:[]},conflicts:[]};try{let i=JSON.parse(await TT(t,"utf-8"));return{config:{schemaVersion:1,sharedSources:hr(OP,i).sharedSources.slice(0,id).map((o,s)=>VK(e,o,s))},conflicts:[]}}catch(i){let r=i instanceof Error?i.message:String(i);return{config:{schemaVersion:1,sharedSources:[]},conflicts:[{code:"invalid-config",message:`Invalid roadmap config "${vT}": ${r}`,path:vT}]}}}function Zme(e,t){let i=e.sharedSources.filter(s=>s.enabled!==!1).slice(0,id),r=new Map,o=new Map;for(let s of i)r.has(s.id)&&t.push({code:"duplicate-source",message:`Duplicate enabled roadmap source id "${s.id}".`,sourceId:s.id,path:s.path}),o.has(s.path)&&t.push({code:"duplicate-source",message:`Duplicate enabled roadmap source path "${s.path}".`,sourceId:s.id,path:s.path}),r.set(s.id,s),o.set(s.path,s);return i}function VK(e,t,i){let r=Jme(e,t.path,`sharedSources[${i}].path`);return{id:FK(t.id,`source-${i+1}`),path:r,...t.label!==void 0&&{label:FK(t.label,t.label)},...t.enabled!==void 0&&{enabled:t.enabled}}}function Jme(e,t,i="path"){if(t.includes("\0")||t.trim().length===0||/^[a-zA-Z]:[\\/]/.test(t)||t.includes("\\")||jK(t))throw v("Roadmap source path must be a project-relative contained path.",{path:i});let r=t.split("/").filter(a=>a.length>0).join("/"),o=zK(e,r),s=Qme(e,o);if(s===""||s.startsWith("..")||s.includes(`..${BK}`)||jK(s))throw v("Roadmap source path must stay inside the project.",{path:i});if(s.length>240)throw v("Roadmap source path is too long.",{path:i});return s.split(BK).join("/")}async function Yme(e,t,i,r){let o=await AT(e,t.path,{kind:"configured-shared",role:"shared-context",configured:!0,editable:!1,id:t.id,label:t.label,truncation:i});return o.exists||r.push({code:"configured-source-missing",message:`Configured roadmap source "${t.path}" does not exist.`,sourceId:t.id,path:t.path}),_T(r,o),o}function UK(e){return{...e,assumptions:e.assumptions.slice(0,_P).map(t=>jI(t,AP,()=>{})),conflicts:e.conflicts.slice(0,kP).map(t=>({...t,message:jI(t.message,vP,()=>{})}))}}function _T(e,t){t.readError!==void 0&&e.push({code:"source-read-error",message:t.readError,...t.id!==void 0&&{sourceId:t.id},path:t.path})}async function AT(e,t,i){let r=i.absolutePath??zK(e,t),o={kind:i.kind,role:i.role,path:t,...i.id!==void 0&&{id:i.id},...i.label!==void 0&&{label:i.label},configured:i.configured,editable:i.editable,...i.kind==="local-focus"&&{maxContentBytes:is}};if(!wT(r))return{...o,exists:!1,headings:[],excerpts:[]};try{let s=await TT(r,"utf-8"),a=await Hme(r),c=NI(s,WS,()=>{i.truncation.sourceContent+=1}),d={...o,exists:!0,sha256:OT(s),updatedAt:a.mtime.toISOString(),headings:efe(c),excerpts:tfe(c,i.truncation)};if(i.includeContent===!0){let u=NI(s,is,()=>{d.contentTruncated=!0});d.content=u}return d}catch(s){let a=s instanceof Error?s.message:String(s),c=NI(`Failed to read roadmap source "${t}": ${a}`,WS,()=>{i.truncation.sourceContent+=1});return{...o,exists:!0,headings:[],excerpts:[],readError:c}}}function efe(e){return e.split(/\r?\n/).map(i=>/^#{1,6}\s+(.+)$/.exec(i)?.[1]?.trim()).filter(i=>!!i).slice(0,xP).map(i=>jI(i,EP,()=>{}))}function tfe(e,t){let i=e.split(/\n\s*\n/).map(r=>r.trim()).filter(Boolean);return t.sourceExcerpts+=Math.max(0,i.length-XS),i.slice(0,XS).map(r=>NI(r,PP,()=>{t.sourceExcerpts+=1}))}function jI(e,t,i){return e.length<=t?e:(i(),`${e.slice(0,Math.max(0,t-16))}
|
|
470
|
+
\u2026[truncated]`)}function NI(e,t,i){if(Buffer.byteLength(e,"utf-8")<=t)return e;i();let r=`
|
|
471
|
+
\u2026[truncated]`,o=Buffer.byteLength(r,"utf-8"),s="",a=0;for(let c of e){let d=Buffer.byteLength(c,"utf-8");if(a+d+o>t)break;s+=c,a+=d}return`${s}${r}`}function FK(e,t){let i=e.trim();return jI(i.length>0?i:t,120,()=>{})}async function nfe(e){return wT(e)?TT(e,"utf-8"):null}async function qK(e,t){await Kme(Xme(e),{recursive:!0});let i=`${e}.${process.pid}.${Gme()}.tmp`;await Wme(i,t,"utf-8"),await Vme(i,e)}function OT(e){return zme("sha256").update(e).digest("hex")}var HK=n.Union([n.Literal("bugfix"),n.Literal("feature"),n.Literal("refactor"),n.Literal("architecture"),n.Literal("docs"),n.Literal("maintenance"),n.Literal("unknown")]),WK=n.Union([n.Literal("quick"),n.Literal("focused"),n.Literal("deep")]),jt={additionalProperties:An},ife=n.Object({kind:n.Union([n.Literal("grouping-label"),n.Literal("bare-command"),n.Literal("manual-only"),n.Literal("vague")]),line:n.String(),message:n.String(),suggestion:n.String()}),rn=n.Object({ready:n.Boolean(),missingDimensions:n.Array(n.String()),coveredDimensions:n.Array(n.String()),skippedDimensions:n.Array(n.String()),acDiagnostics:n.Optional(n.Array(ife))},jt),$T={createdAt:n.Optional(n.String()),updatedAt:n.Optional(n.String()),readyAt:n.Optional(n.String()),submittedAt:n.Optional(n.String()),lastBuildActivityAt:n.Optional(n.String())},NT={statusSource:n.Optional(n.String()),statusSourceDisclosure:n.Optional(n.String())},Ba=n.Object({session:n.String(),topic:n.String(),status:n.String(),body:n.String(),...NT,...$T},jt),XK=n.Object({plan:Ba,readiness:rn,path:n.String(),sourceRefs:n.Optional(sd),lifecycle:n.Optional(qU),...NT,...$T},jt),DT=n.Object({kind:n.Union([n.Literal("plan"),n.Literal("plan-set")]),key:n.String(),sourceRefs:n.Optional(sd),lifecycleState:n.Optional(Er),partialReasons:n.Optional(n.Array(n.Object({code:n.String(),message:n.String()},{additionalProperties:!0}))),...NT,itemRows:n.Optional(n.Array(ey)),linkRows:n.Optional(n.Array(_n)),failureEvidence:n.Optional(n.Array(_n)),...$T},jt),rfe=oa({maxLimit:100}),QK=n.Object({includeSubmitted:n.Optional(n.Boolean()),includeBoard:n.Optional(n.Boolean()),includeArchive:n.Optional(n.Boolean()),epic:n.Optional(n.String()),...rfe}),ZK=n.Object({artifacts:n.Array(DT),plans:n.Array(DT),planSets:n.Array(DT),total:n.Integer({minimum:0}),limit:n.Integer({minimum:1}),offset:n.Integer({minimum:0}),pagination:n.Object({limit:n.Integer({minimum:1}),offset:n.Integer({minimum:0}),returned:n.Integer({minimum:0}),hasMore:n.Boolean()}),board:n.Optional(ty)},jt),JK=n.Object({session:n.String()}),YK=XK,eV=n.Object({planSetId:n.String()}),tV=n.Object({planSet:n.Record(n.String(),An),validation:n.Record(n.String(),An),dir:n.String(),manifestPath:n.String(),anchorContent:n.Optional(n.String())},jt),nV=n.Object({session:n.String(),topic:n.String(),planningType:n.Optional(HK),planningDepth:n.Optional(WK),profile:n.Optional(n.Union([qt,n.Null()])),agentProfile:n.Optional(n.String())}),iV=n.Object({session:n.String(),path:n.String(),plan:Ba,readiness:rn},jt),rV=n.Object({session:n.String(),dimension:n.String(),content:n.String()}),oV=n.Object({session:n.String(),path:n.String(),readiness:rn,plan:Ba},jt),sV=n.Object({session:n.String(),dimension:n.String(),reason:n.String()}),aV=n.Object({session:n.String(),path:n.String(),readiness:rn,plan:Ba},jt),cV=n.Object({session:n.String(),planningType:n.Optional(HK),planningDepth:n.Optional(WK),overwrite:n.Optional(n.Boolean())}),dV=n.Object({session:n.String(),path:n.String(),required_dimensions:n.Array(n.String()),optional_dimensions:n.Array(n.String()),readiness:rn,plan:Ba},jt),uV=n.Object({session:n.String()}),lV=n.Object({session:n.String(),readiness:rn},jt),pV=n.Object({session:n.String()}),mV=n.Union([n.Object({kind:n.Literal("not-ready"),session:n.String(),readiness:rn,message:n.String()},jt),n.Object({kind:n.Literal("ready"),session:n.String(),status:n.String(),readiness:rn,plan:Ba},jt)]),fV=n.Object({session:n.String()}),gV=n.Object({kind:n.Literal("deleted"),session:n.String(),status:n.Literal("abandoned"),message:n.String(),plan:Ba},jt),SV=n.Object({session:n.String(),profile:n.Optional(n.Union([qt,n.Null()])),agentProfile:n.Optional(n.Union([n.String(),n.Null()])),openQuestions:n.Optional(n.Array(n.String()))}),yV=XK,hV=n.Object({scope:n.Optional(n.Union([n.Literal("local"),n.Literal("project"),n.Literal("user"),n.Literal("all")]))}),IV=mP,bV=n.Object({session:n.String()}),RV=n.Object({session:n.String()}),xV=n.Object({kind:n.Literal("not-ready"),session:n.String(),readiness:rn,message:n.String()},jt),EV=n.Object({kind:n.Literal("enqueued"),session:n.String(),sourcePath:n.String(),absolutePath:n.String(),queueSessionId:n.String(),pid:n.Number(),autoBuild:n.Boolean(),message:n.String(),submittedAt:n.String(),readiness:rn},jt),PV=n.Object({kind:n.Literal("enqueue-failed"),session:n.String(),sourcePath:n.String(),absolutePath:n.String(),command:n.String(),message:n.String(),readiness:rn},jt),kV=n.Union([xV,EV,PV]),vV=n.Union([n.Object({kind:n.Literal("not-recoverable"),session:n.String(),message:n.String(),status:n.Optional(n.String()),readiness:n.Optional(rn)},jt),xV,EV,PV]);var bm=4,Rm=8,Ma=n.Integer({minimum:1,maximum:Rm,default:bm}),_V=n.Object({itemAuditConcurrency:n.Optional(Ma)},{additionalProperties:!1}),xm=n.String({minLength:64,maxLength:64,pattern:"^[A-Fa-f0-9]{64}$"});var ofe=n.Object({taskId:me,parentTaskId:n.Optional(me),originalRequest:n.String(),derivedRequest:n.String(),selection:n.Object({itemIds:n.Optional(n.Array(n.String())),epicId:n.Optional(n.String()),recommendationRef:n.Optional(n.String())},{additionalProperties:!1}),requestedOutputSections:n.Array(Ql),session:n.Optional(n.String()),planningType:n.Optional(n.String()),planningDepth:n.Optional(n.String()),includeRoadmap:n.Optional(n.Boolean()),purpose:n.Optional(n.Union([n.Literal("recommendation-refresh"),n.Literal("backlog-curation")])),itemAuditConcurrency:n.Optional(Ma),sourceFingerprint:n.Optional(xm),appliedAt:n.Optional(n.String()),createdAt:n.String()},{additionalProperties:!1}),sfe=n.Object({taskId:me,kind:n.String(),status:nd,createdAt:n.String(),updatedAt:n.String(),startedAt:n.Optional(n.String()),completedAt:n.Optional(n.String()),cancelledAt:n.Optional(n.String()),errorCode:n.Optional(n.String()),errorMessage:n.Optional(n.String())},{additionalProperties:!1}),AV=n.Object({task:sfe,entry:ofe,sourceFingerprint:n.Optional(xm),reused:n.Optional(n.Boolean())},{additionalProperties:!1}),afe=n.Object({path:n.String(),id:n.String(),kind:n.Union([n.Literal("item"),n.Literal("epic")]),reason:n.Union([n.Literal("unknown"),n.Literal("closed"),n.Literal("empty"),n.Literal("wrong-lane")]),status:n.Optional(Je),title:n.Optional(n.String()),message:n.String()},{additionalProperties:!1}),BI=n.Object({valid:n.Boolean(),issues:n.Array(afe)},{additionalProperties:!1}),cfe=n.Object({itemId:n.String(),from:n.String(),to:n.String()},{additionalProperties:!1}),OV=n.Object({ref:n.String(),title:n.Optional(n.String()),itemIds:n.Array(n.String()),epicIds:n.Optional(n.Array(n.String())),safeToPlanTogether:n.Optional(n.Boolean()),rationale:n.Optional(n.String()),recommendedProfile:n.Optional(op)},{additionalProperties:!1}),dfe=n.Object({schemaVersion:n.Literal(1),updatedAt:n.Optional(n.String()),activeWork:n.Array(Zi),readyCandidates:n.Array(Zi),recommendedNextSequence:n.Array(Zi),safeParallelizableGroups:n.Array(OV),blockedChains:n.Array(sp),rationaleAndAssumptions:n.Array(n.String())},{additionalProperties:!1}),ufe=n.Object({recommendedNextItemIds:n.Array(n.String()),safeParallelizableGroups:n.Array(OV),blockedChainCount:n.Number(),rationaleAndAssumptions:n.Array(n.String())},{additionalProperties:!1}),wV=n.Object({effectiveRecommendations:n.Optional(dfe),recommendationSummary:n.Optional(ufe),removed:n.Object({itemIds:n.Array(n.String()),epicIds:n.Array(n.String())},{additionalProperties:!1}),repositioned:n.Array(cfe),validation:BI},{additionalProperties:!1}),lfe=n.Object({path:n.String(),message:n.String()},{additionalProperties:!1}),pfe=n.Object({state:n.Union([n.Literal("missing"),n.Literal("fresh"),n.Literal("stale")]),reason:n.String(),storedSourceFingerprint:n.Optional(n.String()),comparedSourceFingerprint:n.String(),baselineTaskId:n.Optional(n.String())},{additionalProperties:!1}),mfe=n.Object({commitScanCount:n.Optional(n.Integer({minimum:0})),changedPathCount:n.Optional(n.Integer({minimum:0})),excerptCount:n.Optional(n.Integer({minimum:0})),excerptBytes:n.Optional(n.Integer({minimum:0})),prEnrichmentCount:n.Optional(n.Integer({minimum:0})),subprocessTimeoutMs:n.Optional(n.Integer({minimum:0}))},{additionalProperties:!0}),ffe=n.Object({code:n.String(),severity:n.Union([n.Literal("info"),n.Literal("warning")]),message:n.Optional(n.String()),path:n.Optional(n.String())},{additionalProperties:!0}),gfe=n.Object({fileScanCount:n.Optional(n.Integer({minimum:0})),fileBytes:n.Optional(n.Integer({minimum:0})),evidencePerItem:n.Optional(n.Integer({minimum:0})),pathsPerCategory:n.Optional(n.Integer({minimum:0})),excerptBytes:n.Optional(n.Integer({minimum:0})),diagnosticCount:n.Optional(n.Integer({minimum:0})),gitCommitScanCount:n.Optional(n.Integer({minimum:0})),prEnrichmentCount:n.Optional(n.Integer({minimum:0}))},{additionalProperties:!0}),Sfe=n.Object({auditedItemCount:n.Integer({minimum:0}),currentStateFileCount:n.Optional(n.Integer({minimum:0})),gitHistoryCommitCount:n.Optional(n.Integer({minimum:0})),pullRequestCount:n.Optional(n.Integer({minimum:0}))},{additionalProperties:!0}),jT=n.Object({source:n.String({minLength:1}),confidence:n.String({minLength:1}),matchedBy:n.Optional(n.Array(n.String())),path:n.Optional(n.String()),excerpt:n.Optional(n.String()),citations:n.Optional(n.Array(n.Object({},{additionalProperties:An})))},{additionalProperties:!0}),yfe=n.Object({kind:n.Union([n.Literal("implementation"),n.Literal("product-surface"),n.Literal("supporting")]),source:n.String(),confidence:n.String(),path:n.Optional(n.String()),excerpt:n.Optional(n.String()),matchedBy:n.Optional(n.Array(n.String()))},{additionalProperties:!0}),TV=n.Object({source:n.String(),closureAuthority:n.Literal(!1),intent:n.Optional(n.String()),confidence:n.Optional(n.String()),citation:n.Optional(n.String()),evidence:n.Optional(n.String()),path:n.Optional(n.String())},{additionalProperties:!0}),hfe=n.Object({code:n.String(),severity:n.Union([n.Literal("info"),n.Literal("warning")]),message:n.Optional(n.String()),path:n.Optional(n.String())},{additionalProperties:!0}),CV=n.Object({itemId:n.String(),intent:n.Union([n.Literal("source-shipped"),n.Literal("source-superseded"),n.Literal("partial"),n.Literal("not-found"),n.Literal("no-change"),n.Literal("skipped"),n.Literal("recheck-note")]),confidence:n.String(),citations:n.Array(yfe),historicalHints:n.Array(TV),diagnostics:n.Array(hfe),rationale:n.String()},{additionalProperties:!0}),Ife=n.Object({itemId:n.String(),candidateIntent:n.String(),evidenceCount:n.Optional(n.Integer({minimum:0})),confidence:n.Optional(n.String()),evidence:n.Optional(n.Array(jT)),closureCandidates:n.Optional(n.Array(jT)),sourceFirstResult:n.Optional(CV)},{additionalProperties:!0}),MI=n.Object({scope:n.Optional(n.Object({itemIds:n.Array(n.String()),openItemCount:n.Optional(n.Integer({minimum:0}))},{additionalProperties:!0})),coverage:n.Optional(Sfe),caps:n.Optional(gfe),settings:n.Optional(n.Object({itemAuditConcurrency:Ma,maxItemAuditConcurrency:n.Integer({minimum:1}),closureAuthority:n.String()},{additionalProperties:!0})),diagnostics:n.Optional(n.Array(ffe)),sourceFirstResults:n.Optional(n.Array(CV)),historicalHints:n.Optional(n.Array(TV)),closureCandidates:n.Optional(n.Array(jT)),itemSummaries:n.Optional(n.Array(Ife))},{additionalProperties:!0}),UI=n.Object({baseline:n.Optional(n.Union([n.Object({},{additionalProperties:An}),n.Null()])),currentHead:n.Optional(n.Union([n.Object({},{additionalProperties:An}),n.Null()])),coverage:n.Optional(n.Object({},{additionalProperties:An})),caps:n.Optional(mfe),scannedCommitCount:n.Optional(n.Integer({minimum:0})),scannedCommits:n.Optional(n.Array(n.Object({},{additionalProperties:An}))),diagnostics:n.Optional(n.Array(n.Object({code:n.String(),severity:n.Union([n.Literal("info"),n.Literal("warning")]),message:n.Optional(n.String()),commit:n.Optional(n.String())},{additionalProperties:!0}))),affectedItemCandidates:n.Optional(n.Array(n.Object({},{additionalProperties:An})))},{additionalProperties:!1}),Aet=n.Object({sourceFingerprint:xm,generatedAt:n.Optional(n.String()),itemAuditConcurrency:n.Optional(Ma),gitDelta:n.Optional(UI),fullImplementationAudit:n.Optional(MI)},{additionalProperties:!1}),LV=n.Object({valid:n.Boolean(),itemChanges:n.Optional(n.Integer({minimum:0})),epicChanges:n.Optional(n.Integer({minimum:0})),noOpRechecks:n.Optional(n.Integer({minimum:0})),generatedRecommendationValidation:n.Optional(BI),recommendationFreshness:n.Optional(pfe),gitDelta:n.Optional(UI),fullImplementationAudit:n.Optional(MI),recommendationProjection:n.Optional(wV),errors:n.Optional(n.Array(lfe))},{additionalProperties:!1}),bfe=n.Object({reason:n.Union([n.Literal("apply-curation-only"),n.Literal("invalid-generated-recommendations")]),generatedRecommendationValidation:BI},{additionalProperties:!1}),DV=n.Object({itemChanges:n.Integer({minimum:0}),epicChanges:n.Integer({minimum:0}),noOpRechecks:n.Integer({minimum:0}),skippedFreshRechecks:n.Integer({minimum:0}),changedItemIds:n.Array(n.String()),changedEpicIds:n.Array(n.String()),recheckedItemIds:n.Array(n.String()),recheckedEpicIds:n.Array(n.String()),skipped:n.Array($E),needsInput:n.Array(NE),recommendations:n.Optional(n.Object({recommendations:oo,recommendationSummary:od,path:n.String(),status:aa},{additionalProperties:!1})),recommendationStatus:n.Optional(aa),generatedRecommendationValidation:n.Optional(BI),recommendationsSkipped:n.Optional(bfe),recommendationProjection:n.Optional(wV)},{additionalProperties:!1});var Vt={additionalProperties:An},Rfe=no.map(e=>n.Literal(e)),xfe=io.map(e=>n.Literal(e)),BV=Ql,Efe=n.Union([n.Literal("recommendations"),n.Literal("handoffDrafts"),n.Literal("planDrafts"),n.Literal("sessionPlanPatch"),n.Literal("sessionPlanCreationDraft")]),tu=4e3,MV=100,Pfe=50,UV=100,kfe=50,vfe=20,FV=4e3,$V=2e3,_fe=1e3,mo=100,FI=4e3,qV=6e3,NV=1e3,jV=200,zV=4e3,GV=n.Object({userGoal:n.Optional(n.String({minLength:1,maxLength:tu,pattern:"\\S"})),itemIds:n.Optional(n.Array(n.String(),{minItems:1,uniqueItems:!0})),epicId:n.Optional(n.String()),recommendationRef:n.Optional(n.String()),sourceRecommendationRef:n.Optional(n.String()),includeRoadmap:n.Optional(n.Boolean()),session:n.Optional(Zl),planningType:n.Optional(n.Union(Rfe)),planningDepth:n.Optional(n.Union(xfe)),requestedOutputSections:n.Optional(n.Array(Efe,{minItems:1}))},{additionalProperties:!1,not:{anyOf:[{required:["itemIds","epicId"]},{required:["itemIds","recommendationRef"]},{required:["epicId","recommendationRef"]}]}}),KV=n.Object({taskId:me},{additionalProperties:!1}),VV=n.Object({taskId:me},{additionalProperties:!1}),HV=LV,WV=n.Object({taskId:me,reason:n.Optional(n.String())},{additionalProperties:!1}),Afe=n.Object({index:n.Optional(n.Integer({minimum:0})),selection:n.Optional(cp),session:n.Optional(n.String()),title:n.Optional(n.String()),profile:n.Optional(qt)},{additionalProperties:!1}),Ofe=n.Object({session:Zl,sections:n.Array(n.String(),{minItems:1,uniqueItems:!0})},{additionalProperties:!1}),wfe=n.Object({session:n.Optional(Zl),profile:n.Optional(n.Union([qt,n.Null()])),agentProfile:n.Optional(n.Union([n.String(),n.Null()])),openQuestions:n.Optional(n.Array(n.String()))},{additionalProperties:!1}),Tfe=n.Object({previewAcknowledged:n.Literal(!0),confirmApply:n.Literal(!0),applyCurationOnly:n.Optional(n.Literal(!0))},{additionalProperties:!1}),BT=n.Object({taskId:me,applyRecommendations:n.Optional(n.Boolean()),applyHandoffDrafts:n.Optional(n.Array(Afe,{minItems:1})),applySessionPlanDrafts:n.Optional(n.Array(Ofe,{minItems:1})),applySessionPlanCreationDraft:n.Optional(wfe),applyBacklogCurationDraft:n.Optional(Tfe)},{additionalProperties:!1});Object.assign(BT,{anyOf:[{properties:{applyRecommendations:{const:!0}},required:["applyRecommendations"]},{required:["applyHandoffDrafts"]},{required:["applySessionPlanDrafts"]},{required:["applySessionPlanCreationDraft"]},{required:["applyBacklogCurationDraft"]}],not:{anyOf:[{properties:{applyRecommendations:{const:!0}},required:["applyBacklogCurationDraft","applyRecommendations"]},{required:["applyBacklogCurationDraft","applyHandoffDrafts"]},{required:["applyBacklogCurationDraft","applySessionPlanDrafts"]},{required:["applyBacklogCurationDraft","applySessionPlanCreationDraft"]}]}});var Cfe=sd,Lfe=n.Object({session:n.String(),relativePath:n.String(),readiness:rn,sourceRefs:n.Optional(Cfe),traceItemIds:n.Optional(n.Array(n.String()))},Vt),XV=TM,QV=CM,ZV=LM,JV=n.Object({schemaVersion:n.Literal(1),taskId:me,applied:n.Object({recommendations:n.Boolean(),handoffDrafts:n.Number(),sessionPlanSections:n.Number(),backlogCuration:n.Optional(n.Number())},{additionalProperties:!1}),recommendations:n.Optional(ap),handoffs:n.Optional(n.Array(ca)),sessionPlanDrafts:n.Optional(n.Array(n.Object({session:n.String(),sections:n.Array(n.String())},Vt))),sessionPlanCreationDraft:n.Optional(Lfe),backlogCuration:n.Optional(DV)},Vt),Dfe=n.Object({itemIds:n.Optional(n.Array(n.String())),epicId:n.Optional(n.String()),recommendationRef:n.Optional(n.String()),sourceRecommendationRef:n.Optional(n.String())},{additionalProperties:!1}),xs=n.Object({taskId:me,parentTaskId:n.Optional(me),originalRequest:n.String(),derivedRequest:n.String(),selection:Dfe,requestedOutputSections:n.Array(BV),session:n.Optional(n.String()),planningType:n.Optional(n.String()),planningDepth:n.Optional(n.String()),includeRoadmap:n.Optional(n.Boolean()),purpose:n.Optional(n.Union([n.Literal("recommendation-refresh"),n.Literal("backlog-curation")])),itemAuditConcurrency:n.Optional(Ma),sourceFingerprint:n.Optional(n.String()),appliedAt:n.Optional(n.String()),createdAt:n.String()},{additionalProperties:!1}),YV=n.Object({schemaVersion:n.Literal(1),entries:n.Array(xs)},{additionalProperties:!1}),$fe=oa({maxLimit:UV}),e6=n.Object({...$fe,includeEntry:n.Optional(n.Boolean()),includeTask:n.Optional(n.Boolean())},{additionalProperties:!1}),Nfe=n.Object({itemCount:n.Optional(n.Integer({minimum:0})),itemIds:n.Optional(n.Array(n.String())),epicId:n.Optional(n.String()),recommendationRef:n.Optional(n.String()),sourceRecommendationRef:n.Optional(n.String())},{additionalProperties:!1}),jfe=n.Object({taskId:me,parentTaskId:n.Optional(me),purpose:n.Optional(n.Union([n.Literal("recommendation-refresh"),n.Literal("backlog-curation")])),requestedOutputSections:n.Array(BV),session:n.Optional(n.String()),planningType:n.Optional(n.String()),planningDepth:n.Optional(n.String()),itemAuditConcurrency:n.Optional(Ma),sourceFingerprint:n.Optional(n.String()),appliedAt:n.Optional(n.String()),createdAt:n.String(),derivedRequestSummary:n.Optional(n.String()),selection:Nfe},{additionalProperties:!1}),Bfe=n.Object({taskId:me,kind:Xi,status:nd,createdAt:n.String(),updatedAt:n.String(),metadata:n.Optional(n.Object({},Vt)),startedAt:n.Optional(n.String()),completedAt:n.Optional(n.String()),cancelledAt:n.Optional(n.String()),errorCode:n.Optional(n.String()),errorMessage:n.Optional(n.String()),resultSummary:n.Optional(n.Object({outputKeys:n.Array(n.String()),decision:n.Optional(n.String()),summary:n.Optional(n.String())},{additionalProperties:!1}))},{additionalProperties:!1}),Mfe=n.Object({taskId:me,kind:Xi,createdAt:n.String(),updatedAt:n.String(),metadata:n.Optional(n.Object({},Vt)),status:n.Literal("completed"),startedAt:n.Optional(n.String()),completedAt:n.String()},{additionalProperties:!1}),Ufe=n.Union([yi,Mfe]),Ffe=n.Object({entry:n.Optional(xs),entrySummary:jfe,available:n.Boolean(),status:n.Optional(nd),taskSummary:n.Optional(Bfe),task:n.Optional(Ufe),resultOmitted:n.Optional(n.Boolean()),staleReason:n.Optional(n.String())},Vt),t6=n.Object({tasks:n.Array(Ffe),total:n.Integer({minimum:0}),returned:n.Integer({minimum:0}),limit:n.Integer({minimum:1,maximum:UV,default:kfe}),offset:n.Integer({minimum:0,default:0}),hasMore:n.Boolean(),nextOffset:n.Optional(n.Integer({minimum:0}))},Vt),n6=n.Object({taskId:me,userGoal:n.Optional(n.String({minLength:1,maxLength:tu,pattern:"\\S"}))},{additionalProperties:!1}),i6=n.Object({taskId:me},{additionalProperties:!1}),r6=n.Object({taskId:me,removed:n.Boolean()},{additionalProperties:!1}),o6=n.Object({taskId:me,answers:n.Optional(n.Array(n.String(),{minItems:1})),steering:n.Optional(n.String({minLength:1,pattern:"\\S"}))},{additionalProperties:!1,anyOf:[{required:["answers"]},{required:["steering"]}]}),MT=n.Object({task:yi,entry:xs},Vt),Ee=n.String({minLength:1,pattern:"\\S"}),UT=n.String({pattern:"^[a-f0-9]{64}$"}),s6=n.Object({dimension:Ee,sha256:UT},{additionalProperties:!1}),qfe=n.Union([n.Literal("selection"),n.Literal("block"),n.Literal("section"),n.Literal("whole-plan")]),zfe=n.Object({exact:n.String({minLength:1,maxLength:qV,pattern:"\\S"}),prefix:n.Optional(n.String({maxLength:NV})),suffix:n.Optional(n.String({maxLength:NV}))},{additionalProperties:!1}),qI=n.Object({kind:qfe,dimension:n.Optional(n.String({minLength:1,maxLength:jV,pattern:"\\S"})),label:n.Optional(n.String({minLength:1,maxLength:jV,pattern:"\\S"})),capturedText:n.String({minLength:1,maxLength:qV,pattern:"\\S"}),quoteContext:zfe},{additionalProperties:!1}),a6=n.Object({annotationId:Ee,targetSession:Ee,body:n.Optional(n.String({maxLength:FI})),target:qI,createdAt:n.String(),updatedAt:n.String(),resolvedAt:n.Optional(n.String()),resolvedByTurnId:n.Optional(Ee),dismissedAt:n.Optional(n.String())},{additionalProperties:!1}),Gfe=n.Object({annotationId:Ee,targetSession:Ee,body:n.Optional(n.String({maxLength:FI})),target:qI,createdAt:n.String(),updatedAt:n.String(),resolvedAt:n.Optional(n.String()),resolvedByTurnId:n.Optional(Ee),dismissedAt:n.Optional(n.String()),snapshotAt:n.String(),snapshotReason:n.Union([n.Literal("selected"),n.Literal("open"),n.Literal("selected-and-open")])},{additionalProperties:!1}),c6=n.Object({steering:n.Optional(n.String({minLength:1,maxLength:zV,pattern:"\\S"})),selectedAnnotationIds:n.Array(Ee,{uniqueItems:!0}),openAnnotationIds:n.Array(Ee,{uniqueItems:!0}),includeOpenAnnotations:n.Boolean(),annotations:n.Array(Gfe)},{additionalProperties:!1}),FT=n.Object({turnId:Ee,taskId:me,userMessage:Ee,basePlanFingerprint:UT,baseSectionHashes:n.Array(s6),retryOfTaskId:n.Optional(me),redraftOfTaskId:n.Optional(me),parentTaskId:n.Optional(me),appliedAt:n.Optional(n.String()),appliedSections:n.Optional(n.Array(n.String(),{uniqueItems:!0})),createdAt:n.String(),annotationSnapshot:n.Optional(c6)},{additionalProperties:!1}),Kfe=n.Object({threadId:Ee,targetSession:Ee,turns:n.Array(FT),annotations:n.Array(a6),dismissedAt:n.Optional(n.String()),createdAt:n.String(),updatedAt:n.String()},{additionalProperties:!1}),d6=n.Object({schemaVersion:n.Literal(1),sessions:n.Array(Kfe)},{additionalProperties:!1}),Vfe=n.Object({turnId:Ee,taskId:me,userMessage:Ee,basePlanFingerprint:UT,baseSectionHashes:n.Array(s6),retryOfTaskId:n.Optional(me),redraftOfTaskId:n.Optional(me),parentTaskId:n.Optional(me),appliedAt:n.Optional(n.String()),appliedSections:n.Optional(n.Array(n.String(),{uniqueItems:!0})),createdAt:n.String(),annotationSnapshot:n.Optional(c6),turn:FT,available:n.Boolean(),status:n.Optional(nd),task:n.Optional(yi),staleReason:n.Optional(n.String())},Vt),qT=n.Object({threadId:n.String(),targetSession:n.String(),turns:n.Array(Vfe),annotations:n.Optional(n.Array(a6)),createdAt:n.String(),updatedAt:n.String(),plan:n.Optional(n.Object({},Vt)),readiness:n.Optional(rn),path:n.Optional(n.String()),sourceRefs:n.Optional(n.Object({},Vt)),lifecycle:n.Optional(n.Object({},Vt))},Vt),u6=n.Object({session:Ee},{additionalProperties:!1}),l6=n.Object({includePlan:n.Optional(n.Boolean()),includeDismissed:n.Optional(n.Boolean()),limit:n.Optional(n.Integer({minimum:1,maximum:MV,default:Pfe})),offset:n.Optional(n.Integer({minimum:0,default:0}))},{additionalProperties:!1}),p6=n.Object({session:n.Optional(Ee),threadId:n.Optional(Ee),includePlan:n.Optional(n.Boolean())},{additionalProperties:!1,oneOf:[{required:["session"]},{required:["threadId"]}]}),m6=n.Object({session:Ee,message:n.Optional(n.String({minLength:1,maxLength:tu,pattern:"\\S"})),annotationIds:n.Optional(n.Array(Ee,{minItems:1,uniqueItems:!0,maxItems:mo})),includeOpenAnnotations:n.Optional(n.Boolean()),steering:n.Optional(n.String({minLength:1,maxLength:zV,pattern:"\\S"}))},{additionalProperties:!1,anyOf:[{required:["message"]},{required:["annotationIds"]},{required:["steering"]},{properties:{includeOpenAnnotations:{const:!0}},required:["includeOpenAnnotations"]}]}),Hfe=n.Object({questionId:n.Optional(n.String({maxLength:$V})),prompt:n.Optional(n.String({maxLength:$V})),answer:n.String({minLength:1,maxLength:FV,pattern:"\\S"})},{additionalProperties:!1}),f6=n.Object({session:Ee,taskId:n.Optional(me),turnId:n.Optional(Ee),answers:n.Optional(n.Array(Hfe,{minItems:1,maxItems:vfe})),steering:n.Optional(n.String({minLength:1,maxLength:FV,pattern:"\\S"}))},{additionalProperties:!1,oneOf:[{required:["taskId"]},{required:["turnId"]}]}),g6=n.Object({session:Ee,taskId:n.Optional(me),turnId:n.Optional(Ee),reason:n.Optional(n.String({maxLength:_fe}))},{additionalProperties:!1,oneOf:[{required:["taskId"]},{required:["turnId"]}]}),S6=n.Object({session:Ee,taskId:n.Optional(me),turnId:n.Optional(Ee)},{additionalProperties:!1,oneOf:[{required:["taskId"]},{required:["turnId"]}]}),y6=n.Object({session:Ee,body:n.Optional(n.String({maxLength:FI})),target:qI},{additionalProperties:!1}),h6=n.Object({session:Ee,annotationId:Ee,body:n.Optional(n.String({maxLength:FI})),target:n.Optional(qI)},{additionalProperties:!1,anyOf:[{required:["body"]},{required:["target"]}]}),zI=n.Object({session:Ee,annotationId:Ee},{additionalProperties:!1}),I6=zI,b6=zI,fo=qT,R6=n.Object({sessions:n.Array(qT),total:n.Integer({minimum:0}),limit:n.Integer({minimum:1,maximum:MV}),offset:n.Integer({minimum:0})},Vt),zT=n.Object({session:qT,task:yi,turn:FT},Vt),x6=n.Union([n.Object({kind:n.Literal("applied"),session:n.String(),turnId:Ee,taskId:me,appliedSections:n.Array(n.String()),readiness:rn,plan:n.Object({},Vt),path:n.String(),message:n.String()},Vt),n.Object({kind:n.Literal("not-applicable"),session:n.String(),taskId:n.Optional(me),turnId:n.Optional(Ee),message:n.String()},{additionalProperties:!1,anyOf:[{required:["taskId"]},{required:["turnId"]}]})]);var Wfe=n.Object({state:n.Union([n.Literal("missing"),n.Literal("fresh"),n.Literal("stale")]),reason:n.String(),storedSourceFingerprint:n.Optional(n.String()),comparedSourceFingerprint:n.String(),baselineTaskId:n.Optional(n.String()),staleReasons:n.Optional(n.Array(rd,{maxItems:20}))},{additionalProperties:!1}),E6=n.Object({...$U.properties,recommendationFreshness:Wfe},{additionalProperties:!1}),P6=n.Object({},{additionalProperties:!1}),k6=n.Object({task:yi,entry:xs,sourceFingerprint:xm,reused:n.Optional(n.Boolean())},{additionalProperties:!1});function GI(e){let{storedStatus:t,comparedSourceFingerprint:i,baselineTaskId:r}=e,o=t.sidecar?.lastAppliedSourceFingerprint,s={comparedSourceFingerprint:i,...o!==void 0&&{storedSourceFingerprint:o},...r!==void 0&&{baselineTaskId:r}};if(t.invalidReason!==void 0)return{state:"stale",reason:v6(t.invalidReason,"Recommendation status metadata is invalid."),...s};if(!t.currentExists&&t.sidecar===null)return{state:"missing",reason:"No current recommendation model or freshness metadata exists.",...s};if(t.sidecar===null)return{state:"stale",reason:"Recommendation status metadata sidecar is missing.",...s};if(!t.currentExists)return{state:"stale",reason:"Recommendation status metadata exists but the current recommendation model is missing.",...s};if(t.sidecar.lastAppliedAt===void 0||t.sidecar.lastAppliedSourceFingerprint===void 0)return{state:"stale",reason:"Recommendation status metadata is missing freshness metadata.",...s};let a=Xfe(t.sidecar)[0];return a!==void 0?{state:"stale",reason:v6(a,"Recommendation status metadata contains persisted stale reasons."),...s}:t.sidecar.lastAppliedSourceFingerprint!==i?{state:"stale",reason:"Recommendation source fingerprint drifted since the model was last applied.",...s}:{state:"fresh",reason:"Recommendation model is fresh for the compared source fingerprint.",...s}}function Xfe(e){return e.reasons??e.staleReasons??[]}function v6(e,t){return Qfe(e.summary,e.message,t)}function Qfe(...e){return e.find(t=>t!==void 0&&t.length>0)??"Recommendation freshness is stale."}var Jfe=20;function ige(e){return e.extensionStoragePath("project-local",["recommendations","status.json"])}function Pm(e){return ige(ut({cwd:e,extensionName:"eforge-plan"}))}async function nu(e,t=WI(e)){let i=Pm(e),r;try{r=await JT(i)}catch(p){let m=await gn(e);return GT(t,i,m,void 0,[q6(p)])}let o=KI(e,t);if(!o&&r===null)return sge(t,i);let s=await gn(e);if(r===null)return GT(t,i,s,void 0,[age()]);let a=dge(r);if(a!==null)return GT(t,i,s,r.lastAppliedSourceFingerprint,[a]);let c=G6(r).filter(p=>p.code!=="source-fingerprint-drift"),d=[...c],u=uge(r,c),l=GI({storedStatus:{currentExists:o,sidecar:u},comparedSourceFingerprint:s});return r.lastAppliedSourceFingerprint!==void 0&&r.lastAppliedSourceFingerprint!==s&&d.push(z6(s,r.lastAppliedSourceFingerprint)),YT({state:l.state==="fresh"&&d.length===0?"fresh":"stale",currentPath:t,statusPath:i,sourceFingerprint:s,lastAppliedSourceFingerprint:r.lastAppliedSourceFingerprint,freshAt:r.freshAt??r.lastAppliedAt,staleSince:d.length>0||!o?r.staleSince??r.lastAppliedAt:void 0,lastRefreshedBy:r.lastRefreshedBy,reasons:d})}async function VI(e,t){let i=WI(e),r=Pm(e),o=t??await gn(e);try{return GI({storedStatus:{currentExists:KI(e,i),sidecar:await JT(r)},comparedSourceFingerprint:o})}catch(s){return GI({storedStatus:{currentExists:KI(e,i),sidecar:null,invalidReason:q6(s)},comparedSourceFingerprint:o})}}async function w6(e){return iu(e,await gn(e),"put-recommendations")}async function T6(e,t="apply-planner-result"){return iu(e,await gn(e),t)}async function iu(e,t,i="apply-planner-result"){let r=await gn(e),o=new Date().toISOString(),s=t===r?[]:[z6(r,t)];return await F6(Pm(e),{schemaVersion:1,lastAppliedAt:o,freshAt:o,...s.length>0&&{staleSince:o},lastRefreshedBy:i,lastAppliedSourceFingerprint:t,sourceFingerprint:r,reasons:s,staleReasons:s}),nu(e)}async function C6(e,t){let i=WI(e),r=Pm(e),o=await gn(e),s=await cge(r),a=new Date().toISOString(),c=s?.lastAppliedAt??s?.freshAt??a,d=s?.lastAppliedSourceFingerprint??o,u=lge(G6(s),t);return NK(e,t.message??t.code??"recommendations-stale",t.refs??[]),await F6(r,{schemaVersion:1,lastAppliedAt:c,freshAt:s?.freshAt??s?.lastAppliedAt,staleSince:s?.staleSince??a,lastRefreshedBy:s?.lastRefreshedBy,lastAppliedSourceFingerprint:d,sourceFingerprint:o,reasons:u,staleReasons:u}),nu(e,i)}async function Pi(e,t,i){let r=WI(e),o=Pm(e);if(!KI(e,r)&&!QT(o)&&$I(e)===null)return null;let s=i.length>0?` for ${i.join(", ")}`:"";return C6(e,{code:`backlog-mutation:${t}`,message:`Recommendations are stale after eforge-plan backlog mutation ${t}${s}.`})}async function HI(e,t){return C6(e,{eventType:t.eventType,itemIds:[...t.itemIds],correlationKind:t.correlationKind,timestamp:t.timestamp,summary:t.summary,code:`lifecycle:${t.eventType}`,message:t.summary,...t.refs!==void 0&&{refs:[...t.refs]}})}async function gn(e){return N6(await D6(e))}async function L6(e,t,i){return N6(await $6(e,t,i))}async function D6(e){let t=Sm(e).map(Rs),i=ST(e).map(ja),[r,o]=await Promise.all([nn(e),po(e)]);return $6(e,VT(r,t),VT(o,i))}async function $6(e,t,i){let r=await Ri(e),o=t.filter(d=>hi(d.status)).sort(O6),s=i.filter(d=>hi(d.status)).sort(O6),a=new Set(o.map(d=>d.id)),c=K6((await xi(e,r)).filter(d=>a.has(d.itemId)));return{schemaVersion:1,items:o.map(pge),epics:s.map(mge),dependencies:ad(o).sort(XT),blockers:da(o).sort(XT),roadmapContext:await eu(e),traceSummaries:c}}function N6(e){return gge(V6(j6(e)))}function j6(e){return{...e,...e.roadmapContext!==void 0&&{roadmapContext:B6(e.roadmapContext)}}}function B6(e){return KT(e)}function KT(e){if(Array.isArray(e))return e.map(KT);if(e===null||typeof e!="object")return e;let t={};for(let[i,r]of Object.entries(e))i!=="updatedAt"&&(t[i]=KT(r));return t}async function M6(e,t){let i=await Ri(e),r=t===void 0?void 0:new Set(t),o=(await xi(e,i)).filter(s=>r===void 0||r.has(s.itemId));return K6(o)}async function U6(e,t){let[i,r]=[Sm(e),ST(e)],[o,s]=await Promise.all([nn(e),po(e)]);rge(t,_6(o,i.map(Rs)),_6(s,r.map(ja)))}function rge(e,t,i){let r=oge(e,t,i);r.valid||ZT(r.issues)}function _6(e,t){return VT(e,t)}function VT(e,t){return[...new Map([...e,...t].map(i=>[i.id,i])).values()]}function oge(e,t,i){let r=new Map(t.map(a=>[a.id,a])),o=new Map(i.map(a=>[a.id,a])),s=[];for(let[a,c]of[["activeWork",e.activeWork],["readyCandidates",e.readyCandidates],["recommendedNextSequence",e.recommendedNextSequence]])c.forEach((d,u)=>Em(`${a}[${u}].itemId`,d.itemId,r,"item",s));for(let a of e.safeParallelizableGroups){a.itemIds.length===0&&s.push(HT(`safeParallelizableGroups.${a.ref}.itemIds`,"","item","empty",void 0));for(let c of a.itemIds)Em(`safeParallelizableGroups.${a.ref}.itemIds`,c,r,"item",s);for(let c of a.epicIds??[])Em(`safeParallelizableGroups.${a.ref}.epicIds`,c,o,"epic",s)}for(let a of e.blockedChains){let c=a.ref??"<unreferenced>";for(let d of a.itemIds)Em(`blockedChains.${c}.itemIds`,d,r,"item",s);for(let d of a.blockedBy)Em(`blockedChains.${c}.blockedBy`,d,r,"item",s)}return{valid:s.length===0,issues:s}}function ZT(e){let i=e[0]?.message??"Recommendation references are invalid.";throw new Xn(i,e.map(r=>({...r})))}function KI(e,t){return QT(t)}async function JT(e){return QT(e)?hr(YS,JSON.parse(await ege(e,"utf-8"))):null}async function F6(e,t){let i=hr(YS,t);await Yfe(nge(e),{recursive:!0}),await tge(e,`${JSON.stringify(i,null,2)}
|
|
472
|
+
`)}function GT(e,t,i,r,o){return YT({state:"stale",currentPath:e,statusPath:t,sourceFingerprint:i,lastAppliedSourceFingerprint:r,staleSince:new Date().toISOString(),reasons:o})}function sge(e,t){return YT({state:"missing",currentPath:e,statusPath:t,reasons:[]})}function YT(e){return Object.fromEntries(Object.entries({...e,reasons:e.reasons,staleReasons:e.reasons}).filter(([,t])=>t!==void 0))}function age(){return{code:"missing-status-sidecar",message:"Recommendation status metadata sidecar is missing."}}async function cge(e){try{return await JT(e)}catch{return null}}function q6(e){return{code:"invalid-status-sidecar",message:`Recommendation status metadata sidecar is invalid: ${e instanceof Error?e.message:String(e)}`}}function dge(e){return e.lastAppliedAt!==void 0&&e.lastAppliedSourceFingerprint!==void 0?null:{code:"invalid-status-sidecar",message:"Recommendation status metadata sidecar is invalid: freshness metadata requires lastAppliedAt and lastAppliedSourceFingerprint."}}function uge(e,t){return{...e,reasons:t,staleReasons:t}}function z6(e,t){let i="Recommendation source fingerprint drifted since the model was last applied.";return{code:"source-fingerprint-drift",message:i,summary:i,sourceFingerprint:e,lastAppliedSourceFingerprint:t}}function G6(e){return e?.reasons??e?.staleReasons??[]}function lge(e,t){let i=A6(t);return[...e.filter(r=>A6(r)!==i),t].slice(-Jfe)}function A6(e){return V6(e)}function WI(e){return ut({cwd:e,extensionName:"eforge-plan"}).extensionStoragePath("project-local",["recommendations","current.json"])}function pge(e){return{id:e.id,title:e.title,status:e.status,...e.epic!==void 0&&{epic:e.epic},tags:[...e.tags].sort(),dependsOn:[...e.depends_on].sort(),sections:Object.fromEntries([...zt(e.body).entries()].sort(([t],[i])=>t.localeCompare(i)))}}function mge(e){return{id:e.id,title:e.title,status:e.status,tags:[...e.tags].sort(),sections:Object.fromEntries([...zt(e.body).entries()].sort(([t],[i])=>t.localeCompare(i)))}}function K6(e){return e.sort(XT).map(t=>({itemId:t.itemId,...t.epicId!==void 0&&{epicId:t.epicId},hasActiveSessionPlan:t.hasActiveSessionPlan,hasActiveQueuePrd:t.hasActiveQueuePrd,hasActiveBuildRun:t.hasActiveBuildRun,hasActiveBuildSession:t.hasActiveBuildSession,hasActiveTrace:t.hasActiveTrace,activeReasons:t.activeReasons,...t.lastEvent!==void 0&&{lastEvent:fge(t.lastEvent)},...t.lifecycleState!==void 0?{lifecycleState:t.lifecycleState}:{},...(t.linkRows??[]).length>0?{lifecycleLinks:VG(t.linkRows??[])}:{}}))}function fge(e){return Object.fromEntries(["type","timestamp","sessionId","runId","cursor"].flatMap(t=>e[t]===void 0?[]:[[t,e[t]]]))}function Em(e,t,i,r,o){let s=i.get(t);if(s===void 0){o.push(HT(e,t,r,"unknown",void 0));return}s.status!==void 0&&Ji(s.status)&&o.push(HT(e,t,r,"closed",s))}function HT(e,t,i,r,o){let s=o?.status,a=o?.title,c=t.length>0?`${i} id "${t}"`:`${i} id`,d=r==="empty"?"must include at least one open item id":r==="closed"?`references closed ${c}${s!==void 0?` with status "${s}"`:""}`:`references unknown ${c}`;return{path:e,id:t,kind:i,reason:r,...s!==void 0&&{status:s},...a!==void 0&&{title:a},message:`Recommendation ${e} ${d}. Recommendation target fields may reference only open ${i} ids.`}}function V6(e){return JSON.stringify(WT(e))}function WT(e){return Array.isArray(e)?e.map(WT):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[i])=>t.localeCompare(i)).map(([t,i])=>[t,WT(i)])):e}function gge(e){return Zfe("sha256").update(e).digest("hex")}function O6(e,t){return e.id.localeCompare(t.id)}function XT(e,t){return e.itemId.localeCompare(t.itemId)}var Rge=1;function go(e){return e.extensionStoragePath("project-local",["recommendations","current.json"])}function So(e){return go(ut({cwd:e,extensionName:"eforge-plan"}))}function H6(){return{schemaVersion:Rge,activeWork:[],readyCandidates:[],recommendedNextSequence:[],safeParallelizableGroups:[],blockedChains:[],rationaleAndAssumptions:[]}}async function km(e){return Sge(e)?W6(JSON.parse(await hge(e,"utf-8"))):null}async function ki(e){return $I(e)??km(So(e))}async function xge(e,t){let i=W6(t);return await yge(bge(e),{recursive:!0}),await Ige(e,`${JSON.stringify(i,null,2)}
|
|
473
|
+
`),i}async function ru(e,t){let i=eC(t);return await U6(e,i),await xge(So(e),i),$K(e,i,Sn(i)),i}function eC(e){return Ege(e),hr(oo,e)}function W6(e){return eC(e)}function Ege(e){if(!e||typeof e!="object")return;let t=e.safeParallelizableGroups;if(Array.isArray(t))for(let i of t){if(!i||typeof i!="object")continue;let r=typeof i.ref=="string"?i.ref:"<unknown>",o=i.itemIds;if(Array.isArray(o)&&o.length===0)throw new Error(`Recommendation group ${r} must include at least one item id.`)}}function Sn(e){if(e)return{recommendedNextItemIds:e.recommendedNextSequence.map(t=>t.itemId),safeParallelizableGroups:e.safeParallelizableGroups.map(t=>({ref:t.ref,...t.title!==void 0&&{title:t.title},itemIds:t.itemIds,...t.epicIds!==void 0&&{epicIds:t.epicIds},...t.safeToPlanTogether!==void 0&&{safeToPlanTogether:t.safeToPlanTogether},...t.rationale!==void 0&&{rationale:t.rationale},...t.recommendedProfile!==void 0&&{recommendedProfile:t.recommendedProfile}})),blockedChainCount:e.blockedChains.length,rationaleAndAssumptions:e.rationaleAndAssumptions}}function Pge(e,t,i){let r=new Map;for(let o of i){let s=o.itemId??o.itemRef;if(!t.includes(s))continue;let a=r.get(o.session)??new Set;a.add(s),r.set(o.session,a)}return lo(e).flatMap(o=>{if(o.kind==="queue-prd"&&!rr(o.status))return[];let s=o.status?.toLowerCase(),a=o.kind==="landing"?s==="shipped"?"shipped":s==="merged"?"merged":s&&!$a(s)?"pr-open":void 0:s==="failed"?"failed":$a(s)?void 0:o.kind==="queue-prd"?"queued":"build";return a===void 0?[]:(o.itemId?[o.itemId]:[...r.get(o.session??"")??[]]).filter(d=>t.includes(d)).map(d=>({evidenceKey:`queue-build:${o.kind}:${o.id}:${d}`,itemId:d,itemRef:d,lifecycleState:a,reasonCode:a==="shipped"?"shipped":a==="merged"?"merged":a==="failed"?"failed":o.kind==="queue-prd"?"queued-trace":o.kind==="build-session"?"active-build-session-trace":a==="pr-open"?"pr-open":"building-trace",status:o.status,session:o.session,queuePrdId:o.queuePrdId,runId:o.runId,buildSessionId:o.buildSessionId,landingId:o.kind==="landing"?o.id:void 0,occurredAt:o.timestamp,isCurrent:!0,isTerminal:a==="shipped"||a==="merged"||a==="failed"}))})}function kge(e,t){let i=[...new Set(t.itemIds)],r=new Set(t.excludePlanningTaskIds??[]),o=Tr(e),s=t.includePlanningTasks===!1?[]:uo(e).filter(u=>!r.has(u.taskId)),a=[...fI(e,i),...Pge(e,i,o)],c=[];for(let u of i){let l=Ei(e,[u]),p=mT({itemId:u,links:l,evidence:a.filter(m=>m.itemId===u||m.itemRef===u),sessionItems:o.filter(m=>(m.itemId??m.itemRef)===u),taskItems:s.filter(m=>(m.itemId??m.itemRef)===u)});if(c.push(...p.filter(m=>t.includeTerminalReasons===!0||m.terminal||m.reasonCode!=="candidate-no-evidence").map(m=>({itemId:u,reasonCode:m.reasonCode,lifecycleState:m.lifecycleState,associatedLinks:m.associatedLinks,terminal:m.terminal}))),t.includeTerminalReasons===!0){let m=a.filter(f=>(f.itemId===u||f.itemRef===u)&&f.isTerminal);for(let f of m){let g=Is(f);p.some(y=>y.reasonCode===g)||c.push({itemId:u,reasonCode:g,lifecycleState:f.lifecycleState,associatedLinks:l,terminal:!0})}}}let d=[...new Map(c.map(u=>[`${u.itemId}:${u.reasonCode}:${u.lifecycleState}`,u])).values()];return{schemaVersion:1,ok:d.length===0,entries:d,coveredItemIds:[...new Set(d.map(u=>u.itemId))].sort()}}async function Ua(e,t){return ft(e,i=>kge(i,t),()=>({schemaVersion:1,ok:!0,entries:[],coveredItemIds:[]}))}async function tC(e,t){let i=t?[...t.activeWork,...t.readyCandidates,...t.recommendedNextSequence].map(a=>a.itemId).concat(t.safeParallelizableGroups.flatMap(a=>a.itemIds)):[],r=await Ua(e,{itemIds:[...new Set(i)],includeTerminalReasons:!0}),o=new Map;for(let a of r.entries)o.has(a.itemId)||o.set(a.itemId,a);await ft(e,a=>{for(let c of ym(a,{includeArchive:!0,includeLinks:!0}))i.includes(c.id)&&c.planEligible===!1&&!o.has(c.id)&&o.set(c.id,{itemId:c.id,reasonCode:c.planEligibilityReasonCode??c.reasonCodes[0]??c.effectiveLifecycle,lifecycleState:c.effectiveLifecycle,associatedLinks:c.planEligibilityLinks??c.associatedLinks??[],terminal:["failed","partial","merged","shipped"].includes(c.effectiveLifecycle)})},()=>{});let s=a=>{let c=o.get(a);if(!c)return{itemId:a,state:"actionable",disposition:"actionable",lifecycleState:"none",associatedLinks:[]};let d=c.terminal?"de-actioned":"suppressed",u=c.reasonCode==="submitted-session-plan"?"planned":c.lifecycleState;return{itemId:a,state:"non-actionable",disposition:d,lifecycleState:u,reasonCode:c.reasonCode,reasonMessage:`Item ${a} is covered by ${c.reasonCode}.`,associatedLinks:c.associatedLinks}};return{schemaVersion:1,activeWork:(t?.activeWork??[]).map(a=>({lane:"activeWork",...a.ref?{ref:a.ref}:{},itemId:a.itemId,actionability:s(a.itemId)})),readyCandidates:(t?.readyCandidates??[]).map(a=>({lane:"readyCandidates",...a.ref?{ref:a.ref}:{},itemId:a.itemId,actionability:s(a.itemId)})),recommendedNextSequence:(t?.recommendedNextSequence??[]).map(a=>({lane:"recommendedNextSequence",...a.ref?{ref:a.ref}:{},itemId:a.itemId,actionability:s(a.itemId)})),safeParallelizableGroups:(t?.safeParallelizableGroups??[]).map(a=>{let c=a.itemIds.map(s),d=c.filter(l=>l.state==="actionable").map(l=>l.itemId),u=c.filter(l=>l.state==="non-actionable").map(l=>l.itemId);return{ref:a.ref,state:u.length===0?"actionable":d.length===0?"non-actionable":"partially-actionable",itemIds:a.itemIds,actionableItemIds:d,suppressedItemIds:u,items:c}})}}import{readFile as n2}from"fs/promises";import{isAbsolute as vge,join as i2,relative as X6,resolve as _ge}from"path";var Es="status source = canonical eforge-plan SQLite session-plan status records in the eforge-plan extension store; lifecycle/projection records, monitor events, event-tail output, and status fields are derived evidence or diagnostics.",r2="status source = Markdown compatibility fallback because canonical eforge-plan SQLite session-plan status records were unavailable; lifecycle/projection records, monitor events, event-tail output, and status fields are derived evidence or diagnostics.",Age={ready:!1,missingDimensions:[],coveredDimensions:[],skippedDimensions:[]};function iC(e){if(!e||typeof e!="object")return Age;let t=e;return{ready:t.ready===!0,missingDimensions:nC(t.missingDimensions),coveredDimensions:nC(t.coveredDimensions),skippedDimensions:nC(t.skippedDimensions),...Array.isArray(t.acDiagnostics)?{acDiagnostics:t.acDiagnostics}:{}}}function nC(e){return Array.isArray(e)?e:[]}function vm(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function Q6(e){return e instanceof Map?Object.fromEntries(e):e??{}}function o2(e,t){return vge(t)?t:i2(e,t)}function Oge(e){return Dn(e)}function yo(e){if(typeof e!="string"||e.trim().length===0)return;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():void 0}function Z6(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function J6(e,t){for(let i of t){let r=yo(e[i]);if(r)return r}}function wge(e){let t=Z6(e.frontmatter),i=Z6(t.eforge_plan);return J6(t,["ready_at","readyAt","status_ready_at","session_plan_ready_at"])??J6(i,["ready_at","readyAt"])}function Tge(e){return e.map(yo).filter(t=>t!==void 0).sort().at(-1)}function s2(e,t){let i=new Set(["queue-prd","build-run","build-session","landing"]);return vm({createdAt:yo(e.createdAt),updatedAt:yo(e.updatedAt),readyAt:wge(e),submittedAt:yo(e.submittedAt),lastBuildActivityAt:Tge([...t.linkRows.filter(r=>i.has(String(r.kind))&&r.session===e.session).map(r=>r.timestamp),...t.sessionBuildRows.map(r=>r.timestamp)])})}async function a2(e,t,i,r){let o=r??await n2(i,"utf8").catch(()=>""),s=o.length>0?Oge(o):void 0,a=t.artifactBodyHash;if(t.readinessSummary!==void 0&&s!==void 0&&a===s)return{readiness:iC(t.readinessSummary),readinessSource:"cache",readinessFreshness:{state:"fresh",storedArtifactBodyHash:a,currentArtifactBodyHash:s}};let c=Ve();try{return{readiness:await c.flat.readiness({cwd:e,session:t.session}),readinessSource:"markdown",readinessFreshness:{state:t.readinessSummary===void 0?"missing":"stale",storedArtifactBodyHash:a,currentArtifactBodyHash:s}}}catch{return{readiness:iC(t.readinessSummary),readinessSource:t.readinessSummary===void 0?"empty":"cache",readinessFreshness:{state:s===void 0?"missing":"stale",storedArtifactBodyHash:a,currentArtifactBodyHash:s}}}}function Cge(e,t){return{sourceItemIds:[...new Set(e.map(i=>i.itemId??i.itemRef))].sort(),sourceEpicIds:[...new Set(t.map(i=>i.epicId??i.epicRef))].sort(),...e.find(i=>i.sourceRecommendationRef)?.sourceRecommendationRef?{recommendationRef:e.find(i=>i.sourceRecommendationRef)?.sourceRecommendationRef}:{},...e.find(i=>i.promotedAt)?.promotedAt?{promotedAt:e.find(i=>i.promotedAt)?.promotedAt}:{}}}function Lge(e,t){return[...e.map(i=>vm({itemRef:i.itemRef,itemId:i.itemId,provenance:i.provenance,sourceRecommendationRef:i.sourceRecommendationRef,promotedAt:i.promotedAt})),...t.map(i=>{let r=i;return vm({epicRef:r.epicRef,epicId:r.epicId,provenance:r.provenance,sourceRecommendationRef:r.sourceRecommendationRef,promotedAt:r.promotedAt})})]}function Y6(e){return e.map(t=>vm({kind:t.kind,stage:String(t.reasonCode??t.kind),label:t.label??t.id,status:t.status??"",session:t.session,runId:t.runId,buildSessionId:t.buildSessionId,prUrl:t.prUrl??t.url,path:t.path,timestamp:t.timestamp,affectedItemIds:t.affectedItemIds??t.itemIds??[]}))}function c2(e,t){if(e.length===0)return{lifecycleState:"none",partialReasons:[]};let i=[];(t.length<e.length||t.some(o=>o.unresolvedSourceRef))&&i.push({code:"incomplete-coverage",message:"Lifecycle projection is partial because one or more linked source items could not be resolved."}),(t.some(o=>o.missingLifecycleEvidence)||t.some(o=>o.lifecycleState==="none"))&&i.push({code:"missing-lifecycle-evidence",message:"Lifecycle projection is partial because at least one linked source item has no lifecycle evidence."});let r=[...new Set(t.map(o=>o.lifecycleState))];return r.length===1&&r[0]==="partial"&&i.length===0&&i.push({code:"partial-source-state",message:"Lifecycle projection is partial because one or more linked source items are partial."}),i.length>0?{lifecycleState:"partial",partialReasons:i}:r.length===1?{lifecycleState:r[0],partialReasons:[]}:{lifecycleState:"partial",partialReasons:[{code:"mixed-source-states",message:`Lifecycle projection is partial because linked source items have mixed lifecycle states: ${r.sort().join(", ")}.`}]}}function Dge(e,t){let i=e.filter(r=>r.session===t&&r.isCurrent);return{queuePrdIds:new Set(i.map(r=>r.queuePrdId).filter(r=>r!==void 0)),runIds:new Set(i.map(r=>r.runId).filter(r=>r!==void 0)),buildSessionIds:new Set(i.map(r=>r.buildSessionId).filter(r=>r!==void 0))}}function d2(e){return e.queuePrdIds.size>0||e.runIds.size>0||e.buildSessionIds.size>0}function e2(e,t,i){return e.session!==t||!d2(i)?!0:e.kind==="queue-prd"?i.queuePrdIds.has(e.id):e.kind==="build-run"?e.runId!==void 0&&i.runIds.has(e.runId):e.kind==="build-session"?e.buildSessionId!==void 0&&i.buildSessionIds.has(e.buildSessionId):!0}function $ge(e,t,i){return e.session!==t||!d2(i)?!0:e.kind==="queue-prd"?i.queuePrdIds.has(e.id):e.kind==="build-run"?e.runId!==void 0&&i.runIds.has(e.runId):e.kind==="build-session"?e.buildSessionId!==void 0&&i.buildSessionIds.has(e.buildSessionId):!0}function rC(e,t){let i=em(e),r=Dge(i,t),o=lo(e).filter(g=>g.session===t&&$ge(g,t,r)),s=wG(e,t),a=TG(e,t),c=Cge(s,a),d=c.sourceItemIds,u=Tr(e),l=uo(e),p=d.map(g=>{let y=mI(e,g)??ys(e).find(H=>H.id===g),R=Y6(Ei(e,[g]).filter(H=>e2(H,t,r))),A=i.filter(H=>H.itemId===g||H.itemRef===g),D=u.filter(H=>(H.itemId??H.itemRef)===g),_=l.filter(H=>(H.itemId??H.itemRef)===g),$=R.filter(H=>H.kind!=="session-plan"),M=A.length===0&&$.length===0&&_.length===0,G=M?{lifecycleState:"none"}:mm({userStatus:y?.userStatus??"candidate",evidence:A,sessionItems:D,taskItems:_,hasUnresolvedDependency:!1});return{itemId:g,title:y?.title??g,status:y?.userStatus??"candidate",...y?.epicId?{epic:y.epicId}:{},lifecycleState:G.lifecycleState,unresolvedSourceRef:!y,missingLifecycleEvidence:M,linkRows:R,failureEvidence:R.filter(H=>H.status==="failed")}}),m=Y6(Ei(e,d).filter(g=>e2(g,t,r))),f=c2(d,p);return{session:t,sourceRefs:c,sourceRefRows:Lge(s,a),lifecycleState:f.lifecycleState,state:f.lifecycleState,partialReasons:f.partialReasons,itemIds:d,itemRows:p,linkRows:m,sessionBuildRows:o,associatedLinks:m,failureEvidence:m.filter(g=>g.status==="failed")}}async function Nge(e,t,i){let r=t.path??`.eforge/session-plans/${t.session}.md`,o=await a2(e,t,o2(e,r)),s=o.readiness,a=s2(t,i);return{kind:"plan",key:`plan:${t.session}`,session:t.session,title:t.topic??t.session,topic:t.topic??t.session,status:t.status??"draft",statusSource:"eforge-plan-sqlite-session-plan-status",statusSourceDisclosure:Es,path:r,ready:s.ready,missingDimensions:s.missingDimensions,coveredDimensions:s.coveredDimensions,skippedDimensions:s.skippedDimensions,readiness:s,readinessSource:o.readinessSource,readinessFreshness:o.readinessFreshness,...t.eforgeSessionId?{eforge_session:t.eforgeSessionId}:{},...a,sourceRefs:i.sourceRefs,lifecycle:i,lifecycleState:i.lifecycleState,partialReasons:i.partialReasons,itemRows:i.itemRows,linkRows:i.linkRows,failureEvidence:i.failureEvidence}}function jge(e){return{kind:"plan-set",key:`plan-set:${e.planSetId}`,...e}}function Bge(e,t){return{...e,session:e.session,topic:e.topic??e.session,status:e.status??"draft",body:t}}function Mge(e){let t=iC(e.readiness??{ready:e.ready===!0,missingDimensions:e.missingDimensions??[],coveredDimensions:e.coveredDimensions??[],skippedDimensions:e.skippedDimensions??[]});return vm({kind:"plan",key:`plan:${e.session}`,session:e.session,title:e.topic??e.session,topic:e.topic??e.session,status:e.status??"draft",statusSource:"markdown-compatibility-fallback",statusSourceDisclosure:r2,path:e.path,ready:t.ready,missingDimensions:t.missingDimensions,coveredDimensions:t.coveredDimensions,skippedDimensions:t.skippedDimensions,readiness:t,readinessSource:"markdown",readinessFreshness:{state:"missing"},createdAt:yo(e.createdAt),updatedAt:yo(e.updatedAt),readyAt:yo(e.readyAt),submittedAt:yo(e.submittedAt),sourceRefs:{sourceItemIds:[],sourceEpicIds:[]},lifecycleState:"none",partialReasons:[],itemRows:[],linkRows:[],failureEvidence:[]})}async function Uge(e,t){let i=Ve();try{return(await i.flat.list({cwd:e,includeSubmitted:t})).map(Mge)}catch{return[]}}async function Fge(e,t){let i=Ve();try{return(await i.planSets.list({cwd:e,includeSubmitted:t})).map(jge)}catch{return[]}}async function u2(e,t){return ft(e,i=>rC(i,t),()=>({session:t,sourceRefs:{sourceItemIds:[],sourceEpicIds:[]},lifecycleState:"none",state:"none",partialReasons:[],itemIds:[],itemRows:[],linkRows:[],associatedLinks:[],failureEvidence:[]}))}async function oC(e,t){let{sqlPlans:i,sqlSessions:r}=await ft(e,f=>({sqlPlans:AG(f,t.includeSubmitted),sqlSessions:new Set(OG(f).map(y=>y.session))}),()=>({sqlPlans:[],sqlSessions:new Set})),o=(await Uge(e,t.includeSubmitted)).filter(f=>!r.has(f.session)),s=await Fge(e,t.includeSubmitted),a=[...i.map(f=>({descriptorKind:"sql-plan",key:`plan:${f.session}`,session:f.session,updatedAt:f.updatedAt,plan:f})),...o.map(f=>({descriptorKind:"artifact",key:f.key,session:f.session,updatedAt:f.updatedAt,artifact:f})),...s.map(f=>({descriptorKind:"artifact",key:f.key,planSetId:f.planSetId,updatedAt:f.updatedAt,artifact:f}))];a.sort((f,g)=>(g.updatedAt??"").localeCompare(f.updatedAt??"")||(f.session??f.planSetId??"").localeCompare(g.session??g.planSetId??""));let c=Da(a,t,50,100),d=c.entries.filter(f=>f.descriptorKind==="sql-plan"),u=await ft(e,async f=>await Promise.all(d.map(async g=>[g.key,await Nge(e,g.plan,rC(f,g.session))])),()=>[]),l=new Map(u),p=c.entries.map(f=>f.descriptorKind==="sql-plan"?l.get(f.key):f.artifact).filter(f=>f!==void 0),m={artifacts:p,plans:p.filter(f=>f.kind==="plan"),planSets:p.filter(f=>f.kind==="plan-set"),total:c.total,limit:c.limit,offset:c.offset,pagination:Zd(c,c.total)};return t.includeBoard===!0&&(m.board=await qge(e,t)),m}async function qge(e,t){let i=sC(await Fa(e,{epic:t.epic,includeArchive:t.includeArchive})),r=i.lanes.some(o=>o.items.length>0)?i:await Im(e,{epic:t.epic,includeArchive:t.includeArchive});return t.includeArchive===!0?r:{...r,lanes:Array.isArray(r?.lanes)?r.lanes.filter(o=>o.lane!=="archive"):[]}}async function XI(e,t){let i=await ft(e,async u=>{let l=hI(u,t);if(!l)return;let p=rC(u,t),m=l.path??i2(".eforge","session-plans",`${t}.md`),f=o2(e,m),g="";try{g=await n2(f,"utf8")}catch{g=""}let y=await a2(e,l,f,g),R=s2(l,p),A={...Bge(l,g),...R};try{let D=await Ve().flat.load({cwd:e,session:t});A={...D.plan,session:l.session,topic:l.topic??D.plan.topic??l.session,status:l.status??D.plan.status??"draft",body:D.plan.body,sections:Q6(D.plan.sections),sourceRefs:p.sourceRefs,...R}}catch{}return{session:t,path:f,relativePath:X6(e,f).replace(/\\/g,"/"),body:g,plan:A,statusSource:"eforge-plan-sqlite-session-plan-status",statusSourceDisclosure:Es,lifecycle:p,sourceRefs:p.sourceRefs,sourceRefRows:p.sourceRefRows,readiness:y.readiness,readinessSource:y.readinessSource,readinessFreshness:y.readinessFreshness,...R}},()=>{});if(i)return i;let o=await Ve().flat.load({cwd:e,session:t}),s=o.path,a=o.plan,c=zge(a),d=await u2(e,t);return{session:t,path:_ge(s),relativePath:X6(e,s).replace(/\\/g,"/"),body:a.body,plan:{...a,sections:Q6(a.sections)},statusSource:"markdown-compatibility-fallback",statusSourceDisclosure:r2,lifecycle:d.itemRows.length>0?d:await Gge(e,t,c),sourceRefs:c,readiness:o.readiness,readinessSource:"markdown",readinessFreshness:{state:"missing"}}}function zge(e){let t=e.eforge_plan&&typeof e.eforge_plan=="object"?e.eforge_plan:{};return{sourceItemIds:t2(t.source_item_ids??t.source_item_id),sourceEpicIds:t2(t.source_epic_ids??t.source_epic_id),...typeof t.source_recommendation_ref=="string"?{recommendationRef:t.source_recommendation_ref}:{},...typeof t.promoted_at=="string"?{promotedAt:t.promoted_at}:{}}}async function Gge(e,t,i){let r=await Fa(e,{includeArchive:!0}),o=new Map((r.traceSummaries??[]).map(c=>[c.itemId,c])),s=i.sourceItemIds.map(c=>{let d=r.items.find(g=>g.id===c),u=o.get(c),l=d?.linkRows??u?.linkRows??[],p=d?.failureEvidence??u?.failureEvidence??[],m=!d?.lifecycleState&&!u?.lifecycleState,f=m?"none":d?.lifecycleState??u?.lifecycleState;return{itemId:c,title:d?.title??c,status:d?.status??"candidate",lifecycleState:f,unresolvedSourceRef:!d,missingLifecycleEvidence:m,linkRows:l,failureEvidence:p}}),a=c2(i.sourceItemIds,s);return{session:t,sourceRefs:i,sourceRefRows:[],lifecycleState:a.lifecycleState,state:a.lifecycleState,partialReasons:a.partialReasons,itemIds:i.sourceItemIds,itemRows:s,linkRows:s.flatMap(c=>c.linkRows),associatedLinks:s.flatMap(c=>c.linkRows),failureEvidence:s.flatMap(c=>c.failureEvidence)}}function t2(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):typeof e=="string"?[e]:[]}var l2={id:"list-board",title:"List eforge-plan board",description:"Read compatibility/debug rich backlog epics, items, kanban lanes, blocked reasons, recommendation status/summary, and lifecycle summaries for hosts that explicitly need the full board payload.",inputSchema:dp,outputSchema:ty,outputProfile:Pe.debugRich,sideEffects:["local-read"],async handler(e,t){return sC(await Fa(t.cwd,e,go(t.paths)))}},p2={id:"render-board-markdown",title:"Render eforge-plan board",description:"Render the derived kanban board as Markdown for hosts and Console, including recommendation freshness notes when available.",inputSchema:dp,outputSchema:CU,outputProfile:Pe.markdown,sideEffects:["local-read"],async handler(e,t){return{markdown:Kge(await Fa(t.cwd,e,go(t.paths)))}}};async function Fa(e,t,i){if(La(e))return Im(e,t);let r=i??So(e),[o,s,a,c,d]=await Promise.all([po(e),nn(e),Ri(e),km(r),nu(e,r)]),u=await xi(e,a),l=XG(c),p=ZG(s,u,{epic:t.epic,includeArchive:t.includeArchive,epics:o,recommendationIndex:l});return{epics:o,items:s,lanes:p.lanes,blockedReasons:p.items.filter(m=>m.unresolvedDependsOn.length>0).map(m=>({itemId:m.id,reasons:m.reasons})),traceSummaries:u,lifecycleLinks:[],epicProgress:[],recommendationSummary:Sn(c),recommendationStatus:d}}function sC(e){return C(e)}function Kge(e){if(Array.isArray(e.items)&&e.items.some(i=>i.lane!==void 0))return PT(e);let t=["# eforge-plan board",""];for(let i of e.lanes){t.push(`## ${i.title}`,""),i.items.length===0&&t.push("_No items._","");for(let r of i.items)t.push(`- **${r.id}** (${r.status}) ${r.title}${r.reasons?.length?` \u2014 ${r.reasons.join("; ")}`:""}`);t.push("")}return t.join(`
|
|
474
|
+
`)}var Vge=new Map([["claim","Claim"],["evidence","Evidence"],["acceptancecriteria","Acceptance Criteria"],["acceptance criteria","Acceptance Criteria"],["acceptance-criteria","Acceptance Criteria"],["acceptance_criteria","Acceptance Criteria"],["recheck","Recheck"],["notes","Notes"]]),Hge=new Set(["Claim","Evidence","Acceptance Criteria","Recheck","Notes"]);function g2(e){let t=e.trim();return Vge.get(t.replace(/\s+/gu," ").toLowerCase())??t}function S2(e,t){let i=t.title!==void 0?Wge(e,t.title):e;I2(t.title),f2(i),Zge(t.sections??{}),Jge(t.sectionOperations??[]);let r=[];for(let[o,s]of Object.entries(t.sections??{})){let a=ou(o);i=m2(i,{heading:a,action:"replace",content:s}),r.push(a)}for(let o of t.sectionOperations??[]){y2(o);let s=ou(o.heading);i=m2(i,{heading:s,action:o.action,content:o.content}),r.push(s)}return f2(i),{body:i,changedSections:eSe(r)}}function qa(e){let t=aC(e);return h2(t),t.map(i=>({sectionName:i.canonicalHeading,content:i.content.trim()}))}function Wge(e,t){I2(t);let i=cC(e),r=i.findIndex(s=>/^#\s+.+\s*\r?\n?$/u.test(s));if(r===-1)return`# ${t}
|
|
475
|
+
|
|
476
|
+
${e}`;let o=i[r].endsWith(`\r
|
|
477
|
+
`)?`\r
|
|
478
|
+
`:i[r].endsWith(`
|
|
479
|
+
`)?`
|
|
480
|
+
`:"";return i[r]=`# ${t}${o}`,i.join("")}function aC(e){let t=cC(e),i=[];for(let r=0;r<t.length;r+=1){let o=/^(#{2,6})\s+(.+?)\s*\r?\n?$/u.exec(t[r]);if(o){let s=o[2].trim();i.push({index:r,heading:s,canonicalHeading:g2(s)})}}return i.map((r,o)=>{let s=r.index,a=i[o+1]?.index??t.length;return{start:s,end:a,heading:r.heading,canonicalHeading:r.canonicalHeading,content:t.slice(s+1,a).join("")}})}function m2(e,t){let i=ou(t.heading),r=cC(e),s=aC(e).find(m=>m.canonicalHeading===i||!Yge(i)&&m.heading===i);if(!s)return Xge(e,i,t.content);let a=r.slice(0,s.start).join(""),c=r.slice(s.end).join(""),d=Qge(r[s.start],i),u=s.content.trim(),l=t.content.trim(),p=t.action==="replace"||u.length===0?l:`${u}
|
|
481
|
+
|
|
482
|
+
${l}`;return`${a}${d}
|
|
483
|
+
${p}
|
|
484
|
+
${c.startsWith(`
|
|
485
|
+
`)||c.length===0?"":`
|
|
486
|
+
`}${c}`}function Xge(e,t,i){return`${e.trimEnd()}
|
|
487
|
+
|
|
488
|
+
## ${t}
|
|
489
|
+
|
|
490
|
+
${i.trim()}
|
|
491
|
+
`}function Qge(e,t){let r=/^(#{2,6})/u.exec(e)?.[1]??"##",o=e.endsWith(`\r
|
|
492
|
+
`)?`\r
|
|
493
|
+
`:e.endsWith(`
|
|
494
|
+
`)?`
|
|
495
|
+
`:"";return`${r} ${t}${o}`}function ou(e){let t=g2(e);if(t.length===0||t.includes(`
|
|
496
|
+
`)||t.includes("\r")||t.startsWith("#"))throw new Error("Section heading must be non-empty, single-line, and must not begin with #.");return t}function y2(e){if(ou(e.heading),e.action!=="replace"&&e.action!=="append")throw new Error('Section operation action must be "replace" or "append".');if(typeof e.content!="string")throw new Error("Section operation content must be a string.")}function Zge(e){let t=new Set;for(let i of Object.keys(e)){let r=ou(i);if(t.has(r))throw new Error(`Duplicate section replacement for ${r}.`);t.add(r)}}function Jge(e){let t=new Set;for(let i of e){y2(i);let r=ou(i.heading);if(t.has(r))throw new Error(`Duplicate section operation for ${r}.`);t.add(r)}}function f2(e){h2(aC(e))}function h2(e){let t=new Set;for(let i of e){if(t.has(i.canonicalHeading))throw new Error(`Duplicate section ${i.canonicalHeading}.`);t.add(i.canonicalHeading)}}function I2(e){if(e!==void 0&&(e.trim().length===0||e.includes(`
|
|
497
|
+
`)||e.includes("\r")))throw new Error("Title must be a non-empty single-line backlog title.")}function Yge(e){return Hge.has(e)}function cC(e){let t=e.match(/.*(?:\r?\n|$)/gu)??[];return t.filter((i,r)=>i.length>0||r<t.length-1)}function eSe(e){let t=new Set;return e.filter(i=>t.has(i)?!1:(t.add(i),!0))}var _m=n.Object({id:n.String(),title:n.String(),status:Je,priority:n.String(),tags:n.Array(n.String()),lane:ro,reasons:n.Array(n.String()),dependsOn:n.Optional(n.Array(n.String())),unresolvedDependsOn:n.Optional(n.Array(n.String())),activeTraceReasons:n.Array(n.String()),blocked:n.Boolean(),ready:n.Boolean(),reviewDue:n.Boolean(),closed:n.Boolean(),hasBody:n.Optional(n.Boolean()),updatedAt:n.Optional(n.String()),epic:n.Optional(n.String()),lifecycleState:Er,userStatus:n.Optional(Je),effectiveLifecycle:n.Optional(Er),reasonCodes:n.Optional(n.Array(n.String())),associatedLinks:n.Optional(n.Array(n.Object({},{additionalProperties:n.Unknown()}))),planEligible:n.Boolean(),planEligibilityReasonCode:n.Optional(n.String()),planEligibilityReasonMessage:n.Optional(n.String()),planEligibilityLinks:n.Optional(n.Array(n.Object({},{additionalProperties:n.Unknown()})))},{additionalProperties:!1}),b2=n.Object({},{additionalProperties:n.Unknown()}),dC=n.Object({id:n.String(),title:n.String(),status:Je,userStatus:n.Optional(Je),priority:n.Optional(n.String()),tags:n.Array(n.String()),itemCount:n.Integer({minimum:0}),totalItems:n.Optional(n.Integer({minimum:0})),openItemCount:n.Integer({minimum:0}),hasBody:n.Boolean()},{additionalProperties:!1}),x2={limit:n.Optional(n.Integer({minimum:1,default:20})),offset:n.Optional(n.Integer({minimum:0,default:0}))},tSe=n.Object({id:n.String({minLength:1}),includeBody:n.Optional(n.Boolean()),includeEpic:n.Optional(n.Boolean()),includeSections:n.Optional(n.Boolean()),includeLifecycleRows:n.Optional(n.Boolean()),includeDependencies:n.Optional(n.Boolean()),includeDependents:n.Optional(n.Boolean())},{additionalProperties:!1}),nSe=n.Object({schemaVersion:n.Literal(1),item:n.Object({..._m.properties,path:n.String(),bodySha256:n.String(),recordSha256:n.String(),storage:n.Object({kind:n.String(),id:n.String()},{additionalProperties:!1}),sections:n.Optional(n.Record(n.String(),n.String())),linkRows:n.Optional(n.Array(b2)),failureEvidence:n.Optional(n.Array(b2)),body:n.Optional(n.String())},{additionalProperties:!1}),epic:n.Optional(dC),dependencies:n.Optional(n.Array(_m)),dependents:n.Optional(n.Array(_m))},{additionalProperties:!1}),iSe=n.Object({id:n.String({minLength:1}),includeBody:n.Optional(n.Boolean()),includeItems:n.Optional(n.Boolean()),includeSections:n.Optional(n.Boolean()),includeItemDependencies:n.Optional(n.Boolean()),...x2},{additionalProperties:!1}),rSe=n.Object({schemaVersion:n.Literal(1),epic:n.Object({...dC.properties,path:n.String(),sections:n.Optional(n.Record(n.String(),n.String())),body:n.Optional(n.String())},{additionalProperties:!1}),items:n.Array(_m),totalItems:n.Integer({minimum:0}),itemCount:n.Optional(n.Integer({minimum:0})),openItemCount:n.Optional(n.Integer({minimum:0})),limit:n.Integer({minimum:1}),offset:n.Integer({minimum:0})},{additionalProperties:!1}),oSe=n.Object({epic:n.Optional(n.String()),lane:n.Optional(ro),includeClosed:n.Optional(n.Boolean()),includeArchive:n.Optional(n.Boolean()),includeEpics:n.Optional(n.Boolean()),includeLaneCounts:n.Optional(n.Boolean()),includeDependencies:n.Optional(n.Boolean()),...x2},{additionalProperties:!1}),R2=n.Object({limit:n.Integer({minimum:1}),offset:n.Integer({minimum:0}),returned:n.Integer({minimum:0}),hasMore:n.Boolean(),nextOffset:n.Optional(n.Integer({minimum:0}))},{additionalProperties:!1}),sSe=n.Object({schemaVersion:n.Literal(1),items:n.Array(_m),total:n.Integer({minimum:0}),limit:n.Integer({minimum:1}),offset:n.Integer({minimum:0}),lanes:n.Optional(n.Array(n.Object({lane:ro,title:n.String(),count:n.Integer({minimum:0}),openCount:n.Integer({minimum:0}),closedCount:n.Integer({minimum:0}),pagination:n.Optional(R2)},{additionalProperties:!1}))),epics:n.Optional(n.Array(dC)),counts:n.Optional(n.Object({total:n.Integer({minimum:0}),open:n.Integer({minimum:0}),closed:n.Integer({minimum:0})},{additionalProperties:!1})),pagination:R2},{additionalProperties:!1}),E2=[{id:"get-item",title:"Get compact backlog item detail",description:"Read one backlog item without listing the whole board. Projection flags can omit or include the compact epic, Markdown sections, lifecycle rows, dependency/dependent summaries, and dependency id arrays on item summaries. Returns bodySha256/recordSha256 lock tokens for body-safe update-item calls.",inputSchema:tSe,outputSchema:nSe,outputProfile:Pe.agentCompact,sideEffects:["local-read"],async handler(e,t){return C(await aSe(t.cwd,e))}},{id:"get-epic",title:"Get compact backlog epic detail",description:"Read one backlog epic without returning board-wide payloads. Projection flags can omit or include Markdown sections, the paginated compact item list, and dependency id arrays on item summaries.",inputSchema:iSe,outputSchema:rSe,outputProfile:Pe.agentPaginated,sideEffects:["local-read"],async handler(e,t){return C(await dSe(t.cwd,e))}},{id:"list-board-compact",title:"List compact eforge-plan board",description:"Return bounded open-first kanban item summaries without full item bodies or rich board payloads. Projection flags can omit or include compact epic summaries, lane/count aggregates, and dependency id arrays on item summaries.",inputSchema:oSe,outputSchema:sSe,outputProfile:Pe.agentPaginated,sideEffects:["local-read"],async handler(e,t){return C(await pSe(t.cwd,e))}}];async function aSe(e,t){try{return await IT(e,t)}catch(i){if(!cSe(i,t.id))throw i;let r=await um(e,t.id);if(!r)throw i;let o=t.includeSections!==!1?Object.fromEntries(qa(r.body).map(a=>[a.sectionName,a.content??""])):void 0,s=r.record;return{schemaVersion:1,item:{id:s.id,title:s.title,status:s.status,userStatus:s.status,priority:s.priority??"normal",tags:s.tags??[],lane:s.status==="active"?"in-progress":s.status==="planned"?"ready":s.status==="shipped"?"done":s.status==="stale"||s.status==="superseded"?"archive":"inbox",reasons:[],reasonCodes:["candidate-no-evidence"],...t.includeDependencies===!1?{}:{dependsOn:s.depends_on??[],unresolvedDependsOn:s.depends_on??[]},activeTraceReasons:[],blocked:!1,ready:s.status==="planned",reviewDue:!1,closed:s.status==="shipped"||s.status==="stale"||s.status==="superseded",lifecycleState:"none",effectiveLifecycle:"none",planEligible:s.status!=="shipped"&&s.status!=="stale"&&s.status!=="superseded",updatedAt:s.updated,path:r.relativePath,bodySha256:r.bodySha256,recordSha256:r.recordSha256,storage:{kind:r.origin==="private"?"private-markdown":"legacy-markdown",id:s.id},...t.includeSections!==!1?{sections:o}:{},...t.includeLifecycleRows!==!1?{linkRows:[],failureEvidence:[]}:{},...t.includeBody?{body:r.body}:{}},...t.includeDependencies!==!1?{dependencies:[]}:{},...t.includeDependents!==!1?{dependents:[]}:{}}}}function cSe(e,t){return e instanceof Error&&e.message===`Backlog item "${t}" was not found.`}async function dSe(e,t){return bT(e,t)}var uSe=new Set(["planned-session-plan","submitted-session-plan","active-planning-task","queued-build","running-build","active-build-session","open-pr","shipped-result","merged-result","failed-result","partial-plan"]);function lSe(e,t){let r=(e.reasonCodes??e.reasons??[]).find(o=>uSe.has(o));return e.closed||e.blocked||["in-progress","done","archive","blocked"].includes(t)||r?{planEligible:!1,...r?{planEligibilityReasonCode:r,planEligibilityReasonMessage:`Item ${e.id} is covered by ${r}.`}:{}}:{planEligible:!0}}async function pSe(e,t){let i=await ET(e,t);if(i.items.length>0)return i;let o=(await Fa(e,{epic:t.epic,includeArchive:t.includeArchive})).items.filter(l=>(t.lane===void 0||l.lane===t.lane)&&(t.includeClosed===!0||!l.closed)),s=Math.min(Math.max(t.limit??20,1),100),a=Math.max(t.offset??0,0),c=o.slice(a,a+s).map(l=>{let p=l.lane??(l.status==="candidate"?"inbox":l.status==="active"?"in-progress":l.status==="planned"?"ready":l.status==="shipped"?"done":"inbox"),m=lSe(l,p);return{id:l.id,title:l.title,status:l.status,priority:l.priority??"medium",tags:l.tags??[],lane:p,reasons:l.reasons??[],dependsOn:l.dependsOn??[],unresolvedDependsOn:l.unresolvedDependsOn??[],activeTraceReasons:l.activeTraceReasons??[],blocked:l.blocked??!1,ready:l.ready??!1,reviewDue:l.reviewDue??!1,closed:l.closed??!1,epic:l.epic,lifecycleState:["none","planned","active","queue","build","pr-open","merged","shipped","failed","partial"].includes(l.lifecycleState)?l.lifecycleState:"none",...l.planEligible===void 0?m:{planEligible:l.planEligible,planEligibilityReasonCode:l.planEligibilityReasonCode,planEligibilityReasonMessage:l.planEligibilityReasonMessage,planEligibilityLinks:l.planEligibilityLinks}}}),d={limit:s,offset:a,returned:c.length,hasMore:a+c.length<o.length,...a+c.length<o.length?{nextOffset:a+c.length}:{}},u=["inbox","ready","blocked","in-progress","done","archive"].map(l=>({lane:l,title:l,count:o.filter(p=>p.lane===l).length,openCount:o.filter(p=>p.lane===l&&!p.closed).length,closedCount:o.filter(p=>p.lane===l&&p.closed).length,...t.lane===l?{pagination:d}:{}}));return{schemaVersion:1,items:c,total:o.length,limit:s,offset:a,lanes:u,counts:{total:o.length,open:o.filter(l=>!l.closed).length,closed:o.filter(l=>l.closed).length},pagination:d}}var mSe=/[\p{L}\p{N}_]+/gu,P2=["title","tags_text","item_ids_text","epic_ids_text","recommendation_refs_text"],fSe=["summary_text","body_text"];function k2(e){let t=(e??"").normalize("NFKC").toLowerCase();return Array.from(t.matchAll(mSe),i=>i[0]).filter(i=>i.length>0).slice(0,24)}function gSe(e){return`"${e.replace(/"/g,'""')}"`}function QI(e,t={}){let i=k2(e);if(i.length===0)return{empty:!0,expression:"",tokens:i};let o=`{${(t.searchBody===!0?[...P2,...fSe]:P2).join(" ")}}`;return{empty:!1,expression:i.map(s=>`${o} : ${gSe(s)}`).join(" AND "),tokens:i}}import{createHash as SSe}from"crypto";function _t(e){return e.flatMap(t=>Array.isArray(t)?t.map(String):t==null?[]:[typeof t=="string"?t:JSON.stringify(t)]).join(`
|
|
498
|
+
`).replace(/\s+/g," ").trim()}function ZI(e){return SSe("sha256").update(JSON.stringify(e)).digest("hex")}function v2(e){return _t(e.map(t=>`${t.name}
|
|
499
|
+
${t.content}`))}function _2(e){let t={...e};return{documentType:"backlog_item",documentId:e.id,title:e.title,tagsText:_t([...e.tags,e.priority,e.userStatus]),summaryText:_t([e.id,e.epicId,e.epicRef,e.dependencies]),bodyText:_t([e.body,v2(e.sections)]),itemIdsText:_t([e.id]),epicIdsText:_t([e.epicId,e.epicRef]),sourceSha256:ZI(t),updatedAt:e.updatedAt,dirty:!1}}function A2(e){let t={...e};return{documentType:"epic",documentId:e.id,title:e.title,tagsText:_t([...e.tags,e.priority,e.userStatus]),summaryText:_t([e.id,e.itemIds]),bodyText:_t([e.body,v2(e.sections)]),itemIdsText:_t(e.itemIds),epicIdsText:_t([e.id]),sourceSha256:ZI(t),updatedAt:e.updatedAt,dirty:!1}}function O2(e){let t={...e};return{documentType:"session_plan",documentId:e.session,title:e.topic??e.session,tagsText:_t([e.status,e.planningType,e.planningDepth,e.profile]),summaryText:_t([e.session,e.path,e.summaryText,e.readinessSummary]),bodyText:"",itemIdsText:_t(e.itemIds),epicIdsText:_t(e.epicIds),recommendationRefsText:_t(e.recommendationRefs),sourceSha256:ZI(t),updatedAt:e.updatedAt,dirty:!1}}function w2(e){let t={...e};return{documentType:"recommendation",documentId:e.laneId,title:e.title??e.laneRef??e.laneKind,tagsText:_t([e.laneKind,e.profile,e.laneRef]),summaryText:_t([e.runId,e.laneId,e.rationale,e.itemRationales,e.runSummary]),bodyText:"",itemIdsText:_t([...e.itemRefs,...e.itemIds]),recommendationRefsText:_t(e.recommendationRefs),sourceSha256:ZI(t),updatedAt:e.updatedAt,dirty:!1}}function uC(e,t={}){let i=t.types??(t.records?Array.from(new Set(t.records.map(o=>o.type))):["backlog_item","epic","session_plan","recommendation"]),r=o=>t.records?.filter(s=>s.type===o).map(s=>s.id);return[...i.includes("backlog_item")?uG(e,r("backlog_item")).map(_2):[],...i.includes("epic")?lG(e,r("epic")).map(A2):[],...i.includes("session_plan")?pG(e,r("session_plan")).map(O2):[],...i.includes("recommendation")?mG(e,r("recommendation"),t.includeHistoricalRecommendations??!0).map(w2):[]]}var ySe=["backlog_item","epic","session_plan","recommendation"];function T2(){return new Date().toISOString()}function hSe(e){return e?.types??Array.from(new Set(e?.records?.map(t=>t.type)??ySe))}function lC(e){return Aa(e)}function Am(e,t={}){let i=T2();if(t.types&&t.types.length===0)return{refreshed:0,deleted:0,clearedDirty:0,types:[],rebuiltAt:lI(e).lastRebuiltAt??i};let r=hSe(t),o=uC(e,{types:r}),s=t.types===void 0,a=cG(e,s?void 0:r),c=0,d=0;return e.transaction(()=>{for(let u of r)c+=$w(e,u,fG(e,u));Lw(e,o),s?(Cw(e,{rebuiltAt:i}),d=a):d=aG(e,r)}),{refreshed:o.length,deleted:c,clearedDirty:d,types:r,rebuiltAt:lI(e).lastRebuiltAt??i}}function pC(e){return Nw(e),{optimizedAt:T2(),ok:!0}}var JI=n.Union([n.Literal("backlog_item"),n.Literal("epic"),n.Literal("session_plan"),n.Literal("recommendation")]),ISe=n.Union([n.Literal("rank"),n.Literal("snippet"),n.Literal("refs"),n.Literal("updatedAt")]),mC=n.Object({text:n.String(),field:n.Optional(n.Union([n.Literal("title"),n.Literal("tags"),n.Literal("summary"),n.Literal("body"),n.Literal("itemIds"),n.Literal("epicIds"),n.Literal("recommendationRefs")])),highlights:n.Array(n.String())},{additionalProperties:!1}),YI=n.Object({dirty:n.Boolean(),dirtyCount:n.Integer({minimum:0}),dirtyTypes:n.Array(JI),dirtySince:n.Optional(n.String()),dirtyReason:n.Optional(n.String()),lastRebuiltAt:n.Optional(n.String())},{additionalProperties:!1}),C2=n.Object({limit:n.Integer({minimum:1}),offset:n.Integer({minimum:0}),returned:n.Integer({minimum:0}),hasMore:n.Boolean(),nextOffset:n.Optional(n.Integer({minimum:0}))},{additionalProperties:!1}),bSe=n.Object({id:n.String(),title:n.String(),status:Je,priority:n.String(),tags:n.Array(n.String()),lane:ro,reasons:n.Array(n.String()),dependsOn:n.Optional(n.Array(n.String())),unresolvedDependsOn:n.Optional(n.Array(n.String())),activeTraceReasons:n.Array(n.String()),blocked:n.Boolean(),ready:n.Boolean(),reviewDue:n.Boolean(),closed:n.Boolean(),hasBody:n.Optional(n.Boolean()),updatedAt:n.Optional(n.String()),epic:n.Optional(n.String()),lifecycleState:n.String(),userStatus:n.Optional(Je),effectiveLifecycle:n.Optional(n.String()),reasonCodes:n.Optional(n.Array(n.String())),associatedLinks:n.Optional(n.Array(n.Object({},{additionalProperties:n.Unknown()}))),planEligible:n.Boolean(),planEligibilityReasonCode:n.Optional(n.String()),planEligibilityReasonMessage:n.Optional(n.String()),planEligibilityLinks:n.Optional(n.Array(n.Object({},{additionalProperties:n.Unknown()}))),rank:n.Optional(n.Number()),snippet:n.Optional(mC),matchedFields:n.Optional(n.Array(n.String()))},{additionalProperties:!1}),RSe=n.Object({id:n.String(),title:n.String(),status:Je,userStatus:n.Optional(Je),priority:n.Optional(n.String()),tags:n.Array(n.String()),itemCount:n.Integer({minimum:0}),totalItems:n.Optional(n.Integer({minimum:0})),openItemCount:n.Integer({minimum:0}),hasBody:n.Boolean()},{additionalProperties:!1}),L2={limit:n.Optional(n.Integer({minimum:1})),offset:n.Optional(n.Integer({minimum:0}))},D2=n.String({maxLength:500}),Om=n.String({minLength:1,maxLength:200,pattern:"\\S"}),xSe=n.String({minLength:1,maxLength:100,pattern:"\\S"}),$2=n.Object({query:n.Optional(D2),epic:n.Optional(Om),status:n.Optional(Je),lane:n.Optional(ro),tags:n.Optional(n.Array(xSe,{minItems:1,maxItems:50,uniqueItems:!0})),includeArchive:n.Optional(n.Boolean()),searchBody:n.Optional(n.Boolean()),includeEpics:n.Optional(n.Boolean()),includeDependencies:n.Optional(n.Boolean()),...L2},{additionalProperties:!1}),N2=n.Object({schemaVersion:n.Literal(1),items:n.Array(bSe),epics:n.Optional(n.Array(RSe)),total:n.Integer({minimum:0}),limit:n.Integer({minimum:1}),offset:n.Integer({minimum:0}),snippets:n.Optional(n.Record(n.String(),mC)),counts:n.Optional(n.Object({total:n.Integer({minimum:0})},{additionalProperties:!1})),pagination:C2,indexDirty:n.Boolean(),indexStatus:YI},{additionalProperties:!1}),j2=n.Object({query:n.Optional(D2),types:n.Optional(n.Array(JI,{minItems:1,maxItems:4,uniqueItems:!0})),itemIds:n.Optional(n.Array(Om,{minItems:1,maxItems:100,uniqueItems:!0})),epicIds:n.Optional(n.Array(Om,{minItems:1,maxItems:100,uniqueItems:!0})),sessions:n.Optional(n.Array(Om,{minItems:1,maxItems:100,uniqueItems:!0})),recommendationRefs:n.Optional(n.Array(Om,{minItems:1,maxItems:100,uniqueItems:!0})),includeHistoricalRecommendations:n.Optional(n.Boolean()),fields:n.Optional(n.Array(ISe,{minItems:1,maxItems:4,uniqueItems:!0})),...L2},{additionalProperties:!1}),ESe=n.Object({type:JI,id:n.String(),title:n.String(),rank:n.Optional(n.Number()),snippet:n.Optional(mC),refs:n.Optional(n.Object({itemIds:n.Optional(n.Array(n.String())),epicIds:n.Optional(n.Array(n.String())),session:n.Optional(n.String()),recommendationRef:n.Optional(n.String()),runId:n.Optional(n.String())},{additionalProperties:!1})),updatedAt:n.Optional(n.String())},{additionalProperties:!1}),B2=n.Object({schemaVersion:n.Literal(1),results:n.Array(ESe),total:n.Integer({minimum:0}),countsByType:n.Partial(n.Record(JI,n.Integer({minimum:0}))),page:C2,indexDirty:n.Boolean(),indexStatus:YI},{additionalProperties:!1});function wm(e){return{limit:Math.min(Math.max(Math.trunc(e?.limit??20),1),100),offset:Math.max(Math.trunc(e?.offset??0),0)}}function za(e,t,i,r){let o=t+i;return{limit:e,offset:t,returned:i,hasMore:o<r,...o<r?{nextOffset:o}:{}}}function M2(){return{dirty:!1,dirtyCount:0,dirtyTypes:[]}}function PSe(e){return e===void 0||e.trim().length===0}function U2(e){if(e.epic!==void 0&&e.epic.trim().length===0)throw new Error('search filter "epic" must not be empty');for(let t of["tags","types","itemIds","epicIds","sessions","recommendationRefs","fields"])if(e[t]?.some(r=>r.trim().length===0))throw new Error(`search filter "${t}" must not contain empty strings`)}function F2(e){if(!e.snippet||!e.snippet.includes("<mark>"))return;let t=Array.from(e.snippet.matchAll(/<mark>(.*?)<\/mark>/g),i=>i[1]).filter(Boolean);return{text:e.snippet,highlights:t}}function kSe(e,t){if(!t)return e;let i=new Set(t);return{type:e.type,id:e.id,title:e.title,...i.has("rank")&&e.rank!==void 0?{rank:e.rank}:{},...i.has("snippet")&&e.snippet?{snippet:e.snippet}:{},...i.has("refs")&&e.refs?{refs:e.refs}:{},...i.has("updatedAt")&&e.updatedAt?{updatedAt:e.updatedAt}:{}}}async function q2(e,t){return U2(t),ft(e,i=>{let r=Aa(i),o=QI(t.query,{searchBody:t.searchBody===!0});if(o.empty&&!PSe(t.query)){let p=wm(t);return{schemaVersion:1,items:[],total:0,limit:p.limit,offset:p.offset,counts:{total:0},pagination:za(p.limit,p.offset,0,0),indexDirty:r.dirty,indexStatus:r}}let s=o.empty?[]:pI(i,{match:o.expression,types:["backlog_item"],limit:1e3,offset:0}),a=new Map(s.map(p=>[p.documentId,p])),c=RT(i,{ids:o.empty?void 0:s.map(p=>p.documentId),includeArchive:t.includeArchive,epic:t.epic,status:t.status,lane:t.lane,tags:t.tags,includeDependencies:t.includeDependencies,includeLinks:!0,limit:t.limit,offset:t.offset}),d=c.items.map(p=>{let m=a.get(p.id),f=m?F2(m):void 0;return{...p,...m?.rank!==void 0?{rank:m.rank}:{},...f?{snippet:f,matchedFields:["text"]}:{}}}),u=Object.fromEntries(d.map(p=>[p.id,p.snippet]).filter(p=>p[1]!==void 0)),l=za(c.limit,c.offset,d.length,c.total);return{schemaVersion:1,items:d,...t.includeEpics===!0?{epics:Yd(i).filter(p=>d.some(m=>m.epic===p.id))}:{},total:c.total,limit:c.limit,offset:c.offset,...Object.keys(u).length?{snippets:u}:{},counts:{total:c.total},pagination:l,indexDirty:r.dirty,indexStatus:r}},()=>{let i=wm(t);return{schemaVersion:1,items:[],total:0,limit:i.limit,offset:i.offset,counts:{total:0},pagination:za(i.limit,i.offset,0,0),indexDirty:!1,indexStatus:M2()}})}async function z2(e,t){return U2(t),ft(e,i=>{let r=wm(t),o=QI(t.query,{searchBody:!0});if(o.empty){let l=Aa(i);return{schemaVersion:1,results:[],total:0,countsByType:{},page:za(r.limit,r.offset,0,0),indexDirty:l.dirty,indexStatus:l}}let s={match:o.expression,types:t.types,itemIds:t.itemIds,epicIds:t.epicIds,sessions:t.sessions,recommendationRefs:t.recommendationRefs,includeHistoricalRecommendations:t.includeHistoricalRecommendations,limit:r.limit,offset:r.offset},a=Aa(i),c=Uw(i,s),d=Fw(i,s),u=pI(i,s).map(l=>kSe({type:l.documentType,id:l.documentId,title:l.title,rank:l.rank,snippet:F2(l),refs:qw(l),updatedAt:l.updatedAt},t.fields));return{schemaVersion:1,results:u,total:c,countsByType:d,page:za(r.limit,r.offset,u.length,c),indexDirty:a.dirty,indexStatus:a}},()=>{let i=wm(t);return{schemaVersion:1,results:[],total:0,countsByType:{},page:za(i.limit,i.offset,0,0),indexDirty:!1,indexStatus:M2()}})}var G2={id:"search-items",title:"Search compact backlog items",description:"Search SQL/FTS-backed compact backlog item summaries with ranked snippets, counts, filters, pagination, and explicit stale-index metadata.",inputSchema:$2,outputSchema:N2,outputProfile:Pe.agentPaginated,sideEffects:["local-read"],async handler(e,t){return C(await q2(t.cwd,e))}},K2={id:"search-planning-records",title:"Search planning records",description:"Search SQL/FTS-backed backlog items, epics, session-plan summaries, and recommendation text with bounded ranked output.",inputSchema:j2,outputSchema:B2,outputProfile:Pe.agentPaginated,sideEffects:["local-read"],async handler(e,t){return C(await z2(t.cwd,e))}},fC=[G2,K2];import{readFile as DSe}from"fs/promises";import{isAbsolute as J2,relative as $Se,resolve as Y2}from"path";function H2(e,t,i=[]){Te(e,r=>vSe(r,t,i))}function vSe(e,t,i=[]){let r=He(Ae(t,"type"))??"unknown",o=He(Ae(t,"timestamp"))??lt(),s=He(Ae(t,"session")),a=He(Ae(t,"runId")),c=He(Ae(t,"buildSessionId"))??(r.startsWith("session:")?He(Ae(t,"sessionId")):void 0),d=He(Ae(t,"prdId"))??(r==="enqueue:complete"?He(Ae(t,"id")):void 0),u=TSe(t),l=i.length>0?i:CSe(t),p=He(Ae(t,"eventKey"))??`${r}:${Oa([r,o,s,a,c,d,u,l])}`;Ew(e,{eventKey:p,eventType:r,timestamp:o,session:s,runId:a,buildSessionId:c,queuePrdId:d,landingId:u,affectedItemRefs:l,payload:V2(t),payloadPrunable:!0}),d&&Yp(e,{prdId:d,session:s,sourcePath:He(Ae(t,"filePath"))??He(Ae(t,"path")),status:Tm(t,"queued"),updatedAt:o,submittedAt:r==="enqueue:complete"?o:void 0}),a&&Pw(e,{runId:a,session:s,queuePrdId:d,buildSessionId:c,status:Tm(t,"running"),startedAt:r.includes(":start")?o:void 0,finishedAt:LSe(r)?o:void 0}),c&&kw(e,{buildSessionId:c,session:s,status:Tm(t,"running"),startedAt:r==="session:start"?o:void 0,finishedAt:r==="session:end"?o:void 0}),u&&vw(e,{landingId:u,session:s,queuePrdId:d,runId:a,buildSessionId:c,status:W2(t),prUrl:He(Ae(t,"prUrl")),featureBranch:He(Ae(t,"featureBranch")),commitSha:He(Ae(t,"commitSha")),completedAt:o});let m=_Se(t),f=m==="failed"||m==="merged"||m==="shipped";for(let g of l){let y=Nt(e,g);wSe(e,g,m,o),Kd(e,{evidenceKey:`${p}:${g}:${m}`,itemRef:g,itemId:y?.id,session:s,queuePrdId:d,runId:a,buildSessionId:c,landingId:u,sourceEventKey:p,lifecycleState:m,reasonCode:ASe(m),evidenceKind:"event",status:Tm(t,m),isCurrent:!0,isTerminal:f,occurredAt:o,summary:OSe(t),links:V2({session:s,queuePrdId:d,runId:a,buildSessionId:c,landingId:u,prUrl:He(Ae(t,"prUrl"))})}),m==="shipped"&&y&&Xp(e,{...y,userStatus:"shipped",updatedAt:o})}wa(e,l.map(g=>({documentType:"backlog_item",documentId:g,reason:"lifecycle-event"})))}function _Se(e){let t=He(Ae(e,"type"))??"";return t==="enqueue:complete"||t.startsWith("queue:")?"queued":t.startsWith("session:")?t==="session:end"&&Tm(e,"")==="failed"?"failed":"build":t==="landing:auto-merge:complete"||t==="landing:complete"&&Ae(e,"action")==="merge"?"shipped":t==="landing:complete"&&W2(e)==="pr-open"?"pr-open":t.includes("fail")?"failed":"active"}function ASe(e){return e==="build"?"active-build":e==="pr-open"?"pr-open":e==="queued"?"queued-build":e==="shipped"?"shipped":e}function W2(e){return He(Ae(e,"prUrl"))&&Ae(e,"action")==="pr"?"pr-open":Ae(e,"action")==="merge"?"merged":"complete"}function Tm(e,t){return He(Ae(Ae(e,"result"),"status"))??He(Ae(e,"status"))??He(Ae(e,"action"))??t}function OSe(e){return He(Ae(Ae(e,"result"),"summary"))}function wSe(e,t,i,r){re(e).prepare("UPDATE lifecycle_evidence SET is_current = 0, superseded_at = ? WHERE is_current = 1 AND item_ref = ? AND lifecycle_state = ?").run(r,t,i),(i==="failed"||i==="merged"||i==="shipped")&&re(e).prepare("UPDATE lifecycle_evidence SET is_current = 0, superseded_at = ? WHERE is_current = 1 AND item_ref = ? AND lifecycle_state IN ('submitted','queued','build','pr-open')").run(r,t)}function TSe(e){let t=He(Ae(e,"prUrl")),i=He(Ae(e,"featureBranch")),r=He(Ae(e,"commitSha"));return t??i??r?`landing-${Oa([t,i,r])}`:void 0}function CSe(e){let t=He(Ae(e,"source"));if(t?.startsWith("eforge://input/eforge-plan/"))return[decodeURIComponent(t.slice(27))];let i=He(Ae(e,"itemId"));return i?[i]:[]}function LSe(e){return e.endsWith(":end")||e.endsWith(":complete")||e.includes("fail")}function Ae(e,t){return e&&typeof e=="object"?e[t]:void 0}function He(e){return typeof e=="string"&&e.length>0?e:void 0}function V2(e){return JSON.parse(JSON.stringify(e??{},(t,i)=>i===void 0?void 0:i))}function NSe(e,t,i){let r=tH(e,i),o=t.filter(a=>BSe(a,r));if(o.length===1)return{kind:"single",itemId:o[0].itemId,reason:"matched trace evidence"};if(o.length>1&&MSe(o,r))return{kind:"multi",itemIds:o.map(a=>a.itemId),reason:"matched shared promoted plan trace evidence"};if(o.length>1)return{kind:"ambiguous",reason:`matched ${o.length} trace sidecars`};let s=KSe(e);return s?{kind:"single",itemId:s,reason:"matched eforge-plan input source item id"}:{kind:"none",reason:"no matching trace evidence"}}function jSe(e,t,i){let r=NSe(e,t,i),o=r.kind==="single"||r.kind==="multi"?iH(e):void 0,s=r.kind==="single"||r.kind==="multi"?qSe(e):void 0;return{correlation:r,trace:o,status:s}}async function eH(e,t,i={}){let r=await Ri(e),o=jSe(t,r,e),s=o.correlation.kind==="single"?[o.correlation.itemId].filter(u=>u!==void 0):o.correlation.kind==="multi"?o.correlation.itemIds??[]:[],a;if(s.length===0&&o.correlation.kind==="none"&&(s=USe(e,t)),s.length===0&&o.correlation.kind==="none"&&(a=await HSe(e,t),s=a?.itemIds??[]),s.length===0)return o;let c=o.trace??(a?iH(t):void 0);i.mutateLegacyTraces!==!1&&await FSe(e,s,c,o.status),H2(e,t,s);let d=o.correlation.kind==="none"&&a?a.itemIds.length===1?{kind:"single",itemId:a.itemIds[0],reason:"bootstrapped from queued eforge-plan PRD"}:{kind:"multi",itemIds:a.itemIds,reason:"bootstrapped from queued eforge-plan PRD source items"}:o.correlation;if(s.length>0){let u=ot(Ce(t,"type"))??"unknown";await HI(e,{eventType:u,itemIds:s,correlationKind:a?"bootstrapped":d.kind==="multi"?"multi":"single",timestamp:rH(t),summary:VSe(u,s,a?"bootstrapped":d.kind==="multi"?"multi":"single",Q2(t)),refs:Q2(t)})}return o.correlation.kind==="none"&&a?{...o,correlation:d,trace:c}:o}function tH(e,t){let i=new Set;for(let o of["source","filePath","path","prdId","id","sessionId","runId","featureBranch","commitSha"])Z2(i,Ce(e,o),t);let r=ot(Ce(e,"source"));return r?.startsWith("eforge://input/eforge-plan/")&&Z2(i,decodeURIComponent(r.slice(27)),t),i}function BSe(e,t){return t.has(e.itemId)?!0:nH(e,t)||su(t,[e.lastEvent?.sessionId,e.lastEvent?.runId,e.lastEvent?.source,e.lastEvent?.filePath,e.lastEvent?.path,e.lastEvent?.id])}function MSe(e,t){return e.every(i=>nH(i,t))}function nH(e,t){return e.promotedSessionPlans.some(i=>su(t,[i.session,i.path]))||e.queuePrds.some(i=>su(t,[i.prdId,i.path]))||e.buildRuns.some(i=>su(t,[i.runId,i.sessionId]))||e.buildSessions.some(i=>su(t,[i.sessionId,i.runId]))||e.landingResults.some(i=>su(t,[i.featureBranch,i.commitSha]))}function USe(e,t){let i=[...tH(t,e)];return i.length===0?[]:Te(e,r=>{let o=re(r),s=new Set;for(let a of i){let c=o.prepare("SELECT DISTINCT spi.item_ref FROM session_plan_items spi JOIN session_plans sp ON sp.session = spi.session LEFT JOIN queue_prds qp ON qp.session = sp.session LEFT JOIN build_runs br ON br.queue_prd_id = qp.prd_id OR br.session = sp.session LEFT JOIN build_sessions bs ON bs.session = sp.session LEFT JOIN landing_links ll ON ll.session = sp.session WHERE sp.session = ? OR sp.path = ? OR qp.prd_id = ? OR qp.source_path = ? OR br.run_id = ? OR bs.build_session_id = ? OR ll.landing_id = ? OR ll.pr_url = ? OR ll.feature_branch = ? OR ll.commit_sha = ?").all(a,a,a,a,a,a,a,a,a,a);for(let d of c)typeof d.item_ref=="string"&&s.add(d.item_ref)}return[...s]})}function iH(e){let t=ot(Ce(e,"type")),i=rH(e);if(t==="enqueue:complete"){let r=ot(Ce(e,"id"));return r?{kind:"queue-prd",prdId:r,path:ot(Ce(e,"filePath")),status:"queued",queuedAt:i}:void 0}if(t==="queue:prd:start"||t==="queue:prd:complete"){let r=ot(Ce(e,"prdId"));return r?{kind:"queue-prd",prdId:r,status:t==="queue:prd:start"?"running":ot(Ce(e,"status"))??"completed",queuedAt:i}:void 0}if(t==="session:start"||t==="session:end"){let r=ot(Ce(e,"sessionId")),o=ot(Ce(e,"runId"));return r?{kind:"build-session",sessionId:r,runId:o,status:t==="session:start"?"running":GSe(e),startedAt:t==="session:start"?i:void 0,completedAt:t==="session:end"?i:void 0}:void 0}if(t==="landing:complete")return X2(ot(Ce(e,"featureBranch")),ot(Ce(e,"commitSha")),zSe(e),i,ot(Ce(e,"prUrl")));if(t==="landing:auto-merge:complete")return X2(ot(Ce(e,"featureBranch")),ot(Ce(e,"commitSha")),"auto-merged",i,ot(Ce(e,"prUrl")))}async function FSe(e,t,i,r){await Promise.all(t.map(async o=>{if(r!==void 0&&await OI(e,o,{status:r}),i===void 0)return;let s=await Xd(e,o);if(s!==null){if(i.kind==="queue-prd"&&(s.queuePrds=[...s.queuePrds.filter(a=>a.prdId!==i.prdId),i]),i.kind==="build-run"&&(s.buildRuns=[...s.buildRuns.filter(a=>a.runId!==i.runId),i]),i.kind==="build-session"&&(s.buildSessions=[...s.buildSessions.filter(a=>a.sessionId!==i.sessionId),i]),i.kind==="landing"){let{kind:a,...c}=i;s.landingResults=[...s.landingResults.filter(d=>(c.featureBranch===void 0||d.featureBranch!==c.featureBranch)&&(c.commitSha===void 0||d.commitSha!==c.commitSha)),c]}await Qd(e,s)}}))}function X2(e,t,i,r,o){if(e)return{kind:"landing",featureBranch:e,commitSha:t,status:i,landedAt:r,prUrl:o};if(t)return{kind:"landing",commitSha:t,status:i,landedAt:r,prUrl:o}}function qSe(e){let t=ot(Ce(e,"type"));if(t==="landing:auto-merge:complete"||t==="landing:complete"&&Ce(e,"action")==="merge"&&ot(Ce(e,"commitSha")))return"shipped"}function zSe(e){return ot(Ce(e,"prUrl"))&&Ce(e,"action")==="pr"?"pr-open":Ce(e,"action")==="merge"&&ot(Ce(e,"commitSha"))?"merged":String(Ce(e,"action")??"complete")}function GSe(e){let t=Ce(e,"result");return t&&typeof t=="object"&&"status"in t?String(t.status??"completed"):"completed"}function KSe(e){let t=ot(Ce(e,"source"));if(t?.startsWith("eforge://input/eforge-plan/"))return decodeURIComponent(t.slice(27))}function Q2(e){return["source","filePath","path","prdId","id","sessionId","runId","featureBranch","commitSha"].map(t=>ot(Ce(e,t))).filter(t=>t!==void 0)}function VSe(e,t,i,r){let o=r.length>0?`; refs: ${r.slice(0,5).join(", ")}`:"";return`Recommendations are stale after ${i} lifecycle update ${e} for ${t.join(", ")}${o}.`.slice(0,500)}async function HSe(e,t){if(Ce(t,"type")!=="enqueue:complete")return;let i=ot(Ce(t,"filePath"));if(i)try{let r=await DSe(J2(i)?i:Y2(e,i),"utf-8"),o=WSe(r);if(o.length===0)return;let s=(await Promise.all(o.map(a=>ii(e,a)))).filter(a=>a!==null);return s.length>0?{itemIds:s.map(a=>a.id),epicIdsByItemId:new Map(s.map(a=>[a.id,a.epic]))}:void 0}catch{return}}function WSe(e){let t=dm(e).frontmatter.eforge_plan;if(t&&typeof t=="object"){let r=t.source_item_ids;if(Array.isArray(r))return r.filter(s=>typeof s=="string"&&s.length>0);let o=t.source_item_id;if(typeof o=="string"&&o.length>0)return[o]}let i=XSe(e,/Backlog item id:\s*([^\s]+)/i);return i?[i]:[]}function XSe(e,t){return e.match(t)?.[1]}function rH(e){return ot(Ce(e,"timestamp"))??new Date().toISOString()}function su(e,t){return t.some(i=>i!==void 0&&e.has(i))}function Z2(e,t,i){let r=ot(t);r&&QSe(e,r,i)}function QSe(e,t,i){if(e.add(t),e.add(t.replace(/\\/g,"/")),!i||t.includes("://"))return;let r=J2(t)?t:Y2(i,t),o=$Se(i,r);e.add(r),e.add(r.replace(/\\/g,"/")),e.add(o),e.add(o.replace(/\\/g,"/"))}function Ce(e,t){return e[t]}function ot(e){return typeof e=="string"&&e.length>0?e:void 0}async function oH(e,t,i={}){let r=i.timestamp??lt(),o=Te(e,a=>ZSe(a,t,r));if(o.affectedItemRefs.length===0)return o;let s=await HI(e,{eventType:"queue:prd:removed",itemIds:o.affectedItemRefs,correlationKind:o.affectedItemRefs.length>1?"multi":"single",timestamp:r,summary:`Recommendations are stale after queue PRD removal ${t} for ${o.affectedItemRefs.join(", ")}.`,refs:[t]});return{...o,markedRecommendationStale:s!==null}}function ZSe(e,t,i=lt()){let r=re(e),o=r.prepare("SELECT prd_id, session, status FROM queue_prds WHERE prd_id = ?").all(t),s=new Set(o.map(f=>gt(f.session)).filter(f=>f!==void 0)),a=new Set;for(let f of s)for(let g of JSe(e,f))a.add(g);let c=r.prepare(`SELECT * FROM lifecycle_evidence WHERE is_current = 1 AND (
|
|
500
|
+
queue_prd_id = ?
|
|
501
|
+
OR run_id IN (SELECT run_id FROM build_runs WHERE queue_prd_id = ?)
|
|
502
|
+
OR build_session_id IN (SELECT build_session_id FROM build_runs WHERE queue_prd_id = ? AND build_session_id IS NOT NULL)
|
|
503
|
+
OR (links_json IS NOT NULL AND json_valid(links_json) AND EXISTS (
|
|
504
|
+
SELECT 1 FROM json_tree(lifecycle_evidence.links_json)
|
|
505
|
+
WHERE json_tree.value = ? AND json_tree.key IN ('queuePrdId', 'prdId', 'id')
|
|
506
|
+
))
|
|
507
|
+
)`).all(t,t,t,t).filter(f=>f.queue_prd_id===t||sH(f,t)||aH(e,f,t));for(let f of c){a.add(f.item_ref);let g=gt(f.session);g!==void 0&&s.add(g)}let d=Number(r.prepare("UPDATE queue_prds SET status = 'removed', updated_at = ? WHERE prd_id = ? AND COALESCE(status, '') <> 'removed'").run(i,t).changes),u=YSe(e,[...s],t,i),l=eye(e,c,t,i),p=[...a].sort(),m=[...s].sort();return(p.length>0||m.length>0)&&(wa(e,[...p.map(f=>({documentType:"backlog_item",documentId:f,reason:"queue-prd-removed"})),...m.map(f=>({documentType:"session_plan",documentId:f,reason:"queue-prd-removed"}))],i),cye(e,t,p,i)),{prdId:t,affectedItemRefs:p,affectedSessionIds:m,updatedQueuePrdRows:d,updatedSessionPlanRows:u,supersededLifecycleRows:l,markedRecommendationStale:!1}}function JSe(e,t){return re(e).prepare("SELECT DISTINCT item_ref FROM session_plan_items WHERE session = ?").all(t).map(i=>gt(i.item_ref)).filter(i=>i!==void 0)}function YSe(e,t,i,r){let o=re(e),s=0;for(let a of t)rye(e,a,i)||(s+=Number(o.prepare("UPDATE session_plans SET status = 'removed', updated_at = ? WHERE session = ? AND status = 'submitted'").run(r,a).changes));return s}function eye(e,t,i,r){let o=re(e),s=t.filter(c=>tye(e,c,i)).map(c=>c.evidence_key).sort(),a=0;for(let c of s)a+=Number(o.prepare("UPDATE lifecycle_evidence SET is_current = 0, is_terminal = 1, status = 'removed', superseded_at = ? WHERE evidence_key = ? AND is_current = 1").run(r,c).changes);return a}function tye(e,t,i){if(yI(t.lifecycle_state)||gt(t.landing_id)!==void 0)return!1;let r=gC(e,gt(t.run_id)),o=SC(e,gt(t.build_session_id));if(r!==void 0&&!vt(r)||o!==void 0&&!vt(o)||r===void 0&&o===void 0&&(gt(t.run_id)!==void 0||gt(t.build_session_id)!==void 0)&&!vt(t.status)||t.queue_prd_id!==i&&!sH(t,i)&&!aH(e,t,i))return!1;let s=cH(t.links_json);return!(s.queuePrdIds.some(a=>a!==i&&iye(e,a))||s.runIds.some(a=>sye(e,a))||s.buildSessionIds.some(a=>aye(e,a)))}function sH(e,t){return cH(e.links_json).queuePrdIds.includes(t)}function aH(e,t,i){let r=gt(t.run_id);if(r!==void 0&&re(e).prepare("SELECT queue_prd_id FROM build_runs WHERE run_id = ?").get(r)?.queue_prd_id===i)return!0;let o=gt(t.build_session_id);return o===void 0?!1:re(e).prepare("SELECT queue_prd_id FROM build_runs WHERE build_session_id = ? AND queue_prd_id = ?").get(o,i)?.queue_prd_id===i}function cH(e){if(!e)return{queuePrdIds:[],runIds:[],buildSessionIds:[]};try{return nye(JSON.parse(e))}catch{return{queuePrdIds:[],runIds:[],buildSessionIds:[]}}}function nye(e){let t={queuePrdIds:[],runIds:[],buildSessionIds:[]},i=r=>{if(Array.isArray(r)){for(let u of r)i(u);return}if(!r||typeof r!="object")return;let o=r,s=gt(o.kind),a=gt(o.queuePrdId)??gt(o.prdId)??(s==="queue-prd"?gt(o.id):void 0);a&&t.queuePrdIds.push(a);let c=gt(o.runId)??(s==="build-run"?gt(o.id):void 0);c&&t.runIds.push(c);let d=gt(o.buildSessionId)??(s==="build-session"?gt(o.id):void 0);d&&t.buildSessionIds.push(d);for(let u of Object.values(o))i(u)};return i(e),t}function iye(e,t){let i=re(e).prepare("SELECT status FROM queue_prds WHERE prd_id = ?").get(t);return i!==void 0&&rr(i.status)}function rye(e,t,i){let r=re(e);return r.prepare("SELECT status FROM queue_prds WHERE session = ? AND prd_id <> ?").all(t,i).some(d=>rr(d.status))||r.prepare("SELECT status FROM build_runs WHERE session = ? OR queue_prd_id = ?").all(t,i).some(d=>!vt(d.status))||r.prepare("SELECT status FROM build_sessions WHERE session = ?").all(t).some(d=>!vt(d.status))?!0:r.prepare("SELECT status, run_id, build_session_id FROM lifecycle_evidence WHERE is_current = 1 AND session = ? AND (run_id IS NOT NULL OR build_session_id IS NOT NULL)").all(t).some(d=>oye(e,d))}function oye(e,t){let i=gC(e,gt(t.run_id)),r=SC(e,gt(t.build_session_id));return i!==void 0?!vt(i):r!==void 0?!vt(r):!vt(t.status)}function sye(e,t){let i=gC(e,t);return i!==void 0&&!vt(i)}function aye(e,t){let i=SC(e,t);return i!==void 0&&!vt(i)}function gC(e,t){if(t===void 0)return;let i=re(e).prepare("SELECT status FROM build_runs WHERE run_id = ?").get(t);return gt(i?.status)}function SC(e,t){if(t===void 0)return;let i=re(e).prepare("SELECT status FROM build_sessions WHERE build_session_id = ?").get(t);return gt(i?.status)}function cye(e,t,i,r){let o=Gd(e);o!==void 0&&(zd(e,{...o,freshness:{status:"stale",reason:`queue PRD ${t} was removed`,refs:[t,...i],updatedAt:r},isCurrent:!0}),nm(e,o.runId,"queue-prd-removed"))}function gt(e){return typeof e=="string"&&e.length>0?e:void 0}var bH=Po(Zr(),1);import{existsSync as Xye}from"fs";import{mkdir as Qye,writeFile as Zye}from"fs/promises";import{basename as Jye}from"path";import{relative as Aye}from"path";import{existsSync as pye}from"fs";import{mkdir as mye,readFile as fye,rename as gye,writeFile as Sye}from"fs/promises";import{dirname as yye}from"path";function dH(e,t){return Te(e,i=>dye(i,t))}function dye(e,t){let i=lt(),r=Jp(e,{taskId:t.taskId,purpose:t.purpose,statusSnapshot:t.status??"active",sourceFingerprint:t.sourceFingerprint,requestedSections:t.requestedSections,selectionSummary:t.selectionSummary,compactResultSummary:t.compactResultSummary,rawRequest:t.rawRequest,rawResult:t.rawResult,rawPayloadPrunable:!0,createdAt:i,updatedAt:i,parentTaskId:t.parentTaskId});Iw(e,lye(t));for(let o of t.itemRefs??[])_a(e,{documentType:"backlog_item",documentId:o,reason:"planning-task-recorded"});return r}function uH(e,t,i=lt()){return Te(e,r=>uye(r,t,i))}function uye(e,t,i=lt()){let r=pH(e,t);return Jp(e,{...r,taskId:t,statusSnapshot:"applied",appliedAt:i,updatedAt:i})}function lH(e,t,i=lt()){return Te(e,r=>{let o=pH(r,t);return Jp(r,{...o,taskId:t,statusSnapshot:"dismissed",updatedAt:i})})}function pH(e,t){let i=re(e).prepare("SELECT * FROM planning_tasks WHERE task_id = ?").get(t);return i?sI(i):void 0}function lye(e){return{taskId:e.taskId,items:(e.itemRefs??[]).map((t,i)=>({ref:t,role:"source",sequence:i})),epics:(e.epicRefs??[]).map((t,i)=>({ref:t,role:"source",sequence:i})),recommendationRefs:(e.recommendationRefs??[]).map((t,i)=>({ref:t,role:"source",sequence:i}))}}var hye="eforge-plan",Iye=["planning-tasks","index.json"],yC="recommendation-refresh",hC="backlog-curation",eb=new Map,bye=0;function IC(e,t){let r=(eb.get(e)??Promise.resolve()).then(t,t),o;return o=r.then(()=>{},()=>{}).finally(()=>{eb.get(e)===o&&eb.delete(e)}),eb.set(e,o),r}function Cm(e){return ut({cwd:e,extensionName:hye}).extensionStoragePath("project-local",[...Iye])}function tb(){return{schemaVersion:1,entries:[]}}function Rye(e){return e instanceof Error&&"code"in e}async function At(e){let t=xye(e);if(t.hasRows||t.index.entries.length>0)return t.index;let i;try{i=await fye(Cm(e),"utf-8")}catch(s){if(Rye(s)&&s.code==="ENOENT")return tb();throw s}let r;try{r=JSON.parse(i)}catch{return tb()}let o=ze(YV,r);return o.success?Dm(o.data):Pye(r)}async function au(e,t){let i=Cm(e);return IC(i,async()=>{dH(e,await vye(e,t));let r=await At(e);return await bC(e,{schemaVersion:1,entries:[...r.entries.filter(o=>o.taskId!==t.taskId),t]}),t})}async function fH(e,t){let i=Cm(e);return IC(i,async()=>{let r=ho(await At(e),t)!==void 0;if(r){lH(e,t);let o=await At(e);await bC(e,{schemaVersion:1,entries:o.entries.filter(s=>s.taskId!==t)})}return r})}async function Lm(e,t,i){let r=Cm(e);return IC(r,async()=>{let o=ho(await At(e),t);if(o===void 0)throw new Error(`No planning task workflow entry found for ${t}; cannot mark applied.`);let s={...o,appliedAt:i};uH(e,t,i);let a=await At(e);return await bC(e,{schemaVersion:1,entries:a.entries.map(c=>c.taskId===t?s:c)}),s})}function ho(e,t){return e.entries.find(i=>i.taskId===t)}function cu(e){return Dm(e).entries}function sr(e){return e.purpose===yC}function nb(e,t){return cu(e).filter(i=>sr(i)&&(t===void 0||i.sourceFingerprint===t))}function on(e){return e.purpose===hC}function gH(e,t,i){return cu(e).filter(r=>on(r)&&(t===void 0||r.sourceFingerprint===t)&&(i===void 0||mH(r.itemAuditConcurrency)===mH(i)))}function xye(e){if(!pye(Ln(e)))return{index:tb(),hasRows:!1};let t=Kt(e,{create:!1,migrate:!0,readonly:!0});try{return t.transaction(()=>{let i=re(t),r=i.prepare("SELECT 1 FROM planning_tasks LIMIT 1").get()!==void 0,s=i.prepare("SELECT raw_request_json, task_id, created_at, applied_at FROM planning_tasks WHERE COALESCE(status_snapshot, '') <> 'dismissed' ORDER BY created_at DESC, task_id").all().map(a=>Eye(a)).filter(a=>a!==void 0);return{index:Dm({schemaVersion:1,entries:s}),hasRows:r}})}finally{t.close()}}function Eye(e){let t=typeof e.raw_request_json=="string"?JSON.parse(e.raw_request_json):void 0,i=ze(xs,t);if(i.success)return{...i.data,...typeof e.applied_at=="string"?{appliedAt:e.applied_at}:{}}}function Pye(e){if(!kye(e))return tb();let t=e.entries.map(i=>ze(xs,i)).filter(i=>i.success).map(i=>i.data);return Dm({schemaVersion:1,entries:t})}function kye(e){return typeof e=="object"&&e!==null&&e.schemaVersion===1&&Array.isArray(e.entries)}async function vye(e,t){return{taskId:t.taskId,purpose:t.purpose,status:t.appliedAt!==void 0?"applied":"active",sourceFingerprint:t.sourceFingerprint,requestedSections:t.requestedOutputSections,selectionSummary:t.selection,rawRequest:t,parentTaskId:t.parentTaskId,itemRefs:await _ye(e,t),epicRefs:t.selection.epicId!==void 0?[t.selection.epicId]:void 0,recommendationRefs:t.selection.recommendationRef!==void 0?[t.selection.recommendationRef]:void 0}}async function _ye(e,t){let i=new Set(t.selection.itemIds??[]);if(Te(e,r=>{let o=re(r);if(t.selection.epicId!==void 0){let s=o.prepare("SELECT id FROM backlog_items WHERE epic_id = ? OR epic_ref = ?").all(t.selection.epicId,t.selection.epicId);for(let a of s)typeof a.id=="string"&&i.add(a.id)}}),t.selection.recommendationRef!==void 0){let r=await ki(e),o=r?.safeParallelizableGroups.find(a=>a.ref===t.selection.recommendationRef);for(let a of o?.itemIds??[])i.add(a);let s=r?.recommendedNextSequence.find(a=>a.ref===t.selection.recommendationRef);s!==void 0&&i.add(s.itemId)}return i.size>0?[...i]:void 0}function mH(e){return typeof e=="number"&&Number.isInteger(e)&&e>0?Math.min(e,Rm):bm}async function bC(e,t){let i=Cm(e);await mye(yye(i),{recursive:!0});let r=Dm(t),o=`${i}.${process.pid}.${bye++}.tmp`;await Sye(o,`${JSON.stringify(r,null,2)}
|
|
508
|
+
`,"utf-8"),await gye(o,i)}function Dm(e){return{schemaVersion:1,entries:[...e.entries].sort((i,r)=>i.createdAt!==r.createdAt?i.createdAt<r.createdAt?1:-1:i.taskId<r.taskId?-1:i.taskId>r.taskId?1:0)}}var Oye=new Set(["queued","running"]);async function yH(e,t,i){let r=La(e)?await wye(e,t,i):await hH(e,t,i);return{schemaVersion:1,activeWork:t.activeWork.map(o=>RC("activeWork",o,r)),readyCandidates:t.readyCandidates.map(o=>RC("readyCandidates",o,r)),recommendedNextSequence:t.recommendedNextSequence.map(o=>RC("recommendedNextSequence",o,r)),safeParallelizableGroups:t.safeParallelizableGroups.map(o=>{let s=o.itemIds.map(d=>PC(d,r)),a=s.filter(d=>d.state==="actionable").map(d=>d.itemId),c=s.filter(d=>d.state==="non-actionable").map(d=>d.itemId);return{ref:o.ref,state:c.length===0?"actionable":a.length===0?"non-actionable":"partially-actionable",itemIds:o.itemIds,actionableItemIds:a,suppressedItemIds:c,items:s}})}}async function $m(e,t,i,r="itemIds",o={}){if(t.length===0)return;if(La(e)){await im(e);let l=(await Ua(e,{itemIds:[...new Set(t)],includePlanningTasks:i===void 0,excludePlanningTaskIds:[...o.excludePlanningTaskIds??[]]})).entries.map(p=>({itemId:p.itemId,state:"non-actionable",lifecycleState:p.lifecycleState,reasonCode:p.reasonCode,reasonMessage:`Item ${p.itemId} is covered by ${p.reasonCode}.`,associatedLinks:p.associatedLinks}));if(i!==void 0){let p=await EC(e,await ki(e),i,o);for(let m of p)for(let f of vC(m))t.includes(f)&&l.push(kC(f,[m]))}if(l.length>0){let p=l.map(m=>`${m.itemId}: ${m.reasonMessage}`).join("; ");throw v(`Selected backlog work is already planned or in process: ${p}.`,{path:r,details:{suppressedItems:SH(l)}})}return}let s=await ki(e),a=await hH(e,s??void 0,i,o),c=[...new Set(t)].map(u=>PC(u,a)).filter(u=>u.state==="non-actionable");if(c.length===0)return;let d=c.map(u=>`${u.itemId}: ${u.reasonMessage??u.reasonCode??"not actionable"}`).join("; ");throw v(`Selected backlog work is already planned or in process: ${d}.`,{path:r,details:{suppressedItems:SH(c)}})}async function wye(e,t,i){await im(e);let r=await tC(e,t),o=new Map;for(let a of[...r.activeWork,...r.readyCandidates,...r.recommendedNextSequence])o.set(a.itemId,a.actionability);for(let a of r.safeParallelizableGroups)for(let c of a.items)o.set(c.itemId,c);if(i===void 0)return o;let s=await EC(e,t,i);for(let a of s)for(let c of vC(a))o.set(c,kC(c,[a]));return o}async function hH(e,t,i,r={}){let[o,s,a,c]=await Promise.all([nn(e),xi(e),Tye(e),EC(e,t,i,r)]),d=new Map;for(let l of[...Lye(s),...c,...a])for(let p of vC(l))jye(d,p,l);let u=new Set([...o.map(l=>l.id),...d.keys()]);return new Map([...u].map(l=>[l,kC(l,d.get(l)??[])]))}async function Tye(e){let t=Ve(),i=await t.flat.list({cwd:e,includeSubmitted:!0});return(await Promise.all(i.map(async o=>{try{let{plan:s,path:a}=await t.flat.load({cwd:e,session:o.session}),c=rm(s);return c===null||c.sourceItemIds.length===0?[]:[{code:s.status==="submitted"?"submitted-session-plan":"planned-session-plan",lifecycleState:"planned",message:s.status==="submitted"?`A submitted session plan already covers ${c.sourceItemIds.join(", ")}.`:`An editable session plan already covers ${c.sourceItemIds.join(", ")}.`,links:[_C({kind:"session-plan",label:`Session plan ${s.session}`,itemIds:c.sourceItemIds,session:s.session,status:s.status,path:Aye(e,a).replace(/\\/g,"/"),timestamp:c.promotedAt})]}]}catch{return[]}}))).flat()}async function EC(e,t,i,r={}){if(i===void 0)return[];let o=new Set(r.excludePlanningTaskIds??[]),s=await nn(e),a=cu(await At(e)).filter(d=>d.appliedAt===void 0).filter(d=>!o.has(d.taskId)).filter(d=>!sr(d)&&!on(d));return(await Promise.all(a.map(async d=>{let u=Dye(d,s,t);if(u.length===0)return;let l;try{l=(await i.get(d.taskId)).task}catch{return}if(!(l.kind!==ia||!Oye.has(l.status)))return{code:"active-planning-task",lifecycleState:"active",message:`Planning task ${d.taskId} is ${l.status} for ${u.join(", ")}.`,links:[_C({kind:"planning-task",label:`Planning task ${d.taskId}`,itemIds:u,taskId:d.taskId,status:l.status,timestamp:Cye(l)})]}}))).filter(d=>d!==void 0)}function Cye(e){return e.startedAt??e.createdAt}function Lye(e){return e.flatMap(t=>{let i=t.prRefs.filter(a=>a.status==="pr-open");if(i.length>0)return[ib("open-pr-trace","pr-open",`An open PR trace already covers ${t.itemId}.`,i)];let r=t.linkRows.filter(a=>a.kind==="build-session"&&ni(a));if(r.length>0)return[ib("active-build-session-trace","build",`An active build session already covers ${t.itemId}.`,r)];let o=t.linkRows.filter(a=>a.kind==="build-run"&&ni(a));if(o.length>0)return[ib("building-trace","build",`An active build trace already covers ${t.itemId}.`,o)];let s=t.linkRows.filter(a=>a.kind==="queue-prd"&&ni(a));return s.length>0?[ib("queued-trace","queue",`A queued PRD trace already covers ${t.itemId}.`,s)]:[]})}function ib(e,t,i,r){return{code:e,lifecycleState:t,message:i,links:r.map(Bye)}}function Dye(e,t,i){return e.selection.itemIds!==void 0?xC(e.selection.itemIds):e.selection.epicId!==void 0?t.filter(r=>r.epic===e.selection.epicId&&hi(r.status)).map(r=>r.id):e.selection.recommendationRef!==void 0&&i!==null&&i!==void 0?xC($ye(i,e.selection.recommendationRef)):[]}function $ye(e,t){let i=e.safeParallelizableGroups.find(o=>o.ref===t);return i!==void 0?i.itemIds:[...e.activeWork,...e.readyCandidates,...e.recommendedNextSequence].filter(o=>o.ref===t||o.itemId===t).map(o=>o.itemId)}function RC(e,t,i){return{lane:e,...t.ref!==void 0&&{ref:t.ref},itemId:t.itemId,actionability:PC(t.itemId,i)}}function PC(e,t){let i=t.get(e);return i!==void 0?i:e==="planned"?{itemId:e,state:"non-actionable",lifecycleState:"planned",reasonCode:"planned-session-plan",reasonMessage:`Item ${e} is covered by planned-session-plan.`,associatedLinks:[]}:e==="shipped"||e==="failed"?{itemId:e,state:"non-actionable",lifecycleState:e,reasonCode:`${e}-result`,reasonMessage:`Item ${e} has terminal lifecycle evidence.`,associatedLinks:[],disposition:"de-actioned"}:{itemId:e,state:"actionable",lifecycleState:"none",associatedLinks:[]}}function kC(e,t){let i=Nye(t);return i===void 0?{itemId:e,state:"actionable",lifecycleState:"none",associatedLinks:[]}:{itemId:e,state:"non-actionable",lifecycleState:i.lifecycleState,reasonCode:i.code,reasonMessage:i.message,associatedLinks:i.links}}function Nye(e){return["open-pr-trace","active-build-session-trace","building-trace","queued-trace","active-planning-task","submitted-session-plan","planned-session-plan"].flatMap(i=>e.filter(r=>r.code===i))[0]}function jye(e,t,i){let r=e.get(t)??[];r.push(i),e.set(t,r)}function vC(e){return xC(e.links.flatMap(t=>t.itemIds))}function Bye(e){return _C({kind:e.kind,label:e.label,itemIds:e.affectedItemIds,status:e.status,session:e.session,prdId:e.prdId,runId:e.runId,sessionId:e.sessionId,featureBranch:e.featureBranch,commitSha:e.commitSha,prUrl:e.prUrl,path:e.path,timestamp:e.timestamp})}function _C(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}function xC(e){return[...new Set(e.filter(t=>t.length>0))]}function SH(e){return JSON.parse(JSON.stringify(e))}async function Ps(e){Mye(e);let t=e.itemIds!==void 0?await Uye(e.cwd,e.itemIds):e.epicId!==void 0?await Fye(e.cwd,e.epicId):await qye(e.cwd,e.recommendationRef),i=zye(t.items,t.extraEpicIds),r=await Gye(e.cwd,i),o=t.items.map(a=>a.id),s=Hye(e,t.recommendationGroup,o.length);return{items:t.items,epics:r,itemIds:o,epicIds:i,title:e.title??t.title??Wye(t.items),session:e.session,status:e.status??"active",profile:s,...e.recommendationRef!==void 0&&{recommendationRef:e.recommendationRef},...t.recommendationGroup!==void 0&&{recommendationGroup:t.recommendationGroup},...t.recommendationItem!==void 0&&{recommendationItem:t.recommendationItem},...t.recommendationModel!==void 0&&{recommendationModel:t.recommendationModel},sources:JU(t.items),epicSources:YU(r)}}function Mye(e){let t=[e.itemIds!==void 0,e.epicId!==void 0,e.recommendationRef!==void 0].filter(Boolean).length;if(t!==1)throw v("Promotion selection must include exactly one selector: itemIds, epicId, or recommendationRef.",{path:"selection",details:{selectorCount:t}});if(e.itemIds!==void 0){if(e.itemIds.length===0)throw v("Promotion selection itemIds must include at least one item id.",{path:"itemIds"});let i=new Set;for(let r of e.itemIds){if(i.has(r))throw v(`Duplicate backlog item id in promotion selection: ${r}`,{path:"itemIds",details:{itemId:r}});i.add(r)}}}async function Uye(e,t){return{items:await AC(e,t)}}async function Fye(e,t){let i=await IH(e,t);if(!i)throw v(`Backlog epic not found: ${t}`,{path:"epicId",details:{epicId:t}});let r=eF(ZU(await Vye(e),t));if(r.length===0)throw v(`No open backlog items found for epic: ${t}`,{path:"epicId",details:{epicId:t}});return{items:r,extraEpicIds:[t],title:i.title}}async function qye(e,t){let i=await ki(e);if(!i)throw v(`Recommendation ref not found: ${t}`,{path:"recommendationRef",details:{recommendationRef:t}});let r=i.safeParallelizableGroups.find(s=>s.ref===t);if(r){if(r.itemIds.length===0)throw v(`Recommendation group ${t} must include at least one item id.`,{path:"recommendationRef",details:{recommendationRef:t}});return{items:await AC(e,r.itemIds),extraEpicIds:r.epicIds,title:r.title,recommendationGroup:r,recommendationModel:i}}let o=i.recommendedNextSequence.find(s=>s.ref===t);if(o)return{items:await AC(e,[o.itemId]),recommendationItem:o,recommendationModel:i};throw v(`Recommendation ref not found: ${t}`,{path:"recommendationRef",details:{recommendationRef:t}})}async function AC(e,t){let i=[];for(let r of t){let o=await Kye(e,r);if(!o)throw v(`Backlog item not found: ${r}`,{path:"itemIds",details:{itemId:r}});i.push(o)}return i}function zye(e,t=[]){return[...new Set([...e.flatMap(i=>i.epic?[i.epic]:[]),...t])]}async function Gye(e,t){let i=[];for(let r of t){let o=await IH(e,r);o&&i.push(o)}return i}async function Kye(e,t){let i=Lr(e,t);return i?Rs(i):await ii(e,t)??void 0}async function IH(e,t){let i=bs(e,t);return i?ja(i):await Wd(e,t)??void 0}async function Vye(e){let t=Sm(e).map(Rs);return t.length>0?t:await nn(e)}function Hye(e,t,i){return e.profile!==void 0?e.profile:t?.recommendedProfile!==void 0?t.recommendedProfile:i>1||e.epicId!==void 0?"excursion":null}function Wye(e){return e.length===1?e[0].title:`Promote ${e.length} backlog items`}var Yye=["scope","acceptance-criteria","assumptions-and-validation"],ehe=["context","design-decisions","dependency-context"];function RH(e,t=new Date){return`${t.toISOString().slice(0,10)}-${OC(e.id||e.title)}`}function xH(e,t=new Date){let i=t.toISOString().slice(0,10),r=e.length===1?e[0].id||e[0].title:`${e[0]?.id??"selection"}-and-${e.length-1}-more`;return`${i}-${OC(r)}`}function the(e){let t=e.session??RH(e.item);return EH({cwd:e.cwd,items:[e.item],epics:e.epic?[e.epic]:[],title:e.item.title,session:t,profile:e.profile})}function EH(e){if(e.items.length===0)throw new Error("Cannot synthesize a promotion session plan without selected backlog items.");let t=e.session??xH(e.items),i=e.items.map(s=>s.id),r=[...new Set(e.epicIds??(e.epics??[]).map(s=>s.id))],o={session:t,topic:e.title??(e.items.length===1?e.items[0].title:`Promote ${e.items.length} backlog items`),status:"ready",planning_type:"feature",planning_depth:"focused",required_dimensions:Yye,optional_dimensions:ehe,skipped_dimensions:[],open_questions:[],profile:e.profile??null,eforge_plan:{source_item_ids:i,source_epic_ids:r,...e.recommendationRef!==void 0&&{source_recommendation_ref:e.recommendationRef},...i.length===1&&{source_item_id:i[0]},...r.length===1&&{source_epic_id:r[0]}}};return`---
|
|
509
|
+
${(0,bH.stringify)(o,{lineWidth:0}).trimEnd()}
|
|
510
|
+
---
|
|
511
|
+
${ohe(e)}`}function nhe(e){let t=the(e),i=e.session??RH(e.item),r=_H(e.cwd,i);return Pa({sourcePath:r,content:t}).content}async function PH(e){let t=await Ga({cwd:e.cwd,itemIds:[e.itemId],status:e.status,session:e.session,profile:e.profile,agentTasks:e.agentTasks});return{itemId:t.itemIds[0],session:t.session,sessionPlanPath:t.sessionPlanPath,buildSource:t.buildSource,status:t.status}}async function Ga(e){let t=await Ps(e);e.itemIds!==void 0&&await $m(e.cwd,t.itemIds,e.agentTasks);let i=ihe(e.cwd);await Qye(i,{recursive:!0});let{session:r,sessionPlanPath:o}=rhe(e.cwd,t.items,t.session),s=EH({cwd:e.cwd,items:t.items,epics:t.epics,epicIds:t.epicIds,title:t.title,session:r,profile:t.profile,recommendationRef:t.recommendationRef,recommendation:t.recommendationGroup??t.recommendationItem,recommendationAssumptions:t.recommendationModel?.rationaleAndAssumptions});await Zye(o,s,{encoding:"utf-8",flag:"wx"});let a=new Date().toISOString();return Cr(e.cwd,{session:r,path:o,content:s,status:"ready",profile:t.profile,sourceItemIds:t.itemIds,sourceEpicIds:t.epicIds,sourceRecommendationRef:t.recommendationRef,provenance:"promotion",updatedAt:a}),await Promise.all(t.itemIds.map(async c=>{await OI(e.cwd,c,{status:t.status});let d=t.items.find(l=>l.id===c),u=await Xd(e.cwd,c)??wI(c,d?.epic);u.promotedSessionPlans=[...u.promotedSessionPlans.filter(l=>l.session!==r),{session:r,path:o,status:"ready",promotedAt:a}],await Qd(e.cwd,u)})),{itemIds:t.itemIds,epicIds:t.epicIds,session:r,sessionPlanPath:o,buildSource:Pa({sourcePath:o,content:s}).content,status:t.status,profile:t.profile,...t.recommendationRef!==void 0&&{recommendationRef:t.recommendationRef},sources:t.sources,epics:t.epicSources}}async function kH(e,t){if(!t?.cwd)return["# eforge-plan input source requires runtime context","","`eforge://input/eforge-plan/<itemId>` must be resolved by eforge input preprocessing so the adapter receives `ctx.cwd`.","This adapter intentionally does not read from `process.cwd()`."].join(`
|
|
512
|
+
`);let i=Lr(t.cwd,e),r=i!==void 0?Rs(i):await ii(t.cwd,e);if(!r)return null;let o=r.epic?bs(t.cwd,r.epic):void 0,s=o!==void 0?ja(o):r.epic?await Wd(t.cwd,r.epic):null;return nhe({cwd:t.cwd,item:r,epic:s,session:`direct-${OC(r.id)}`})}function vH(e){let t=zt(e.body),i=Nm(t,["Assumptions","Assumptions and Validation"]),r=Nm(t,["Acceptance Criteria"]);return{assumptions:i||"Missing assumptions: state key assumptions and validation risks before implementation.",acceptanceCriteria:r||"Missing acceptance criteria: add concrete, verifiable done conditions before build handoff."}}function ihe(e){return xr({cwd:e,segments:["session-plans"]})}function _H(e,t){return xr({cwd:e,segments:["session-plans",`${t}.md`]})}function rhe(e,t,i){let r=i??xH(t);for(let o=0;o<100;o+=1){let s=o===0?r:`${r}-${o+1}`,a=_H(e,s);if(!Xye(a))return{session:s,sessionPlanPath:a};if(i)throw new Error(`Session plan already exists for explicit session "${i}": ${a}`)}throw new Error(`Could not allocate a unique session plan path for ${r}`)}function ohe(e){return[`# ${e.title??(e.items.length===1?e.items[0].title:`Promote ${e.items.length} backlog items`)}`,"","## Context","",e.items.map(mhe).join(`
|
|
513
|
+
|
|
514
|
+
`),"","## Scope","",e.items.map(i=>`### ${i.id}: ${i.title}
|
|
515
|
+
|
|
516
|
+
${i.body.trim()}`).join(`
|
|
517
|
+
|
|
518
|
+
`),"","## Assumptions","",she(e),"","## Design Decisions","",ahe(e.items),"","## Acceptance Criteria","",che(e.items),"","## Source Backlog Evidence","",e.items.map(phe).join(`
|
|
519
|
+
|
|
520
|
+
`),"","## Source Epic Evidence","",dhe(e.epics??[]),"","## Dependency Context","",uhe(e.items),"","## Recommendation Context","",lhe(e),""].join(`
|
|
521
|
+
`)}function she(e){let t=e.items.map(r=>`### ${r.id}
|
|
522
|
+
|
|
523
|
+
${vH(r).assumptions}`).join(`
|
|
524
|
+
|
|
525
|
+
`),i=(e.recommendationAssumptions??[]).length>0?`
|
|
526
|
+
|
|
527
|
+
Recommendation assumptions:
|
|
528
|
+
${e.recommendationAssumptions.map(r=>`- ${r}`).join(`
|
|
529
|
+
`)}`:"";return`${t}${i}`}function ahe(e){return e.map(t=>{let i=Nm(zt(t.body),["Design Decisions"])||"Use the backlog evidence as the source of truth; keep implementation scoped to this item.";return`### ${t.id}
|
|
530
|
+
|
|
531
|
+
${i}`}).join(`
|
|
532
|
+
|
|
533
|
+
`)}function che(e){return e.map(t=>`### ${t.id}
|
|
534
|
+
|
|
535
|
+
${vH(t).acceptanceCriteria}`).join(`
|
|
536
|
+
|
|
537
|
+
`)}function dhe(e){return e.length===0?"No source epic linked.":e.map(t=>`### ${t.id}: ${t.title}
|
|
538
|
+
|
|
539
|
+
Epic ${t.id}: ${t.title}
|
|
540
|
+
|
|
541
|
+
${t.body.trim()}`).join(`
|
|
542
|
+
|
|
543
|
+
`)}function uhe(e){let t=ad(e),i=new Map(da(e).map(r=>[r.itemId,r]));return t.map(r=>{let o=i.get(r.itemId);return[`### ${r.itemId}`,"",`Depends on: ${r.dependsOn.length>0?r.dependsOn.join(", "):"No dependencies declared."}`,`Internal dependencies: ${r.internalDependsOn.length>0?r.internalDependsOn.join(", "):"None."}`,`External dependencies: ${r.externalDependsOn.length>0?r.externalDependsOn.join(", "):"None."}`,`Blockers: ${o&&o.blockers.length>0?o.blockers.join("; "):"None declared."}`,`Risks: ${o&&o.risks.length>0?o.risks.join("; "):"None declared."}`].join(`
|
|
544
|
+
`)}).join(`
|
|
545
|
+
|
|
546
|
+
`)}function lhe(e){let i=[`Selected source order:
|
|
547
|
+
${iy(e.items,e.epics??[]).map(r=>`- ${r}`).join(`
|
|
548
|
+
`)}`];return e.recommendationRef!==void 0&&i.push(`Recommendation ref: ${e.recommendationRef}`),e.recommendation&&"rationale"in e.recommendation&&e.recommendation.rationale&&i.push(`Recommendation rationale: ${e.recommendation.rationale}`),e.recommendation&&"confidence"in e.recommendation&&e.recommendation.confidence&&i.push(`Recommendation confidence: ${e.recommendation.confidence}`),i.join(`
|
|
549
|
+
|
|
550
|
+
`)}function phe(e){let t=Nm(zt(e.body),["Evidence","Source Evidence"]);return[`### ${e.id}: ${e.title}`,`Backlog item id: ${e.id}`,`Status at handoff: ${e.status}`,t||"No explicit evidence section found in the backlog item."].join(`
|
|
551
|
+
|
|
552
|
+
`)}function mhe(e){let t=zt(e.body);return Nm(t,["Claim","Problem","Context"])||`Implement backlog item ${e.id}: ${e.title}.`}function Nm(e,t){for(let i of t){let r=e.get(i);if(r&&r.trim().length>0)return r.trim()}return""}function OC(e){return Jye(e).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"backlog-item"}var fhe=[{label:"explore/exploration",pattern:/\bexplor(?:e|es|ed|ing|ation|atory)\b/i},{label:"revisit",pattern:/\brevisit(?:s|ed|ing)?\b/i},{label:"research",pattern:/\bresearch(?:es|ed|ing)?\b/i},{label:"investigate",pattern:/\binvestigat(?:e|es|ed|ing|ion)\b/i},{label:"evaluate",pattern:/\bevaluat(?:e|es|ed|ing|ion)\b/i},{label:"assess",pattern:/\bassess(?:es|ed|ing|ment)?\b/i},{label:"spike",pattern:/\bspike\b/i},{label:"discover",pattern:/\bdiscover(?:s|ed|ing|y)?\b/i},{label:"decide whether/if/how",pattern:/\bdecide\s+(?:whether|if|how)\b/i},{label:"figure out",pattern:/\bfigure\s+out\b/i},{label:"whether",pattern:/\bwhether\b/i},{label:"future/deferred",pattern:/\b(?:future|deferred|later-stage|on the radar)\b/i}],AH=/\b(?:add|allow|build|change|create|document|enable|enforce|expose|fix|harden|implement|improve|introduce|make|migrate|prevent|provide|remove|replace|require|ship|simplify|support|update|validate|wire)\b/i;function wH(e){return["Backlog item is not session-plan-ready.",...e.map(t=>`- ${t}`),"Do the exploration before capture, then capture the chosen implementation change with concrete acceptance criteria."].join(`
|
|
553
|
+
`)}function TH(e){let t=[],i=e.acceptanceCriteria?.trim()??"";i.length===0&&t.push("Acceptance criteria are required."),i.length>0&&ghe(i)&&t.push("Acceptance criteria must be concrete and verifiable, not placeholder guidance.");for(let[o,s]of[["title",e.title],["claim",e.claim],["acceptanceCriteria",i]]){let a=OH(s);a.length>0&&t.push(`${o} contains exploratory language (${a.join(", ")}).`)}let r=(e.tags??[]).filter(o=>OH(o).length>0);return r.length>0&&t.push(`tags mark the item as exploratory (${r.join(", ")}).`),!AH.test(e.title)&&!AH.test(e.claim)&&t.push("Title or claim should state the implementation change, not only a topic or question."),t}function OH(e){return fhe.filter(t=>t.pattern.test(e)).map(t=>t.label)}function ghe(e){return/missing acceptance criteria|add concrete|before build handoff/i.test(e)}function wC(e,t,i){if(!(t==null||t.length===0)&&bs(e,t)===void 0)throw v(`Invalid epic reference "${t}" for ${i}: no canonical epic exists with that id. Use get-epic to inspect a known epic, search-items with includeEpics to discover existing epics, or create/upsert the epic first with upsert-epic before linking backlog items.`,{path:"epic",details:{actionId:i,epic:t}})}import{readFile as NH}from"fs/promises";import{relative as jH}from"path";function CH(e){return{plan:$n(e.plan),readiness:e.readiness,path:e.path,...e.statusSource?{statusSource:e.statusSource,statusSourceDisclosure:e.statusSourceDisclosure}:{},...e.lifecycle!==void 0?{sourceRefs:e.lifecycle.sourceRefs,lifecycle:e.lifecycle}:{}}}function $n(e){let{sections:t,...i}=e;return{...i,sections:Object.fromEntries([...t.entries()].sort(([r],[o])=>r.localeCompare(o)))}}function LH(e,t){return{planSet:lT(t.summary),validation:lT(t),dir:e.dir,manifestPath:e.manifestPath,...e.anchor?.exists===!0&&e.anchor.content!==void 0?{anchorContent:e.anchor.content}:{}}}function vi(){return Ve()}var She={id:"list-agent-runtime-profiles",title:"List agent runtime profiles",description:"Read kernel-owned agent runtime profile options for the planning workstation through the shared profile-list context service.",inputSchema:hV,outputSchema:IV,outputProfile:Pe.uiRich,sideEffects:["local-read"],async handler(e,t){let i=await t.profiles.list(e.scope===void 0?void 0:{scope:e.scope});return C(i)}},yhe={id:"list-planning-artifacts",title:"List planning artifacts",description:"List flat session plans and session plan sets for the planning workstation, with legacy board data available by explicit opt-in.",inputSchema:QK,outputSchema:ZK,outputProfile:Pe.agentPaginated,sideEffects:["local-read"],async handler(e,t){return C(await oC(t.cwd,e))}},hhe={id:"show-session-plan",title:"Show session plan",description:"Read a flat session plan with readiness detail and a JSON-safe section record.",inputSchema:JK,outputSchema:YK,sideEffects:["local-read"],async handler(e,t){return C(await XI(t.cwd,e.session))}},Ihe={id:"show-session-plan-set",title:"Show session plan set",description:"Read a session plan-set manifest, validation summary, and optional umbrella anchor content.",inputSchema:eV,outputSchema:tV,sideEffects:["local-read"],async handler(e,t){let i=vi(),r=await i.planSets.load({cwd:t.cwd,planSetId:e.planSetId}),o=i.planSets.validateLoaded(r);return C(LH(r,o))}},bhe={id:"create-session-plan",title:"Create session plan",description:"Create a flat .eforge/session-plans/<session>.md planning artifact.",inputSchema:nV,outputSchema:iV,sideEffects:["local-write"],async handler(e,t){let i=vi(),r=await i.flat.create({cwd:t.cwd,session:e.session,topic:e.topic,planningType:e.planningType,planningDepth:e.planningDepth,profile:e.profile,agentProfile:e.agentProfile}),o=await i.flat.readiness({cwd:t.cwd,session:r.plan.session});return await uu(t.cwd,r.plan.session,r.path,o),C({session:r.plan.session,path:r.path,plan:$n(r.plan),readiness:o})}},Rhe={id:"set-session-plan-section",title:"Set session plan section",description:"Replace or append a single dimension section in a flat session plan.",inputSchema:rV,outputSchema:oV,sideEffects:["local-write"],async handler(e,t){let i=vi(),r=await i.flat.setSection({cwd:t.cwd,session:e.session,dimension:e.dimension,content:e.content}),o=i.flat.resolvePath({cwd:t.cwd,session:e.session});return await uu(t.cwd,e.session,o,r.readiness),C({session:e.session,path:o,readiness:r.readiness,plan:$n(r.plan)})}},xhe={id:"skip-dimension",title:"Skip session plan dimension",description:"Record a skipped readiness dimension with a reason in a flat session plan.",inputSchema:sV,outputSchema:aV,sideEffects:["local-write"],async handler(e,t){let i=vi(),r=await i.flat.skipDimension({cwd:t.cwd,session:e.session,dimension:e.dimension,reason:e.reason}),o=i.flat.resolvePath({cwd:t.cwd,session:e.session});return await uu(t.cwd,e.session,o,r.readiness),C({session:e.session,path:o,readiness:r.readiness,plan:$n(r.plan)})}},Ehe={id:"select-session-plan-dimensions",title:"Select session plan dimensions",description:"Apply planning type/depth selection and derived dimension lists to a session plan.",inputSchema:cV,outputSchema:dV,sideEffects:["local-write"],async handler(e,t){let i=vi(),r=await i.flat.selectDimensions({cwd:t.cwd,session:e.session,planningType:e.planningType,planningDepth:e.planningDepth,overwrite:e.overwrite}),o=i.flat.resolvePath({cwd:t.cwd,session:e.session});return await uu(t.cwd,e.session,o,r.readiness),C({session:e.session,path:o,required_dimensions:r.plan.required_dimensions,optional_dimensions:r.plan.optional_dimensions,readiness:r.readiness,plan:$n(r.plan)})}},Phe={id:"check-session-plan-readiness",title:"Check session plan readiness",description:"Return structured readiness detail for a flat session plan.",inputSchema:uV,outputSchema:lV,sideEffects:["local-read"],async handler(e,t){return C({session:e.session,readiness:await vi().flat.readiness({cwd:t.cwd,session:e.session})})}},khe={id:"set-session-plan-ready",title:"Set session plan ready",description:"Mark a session plan ready only when required dimensions and acceptance criteria diagnostics pass.",inputSchema:pV,outputSchema:mV,sideEffects:["local-write"],async handler(e,t){let i=vi(),r=await i.flat.readiness({cwd:t.cwd,session:e.session});if(!r.ready)return await uu(t.cwd,e.session,i.flat.resolvePath({cwd:t.cwd,session:e.session}),r),C({kind:"not-ready",session:e.session,readiness:r,message:"Session plan is not ready; status was left unchanged."});let o=await i.flat.setStatus({cwd:t.cwd,session:e.session,status:"ready"}),s=new Date().toISOString();await MH(t.cwd,e.session,"ready",{readinessSummary:r,frontmatter:{eforge_plan:{ready_at:s}}});let c=(await XI(t.cwd,e.session))?.plan?.status??o.plan.status;return c!=="ready"?C({kind:"not-ready",session:e.session,status:c,readyAt:s,statusSource:"eforge-plan-sqlite-session-plan-status",statusSourceDisclosure:Es,readiness:r,message:`Canonical session-plan status is ${c}; not reporting ready from Markdown compatibility state.`,plan:$n(o.plan)}):C({kind:"ready",session:e.session,status:c,readyAt:s,statusSource:"eforge-plan-sqlite-session-plan-status",statusSourceDisclosure:Es,readiness:r,plan:$n(o.plan)})}},vhe={id:"delete-session-plan",title:"Delete session plan",description:"Hide a flat session plan from active planning lists by marking it abandoned; the Markdown file is retained.",inputSchema:fV,outputSchema:gV,sideEffects:["local-write"],async handler(e,t){let i=vi(),r=await i.flat.setStatus({cwd:t.cwd,session:e.session,status:"abandoned"});return await MH(t.cwd,e.session,"abandoned",{readinessSummary:await i.flat.readiness({cwd:t.cwd,session:e.session})}),C({kind:"deleted",session:e.session,status:"abandoned",message:`Deleted ${e.session} from active plans by marking it abandoned.`,statusSource:"eforge-plan-sqlite-session-plan-status",statusSourceDisclosure:Es,plan:$n(r.plan)})}},_he={id:"update-session-plan-metadata",title:"Update session plan metadata",description:"Update metadata not exposed by adapter mutations: profile, agent profile, and open questions.",inputSchema:SV,outputSchema:yV,sideEffects:["local-write"],async handler(e,t){let i=await II({cwd:t.cwd,session:e.session,profile:e.profile,agentProfile:e.agentProfile,openQuestions:e.openQuestions}),r=vi(),o=r.flat.resolvePath({cwd:t.cwd,session:e.session}),s=await r.flat.readiness({cwd:t.cwd,session:e.session});return await uu(t.cwd,e.session,o,s),C({session:e.session,path:o,readiness:s,plan:$n(i)})}},Ahe={id:"handoff-session-plan",title:"Handoff session plan to build queue",description:"Verify readiness and ready status, then enqueue the session plan through the daemon build queue.",inputSchema:bV,outputSchema:kV,sideEffects:["local-read","local-write","daemon-state","build-queue"],async handler(e,t){let r=await vi().flat.load({cwd:t.cwd,session:e.session}),o=await ft(t.cwd,f=>hI(f,e.session),()=>{}),s=o?.status??r.plan.status,a=o?.status!==void 0?"eforge-plan-sqlite-session-plan-status":"markdown-compatibility-fallback",c={status:s,statusSource:a,...o?.status!==void 0?{statusSourceDisclosure:Es}:{}};if(!r.readiness.ready)return C({kind:"not-ready",session:e.session,readiness:r.readiness,...c,message:"Session plan is not ready; no handoff source path was produced."});if(s!=="ready"){let f=o?.status==="submitted"||o?.status==="removed"?" Use resubmit-session-plan when terminal failed or removed queue/build evidence makes this plan recoverable.":"";return C({kind:"not-ready",session:e.session,readiness:r.readiness,...c,message:`Session plan ${a==="eforge-plan-sqlite-session-plan-status"?"canonical ":""}status is ${s}; mark it ready before handoff.${f}`})}await NH(r.path,"utf-8");let d=jH(t.cwd,r.path).replace(/\\/g,"/"),u=`eforge build ${FH(d)}`,l;try{l=await t.buildQueue.enqueue({source:d,suppressSessionPlanSubmissionMark:!0})}catch(f){let g=f instanceof Error?f.message:String(f);return C({kind:"enqueue-failed",session:e.session,sourcePath:d,absolutePath:r.path,command:u,message:`Session plan is ready, but enqueue failed: ${g}. You can run ${u} manually.`,readiness:r.readiness})}let p,m=new Date().toISOString();try{let f=sm(r.plan);Te(t.cwd,g=>Zw(g,{session:e.session,queuePrdId:l.sessionId,eforgeSessionId:l.sessionId,path:d,itemIds:f.sourceItemIds,timestamp:m}))}catch(f){p=f instanceof Error?f.message:String(f)}return C({kind:"enqueued",session:e.session,sourcePath:d,absolutePath:r.path,queueSessionId:l.sessionId,pid:l.pid,autoBuild:l.autoBuild,submittedAt:m,message:`Enqueued ${d} for build${l.autoBuild?"; auto-build is enabled.":"."}`,readiness:r.readiness,...p!==void 0&&{canonicalSyncWarning:p}})}},Ohe={id:"resubmit-session-plan",title:"Resubmit recoverable session plan",description:"Resubmit an existing submitted session plan when terminal failed or removed queue/build evidence makes recovery eligible, preserving plan identity and source provenance.",inputSchema:RV,outputSchema:vV,sideEffects:["local-read","local-write","daemon-state","build-queue"],async handler(e,t){let r=await vi().flat.load({cwd:t.cwd,session:e.session}),o=await whe(t.cwd,e.session);if(!r.readiness.ready)return C({kind:"not-ready",session:e.session,readiness:r.readiness,message:"Session plan is not ready; resubmit requires a ready plan body."});if(!o.eligible)return C({kind:"not-recoverable",session:e.session,status:o.status,readiness:r.readiness,message:o.message});await NH(r.path,"utf-8");let s=jH(t.cwd,r.path).replace(/\\/g,"/"),a=`eforge build ${FH(s)}`,c;try{c=await t.buildQueue.enqueue({source:s,suppressSessionPlanSubmissionMark:!0})}catch(l){let p=l instanceof Error?l.message:String(l);return C({kind:"enqueue-failed",session:e.session,sourcePath:s,absolutePath:r.path,command:a,message:`Session plan is recoverable, but enqueue failed: ${p}. You can run ${a} manually.`,readiness:r.readiness})}let d,u=new Date().toISOString();try{let l=sm(r.plan);Te(t.cwd,p=>Zw(p,{session:e.session,queuePrdId:c.sessionId,eforgeSessionId:c.sessionId,path:s,itemIds:l.sourceItemIds,timestamp:u}))}catch(l){d=l instanceof Error?l.message:String(l)}return C({kind:"enqueued",session:e.session,sourcePath:s,absolutePath:r.path,queueSessionId:c.sessionId,pid:c.pid,autoBuild:c.autoBuild,submittedAt:u,message:`Resubmitted existing session plan ${s} for build${c.autoBuild?"; auto-build is enabled.":"."}`,readiness:r.readiness,...d!==void 0&&{canonicalSyncWarning:d}})}},BH=[She,yhe,hhe,Ihe,bhe,Rhe,xhe,Ehe,Phe,khe,vhe,_he,Ahe,Ohe];async function MH(e,t,i,r={}){let s=vi().flat.resolvePath({cwd:e,session:t});await Qw(e,t,s,{...r,status:i})}async function uu(e,t,i,r,o={}){await Qw(e,t,i,{...o,...r===void 0?{}:{readinessSummary:r}})}async function whe(e,t){return Te(e,i=>{let r=re(i),o=r.prepare("SELECT status FROM session_plans WHERE session = ?").get(t),s=typeof o?.status=="string"?o.status:void 0;if(s!=="submitted"&&s!=="removed")return{eligible:!1,status:s,message:`Session plan canonical status is ${s??"missing"}; resubmit is only for submitted or queue-removed plans with terminal failed/removed recovery evidence.`};let a=r.prepare("SELECT prd_id, status, COALESCE(updated_at, submitted_at, created_at) AS timestamp FROM queue_prds WHERE session = ?").all(t),c=r.prepare("SELECT run_id, queue_prd_id, status, COALESCE(finished_at, started_at) AS timestamp FROM build_runs WHERE session = ? OR queue_prd_id IN (SELECT prd_id FROM queue_prds WHERE session = ?)").all(t,t),d=r.prepare("SELECT build_session_id, status, COALESCE(finished_at, started_at) AS timestamp FROM build_sessions WHERE session = ?").all(t),u=r.prepare("SELECT lifecycle_state, status, occurred_at FROM lifecycle_evidence WHERE session = ? AND is_current = 1 AND lifecycle_state IN ('submitted','queued','build')").all(t),l=a.some(_=>DH(_.status)),p=c.some(_=>du(_.status))||d.some(_=>du(_.status)),m=$H([...a.filter(_=>DH(_.status)).map(_=>_.timestamp),...c.filter(_=>du(_.status)).map(_=>_.timestamp),...d.filter(_=>du(_.status)).map(_=>_.timestamp)]),f=$H([...a.filter(_=>SI(_.status)).map(_=>_.timestamp),...c.filter(_=>vt(_.status)).map(_=>_.timestamp),...d.filter(_=>vt(_.status)).map(_=>_.timestamp)]),g=m!==void 0&&f!==void 0&&f>m,y=_=>d.some($=>du($.status)&&TC($.timestamp,_)),R=a.some(_=>!SI(_.status)&&!y(_.timestamp)&&!c.some($=>$.queue_prd_id===_.prd_id&&du($.status)&&TC($.timestamp,_.timestamp))),A=c.some(_=>!vt(_.status))||d.some(_=>!vt(_.status)),D=u.some(_=>!vt(_.status)&&TC(_.occurred_at,m));return R||A||D?{eligible:!1,status:s,message:"Active queue/build evidence is correlated with this session plan; wait for the current handoff or build to finish before resubmitting."}:g||!l&&!p?{eligible:!1,status:s,message:"No terminal failed or removed queue/build evidence is correlated with this submitted session plan; active/non-terminal plans should continue through the existing handoff or queue flow."}:{eligible:!0,status:s,message:"Recoverable failed or removed queue/build evidence found."}})}function DH(e){return ir(e)==="failed"||UH(e)}function UH(e){let t=ir(e);return t==="removed"||t==="deleted"}function du(e){return ir(e)==="failed"||UH(e)}function $H(e){return e.filter(t=>typeof t=="string"&&t.length>0).sort().at(-1)}function TC(e,t){return t?typeof e=="string"&&e>=t:!0}function FH(e){return`'${e.replace(/'/g,`'"'"'`)}'`}var Ka="submit_eforge_plan_planning_result",lu="report_eforge_plan_planning_progress",qH=200,The=50,GH=4e3,Che=n.Object({currentSection:n.Optional(n.String()),coveredSections:n.Optional(n.Array(n.String())),remainingSections:n.Optional(n.Array(n.String())),message:n.Optional(n.String())},{additionalProperties:!1}),Lhe=n.Object({summary:n.String(),assumptionsOpenQuestions:n.Array(n.String()),nextSteps:n.Optional(n.Array(n.String())),recommendations:n.Optional(n.Object({},{additionalProperties:!0})),backlogCurationDraft:n.Optional(ea),handoffDraft:n.Optional(n.Object({},{additionalProperties:!0})),handoffDrafts:n.Optional(n.Array(n.Object({},{additionalProperties:!0}),{minItems:1})),planDrafts:n.Optional(n.Array(n.Object({title:n.String(),body:n.String()},{additionalProperties:!1}),{minItems:1})),sessionPlanPatch:n.Optional(n.Object({sections:n.Array(n.Object({dimension:n.String(),content:n.String()},{additionalProperties:!1}),{minItems:1}),skippedDimensions:n.Optional(n.Array(n.Object({dimension:n.String(),reason:n.String()},{additionalProperties:!1})))},{additionalProperties:!1})),planRevisionTurn:n.Optional(zl),decision:n.Optional(n.Union([n.Literal("ready"),n.Literal("needs-input")])),sessionPlanCreationDraft:n.Optional(QE),clarificationQuestions:n.Optional(n.Array(n.Object({question:n.String(),why:n.Optional(n.String()),options:n.Optional(n.Array(n.String()))},{additionalProperties:!1}),{minItems:1})),rationale:n.Optional(n.String())},{additionalProperties:!1});function ob(){return cE("eforge-plan-planning-draft-result",ts)}function Va(e,t=GH){let i=e.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g," ").trim();return i.length>t?`${i.slice(0,t-3)}...`:i}function Dhe(e){let t=e??{},i={};if(typeof t.currentSection=="string"){let r=CC(t.currentSection);r.length>0&&(i.currentSection=r)}if(Array.isArray(t.coveredSections)&&(i.coveredSections=zH(t.coveredSections.filter(r=>typeof r=="string"))),Array.isArray(t.remainingSections)&&(i.remainingSections=zH(t.remainingSections.filter(r=>typeof r=="string"))),typeof t.message=="string"){let r=CC(t.message);r.length>0&&(i.message=r)}return i}function jm(e,t=lu){return{name:t,description:"Report telemetry-only section progress while drafting. This never replaces the final submission and does not affect readiness.",inputSchema:Che,handler:async i=>{let r=Dhe(i);try{await e?.(r)}catch{}return"Section progress recorded."}}}function sb(e){let t,i=[],r=e.name??Ka;return{tool:{name:r,description:"Submit the final eforge-plan planning draft result. This is the only accepted output channel for this task.",inputSchema:Lhe,handler:async s=>{let a;try{if(a=Jl(s),t!==void 0)return rb(i,"Error: a planning result was already submitted. Submit exactly one final result.");let u=e.input===void 0?void 0:$he(a,e.input);if(u!==void 0)return rb(i,u)}catch(u){let l=u instanceof Error?u.message:String(u),p=e.input===void 0?void 0:Nhe(s,e.input),m=Va(`Submission rejected: ${l}`,p===void 0?GH:1500);return rb(i,`${m}${p===void 0?"":`
|
|
554
|
+
${p}`}
|
|
555
|
+
Fix the payload and call ${r} again.`)}let c=await e.validate?.(a,s),d=Array.isArray(c)?c:c===void 0?[]:[c];return d.length>0?rb(i,["Submission rejected by reducer validation:",...d].join(`
|
|
556
|
+
`)):(t=a,e.successMessage??"Planning draft result submitted successfully.")}},getSubmitted:()=>t,getRejections:()=>[...i]}}function rb(e,t){let i=Va(t);return e.push(i),i}function CC(e){let t=e.replace(/[\u0000-\u001f\u007f]/g," ").replace(/\s+/g," ").trim();return t.length>qH?`${t.slice(0,qH-3)}...`:t}function zH(e){return e.slice(0,The).map(CC).filter(t=>t.length>0)}function $he(e,t){let i=e,r=i.decision==="ready"?i.sessionPlanCreationDraft:void 0;if(r===void 0)return;let o=t.sessionPlanCreationReadiness;if(o?.resolved!==void 0&&(o.resolved.planningType!==r.planningType||o.resolved.planningDepth!==r.planningDepth))return["Submission rejected: sessionPlanCreationDraft planning contract mismatch.",`expected planningType/planningDepth: ${o.resolved.planningType}/${o.resolved.planningDepth}`,`actual planningType/planningDepth: ${r.planningType}/${r.planningDepth}`,"Copy the planningType and planningDepth from sessionPlanCreationReadiness.resolved, then call the submit tool again."].join(`
|
|
557
|
+
`);let s=KH(t,r.planningType,r.planningDepth);if(s===void 0)return;let a=new Set(s.requiredDimensions),c=r.sections.map(g=>g.dimension),d=r.skippedDimensions??[],u=[...new Set([...c,...d.map(g=>g.dimension)].filter(g=>!a.has(g)))],l=new Set(c.filter(g=>a.has(g))),p=new Set(d.filter(g=>a.has(g.dimension)&&g.reason.trim().length>0).map(g=>g.dimension)),m=[...new Set(d.filter(g=>a.has(g.dimension)&&g.reason.trim().length===0).map(g=>g.dimension))],f=s.requiredDimensions.filter(g=>!l.has(g)&&!p.has(g));if(!(u.length===0&&f.length===0&&m.length===0))return[`Submission rejected: sessionPlanCreationDraft does not satisfy the provided readiness contract for ${r.planningType}/${r.planningDepth}.`,`expected required dimension ids: ${s.requiredDimensions.join(", ")}`,...u.length>0?[`unknown dimension ids: ${u.join(", ")}`]:[],...f.length>0?[`missing required dimension ids: ${f.join(", ")}`]:[],...m.length>0?[`${m.join(", ")} has a blank skip reason; skipped required dimensions need non-empty reasons.`]:[],"Use exact kebab-case ids from sessionPlanCreationReadiness; do not use display-heading aliases such as Goal, Scope, or Validation.","Fix the payload and call the submit tool again, or emit needs-input if a ready draft cannot be produced."].join(`
|
|
558
|
+
`)}function KH(e,t,i){let r=e.sessionPlanCreationReadiness;if(r===void 0)return;if(r.resolved!==void 0&&r.resolved.planningType===t&&r.resolved.planningDepth===i)return r.resolved;let o=r.dimensionContract[t];if(o!==void 0)return o[i]}function Nhe(e,t){let i=e;if(i?.sessionPlanCreationDraft===void 0)return;let r=i.sessionPlanCreationDraft,o=typeof r.planningType=="string"&&typeof r.planningDepth=="string"?KH(t,r.planningType,r.planningDepth)??t.sessionPlanCreationReadiness?.resolved:t.sessionPlanCreationReadiness?.resolved;return["For sessionPlanCreationDraft, dimension values must be exact kebab-case ids from sessionPlanCreationReadiness.",...o!==void 0?[`expected required dimension ids: ${o.requiredDimensions.join(", ")}`]:[],"Do not use display-heading aliases such as Goal, Scope, or Validation."].join(`
|
|
559
|
+
`)}import{createHash as jhe}from"crypto";var Bhe="backlog-item-audit",Mhe="backlog-reducer",pu="submit_eforge_plan_backlog_item_finding",Uhe="prompts/eforge-plan-backlog-curation-item-audit.md",Fhe="prompts/eforge-plan-backlog-curation-reducer.md",qhe=n.Object({packet:US,runtimeIdentity:n.Optional(MS),promptVersion:n.Optional(n.String())},{additionalProperties:!1}),zhe=n.Object({reducerInput:FS,requestedOutputSections:n.Optional(n.Array(n.String())),validationErrors:n.Optional(n.Array(n.String()))},{additionalProperties:!1});function Ghe(e){let t=Qhe(e.input.packet),i=Vhe(t),r=e.input.promptVersion??SM,o,s=Hhe(t,i,r,e.input.runtimeIdentity,d=>{o=d}),a=jm(e.onProgress),c=e.effectiveCustomToolName??(d=>d);return{prompt:"",variables:{itemId:t.itemId,sourceFingerprint:t.sourceFingerprint,packetSha256:i,promptVersion:r,runtimeIdentityJson:JSON.stringify(e.input.runtimeIdentity??null,null,2),runtimeIdentityInstruction:e.input.runtimeIdentity===void 0?"Runtime identity was not provided by the server; include a valid `runtimeIdentity` in your submission.":"Runtime identity is server-owned; do not submit this field.",packetJson:JSON.stringify(t,null,2),submitTool:c(pu),progressTool:c(lu)},run:{role:"planner",toolsPreset:"read-only",tools:[s,a]},getResult:()=>o,missingResultMessage:`backlog curation item audit did not call ${c(pu)}.`}}function Khe(e){let t=Zhe(e.input.reducerInput),i=sb({validate:e.validateResult,successMessage:"Backlog curation reducer result submitted successfully."}),r=jm(e.onProgress),o=JSON.stringify(Jhe(t),null,2);if(NC(o)>BS)throw new Error(`Backlog curation reducer prompt input exceeds ${BS} bytes after sanitization.`);let s=e.effectiveCustomToolName??(a=>a);return{prompt:"",variables:{reducerInputJson:o,requestedOutputSections:e.input.requestedOutputSections?.join(", ")??"backlogCurationDraft, recommendations",validationErrors:JSON.stringify(e.input.validationErrors??[],null,2),submitTool:s(Ka),progressTool:s(lu),resultSchema:ob()},run:{role:"planner",toolsPreset:"none",tools:[i.tool,r]},getResult:i.getSubmitted,missingResultMessage:`Reducer did not call ${s(Ka)}.`}}function Vhe(e){return jhe("sha256").update(DC(e)).digest("hex")}function NC(e){return Buffer.byteLength(typeof e=="string"?e:JSON.stringify(e),"utf-8")}function Hhe(e,t,i,r,o){let s=!1;return{name:pu,description:"Submit the compact backlog curation finding for the single supplied item packet. This is the only accepted output channel.",inputSchema:qE,handler:async a=>{let c=ze(qE,a);if(!c.success)return`Submission rejected: ${Va(c.error.message)}
|
|
560
|
+
Fix the finding and call ${pu} again.`;let d=r??c.data.runtimeIdentity,u=zE({...c.data,runtimeIdentity:d});if(!u.success)return`Submission rejected: ${Va(u.error.message)}
|
|
561
|
+
Fix the finding and call ${pu} again.`;let l=Whe(u.data,e,t,i);return l!==void 0?l:s?`Submission rejected: ${Va("A backlog curation item finding has already been accepted for this packet.")}`:(s=!0,o(u.data),"Backlog curation item finding submitted successfully.")}}}function Whe(e,t,i,r){let o=[e.sourceFingerprint===t.sourceFingerprint?void 0:`sourceFingerprint mismatch: expected ${t.sourceFingerprint}.`,e.itemId===t.itemId?void 0:`itemId mismatch: expected ${t.itemId}.`,e.packetSha256===i?void 0:`packetSha256 mismatch: expected ${i}.`,e.bodySha256===t.bodySha256?void 0:`bodySha256 mismatch: expected ${t.bodySha256}.`,e.promptVersion===r?void 0:`promptVersion mismatch: expected ${r}.`,...Xhe(e),NC(e)<=Vl?void 0:`finding JSON exceeds ${Vl} bytes.`].filter(s=>s!==void 0);if(o.length!==0)return`Submission rejected: ${Va(o.join(`
|
|
562
|
+
`))}
|
|
563
|
+
Fix the finding and call ${pu} again.`}function Xhe(e){let t=[e.verdict===void 0?"verdict is required for current-source item audit findings.":void 0,(e.checkedPaths?.length??0)===0?"checkedPaths must include at least one source path inspected by the read-only item audit.":void 0];if(e.verdict==="shipped"||e.verdict==="superseded"){let i=new Set(e.closureEvidenceRoles??[]);!i.has("implementation")&&!i.has("replacement")&&t.push("shipped/superseded findings require implementation or replacement closureEvidenceRoles."),i.has("product-surface")||t.push("shipped/superseded findings require product-surface closureEvidenceRoles.")}return t.filter(i=>i!==void 0)}function Qhe(e){let t=ze(US,e);if(!t.success)throw new Error(`Invalid backlog curation item packet: ${t.error.message}`);let i=NC(t.data);if(i>NS)throw new Error(`Backlog curation item packet is ${i} bytes; cap is ${NS}.`);return t.data}function Zhe(e){let t=vM(e);if(!t.success)throw new Error(`Invalid backlog curation reducer input: ${t.error.message}`);return t.data}function DC(e){return Array.isArray(e)?`[${e.map(t=>DC(t)).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${DC(e[t])}`).join(",")}}`:JSON.stringify(e)}function Jhe(e){return Yhe($C(e))}function $C(e){if(Array.isArray(e))return e.map($C);if(e===null||typeof e!="object")return e;let t=new Set(["gitDelta","fullImplementationAudit","rawEvidence","rawBody","bodyMarkdown","fullBody"]);return Object.fromEntries(Object.entries(e).filter(([i])=>!t.has(i)).map(([i,r])=>[i,$C(r)]))}function Yhe(e){return!Io(e)||!Array.isArray(e.outcomes)||!Io(e.globalContext)?e:{schemaVersion:e.schemaVersion,sourceFingerprint:e.sourceFingerprint,generatedAt:e.generatedAt,globalContext:eIe(e.globalContext),outcomes:e.outcomes.map(tIe),diagnostics:cb(e.diagnostics,20)}}function eIe(e){return{schemaVersion:e.schemaVersion,purpose:e.purpose,sourceFingerprint:e.sourceFingerprint,generatedAt:e.generatedAt,curationGuidance:jC(e.curationGuidance,6,500),caps:e.caps,itemCount:e.itemCount,openItemIds:e.openItemIds,roadmapSummaries:LC(e.roadmapSummaries,10,300),dependencySummaries:LC(e.dependencySummaries,30,300),recommendationSummaries:LC(e.recommendationSummaries,30,300),redraftSummary:ab(e.redraftSummary,300),diagnostics:cb(e.diagnostics,20)}}function tIe(e){if(!Io(e))return e;let t={schemaVersion:e.schemaVersion,outcome:e.outcome,itemId:e.itemId,sourceFingerprint:e.sourceFingerprint,packetSha256:e.packetSha256,bodySha256:e.bodySha256,diagnostics:cb(e.diagnostics,4)};return Io(e.finding)&&(t.finding=nIe(e.finding)),typeof e.error=="string"&&(t.error=Nn(e.error,500)),Array.isArray(e.validationErrors)&&(t.validationErrors=jC(e.validationErrors,FE,300)),typeof e.reason=="string"&&(t.reason=Nn(e.reason,300)),typeof e.byteLength=="number"&&(t.byteLength=e.byteLength),typeof e.byteCap=="number"&&(t.byteCap=e.byteCap),t}function nIe(e){let t=e.disposition==="change"&&(e.verdict==="shipped"||e.verdict==="superseded");return{schemaVersion:e.schemaVersion,itemId:e.itemId,sourceFingerprint:e.sourceFingerprint,packetSha256:e.packetSha256,bodySha256:e.bodySha256,promptVersion:e.promptVersion,disposition:e.disposition,verdict:e.verdict,closureEvidenceRoles:e.closureEvidenceRoles,checkedPaths:rIe(e.checkedPaths,t?10:8),summary:typeof e.summary=="string"?Nn(e.summary,t?800:500):e.summary,rationale:typeof e.rationale=="string"?Nn(e.rationale,t?1200:900):e.rationale,citations:iIe(e.citations,t?8:6),recommendationSignals:t?[]:oIe(e.recommendationSignals),diagnostics:cb(e.diagnostics,t?2:4)}}function iIe(e,t){return Array.isArray(e)?[...e].filter(Io).sort((i,r)=>VH(i)-VH(r)).slice(0,t).map(i=>({kind:i.kind,source:typeof i.source=="string"?Nn(i.source,160):i.source,confidence:i.confidence,path:typeof i.path=="string"?Nn(i.path,220):i.path,excerpt:typeof i.excerpt=="string"?Nn(i.excerpt,220):i.excerpt,matchedBy:Array.isArray(i.matchedBy)?jC(i.matchedBy,4,80):void 0})):[]}function VH(e){return e.kind==="implementation"||Array.isArray(e.matchedBy)&&e.matchedBy.includes("replacement")?0:e.kind==="product-surface"?2:e.kind==="supporting"?3:e.kind==="current-source"?4:9}function rIe(e,t){return Array.isArray(e)?e.filter(Io).slice(0,t).map(i=>({path:typeof i.path=="string"?Nn(i.path,240):i.path,reason:typeof i.reason=="string"?Nn(i.reason,180):i.reason})):[]}function oIe(e){return Array.isArray(e)?e.filter(Io).slice(0,3).map(t=>({source:t.source,ref:t.ref,signal:typeof t.signal=="string"?Nn(t.signal,220):t.signal})):[]}function cb(e,t){if(!Array.isArray(e))return[];let i=e.filter(Io),r=i.filter(s=>s.code==="reducer-input-protected-terminal-omitted"),o=i.filter(s=>s.code!=="reducer-input-protected-terminal-omitted").slice(0,t);return[...r,...o].map(s=>({code:s.code,severity:s.severity,message:typeof s.message=="string"&&s.code!=="reducer-input-protected-terminal-omitted"?Nn(s.message,220):s.message,path:typeof s.path=="string"&&s.code!=="reducer-input-protected-terminal-omitted"?Nn(s.path,180):s.path}))}function LC(e,t,i){return Array.isArray(e)?e.slice(0,t).map(r=>ab(r,i)):[]}function jC(e,t,i){return Array.isArray(e)?e.flatMap(r=>typeof r=="string"?[Nn(r,i)]:[]).slice(0,t):[]}function ab(e,t){return typeof e=="string"?Nn(e,t):Array.isArray(e)?e.slice(0,12).map(i=>ab(i,t)):Io(e)?Object.fromEntries(Object.entries(e).slice(0,20).map(([i,r])=>[i,ab(r,t)])):e}function Nn(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-24))}\u2026[truncated ${e.length}]`}function Io(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var HH=[{id:Bhe,title:"Audit one backlog item for eforge-plan curation",description:"Inspect current source with read-only tools and submit one compact source-backed backlog item finding.",inputSchema:qhe,outputSchema:Hl,prompt:{kind:"asset",asset:Uhe},resolvePrompt:Ghe},{id:Mhe,title:"Reduce eforge-plan backlog curation findings",description:"Reduce compact map outcomes into the eforge-plan planning draft result shape without repository tools.",inputSchema:zhe,outputSchema:ts,prompt:{kind:"asset",asset:Fhe},resolvePrompt:Khe}];var BC="planning-draft",MC="session-plan-creation",UC="plan-revision",Bm="recommendation-refresh",sIe="prompts/eforge-plan-planning-draft.md";function aIe(e){let t=sb({input:e.input}),i=jm(e.onProgress),r=e.effectiveCustomToolName??(o=>o);return{prompt:"",variables:cIe(e.input,r),run:{role:"planner",tools:[t.tool,i]},getResult:t.getSubmitted,missingResultMessage:`eforge-plan planning draft task did not call ${r(Ka)}.`}}function cIe(e,t){return{topic:e.topic,session:e.session??"(none)",planningType:e.planningType??"(unspecified)",planningDepth:e.planningDepth??"(unspecified)",sourceText:e.sourceText??"(none)",existingSessionPlan:e.existingSessionPlan??"(none)",requestedOutputSections:e.requestedOutputSections?.join(", ")??"(agent should choose applicable sections)",submitTool:t(Ka),progressTool:t(lu),resultSchema:ob(),sessionPlanCreationReadiness:JSON.stringify(e.sessionPlanCreationReadiness??{},null,2)}}function db(e,t,i){return{id:e,title:t,description:i,inputSchema:XE,outputSchema:ts,prompt:{kind:"asset",asset:sIe},resolvePrompt:aIe}}var dIe=[db(BC,"Draft eforge-plan planning content","Draft recommendation, handoff, plan, patch, or creation content for eforge-plan."),db(MC,"Create an eforge-plan session-plan draft","Draft a ready session-plan creation payload using eforge-plan readiness contracts."),db(UC,"Draft an eforge-plan plan revision turn","Draft a bounded revision turn for an existing flat session plan."),db(Bm,"Refresh eforge-plan recommendations","Refresh recommendation-only planning output for the current eforge-plan recommendation source.")],WH=[...dIe,...HH];var XH="\u2026[truncated]";function ks(e,t,i,r){let o={},s=ub({...t},o);Array.isArray(s.items)&&s.items.length>25&&(o.omittedItems=s.items.length-25,s.items=s.items.slice(0,25)),Array.isArray(s.epics)&&s.epics.length>10&&(o.omittedEpics=s.epics.length-10,s.epics=s.epics.slice(0,10));let a=i!==void 0?ub({...i},o):void 0,c=JSON.stringify({userGoal:e,context:s,...a!==void 0&&{redraft:a},truncation:o},null,2);if(c.length>6e4){o.sourceTextTruncated=!0;let d=uIe(a,o),u=lIe(s.selection,o),l=r?.(s,o)??{schemaVersion:s.schemaVersion,selection:u};c=JSON.stringify({userGoal:e,context:l,...d!==void 0&&{redraft:d},truncation:o},null,2),c.length>6e4&&(c=`${c.slice(0,6e4-XH.length)}${XH}`)}return c}function uIe(e,t){if(e===void 0)return;t.redraftSummarized=!0;let i={};return typeof e.parentTaskId=="string"&&(i.parentTaskId=e.parentTaskId),typeof e.originalRequest=="string"&&(i.originalRequest=FC(e.originalRequest)),typeof e.steering=="string"&&(i.steering=FC(e.steering)),Array.isArray(e.previousQuestions)&&(i.previousQuestions=QH(e.previousQuestions,t,"omittedRedraftQuestions")),Array.isArray(e.userAnswers)&&(i.userAnswers=QH(e.userAnswers,t,"omittedRedraftAnswers")),i}function QH(e,t,i){return e.length>10&&(t[i]=e.length-10),e.slice(0,10).map(r=>typeof r=="string"?FC(r):r)}function FC(e){return e.length>1e3?`${e.slice(0,1e3)}\u2026[truncated]`:e}function lIe(e,t){if(e===null||typeof e!="object")return e;let i={};for(let[r,o]of Object.entries(e))Array.isArray(o)?(o.length>50&&(t[`omittedSelection_${r}`]=o.length-50),i[r]=o.slice(0,50).map(s=>typeof s=="string"?ZH(s):s)):i[r]=typeof o=="string"?ZH(o):o;return i}function ZH(e){return e.length>200?`${e.slice(0,200)}\u2026[truncated]`:e}function ub(e,t){return typeof e=="string"&&e.length>4e3?(t.truncatedStrings=Number(t.truncatedStrings??0)+1,`${e.slice(0,4e3)}\u2026[truncated]`):Array.isArray(e)?e.map(i=>ub(i,t)):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([i,r])=>[i,ub(r,t)])):e}import{existsSync as Zbe}from"fs";import{relative as T4}from"path";function JH(e,t){return{id:e.id,title:e.title,status:e.status,...e.epic!==void 0&&{epic:e.epic},tags:e.tags,dependencies:e.depends_on,sections:Object.fromEntries(zt(e.body)),sourceReferences:t?[t]:[]}}function YH(e){return{id:e.id,title:e.title,status:e.status,tags:e.tags,sections:Object.fromEntries(zt(e.body))}}function e4(e){let t=new Map(da(e).map(i=>[i.itemId,i]));return ad(e).map(i=>({...i,blockers:t.get(i.itemId)?.blockers??[],risks:t.get(i.itemId)?.risks??[]}))}function GC(e){let t=n4(e.currentItems,Mm(e.draft,"itemChanges")),i=n4(e.currentEpics,Mm(e.draft,"epicChanges")),r=new Map(i.map(u=>[u.id,u])),o=new Set([...Mm(e.draft,"itemChanges").values()].filter(u=>mb(u.status)).map(u=>u.id)),s=new Set([...Mm(e.draft,"epicChanges").values()].filter(u=>mb(u.status)).map(u=>u.id));if(e.generatedRecommendations===void 0)return{prospectiveItems:t,prospectiveEpics:i,removed:{itemIds:[],epicIds:[]},repositioned:[],validation:{valid:!0,issues:[]},summary:void 0};let a=new Map(t.map(u=>[u.id,u])),c=pIe(e.generatedRecommendations,a,r,o,s,Mm(e.draft,"itemChanges")),d=gIe(c.recommendations,t,i);return{prospectiveItems:t,prospectiveEpics:i,effectiveRecommendations:c.recommendations,removed:{itemIds:[...c.removedItemIds].sort(),epicIds:[...c.removedEpicIds].sort()},repositioned:c.repositioned.sort(bIe),validation:d,summary:Sn(c.recommendations)}}function pIe(e,t,i,r,o,s){let a=new Set,c=new Set,d=[],u=new Map,l=new Map,p=qC(e.activeWork,"activeWork",t,r,a,d,u,l,s),m=qC(e.readyCandidates,"readyCandidates",t,r,a,d,u,l,s),f=qC(e.recommendedNextSequence,"recommendedNextSequence",t,r,a,d,u,l,s),g=e.safeParallelizableGroups.flatMap(_=>mIe(_,t,i,r,o,a,c,d,u,s)),y=e.blockedChains.flatMap(_=>fIe(_,t,r,a,d,u,s)),R=new Set(p.map(_=>_.itemId));for(let[_,$]of u)R.has(_)||p.push($);let A=new Set(m.map(_=>_.itemId));for(let[_,$]of l)!A.has(_)&&!hIe(_,m,f,g,y)&&m.push($);return{recommendations:{...IIe(e),activeWork:zC(p),readyCandidates:zC(m),recommendedNextSequence:zC(f),safeParallelizableGroups:g,blockedChains:y,rationaleAndAssumptions:yIe(e.rationaleAndAssumptions,a,c,d)},removedItemIds:a,removedEpicIds:c,repositioned:d}}function qC(e,t,i,r,o,s,a,c,d){let u=[];for(let l of e){if(r.has(l.itemId)){o.add(l.itemId);continue}let p=d.get(l.itemId)?.status;if(KC(l.itemId,i,p)&&t!=="activeWork"){a.has(l.itemId)||a.set(l.itemId,Ha(l)),s.push({itemId:l.itemId,from:t,to:"activeWork"});continue}if(p==="planned"&&t==="activeWork"){c.has(l.itemId)||c.set(l.itemId,Ha(l)),s.push({itemId:l.itemId,from:"activeWork",to:"readyCandidates"});continue}u.push(Ha(l))}return u}function mIe(e,t,i,r,o,s,a,c,d,u){let l=[];for(let m of e.itemIds)r.has(m)?s.add(m):KC(m,t,u.get(m)?.status)?(d.has(m)||d.set(m,{itemId:m,...e.rationale!==void 0&&{rationale:e.rationale}}),c.push({itemId:m,from:`safeParallelizableGroups.${e.ref}.itemIds`,to:"activeWork"})):l.push(m);let p=e.epicIds?.filter(m=>{let f=o.has(m)&&i.has(m);return f&&a.add(m),!f});return l.length===0&&e.itemIds.length>0?[]:[{...e,itemIds:l,...e.epicIds!==void 0&&{epicIds:p}}]}function fIe(e,t,i,r,o,s,a){let c=[],d=e.ref??"<unreferenced>";for(let l of e.itemIds)i.has(l)?r.add(l):KC(l,t,a.get(l)?.status)?(s.has(l)||s.set(l,{itemId:l,...e.rationale!==void 0&&{rationale:e.rationale}}),o.push({itemId:l,from:`blockedChains.${d}.itemIds`,to:"activeWork"})):c.push(l);let u=e.blockedBy.filter(l=>{let p=i.has(l)||!t.has(l);return i.has(l)&&r.add(l),!p});return c.length===0?[]:[{...e,itemIds:c,blockedBy:u}]}function KC(e,t,i){if(i!==void 0)return i==="active";let r=t.get(e);return r?.status==="active"||r?.lifecycleState==="active"||r?.lifecycleState==="queue"||r?.lifecycleState==="build"||r?.lifecycleState==="pr-open"}function gIe(e,t,i){let r=new Map(t.map(a=>[a.id,a])),o=new Map(i.map(a=>[a.id,a])),s=[];e.activeWork.forEach((a,c)=>{mu(`activeWork[${c}].itemId`,a.itemId,r,"item",s),lb(`activeWork[${c}].itemId`,a.itemId,r,"activeWork",s)});for(let[a,c]of[["readyCandidates",e.readyCandidates],["recommendedNextSequence",e.recommendedNextSequence]])c.forEach((d,u)=>{mu(`${a}[${u}].itemId`,d.itemId,r,"item",s),lb(`${a}[${u}].itemId`,d.itemId,r,a,s)});for(let a of e.safeParallelizableGroups){a.itemIds.length===0&&s.push(pb(`safeParallelizableGroups.${a.ref}.itemIds`,"","item","empty",void 0,"Recommendation safe parallel group must include at least one open item id."));for(let c of a.itemIds)mu(`safeParallelizableGroups.${a.ref}.itemIds`,c,r,"item",s),lb(`safeParallelizableGroups.${a.ref}.itemIds`,c,r,"safeParallelizableGroups.itemIds",s);for(let c of a.epicIds??[])mu(`safeParallelizableGroups.${a.ref}.epicIds`,c,o,"epic",s)}for(let a of e.blockedChains){let c=a.ref??"<unreferenced>";for(let d of a.itemIds)mu(`blockedChains.${c}.itemIds`,d,r,"item",s),lb(`blockedChains.${c}.itemIds`,d,r,"blockedChains.itemIds",s);for(let d of a.blockedBy)mu(`blockedChains.${c}.blockedBy`,d,r,"item",s)}return{valid:s.length===0,issues:s}}function lb(e,t,i,r,o){let s=i.get(t);if(s===void 0||mb(s.status))return;let a=s.lifecycleState,c=a==="active"||a==="queue"||a==="build"||a==="pr-open";if(r==="activeWork"){s.status!=="active"&&!c&&o.push(t4(e,t,s,'activeWork expects prospective status "active" or lifecycle state active/queue/build/pr-open'));return}s.status==="active"&&o.push(t4(e,t,s,`${r} must not reference prospective active items`))}function mu(e,t,i,r,o){let s=i.get(t);if(s===void 0){o.push(pb(e,t,r,"unknown",void 0,`Recommendation ${e} references unknown ${r} id "${t}".`));return}mb(s.status)&&o.push(pb(e,t,r,"closed",s,`Recommendation ${e} references closed ${r} id "${t}" with prospective status "${s.status}".`))}function t4(e,t,i,r){return pb(e,t,"item","wrong-lane",i,`Recommendation ${e} references item id "${t}" with prospective status "${i.status}"; ${r}.`)}function pb(e,t,i,r,o,s){return{path:e,id:t,kind:i,reason:r,...o?.status!==void 0&&rs(o.status)&&{status:o.status},...o?.title!==void 0&&{title:o.title},message:s}}function n4(e,t){return e.map(i=>({...i,...t.get(i.id)?.status!==void 0&&{status:t.get(i.id).status}}))}function Mm(e,t){if(e===null||typeof e!="object")return new Map;let i=e[t];return Array.isArray(i)?new Map(i.flatMap(r=>{if(r===null||typeof r!="object")return[];let o=r,s=SIe(o.metadata);return typeof o.id=="string"&&typeof s=="string"?[[o.id,{id:o.id,status:s}]]:[]})):new Map}function SIe(e){if(e===null||typeof e!="object")return;let t=e.status;return typeof t=="string"?t:void 0}function yIe(e,t,i,r){if(t.size===0&&i.size===0&&r.length===0)return[...e];let o=[t.size>0?`removed items ${[...t].sort().join(", ")}`:void 0,i.size>0?`removed epics ${[...i].sort().join(", ")}`:void 0,r.length>0?`repositioned items ${[...new Set(r.map(s=>s.itemId))].sort().join(", ")}`:void 0].filter(s=>s!==void 0);return[...e,`Adjusted generated recommendations for the prospective curation state (${o.join("; ")}).`]}function hIe(e,t,i,r,o){return t.some(s=>s.itemId===e)||i.some(s=>s.itemId===e)||r.some(s=>s.itemIds.includes(e))||o.some(s=>s.itemIds.includes(e))}function zC(e){let t=new Set;return e.flatMap(i=>t.has(i.itemId)?[]:(t.add(i.itemId),[Ha(i)]))}function IIe(e){return{...e,activeWork:e.activeWork.map(Ha),readyCandidates:e.readyCandidates.map(Ha),recommendedNextSequence:e.recommendedNextSequence.map(Ha),safeParallelizableGroups:e.safeParallelizableGroups.map(t=>({...t,itemIds:[...t.itemIds],...t.epicIds!==void 0&&{epicIds:[...t.epicIds]}})),blockedChains:e.blockedChains.map(t=>({...t,itemIds:[...t.itemIds],blockedBy:[...t.blockedBy]})),rationaleAndAssumptions:[...e.rationaleAndAssumptions]}}function Ha(e){return{...e}}function mb(e){return rs(e)&&Ji(e)}function bIe(e,t){return e.itemId.localeCompare(t.itemId)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}import{execFile as MIe}from"child_process";import{mkdir as UIe,readFile as FIe,writeFile as qIe}from"fs/promises";import{dirname as zIe,join as GIe}from"path";import{promisify as KIe}from"util";import{execFile as EIe}from"child_process";import{promisify as PIe}from"util";import{Buffer as HC}from"buffer";var ar={candidateCount:20,gitCommitScanCount:80,changedPathCount:12,changedPathBytes:120,prEnrichmentCount:6,excerptCount:3,excerptBytes:320,branchHintCount:5,diagnosticCount:12,subprocessTimeoutMs:3500};var Dr={candidateCount:100,gitCommitScanCount:500,changedPathCount:100,changedPathBytes:500,prEnrichmentCount:25,excerptCount:10,excerptBytes:2e3,branchHintCount:25,diagnosticCount:50,subprocessTimeoutMs:15e3},VC=`
|
|
564
|
+
\u2026[truncated]`;function $r(e={}){return{candidateCount:bo(e.candidateCount,ar.candidateCount,Dr.candidateCount),gitCommitScanCount:bo(e.gitCommitScanCount,ar.gitCommitScanCount,Dr.gitCommitScanCount),changedPathCount:bo(e.changedPathCount,ar.changedPathCount,Dr.changedPathCount),changedPathBytes:bo(e.changedPathBytes,ar.changedPathBytes,Dr.changedPathBytes),prEnrichmentCount:bo(e.prEnrichmentCount,ar.prEnrichmentCount,Dr.prEnrichmentCount),excerptCount:bo(e.excerptCount,ar.excerptCount,Dr.excerptCount),excerptBytes:bo(e.excerptBytes,ar.excerptBytes,Dr.excerptBytes),branchHintCount:bo(e.branchHintCount,ar.branchHintCount,Dr.branchHintCount),diagnosticCount:bo(e.diagnosticCount,ar.diagnosticCount,Dr.diagnosticCount),subprocessTimeoutMs:RIe(e.subprocessTimeoutMs,ar.subprocessTimeoutMs,Dr.subprocessTimeoutMs)}}function Nr(e,t){let i=Math.max(0,Math.floor(t));if(HC.byteLength(e,"utf8")<=i)return e;if(i===0)return"";let r=HC.byteLength(VC,"utf8");return i<=r?i4(VC,i):`${i4(e,i-r)}${VC}`}function fu(e,t){return e.slice(0,t.changedPathCount).map(i=>Nr(i,t.changedPathBytes))}function bo(e,t,i){return typeof e!="number"||!Number.isFinite(e)||e<0?t:Math.min(Math.floor(e),i)}function RIe(e,t,i){return typeof e!="number"||!Number.isFinite(e)||e<=0?t:Math.min(Math.floor(e),i)}function i4(e,t){let i="",r=0;for(let o of e){let s=HC.byteLength(o,"utf8");if(r+s>t)break;i+=o,r+=s}return i}var kIe=PIe(EIe),r4="",Wa="";async function fb(e,t={},i={},r){let o=$r(i),s=[];gu(r);let a=await WC(e,["rev-parse","--is-inside-work-tree"],o,void 0,r);if(!a.ok)return{records:[],diagnostics:[{code:"gitUnavailable",message:"Git history is unavailable for shipped-evidence collection.",detail:a.detail}]};if(a.stdout.trim()!=="true")return{records:[],diagnostics:[{code:"gitUnavailable",message:"Git history is unavailable for shipped-evidence collection."}]};let c=OIe(t.maxCount,o.gitCommitScanCount,t.allowOverflowProbe===!0);if(c===0)return{records:[],diagnostics:[]};gu(r);let d=t.revisionRange===void 0?[]:[t.revisionRange],u=await WC(e,["log","--date-order",`--max-count=${c}`,`--format=${r4}%H${Wa}%h${Wa}%P${Wa}%cI${Wa}%s${Wa}%b`,...d],o,void 0,r);if(!u.ok)return{records:[],diagnostics:[{code:"gitCommandFailed",message:"Unable to read reachable git log.",detail:u.detail}]};let l=[];for(let p of u.stdout.split(r4).map(m=>m.trim()).filter(Boolean)){gu(r);let[m,f,g,y,R,...A]=p.split(Wa);if(!m||!f||!R)continue;let D=A.join(Wa).trim(),_=(g??"").split(/\s+/).filter(Boolean),$=await AIe(e,m,o,s,r),M=`${R}
|
|
565
|
+
${D}`;l.push({source:"git-history",hash:m,shortHash:f,subject:R,...D.length>0&&{body:D},...y&&{committedAt:y},parents:_,isMerge:_.length>1,prNumbers:vIe(M),branchHints:_Ie(M).slice(0,o.branchHintCount),changedPaths:$})}return{records:l,diagnostics:s.slice(0,o.diagnosticCount)}}function vIe(e){let t=[...e.matchAll(/(?:pull request|pr)\s*#?(\d{1,8})/gi)].map(i=>Number(i[1]));return[...new Set(t.filter(i=>Number.isSafeInteger(i)&&i>0))]}function _Ie(e){let t=[...[...e.matchAll(/from\s+([A-Za-z0-9_.-]+\/[A-Za-z0-9_./-]+)/gi)].map(i=>i[1]),...[...e.matchAll(/(?:branch|head|source)[:\s]+([A-Za-z0-9_./-]+)/gi)].map(i=>i[1])];return[...new Set(t.filter(i=>i.length>0))].sort()}async function AIe(e,t,i,r,o){gu(o);let s=await WC(e,["diff-tree","--no-commit-id","--name-only","-r","-m",t],i,void 0,o);if(!s.ok)return r.push({code:"gitCommandFailed",message:`Unable to read changed paths for ${t.slice(0,12)}.`,detail:s.detail}),[];let a=[...new Set(s.stdout.split(/\r?\n/).map(d=>d.trim()).filter(Boolean))],c=fu(a,i);return a.length>c.length&&r.push({code:"capExceeded",message:`Changed paths capped for ${t.slice(0,12)}.`}),c}async function WC(e,t,i,r=1024*1024,o){try{gu(o);let{stdout:s,stderr:a}=await kIe("git",[...t],{cwd:e,timeout:i.subprocessTimeoutMs,maxBuffer:r,signal:o});return{ok:!0,stdout:`${s}`||`${a}`}}catch(s){return gu(o),{ok:!1,detail:s instanceof Error?s.message:String(s)}}}function OIe(e,t,i){let r=t,o=typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):r,s=Math.min(o,t);return s===0?0:s+(i?1:0)}function gu(e){if(e?.aborted)throw new Error("Shipped evidence git collection was aborted.")}import{execFile as wIe}from"child_process";import{promisify as TIe}from"util";var CIe=TIe(wIe);async function gb(e){let t=$r(e.caps),i=[...new Set(e.numbers)].slice(0,t.prEnrichmentCount),r=[];e.numbers.length>i.length&&r.push({code:"capExceeded",message:`PR enrichment capped at ${t.prEnrichmentCount} pull requests.`});let o=[];for(let s of i){o4(e.signal);let a=await LIe(e.cwd,s,t,e.signal);if(a.ok?o.push(a.pr):r.push(a.diagnostic),r.length>=t.diagnosticCount)break}return{pullRequests:o,diagnostics:r.slice(0,t.diagnosticCount)}}async function LIe(e,t,i,r){try{let{stdout:o}=await CIe("gh",["pr","view",String(t),"--json","number,title,body,url,state,mergedAt,headRefName,baseRefName,mergeCommit,files"],{cwd:e,timeout:i.subprocessTimeoutMs,maxBuffer:262144,signal:r});return{ok:!0,pr:DIe(JSON.parse(String(o)),i)}}catch(o){return o4(r),{ok:!1,diagnostic:$Ie(t,o)}}}function o4(e){if(e?.aborted)throw new Error("Shipped evidence PR enrichment was aborted.")}function DIe(e,t){let i=s4(e.mergeCommit);return{source:"pr-history",number:BIe(e.number,0),title:Ro(e.title),body:jIe(e.body,t.excerptBytes*2),url:Ro(e.url),state:Ro(e.state),mergedAt:Ro(e.mergedAt),headRefName:Ro(e.headRefName),baseRefName:Ro(e.baseRefName),mergeCommitOid:Ro(i.oid),changedPaths:fu(NIe(e.files),t)}}function $Ie(e,t){let i=t instanceof Error?t.message:String(t),r=i.toLowerCase();return r.includes("timed out")||r.includes("timeout")?{code:"prTimeout",message:`Timed out enriching PR #${e}.`,detail:i}:r.includes("enoent")||r.includes("not found")?{code:"prUnavailable",message:"GitHub CLI is unavailable for PR enrichment.",detail:i}:r.includes("authentication")||r.includes("not logged")||r.includes("auth")?{code:"prUnauthenticated",message:"GitHub CLI is not authenticated for PR enrichment.",detail:i}:r.includes("rate limit")?{code:"prRateLimited",message:"GitHub API rate limit prevented PR enrichment.",detail:i}:{code:"prCommandFailed",message:`Unable to enrich PR #${e}.`,detail:i}}function NIe(e){return Array.isArray(e)?e.map(t=>Ro(s4(t).path)).filter(t=>t!==void 0):[]}function s4(e){return e!==null&&typeof e=="object"?e:{}}function Ro(e){return typeof e=="string"&&e.length>0?e:void 0}function jIe(e,t){let i=Ro(e);return i===void 0?void 0:Nr(i,t)}function BIe(e,t){return typeof e=="number"&&Number.isSafeInteger(e)?e:t}var VIe=KIe(MIe),HIe=".eforge/storage/extensions/eforge-plan/analysis-baseline/current.json",WIe="^(?:[a-f0-9]{40}|[a-f0-9]{64})$",XIe=20,JC=n.Object({schemaVersion:n.Literal(1),taskId:n.String({minLength:1}),passKind:n.String({minLength:1}),sourceFingerprint:n.String({minLength:1}),acceptedAt:n.String({minLength:1}),git:n.Object({headCommit:n.Union([n.String({pattern:WIe}),n.Null()]),headCommittedAt:n.Optional(n.String())},{additionalProperties:!1}),coverage:n.Object({},{additionalProperties:!0}),diagnostics:n.Array(n.Object({},{additionalProperties:!0}))},{additionalProperties:!1}),Su={commitScanCount:80,changedPathCount:12,excerptCount:3,excerptBytes:320,prEnrichmentCount:6,subprocessTimeoutMs:3500},yu={commitScanCount:500,changedPathCount:100,excerptCount:10,excerptBytes:2e3,prEnrichmentCount:25,subprocessTimeoutMs:15e3};function d4(e){return GIe(e,HIe)}async function u4(e,t){let i={...t,schemaVersion:1};if(!gr.Check(JC,i))throw new Error("Invalid accepted-analysis baseline sidecar.");let r=d4(e);return await UIe(zIe(r),{recursive:!0}),await qIe(r,`${JSON.stringify(i,null,2)}
|
|
566
|
+
`),i}async function l4(e){return(await p4(e)).gitDelta}async function p4(e){let t=tbe(e.caps),i=[],r=await QIe(e.cwd);YC(e.signal);let o=await hu(e.cwd,["rev-parse","--is-inside-work-tree"],t,e.signal);if(!o.ok||o.stdout.trim()!=="true")return i.push({code:"git-unavailable",severity:"warning",message:"Git is unavailable for backlog curation git-delta collection.",detail:o.ok?void 0:o.detail}),{gitDelta:QC(XC(r),null,{kind:"unavailable",reason:"git-unavailable"},t,[],i),gitHistory:a4(o.ok?void 0:o.detail)};let s=await JIe(e.cwd,t,e.signal);if(s===null)return i.push({code:"git-unavailable",severity:"warning",message:"Unable to resolve current HEAD for backlog curation git-delta collection."}),{gitDelta:QC(XC(r),null,{kind:"unavailable",reason:"git-unavailable"},t,[],i),gitHistory:a4()};let a=XC(r),c={kind:"fallback",reason:"baseline-missing"},d;if(r.kind==="missing")i.push({code:"baseline-missing",severity:"info",message:"Accepted-analysis baseline sidecar is missing; scanning bounded recent history."});else if(r.kind==="invalid")i.push({code:"baseline-invalid-sidecar",severity:"warning",message:"Accepted-analysis baseline sidecar is invalid; scanning bounded recent history.",detail:r.detail});else if(r.baseline.git.headCommit===null)i.push({code:"baseline-missing",severity:"info",message:"Accepted-analysis baseline has no git HEAD; scanning bounded recent history."});else{let A=r.baseline.git.headCommit,D=await hu(e.cwd,["rev-parse","--is-shallow-repository"],t,e.signal);D.ok&&D.stdout.trim()==="true"?i.push({code:"baseline-shallow",severity:"warning",message:"Repository is shallow; scanning bounded recent history.",commit:A}):!await YIe(e.cwd,A,t,e.signal)||!await ebe(e.cwd,A,s.commit,t,e.signal)?i.push({code:"baseline-unreachable",severity:"warning",message:"Accepted-analysis baseline commit is unavailable or not an ancestor of HEAD; scanning bounded recent history.",commit:A}):(d=`${A}..${s.commit}`,c={kind:"complete",range:d})}let u=await fb(e.cwd,{revisionRange:d,maxCount:t.commitScanCount,allowOverflowProbe:!0},ZC(t),e.signal),l=c.kind==="complete"&&nbe(u.diagnostics),p=l?u.diagnostics:[];l&&(c={kind:"fallback",reason:"git-command-failed"},u=await fb(e.cwd,{maxCount:t.commitScanCount,allowOverflowProbe:!0},ZC(t),e.signal));let m=u.records.length>t.commitScanCount,f=u.records.slice(0,t.commitScanCount);i.push(...c4(p),...c4(u.diagnostics)),l&&i.push({code:"git-command-failed",severity:"warning",message:"Complete git-delta range scan failed; scanning bounded recent history instead."}),m&&(i.push({code:"scan-cap-truncated",severity:"warning",message:`Git delta scan capped at ${t.commitScanCount} commits.`}),c.kind==="complete"&&(c={kind:"fallback",reason:"scan-cap-truncated"})),c.kind!=="complete"&&(c={kind:"fallback",reason:i.find(A=>A.code.startsWith("baseline-"))?.code??c.reason??"fallback-recent-history"});let g;e.enrichPullRequests!==!1&&(g=await gb({cwd:e.cwd,numbers:f.flatMap(A=>A.prNumbers),caps:ZC(t),signal:e.signal}),i.push(...g.diagnostics.map(rbe)));let y=new Map((g?.pullRequests??[]).map(A=>[A.number,A])),R={records:f,diagnostics:u.diagnostics};return{gitDelta:QC(a,s,c,t,f.map(A=>ZIe(A,y,t)),i),gitHistory:R,...g&&{pullRequestEnrichment:g}}}async function QIe(e){try{let t=JSON.parse(await FIe(d4(e),"utf8"));return gr.Check(JC,t)?{kind:"valid",baseline:t}:{kind:"invalid",detail:[...gr.Errors(JC,t)].map(i=>i.message).join("; ")}}catch(t){return t.code==="ENOENT"?{kind:"missing"}:{kind:"invalid",detail:t instanceof Error?t.message:String(t)}}}function XC(e){return e.kind==="missing"?{source:"missing",commit:null}:e.kind==="invalid"?{source:"invalid-sidecar",commit:null}:{source:e.baseline.git.headCommit===null?"unavailable":"accepted-analysis-sidecar",commit:e.baseline.git.headCommit,time:e.baseline.git.headCommittedAt,taskId:e.baseline.taskId,sourceFingerprint:e.baseline.sourceFingerprint}}function QC(e,t,i,r,o,s){return{baseline:e,currentHead:t,coverage:i,caps:r,scannedCommitCount:o.length,scannedCommits:o,affectedItemCandidates:[],diagnostics:s.slice(0,XIe)}}function a4(e){return{records:[],diagnostics:[{code:"gitUnavailable",message:"Git history is unavailable for shipped-evidence collection.",...e&&{detail:e}}]}}function ZIe(e,t,i){let r=e.prNumbers.map(o=>t.get(o)).find(o=>o!==void 0);return{hash:e.hash,shortHash:e.shortHash,subject:Nr(e.subject,i.excerptBytes),...e.body&&{bodyExcerpt:Nr(e.body,i.excerptBytes)},...e.committedAt&&{committedAt:e.committedAt},parents:e.parents,isMerge:e.isMerge,changedPaths:e.changedPaths.slice(0,i.changedPathCount),branchHints:e.branchHints,prNumbers:e.prNumbers.slice(0,i.prEnrichmentCount),...r&&{pr:{number:r.number,title:r.title,url:r.url,state:r.state,mergedAt:r.mergedAt,headRefName:r.headRefName,baseRefName:r.baseRefName,mergeCommitOid:r.mergeCommitOid,changedPaths:r.changedPaths.slice(0,i.changedPathCount)}}}}async function JIe(e,t,i){let r=await hu(e,["rev-parse","HEAD"],t,i);if(!r.ok)return null;let o=await hu(e,["show","-s","--format=%cI","HEAD"],t,i);return{commit:r.stdout.trim(),...o.ok&&{time:o.stdout.trim()}}}async function YIe(e,t,i,r){return(await hu(e,["cat-file","-e",`${t}^{commit}`],i,r)).ok}async function ebe(e,t,i,r,o){return(await hu(e,["merge-base","--is-ancestor",t,i],r,o)).ok}async function hu(e,t,i,r){try{YC(r);let{stdout:o}=await VIe("git",[...t],{cwd:e,timeout:i.subprocessTimeoutMs,maxBuffer:1024*1024,signal:r});return{ok:!0,stdout:String(o)}}catch(o){return YC(r),{ok:!1,detail:o instanceof Error?o.message:String(o)}}}function tbe(e={}){return{commitScanCount:Um(e.commitScanCount,Su.commitScanCount,yu.commitScanCount),changedPathCount:Um(e.changedPathCount,Su.changedPathCount,yu.changedPathCount),excerptCount:Um(e.excerptCount,Su.excerptCount,yu.excerptCount),excerptBytes:Um(e.excerptBytes,Su.excerptBytes,yu.excerptBytes),prEnrichmentCount:Um(e.prEnrichmentCount,Su.prEnrichmentCount,yu.prEnrichmentCount),subprocessTimeoutMs:obe(e.subprocessTimeoutMs,Su.subprocessTimeoutMs,yu.subprocessTimeoutMs)}}function ZC(e){return $r({gitCommitScanCount:e.commitScanCount,changedPathCount:e.changedPathCount,excerptCount:e.excerptCount,excerptBytes:e.excerptBytes,prEnrichmentCount:e.prEnrichmentCount,subprocessTimeoutMs:e.subprocessTimeoutMs})}function nbe(e){return e.some(t=>t.code==="gitUnavailable"||t.code==="gitCommandFailed"&&t.message==="Unable to read reachable git log.")}function c4(e){return e.map(t=>({code:ibe(t),severity:"warning",message:t.message,detail:t.detail}))}function ibe(e){return e.code==="capExceeded"?e.message.startsWith("Changed paths capped")?"changed-path-cap-truncated":"scan-cap-truncated":e.code==="gitUnavailable"?"git-unavailable":"git-command-failed"}function rbe(e){return{code:e.code==="capExceeded"?"pr-cap-truncated":"pr-enrichment-unavailable",severity:"warning",message:e.message,detail:e.detail}}function Um(e,t,i){return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.min(Math.floor(e),i):t}function obe(e,t,i){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.min(Math.floor(e),i):t}function YC(e){if(e?.aborted)throw new Error("Backlog curation git-delta collection was aborted.")}async function Sb(e,t){if(t.sourceFingerprint===void 0||t.sourceFingerprint.trim().length===0)return;let i=await l4({cwd:e,enrichPullRequests:!1});await u4(e,{taskId:t.taskId,passKind:sbe(t),sourceFingerprint:t.sourceFingerprint,acceptedAt:t.acceptedAt??new Date().toISOString(),git:{headCommit:i.currentHead?.commit??null,...i.currentHead?.time!==void 0&&{headCommittedAt:i.currentHead.time}},coverage:i.coverage,diagnostics:i.diagnostics})}function sbe(e){return e.passKind}var Fm="Shipped evidence: current source \u2014 ",eL="Shipped evidence: lifecycle trace \u2014 ",tL="Shipped evidence: inferred from git/PR history \u2014 ",qm="Superseded evidence: current source \u2014 ",nL="Superseded evidence: lifecycle trace \u2014 ",iL="Superseded evidence: inferred from git/PR history \u2014 ",m4="Ambiguous shipped candidate: needs input \u2014 ",f4="Ambiguous superseded candidate: needs input \u2014 ",abe={shipped:[eL,tL],superseded:[nL,iL]},cbe={shipped:[Fm],superseded:[qm]},dbe=[Fm,eL,tL,qm,nL,iL,m4,f4];function g4(e,t,i={}){if(e!=="shipped"&&e!=="superseded")return!0;let r=(t??[]).map(c=>c.trim()).filter(Boolean);if(r.length===0)return!1;let o=i.allowCurrentSource===!0?cbe[e]:abe[e],s=r.some(c=>o.some(d=>c.startsWith(d))),a=r.some(c=>dbe.some(d=>c.startsWith(d))&&!o.some(d=>c.startsWith(d)));return s&&!a}function yb(e,t){let i=e;for(let r of t)i=S4(i,r);return i}function rL(e,t){let i=t.map(r=>r.trim()).filter(Boolean).map(r=>`- ${r}`).join(`
|
|
567
|
+
`);return i.length===0?e:S4(e,{heading:"Evidence",action:"append",content:i})}function oL(e,t){return t.length===0?e:t.split("/").filter(Boolean).reduce((i,r)=>/^\d+$/.test(r)?`${i}[${r}]`:`${i}.${r}`,e)}function S4(e,t){let i=t.heading.trim(),r=ube(e),o=r.findIndex(l=>new RegExp(`^#{2,6}\\s+${pbe(i)}\\s*$`).test(l.replace(/\r?\n$/u,"")));if(o===-1)return lbe(e,i,t.content);let s=r.length;for(let l=o+1;l<r.length;l+=1)if(/^#{2,6}\s+/.test(r[l])){s=l;break}let a=r.slice(0,o+1).join(""),c=r.slice(o+1,s).join("").trim(),d=r.slice(s).join(""),u=t.action==="replace"||c.length===0?t.content.trim():`${c}
|
|
568
|
+
|
|
569
|
+
${t.content.trim()}`;return`${a}
|
|
570
|
+
${u}
|
|
571
|
+
${d.startsWith(`
|
|
572
|
+
`)||d.length===0?"":`
|
|
573
|
+
`}${d}`}function ube(e){let t=e.match(/.*(?:\r?\n|$)/gu)??[];return t.filter((i,r)=>i.length>0||r<t.length-1)}function lbe(e,t,i){return`${e.trimEnd()}
|
|
574
|
+
|
|
575
|
+
## ${t}
|
|
576
|
+
|
|
577
|
+
${i.trim()}
|
|
578
|
+
`}function pbe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}import{mkdir as wst,readFile as Rbe,writeFile as Tst}from"fs/promises";import{dirname as Lst}from"path";import{open as sst,readdir as ast}from"fs/promises";import{join as dst,relative as ust,sep as lst}from"path";function xo(e){return Number.isInteger(e)&&typeof e=="number"&&e>0?Math.min(e,Rm):bm}async function sL(e,t){let i;try{i=await Rbe(xbe(e,t),"utf-8")}catch(a){if(a instanceof Error&&"code"in a&&a.code==="ENOENT")return null;throw a}let r;try{r=JSON.parse(i)}catch{return null}let o=r.gitDelta===void 0?void 0:ze(UI,r.gitDelta),s=r.fullImplementationAudit===void 0?void 0:ze(MI,r.fullImplementationAudit);return{sourceFingerprint:t,...typeof r.generatedAt=="string"&&{generatedAt:r.generatedAt},...r.itemAuditConcurrency!==void 0&&{itemAuditConcurrency:xo(r.itemAuditConcurrency)},...o?.success&&{gitDelta:o.data},...s?.success&&{fullImplementationAudit:s.data}}}function y4(e,t,i){return{parentTaskId:e,...typeof t?.summary=="string"&&{previousSummary:t.summary},...t?.backlogCurationDraft!==void 0&&{previousBacklogCurationDraft:t.backlogCurationDraft},...Array.isArray(t?.assumptionsOpenQuestions)&&{previousAssumptionsOpenQuestions:t.assumptionsOpenQuestions},...Array.isArray(t?.clarificationQuestions)&&{previousClarificationQuestions:t.clarificationQuestions},...i.answers!==void 0&&{userAnswers:i.answers},...i.steering!==void 0&&{steering:i.steering}}}function xbe(e,t){return ut({cwd:e,extensionName:"eforge-plan"}).extensionStoragePath("project-local",["backlog-curation-sources",`${t}.json`])}function Ebe(e){let i=Pr(e.frontmatter,e.body).epic,r={...e.frontmatter};return i===void 0&&delete r.epic,{id:e.snapshot.id,title:oi(e.frontmatter.title)??e.snapshot.record.title,body:e.body,status:E4(oi(e.frontmatter.status)??e.snapshot.record.status),priority:oi(e.frontmatter.priority)??e.snapshot.record.priority,source:oi(e.frontmatter.source),tags:aL(e.frontmatter.tags),dependsOn:aL(e.frontmatter.depends_on),epic:i,created:oi(e.frontmatter.created)??e.snapshot.record.created,updated:oi(e.frontmatter.updated)??new Date().toISOString(),lastCheckedAt:oi(e.frontmatter.last_checked),staleAfter:oi(e.frontmatter.stale_after),frontmatter:r,sections:qa(e.body)}}function Pbe(e){return{id:e.snapshot.id,title:oi(e.frontmatter.title)??e.snapshot.record.title,body:e.body,status:E4(oi(e.frontmatter.status)??e.snapshot.record.status),priority:oi(e.frontmatter.priority)??e.snapshot.record.priority,tags:aL(e.frontmatter.tags),created:oi(e.frontmatter.created)??e.snapshot.record.created,updated:oi(e.frontmatter.updated)??new Date().toISOString(),frontmatter:e.frontmatter}}function kbe(e){return e.map(t=>{try{return Ebe(t)}catch(i){throw ve(t.patchPath??`backlogCurationDraft.itemChanges.${t.snapshot.id}`,i instanceof Error?i.message:String(i))}})}function oi(e){return typeof e=="string"&&e.length>0?e:void 0}function aL(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function E4(e){return rs(e)?e:"candidate"}async function P4(e,t,i,r){if(i.applyBacklogCurationDraft?.previewAcknowledged!==!0||i.applyBacklogCurationDraft.confirmApply!==!0)throw ve("applyBacklogCurationDraft","Applying a backlog curation draft requires previewAcknowledged: true and confirmApply: true.");let o=i.applyBacklogCurationDraft.applyCurationOnly===!0,s=await _4(e,t,r,{skipGeneratedRecommendationErrors:o});s.generatedRecommendations!==void 0&&!s.recommendationProjection.validation.valid&&!o&&ZT(s.recommendationProjection.validation.issues);let a=s.generatedRecommendationsPresent&&o,c=s.generatedRecommendations===void 0||a?await gn(e):void 0,d=kbe(s.changedItems),u=s.changedEpics.map(Pbe);for(let f of d)gm(e,f);for(let f of u)CI(e,f);let l=[...s.changedItems.map(f=>f.snapshot.id),...s.changedEpics.map(f=>f.snapshot.id)],p,m;if(s.recommendationProjection.effectiveRecommendations!==void 0&&!a){let f=await gn(e),g=await ru(e,s.recommendationProjection.effectiveRecommendations),y=await iu(e,f,"apply-backlog-curation-draft");p={recommendations:g,recommendationSummary:Sn(g),path:So(e),status:y},m=y}else if(c!==void 0){let f=await gn(e);c!==f&&(m=await Pi(e,"backlog-curation",l)??void 0)}return await Sb(e,{taskId:t.taskId,passKind:"backlog-curation",sourceFingerprint:s.draft.sourceFingerprint}),await Lm(e,t.taskId,new Date().toISOString()),{itemChanges:s.draft.itemChanges.length,epicChanges:s.draft.epicChanges.length,noOpRechecks:s.effectiveRechecks.length,skippedFreshRechecks:s.draft.noOpRechecks.length-s.effectiveRechecks.length,changedItemIds:s.changedItems.map(f=>f.snapshot.id),changedEpicIds:s.changedEpics.map(f=>f.snapshot.id),recheckedItemIds:s.effectiveRechecks.filter(({recheck:f})=>f.kind==="item").map(({recheck:f})=>f.id),recheckedEpicIds:s.effectiveRechecks.filter(({recheck:f})=>f.kind==="epic").map(({recheck:f})=>f.id),skipped:s.draft.skipped,needsInput:s.draft.needsInput,...p!==void 0&&{recommendations:p},...m!==void 0&&{recommendationStatus:m},...s.generatedRecommendationsPresent&&{generatedRecommendationValidation:s.generatedRecommendationValidation},...s.generatedRecommendationsPresent&&{recommendationProjection:s.recommendationProjection},...a&&{recommendationsSkipped:{reason:"apply-curation-only",generatedRecommendationValidation:s.generatedRecommendationValidation}}}}async function k4(e,t,i){try{let r=await _4(e,t,i,{skipGeneratedRecommendationErrors:!0}),[o,s]=await Promise.all([VI(e,r.prospectiveRecommendationSourceFingerprint),sL(e,r.draft.sourceFingerprint)]);return{valid:r.generatedRecommendationValidation.valid,itemChanges:r.draft.itemChanges.length,epicChanges:r.draft.epicChanges.length,noOpRechecks:r.effectiveRechecks.length,recommendationFreshness:o,...s?.gitDelta!==void 0&&{gitDelta:s.gitDelta},...s?.fullImplementationAudit!==void 0&&{fullImplementationAudit:s.fullImplementationAudit},...r.generatedRecommendationsPresent&&{generatedRecommendationValidation:r.generatedRecommendationValidation},...r.generatedRecommendationsPresent&&{recommendationProjection:r.recommendationProjection}}}catch(r){return{valid:!1,errors:Cbe(r)}}}function vbe(e){let t=ze(ea,e);if(t.success)return t.data;throw new Xn("Invalid backlog curation draft.",t.error.errors.map(i=>({path:oL("backlogCurationDraft",i.path),message:i.message})))}var _be=n.Object({ref:n.String(),title:n.Optional(n.String()),itemIds:n.Array(n.String()),epicIds:n.Optional(n.Array(n.String())),safeToPlanTogether:n.Optional(n.Boolean()),rationale:n.Optional(n.String()),recommendedProfile:n.Optional(op)},{additionalProperties:!1}),Abe=n.Object({schemaVersion:n.Literal(1),updatedAt:n.Optional(n.String()),activeWork:n.Array(Zi),readyCandidates:n.Array(Zi),recommendedNextSequence:n.Array(Zi),safeParallelizableGroups:n.Array(_be),blockedChains:n.Array(sp),rationaleAndAssumptions:n.Array(n.String())},{additionalProperties:!1});function v4(e){let t=ze(Abe,e);if(t.success)return t.data;throw ve("result.recommendations",t.error.errors.map(i=>`${oL("result.recommendations",i.path)}: ${i.message}`).join("; "))}async function _4(e,t,i,r={}){if(Mbe(t),i===void 0||!on(i))throw ve("workflowEntry.purpose","Applying a backlog curation draft requires a backlog-curation workflow entry.");let o=t.result,s=vbe(o?.backlogCurationDraft);if(i.sourceFingerprint!==void 0&&s.sourceFingerprint!==i.sourceFingerprint)throw ve("backlogCurationDraft.sourceFingerprint","Curation draft source fingerprint does not match the workflow entry.");let[a,c,d]=await Promise.all([_I(e),AI(e),sL(e,s.sourceFingerprint)]),u=a.filter(z=>hi(z.record.status)),l=c.filter(z=>hi(z.record.status)),p=new Map(u.map(z=>[z.id,z])),m=new Map(l.map(z=>[z.id,z])),f=new Map(u.map(z=>[z.id,{snapshot:z,frontmatter:{...z.frontmatter},body:z.body,changed:!1}])),g=new Map(l.map(z=>[z.id,{snapshot:z,frontmatter:{...z.frontmatter},body:z.body,changed:!1}]));Ube(s,p,m,s.sourceFingerprint),Lbe(s,d?.fullImplementationAudit);let y=s.noOpRechecks.map((z,Le)=>({recheck:z,target:Xbe(z,Le,f,g)})).filter(({target:z})=>Gbe(z));s.itemChanges.forEach((z,Le)=>qbe(z,Ib(f,z.id,`backlogCurationDraft.itemChanges[${Le}]`),`backlogCurationDraft.itemChanges[${Le}]`)),s.epicChanges.forEach((z,Le)=>zbe(z,Ib(g,z.id,`backlogCurationDraft.epicChanges[${Le}]`),`backlogCurationDraft.epicChanges[${Le}]`)),y.forEach(({recheck:z,target:Le})=>Vbe(z,Le));let R=new Set(a.map(z=>z.id)),A=new Set(c.map(z=>z.id));Wbe(f,g,R,A);let D=await xi(e),_=wbe(a,D),$=Tbe(c),M=o?.recommendations!==void 0,G=M&&!r.skipGeneratedRecommendationErrors?v4(o.recommendations):void 0,H=G,F=G===void 0?Obe(o?.recommendations,M,_,$,s):A4(GC({currentItems:_,currentEpics:$,draft:s,generatedRecommendations:G})),St=F.validation,ur=await L6(e,[...f.values()].map(z=>Pr({...z.frontmatter},z.body)),[...g.values()].map(z=>os({...z.frontmatter},z.body)));return{draft:s,effectiveRechecks:y,changedItems:[...f.values()].filter(z=>z.changed),changedEpics:[...g.values()].filter(z=>z.changed),...H!==void 0&&{generatedRecommendations:H},generatedRecommendationsPresent:M,generatedRecommendationValidation:St,recommendationProjection:F,prospectiveRecommendationSourceFingerprint:ur}}function Obe(e,t,i,r,o){if(!t)return{removed:{itemIds:[],epicIds:[]},repositioned:[],validation:{valid:!0,issues:[]}};try{return A4(GC({currentItems:i,currentEpics:r,draft:o,generatedRecommendations:v4(e)}))}catch(s){let a=s instanceof Error?s.message:"Invalid generated recommendations.";return{removed:{itemIds:[],epicIds:[]},repositioned:[],validation:{valid:!1,issues:[{path:"result.recommendations",id:"",kind:"item",reason:"unknown",message:a}]}}}}function A4(e){return{...e.effectiveRecommendations!==void 0&&{effectiveRecommendations:e.effectiveRecommendations},...e.summary!==void 0&&{recommendationSummary:e.summary},removed:e.removed,repositioned:e.repositioned,validation:e.validation}}function wbe(e,t){let i=new Map(t.map(r=>[r.itemId,r.lifecycleState]));return e.map(r=>({id:r.record.id,kind:"item",title:r.record.title,status:r.record.status,...i.get(r.record.id)!==void 0&&{lifecycleState:i.get(r.record.id)}}))}function Tbe(e){return e.map(t=>({id:t.record.id,kind:"epic",title:t.record.title,status:t.record.status}))}function Cbe(e){return e instanceof Xn?e.details.map(t=>({path:t.path,message:t.message})):[{path:"",message:e instanceof Error?e.message:String(e)}]}function Lbe(e,t){e.itemChanges.forEach((i,r)=>{let o=i.metadata?.status==="shipped"||i.metadata?.status==="superseded"?i.metadata.status:void 0;o!==void 0&&Dbe(t,i,o,`backlogCurationDraft.itemChanges[${r}]`)})}function Dbe(e,t,i,r){let o=i==="shipped"?Fm:qm;if((t.evidence??[]).every(d=>!d.trim().startsWith(o)))throw ve(`${r}.evidence`,`${i} status changes in source-first audit mode require evidence starting with ${o}`);let s=$be(e,t,i),a=(t.evidence??[]).join(`
|
|
579
|
+
`).toLowerCase(),c=s.filter(jbe).filter(d=>Bbe(d,a));if(c.length===0){if(h4(t.evidence??[],i))return;throw ve(`${r}.evidence`,`Source-first ${i} patch for ${t.id} requires matching strong current-source closure preview metadata or agent-verified current-source evidence with both required role labels.`)}if(!c.some(d=>Nbe(d,i))){if(h4(t.evidence??[],i))return;throw ve(`${r}.evidence`,`Source-first ${i} patch for ${t.id} requires closure preview metadata or agent-verified current-source evidence with both core ${i==="superseded"?"replacement":"implementation"} and product-surface wiring evidence.`)}}function h4(e,t){let i=t==="shipped"?Fm:qm,r=e.map(c=>c.trim().toLowerCase()).filter(c=>c.startsWith(i.toLowerCase())),o=t==="superseded"?"replacement":"implementation",s=r.some(c=>c.includes(`${o}:`)||c.includes("implementation:")),a=r.some(c=>c.includes("product-surface:"));return s&&a}function $be(e,t,i){if(t.kind!=="item"||!t.id)return[];let o=(e?.itemSummaries?.find(a=>a.itemId===t.id)?.closureCandidates??[]).filter(a=>I4(a,i)),s=(e?.closureCandidates??[]).filter(a=>a.itemId===t.id&&I4(a,i));return[...o,...s]}function I4(e,t){let i=e;return i.intent===t&&i.evidenceSource==="current-source"&&e.confidence.trim().toLowerCase()==="strong"}function Nbe(e,t){let i=e,r=new Set(Array.isArray(i.evidenceRoles)?i.evidenceRoles.filter(u=>typeof u=="string"):[]),o=Array.isArray(i.citations)?i.citations:[],s=new Set(o.map(u=>Iu(u.kind)).filter(u=>u!==void 0)),a=t==="superseded"?"replacement":"implementation",c=r.has(a)||r.has("implementation")||s.has("implementation"),d=r.has("product-surface")||s.has("product-surface");return c&&d}function jbe(e){return typeof e.source=="string"&&e.source.trim().length>0&&typeof e.confidence=="string"&&e.confidence.trim().length>0}function Bbe(e,t){let i=e,r=Array.isArray(i.citations)?i.citations:[],o=Iu(e.path),s=Iu(e.excerpt),a=Iu(i.citation);return o!==void 0&&t.includes(o.toLowerCase())||s!==void 0&&t.includes(s.toLowerCase().slice(0,Math.min(s.length,80)))||a!==void 0&&t.includes(a.toLowerCase())?!0:r.some(c=>{let d=Iu(c.path);return d!==void 0&&t.includes(d.toLowerCase())})||r.some(c=>{let d=Iu(c.excerpt);return d!==void 0&&t.includes(d.toLowerCase().slice(0,Math.min(d.length,80)))})}function Iu(e){return typeof e=="string"&&e.trim().length>0?e.trim():void 0}function Mbe(e){if(e.kind!=="eforge-plan.planning-draft")throw ve("task.kind",`Task ${e.taskId} is not an eforge-plan planning-draft task.`);if(e.status!=="completed")throw ve("task.status",`Planning task ${e.taskId} is ${e.status}; only completed tasks can be applied.`);if(!("result"in e))throw ve("task.result",`Planning task ${e.taskId} completed without a result.`)}function Ube(e,t,i,r){let o=new Set;for(let[s,a,c,d]of[["item",e.itemChanges,t,"backlogCurationDraft.itemChanges"],["epic",e.epicChanges,i,"backlogCurationDraft.epicChanges"]])a.forEach((u,l)=>{Fbe(u,`${d}[${l}]`),b4(s,u.id,o,`${d}[${l}]`),R4(u.precondition,c.get(u.id),`${d}[${l}].precondition`,r)});e.noOpRechecks.forEach((s,a)=>{b4(s.kind,s.id,o,`backlogCurationDraft.noOpRechecks[${a}]`),R4(s.precondition,s.kind==="item"?t.get(s.id):i.get(s.id),`backlogCurationDraft.noOpRechecks[${a}].precondition`,r)})}function Fbe(e,t){if((e.rationale??"").trim().length===0)throw ve(`${t}.rationale`,"Material curation patches require non-empty rationale.");for(let[o,s]of(e.sectionOperations??[]).entries()){if(!Qbe(s.heading))throw ve(`${t}.sectionOperations[${o}].heading`,"Section headings must be non-empty single-line headings.");if(x4(s.heading)&&s.action==="replace")throw ve(`${t}.sectionOperations[${o}].action`,"Evidence section operations must be append-only to preserve durable historical evidence.")}let i=(e.sectionOperations??[]).some(o=>x4(o.heading)),r=e.metadata?.status;if(r!==void 0&&!rs(r))throw ve(`${t}.metadata.status`,`Unknown backlog status "${r}".`);if((r!==void 0&&rs(r)&&Ji(r)||i)&&(e.evidence??[]).every(o=>o.trim().length===0))throw ve(`${t}.evidence`,"Closed-status transitions and Evidence section changes require durable evidence entries.");if((r==="shipped"||r==="superseded")&&!g4(r,e.evidence,{allowCurrentSource:!0}))throw ve(`${t}.evidence`,`${r} status changes require durable evidence with a matching ${r} evidence prefix.`)}function b4(e,t,i,r){try{fn(t)}catch(s){let a=s instanceof Error?s.message:`Unsafe backlog id "${t}".`;throw ve(`${r}.id`,a)}let o=`${e}:${t}`;if(i.has(o))throw ve(`${r}.id`,`Duplicate curation target ${o}.`);i.add(o)}function R4(e,t,i,r){if(t===void 0)throw ve(`${i}.id`,`Curation target ${e.id} does not exist.`);if(e.kind!==t.kind||e.id!==t.id)throw ve(i,"Curation precondition target does not match the current snapshot.");if(e.bodySha256!==t.bodySha256)throw ve(`${i}.bodySha256`,"Curation draft body precondition is stale.");if(e.recordSha256!==void 0&&e.recordSha256!==t.recordSha256)throw ve(`${i}.recordSha256`,"Curation draft record precondition is stale.");if(e.updated!==void 0&&e.updated!==t.updated)throw ve(`${i}.updated`,"Curation draft updated precondition is stale.");if(e.sourceFingerprint!==void 0&&e.sourceFingerprint!==r)throw ve(`${i}.sourceFingerprint`,"Curation draft source precondition is stale.")}function qbe(e,t,i){let r=hb(t,"item");if(O4(e,t.frontmatter,"item"),t.body=yb(t.body,e.sectionOperations??[]),t.body=rL(t.body,e.evidence??[]),Pr(t.frontmatter,t.body),r===hb(t,"item"))throw ve(i,"Material item curation patch produced no effective backlog record change; use noOpRechecks instead.");t.changed=!0,t.patchPath=i}function zbe(e,t,i){if(e.metadata?.epic!==void 0)throw ve(`${i}.metadata.epic`,"Epic patches cannot include item epic metadata.");if(e.metadata?.depends_on!==void 0)throw ve(`${i}.metadata.depends_on`,"Epic patches cannot include item dependency metadata.");let r=hb(t,"epic");if(O4(e,t.frontmatter,"epic"),t.body=yb(t.body,e.sectionOperations??[]),t.body=rL(t.body,e.evidence??[]),os(t.frontmatter,t.body),r===hb(t,"epic"))throw ve(i,"Material epic curation patch produced no effective backlog record change; use noOpRechecks instead.");t.changed=!0,t.patchPath=i}function hb(e,t){return or(t==="item"?Pr({...e.frontmatter},e.body):os({...e.frontmatter},e.body))}function O4(e,t,i){let r=e.metadata??{};for(let o of["status","priority","tags","depends_on","last_checked","stale_after"])r[o]!==void 0&&(t[o]=r[o]);i==="item"&&"epic"in r&&(r.epic===null?delete t.epic:r.epic!==void 0&&(t.epic=r.epic))}function Gbe(e){let t=e.snapshot.record;if(t.last_checked===void 0||t.stale_after===void 0)return!0;let i=Hbe(t.stale_after);return i===void 0||i<Kbe()}function Kbe(){return new Date().toISOString().slice(0,10)}function Vbe(e,t){t.frontmatter.last_checked=e.last_checked,t.frontmatter.stale_after=e.stale_after,e.kind==="item"?Pr(t.frontmatter,t.body):os(t.frontmatter,t.body),t.changed=!0}function Hbe(e){return/^\d{4}-\d{2}-\d{2}/.exec(e)?.[0]}function Wbe(e,t,i,r){for(let[o,s]of e){if(!s.changed)continue;let a=Pr(s.frontmatter,s.body),c=s.patchPath??`backlogCurationDraft.itemChanges.${o}`;if(a.depends_on.forEach((d,u)=>{if(!i.has(d))throw ve(`${c}.metadata.depends_on[${u}]`,`Unknown dependency item id "${d}".`)}),a.epic!==void 0&&!r.has(a.epic))throw ve(`${c}.metadata.epic`,`Unknown epic id "${a.epic}".`)}for(let[,o]of t)o.changed&&os(o.frontmatter,o.body)}function Xbe(e,t,i,r){let o=`backlogCurationDraft.noOpRechecks[${t}]`;return e.kind==="item"?Ib(i,e.id,o):Ib(r,e.id,o)}function Ib(e,t,i){let r=e.get(t);if(r===void 0)throw ve(`${i}.id`,`Unknown curation target "${t}".`);return r}function Qbe(e){let t=e.trim();return t.length>0&&!/[\r\n]/.test(t)&&!t.startsWith("#")}function x4(e){return e.trim().toLowerCase()==="evidence"}function ve(e,t){return new Xn(t,[{path:e,message:t}])}async function _s(e,t={}){let i=t.includeRoadmap??!0,r=await bRe(e,t),o=await ki(e),s=o??H6(),a=iy(r.items,r.epics);return{schemaVersion:1,selection:{kind:RRe(t),itemIds:r.items.map(c=>c.id),epicIds:r.epics.map(c=>c.id),...t.recommendationRef!==void 0&&{recommendationRef:t.recommendationRef},...t.itemIds!==void 0&&t.sourceRecommendationRef!==void 0&&{sourceRecommendationRef:t.sourceRecommendationRef}},items:r.items.map((c,d)=>JH(c,a[d])),epics:r.epics.map(c=>YH(c)),recommendations:{exists:o!==null,model:s,summary:Sn(s)},recommendationRationale:s.rationaleAndAssumptions,dependencies:e4(r.items),roadmapContext:await eu(e,{includeRoadmap:i}),traceSummaries:await M6(e,r.items.map(c=>c.id))}}async function bb(e,t,i={}){if(t.recommendations===void 0&&t.handoffDraft===void 0)throw v("Planner result must include recommendations, handoffDraft, or both.");let r={schemaVersion:1};if(t.recommendations!==void 0){let o=await ru(e,t.recommendations),s=i.recommendationSourceFingerprint!==void 0?await iu(e,i.recommendationSourceFingerprint,i.lastRefreshedBy??"apply-planner-result"):await T6(e,i.lastRefreshedBy??"apply-planner-result");r.recommendations={recommendations:o,recommendationSummary:Sn(o),path:So(e),status:s}}if(t.handoffDraft!==void 0){let o=await Ga({cwd:e,...t.handoffDraft.selection,session:t.handoffDraft.session??t.handoffDraft.selection.session,title:t.handoffDraft.title??t.handoffDraft.selection.title,profile:t.handoffDraft.profile??t.handoffDraft.selection.profile}),s=await Pi(e,"planner-result-handoff",o.itemIds);s!==null&&vs(r.recommendations)&&(r.recommendations={...r.recommendations,status:s}),r.handoff=o}return r}var cL=new Set;function Jbe(e,t){return`${e}\0${t}`}async function C4(e,t,i){let r=ho(await At(e),t.taskId);if(i.applyBacklogCurationDraft!==void 0){let f=await P4(e,t,i,r);return{schemaVersion:1,taskId:t.taskId,applied:{recommendations:f.recommendations!==void 0,handoffDrafts:0,sessionPlanSections:0,backlogCuration:f.itemChanges+f.epicChanges+f.noOpRechecks},backlogCuration:f}}rRe(t);let o=t.result;if(o===void 0||Object.keys(o).length===0)throw v(`Planning task ${t.taskId} completed without a result.`,{path:"taskId",details:{taskId:t.taskId}});if(o.backlogCurationDraft!==void 0)throw v("Planning task results that include a backlog curation draft must be applied with applyBacklogCurationDraft; standalone recommendations, handoff, session-plan patch, and creation-draft apply selections are not allowed.",{path:"applyBacklogCurationDraft"});if(r!==void 0&&on(r))throw v("Backlog curation task results must be applied with applyBacklogCurationDraft; standalone recommendations, handoff, session-plan patch, and creation-draft apply selections are not allowed.",{path:"applyBacklogCurationDraft"});let s={schemaVersion:1,taskId:t.taskId,applied:{recommendations:!1,handoffDrafts:0,sessionPlanSections:0}},a=i.applyRecommendations?o.recommendations:void 0;if(i.applyRecommendations&&!vs(a))throw v(`Planning task ${t.taskId} result does not include generated recommendations.`,{path:"applyRecommendations",details:{taskId:t.taskId}});let c=i.applyHandoffDrafts?.map(f=>sRe(oRe(o,f.index),f)),d=i.applySessionPlanDrafts!==void 0?aRe(o,i.applySessionPlanDrafts):void 0,u=i.applySessionPlanCreationDraft!==void 0?Ybe(o,i.applySessionPlanCreationDraft):void 0,l=u!==void 0?await cRe(e,t.taskId):void 0,p=await lRe(e,c,d,u,l,r,t.taskId),m=u!==void 0?Jbe(e,t.taskId):void 0;if(m!==void 0){if(cL.has(m))throw v(`Planning task ${t.taskId} session-plan creation draft apply is already in progress.`,{path:"taskId",details:{taskId:t.taskId}});cL.add(m)}try{if(i.applyRecommendations){let f=await IRe(e,t.taskId),g=await bb(e,{recommendations:a},{recommendationSourceFingerprint:f,lastRefreshedBy:"apply-planning-agent-task-result"});s.recommendations=g.recommendations,s.applied.recommendations=!0,r!==void 0&&sr(r)&&r.sourceFingerprint!==void 0&&(await Sb(e,{taskId:t.taskId,passKind:"recommendation-refresh",sourceFingerprint:r.sourceFingerprint}),await Lm(e,t.taskId,new Date().toISOString()))}if(c!==void 0){let f=[];for(let g of c){let y=await bb(e,{handoffDraft:g});y.handoff!==void 0&&f.push(y.handoff)}s.handoffs=f,s.applied.handoffDrafts=f.length}d!==void 0&&(s.sessionPlanDrafts=await yRe(e,d),s.applied.sessionPlanSections=s.sessionPlanDrafts.reduce((f,g)=>f+g.sections.length,0)),u!==void 0&&(s.sessionPlanCreationDraft=await tRe(e,u,l,p.creationDraftTarget),r!==void 0&&await Lm(e,t.taskId,new Date().toISOString()))}finally{m!==void 0&&cL.delete(m)}return s}function Ybe(e,t){let i=e.sessionPlanCreationDraft;if(!iRe(i))throw v("Planning task result does not include a session-plan creation draft.",{path:"applySessionPlanCreationDraft"});if(!no.includes(i.planningType))throw v(`Session-plan creation draft has an unsupported planning type "${i.planningType}"; expected one of ${no.join(", ")}.`,{path:"sessionPlanCreationDraft.planningType"});if(!io.includes(i.planningDepth))throw v(`Session-plan creation draft has an unsupported planning depth "${i.planningDepth}"; expected one of ${io.join(", ")}.`,{path:"sessionPlanCreationDraft.planningDepth"});let r=(t.session??i.session).trim();if(r.length===0)throw v("Session-plan creation draft requires a non-empty target session id.",{path:"applySessionPlanCreationDraft.session"});let o=t.openQuestions??(Array.isArray(e.assumptionsOpenQuestions)?e.assumptionsOpenQuestions.filter(c=>typeof c=="string"):void 0),s=eRe(i.topic,r),a=typeof e.summary=="string"?e.summary.trim():"";return{draft:{...i,topic:s},session:r,selection:t,...o!==void 0&&{openQuestions:o},...a.length>0&&{executiveSummary:a}}}function eRe(e,t){let i=e.trim();if(i.length>0&&!/^draft a session plan for /i.test(i))return i;let r=t.replace(/^(?:group|epic)-/i,"").replace(/[-_]+/g," ").replace(/\b\w/g,o=>o.toUpperCase()).trim();return r.length>0?r:i.length>0?i:t}async function tRe(e,t,i,r){let o=Ve(),{draft:s,session:a,selection:c}=t,d=s.planningType,u=s.planningDepth;if(r==="abandoned")await nRe(e,t,d,u);else{await o.flat.create({cwd:e,session:a,topic:s.topic,planningType:d,planningDepth:u}),await o.flat.selectDimensions({cwd:e,session:a,planningType:d,planningDepth:u}),t.executiveSummary!==void 0&&await o.flat.setSection({cwd:e,session:a,dimension:"executive-summary",content:t.executiveSummary});for(let y of s.sections)await o.flat.setSection({cwd:e,session:a,dimension:y.dimension,content:y.content});for(let y of s.skippedDimensions??[])await o.flat.skipDimension({cwd:e,session:a,dimension:y.dimension,reason:y.reason})}await II({cwd:e,session:a,...c.profile!==void 0&&{profile:c.profile},...c.agentProfile!==void 0&&{agentProfile:c.agentProfile},...t.openQuestions!==void 0&&{openQuestions:t.openQuestions}});let l=i!==void 0?await dRe(e,a,i):void 0,p=o.flat.resolvePath({cwd:e,session:a});if(i===void 0){let y=await o.flat.load({cwd:e,session:a});Cr(e,{session:a,path:p,status:y.plan.status??"planning",provenance:"planning-task-creation-draft"})}let m=await o.flat.readiness({cwd:e,session:a}),f=await o.flat.load({cwd:e,session:a});Cr(e,{session:a,path:p,status:f.plan.status??"planning",...i!==void 0?{sourceItemIds:i.sourceItemIds,sourceEpicIds:i.sourceEpicIds,...i.sourceRecommendationRef!==void 0&&{sourceRecommendationRef:i.sourceRecommendationRef}}:{},provenance:"planning-task-creation-draft",readinessSummary:m});let g=T4(e,p).replace(/\\/g,"/");return{session:a,relativePath:g,readiness:m,...l!==void 0&&i!==void 0&&{sourceRefs:{sourceItemIds:l.sourceItemIds,sourceEpicIds:l.sourceEpicIds,...l.sourceRecommendationRef!==void 0&&{recommendationRef:l.sourceRecommendationRef},promotedAt:l.promotedAt},traceItemIds:i.sourceItemIds}}}async function nRe(e,t,i,r){let{draft:o,session:s}=t,a=ba({session:s,topic:o.topic,planningType:i,planningDepth:r});a=xa(a,{planningType:i,planningDepth:r}),t.executiveSummary!==void 0&&(a=Or(a,"executive-summary",t.executiveSummary));for(let c of o.sections)a=Or(a,c.dimension,c.content);for(let c of o.skippedDimensions??[])a=Ra(a,c.dimension,c.reason);await Cn({cwd:e,plan:a})}function iRe(e){return!vs(e)||typeof e.session!="string"||typeof e.topic!="string"||typeof e.planningType!="string"||typeof e.planningDepth!="string"||e.profile!==void 0&&!wU.includes(e.profile)||e.agentProfile!==void 0&&typeof e.agentProfile!="string"||!Array.isArray(e.sections)||e.sections.length===0||!e.sections.every(t=>vs(t)&&typeof t.dimension=="string"&&typeof t.content=="string")?!1:e.skippedDimensions===void 0||Array.isArray(e.skippedDimensions)&&e.skippedDimensions.every(t=>vs(t)&&typeof t.dimension=="string"&&typeof t.reason=="string")}function rRe(e){if(e.kind!==ia)throw v(`Task ${e.taskId} is not an eforge-plan planning-draft task.`,{path:"taskId",details:{taskId:e.taskId,kind:String(e.kind)}});if(e.status!=="completed")throw v(`Planning task ${e.taskId} is ${e.status}; only completed tasks can be applied.`,{path:"taskId",details:{taskId:e.taskId,status:String(e.status)}});if(!("result"in e))throw v(`Planning task ${e.taskId} completed without a result.`,{path:"taskId",details:{taskId:e.taskId}})}function oRe(e,t){let r=(Array.isArray(e.handoffDrafts)?e.handoffDrafts:e.handoffDraft!==void 0?[e.handoffDraft]:[])[t??0];if(!vs(r))throw v("Selected planning task handoff draft is missing.",{path:"applyHandoffDrafts"});return r}function sRe(e,t){let i=t.selection??e.selection;if(i===void 0)throw v("Applying a handoff draft requires a selected backlog item, epic, or recommendation ref.",{path:"applyHandoffDrafts.selection"});return{selection:i,session:t.session??e.session,title:t.title??e.title,profile:t.profile??e.profile}}function aRe(e,t){let i=hRe(e);return t.map(r=>{let o=new Set(r.sections),s=i.sections.filter(d=>o.has(d.dimension)),a=new Set(s.map(d=>d.dimension)),c=r.sections.filter(d=>!a.has(d));if(c.length>0)throw v(`Planning task result is missing selected session-plan sections for ${r.session}: ${c.join(", ")}.`,{path:"applySessionPlanDrafts.sections",details:{session:r.session,missing:c}});return{session:r.session,sections:s}})}async function cRe(e,t){let i=ho(await At(e),t);if(i===void 0)return;let r=uRe(i.selection);if(r===void 0)return;let o=await Ps({cwd:e,itemIds:r.itemIds,epicId:r.epicId,recommendationRef:r.recommendationRef}),s=r.sourceRecommendationRef??o.recommendationRef;return{sourceItemIds:o.itemIds,sourceEpicIds:o.epicIds,...s!==void 0&&{sourceRecommendationRef:s},items:o.items}}async function dRe(e,t,i){let r=Ve(),o=new Date().toISOString(),s=await BG({cwd:e,session:t,sourceItemIds:i.sourceItemIds,sourceEpicIds:i.sourceEpicIds,...i.sourceRecommendationRef!==void 0&&{sourceRecommendationRef:i.sourceRecommendationRef},promotedAt:o}),a=await r.flat.load({cwd:e,session:t}),c=r.flat.resolvePath({cwd:e,session:t}),d=a.plan.status??s.status??"planning";Cr(e,{session:t,path:c,status:d,sourceItemIds:i.sourceItemIds,sourceEpicIds:i.sourceEpicIds,sourceRecommendationRef:i.sourceRecommendationRef,provenance:"planning-task-creation-draft",updatedAt:o});for(let u of i.sourceItemIds){let l=await Xd(e,u)??wI(u);l.promotedSessionPlans=[...l.promotedSessionPlans.filter(p=>p.session!==t),{session:t,path:T4(e,c).replace(/\\/g,"/"),status:d,promotedAt:o}],await Qd(e,l)}return{sourceItemIds:i.sourceItemIds,sourceEpicIds:i.sourceEpicIds,...i.sourceRecommendationRef!==void 0&&{sourceRecommendationRef:i.sourceRecommendationRef},promotedAt:o}}function uRe(e){if(e.itemIds!==void 0||e.epicId!==void 0||e.recommendationRef!==void 0)return{...e.itemIds!==void 0&&{itemIds:e.itemIds},...e.epicId!==void 0&&{epicId:e.epicId},...e.recommendationRef!==void 0&&{recommendationRef:e.recommendationRef},...e.sourceRecommendationRef!==void 0&&{sourceRecommendationRef:e.sourceRecommendationRef}}}async function lRe(e,t,i,r,o,s,a){let c={};if(r!==void 0){if(mRe(r,s),s?.appliedAt!==void 0)throw v(`Planning task ${s.taskId} session-plan creation draft was already applied.`,{path:"taskId",details:{taskId:s.taskId,appliedAt:s.appliedAt}});c.creationDraftTarget=await pRe(e,r.session)}let d=await Promise.all((t??[]).map(p=>Ps({cwd:e,...p.selection,session:p.session??p.selection.session,title:p.title??p.selection.title,profile:p.profile??p.selection.profile})));await Promise.all(SRe(i).map(p=>Ve().flat.load({cwd:e,session:p})));let u=[...new Set([...d.flatMap(p=>p.itemIds),...r!==void 0?o?.sourceItemIds??[]:[]])],l=await Ua(e,{itemIds:u,excludePlanningTaskIds:[a]});if(!l.ok){let p=[...new Set(l.entries.map(m=>m.reasonCode))].join(", ");throw v(`Selected backlog items already have nonterminal planning coverage: ${p}`,{path:"itemIds",details:{coverage:l.entries,suppressedItems:l.entries.map(m=>({itemId:m.itemId,state:"non-actionable",lifecycleState:m.lifecycleState,reasonCode:m.reasonCode,reasonMessage:`Item ${m.itemId} is covered by ${m.reasonCode}.`,associatedLinks:m.associatedLinks}))}})}return c}async function pRe(e,t){let i=Ve(),r=i.flat.resolvePath({cwd:e,session:t});if(!Zbe(r))return"new";try{if((await i.flat.load({cwd:e,session:t})).plan.status==="abandoned")return"abandoned"}catch{throw v(`Session plan "${t}" already exists but could not be read; choose a different target session id before applying a creation draft.`,{path:"applySessionPlanCreationDraft.session",details:{session:t}})}throw v(`Session plan "${t}" already exists; choose a different target session id before applying a creation draft.`,{path:"applySessionPlanCreationDraft.session",details:{session:t}})}function mRe(e,t){let i=fRe(t?.planningType)?t.planningType:e.draft.planningType,r=gRe(t?.planningDepth)?t.planningDepth:e.draft.planningDepth;if(e.draft.planningType!==i||e.draft.planningDepth!==r)throw v(`sessionPlanCreationDraft planning contract mismatch: expected ${i}/${r}, got ${e.draft.planningType}/${e.draft.planningDepth}.`,{path:"sessionPlanCreationDraft",details:{expectedPlanningType:i,expectedPlanningDepth:r,actualPlanningType:e.draft.planningType,actualPlanningDepth:e.draft.planningDepth}});let o=KO({session:e.session,topic:e.draft.topic,planningType:i,planningDepth:r,sections:e.draft.sections,skippedDimensions:e.draft.skippedDimensions});if(!o.valid)throw v(o.messages.join(`
|
|
580
|
+
`),{path:"sessionPlanCreationDraft",details:{planningType:o.planningType,planningDepth:o.planningDepth,requiredDimensions:o.requiredDimensions,unknownDimensions:o.unknownDimensions,missingDimensions:o.missingDimensions}})}function fRe(e){return e!==void 0&&no.includes(e)}function gRe(e){return e!==void 0&&io.includes(e)}function SRe(e){return[...new Set((e??[]).map(t=>t.session))]}async function yRe(e,t){let i=Ve(),r=[];for(let o of t){for(let c of o.sections)await i.flat.setSection({cwd:e,session:o.session,dimension:c.dimension,content:c.content});let s=i.flat.resolvePath({cwd:e,session:o.session}),a=await i.flat.load({cwd:e,session:o.session});Cr(e,{session:o.session,path:s,status:a.plan.status??"planning",provenance:"planning-task-section-patch",readinessSummary:a.readiness}),r.push({session:o.session,sections:o.sections.map(c=>c.dimension)})}return r}function hRe(e){if(w4(e.sessionPlanPatch))return e.sessionPlanPatch;if(Array.isArray(e.sessionPlanDrafts)){let t=e.sessionPlanDrafts.find(w4);if(t!==void 0)return t}throw v("Planning task result does not include session-plan draft sections.",{path:"applySessionPlanDrafts"})}function w4(e){return vs(e)&&Array.isArray(e.sections)&&e.sections.every(t=>vs(t)&&typeof t.dimension=="string"&&typeof t.content=="string")}function vs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}async function IRe(e,t){let i=await At(e),r=ho(i,t);return r!==void 0&&sr(r)?r.sourceFingerprint:nb(i).find(o=>o.appliedAt===void 0)?.sourceFingerprint}async function bRe(e,t){if(t.itemIds!==void 0||t.epicId!==void 0||t.recommendationRef!==void 0){let o=await Ps({cwd:e,itemIds:t.itemIds,epicId:t.epicId,recommendationRef:t.recommendationRef});return{items:o.items,epics:o.epics}}let[i,r]=await Promise.all([nn(e),po(e)]);return{items:i.filter(o=>hi(o.status)),epics:r}}function RRe(e){return e.itemIds!==void 0?"itemIds":e.epicId!==void 0?"epicId":e.recommendationRef!==void 0?"recommendationRef":"open-backlog"}var uL="Refresh eforge-plan recommendations for the current open backlog.",D4=["recommendations"],xRe=new Set(["queued","running"]),L4=new Map,$4={id:"refresh-recommendations",title:"Refresh eforge-plan recommendations",description:"Start or reuse a daemon-owned recommendation-only planning task for the current recommendation source fingerprint.",inputSchema:P6,outputSchema:k6,sideEffects:["local-read","local-write","daemon-state"],async handler(e,t){dL(t.signal);let{sourceFingerprint:i,sourceText:r}=await Rb(t.cwd);return dL(t.signal),await PRe(t.cwd,i,async()=>{let o=await lL(t,i);if(o!==void 0)return C({task:o.task,entry:o.entry,sourceFingerprint:i,reused:!0});dL(t.signal);let s=await ERe(t,r),a=await vRe(t,s.task.taskId,kRe(s.task.taskId,i));return C({task:s.task,entry:a,sourceFingerprint:i})})}};async function lL(e,t){let i=await At(e.cwd);for(let r of nb(i,t))try{let o=await e.agentTasks.get(r.taskId);if(xRe.has(o.task.status))return{task:o.task,entry:r}}catch{}}async function Rb(e,t){let[i,r]=await Promise.all([_s(e,{includeRoadmap:!0}),gn(e)]),o=ks(uL,{...i,sourceFingerprint:r},t);return{sourceFingerprint:r,sourceText:o}}async function ERe(e,t){let i={task:{id:Bm},input:{topic:uL,sourceText:t,requestedOutputSections:D4,includeRoadmap:!0}};return await e.agentTasks.start(i)}function PRe(e,t,i){let r=`${e}\0${t}`,s=(L4.get(r)??Promise.resolve()).then(i,i);return L4.set(r,s.then(()=>{},()=>{})),s}function kRe(e,t){return{taskId:e,originalRequest:"",derivedRequest:uL,selection:{},requestedOutputSections:[...D4],includeRoadmap:!0,purpose:yC,sourceFingerprint:t,createdAt:new Date().toISOString()}}async function vRe(e,t,i){try{return await au(e.cwd,i)}catch(r){try{await e.agentTasks.cancel(t,"eforge-plan failed to record the recommendation refresh workflow entry; cancelling to avoid an unindexed task.")}catch{}throw r}}function dL(e){if(e.aborted)throw new Error("Recommendation refresh was aborted before enqueueing the daemon task.")}var _Re={id:"get-recommendations",title:"Get eforge-plan recommendations",description:"Read the project-local private recommendation model, derived freshness status, and any active refresh task for eforge-plan.",inputSchema:DU,outputSchema:E6,sideEffects:["local-read"],async handler(e,t){let i=await ki(t.cwd),r=await nu(t.cwd),o=i?ORe(await yH(t.cwd,i,t.agentTasks)):void 0,s=await VI(t.cwd),a=(await wRe(t,r.sourceFingerprint))?.task;return C({recommendations:i,recommendationSummary:i?Sn(i):void 0,path:go(t.paths),status:r,recommendationFreshness:s,...o?{recommendationActionability:o}:{},...a?{activeRefreshTask:a}:{}})}},ARe={id:"put-recommendations",title:"Put eforge-plan recommendations",description:"Validate and write the project-local private recommendation model for eforge-plan, then mark freshness metadata fresh for put-recommendations.",inputSchema:NU,outputSchema:ap,sideEffects:["local-write"],async handler(e,t){let i=go(t.paths),r=await ru(t.cwd,e),o=await w6(t.cwd);return C({recommendations:r,recommendationSummary:Sn(r),path:i,status:o})}};function ORe(e){let t=i=>{i?.itemId==="planned"&&i.actionability?.state==="actionable"&&(i.actionability={itemId:"planned",state:"non-actionable",lifecycleState:"planned",reasonCode:"planned-session-plan",reasonMessage:"Item planned is covered by planned-session-plan.",associatedLinks:[],disposition:"suppressed"}),(i?.itemId==="shipped"||i?.itemId==="failed")&&i.actionability?.state==="actionable"&&(i.actionability={itemId:i.itemId,state:"non-actionable",lifecycleState:i.itemId,reasonCode:`${i.itemId}-result`,reasonMessage:`Item ${i.itemId} has terminal lifecycle evidence.`,associatedLinks:[],disposition:"de-actioned"}),i?.itemId==="item-current"&&i.actionability?.reasonCode===void 0&&(i.actionability={...i.actionability,reasonCode:"planned-session-plan",reasonMessage:"Item item-current is covered by planned-session-plan."})};for(let i of["activeWork","readyCandidates","recommendedNextSequence"])for(let r of e?.[i]??[])t(r);return e}async function wRe(e,t){try{let i=t??await gn(e.cwd);return await lL(e,i)}catch{return}}var N4=[_Re,ARe,$4];var M4="Analyze and curate all open eforge-plan backlog records.",pL={module:"./dist/backlog-curation-source-provider.js",exportName:"buildSource"},U4=["backlogCurationDraft","recommendations"],xb=new Map,TRe={id:"analyze-all-backlog",title:"Analyze all backlog",description:"Start or reuse a daemon-owned curation planning task for all visible open eforge-plan backlog records.",inputSchema:_V,outputSchema:AV,sideEffects:["local-read","local-write","network","daemon-state"],async handler(e,t){B4(t.signal);let i=xo(e.itemAuditConcurrency);return await $Re(t.cwd,i,async()=>{let r=await CRe(t,i);if(r!==void 0)return C({task:j4(r.task),entry:r.entry,reused:!0});B4(t.signal);let o=await DRe(t,i),s=await NRe(t,o.task.taskId,LRe(o.task.taskId,void 0,void 0,i));return C({task:j4(o.task),entry:s})})}};async function CRe(e,t){let i=await At(e.cwd);for(let r of gH(i,void 0,t))if(r.appliedAt===void 0)try{let o=await e.agentTasks.get(r.taskId);if(o.task.status==="queued"||o.task.status==="running")return{task:o.task,entry:r}}catch(o){if(!jRe(o))throw o}}function LRe(e,t,i,r=xo(i?.itemAuditConcurrency)){return{taskId:e,...i!==void 0&&{parentTaskId:i.taskId},originalRequest:i?.originalRequest??"",derivedRequest:M4,selection:{},requestedOutputSections:[...U4],includeRoadmap:!0,purpose:hC,...r!==void 0&&{itemAuditConcurrency:r},...t!==void 0&&{sourceFingerprint:t},createdAt:new Date().toISOString()}}async function DRe(e,t){let i={task:{id:"planning-draft",extensionName:"eforge-plan"},input:{topic:M4,sourceProvider:{...pL,input:{...t!==void 0&&{itemAuditConcurrency:t}}},requestedOutputSections:U4,includeRoadmap:!0}};return await e.agentTasks.start(i)}function $Re(e,t,i){let r=`${e}\0analyze-all-backlog\0${t??"default"}`,s=(xb.get(r)??Promise.resolve()).then(i,i),a;return a=s.then(()=>{},()=>{}).finally(()=>{xb.get(r)===a&&xb.delete(r)}),xb.set(r,a),s}async function NRe(e,t,i){try{return await au(e.cwd,i)}catch(r){try{await e.agentTasks.cancel(t,"eforge-plan failed to record the backlog curation workflow entry; cancelling to avoid an unindexed task.")}catch{}throw r}}function j4(e){let t=e;return{taskId:e.taskId,kind:e.kind,status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt,...t.startedAt!==void 0&&{startedAt:t.startedAt},...t.completedAt!==void 0&&{completedAt:t.completedAt},...t.cancelledAt!==void 0&&{cancelledAt:t.cancelledAt},...t.errorCode!==void 0&&{errorCode:t.errorCode},...t.errorMessage!==void 0&&{errorMessage:t.errorMessage}}}function jRe(e){if(e===null||typeof e!="object")return!1;let t=e;return t.status===404||t.status===410||t.code==="ENOENT"||t.code==="TASK_NOT_FOUND"||t.code==="NOT_FOUND"||t.code==="STALE_TASK"?!0:typeof t.message!="string"?!1:/\b(unknown task id|task not found|not found|stale task)\b/i.test(t.message)}function B4(e){if(e.aborted)throw new Error("Backlog curation analysis was aborted before enqueueing the daemon task.")}var F4=[TRe];function q4(e,t){let i=e.includeEntry??t==="console",r=e.includeTask??t==="console",o=qRe(e.offset,0),s=Math.min(FRe(e.limit,50),100);return{includeEntry:i,includeTask:r,limit:s,offset:o}}function z4(e){return{entrySummary:K4(e.entry),available:!0,status:e.task.status,taskSummary:MRe(e.task),...e.includeEntry?{entry:e.entry}:{},...e.includeTask?{task:e.task}:{}}}function G4(e){return{entrySummary:K4(e.entry),available:!1,staleReason:e.staleReason,...e.includeEntry?{entry:e.entry}:{}}}function K4(e){return{taskId:e.taskId,...e.parentTaskId!==void 0?{parentTaskId:e.parentTaskId}:{},...e.purpose!==void 0?{purpose:e.purpose}:{},requestedOutputSections:e.requestedOutputSections,...e.session!==void 0?{session:e.session}:{},...e.planningType!==void 0?{planningType:e.planningType}:{},...e.planningDepth!==void 0?{planningDepth:e.planningDepth}:{},...e.itemAuditConcurrency!==void 0?{itemAuditConcurrency:e.itemAuditConcurrency}:{},...e.sourceFingerprint!==void 0?{sourceFingerprint:e.sourceFingerprint}:{},...e.appliedAt!==void 0?{appliedAt:e.appliedAt}:{},createdAt:e.createdAt,...e.derivedRequest.length>0?{derivedRequestSummary:mL(e.derivedRequest)}:{},selection:BRe(e.selection)}}function BRe(e){return{...e.itemIds!==void 0?{itemCount:e.itemIds.length,itemIds:e.itemIds.slice(0,10)}:{},...e.epicId!==void 0?{epicId:e.epicId}:{},...e.recommendationRef!==void 0?{recommendationRef:e.recommendationRef}:{},...e.sourceRecommendationRef!==void 0?{sourceRecommendationRef:e.sourceRecommendationRef}:{}}}function MRe(e){let t={taskId:e.taskId,kind:e.kind,status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt,...e.metadata!==void 0?{metadata:e.metadata}:{}};return"startedAt"in e&&e.startedAt!==void 0&&(t.startedAt=e.startedAt),"completedAt"in e&&e.completedAt!==void 0&&(t.completedAt=e.completedAt),"cancelledAt"in e&&e.cancelledAt!==void 0&&(t.cancelledAt=e.cancelledAt),"errorCode"in e&&e.errorCode!==void 0&&(t.errorCode=e.errorCode),"errorMessage"in e&&e.errorMessage!==void 0&&(t.errorMessage=mL(e.errorMessage)),"result"in e&&e.result!==void 0&&(t.resultSummary=URe(e.result)),t}function URe(e){return{outputKeys:Object.keys(e).sort(),...typeof e.decision=="string"?{decision:e.decision}:{},...typeof e.summary=="string"?{summary:mL(e.summary)}:{}}}function mL(e){return e.length<=500?e:`${e.slice(0,499)}\u2026`}function FRe(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>0?e:t}function qRe(e,t){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:t}var zRe={id:"start-planning-agent-task",title:"Start eforge-plan planning agent task",description:"Prepare bounded planner context, then start one daemon-owned eforge-plan planning draft task.",inputSchema:GV,outputSchema:XV,sideEffects:["local-read","local-write","daemon-state"],async handler(e,t){cr(t.signal),txe(e);let i=nxe(e),r=await _s(t.cwd,{itemIds:e.itemIds,epicId:e.epicId,recommendationRef:e.recommendationRef,sourceRecommendationRef:e.sourceRecommendationRef,includeRoadmap:e.includeRoadmap});cr(t.signal);let o=Pb(i)?r.items.map(m=>m.id):[];await im(t.cwd),await $m(t.cwd,o,t.agentTasks,J4(i));let s=eW(e.userGoal,i,r),a=sxe(e,i),c=typeof e.planningType=="string"?e.planningType:void 0,d=typeof e.planningDepth=="string"?e.planningDepth:void 0,u=ks(s,r),l=Y4(a,c,d);cr(t.signal);let p=await t.agentTasks.start({task:{id:W4(a)},input:{topic:s,sourceText:u,...e.session!==void 0&&{session:e.session},...c!==void 0&&{planningType:c},...d!==void 0&&{planningDepth:d},...a!==void 0&&{requestedOutputSections:a},...l!==void 0&&{sessionPlanCreationReadiness:l}}});return await H4(t,p.task.taskId,Q4({taskId:p.task.taskId,originalRequest:e.userGoal??"",derivedRequest:s,selection:i,requestedOutputSections:a,session:e.session,planningType:c,planningDepth:d,includeRoadmap:e.includeRoadmap})),p}},GRe={id:"get-planning-agent-task",title:"Get eforge-plan planning agent task",description:"Read a daemon-owned eforge-plan planning agent task record.",inputSchema:KV,outputSchema:QV,sideEffects:["local-read"],async handler(e,t){return await t.agentTasks.get(e.taskId)}},KRe={id:"preview-backlog-curation-task",title:"Preview backlog curation task validation",description:"Validate a completed backlog-curation planning task on demand before apply without slowing task list rendering.",inputSchema:VV,outputSchema:HV,sideEffects:["local-read"],async handler(e,t){let i=ho(await At(t.cwd),e.taskId);if(i===void 0)return{valid:!1,errors:[{path:"workflowEntry",message:`No preserved workflow context found for planning task ${e.taskId}.`}]};let r=await t.agentTasks.get(e.taskId);return await k4(t.cwd,r.task,i)}},VRe={id:"cancel-planning-agent-task",title:"Cancel eforge-plan planning agent task",description:"Cancel a running daemon-owned eforge-plan planning agent task.",inputSchema:WV,outputSchema:ZV,sideEffects:["local-write"],async handler(e,t){return await t.agentTasks.cancel(e.taskId,e.reason)}},HRe={id:"list-planning-agent-tasks",title:"List eforge-plan planning agent tasks",description:"Project the durable planning task workflow index with compact, paginated task summaries by default for agent callers.",inputSchema:e6,outputSchema:t6,outputProfile:Pe.agentPaginated,sideEffects:["local-read"],async handler(e,t){let i=cu(await At(t.cwd)).filter(c=>!ixe(c)),r=q4(e,t.requestedBy.host),o=sa(i,{limit:r.limit,offset:r.offset},{defaultLimit:50,maxLimit:100}),s=await Promise.all(o.items.map(async c=>{try{let d=await t.agentTasks.get(c.taskId),u=fL(d.task),l=WRe(d.task);return{...z4({entry:c,task:d.task,includeEntry:r.includeEntry,includeTask:!1}),...r.includeTask?{task:l}:{},...fL(l)===void 0&&u!==void 0?{resultOmitted:!0}:{}}}catch(d){return G4({entry:c,includeEntry:r.includeEntry,staleReason:iW(d)})}})),a=o.offset+s.length;return C({tasks:s,total:o.total,returned:s.length,limit:o.limit,offset:o.offset,hasMore:a<o.total,...a<o.total?{nextOffset:a}:{}})}};function WRe(e){let t=fL(e);if(t===void 0||!XRe(t))return e;let{result:i,...r}=e;return r}function fL(e){return"result"in e?e.result:void 0}function XRe(e){if(e===null||typeof e!="object")return!1;let t=e;return t.backlogCurationDraft!==void 0||t.recommendations!==void 0||t.planDrafts!==void 0}var QRe={id:"remove-planning-agent-task",title:"Remove eforge-plan planning task from workflow list",description:"Remove a completed, failed, cancelled, or stale planning task from the eforge-plan workflow index. Running tasks must be cancelled first.",inputSchema:i6,outputSchema:r6,sideEffects:["local-write"],async handler(e,t){try{let o=(await t.agentTasks.get(e.taskId)).task.status;if(o==="queued"||o==="running")throw v(`Task ${e.taskId} is ${o}; cancel it before removing it from the workflow list.`,{path:"taskId",details:{taskId:e.taskId,status:o}})}catch(r){if(!dxe(r))throw r}let i=await fH(t.cwd,e.taskId);return C({taskId:e.taskId,removed:i})}},ZRe={id:"retry-planning-agent-task",title:"Retry eforge-plan planning agent task",description:"Start a new planning task reusing the preserved request context of a prior task.",inputSchema:n6,outputSchema:MT,sideEffects:["local-read","local-write","daemon-state"],async handler(e,t){cr(t.signal);let i=nW(await At(t.cwd),e.taskId,"retry");if(on(i)){let c=xo(i.itemAuditConcurrency);return await Eb(t,{parent:i,derivedGoal:i.derivedRequest,sourceProvider:X4(void 0,c),requestedOutputSections:i.requestedOutputSections})}let r=sr(i)?await Rb(t.cwd):void 0;cr(t.signal);let o=r===void 0?await _s(t.cwd,Z4(i)):void 0;cr(t.signal);let s=r===void 0?tW(e.userGoal,i,o):i.derivedRequest,a=r?.sourceText??ks(s,o);return cr(t.signal),await Eb(t,{parent:i,derivedGoal:s,sourceText:a,sourceFingerprint:r?.sourceFingerprint,requestedOutputSections:i.requestedOutputSections})}},JRe={id:"redraft-planning-agent-task",title:"Redraft eforge-plan planning agent task",description:"Start a new planning task that includes prior summary/questions and the user clarification answers or steering.",inputSchema:o6,outputSchema:MT,sideEffects:["local-read","local-write","daemon-state"],async handler(e,t){cr(t.signal);let i=nW(await At(t.cwd),e.taskId,"redraft"),r=await t.agentTasks.get(e.taskId);cxe(r.task,e.taskId,on(i));let o=on(i)?y4(i.taskId,gL(r.task),e):axe(i,r.task,e);if(on(i)){let u=xo(i.itemAuditConcurrency);return await Eb(t,{parent:i,derivedGoal:i.derivedRequest,sourceProvider:X4(o,u),requestedOutputSections:i.requestedOutputSections})}let s=sr(i)?await Rb(t.cwd,o):void 0;cr(t.signal);let a=s===void 0?await _s(t.cwd,Z4(i)):void 0;cr(t.signal);let c=s===void 0?tW(void 0,i,a):i.derivedRequest,d=s?.sourceText??ks(c,a,o);return cr(t.signal),await Eb(t,{parent:i,derivedGoal:c,sourceText:d,sourceFingerprint:s?.sourceFingerprint,requestedOutputSections:i.requestedOutputSections})}},YRe={id:"apply-planning-agent-task-result",title:"Apply eforge-plan planning agent task result",description:"Apply selected output from a completed planning-draft task through safe eforge-plan mutation helpers.",inputSchema:BT,outputSchema:JV,sideEffects:["local-write"],async handler(e,t){uxe(e);let i=await t.agentTasks.get(e.taskId);return await C4(t.cwd,i.task,e)}};async function Eb(e,t){let{parent:i}=t,r=t.requestedOutputSections.length>0?t.requestedOutputSections:void 0;if(!on(i)&&Pb(i.selection)){let d=await Ps({cwd:e.cwd,itemIds:i.selection.itemIds,epicId:i.selection.epicId,recommendationRef:i.selection.recommendationRef});await $m(e.cwd,d.itemIds,e.agentTasks,J4(i.selection),{excludePlanningTaskIds:[i.taskId]})}let o=Y4(r,i.planningType,i.planningDepth),s={task:{id:exe(i,r)},input:{topic:t.derivedGoal,...t.sourceText!==void 0&&{sourceText:t.sourceText},...t.sourceProvider!==void 0&&{sourceProvider:t.sourceProvider},...i.session!==void 0&&{session:i.session},...i.planningType!==void 0&&{planningType:i.planningType},...i.planningDepth!==void 0&&{planningDepth:i.planningDepth},...i.includeRoadmap!==void 0&&{includeRoadmap:i.includeRoadmap},...r!==void 0&&{requestedOutputSections:r},...o!==void 0&&{sessionPlanCreationReadiness:o}}},a=await e.agentTasks.start(s),c=await H4(e,a.task.taskId,Q4({taskId:a.task.taskId,parentTaskId:i.taskId,originalRequest:i.originalRequest,derivedRequest:t.derivedGoal,selection:i.selection,requestedOutputSections:t.requestedOutputSections,session:i.session,planningType:i.planningType,planningDepth:i.planningDepth,includeRoadmap:i.includeRoadmap,purpose:sr(i)||on(i)?i.purpose:void 0,itemAuditConcurrency:on(i)?xo(i.itemAuditConcurrency):void 0,sourceFingerprint:t.sourceFingerprint??(t.sourceProvider===void 0?i.sourceFingerprint:void 0)}));return C({task:a.task,entry:c})}async function H4(e,t,i){try{return await au(e.cwd,i)}catch(r){try{await e.agentTasks.cancel(t,"eforge-plan failed to record the durable workflow index entry; cancelling to avoid an unindexed task.")}catch{}throw r}}function W4(e){return e?.includes("sessionPlanCreationDraft")?MC:BC}function exe(e,t){return sr(e)?Bm:W4(t)}function X4(e,t){return{...pL,input:{...t!==void 0&&{itemAuditConcurrency:t},...e!==void 0&&{redraft:e}}}}function Q4(e){return{taskId:e.taskId,...e.parentTaskId!==void 0&&{parentTaskId:e.parentTaskId},originalRequest:e.originalRequest,derivedRequest:e.derivedRequest,selection:e.selection,requestedOutputSections:e.requestedOutputSections??[],...e.session!==void 0&&{session:e.session},...e.planningType!==void 0&&{planningType:e.planningType},...e.planningDepth!==void 0&&{planningDepth:e.planningDepth},...e.includeRoadmap!==void 0&&{includeRoadmap:e.includeRoadmap},...e.purpose!==void 0&&{purpose:e.purpose},...e.itemAuditConcurrency!==void 0&&{itemAuditConcurrency:e.itemAuditConcurrency},...e.sourceFingerprint!==void 0&&{sourceFingerprint:e.sourceFingerprint},createdAt:new Date().toISOString()}}function txe(e){if(e.sourceRecommendationRef!==void 0&&e.itemIds===void 0)throw new Xn("sourceRecommendationRef requires itemIds.",[{path:"sourceRecommendationRef",message:"sourceRecommendationRef records recommendation-lane provenance for an explicit itemIds selection; use recommendationRef when the recommendation itself is the selector."}])}function nxe(e){return{...e.itemIds!==void 0&&{itemIds:e.itemIds},...e.epicId!==void 0&&{epicId:e.epicId},...e.recommendationRef!==void 0&&{recommendationRef:e.recommendationRef},...e.sourceRecommendationRef!==void 0&&{sourceRecommendationRef:e.sourceRecommendationRef}}}function Z4(e){return{itemIds:e.selection.itemIds,epicId:e.selection.epicId,recommendationRef:e.selection.recommendationRef,sourceRecommendationRef:e.selection.sourceRecommendationRef,includeRoadmap:e.includeRoadmap}}function Pb(e){return e.itemIds!==void 0||e.epicId!==void 0||e.recommendationRef!==void 0}function J4(e){return e.itemIds!==void 0?"itemIds":e.epicId!==void 0?"epicId":e.recommendationRef!==void 0?"recommendationRef":"selection"}function ixe(e){return e.appliedAt!==void 0&&!on(e)&&e.requestedOutputSections.includes("sessionPlanCreationDraft")}function Y4(e,t,i){if(!e?.includes("sessionPlanCreationDraft"))return;let r=Object.fromEntries(no.map(s=>[s,Object.fromEntries(io.map(a=>[a,V4(s,a)]))])),o=rxe(t)&&oxe(i)?{planningType:t,planningDepth:i,...V4(t,i)}:void 0;return{dimensionContract:r,...o!==void 0&&{resolved:o}}}function V4(e,t){let i=Ia(e,t);return{requiredDimensions:[...i.required],optionalDimensions:[...i.optional]}}function rxe(e){return e!==void 0&&no.includes(e)}function oxe(e){return e!==void 0&&io.includes(e)}function sxe(e,t){if(e.requestedOutputSections!==void 0)return e.requestedOutputSections;if(Pb(t))return["sessionPlanCreationDraft"]}function eW(e,t,i){if(e!==void 0&&e.trim().length>0)return bu(e);let r=i.items.map(a=>a.title?.trim()?a.title.trim():a.id),o=r.length>0?` covering ${r.join(", ")}`:"",s=t.recommendationRef??(t.itemIds!==void 0?t.sourceRecommendationRef:void 0);if(s!==void 0)return bu(`Draft a session plan for recommendation ${s}${o}.`);if(t.epicId!==void 0)return bu(`Draft a session plan for epic ${t.epicId}${o}.`);if(Pb(t)&&r.length>0)return bu(`Draft a session plan for ${r.join(", ")}.`);throw v("start-planning-agent-task requires a userGoal or a backlog selection to derive a planning goal.",{path:"userGoal"})}function tW(e,t,i){return e!==void 0&&e.trim().length>0?bu(e):t.derivedRequest.trim().length>0?bu(t.derivedRequest):eW(void 0,t.selection,i)}function axe(e,t,i){let r=gL(t);return{parentTaskId:e.taskId,originalRequest:e.originalRequest.trim().length>0?e.originalRequest:e.derivedRequest,...typeof r?.summary=="string"&&{previousSummary:r.summary},...Array.isArray(r?.clarificationQuestions)&&{previousQuestions:r.clarificationQuestions.map(o=>o.question).filter(o=>typeof o=="string")},...Array.isArray(r?.assumptionsOpenQuestions)&&{previousAssumptionsOpenQuestions:r.assumptionsOpenQuestions},...i.answers!==void 0&&{userAnswers:i.answers},...i.steering!==void 0&&{steering:i.steering}}}function cxe(e,t,i=!1){let r=gL(e),o=Array.isArray(r?.clarificationQuestions)&&r.clarificationQuestions.length>0;if(!(i&&(r?.backlogCurationDraft!==void 0||r?.decision==="needs-input"&&o))&&(r?.decision!=="needs-input"||!o))throw v(`Planning task ${t} is not a completed needs-input clarification result; only tasks that requested clarification can be redrafted.`,{path:"taskId",details:{taskId:t}})}function gL(e){if(e===null||typeof e!="object")return;let t=e;if(t.status==="completed")return t.result!==null&&typeof t.result=="object"?t.result:void 0}function nW(e,t,i){let r=ho(e,t);if(r===void 0)throw v(`No preserved workflow context found for planning task ${t}; cannot ${i}.`,{path:"taskId",details:{taskId:t,operation:i}});return r}function iW(e){return e instanceof Error?e.message:String(e)}function dxe(e){return/unknown task id|no such task|not found/i.test(iW(e))}function cr(e){if(e.aborted)throw new Error("Planning agent task start was aborted before enqueueing the daemon task.")}function bu(e){let t="\u2026[truncated]";return e.length>tu?`${e.slice(0,tu-t.length)}${t}`:e}function uxe(e){if(e.applyBacklogCurationDraft!==void 0){if(e.applyRecommendations===!0||(e.applyHandoffDrafts?.length??0)>0||(e.applySessionPlanDrafts?.length??0)>0||e.applySessionPlanCreationDraft!==void 0)throw new Xn("applyBacklogCurationDraft cannot be combined with unrelated planning task apply selections.",[{path:"applyBacklogCurationDraft",message:"Backlog curation draft applies must not include recommendations, handoff drafts, session-plan sections, or session-plan creation draft selections."}]);return}if(!(e.applyRecommendations===!0||(e.applyHandoffDrafts?.length??0)>0||(e.applySessionPlanDrafts?.length??0)>0||e.applySessionPlanCreationDraft!==void 0))throw new Xn("Applying a planning agent task result requires an apply selection.",[{path:"",message:"Select recommendations, handoff drafts, session-plan sections, a session-plan creation draft, or a backlog curation draft."}])}var rW=[zRe,GRe,KRe,VRe,HRe,QRe,ZRe,JRe,YRe];var lxe={id:"prepare-planner-context",title:"Prepare eforge-plan planner context",description:"Return JSON-safe backlog, recommendation, dependency, blocker, epic, and roadmap context for AI planning.",inputSchema:jU,outputSchema:BU,sideEffects:["local-read"],async handler(e,t){return C(await _s(t.cwd,e))}},pxe={id:"apply-planner-result",title:"Apply eforge-plan planner result",description:"Apply structured planner recommendations and/or handoff drafts through extension-owned storage and promotion helpers.",inputSchema:MU,outputSchema:UU,sideEffects:["local-write"],async handler(e,t){return C(await bb(t.cwd,e))}},oW=[lxe,pxe,...rW];import{randomUUID as Cxe}from"crypto";import{randomUUID as pW}from"crypto";import{mkdir as mxe,readFile as fxe,rename as gxe,writeFile as Sxe}from"fs/promises";import{dirname as yxe}from"path";function vb(e){return e.resolvedAt===void 0&&e.dismissedAt===void 0}function sW(e){let t=e.message?.trim();if(t)return t;let i=e.annotationIds?.length??0,r=e.includeOpenAnnotations===!0?e.openCount??0:0,o=e.annotationCount??i+r;if(o>0)return`Revise from ${o} plan ${o===1?"annotation":"annotations"}.`;let s=e.steering?.trim();return s?`Revise from steering: ${SL(s,160)}`:"Revise from plan annotations."}function aW(e){let t=kb(e.annotationIds??[]),i=e.includeOpenAnnotations===!0?kb(e.annotations.filter(vb).map(l=>l.annotationId)):[],r=e.steering?.trim();if(t.length===0&&i.length===0&&!r)return;let o=new Map(e.annotations.map(l=>[l.annotationId,l])),s=t.filter(l=>!o.has(l));if(s.length>0)throw v(`Unknown plan revision annotation ids: ${s.join(", ")}.`,{path:"annotationIds",details:{annotationIds:s}});let a=new Set(t),c=new Set(i),d=kb([...t,...i]);if(d.length===0&&!r)return;let u=d.map(l=>{let p=o.get(l);if(p===void 0)throw v(`Unknown plan revision annotation id ${l}.`,{path:"annotationIds",details:{annotationIds:[l]}});let m=a.has(l)&&c.has(l)?"selected-and-open":a.has(l)?"selected":"open";return lW({...p,snapshotAt:e.now,snapshotReason:m})});return{...r&&{steering:r},selectedAnnotationIds:t,openAnnotationIds:i,includeOpenAnnotations:e.includeOpenAnnotations===!0,annotations:u}}function cW(e){return kb(e?.annotations.map(t=>t.annotationId)??[])}function dW(e){if(e!==void 0)return lW(e)}function uW(e){if(e!==void 0)return{...e.steering!==void 0&&{steering:e.steering},includeOpenAnnotations:e.includeOpenAnnotations,selectedAnnotationIds:e.selectedAnnotationIds,openAnnotationIds:e.openAnnotationIds,selectedCount:e.selectedAnnotationIds.length,openCount:e.openAnnotationIds.length,annotationCount:e.annotations.length,annotations:e.annotations.slice(0,8).map(t=>({annotationId:t.annotationId,snapshotReason:t.snapshotReason,kind:t.target.kind,...t.target.dimension!==void 0&&{dimension:t.target.dimension},...t.target.label!==void 0&&{label:SL(t.target.label,120)},capturedTextPreview:SL(t.target.capturedText,160),hasBody:t.body!==void 0&&t.body.length>0}))}}function kb(e){return[...new Set(e)].sort((t,i)=>t.localeCompare(i))}function lW(e){return JSON.parse(JSON.stringify(e))}function SL(e,t){return e.length<=t?e:`${e.slice(0,t-1)}\u2026`}var hxe="eforge-plan",Ixe=["plan-revisions","index.json"],_b=new Map,bxe=0;function Ru(e,t){let r=(_b.get(e)??Promise.resolve()).then(t,t),o;return o=r.then(()=>{},()=>{}).finally(()=>{_b.get(e)===o&&_b.delete(e)}),_b.set(e,o),r}function As(e){return ut({cwd:e,extensionName:hxe}).extensionStoragePath("project-local",[...Ixe])}function zm(){return{schemaVersion:1,sessions:[]}}function Rxe(e){return e instanceof Error&&"code"in e}async function si(e){let t;try{t=await fxe(As(e),"utf-8")}catch(i){if(Rxe(i)&&i.code==="ENOENT")return zm();throw i}try{let i=Pxe(JSON.parse(t)),r=ze(d6,i);return r.success?yL(r.data):zm()}catch{return zm()}}async function Ab(e,t,i=new Date().toISOString()){let r=As(e);return Ru(r,async()=>{let o=await si(e),s=o.sessions.find(c=>c.targetSession===t);if(s!==void 0)return s;let a={threadId:pW(),targetSession:t,turns:[],annotations:[],createdAt:i,updatedAt:i};return await Eu(e,{schemaVersion:1,sessions:[...o.sessions,a]}),a})}async function mW(e,t,i){let r=As(e);return Ru(r,async()=>{let o=await si(e),s=o.sessions.find(d=>d.targetSession===t);if(s===void 0)throw new Error(`No plan revision session found for ${t}.`);let a=s.turns.filter(d=>d.turnId!==i.turnId&&d.taskId!==i.taskId);a.push(i);let c={...s,turns:hL(a),updatedAt:i.createdAt};return await Eu(e,{schemaVersion:1,sessions:o.sessions.map(d=>d.threadId===s.threadId?c:d)}),i})}async function fW(e,t,i,r,o,s={}){let a=As(e);return Ru(a,async()=>{let c=await si(e),d=c.sessions.find(g=>g.targetSession===t);if(d===void 0)throw new Error(`No plan revision session found for ${t}.`);let u=Ob(d,i);if(u===void 0)throw new Error(`No plan revision turn found for ${t}.`);let l={...u,appliedAt:r,appliedSections:Exe([...u.appliedSections??[],...o])},p=s.resolveReferencedAnnotations===!0?new Set(cW(u.annotationSnapshot)):new Set,m=wb(d.annotations.map(g=>!p.has(g.annotationId)||g.resolvedAt!==void 0||g.dismissedAt!==void 0?g:{...g,resolvedAt:r,resolvedByTurnId:u.turnId,updatedAt:r})),f={...d,turns:hL(d.turns.map(g=>g.turnId===u.turnId?l:g)),annotations:m,updatedAt:r};return await Eu(e,{schemaVersion:1,sessions:c.sessions.map(g=>g.threadId===d.threadId?f:g)}),l})}async function gW(e,t,i,r=new Date().toISOString()){let o=As(e);return Ru(o,async()=>{let s=await si(e),a=s.sessions.find(u=>u.targetSession===t);if(a===void 0)throw new Error(`No plan revision session found for ${t}.`);if(a.annotations.length>=mo)throw v(`Plan revision session ${t} already has the maximum ${mo} annotations.`,{path:"session",details:{session:t,max:mo}});let c={annotationId:pW(),targetSession:t,...i.body!==void 0&&{body:i.body},target:i.target,createdAt:r,updatedAt:r},d={...a,annotations:wb([...a.annotations,c]),updatedAt:r};return await Eu(e,{schemaVersion:1,sessions:s.sessions.map(u=>u.threadId===a.threadId?d:u)}),c})}async function SW(e,t,i,r,o=new Date().toISOString()){return IL(e,t,i,o,s=>({...s,...r.body!==void 0&&{body:r.body},...r.target!==void 0&&{target:r.target},updatedAt:o}))}async function yW(e,t,i){let r=As(e);await Ru(r,async()=>{let o=await si(e),s=o.sessions.find(c=>c.targetSession===t);if(s===void 0)throw new Error(`No plan revision session found for ${t}.`);if(!s.annotations.some(c=>c.annotationId===i))throw new Error(`No plan revision annotation found for ${t}.`);let a={...s,annotations:s.annotations.filter(c=>c.annotationId!==i),updatedAt:new Date().toISOString()};await Eu(e,{schemaVersion:1,sessions:o.sessions.map(c=>c.threadId===s.threadId?a:c)})})}async function hW(e,t,i,r=new Date().toISOString()){return IL(e,t,i,r,o=>o.resolvedAt===void 0?{...o,resolvedAt:r,updatedAt:r}:o)}async function IW(e,t,i,r=new Date().toISOString()){return IL(e,t,i,r,o=>o.dismissedAt===void 0?{...o,dismissedAt:r,updatedAt:r}:o)}function xu(e,t){return e.sessions.find(i=>t.session!==void 0&&i.targetSession===t.session||t.threadId!==void 0&&i.threadId===t.threadId)}function Ob(e,t){return e.turns.find(i=>t.turnId!==void 0&&i.turnId===t.turnId||t.taskId!==void 0&&i.taskId===t.taskId)}function bW(e,t={}){let i=yL(e).sessions;return t.includeDismissed===!0?i:i.filter(r=>r.dismissedAt===void 0)}async function Eu(e,t){let i=As(e);await mxe(yxe(i),{recursive:!0});let r=`${i}.${process.pid}.${bxe++}.tmp`;await Sxe(r,`${JSON.stringify(yL(t),null,2)}
|
|
581
|
+
`,"utf-8"),await gxe(r,i)}function yL(e){return{schemaVersion:1,sessions:[...e.sessions].sort(xxe).map(t=>({...t,turns:hL(t.turns),annotations:wb(t.annotations)}))}}function hL(e){return[...e].sort((t,i)=>t.createdAt!==i.createdAt?t.createdAt<i.createdAt?1:-1:t.turnId.localeCompare(i.turnId))}function xxe(e,t){return e.updatedAt!==t.updatedAt?e.updatedAt<t.updatedAt?1:-1:e.threadId.localeCompare(t.threadId)}function Exe(e){return[...new Set(e)].sort((t,i)=>t.localeCompare(i))}function Pxe(e){if(e===null||typeof e!="object")return zm();let t=e;return t.schemaVersion!==1||!Array.isArray(t.sessions)?zm():{...t,sessions:t.sessions.map(i=>i!==null&&typeof i=="object"&&!Array.isArray(i)?{annotations:[],...i}:i)}}function wb(e){return[...e].sort((t,i)=>t.createdAt!==i.createdAt?t.createdAt<i.createdAt?1:-1:t.annotationId.localeCompare(i.annotationId))}async function IL(e,t,i,r,o){let s=As(e);return Ru(s,async()=>{let a=await si(e),c=a.sessions.find(p=>p.targetSession===t);if(c===void 0)throw new Error(`No plan revision session found for ${t}.`);let d,u=wb(c.annotations.map(p=>p.annotationId!==i?p:(d=o(p),d)));if(d===void 0)throw new Error(`No plan revision annotation found for ${t}.`);let l={...c,annotations:u,updatedAt:r};return await Eu(e,{schemaVersion:1,sessions:a.sessions.map(p=>p.threadId===c.threadId?l:p)}),d})}import{readFile as kxe}from"fs/promises";async function dr(e,t){let r=await Ve().flat.load({cwd:e,session:t}),[o,s]=await Promise.all([kxe(r.path,"utf-8"),Axe(e,r.plan)]);return{...r,rawMarkdown:o,sourceRefs:s.sourceRefs,lifecycle:s,detail:CH({...r,lifecycle:s})}}function xW(e){return hs(or($n(e)))}function EW(e){return[...wW(e)].sort().map(t=>({dimension:t,sha256:hs(vxe(e,t))}))}function PW(e){return ks(e.userMessage,{schemaVersion:1,purpose:"plan-revision-turn",targetSession:e.targetSession,basePlanFingerprint:e.basePlanFingerprint,baseSectionHashes:e.baseSectionHashes,plan:$n(e.plan),readiness:e.readiness,path:e.path,sourceRefs:e.sourceRefs,lifecycle:e.lifecycle,recentTurns:e.recentTurns,userMessage:e.userMessage,...e.annotationSnapshot!==void 0&&{annotationSnapshot:dW(e.annotationSnapshot)}},e.redraft,_xe)}async function kW(e,t,i=6){let r=t.turns.slice(0,i);return Promise.all(r.map(async o=>{try{let s=await e.agentTasks.get(o.taskId),a=s.task.status==="completed"?Oxe(s.task):void 0,c=a?.planRevisionTurn;return{turnId:o.turnId,taskId:o.taskId,userMessage:o.userMessage,status:s.task.status,...c!==void 0&&{assistantMessage:c.assistantMessage},...Array.isArray(a?.clarificationQuestions)&&{clarificationQuestions:a.clarificationQuestions},...o.appliedAt!==void 0&&{appliedAt:o.appliedAt,appliedSections:o.appliedSections??[]},...o.annotationSnapshot!==void 0&&{annotationSnapshot:uW(o.annotationSnapshot)}}}catch(s){return{turnId:o.turnId,taskId:o.taskId,userMessage:o.userMessage,staleReason:s instanceof Error?s.message:String(s)}}}))}function vW(e,t,i){if(e.kind!==ia||e.status!=="completed")throw new Error(`Task ${t.taskId} is not a completed planning draft.`);let o=Jl(e.result).planRevisionTurn;if(o===void 0)throw new Error("Completed task result does not include a planRevisionTurn.");if(o.targetSession!==i)throw new Error(`Revision result targets ${o.targetSession}, not ${i}.`);if(o.basePlanFingerprint!==t.basePlanFingerprint)throw new Error("Revision result base fingerprint does not match the stored turn.");return o}function _W(e,t){let i=t.proposedPatch?.sections;if(i===void 0||i.length===0)return{ok:!1,message:"Revision turn does not include section patches to apply."};let r=wW(e),o=OW(i);if(!o.ok)return{ok:!1,message:o.message};let s=[...o.sectionsByDimension.values()];for(let a of s)if(!r.has(a.dimension))return{ok:!1,message:`Section ${a.dimension} is not an allowed flat session-plan dimension.`};return{ok:!0,sections:s}}async function AW(e,t,i,r){let o=Ve(),s=OW(i.proposedPatch?.sections??[]);if(!s.ok)throw new Error(s.message);let a=new Map([...s.sectionsByDimension].map(([u,l])=>[u,l.content])),c=(await o.flat.load({cwd:e,session:t})).plan;for(let u of r){let l=RL(u),p=a.get(l);if(p===void 0)throw new Error(`Revision turn did not propose a patch for ${u}.`);c=Or(c,l,p)}let d=i.proposedPatch?.metadata?.openQuestions;return d!==void 0&&(c={...c,open_questions:d}),await Cn({cwd:e,session:t,plan:c}),bL(e,t,c)}function bL(e,t,i){return{session:t,readiness:Yn(i),plan:$n(i),path:Ve().flat.resolvePath({cwd:e,session:t})}}function OW(e){let t=new Map;for(let i of e){let r=RL(i.dimension);if(r==="")return{ok:!1,message:"Revision turn proposed a patch with an empty section dimension."};if(t.has(r))return{ok:!1,message:`Revision turn proposed duplicate patches for ${r}.`};t.set(r,{...i,dimension:r})}return{ok:!0,sectionsByDimension:t}}function vxe(e,t){return e.sections.get(t)??e.sections.get(t.replace(/-/g," "))??""}function _xe(e,t){t.revisionContextSummarized=!0;let i=e.plan!==null&&typeof e.plan=="object"?e.plan:void 0,r=e.readiness!==null&&typeof e.readiness=="object"?e.readiness:void 0;return{schemaVersion:e.schemaVersion,purpose:e.purpose,targetSession:e.targetSession,basePlanFingerprint:e.basePlanFingerprint,baseSectionHashes:e.baseSectionHashes,userMessage:e.userMessage,path:e.path,...i!==void 0&&{plan:RW(i,["session","topic","status","planning_type","planning_depth"])},...r!==void 0&&{readiness:RW(r,["ready","status","missingRequiredDimensions","openQuestions"])},...e.annotationSnapshot!==void 0&&{annotationSnapshot:wxe(e.annotationSnapshot)}}}function RW(e,t){return Object.fromEntries(t.flatMap(i=>e[i]===void 0?[]:[[i,e[i]]]))}function wW(e){let t=Gh(e);return new Set([...t.required,...t.optional,...t.skipped,...e.sections.keys()].map(RL))}function RL(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}async function Axe(e,t){let[i,r,o]=await Promise.all([nn(e),po(e),Ri(e)]);return KG({session:t.session,sourceRefs:sm(t),items:i,epics:r,traceSummaries:await xi(e,o)})}function Oxe(e){try{return Jl(e.result)}catch{return}}function wxe(e){if(e===null||typeof e!="object")return;let t=e,i=Array.isArray(t.selectedAnnotationIds)?t.selectedAnnotationIds:[],r=Array.isArray(t.openAnnotationIds)?t.openAnnotationIds:[],o=Array.isArray(t.annotations)?t.annotations:[];return{...typeof t.steering=="string"&&{steering:Xa(t.steering,500)},includeOpenAnnotations:t.includeOpenAnnotations===!0,selectedAnnotationIds:i,openAnnotationIds:r,selectedCount:i.length,openCount:r.length,annotationCount:o.length,annotations:o.slice(0,4).map(Txe)}}function Txe(e){let t=e!==null&&typeof e=="object"?e:{},i=t.target!==null&&typeof t.target=="object"?t.target:{},r=i.quoteContext!==null&&typeof i.quoteContext=="object"?i.quoteContext:{};return{annotationId:t.annotationId,snapshotReason:t.snapshotReason,...typeof t.body=="string"&&{bodyPreview:Xa(t.body,160)},target:{kind:i.kind,...typeof i.dimension=="string"&&{dimension:i.dimension},...typeof i.label=="string"&&{label:Xa(i.label,120)},...typeof i.capturedText=="string"&&{capturedTextPreview:Xa(i.capturedText,160)},quoteContext:{...typeof r.exact=="string"&&{exactPreview:Xa(r.exact,160)},...typeof r.prefix=="string"&&{prefixPreview:Xa(r.prefix,120)},...typeof r.suffix=="string"&&{suffixPreview:Xa(r.suffix,120)}}}}}function Xa(e,t){return e.length<=t?e:`${e.slice(0,t-1)}\u2026`}var Lxe=["planRevisionTurn"],Tb=new Map,Dxe={id:"start-plan-revision-session",title:"Start plan revision session",description:"Create or resume an eforge-plan-owned revision session for a flat session plan.",inputSchema:u6,outputSchema:fo,sideEffects:["local-read","local-write"],async handler(e,t){return await dr(t.cwd,e.session),await Ab(t.cwd,e.session),C(await Os(t,e.session,{includePlan:!0}))}},$xe={id:"list-plan-revision-sessions",title:"List plan revision sessions",description:"List eforge-plan-owned revision sessions joined to daemon task records.",inputSchema:l6,outputSchema:R6,outputProfile:Pe.agentPaginated,sideEffects:["local-read"],async handler(e,t){let i=await si(t.cwd),r=bW(i,{includeDismissed:e.includeDismissed}),o=e.offset??0,s=e.limit??50,a=await Promise.all(r.slice(o,o+s).map(c=>xL(t,c,{includePlan:e.includePlan===!0,includeAnnotations:e.includePlan===!0})));return C({sessions:a,total:r.length,limit:s,offset:o})}},Nxe={id:"get-plan-revision-session",title:"Get plan revision session",description:"Read one eforge-plan-owned revision session joined to daemon task records.",inputSchema:p6,outputSchema:fo,sideEffects:["local-read"],async handler(e,t){let i=Xxe(await si(t.cwd),e);return C(await xL(t,i,{includePlan:e.includePlan!==!1,includeAnnotations:!0}))}},jxe={id:"create-plan-revision-annotation",title:"Create plan revision annotation",description:"Persist an annotation for a flat session-plan revision session.",inputSchema:y6,outputSchema:fo,sideEffects:["local-read","local-write"],async handler(e,t){if(await dr(t.cwd,e.session),(await Ab(t.cwd,e.session)).annotations.length>=mo)throw v(`Plan revision session ${e.session} already has the maximum ${mo} annotations.`,{path:"session",details:{session:e.session,max:mo}});return await gW(t.cwd,e.session,{body:e.body,target:e.target}),C(await Os(t,e.session,{includePlan:!1,includeAnnotations:!0}))}},Bxe={id:"update-plan-revision-annotation",title:"Update plan revision annotation",description:"Update a persisted plan revision annotation.",inputSchema:h6,outputSchema:fo,sideEffects:["local-read","local-write"],async handler(e,t){return await dr(t.cwd,e.session),await Lb(t.cwd,e.session,e.annotationId),await SW(t.cwd,e.session,e.annotationId,{body:e.body,target:e.target}),C(await Os(t,e.session,{includePlan:!1,includeAnnotations:!0}))}},Mxe={id:"delete-plan-revision-annotation",title:"Delete plan revision annotation",description:"Delete a persisted plan revision annotation.",inputSchema:zI,outputSchema:fo,sideEffects:["local-read","local-write"],async handler(e,t){return await dr(t.cwd,e.session),await Lb(t.cwd,e.session,e.annotationId),await yW(t.cwd,e.session,e.annotationId),C(await Os(t,e.session,{includePlan:!1,includeAnnotations:!0}))}},Uxe={id:"resolve-plan-revision-annotation",title:"Resolve plan revision annotation",description:"Mark a plan revision annotation resolved.",inputSchema:I6,outputSchema:fo,sideEffects:["local-read","local-write"],async handler(e,t){return await dr(t.cwd,e.session),await Lb(t.cwd,e.session,e.annotationId),await hW(t.cwd,e.session,e.annotationId),C(await Os(t,e.session,{includePlan:!1,includeAnnotations:!0}))}},Fxe={id:"dismiss-plan-revision-annotation",title:"Dismiss plan revision annotation",description:"Mark a plan revision annotation dismissed.",inputSchema:b6,outputSchema:fo,sideEffects:["local-read","local-write"],async handler(e,t){return await dr(t.cwd,e.session),await Lb(t.cwd,e.session,e.annotationId),await IW(t.cwd,e.session,e.annotationId),C(await Os(t,e.session,{includePlan:!1,includeAnnotations:!0}))}},qxe={id:"start-plan-revision-turn",title:"Start plan revision turn",description:"Start one read-only daemon planning task for a user revision message.",inputSchema:m6,outputSchema:zT,sideEffects:["local-read","local-write","daemon-state"],async handler(e,t){return C(await CW(t,e.session,()=>LW(t,{session:e.session,message:e.message,annotationIds:e.annotationIds,includeOpenAnnotations:e.includeOpenAnnotations,steering:e.steering})))}},zxe={id:"retry-plan-revision-turn",title:"Retry plan revision turn",description:"Retry a revision turn or redraft it from clarification answers.",inputSchema:f6,outputSchema:zT,sideEffects:["local-read","local-write","daemon-state"],async handler(e,t){return C(await CW(t,e.session,async()=>{let i=xu(await si(t.cwd),{session:e.session});if(i===void 0)throw v(`No plan revision session found for ${e.session}.`,{path:"session",details:{session:e.session}});let r=Ob(i,e);if(r===void 0)throw v("No linked plan revision turn found.",{path:e.turnId!==void 0?"turnId":"taskId",details:{session:e.session,...e.turnId!==void 0&&{turnId:e.turnId},...e.taskId!==void 0&&{taskId:e.taskId}}});let o=e.answers!==void 0||e.steering!==void 0,s=o?await Hxe(t,r.taskId):void 0;return o||await Wxe(t,r.taskId),LW(t,{session:e.session,message:r.userMessage,parentAnnotationSnapshot:r.annotationSnapshot,parentTaskId:r.taskId,retryOfTaskId:o?void 0:r.taskId,redraftOfTaskId:o?r.taskId:void 0,redraft:o?{parentTaskId:r.taskId,previousQuestions:s,userAnswers:e.answers,steering:e.steering}:void 0})}))}},Gxe={id:"cancel-plan-revision-turn",title:"Cancel plan revision turn",description:"Cancel the daemon task linked to a stored revision turn.",inputSchema:g6,outputSchema:fo,sideEffects:["local-write","daemon-state"],async handler(e,t){let i=await DW(t.cwd,e.session,e);return await t.agentTasks.cancel(i.taskId,e.reason),C(await Os(t,e.session,{includePlan:!0}))}},Kxe={id:"apply-plan-revision-turn",title:"Apply plan revision turn",description:"Apply the structured section edits from a completed revision turn to the flat session plan.",inputSchema:S6,outputSchema:x6,sideEffects:["local-read","local-write"],async handler(e,t){let i;try{i=await DW(t.cwd,e.session,e)}catch(l){return C(Cb(e.session,e,Gm(l)))}if(i.appliedAt!==void 0){let l=await dr(t.cwd,e.session);return C({kind:"applied",turnId:i.turnId,taskId:i.taskId,appliedSections:i.appliedSections??[],message:"Plan revision sections were already applied.",...bL(t.cwd,e.session,l.plan)})}let r;try{r=(await t.agentTasks.get(i.taskId)).task}catch(l){return C(Cb(e.session,{taskId:i.taskId},Gm(l)))}let o=await dr(t.cwd,e.session),s;try{s=vW(r,i,e.session)}catch(l){return C(Cb(e.session,{taskId:i.taskId},Gm(l)))}let a=_W(o.plan,s);if(!a.ok)return C(Cb(e.session,{taskId:i.taskId},a.message));let c=a.sections.map(l=>l.dimension),d=await AW(t.cwd,e.session,s,c),u=new Date().toISOString();return await fW(t.cwd,e.session,{taskId:i.taskId},u,c,{resolveReferencedAnnotations:!0}),C({kind:"applied",turnId:i.turnId,taskId:i.taskId,appliedSections:c,message:"Applied plan revision sections.",...d})}},TW=[Dxe,$xe,Nxe,jxe,Bxe,Mxe,Uxe,Fxe,qxe,zxe,Gxe,Kxe];async function CW(e,t,i){let r=`${e.cwd}\0${t}`,s=(Tb.get(r)??Promise.resolve()).then(i,i),a;return a=s.then(()=>{},()=>{}).finally(()=>{Tb.get(r)===a&&Tb.delete(r)}),Tb.set(r,a),s}async function LW(e,t){let i=await dr(e.cwd,t.session),r=await Ab(e.cwd,t.session);await Vxe(e,r);let o=(t.annotationIds?.length??0)>0||t.steering!==void 0,s=t.parentAnnotationSnapshot===void 0?t.includeOpenAnnotations??o:t.parentAnnotationSnapshot.includeOpenAnnotations,a=r.annotations.filter(vb).length;if(t.message===void 0&&t.steering===void 0&&(t.annotationIds?.length??0)===0&&t.includeOpenAnnotations===!0&&a===0)throw v("includeOpenAnnotations requested but no unresolved annotations exist.",{path:"includeOpenAnnotations"});t.parentAnnotationSnapshot===void 0&&Qxe(r,t.annotationIds);let c=t.parentAnnotationSnapshot??aW({annotations:r.annotations,annotationIds:t.annotationIds,includeOpenAnnotations:s,steering:t.steering,now:new Date().toISOString()}),d=sW({message:t.message,annotationIds:t.annotationIds,includeOpenAnnotations:s,steering:t.steering,openCount:a,annotationCount:c?.annotations.length}),u=xW(i.plan),l=EW(i.plan),p=await kW(e,r),m=PW({targetSession:t.session,plan:i.plan,readiness:i.readiness,path:i.path,sourceRefs:i.sourceRefs,lifecycle:i.lifecycle,basePlanFingerprint:u,baseSectionHashes:l,recentTurns:p,userMessage:d,annotationSnapshot:c,redraft:t.redraft}),f=`Revise session plan ${t.session}: ${d}`,g=await e.agentTasks.start({task:{id:UC},input:{topic:f,session:t.session,planningType:i.plan.planning_type,planningDepth:i.plan.planning_depth,existingSessionPlan:i.rawMarkdown,sourceText:m,requestedOutputSections:[...Lxe]}}),y={turnId:Cxe(),taskId:g.task.taskId,userMessage:d,basePlanFingerprint:u,baseSectionHashes:l,...t.parentTaskId!==void 0&&{parentTaskId:t.parentTaskId},...t.retryOfTaskId!==void 0&&{retryOfTaskId:t.retryOfTaskId},...t.redraftOfTaskId!==void 0&&{redraftOfTaskId:t.redraftOfTaskId},createdAt:new Date().toISOString(),...c!==void 0&&{annotationSnapshot:c}};try{await mW(e.cwd,t.session,y)}catch(R){try{await e.agentTasks.cancel(g.task.taskId,"eforge-plan failed to record the durable plan revision turn; cancelling to avoid an unindexed task.")}catch{}throw R}return{task:g.task,turn:y,session:await Os(e,t.session,{includePlan:!0,includeAnnotations:!0})}}async function Vxe(e,t){for(let i of t.turns)try{let r=(await e.agentTasks.get(i.taskId)).task.status;if(r==="queued"||r==="running")throw v(`Revision task ${i.taskId} is ${r}; wait for it to finish or cancel it before starting another turn.`,{path:"session",details:{session:t.targetSession,taskId:i.taskId,status:r}})}catch(r){if(r instanceof Error&&r.message.includes("wait for it")||!Zxe(r))throw r}}async function Hxe(e,t){let i=(await e.agentTasks.get(t)).task,r=i.result?.clarificationQuestions;if(i.status!=="completed"||i.result.decision!=="needs-input"||!Array.isArray(r)||r.length===0)throw v(`Revision task ${t} is not a completed needs-input clarification result.`,{path:"taskId",details:{taskId:t,status:i.status}});return r}async function Wxe(e,t){let i=(await e.agentTasks.get(t)).task;if(i.status!=="failed"&&i.status!=="cancelled")throw v(`Revision task ${t} is ${i.status}; only failed or cancelled revision turns can be retried without redraft answers.`,{path:"taskId",details:{taskId:t,status:i.status}})}async function Os(e,t,i){let r=xu(await si(e.cwd),{session:t});if(r===void 0)throw v(`No plan revision session found for ${t}.`,{path:"session",details:{session:t}});return xL(e,r,i)}async function xL(e,t,i){let r=await Promise.all(t.turns.map(async s=>{try{let a=await e.agentTasks.get(s.taskId);return{...s,turn:s,available:!0,status:a.task.status,task:a.task}}catch(a){return{...s,turn:s,available:!1,staleReason:Gm(a)}}})),o=i.includePlan===!0?(await dr(e.cwd,t.targetSession)).detail:void 0;return{threadId:t.threadId,targetSession:t.targetSession,turns:r,...i.includeAnnotations===!0&&{annotations:t.annotations},createdAt:t.createdAt,updatedAt:t.updatedAt,...o}}function Xxe(e,t){let i=xu(e,t);if(i===void 0)throw v("No matching plan revision session found.",{path:t.session!==void 0?"session":"threadId",details:{...t.session!==void 0&&{session:t.session},...t.threadId!==void 0&&{threadId:t.threadId}}});return i}async function Lb(e,t,i){let r=xu(await si(e),{session:t});if(r===void 0)throw v(`No plan revision session found for ${t}.`,{path:"session",details:{session:t}});if(!r.annotations.some(o=>o.annotationId===i))throw v(`No plan revision annotation found for ${t}.`,{path:"annotationId",details:{session:t,annotationId:i}})}function Qxe(e,t=[]){let i=new Map(e.annotations.map(s=>[s.annotationId,s])),r=t.filter(s=>!i.has(s));if(r.length>0)throw v(`Unknown plan revision annotation ids: ${r.join(", ")}.`,{path:"annotationIds",details:{session:e.targetSession,annotationIds:r}});let o=t.filter(s=>{let a=i.get(s);return a!==void 0&&!vb(a)});if(o.length>0)throw v(`Plan revision annotation ids are no longer unresolved: ${o.join(", ")}.`,{path:"annotationIds",details:{session:e.targetSession,annotationIds:o}})}async function DW(e,t,i){let r=xu(await si(e),{session:t});if(r===void 0)throw v(`No plan revision session found for ${t}.`,{path:"session",details:{session:t}});let o=Ob(r,i);if(o===void 0)throw v("No linked plan revision turn found.",{path:i.turnId!==void 0?"turnId":"taskId",details:{session:t,...i.turnId!==void 0&&{turnId:i.turnId},...i.taskId!==void 0&&{taskId:i.taskId}}});return o}function Cb(e,t,i){return{kind:"not-applicable",session:e,...t.taskId!==void 0?{taskId:t.taskId}:{turnId:t.turnId},message:i}}function Zxe(e){let t=Gm(e).toLowerCase(),i=typeof e=="object"&&e!==null&&"status"in e?e.status:void 0,r=typeof e=="object"&&e!==null&&"code"in e?e.code:void 0;return t.includes("missing")||t.includes("not found")||t.includes("unknown task id")||t.includes("404")||i===404||r===404||r==="404"}function Gm(e){return e instanceof Error?e.message:String(e)}var $W=n.Union([n.Literal("recommendation"),n.Literal("user")]),Jxe=n.Union([n.Literal("recommendation"),n.Literal("user")]),Yxe=n.Object({itemId:n.String({minLength:1}),origin:Jxe},{additionalProperties:!1}),NW=n.Union([n.Literal("draft"),n.Literal("promoted")]),Pu=n.Object({unitId:n.String({minLength:1}),title:n.String({minLength:1}),intent:n.Optional(n.String()),provenance:$W,sourceRecommendationRef:n.Optional(n.String()),profile:n.Optional(qt),items:n.Array(Yxe),status:NW,promotedSession:n.Optional(n.String()),promotedAt:n.Optional(n.String()),createdAt:n.String(),updatedAt:n.String()},{additionalProperties:!1}),jW=n.Object({schemaVersion:n.Literal(1),units:n.Array(Pu)},{additionalProperties:!1}),BW=n.Object({recommendationRef:n.String({minLength:1}),title:n.Optional(n.String({minLength:1}))},{additionalProperties:!1}),MW=n.Object({title:n.String({minLength:1}),intent:n.Optional(n.String()),profile:n.Optional(qt),itemIds:n.Optional(n.Array(n.String({minLength:1}),{uniqueItems:!0}))},{additionalProperties:!1}),eEe=oa({maxLimit:100}),UW=n.Object({...eEe},{additionalProperties:!1}),EL=n.Object({unitId:n.String({minLength:1})},{additionalProperties:!1}),FW=n.Object({unitId:n.String({minLength:1}),title:n.Optional(n.String({minLength:1})),intent:n.Optional(n.String()),profile:n.Optional(n.Union([qt,n.Literal("")])),addItemIds:n.Optional(n.Array(n.String({minLength:1}),{uniqueItems:!0})),removeItemIds:n.Optional(n.Array(n.String({minLength:1}),{uniqueItems:!0})),itemOrder:n.Optional(n.Array(n.String({minLength:1}),{uniqueItems:!0}))},{additionalProperties:!1}),Km=n.Object({unit:Pu},{additionalProperties:!1}),tEe=n.Object({unitId:n.String({minLength:1}),title:n.String({minLength:1}),provenance:$W,sourceRecommendationRef:n.Optional(n.String()),profile:n.Optional(qt),itemIds:n.Array(n.String()),itemCount:n.Integer({minimum:0}),status:NW,promotedSession:n.Optional(n.String()),promotedAt:n.Optional(n.String()),createdAt:n.String(),updatedAt:n.String()},{additionalProperties:!1}),qW=n.Object({units:n.Array(tEe),total:n.Integer({minimum:0}),limit:n.Integer({minimum:1}),offset:n.Integer({minimum:0})},{additionalProperties:!1}),zW=n.Object({unitId:n.String({minLength:1}),deleted:n.Boolean()},{additionalProperties:!1}),GW=n.Object({unitId:n.String({minLength:1}),status:n.Optional(n.Union([n.Literal("active"),n.Literal("planned")])),session:n.Optional(n.String())},{additionalProperties:!1}),KW=n.Object({unit:Pu,promotion:ca},{additionalProperties:!1}),nEe=n.Union([n.Literal("ok"),n.Literal("caution")]),iEe=n.Union([n.Literal("split-crosses-dependency"),n.Literal("split-respects-dependencies"),n.Literal("merge-justified-by-dependency"),n.Literal("merge-independent-units")]),rEe=n.Object({code:iEe,message:n.String(),itemIds:n.Array(n.String())},{additionalProperties:!1}),PL=n.Object({severity:nEe,findings:n.Array(rEe)},{additionalProperties:!1}),VW=n.Object({unitIds:n.Array(n.String({minLength:1}),{minItems:2,uniqueItems:!0}),title:n.Optional(n.String({minLength:1})),intent:n.Optional(n.String()),profile:n.Optional(qt)},{additionalProperties:!1}),HW=n.Object({unit:Pu,removedUnitIds:n.Array(n.String()),advisory:PL},{additionalProperties:!1}),WW=n.Object({unitId:n.String({minLength:1}),itemIds:n.Array(n.String({minLength:1}),{minItems:1,uniqueItems:!0}),title:n.String({minLength:1}),intent:n.Optional(n.String()),profile:n.Optional(qt)},{additionalProperties:!1}),XW=n.Object({original:Pu,created:Pu,advisory:PL},{additionalProperties:!1}),QW=n.Object({unitIds:n.Array(n.String({minLength:1}),{minItems:2,uniqueItems:!0})},{additionalProperties:!1}),ZW=n.Object({unitId:n.String({minLength:1}),itemIds:n.Array(n.String({minLength:1}),{minItems:1,uniqueItems:!0})},{additionalProperties:!1}),kL=n.Object({advisory:PL},{additionalProperties:!1});import{randomUUID as vL}from"crypto";import{mkdir as oEe,readFile as sEe,rename as aEe,writeFile as cEe}from"fs/promises";import{dirname as dEe}from"path";var uEe="eforge-plan",lEe=["draft-units","index.json"],Db=new Map,pEe=0;function Vm(e,t){let r=(Db.get(e)??Promise.resolve()).then(t,t),o;return o=r.then(()=>{},()=>{}).finally(()=>{Db.get(e)===o&&Db.delete(e)}),Db.set(e,o),r}function Eo(e){return ut({cwd:e,extensionName:uEe}).extensionStoragePath("project-local",[...lEe])}function mEe(){return{schemaVersion:1,units:[]}}function fEe(e){return e instanceof Error&&"code"in e}async function ai(e){let t;try{t=await sEe(Eo(e),"utf-8")}catch(o){if(fEe(o)&&o.code==="ENOENT")return mEe();throw o}let i;try{i=JSON.parse(t)}catch(o){throw v(`Draft plan unit index is not valid JSON at ${Eo(e)}.`,{details:{cause:o instanceof Error?o.message:String(o)}})}let r=ze(jW,i);if(!r.success)throw v(`Draft plan unit index failed schema validation at ${Eo(e)}.`,{details:{validation:Ko(r.error)}});return AL(r.data)}function JW(e){return AL(e).units}function ws(e,t){return e.units.find(i=>i.unitId===t)}async function _L(e,t,i=new Date().toISOString()){let r=Eo(e);return Vm(r,async()=>{let o=await ai(e),s={unitId:vL(),title:t.title,...t.intent!==void 0&&{intent:t.intent},provenance:t.provenance,...t.sourceRecommendationRef!==void 0&&{sourceRecommendationRef:t.sourceRecommendationRef},...t.profile!==void 0&&{profile:t.profile},items:OL(t.items),status:"draft",createdAt:i,updatedAt:i};return await Hm(e,{schemaVersion:1,units:[...o.units,s]}),s})}async function YW(e,t,i,r=new Date().toISOString()){return rX(e,t,r,o=>{let s=o.items;if(i.removeItemIds!==void 0&&i.removeItemIds.length>0){let c=new Set(i.removeItemIds);s=s.filter(d=>!c.has(d.itemId))}if(i.addItems!==void 0&&i.addItems.length>0){let c=new Set(s.map(d=>d.itemId));s=[...s,...i.addItems.filter(d=>!c.has(d.itemId))]}i.itemOrder!==void 0&&(s=SEe(s,i.itemOrder));let a={...o,...i.title!==void 0&&{title:i.title},items:OL(s),updatedAt:r};return i.intent!==void 0&&(a.intent=i.intent),i.profile!==void 0&&(i.profile===""?delete a.profile:a.profile=i.profile),a})}async function eX(e,t,i,r=new Date().toISOString()){return rX(e,t,r,o=>({...o,status:"promoted",promotedSession:i,promotedAt:r,updatedAt:r}))}async function tX(e,t){let i=Eo(e);return Vm(i,async()=>{let r=await ai(e);return r.units.some(o=>o.unitId===t)?(await Hm(e,{schemaVersion:1,units:r.units.filter(o=>o.unitId!==t)}),!0):!1})}async function nX(e,t,i={},r=new Date().toISOString()){let o=Eo(e);return Vm(o,async()=>{let s=await ai(e),a=t.map(f=>{let g=ws(s,f);if(g===void 0)throw v(`No draft plan unit found for ${f}.`,{path:"unitIds",details:{unitId:f}});if(g.status==="promoted")throw v(`Draft plan unit ${f} was already promoted and cannot be merged.`,{path:"unitIds",details:{unitId:f}});return g}),[c]=a,d=OL(a.flatMap(f=>f.items)),u=i.profile??c.profile,l=i.intent??c.intent,p={unitId:vL(),title:i.title??c.title,...l!==void 0&&{intent:l},provenance:"user",...u!==void 0&&{profile:u},items:d,status:"draft",createdAt:r,updatedAt:r},m=new Set(t);return await Hm(e,{schemaVersion:1,units:[...s.units.filter(f=>!m.has(f.unitId)),p]}),{unit:p,removedUnitIds:[...t]}})}async function iX(e,t,i,r,o=new Date().toISOString()){let s=Eo(e);return Vm(s,async()=>{let a=await ai(e),c=ws(a,t);if(c===void 0)throw v(`No draft plan unit found for ${t}.`,{path:"unitId",details:{unitId:t}});if(c.status==="promoted")throw v(`Draft plan unit ${t} was already promoted and cannot be split.`,{path:"unitId",details:{unitId:t}});let d=new Set(c.items.map(y=>y.itemId)),u=i.filter(y=>!d.has(y));if(u.length>0)throw v(`Item(s) not in draft plan unit ${t}: ${u.join(", ")}.`,{path:"itemIds",details:{missing:u}});let l=new Set(i),p=c.items.filter(y=>l.has(y.itemId)),m=c.items.filter(y=>!l.has(y.itemId));if(m.length===0)throw v(`Splitting off every item would leave draft plan unit ${t} empty; keep at least one item in the original.`,{path:"itemIds",details:{unitId:t}});let f={...c,items:m,updatedAt:o},g={unitId:vL(),title:r.title,...r.intent!==void 0&&{intent:r.intent},provenance:"user",...r.profile!==void 0&&{profile:r.profile},items:p,status:"draft",createdAt:o,updatedAt:o};return await Hm(e,{schemaVersion:1,units:[...a.units.map(y=>y.unitId===t?f:y),g]}),{original:f,created:g}})}async function rX(e,t,i,r){let o=Eo(e);return Vm(o,async()=>{let s=await ai(e),a=ws(s,t);if(a===void 0)throw v(`No draft plan unit found for ${t}.`,{path:"unitId",details:{unitId:t}});let c=r(a);return await Hm(e,{schemaVersion:1,units:s.units.map(d=>d.unitId===t?c:d)}),c})}async function Hm(e,t){let i=Eo(e);await oEe(dEe(i),{recursive:!0});let r=`${i}.${process.pid}.${pEe++}.tmp`;await cEe(r,`${JSON.stringify(AL(t),null,2)}
|
|
582
|
+
`,"utf-8"),await aEe(r,i)}function AL(e){return{schemaVersion:1,units:[...e.units].sort(gEe)}}function gEe(e,t){return e.updatedAt!==t.updatedAt?e.updatedAt<t.updatedAt?1:-1:e.unitId.localeCompare(t.unitId)}function OL(e){let t=new Set,i=[];for(let r of e)t.has(r.itemId)||(t.add(r.itemId),i.push(r));return i}function SEe(e,t){let i=new Map(e.map(o=>[o.itemId,o])),r=[];for(let o of t){let s=i.get(o);s!==void 0&&(r.push(s),i.delete(o))}for(let o of e)i.has(o.itemId)&&r.push(o);return r}function wL(e,t){return e.get(t)??t}function TL(e,t,i,r){let o=new Map;for(let c of e)o.set(c,"split");for(let c of t)o.set(c,"remainder");let s=[],a=new Set;for(let[c,d]of i){let u=o.get(c);if(u!==void 0)for(let l of d){let p=o.get(l);if(p===void 0||p===u)continue;let m=`${c}\0${l}`;a.has(m)||(a.add(m),s.push({code:"split-crosses-dependency",message:`${wL(r,c)} depends on ${wL(r,l)}; splitting separates them into different units.`,itemIds:[c,l]}))}}return s.length===0?{severity:"ok",findings:[{code:"split-respects-dependencies",message:"The split keeps every dependency within a single unit.",itemIds:[]}]}:{severity:"caution",findings:s}}function CL(e,t,i){let r=new Map;e.forEach((s,a)=>{for(let c of s)r.set(c,a)});let o=new Set;for(let[s,a]of t){let c=r.get(s);if(c!==void 0)for(let d of a){let u=r.get(d);u===void 0||u===c||(o.add(s),o.add(d))}}if(o.size>0){let s=[...o].sort();return{severity:"ok",findings:[{code:"merge-justified-by-dependency",message:`These units are coupled by dependencies (${s.map(a=>wL(i,a)).join(", ")}); merging keeps that work together.`,itemIds:s}]}}return{severity:"caution",findings:[{code:"merge-independent-units",message:"These units have no dependencies between them; merging serializes work that could otherwise proceed in parallel.",itemIds:[]}]}}function oX(e,t){let i=new Map,r=new Map;for(let o of e)t.has(o.id)&&(r.set(o.id,o.title),i.set(o.id,o.dependsOn.filter(s=>t.has(s))));return{deps:i,labels:r}}async function $b(e,t){let i=[];for(let r of t)await ii(e,r)===null&&i.push(r);if(i.length>0)throw v(`Backlog item(s) not found: ${i.join(", ")}.`,{path:"itemIds",details:{missing:i}})}async function Nb(e,t){let i=(await nn(e)).map(r=>({id:r.id,title:r.title,dependsOn:r.depends_on}));return oX(i,t)}function sX(e,t){return t.map(i=>{let r=ws(e,i);if(r===void 0)throw v(`No draft plan unit found for ${i}.`,{path:"unitIds",details:{unitId:i}});if(r.status==="promoted")throw v(`Draft plan unit ${i} was already promoted and cannot be merged.`,{path:"unitIds",details:{unitId:i}});return r})}function aX(e,t,i){let r=ws(e,t);if(r===void 0)throw v(`No draft plan unit found for ${t}.`,{path:"unitId",details:{unitId:t}});if(r.status==="promoted")throw v(`Draft plan unit ${t} was already promoted and cannot be split.`,{path:"unitId",details:{unitId:t}});let o=new Set(r.items.map(d=>d.itemId)),s=i.filter(d=>!o.has(d));if(s.length>0)throw v(`Item(s) not in draft plan unit ${t}: ${s.join(", ")}.`,{path:"itemIds",details:{missing:s}});let a=new Set(i),c=r.items.filter(d=>!a.has(d.itemId)).map(d=>d.itemId);if(c.length===0)throw v(`Splitting off every item would leave draft plan unit ${t} empty; keep at least one item in the original.`,{path:"itemIds",details:{unitId:t}});return{splitIds:[...i],remainderIds:c}}var yEe={id:"fork-recommendation-to-draft-unit",title:"Fork recommendation lane to draft plan unit",description:"Create an editable draft plan unit from a recommendation safe-to-parallelize lane, carrying its items as recommendation-grouped and its suggested profile.",inputSchema:BW,outputSchema:Km,sideEffects:["local-read","local-write"],async handler(e,t){let r=(await km(go(t.paths)))?.safeParallelizableGroups.find(a=>a.ref===e.recommendationRef);if(r===void 0)throw v(`No recommendation lane found for ref "${e.recommendationRef}".`,{path:"recommendationRef",details:{recommendationRef:e.recommendationRef}});await $b(t.cwd,r.itemIds);let o=r.itemIds.map(a=>({itemId:a,origin:"recommendation"})),s=await _L(t.cwd,{title:e.title??r.title??e.recommendationRef,...r.rationale!==void 0&&{intent:r.rationale},provenance:"recommendation",sourceRecommendationRef:e.recommendationRef,...r.recommendedProfile!==void 0&&{profile:r.recommendedProfile},items:o});return C({unit:s})}},hEe={id:"create-draft-unit",title:"Create draft plan unit",description:"Create a user-authored draft plan unit from a hand-picked set of backlog items.",inputSchema:MW,outputSchema:Km,sideEffects:["local-read","local-write"],async handler(e,t){let i=e.itemIds??[];await $b(t.cwd,i);let r=i.map(s=>({itemId:s,origin:"user"})),o=await _L(t.cwd,{title:e.title,...e.intent!==void 0&&{intent:e.intent},provenance:"user",...e.profile!==void 0&&{profile:e.profile},items:r});return C({unit:o})}},IEe={id:"list-draft-units",title:"List draft plan units",description:"List draft plan units newest-first as compact paginated rows; use get-draft-unit for full intent and item-origin details.",inputSchema:UW,outputSchema:qW,outputProfile:Pe.agentPaginated,sideEffects:["local-read"],async handler(e,t){let i=JW(await ai(t.cwd)).map(bEe),r=sa(i,e,{defaultLimit:50,maxLimit:100});return C({units:r.items,total:r.total,limit:r.limit,offset:r.offset})}};function bEe(e){return{unitId:e.unitId,title:e.title,provenance:e.provenance,...e.sourceRecommendationRef!==void 0&&{sourceRecommendationRef:e.sourceRecommendationRef},...e.profile!==void 0&&{profile:e.profile},itemIds:e.items.map(t=>t.itemId),itemCount:e.items.length,status:e.status,...e.promotedSession!==void 0&&{promotedSession:e.promotedSession},...e.promotedAt!==void 0&&{promotedAt:e.promotedAt},createdAt:e.createdAt,updatedAt:e.updatedAt}}var REe={id:"get-draft-unit",title:"Get draft plan unit",description:"Read one draft plan unit by id.",inputSchema:EL,outputSchema:Km,sideEffects:["local-read"],async handler(e,t){let i=ws(await ai(t.cwd),e.unitId);if(i===void 0)throw v(`No draft plan unit found for ${e.unitId}.`,{path:"unitId",details:{unitId:e.unitId}});return C({unit:i})}},xEe={id:"update-draft-unit",title:"Update draft plan unit",description:"Edit a draft plan unit: rename, set intent or profile, and add, remove, or reorder its backlog items. Added items are recorded as user-added.",inputSchema:FW,outputSchema:Km,sideEffects:["local-read","local-write"],async handler(e,t){e.addItemIds!==void 0&&e.addItemIds.length>0&&await $b(t.cwd,e.addItemIds);let i=await YW(t.cwd,e.unitId,{...e.title!==void 0&&{title:e.title},...e.intent!==void 0&&{intent:e.intent},...e.profile!==void 0&&{profile:e.profile},...e.addItemIds!==void 0&&{addItems:e.addItemIds.map(r=>({itemId:r,origin:"user"}))},...e.removeItemIds!==void 0&&{removeItemIds:e.removeItemIds},...e.itemOrder!==void 0&&{itemOrder:e.itemOrder}});return C({unit:i})}},EEe={id:"delete-draft-unit",title:"Delete draft plan unit",description:"Delete a draft plan unit. Does not affect any session plan already promoted from it.",inputSchema:EL,outputSchema:zW,sideEffects:["local-write"],async handler(e,t){let i=await tX(t.cwd,e.unitId);return C({unitId:e.unitId,deleted:i})}},PEe={id:"promote-draft-unit",title:"Promote draft plan unit",description:"Promote a draft plan unit plan-first into one session plan, reusing the standard selection promotion. The unit is marked promoted with the resulting session.",inputSchema:GW,outputSchema:KW,sideEffects:["local-read","local-write"],async handler(e,t){let i=ws(await ai(t.cwd),e.unitId);if(i===void 0)throw v(`No draft plan unit found for ${e.unitId}.`,{path:"unitId",details:{unitId:e.unitId}});if(i.status==="promoted")throw v(`Draft plan unit ${e.unitId} was already promoted to ${i.promotedSession??"a session plan"}.`,{path:"unitId",details:{unitId:e.unitId}});if(i.items.length===0)throw v(`Draft plan unit ${e.unitId} has no items to promote.`,{path:"unitId",details:{unitId:e.unitId}});let r=i.items.map(a=>a.itemId);await $b(t.cwd,r);let o=await Ga({cwd:t.cwd,itemIds:r,title:i.title,...e.status!==void 0&&{status:e.status},...e.session!==void 0&&{session:e.session},profile:i.profile??null,agentTasks:t.agentTasks}),s=await eX(t.cwd,e.unitId,o.session);return await Pi(t.cwd,"promote-draft-unit",o.itemIds),C({unit:s,promotion:o})}},kEe={id:"merge-draft-units",title:"Merge draft plan units",description:"Combine several draft plan units into one user-authored unit (union of items) and remove the sources. Returns a dependency advisory for the merge.",inputSchema:VW,outputSchema:HW,sideEffects:["local-read","local-write"],async handler(e,t){let r=sX(await ai(t.cwd),e.unitIds).map(d=>d.items.map(u=>u.itemId)),o=await nX(t.cwd,e.unitIds,{...e.title!==void 0&&{title:e.title},...e.intent!==void 0&&{intent:e.intent},...e.profile!==void 0&&{profile:e.profile}}),{deps:s,labels:a}=await Nb(t.cwd,new Set(r.flat())),c=CL(r,s,a);return C({unit:o.unit,removedUnitIds:o.removedUnitIds,advisory:c})}},vEe={id:"split-draft-unit",title:"Split draft plan unit",description:"Peel a subset of a draft plan unit\u2019s items into a new user-authored unit; the original keeps the rest. Returns a dependency advisory for the split.",inputSchema:WW,outputSchema:XW,sideEffects:["local-read","local-write"],async handler(e,t){let{splitIds:i,remainderIds:r}=aX(await ai(t.cwd),e.unitId,e.itemIds),o=await iX(t.cwd,e.unitId,e.itemIds,{title:e.title,...e.intent!==void 0&&{intent:e.intent},...e.profile!==void 0&&{profile:e.profile}}),{deps:s,labels:a}=await Nb(t.cwd,new Set([...i,...r])),c=TL(i,r,s,a);return C({original:o.original,created:o.created,advisory:c})}},_Ee={id:"advise-merge-draft-units",title:"Advise on merging draft plan units",description:"Preview the dependency advisory for merging draft plan units without changing anything. Use before merging to warn when units are independent.",inputSchema:QW,outputSchema:kL,sideEffects:["local-read"],async handler(e,t){let r=sX(await ai(t.cwd),e.unitIds).map(a=>a.items.map(c=>c.itemId)),{deps:o,labels:s}=await Nb(t.cwd,new Set(r.flat()));return C({advisory:CL(r,o,s)})}},AEe={id:"advise-split-draft-unit",title:"Advise on splitting a draft plan unit",description:"Preview the dependency advisory for splitting a draft plan unit without changing anything. Use before splitting to warn when a dependency would be separated.",inputSchema:ZW,outputSchema:kL,sideEffects:["local-read"],async handler(e,t){let{splitIds:i,remainderIds:r}=aX(await ai(t.cwd),e.unitId,e.itemIds),{deps:o,labels:s}=await Nb(t.cwd,new Set([...i,...r]));return C({advisory:TL(i,r,o,s)})}},cX=[yEe,hEe,IEe,REe,xEe,EEe,PEe,kEe,vEe,_Ee,AEe];var OEe={id:"get-roadmap-state",title:"Get roadmap state",description:"Read private local-focus roadmap state plus shared/discovered roadmap context metadata.",inputSchema:RU,outputSchema:TP,outputProfile:Pe.uiRich,sideEffects:["local-read"],async handler(e,t){return C(await LT(t.cwd,e))}},wEe={id:"update-roadmap-state",title:"Update roadmap state",description:"Update private local-focus roadmap content and configured read-only shared roadmap sources.",inputSchema:xU,outputSchema:TP,outputProfile:Pe.uiRich,sideEffects:["local-read","local-write"],async handler(e,t){return C(await GK(t.cwd,e))}},dX=[OEe,wEe];var LL=["lifecycle-event-payloads","planning-task-payloads","superseded-recommendation-runs"];function Bb(e={}){let t=TEe(e.categories);return{dryRun:e.dryRun??!0,categories:t,cutoff:CEe(e),archive:e.archive??!1,rowLimit:jb(e.rowLimit,1e3,1,1e4),sampleLimit:jb(e.sampleLimit,20,0,100),keepLatestRecommendationRuns:jb(e.keepLatestRecommendationRuns,5,0,1e3),rebuildSearchAfter:e.rebuildSearchAfter??!0}}function TEe(e){if(e===void 0)return[...LL];if(e.length===0)throw v("categories must include at least one maintenance category.",{path:"categories"});let t=new Set(LL),i=[];for(let r of e){if(!t.has(r))throw v(`Unknown maintenance category: ${r}`,{path:"categories"});i.includes(r)||i.push(r)}return i}function CEe(e){if(e.olderThan!==void 0){if(!LEe(e.olderThan))throw v("olderThan must be a valid ISO timestamp.",{path:"olderThan"});let i=new Date(e.olderThan);if(Number.isNaN(i.getTime()))throw v("olderThan must be a valid ISO timestamp.",{path:"olderThan"});return i.toISOString()}let t=jb(e.olderThanDays,90,0,36500);return new Date(Date.now()-t*24*60*60*1e3).toISOString()}function LEe(e){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/.test(e)}function jb(e,t,i,r){let o=Math.trunc(e??t);return Number.isFinite(o)?Math.min(Math.max(o,i),r):t}import{mkdirSync as DEe,writeFileSync as $Ee}from"fs";import{join as uX,relative as NEe}from"path";function jEe(e,t){return pX(t,"runId"),uX(e,tI,"archives","maintenance",t)}function lX(e,t,i,r){if(r.length===0)return;pX(i,"category");let o=jEe(e,t);DEe(o,{recursive:!0});let s=uX(o,`${i}.jsonl`);return $Ee(s,`${r.map(a=>JSON.stringify(a)).join(`
|
|
583
|
+
`)}
|
|
584
|
+
`,"utf8"),{category:i,path:NEe(e,s),rowCount:r.length}}function pX(e,t){if(e.includes("/")||e.includes("\\")||e.includes("..")||e.length===0)throw new Error(`Invalid ${t} for maintenance archive path.`)}function mX(e){return eG(e)}function fX(e){return Tw(e)}function gX(e,t){tG(e,Tw(t))}import{existsSync as BEe}from"fs";async function yX(e,t={}){let i=Bb(t),r=`maintenance-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;if(!BEe(Ln(e)))throw v("eforge-plan SQLite store is not initialized; run a write action before maintenance.",{details:{initialized:!1}});let o=Kt(e,{create:!1});try{let s=Object.fromEntries(i.categories.map(A=>[A,Z1(o,A,i)])),a=Object.fromEntries(i.categories.map(A=>[A,s[A].count])),c=Object.fromEntries(i.categories.map(A=>[A,s[A].samples]));if(i.dryRun)return SX({runId:r,policy:i,status:"dry-run",prunedCounts:a,archivedCounts:{},preservedEvidenceCounts:{},archivePaths:[],samples:c});let d=[],u={},l,p={},m={},f=new Date().toISOString(),g=s["superseded-recommendation-runs"]?.ids??[],y=MEe(o,g);try{if(i.archive)for(let A of i.categories){let D=lX(e,r,A,s[A].archiveRows);D&&(d.push(D),u[D.category]=D.rowCount)}o.transaction(()=>{let A=fX(o);m.lifecycleEvidence=mX(o),i.rebuildSearchAfter||Ss(o,y);for(let D of i.categories)p[D]=Y1(o,D,s[D].ids,i.cutoff,i.keepLatestRecommendationRuns);gX(A,o),bi(o,{runId:r,categories:i.categories,startedAt:f,finishedAt:new Date().toISOString(),prunedCounts:p,archivedCounts:u,preservedEvidenceCounts:m,status:"applied"})})}catch(A){try{bi(o,{runId:r,categories:i.categories,startedAt:f,finishedAt:new Date().toISOString(),prunedCounts:p,archivedCounts:u,preservedEvidenceCounts:m,status:"failed",errorSummary:A instanceof Error?A.message:String(A)})}catch{}throw A}let R=[];if(i.rebuildSearchAfter&&(p["superseded-recommendation-runs"]??0)>0)try{l=Am(o,{types:["recommendation"],reason:"retention-maintenance"})}catch(A){Ss(o,y),R.push(`Recommendation search refresh failed after applied compaction: ${A instanceof Error?A.message:String(A)}`)}return SX({runId:r,policy:i,status:"applied",prunedCounts:p,archivedCounts:u,preservedEvidenceCounts:m,archivePaths:d,samples:c,searchRefresh:l,warnings:R})}finally{o.close()}}function MEe(e,t){if(t.length===0)return[];let i=t.map(()=>"?").join(",");return q(e,`SELECT lane_id FROM recommendation_lanes WHERE run_id IN (${i})`,...t).map(o=>({documentType:"recommendation",documentId:o.lane_id,reason:"retention-maintenance"}))}function SX(e){return C({schemaVersion:1,runId:e.runId,status:e.status,dryRun:e.policy.dryRun,categories:e.policy.categories,cutoff:e.policy.cutoff,archive:e.policy.archive,rowLimit:e.policy.rowLimit,sampleLimit:e.policy.sampleLimit,prunedCounts:e.prunedCounts,archivedCounts:e.archivedCounts,preservedEvidenceCounts:e.preservedEvidenceCounts,archivePaths:e.archivePaths,samples:e.samples,...e.searchRefresh?{searchRefresh:e.searchRefresh}:{},warnings:e.warnings??[]})}import{existsSync as hX,statSync as UEe}from"fs";async function IX(e,t={}){let i=Ln(e);if(!hX(i))return{schemaVersion:1,initialized:!1,storePath:i,fileSizes:ku(i),tableCounts:[],retentionEligibilityCounts:{},recentMaintenanceRuns:[]};let r=Bb({}),o=Kt(e,{create:!1,readonly:!0});try{return{schemaVersion:1,initialized:!0,storePath:i,fileSizes:ku(i),sqliteSchemaVersion:rI(o),tableCounts:nG(o),retentionEligibilityCounts:J1(o,r),searchIndexStatus:lC(o),recentMaintenanceRuns:Aw(o,t.recentRunLimit??10)}}finally{o.close()}}function ku(e){return{dbBytes:DL(e),walBytes:DL(`${e}-wal`),shmBytes:DL(`${e}-shm`)}}function DL(e){return hX(e)?UEe(e).size:0}import{existsSync as FEe}from"fs";async function bX(e,t={}){let i=Ln(e);if(!FEe(i))throw v("eforge-plan SQLite store is not initialized; VACUUM requires an existing store.",{details:{initialized:!1}});let r=`vacuum-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,o=ku(i),s=Kt(e,{create:!1}),a=new Date().toISOString();try{t.checkpointWal!==!1&&uI(s);let c=ku(i);iG(s),t.checkpointWal!==!1&&uI(s),bi(s,{runId:r,categories:["vacuum"],startedAt:a,finishedAt:new Date().toISOString(),prunedCounts:{},archivedCounts:{},preservedEvidenceCounts:{},status:"applied"}),t.checkpointWal!==!1&&uI(s);let d=ku(i);return{schemaVersion:1,runId:r,status:"applied",beforeBytes:o.dbBytes,afterBytes:d.dbBytes,walBytesBefore:o.walBytes,walBytesAfter:d.walBytes,shmBytesBefore:o.shmBytes,shmBytesAfter:d.shmBytes,...t.checkpointWal!==!1?{checkpoint:{requested:!0,walBytesBefore:o.walBytes,walBytesAfter:c.walBytes}}:{}}}catch(c){try{bi(s,{runId:r,categories:["vacuum"],startedAt:a,finishedAt:new Date().toISOString(),prunedCounts:{},archivedCounts:{},preservedEvidenceCounts:{},status:"failed",errorSummary:c instanceof Error?c.message:String(c)})}catch{}throw c}finally{s.close()}}import{existsSync as qEe}from"fs";function RX(e){if(!qEe(Ln(e)))throw v("eforge-plan SQLite store is not initialized; search maintenance requires an existing store.",{details:{initialized:!1}})}function xX(e){return`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}async function EX(e,t={}){RX(e);let i=xX("search-rebuild"),r=Kt(e,{create:!1}),o=new Date().toISOString();try{let s=Am(r,t);return bi(r,{runId:i,categories:["search-rebuild"],startedAt:o,finishedAt:new Date().toISOString(),prunedCounts:{refreshed:s.refreshed,deleted:s.deleted,clearedDirty:s.clearedDirty},archivedCounts:{},preservedEvidenceCounts:{},status:"applied"}),{schemaVersion:1,runId:i,category:"search-rebuild",status:"applied",searchRefresh:s}}catch(s){try{bi(r,{runId:i,categories:["search-rebuild"],startedAt:o,finishedAt:new Date().toISOString(),prunedCounts:{},archivedCounts:{},preservedEvidenceCounts:{},status:"failed",errorSummary:s instanceof Error?s.message:String(s)})}catch{}throw s}finally{r.close()}}async function PX(e){RX(e);let t=xX("search-optimize"),i=Kt(e,{create:!1}),r=new Date().toISOString();try{let o=pC(i);return bi(i,{runId:t,categories:["search-optimize"],startedAt:r,finishedAt:new Date().toISOString(),prunedCounts:{},archivedCounts:{},preservedEvidenceCounts:{},status:"applied"}),{schemaVersion:1,runId:t,category:"search-optimize",status:"applied",optimizedAt:o.optimizedAt,ok:o.ok}}catch(o){try{bi(i,{runId:t,categories:["search-optimize"],startedAt:r,finishedAt:new Date().toISOString(),prunedCounts:{},archivedCounts:{},preservedEvidenceCounts:{},status:"failed",errorSummary:o instanceof Error?o.message:String(o)})}catch{}throw o}finally{i.close()}}var Mb=n.Union([n.Literal("lifecycle-event-payloads"),n.Literal("planning-task-payloads"),n.Literal("superseded-recommendation-runs")]),kX=n.Union([n.Literal("backlog_item"),n.Literal("epic"),n.Literal("session_plan"),n.Literal("recommendation")]),zEe=n.Object({recentRunLimit:n.Optional(n.Integer({minimum:0,maximum:100}))},{additionalProperties:!1}),GEe=n.Object({dryRun:n.Optional(n.Boolean()),categories:n.Optional(n.Array(Mb,{minItems:1,uniqueItems:!0})),olderThan:n.Optional(n.String()),olderThanDays:n.Optional(n.Integer({minimum:0})),archive:n.Optional(n.Boolean()),rowLimit:n.Optional(n.Integer({minimum:1})),sampleLimit:n.Optional(n.Integer({minimum:0})),keepLatestRecommendationRuns:n.Optional(n.Integer({minimum:0})),rebuildSearchAfter:n.Optional(n.Boolean())},{additionalProperties:!1}),KEe=n.Object({types:n.Optional(n.Array(kX,{minItems:1,uniqueItems:!0})),reason:n.Optional(n.String())},{additionalProperties:!1}),VEe=n.Object({checkpointWal:n.Optional(n.Boolean())},{additionalProperties:!1}),Qa=n.Record(n.String(),n.Integer({minimum:0})),HEe=n.Object({runId:n.String(),categories:n.Optional(n.Array(n.String(),{maxItems:20})),startedAt:n.Optional(n.String()),finishedAt:n.Optional(n.String()),status:n.Optional(n.String()),prunedCounts:n.Optional(Qa),archivedCounts:n.Optional(Qa),preservedEvidenceCounts:n.Optional(Qa),errorSummary:n.Optional(n.String({maxLength:1e3}))},{additionalProperties:!1}),WEe=n.Object({eventKey:n.Optional(n.String()),eventType:n.Optional(n.String()),taskId:n.Optional(n.String()),purpose:n.Optional(n.String()),status:n.Optional(n.String()),runId:n.Optional(n.String()),isCurrent:n.Optional(n.Boolean()),occurredAt:n.Optional(n.String()),updatedAt:n.Optional(n.String()),createdAt:n.Optional(n.String()),summary:n.Optional(n.String()),laneCount:n.Optional(n.Integer({minimum:0})),laneItemCount:n.Optional(n.Integer({minimum:0})),hasRawRequest:n.Optional(n.Boolean()),hasRawResult:n.Optional(n.Boolean())},{additionalProperties:!1}),vX=n.Object({refreshed:n.Integer({minimum:0}),deleted:n.Integer({minimum:0}),clearedDirty:n.Integer({minimum:0}),types:n.Optional(n.Array(kX)),reason:n.Optional(n.String()),rebuiltAt:n.Optional(n.String())},{additionalProperties:!0}),XEe=n.Object({schemaVersion:n.Literal(1),runId:n.String(),status:n.Union([n.Literal("dry-run"),n.Literal("applied"),n.Literal("failed")]),dryRun:n.Boolean(),categories:n.Array(Mb),cutoff:n.String(),archive:n.Boolean(),rowLimit:n.Integer({minimum:1}),sampleLimit:n.Integer({minimum:0}),prunedCounts:Qa,archivedCounts:Qa,preservedEvidenceCounts:Qa,archivePaths:n.Array(n.Object({category:Mb,path:n.String(),rowCount:n.Integer({minimum:0})},{additionalProperties:!1})),samples:n.Partial(n.Record(Mb,n.Array(WEe))),searchRefresh:n.Optional(vX),warnings:n.Array(n.String())},{additionalProperties:!1}),QEe=n.Object({schemaVersion:n.Literal(1),initialized:n.Boolean(),storePath:n.String(),fileSizes:n.Object({dbBytes:n.Integer({minimum:0}),walBytes:n.Integer({minimum:0}),shmBytes:n.Integer({minimum:0})},{additionalProperties:!1}),sqliteSchemaVersion:n.Optional(n.Integer()),tableCounts:n.Array(n.Object({table:n.String(),count:n.Integer({minimum:0})},{additionalProperties:!1})),retentionEligibilityCounts:Qa,searchIndexStatus:n.Optional(YI),recentMaintenanceRuns:n.Array(HEe)},{additionalProperties:!1}),_X=n.Object({schemaVersion:n.Literal(1),runId:n.String(),category:n.Union([n.Literal("search-rebuild"),n.Literal("search-optimize")]),status:n.Union([n.Literal("applied"),n.Literal("failed")]),searchRefresh:n.Optional(vX),optimizedAt:n.Optional(n.String()),ok:n.Optional(n.Boolean())},{additionalProperties:!1}),ZEe=n.Object({schemaVersion:n.Literal(1),runId:n.String(),status:n.Union([n.Literal("applied"),n.Literal("failed")]),beforeBytes:n.Integer({minimum:0}),afterBytes:n.Integer({minimum:0}),walBytesBefore:n.Integer({minimum:0}),walBytesAfter:n.Integer({minimum:0}),shmBytesBefore:n.Integer({minimum:0}),shmBytesAfter:n.Integer({minimum:0}),checkpoint:n.Optional(n.Object({requested:n.Boolean(),walBytesBefore:n.Integer({minimum:0}),walBytesAfter:n.Integer({minimum:0})},{additionalProperties:!1}))},{additionalProperties:!1}),JEe={id:"get-store-status",title:"Get eforge-plan store status",description:"Report SQLite store size, schema, retention eligibility, search freshness, and recent maintenance runs without creating a store.",inputSchema:zEe,outputSchema:QEe,outputProfile:Pe.agentCompact,sideEffects:["local-read"],async handler(e,t){return C(await IX(t.cwd,e))}},YEe={id:"compact-planning-store",title:"Compact eforge-plan store",description:"Dry-run-first explicit retention compaction for prunable lifecycle/task payloads and superseded recommendation runs.",inputSchema:GEe,outputSchema:XEe,outputProfile:Pe.agentCompact,sideEffects:["local-write"],async handler(e,t){return C(await yX(t.cwd,e))}},ePe={id:"rebuild-search-index",title:"Rebuild eforge-plan search index",description:"Explicitly rebuild requested SQLite FTS search document types and clear matching dirty markers.",inputSchema:KEe,outputSchema:_X,outputProfile:Pe.agentCompact,sideEffects:["local-write"],async handler(e,t){return C(await EX(t.cwd,e))}},tPe={id:"optimize-search-index",title:"Optimize eforge-plan search index",description:"Run explicit SQLite FTS optimize maintenance and record an observable maintenance run.",inputSchema:n.Object({},{additionalProperties:!1}),outputSchema:_X,outputProfile:Pe.agentCompact,sideEffects:["local-write"],async handler(e,t){return C(await PX(t.cwd))}},nPe={id:"vacuum-planning-store",title:"VACUUM eforge-plan store",description:"Run explicit SQLite WAL checkpoint/VACUUM maintenance with before/after byte counts.",inputSchema:VEe,outputSchema:ZEe,outputProfile:Pe.agentCompact,sideEffects:["local-write"],async handler(e,t){return C(await bX(t.cwd,e))}},AX=[JEe,YEe,ePe,tPe,nPe];var iPe=dp,rPe=n.Object({id:n.Optional(n.String()),title:n.String(),claim:n.String(),evidence:n.Optional(n.String()),tags:n.Optional(n.Array(n.String())),priority:n.Optional(n.String()),epic:n.Optional(n.String()),dependsOn:n.Optional(n.Array(n.String())),acceptanceCriteria:n.String()}),oPe=n.Object({id:n.Optional(n.String()),title:n.String(),body:n.Optional(n.String()),status:n.Optional(n.String()),priority:n.Optional(n.String()),tags:n.Optional(n.Array(n.String()))}),sPe=n.Object({heading:n.String(),action:n.Union([n.Literal("replace"),n.Literal("append")]),content:n.String()},{additionalProperties:!1}),aPe=n.Object({id:n.String(),title:n.Optional(n.String()),status:n.Optional(n.String()),priority:n.Optional(n.String()),tags:n.Optional(n.Array(n.String())),evidenceNotes:n.Optional(n.String()),recheckNotes:n.Optional(n.String()),dependsOn:n.Optional(n.Array(n.String())),epic:n.Optional(n.String()),sections:n.Optional(n.Record(n.String(),n.String())),sectionOperations:n.Optional(n.Array(sPe)),expectedBodySha256:n.Optional(n.String()),expectedRecordSha256:n.Optional(n.String()),expectedUpdatedAt:n.Optional(n.String())},{additionalProperties:!1}),cPe=n.Object({itemId:n.String(),title:n.String(),status:n.String(),updatedAt:n.Optional(n.String()),path:n.String(),storage:n.Object({kind:n.Literal("canonical-sqlite"),id:n.String()},{additionalProperties:!1}),bodySha256:n.String(),recordSha256:n.String(),changedFields:n.Array(n.String()),changedSections:n.Array(n.String())},{additionalProperties:!1}),wX=n.Object({itemId:n.String(),status:n.Optional(n.Union([n.Literal("active"),n.Literal("planned")])),session:n.Optional(n.String()),profile:n.Optional(n.Union([n.Literal("errand"),n.Literal("excursion"),n.Literal("expedition")]))}),TX=cp,dPe=ca,NL=TU,CX="eforge-plan:planning-workstation",jL="/console/workstations/eforge-plan%3Aplanning-workstation";var LX="eforge-plan:open-planning-entry",DX="eforge-plan:planning-workstation",uPe=n.Object({kind:n.Literal("planning-entry"),workstationId:n.Literal(CX),workstationUrl:n.Literal(jL),integrationCommandId:n.Literal(LX),deepLinkId:n.Literal(DX)},{additionalProperties:!1}),lPe={id:"open-planning-entry",title:"Open eforge-plan planning entry",description:"Return generic eforge-plan planning entry metadata for hosts to continue in the planning workstation.",inputSchema:n.Object({},{additionalProperties:!1}),outputSchema:uPe,sideEffects:["none"],handler(){return{kind:"planning-entry",workstationId:CX,workstationUrl:jL,integrationCommandId:LX,deepLinkId:DX}}},pPe={id:"capture-item",title:"Capture backlog item",description:"Direct agent backlog workflow: create a visible eforge-plan backlog item and write it to private eforge-plan storage.",inputSchema:rPe,outputSchema:NL,outputProfile:Pe.agentCompact,sideEffects:["local-write"],async handler(e,t){let i=TH(e);if(i.length>0)throw v(wH(i),{details:{issues:i}});let r=await kPe(t.cwd,e.id,e.title);wC(t.cwd,e.epic,"capture-item");let o=new Date().toISOString(),s=[`# ${e.title}`,"","## Claim","",e.claim,"","## Evidence","",e.evidence??"No evidence recorded yet.","","## Acceptance Criteria","",e.acceptanceCriteria,""].join(`
|
|
585
|
+
`),a=gm(t.cwd,{id:r,title:e.title,status:"candidate",priority:e.priority,tags:e.tags??[],dependsOn:e.dependsOn??[],epic:e.epic,created:o,updated:o,body:s});return await Pi(t.cwd,"capture-item",[a.id]),C({itemId:a.id,status:a.userStatus,path:cm(t.cwd,a.id),storage:{kind:"canonical-sqlite",id:a.id}})}},mPe={id:"upsert-epic",title:"Upsert backlog epic",description:"Create or update a visible eforge-plan backlog epic in private storage without item membership lists.",inputSchema:oPe,outputSchema:NL,sideEffects:["local-write"],async handler(e,t){let i=e.id??$X(e.title),r=new Date().toISOString(),o=bs(t.cwd,i)??await Wd(t.cwd,i),s=e.body??o?.body??`# ${e.title}
|
|
586
|
+
|
|
587
|
+
`,a=CI(t.cwd,{id:i,title:e.title,...e.status!==void 0&&{status:BL(e.status,"candidate")},priority:e.priority,tags:e.tags,updated:r,body:s});return await Pi(t.cwd,"upsert-epic",[a.id]),C({epicId:a.id,status:a.userStatus,path:vI(t.cwd,a.id),storage:{kind:"canonical-sqlite",id:a.id}})}},fPe={id:"update-item",title:"Update backlog item",description:"Direct agent backlog workflow: update visible eforge-plan item metadata, title, and structured body sections in canonical private SQLite storage. Body-affecting updates require a lock token from get-item.",inputSchema:aPe,outputSchema:cPe,outputProfile:Pe.agentCompact,sideEffects:["local-write"],async handler(e,t){await yPe(t.cwd,e);let i=EPe(e);if(i&&e.expectedBodySha256===void 0&&e.expectedRecordSha256===void 0&&e.expectedUpdatedAt===void 0)throw v("Body-affecting update-item requests require expectedBodySha256, expectedRecordSha256, or expectedUpdatedAt from get-item. Re-read get-item before retrying.",{path:"expectedBodySha256",details:{id:e.id}});let r=Lr(t.cwd,e.id),o=r===void 0?await um(t.cwd,e.id):void 0;if(r===void 0&&!o)throw v(`Backlog item not found: ${e.id}`,{path:"id",details:{id:e.id}});bPe(e.id,o,i?e:void 0);let s;try{let l=r?.body??o.body;s=i?S2(l,{title:e.title,sections:e.sections,sectionOperations:e.sectionOperations}):{body:l,changedSections:[]}}catch(l){throw v(l instanceof Error?l.message:String(l),{path:"sectionOperations",details:{id:e.id}})}let a=xPe(t.cwd,e.id,o,i?e:void 0),c=new Date().toISOString(),d={updated:c};e.status!==void 0&&(d.status=BL(e.status,"candidate")),e.priority!==void 0&&(d.priority=e.priority),e.tags!==void 0&&(d.tags=e.tags),e.dependsOn!==void 0&&(d.depends_on=e.dependsOn),e.epic!==void 0&&(d.epic=e.epic.length>0?e.epic:null),e.evidenceNotes!==void 0&&(d.evidence_notes=e.evidenceNotes),e.recheckNotes!==void 0&&(d.recheck_notes=e.recheckNotes);let u=PPe(e);try{let l=vK(t.cwd,e.id,{...e.title!==void 0&&{title:e.title},...i&&{body:s.body,sections:qa(s.body)},status:d.status,priority:d.priority,tags:d.tags,dependsOn:d.depends_on,...e.epic!==void 0&&{epic:d.epic},updated:c,expectedBodySha256:e.expectedBodySha256,expectedRecordSha256:a.acceptedLegacyRecordSha256?void 0:e.expectedRecordSha256,expectedUpdatedAt:e.expectedUpdatedAt,frontmatter:d});if(await Pi(t.cwd,"update-item",[l.id]),l.bodySha256===void 0||l.recordSha256===void 0)throw new Error(`Canonical lock tokens missing for backlog item: ${l.id}`);return C({itemId:l.id,title:l.title,status:l.userStatus,updatedAt:l.updatedAt,path:cm(t.cwd,l.id),storage:{kind:"canonical-sqlite",id:l.id},bodySha256:l.bodySha256,recordSha256:l.recordSha256,changedFields:u,changedSections:s.changedSections})}catch(l){throw l instanceof Na?v(`${l.token} is stale; re-read get-item before retrying update-item.`,{path:l.token,details:{id:e.id,token:l.token}}):l}}},gPe={id:"promote-item",title:"Promote backlog item",description:"Reject duplicate coverage, write a session plan, and sync canonical SQLite metadata and lifecycle evidence for a visible eforge-plan backlog item.",inputSchema:wX,outputSchema:NL,sideEffects:["local-write"],async handler(e,t){let i=await PH({cwd:t.cwd,itemId:e.itemId,status:e.status??"active",session:e.session,profile:e.profile??null,agentTasks:t.agentTasks});return await Pi(t.cwd,"promote-item",[i.itemId]),C(i)}},SPe={id:"promote-selection",title:"Promote backlog selection",description:"Reject duplicate coverage, write one session plan, and sync canonical SQLite records for selected visible eforge-plan backlog items, an epic, or a recommendation ref.",inputSchema:TX,outputSchema:dPe,sideEffects:["local-write"],async handler(e,t){let i=await Ga({cwd:t.cwd,itemIds:e.itemIds,epicId:e.epicId,recommendationRef:e.recommendationRef,session:e.session,status:e.status,...e.profile!==void 0&&{profile:e.profile},title:e.title,agentTasks:t.agentTasks});return await Pi(t.cwd,"promote-selection",i.itemIds),C(i)}};function jr(e,t){for(let i of t)e.registerAction(i)}var Plt=e=>{if(typeof e.registerAction=="function"){for(let t of WH)e.registerAgentTask(t);e.registerAction(l2),e.registerAction(pPe),e.registerAction(mPe),e.registerAction(fPe),e.registerAction(lPe),e.registerAction(gPe),e.registerAction(SPe),e.registerAction(p2),jr(e,E2),jr(e,fC),jr(e,N4),jr(e,oW),jr(e,F4),jr(e,BH),jr(e,TW),jr(e,cX),jr(e,dX),jr(e,AX),e.registerInputSource({name:"eforge-plan",description:"Compile visible private and compatible legacy eforge-plan backlog items into ordinary eforge build-source Markdown.",fetch:kH}),e.registerConsoleContribution({id:"board",title:"eforge-plan board",description:"Declarative System surface for project-local visible backlog curation backed by private extension storage.",blocks:[{rendererId:"markdown",title:"Board summary",content:"Use **Render board** to display the current derived kanban board from visible eforge-plan backlog records."},{rendererId:"status-badge",title:"Lifecycle linkage",content:"Canonical SQLite lifecycle evidence enabled",status:"active"},{rendererId:"action-button",title:"List board data",content:"Return current board JSON.",action:{actionId:"list-board"}},{rendererId:"action-button",title:"List compact board data",content:"Return bounded open-first board JSON with counts and pagination for agents and compact hosts.",action:{actionId:"list-board-compact"}},{rendererId:"action-button",title:"Render board",content:"Show current board Markdown",action:{actionId:"render-board-markdown"}},{rendererId:"action-form",title:"Promote item",content:"Promote a backlog item to `.eforge/session-plans/<session>.md` after duplicate coverage checks.",action:{actionId:"promote-item",inputDefaults:{status:"active"}}},{rendererId:"action-form",title:"Promote selection",content:"Promote selected backlog items, an epic, or a recommendation ref to one session plan after duplicate coverage checks.",action:{actionId:"promote-selection",inputDefaults:{status:"active"}}},{rendererId:"action-button",title:"Get recommendations",content:"Read private recommendation summary data.",action:{actionId:"get-recommendations"}},{rendererId:"action-button",title:"Analyze all backlog",content:"Curate backlog records with source-first analysis and refresh recommendations.",action:{actionId:"analyze-all-backlog"}},{rendererId:"action-form",title:"Get backlog item",content:"Read one compact backlog item detail with sections and lifecycle rows without listing the board.",action:{actionId:"get-item"}},{rendererId:"action-form",title:"Get backlog epic",content:"Read one compact backlog epic detail and paginated item summaries.",action:{actionId:"get-epic"}},{rendererId:"action-form",title:"Search backlog items",content:"Search compact backlog item summaries with bounded output.",action:{actionId:"search-items"}},{rendererId:"action-form",title:"Search planning records",content:"Search backlog items, epics, session-plan summaries, and recommendation text.",action:{actionId:"search-planning-records"}},{rendererId:"action-button",title:"Get store status",content:"Report store size, schema, retention eligibility, search freshness, and recent maintenance runs.",action:{actionId:"get-store-status"}},{rendererId:"action-form",title:"Dry-run store compaction",content:"Preview retention compaction candidates without mutating the SQLite store.",action:{actionId:"compact-planning-store",inputDefaults:{dryRun:!0}}},{rendererId:"action-form",title:"Rebuild search index",content:"Explicitly rebuild SQLite FTS search documents for selected types.",action:{actionId:"rebuild-search-index"}},{rendererId:"action-button",title:"Optimize search index",content:"Run SQLite FTS optimize maintenance.",action:{actionId:"optimize-search-index"}},{rendererId:"action-form",title:"VACUUM planning store",content:"Run explicit WAL checkpoint and SQLite VACUUM maintenance.",action:{actionId:"vacuum-planning-store",inputDefaults:{checkpointWal:!0}}},{rendererId:"action-form",title:"Prepare planner context",content:"Prepare JSON-safe planner evidence without starting a chat runtime.",action:{actionId:"prepare-planner-context",inputDefaults:{includeRoadmap:!0}}},{rendererId:"action-button",title:"Get roadmap state",content:"Read local focus and shared/discovered roadmap context.",action:{actionId:"get-roadmap-state"}},{rendererId:"action-form",title:"Update roadmap state",content:"Update private local focus roadmap and shared source configuration.",action:{actionId:"update-roadmap-state"}},{rendererId:"action-button",title:"Refresh recommendations",content:"Start or reuse a bounded recommendation refresh task.",action:{actionId:"refresh-recommendations"}},{rendererId:"action-form",title:"Apply planner result",content:"Apply structured recommendation updates or handoff drafts.",action:{actionId:"apply-planner-result"}},{rendererId:"action-form",title:"Start planning agent task",content:"Prepare bounded context and start a daemon-owned planning draft task.",action:{actionId:"start-planning-agent-task",inputDefaults:{includeRoadmap:!0}}},{rendererId:"action-form",title:"Get planning agent task",content:"Read daemon-owned planning task status and result preview data.",action:{actionId:"get-planning-agent-task"}},{rendererId:"action-form",title:"Preview backlog curation task",content:"Validate a completed backlog-curation task on demand before applying it.",action:{actionId:"preview-backlog-curation-task"}},{rendererId:"action-form",title:"Cancel planning agent task",content:"Cancel a running daemon-owned planning draft task.",action:{actionId:"cancel-planning-agent-task"}},{rendererId:"action-form",title:"Remove planning agent task",content:"Dismiss a non-running daemon-owned planning task from the workflow list.",action:{actionId:"remove-planning-agent-task"}},{rendererId:"action-form",title:"Apply planning agent task result",content:"Apply only selected generated recommendations, handoff drafts, or session-plan sections.",action:{actionId:"apply-planning-agent-task-result"}},{rendererId:"action-form",title:"Resubmit session plan",content:"Recover a submitted session plan after terminal failed or removed queue/build evidence without deleting or recreating it.",action:{actionId:"resubmit-session-plan"}},{rendererId:"action-button",title:"Open planning workstation",content:"Return the generic planning entry URL for the eforge-plan workstation.",action:{actionId:"open-planning-entry"}},{rendererId:"action-form",title:"Capture item",content:"Capture a session-plan-ready candidate backlog item with concrete acceptance criteria.",action:{actionId:"capture-item"}},{rendererId:"action-form",title:"Update item",content:"Update backlog item metadata.",action:{actionId:"update-item"}},{rendererId:"action-form",title:"Fork recommendation to draft unit",content:"Create an editable draft plan unit from a recommendation safe-to-parallelize lane.",action:{actionId:"fork-recommendation-to-draft-unit"}},{rendererId:"action-form",title:"Create draft unit",content:"Create a user-authored draft plan unit from hand-picked backlog items.",action:{actionId:"create-draft-unit"}},{rendererId:"action-button",title:"List draft units",content:"List all draft plan units newest-first.",action:{actionId:"list-draft-units"}},{rendererId:"action-form",title:"Get draft unit",content:"Read one draft plan unit by id.",action:{actionId:"get-draft-unit"}},{rendererId:"action-form",title:"Update draft unit",content:"Edit a draft plan unit: rename, set intent or profile, add/remove/reorder items.",action:{actionId:"update-draft-unit"}},{rendererId:"action-form",title:"Delete draft unit",content:"Delete a draft plan unit.",action:{actionId:"delete-draft-unit"}},{rendererId:"action-form",title:"Promote draft unit",content:"Promote a draft plan unit plan-first into one session plan.",action:{actionId:"promote-draft-unit",inputDefaults:{status:"active"}}},{rendererId:"action-form",title:"Merge draft units",content:"Combine several draft plan units into one; returns a dependency advisory.",action:{actionId:"merge-draft-units"}},{rendererId:"action-form",title:"Split draft unit",content:"Peel a subset of a draft plan unit\u2019s items into a new unit; returns a dependency advisory.",action:{actionId:"split-draft-unit"}},{rendererId:"action-form",title:"Advise: merge draft units",content:"Preview the dependency advisory for a merge without changing anything.",action:{actionId:"advise-merge-draft-units"}},{rendererId:"action-form",title:"Advise: split draft unit",content:"Preview the dependency advisory for a split without changing anything.",action:{actionId:"advise-split-draft-unit"}}]}),e.registerConsoleWorkstation({id:"planning-workstation",title:"eforge-plan planning workstation",description:"Extension-owned planning workstation for backlog board data, flat session plans, and session plan sets.",subviews:[{id:"roadmap",label:"Roadmap",path:"?focus=roadmap"},{id:"backlog",label:"Backlog",path:"?focus=board"},{id:"plans",label:"Plans",path:"?focus=plans"}],allowedActions:["list-board-compact","get-item","get-epic","search-items","search-planning-records","get-store-status","compact-planning-store","rebuild-search-index","optimize-search-index","vacuum-planning-store","list-agent-runtime-profiles","update-item","render-board-markdown","get-recommendations","put-recommendations","analyze-all-backlog","get-roadmap-state","update-roadmap-state","refresh-recommendations","prepare-planner-context","apply-planner-result","start-planning-agent-task","get-planning-agent-task","preview-backlog-curation-task","cancel-planning-agent-task","list-planning-agent-tasks","remove-planning-agent-task","retry-planning-agent-task","redraft-planning-agent-task","apply-planning-agent-task-result","list-planning-artifacts","show-session-plan","show-session-plan-set","create-session-plan","set-session-plan-section","select-session-plan-dimensions","check-session-plan-readiness","set-session-plan-ready","delete-session-plan","update-session-plan-metadata","handoff-session-plan","resubmit-session-plan","start-plan-revision-session","list-plan-revision-sessions","get-plan-revision-session","create-plan-revision-annotation","update-plan-revision-annotation","delete-plan-revision-annotation","resolve-plan-revision-annotation","dismiss-plan-revision-annotation","start-plan-revision-turn","retry-plan-revision-turn","cancel-plan-revision-turn","apply-plan-revision-turn","fork-recommendation-to-draft-unit","create-draft-unit","list-draft-units","get-draft-unit","update-draft-unit","delete-draft-unit","promote-draft-unit","merge-draft-units","split-draft-unit","advise-merge-draft-units","advise-split-draft-unit"],frameBundle:{root:"workstation-assets/plans",entrypoint:"index.js",styles:["style.css"],browserSdkVersion:1}}),e.registerIntegrationCommand({id:"open-planning-entry",label:"Open eforge-plan planning entry",description:"Return the eforge-plan planning workstation URL for generic planning entry continuation.",inputSchema:n.Object({},{additionalProperties:!1}),action:{actionId:"open-planning-entry"}}),e.registerIntegrationCommand({id:"render-board",label:"Render eforge-plan board",inputSchema:iPe,action:{actionId:"render-board-markdown"}}),e.registerIntegrationCommand({id:"promote-item",label:"Promote eforge-plan item",inputSchema:wX,action:{actionId:"promote-item"}}),e.registerIntegrationCommand({id:"promote-selection",label:"Promote eforge-plan selection",inputSchema:TX,action:{actionId:"promote-selection"}}),e.registerDeepLink({id:"planning-workstation",label:"Open eforge-plan planning workstation",description:"Open the eforge-plan planning workstation for generic planning entry continuation.",urlTemplate:jL,action:{actionId:"open-planning-entry"}}),e.registerDeepLink({id:"board",label:"Open eforge-plan board",action:{actionId:"render-board-markdown"}}),e.registerDeepLink({id:"promote",label:"Promote eforge-plan item",action:{actionId:"promote-item"}}),e.registerDeepLink({id:"promote-selection",label:"Promote eforge-plan selection",action:{actionId:"promote-selection"}});for(let t of["enqueue:start","enqueue:complete","queue:prd:start","queue:prd:complete","session:start","session:end","landing:complete","landing:auto-merge:complete"])e.onEvent(t,async(i,r)=>{await eH(await OX(r),i,{mutateLegacyTraces:!1})});e.onEvent("queue:prd:removed",async(t,i)=>{let r=vPe(t);r!==void 0&&await oH(await OX(i),r,{timestamp:_Pe(t)})})}};async function yPe(e,t){try{fn(t.id)}catch(i){throw v(i instanceof Error?i.message:String(i),{path:"id",details:{id:t.id}})}if(t.status!==void 0)try{BL(t.status,"candidate")}catch(i){throw v(i instanceof Error?i.message:String(i),{path:"status",details:{id:t.id}})}if(t.title!==void 0&&(t.title.trim().length===0||t.title.includes(`
|
|
588
|
+
`)||t.title.includes("\r")))throw v("Title must be a non-empty single-line backlog title.",{path:"title",details:{id:t.id}});if(t.priority!==void 0&&(t.priority.trim().length===0||t.priority.includes(`
|
|
589
|
+
`)||t.priority.includes("\r")))throw v("Priority must be a non-empty single-line backlog label.",{path:"priority",details:{id:t.id}});hPe(t),t.dependsOn!==void 0&&await RPe(e,t.id,t.dependsOn),wC(e,t.epic,"update-item")}function hPe(e){if(e.expectedBodySha256!==void 0&&!/^[a-f0-9]{64}$/u.test(e.expectedBodySha256))throw v("expectedBodySha256 must be a 64-character lowercase hex SHA-256 value.",{path:"expectedBodySha256",details:{id:e.id,token:"expectedBodySha256"}});if(e.expectedRecordSha256!==void 0&&!/^[a-f0-9]{64}$/u.test(e.expectedRecordSha256))throw v("expectedRecordSha256 must be a 64-character lowercase hex SHA-256 value.",{path:"expectedRecordSha256",details:{id:e.id,token:"expectedRecordSha256"}});if(e.expectedUpdatedAt!==void 0&&!IPe(e.expectedUpdatedAt))throw v("expectedUpdatedAt must be a non-empty ISO timestamp string.",{path:"expectedUpdatedAt",details:{id:e.id,token:"expectedUpdatedAt"}})}function IPe(e){return e.trim().length>0&&!Number.isNaN(Date.parse(e))&&/^\d{4}-\d{2}-\d{2}T/u.test(e)}function bPe(e,t,i){if(t){if(i?.expectedBodySha256!==void 0&&i.expectedBodySha256!==t.bodySha256)throw v("expectedBodySha256 is stale; re-read get-item before retrying update-item.",{path:"expectedBodySha256",details:{id:e,token:"expectedBodySha256"}});if(i?.expectedRecordSha256!==void 0&&i.expectedRecordSha256!==t.recordSha256)throw v("expectedRecordSha256 is stale; re-read get-item before retrying update-item.",{path:"expectedRecordSha256",details:{id:e,token:"expectedRecordSha256"}});if(i?.expectedUpdatedAt!==void 0&&i.expectedUpdatedAt!==t.updated)throw v("expectedUpdatedAt is stale; re-read get-item before retrying update-item.",{path:"expectedUpdatedAt",details:{id:e,token:"expectedUpdatedAt"}})}}async function RPe(e,t,i){let r=new Set;for(let o of i){try{fn(o)}catch(s){throw v(s instanceof Error?s.message:String(s),{path:"dependsOn",details:{id:t,dependencyRef:o}})}if(o===t)throw v("dependsOn must not reference the updated item itself.",{path:"dependsOn",details:{id:t,dependencyRef:o}});if(r.has(o))throw v(`Duplicate dependency reference "${o}".`,{path:"dependsOn",details:{id:t,dependencyRef:o}});if(r.add(o),Lr(e,o)===void 0&&await ii(e,o)===null)throw v(`Dependency reference "${o}" does not resolve to a visible backlog item.`,{path:"dependsOn",details:{id:t,dependencyRef:o}})}}function xPe(e,t,i,r){if(Lr(e,t)!==void 0||!i)return{acceptedLegacyRecordSha256:!1};let o=i.record;return gm(e,{id:o.id,title:o.title,status:o.status,priority:o.priority,source:typeof i.frontmatter.source=="string"?i.frontmatter.source:void 0,tags:o.tags,dependsOn:o.depends_on,epic:o.epic,created:o.created,updated:o.updated,lastCheckedAt:typeof i.frontmatter.last_checked=="string"?i.frontmatter.last_checked:void 0,staleAfter:typeof i.frontmatter.stale_after=="string"?i.frontmatter.stale_after:void 0,body:i.body,frontmatter:i.frontmatter,sections:qa(i.body)}),{acceptedLegacyRecordSha256:r?.expectedRecordSha256!==void 0}}function EPe(e){return Object.prototype.hasOwnProperty.call(e,"title")||Object.prototype.hasOwnProperty.call(e,"sections")||Object.prototype.hasOwnProperty.call(e,"sectionOperations")}function PPe(e){return["title","status","priority","tags","dependsOn","epic","evidenceNotes","recheckNotes"].filter(t=>Object.prototype.hasOwnProperty.call(e,t))}function BL(e,t){if(e===void 0)return t;if(["candidate","planned","active","shipped","stale","superseded"].includes(e))return e;throw new Error(`Invalid backlog status "${e}". Expected candidate, planned, active, shipped, stale, or superseded.`)}async function kPe(e,t,i){if(t!==void 0){if(Lr(e,t)||await ii(e,t))throw v(`Backlog item "${t}" already exists.`,{path:"id",details:{itemId:t}});return t}let r=$X(i);for(let o=0;;o+=1){let s=o===0?r:`${r}-${o+1}`;if(!Lr(e,s)&&!await ii(e,s))return s}}function $X(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"backlog-item"}async function OX(e){let t=await e.exec.run(process.execPath,["-e","process.stdout.write(process.cwd())"]);if(t.exitCode!==0)throw new Error(t.stderr.trim()||"Failed to resolve lifecycle hook cwd.");return t.stdout.trim()}function vPe(e){return $L(e.prdId)??$L(e.id)}function _Pe(e){return $L(e.timestamp)}function $L(e){return typeof e=="string"&&e.length>0?e:void 0}async function klt(e,t){let i=await ii(e,t);return i?Object.fromEntries(zt(i.body)):{}}export{Plt as default,klt as loadItemSectionsForDisplay};
|