@alex.botez/elaborate 1.0.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.
Files changed (162) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +114 -0
  3. package/dist/durable/index.d.ts +10 -0
  4. package/dist/durable/index.d.ts.map +1 -0
  5. package/dist/durable/index.js +9 -0
  6. package/dist/durable/index.js.map +1 -0
  7. package/dist/durable/workflow.d.ts +165 -0
  8. package/dist/durable/workflow.d.ts.map +1 -0
  9. package/dist/durable/workflow.js +224 -0
  10. package/dist/durable/workflow.js.map +1 -0
  11. package/dist/interview/classification.d.ts +16 -0
  12. package/dist/interview/classification.d.ts.map +1 -0
  13. package/dist/interview/classification.js +25 -0
  14. package/dist/interview/classification.js.map +1 -0
  15. package/dist/interview/composition.d.ts +12 -0
  16. package/dist/interview/composition.d.ts.map +1 -0
  17. package/dist/interview/composition.js +19 -0
  18. package/dist/interview/composition.js.map +1 -0
  19. package/dist/interview/describe.d.ts +41 -0
  20. package/dist/interview/describe.d.ts.map +1 -0
  21. package/dist/interview/describe.js +80 -0
  22. package/dist/interview/describe.js.map +1 -0
  23. package/dist/interview/deviation.d.ts +91 -0
  24. package/dist/interview/deviation.d.ts.map +1 -0
  25. package/dist/interview/deviation.js +137 -0
  26. package/dist/interview/deviation.js.map +1 -0
  27. package/dist/interview/extraction.d.ts +32 -0
  28. package/dist/interview/extraction.d.ts.map +1 -0
  29. package/dist/interview/extraction.js +102 -0
  30. package/dist/interview/extraction.js.map +1 -0
  31. package/dist/interview/index.d.ts +25 -0
  32. package/dist/interview/index.d.ts.map +1 -0
  33. package/dist/interview/index.js +22 -0
  34. package/dist/interview/index.js.map +1 -0
  35. package/dist/interview/macros.d.ts +91 -0
  36. package/dist/interview/macros.d.ts.map +1 -0
  37. package/dist/interview/macros.js +138 -0
  38. package/dist/interview/macros.js.map +1 -0
  39. package/dist/interview/preambles.d.ts +18 -0
  40. package/dist/interview/preambles.d.ts.map +1 -0
  41. package/dist/interview/preambles.js +93 -0
  42. package/dist/interview/preambles.js.map +1 -0
  43. package/dist/interview/progress.d.ts +31 -0
  44. package/dist/interview/progress.d.ts.map +1 -0
  45. package/dist/interview/progress.js +51 -0
  46. package/dist/interview/progress.js.map +1 -0
  47. package/dist/interview/prompt.d.ts +20 -0
  48. package/dist/interview/prompt.d.ts.map +1 -0
  49. package/dist/interview/prompt.js +58 -0
  50. package/dist/interview/prompt.js.map +1 -0
  51. package/dist/phases/aggregate/assumptions.d.ts +14 -0
  52. package/dist/phases/aggregate/assumptions.d.ts.map +1 -0
  53. package/dist/phases/aggregate/assumptions.js +33 -0
  54. package/dist/phases/aggregate/assumptions.js.map +1 -0
  55. package/dist/phases/aggregate/findings.d.ts +10 -0
  56. package/dist/phases/aggregate/findings.d.ts.map +1 -0
  57. package/dist/phases/aggregate/findings.js +20 -0
  58. package/dist/phases/aggregate/findings.js.map +1 -0
  59. package/dist/phases/aggregate/goals.d.ts +28 -0
  60. package/dist/phases/aggregate/goals.d.ts.map +1 -0
  61. package/dist/phases/aggregate/goals.js +74 -0
  62. package/dist/phases/aggregate/goals.js.map +1 -0
  63. package/dist/phases/aggregate/index.d.ts +128 -0
  64. package/dist/phases/aggregate/index.d.ts.map +1 -0
  65. package/dist/phases/aggregate/index.js +165 -0
  66. package/dist/phases/aggregate/index.js.map +1 -0
  67. package/dist/phases/aggregate/pam.d.ts +19 -0
  68. package/dist/phases/aggregate/pam.d.ts.map +1 -0
  69. package/dist/phases/aggregate/pam.js +37 -0
  70. package/dist/phases/aggregate/pam.js.map +1 -0
  71. package/dist/phases/aggregate/scope.d.ts +24 -0
  72. package/dist/phases/aggregate/scope.d.ts.map +1 -0
  73. package/dist/phases/aggregate/scope.js +67 -0
  74. package/dist/phases/aggregate/scope.js.map +1 -0
  75. package/dist/phases/aggregate/shared.d.ts +16 -0
  76. package/dist/phases/aggregate/shared.d.ts.map +1 -0
  77. package/dist/phases/aggregate/shared.js +26 -0
  78. package/dist/phases/aggregate/shared.js.map +1 -0
  79. package/dist/phases/aggregate/stakeholders.d.ts +27 -0
  80. package/dist/phases/aggregate/stakeholders.d.ts.map +1 -0
  81. package/dist/phases/aggregate/stakeholders.js +90 -0
  82. package/dist/phases/aggregate/stakeholders.js.map +1 -0
  83. package/dist/phases/aggregate/waitingRoom.d.ts +16 -0
  84. package/dist/phases/aggregate/waitingRoom.d.ts.map +1 -0
  85. package/dist/phases/aggregate/waitingRoom.js +32 -0
  86. package/dist/phases/aggregate/waitingRoom.js.map +1 -0
  87. package/dist/phases/assumptions.d.ts +19 -0
  88. package/dist/phases/assumptions.d.ts.map +1 -0
  89. package/dist/phases/assumptions.js +224 -0
  90. package/dist/phases/assumptions.js.map +1 -0
  91. package/dist/phases/configuration.d.ts +8 -0
  92. package/dist/phases/configuration.d.ts.map +1 -0
  93. package/dist/phases/configuration.js +14 -0
  94. package/dist/phases/configuration.js.map +1 -0
  95. package/dist/phases/goals.d.ts +15 -0
  96. package/dist/phases/goals.d.ts.map +1 -0
  97. package/dist/phases/goals.js +297 -0
  98. package/dist/phases/goals.js.map +1 -0
  99. package/dist/phases/index.d.ts +21 -0
  100. package/dist/phases/index.d.ts.map +1 -0
  101. package/dist/phases/index.js +56 -0
  102. package/dist/phases/index.js.map +1 -0
  103. package/dist/phases/opening.d.ts +12 -0
  104. package/dist/phases/opening.d.ts.map +1 -0
  105. package/dist/phases/opening.js +99 -0
  106. package/dist/phases/opening.js.map +1 -0
  107. package/dist/phases/purpose.d.ts +17 -0
  108. package/dist/phases/purpose.d.ts.map +1 -0
  109. package/dist/phases/purpose.js +207 -0
  110. package/dist/phases/purpose.js.map +1 -0
  111. package/dist/phases/schema.d.ts +861 -0
  112. package/dist/phases/schema.d.ts.map +1 -0
  113. package/dist/phases/schema.js +157 -0
  114. package/dist/phases/schema.js.map +1 -0
  115. package/dist/phases/scope.d.ts +18 -0
  116. package/dist/phases/scope.d.ts.map +1 -0
  117. package/dist/phases/scope.js +440 -0
  118. package/dist/phases/scope.js.map +1 -0
  119. package/dist/phases/session/archive.d.ts +19 -0
  120. package/dist/phases/session/archive.d.ts.map +1 -0
  121. package/dist/phases/session/archive.js +49 -0
  122. package/dist/phases/session/archive.js.map +1 -0
  123. package/dist/phases/session/file.d.ts +31 -0
  124. package/dist/phases/session/file.d.ts.map +1 -0
  125. package/dist/phases/session/file.js +113 -0
  126. package/dist/phases/session/file.js.map +1 -0
  127. package/dist/phases/session/index.d.ts +8 -0
  128. package/dist/phases/session/index.d.ts.map +1 -0
  129. package/dist/phases/session/index.js +8 -0
  130. package/dist/phases/session/index.js.map +1 -0
  131. package/dist/phases/session/persistence.d.ts +30 -0
  132. package/dist/phases/session/persistence.d.ts.map +1 -0
  133. package/dist/phases/session/persistence.js +91 -0
  134. package/dist/phases/session/persistence.js.map +1 -0
  135. package/dist/phases/shared.d.ts +64 -0
  136. package/dist/phases/shared.d.ts.map +1 -0
  137. package/dist/phases/shared.js +100 -0
  138. package/dist/phases/shared.js.map +1 -0
  139. package/dist/phases/stakeholders.d.ts +17 -0
  140. package/dist/phases/stakeholders.d.ts.map +1 -0
  141. package/dist/phases/stakeholders.js +370 -0
  142. package/dist/phases/stakeholders.js.map +1 -0
  143. package/dist/phases/validation.d.ts +13 -0
  144. package/dist/phases/validation.d.ts.map +1 -0
  145. package/dist/phases/validation.js +130 -0
  146. package/dist/phases/validation.js.map +1 -0
  147. package/dist/skill/adapter.d.ts +16 -0
  148. package/dist/skill/adapter.d.ts.map +1 -0
  149. package/dist/skill/adapter.js +278 -0
  150. package/dist/skill/adapter.js.map +1 -0
  151. package/dist/skill/index.d.ts +12 -0
  152. package/dist/skill/index.d.ts.map +1 -0
  153. package/dist/skill/index.js +11 -0
  154. package/dist/skill/index.js.map +1 -0
  155. package/dist/skill/log.d.ts +18 -0
  156. package/dist/skill/log.d.ts.map +1 -0
  157. package/dist/skill/log.js +53 -0
  158. package/dist/skill/log.js.map +1 -0
  159. package/package.json +83 -0
  160. package/skills/elaborate/SKILL.md +97 -0
  161. package/skills/elaborate/scripts/elaborate.cjs +589 -0
  162. package/skills/project-brief/SKILL.md +45 -0
@@ -0,0 +1,589 @@
1
+ #!/usr/bin/env node
2
+ "use strict";var Ru=Object.create;var fr=Object.defineProperty;var Pu=Object.getOwnPropertyDescriptor;var ju=Object.getOwnPropertyNames;var qu=Object.getPrototypeOf,Lu=Object.prototype.hasOwnProperty;var I=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),Du=(s,e)=>{for(var t in e)fr(s,t,{get:e[t],enumerable:!0})},Mu=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ju(e))!Lu.call(s,r)&&r!==t&&fr(s,r,{get:()=>e[r],enumerable:!(n=Pu(e,r))||n.enumerable});return s};var yt=(s,e,t)=>(t=s!=null?Ru(qu(s)):{},Mu(e||!s||!s.__esModule?fr(t,"default",{value:s,enumerable:!0}):t,s));var D=I(U=>{"use strict";var Tr=Symbol.for("yaml.alias"),Na=Symbol.for("yaml.document"),un=Symbol.for("yaml.map"),Ra=Symbol.for("yaml.pair"),Er=Symbol.for("yaml.scalar"),dn=Symbol.for("yaml.seq"),Te=Symbol.for("yaml.node.type"),Mp=s=>!!s&&typeof s=="object"&&s[Te]===Tr,Fp=s=>!!s&&typeof s=="object"&&s[Te]===Na,Wp=s=>!!s&&typeof s=="object"&&s[Te]===un,Bp=s=>!!s&&typeof s=="object"&&s[Te]===Ra,Pa=s=>!!s&&typeof s=="object"&&s[Te]===Er,Gp=s=>!!s&&typeof s=="object"&&s[Te]===dn;function ja(s){if(s&&typeof s=="object")switch(s[Te]){case un:case dn:return!0}return!1}function zp(s){if(s&&typeof s=="object")switch(s[Te]){case Tr:case un:case Er:case dn:return!0}return!1}var Kp=s=>(Pa(s)||ja(s))&&!!s.anchor;U.ALIAS=Tr;U.DOC=Na;U.MAP=un;U.NODE_TYPE=Te;U.PAIR=Ra;U.SCALAR=Er;U.SEQ=dn;U.hasAnchor=Kp;U.isAlias=Mp;U.isCollection=ja;U.isDocument=Fp;U.isMap=Wp;U.isNode=zp;U.isPair=Bp;U.isScalar=Pa;U.isSeq=Gp});var rs=I($r=>{"use strict";var z=D(),te=Symbol("break visit"),qa=Symbol("skip children"),we=Symbol("remove node");function fn(s,e){let t=La(e);z.isDocument(s)?Rt(null,s.contents,t,Object.freeze([s]))===we&&(s.contents=null):Rt(null,s,t,Object.freeze([]))}fn.BREAK=te;fn.SKIP=qa;fn.REMOVE=we;function Rt(s,e,t,n){let r=Da(s,e,t,n);if(z.isNode(r)||z.isPair(r))return Ma(s,n,r),Rt(s,r,t,n);if(typeof r!="symbol"){if(z.isCollection(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){let o=Rt(i,e.items[i],t,n);if(typeof o=="number")i=o-1;else{if(o===te)return te;o===we&&(e.items.splice(i,1),i-=1)}}}else if(z.isPair(e)){n=Object.freeze(n.concat(e));let i=Rt("key",e.key,t,n);if(i===te)return te;i===we&&(e.key=null);let o=Rt("value",e.value,t,n);if(o===te)return te;o===we&&(e.value=null)}}return r}async function pn(s,e){let t=La(e);z.isDocument(s)?await Pt(null,s.contents,t,Object.freeze([s]))===we&&(s.contents=null):await Pt(null,s,t,Object.freeze([]))}pn.BREAK=te;pn.SKIP=qa;pn.REMOVE=we;async function Pt(s,e,t,n){let r=await Da(s,e,t,n);if(z.isNode(r)||z.isPair(r))return Ma(s,n,r),Pt(s,r,t,n);if(typeof r!="symbol"){if(z.isCollection(e)){n=Object.freeze(n.concat(e));for(let i=0;i<e.items.length;++i){let o=await Pt(i,e.items[i],t,n);if(typeof o=="number")i=o-1;else{if(o===te)return te;o===we&&(e.items.splice(i,1),i-=1)}}}else if(z.isPair(e)){n=Object.freeze(n.concat(e));let i=await Pt("key",e.key,t,n);if(i===te)return te;i===we&&(e.key=null);let o=await Pt("value",e.value,t,n);if(o===te)return te;o===we&&(e.value=null)}}return r}function La(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Da(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(z.isMap(e))return t.Map?.(s,e,n);if(z.isSeq(e))return t.Seq?.(s,e,n);if(z.isPair(e))return t.Pair?.(s,e,n);if(z.isScalar(e))return t.Scalar?.(s,e,n);if(z.isAlias(e))return t.Alias?.(s,e,n)}function Ma(s,e,t){let n=e[e.length-1];if(z.isCollection(n))n.items[s]=t;else if(z.isPair(n))s==="key"?n.key=t:n.value=t;else if(z.isDocument(n))n.contents=t;else{let r=z.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}$r.visit=fn;$r.visitAsync=pn});var Nr=I(Wa=>{"use strict";var Fa=D(),Up=rs(),Vp={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Yp=s=>s.replace(/[!,[\]{}]/g,e=>Vp[e]),is=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[i,o]=n;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[i]=n;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{let o=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,o),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Yp(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&Fa.isNode(e.contents)){let i={};Up.visit(e.contents,(o,a)=>{Fa.isNode(a)&&a.tag&&(i[a.tag]=!0)}),r=Object.keys(i)}else r=[];for(let[i,o]of n)i==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(o)))&&t.push(`%TAG ${i} ${o}`);return t.join(`
3
+ `)}};is.defaultYaml={explicit:!1,version:"1.2"};is.defaultTags={"!!":"tag:yaml.org,2002:"};Wa.Directives=is});var mn=I(os=>{"use strict";var Ba=D(),Zp=rs();function Hp(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Ga(s){let e=new Set;return Zp.visit(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function za(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function Jp(s,e){let t=[],n=new Map,r=null;return{onAnchor:i=>{t.push(i),r??(r=Ga(s));let o=za(e,r);return r.add(o),o},setAnchors:()=>{for(let i of t){let o=n.get(i);if(typeof o=="object"&&o.anchor&&(Ba.isScalar(o.node)||Ba.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:n}}os.anchorIsValid=Hp;os.anchorNames=Ga;os.createNodeAnchors=Jp;os.findNewAnchor=za});var Rr=I(Ka=>{"use strict";function as(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let r=0,i=n.length;r<i;++r){let o=n[r],a=as(s,n,String(r),o);a===void 0?delete n[r]:a!==o&&(n[r]=a)}else if(n instanceof Map)for(let r of Array.from(n.keys())){let i=n.get(r),o=as(s,n,r,i);o===void 0?n.delete(r):o!==i&&n.set(r,o)}else if(n instanceof Set)for(let r of Array.from(n)){let i=as(s,n,r,r);i===void 0?n.delete(r):i!==r&&(n.delete(r),n.add(i))}else for(let[r,i]of Object.entries(n)){let o=as(s,n,r,i);o===void 0?delete n[r]:o!==i&&(n[r]=o)}return s.call(e,t,n)}Ka.applyReviver=as});var Le=I(Va=>{"use strict";var Qp=D();function Ua(s,e,t){if(Array.isArray(s))return s.map((n,r)=>Ua(n,String(r),t));if(s&&typeof s.toJSON=="function"){if(!t||!Qp.hasAnchor(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=i=>{n.res=i,delete t.onCreate};let r=s.toJSON(e,t);return t.onCreate&&t.onCreate(r),r}return typeof s=="bigint"&&!t?.keep?Number(s):s}Va.toJS=Ua});var hn=I(Za=>{"use strict";var Xp=Rr(),Ya=D(),em=Le(),Pr=class{constructor(e){Object.defineProperty(this,Ya.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Ya.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=em.toJS(this,"",o);if(typeof r=="function")for(let{count:l,res:u}of o.anchors.values())r(u,l);return typeof i=="function"?Xp.applyReviver(i,{"":a},"",a):a}};Za.NodeBase=Pr});var cs=I(Ha=>{"use strict";var tm=mn(),sm=rs(),jt=D(),nm=hn(),rm=Le(),jr=class extends nm.NodeBase{constructor(e){super(jt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],sm.visit(e,{Node:(i,o)=>{(jt.isAlias(o)||jt.hasAnchor(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let r;for(let i of n){if(i===this)break;i.anchor===this.source&&(r=i)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,o=this.resolve(r,t);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(a||(rm.toJS(o,null,t),a=n.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=gn(r,o,n)),a.count*a.aliasCount>i)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(tm.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(e.implicitKey)return`${r} `}return r}};function gn(s,e,t){if(jt.isAlias(e)){let n=e.resolve(s),r=t&&n&&t.get(n);return r?r.count*r.aliasCount:0}else if(jt.isCollection(e)){let n=0;for(let r of e.items){let i=gn(s,r,t);i>n&&(n=i)}return n}else if(jt.isPair(e)){let n=gn(s,e.key,t),r=gn(s,e.value,t);return Math.max(n,r)}return 1}Ha.Alias=jr});var B=I(qr=>{"use strict";var im=D(),om=hn(),am=Le(),cm=s=>!s||typeof s!="function"&&typeof s!="object",De=class extends om.NodeBase{constructor(e){super(im.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:am.toJS(this.value,e,t)}toString(){return String(this.value)}};De.BLOCK_FOLDED="BLOCK_FOLDED";De.BLOCK_LITERAL="BLOCK_LITERAL";De.PLAIN="PLAIN";De.QUOTE_DOUBLE="QUOTE_DOUBLE";De.QUOTE_SINGLE="QUOTE_SINGLE";qr.Scalar=De;qr.isScalarValue=cm});var ls=I(Qa=>{"use strict";var lm=cs(),lt=D(),Ja=B(),um="tag:yaml.org,2002:";function dm(s,e,t){if(e){let n=t.filter(i=>i.tag===e),r=n.find(i=>!i.format)??n[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return t.find(n=>n.identify?.(s)&&!n.format)}function fm(s,e,t){if(lt.isDocument(s)&&(s=s.contents),lt.isNode(s))return s;if(lt.isPair(s)){let d=t.schema[lt.MAP].createNode?.(t.schema,null,t);return d.items.push(s),d}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:r,onTagObj:i,schema:o,sourceObjects:a}=t,l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor??(l.anchor=r(s)),new lm.Alias(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=um+e.slice(2));let u=dm(s,e,o.tags);if(!u){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let d=new Ja.Scalar(s);return l&&(l.node=d),d}u=s instanceof Map?o[lt.MAP]:Symbol.iterator in Object(s)?o[lt.SEQ]:o[lt.MAP]}i&&(i(u),delete t.onTagObj);let p=u?.createNode?u.createNode(t.schema,s,t):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(t.schema,s,t):new Ja.Scalar(s);return e?p.tag=e:u.default||(p.tag=u.tag),l&&(l.node=p),p}Qa.createNode=fm});var bn=I(yn=>{"use strict";var pm=ls(),ve=D(),mm=hn();function Lr(s,e,t){let n=t;for(let r=e.length-1;r>=0;--r){let i=e[r];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let o=[];o[i]=n,n=o}else n=new Map([[i,n]])}return pm.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var Xa=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,Dr=class extends mm.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>ve.isNode(n)||ve.isPair(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Xa(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(ve.isCollection(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Lr(this.schema,r,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(ve.isCollection(r))return r.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&ve.isScalar(i)?i.value:i:ve.isCollection(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!ve.isPair(t))return!1;let n=t.value;return n==null||e&&ve.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return ve.isCollection(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let i=this.get(n,!0);if(ve.isCollection(i))i.setIn(r,t);else if(i===void 0&&this.schema)this.set(n,Lr(this.schema,r,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};yn.Collection=Dr;yn.collectionFromPath=Lr;yn.isEmptyPath=Xa});var us=I(wn=>{"use strict";var hm=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Mr(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var gm=(s,e,t)=>s.endsWith(`
4
+ `)?Mr(t,e):t.includes(`
5
+ `)?`
6
+ `+Mr(t,e):(s.endsWith(" ")?"":" ")+t;wn.indentComment=Mr;wn.lineComment=gm;wn.stringifyComment=hm});var tc=I(ds=>{"use strict";var ym="flow",Fr="block",vn="quoted";function bm(s,e,t="flow",{indentAtStart:n,lineWidth:r=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){if(!r||r<0)return s;r<i&&(i=0);let l=Math.max(1+i,1+r-e.length);if(s.length<=l)return s;let u=[],p={},d=r-e.length;typeof n=="number"&&(n>r-Math.max(2,i)?u.push(0):d=r-n);let f,y,g=!1,m=-1,h=-1,v=-1;t===Fr&&(m=ec(s,m,e.length),m!==-1&&(d=m+l));for(let S;S=s[m+=1];){if(t===vn&&S==="\\"){switch(h=m,s[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}v=m}if(S===`
7
+ `)t===Fr&&(m=ec(s,m,e.length)),d=m+e.length+l,f=void 0;else{if(S===" "&&y&&y!==" "&&y!==`
8
+ `&&y!==" "){let _=s[m+1];_&&_!==" "&&_!==`
9
+ `&&_!==" "&&(f=m)}if(m>=d)if(f)u.push(f),d=f+l,f=void 0;else if(t===vn){for(;y===" "||y===" ";)y=S,S=s[m+=1],g=!0;let _=m>v+1?m-2:h-1;if(p[_])return s;u.push(_),p[_]=!0,d=_+l,f=void 0}else g=!0}y=S}if(g&&a&&a(),u.length===0)return s;o&&o();let b=s.slice(0,u[0]);for(let S=0;S<u.length;++S){let _=u[S],C=u[S+1]||s.length;_===0?b=`
10
+ ${e}${s.slice(0,C)}`:(t===vn&&p[_]&&(b+=`${s[_]}\\`),b+=`
11
+ ${e}${s.slice(_+1,C)}`)}return b}function ec(s,e,t){let n=e,r=e+1,i=s[r];for(;i===" "||i===" ";)if(e<r+t)i=s[++e];else{do i=s[++e];while(i&&i!==`
12
+ `);n=e,r=e+1,i=s[r]}return n}ds.FOLD_BLOCK=Fr;ds.FOLD_FLOW=ym;ds.FOLD_QUOTED=vn;ds.foldFlowLines=bm});var ps=I(sc=>{"use strict";var pe=B(),Me=tc(),kn=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),xn=s=>/^(%|---|\.\.\.)/m.test(s);function wm(s,e,t){if(!e||e<0)return!1;let n=e-t,r=s.length;if(r<=n)return!1;for(let i=0,o=0;i<r;++i)if(s[i]===`
13
+ `){if(i-o>n)return!0;if(o=i+1,r-o<=n)return!1}return!0}function fs(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:n}=e,r=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(xn(s)?" ":""),o="",a=0;for(let l=0,u=t[l];u;u=t[++l])if(u===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,u="\\"),u==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let p=t.substr(l+2,4);switch(p){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:p.substr(0,2)==="00"?o+="\\x"+p.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]==='"'||t.length<r)l+=1;else{for(o+=t.slice(a,l)+`
14
+
15
+ `;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=`
16
+ `,l+=2;o+=i,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,n?o:Me.foldFlowLines(o,i,Me.FOLD_QUOTED,kn(e,!1))}function Wr(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
17
+ `)||/[ \t]\n|\n[ \t]/.test(s))return fs(s,e);let t=e.indent||(xn(s)?" ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
18
+ ${t}`)+"'";return e.implicitKey?n:Me.foldFlowLines(n,t,Me.FOLD_FLOW,kn(e,!1))}function qt(s,e){let{singleQuote:t}=e.options,n;if(t===!1)n=fs;else{let r=s.includes('"'),i=s.includes("'");r&&!i?n=Wr:i&&!r?n=fs:n=t?Wr:fs}return n(s,e)}var Br;try{Br=new RegExp(`(^|(?<!
19
+ ))
20
+ +(?!
21
+ |$)`,"g")}catch{Br=/\n+(?!\n|$)/g}function Sn({comment:s,type:e,value:t},n,r,i){let{blockQuote:o,commentString:a,lineWidth:l}=n.options;if(!o||/\n[\t ]+$/.test(t))return qt(t,n);let u=n.indent||(n.forceBlockIndent||xn(t)?" ":""),p=o==="literal"?!0:o==="folded"||e===pe.Scalar.BLOCK_FOLDED?!1:e===pe.Scalar.BLOCK_LITERAL?!0:!wm(t,l,u.length);if(!t)return p?`|
22
+ `:`>
23
+ `;let d,f;for(f=t.length;f>0;--f){let C=t[f-1];if(C!==`
24
+ `&&C!==" "&&C!==" ")break}let y=t.substring(f),g=y.indexOf(`
25
+ `);g===-1?d="-":t===y||g!==y.length-1?(d="+",i&&i()):d="",y&&(t=t.slice(0,-y.length),y[y.length-1]===`
26
+ `&&(y=y.slice(0,-1)),y=y.replace(Br,`$&${u}`));let m=!1,h,v=-1;for(h=0;h<t.length;++h){let C=t[h];if(C===" ")m=!0;else if(C===`
27
+ `)v=h;else break}let b=t.substring(0,v<h?v+1:h);b&&(t=t.substring(b.length),b=b.replace(/\n+/g,`$&${u}`));let _=(m?u?"2":"1":"")+d;if(s&&(_+=" "+a(s.replace(/ ?[\r\n]+/g," ")),r&&r()),!p){let C=t.replace(/\n+/g,`
28
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),O=!1,L=kn(n,!0);o!=="folded"&&e!==pe.Scalar.BLOCK_FOLDED&&(L.onOverflow=()=>{O=!0});let k=Me.foldFlowLines(`${b}${C}${y}`,u,Me.FOLD_BLOCK,L);if(!O)return`>${_}
29
+ ${u}${k}`}return t=t.replace(/\n+/g,`$&${u}`),`|${_}
30
+ ${u}${b}${t}${y}`}function vm(s,e,t,n){let{type:r,value:i}=s,{actualString:o,implicitKey:a,indent:l,indentStep:u,inFlow:p}=e;if(a&&i.includes(`
31
+ `)||p&&/[[\]{},]/.test(i))return qt(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||p||!i.includes(`
32
+ `)?qt(i,e):Sn(s,e,t,n);if(!a&&!p&&r!==pe.Scalar.PLAIN&&i.includes(`
33
+ `))return Sn(s,e,t,n);if(xn(i)){if(l==="")return e.forceBlockIndent=!0,Sn(s,e,t,n);if(a&&l===u)return qt(i,e)}let d=i.replace(/\n+/g,`$&
34
+ ${l}`);if(o){let f=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(d),{compat:y,tags:g}=e.doc.schema;if(g.some(f)||y?.some(f))return qt(i,e)}return a?d:Me.foldFlowLines(d,l,Me.FOLD_FLOW,kn(e,!1))}function Sm(s,e,t,n){let{implicitKey:r,inFlow:i}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==pe.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=pe.Scalar.QUOTE_DOUBLE);let l=p=>{switch(p){case pe.Scalar.BLOCK_FOLDED:case pe.Scalar.BLOCK_LITERAL:return r||i?qt(o.value,e):Sn(o,e,t,n);case pe.Scalar.QUOTE_DOUBLE:return fs(o.value,e);case pe.Scalar.QUOTE_SINGLE:return Wr(o.value,e);case pe.Scalar.PLAIN:return vm(o,e,t,n);default:return null}},u=l(a);if(u===null){let{defaultKeyType:p,defaultStringType:d}=e.options,f=r&&p||d;if(u=l(f),u===null)throw new Error(`Unsupported default string type ${f}`)}return u}sc.stringifyString=Sm});var ms=I(Gr=>{"use strict";var km=mn(),Fe=D(),xm=us(),_m=ps();function Im(s,e){let t=Object.assign({blockQuote:!0,commentString:xm.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},s.schema.toStringOptions,e),n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Am(s,e){if(e.tag){let r=s.filter(i=>i.tag===e.tag);if(r.length>0)return r.find(i=>i.format===e.format)??r[0]}let t,n;if(Fe.isScalar(e)){n=e.value;let r=s.filter(i=>i.identify?.(n));if(r.length>1){let i=r.filter(o=>o.test);i.length>0&&(r=i)}t=r.find(i=>i.format===e.format)??r.find(i=>!i.format)}else n=e,t=s.find(r=>r.nodeClass&&n instanceof r.nodeClass);if(!t){let r=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${r} value`)}return t}function Cm(s,e,{anchors:t,doc:n}){if(!n.directives)return"";let r=[],i=(Fe.isScalar(s)||Fe.isCollection(s))&&s.anchor;i&&km.anchorIsValid(i)&&(t.add(i),r.push(`&${i}`));let o=s.tag??(e.default?null:e.tag);return o&&r.push(n.directives.tagString(o)),r.join(" ")}function Om(s,e,t,n){if(Fe.isPair(s))return s.toString(e,t,n);if(Fe.isAlias(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let r,i=Fe.isNode(s)?s:e.doc.createNode(s,{onTagObj:l=>r=l});r??(r=Am(e.doc.schema.tags,i));let o=Cm(i,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof r.stringify=="function"?r.stringify(i,e,t,n):Fe.isScalar(i)?_m.stringifyString(i,e,t,n):i.toString(e,t,n);return o?Fe.isScalar(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
35
+ ${e.indent}${a}`:a}Gr.createStringifyContext=Im;Gr.stringify=Om});var oc=I(ic=>{"use strict";var Ee=D(),nc=B(),rc=ms(),hs=us();function Tm({key:s,value:e},t,n,r){let{allNullValues:i,doc:o,indent:a,indentStep:l,options:{commentString:u,indentSeq:p,simpleKeys:d}}=t,f=Ee.isNode(s)&&s.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Ee.isCollection(s)||!Ee.isNode(s)&&typeof s=="object"){let L="With simple keys, collection cannot be used as a key value";throw new Error(L)}}let y=!d&&(!s||f&&e==null&&!t.inFlow||Ee.isCollection(s)||(Ee.isScalar(s)?s.type===nc.Scalar.BLOCK_FOLDED||s.type===nc.Scalar.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!y&&(d||!i),indent:a+l});let g=!1,m=!1,h=rc.stringify(s,t,()=>g=!0,()=>m=!0);if(!y&&!t.inFlow&&h.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");y=!0}if(t.inFlow){if(i||e==null)return g&&n&&n(),h===""?"?":y?`? ${h}`:h}else if(i&&!d||e==null&&y)return h=`? ${h}`,f&&!g?h+=hs.lineComment(h,t.indent,u(f)):m&&r&&r(),h;g&&(f=null),y?(f&&(h+=hs.lineComment(h,t.indent,u(f))),h=`? ${h}
36
+ ${a}:`):(h=`${h}:`,f&&(h+=hs.lineComment(h,t.indent,u(f))));let v,b,S;Ee.isNode(e)?(v=!!e.spaceBefore,b=e.commentBefore,S=e.comment):(v=!1,b=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!y&&!f&&Ee.isScalar(e)&&(t.indentAtStart=h.length+1),m=!1,!p&&l.length>=2&&!t.inFlow&&!y&&Ee.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let _=!1,C=rc.stringify(e,t,()=>_=!0,()=>m=!0),O=" ";if(f||v||b){if(O=v?`
37
+ `:"",b){let L=u(b);O+=`
38
+ ${hs.indentComment(L,t.indent)}`}C===""&&!t.inFlow?O===`
39
+ `&&S&&(O=`
40
+
41
+ `):O+=`
42
+ ${t.indent}`}else if(!y&&Ee.isCollection(e)){let L=C[0],k=C.indexOf(`
43
+ `),M=k!==-1,re=t.inFlow??e.flow??e.items.length===0;if(M||!re){let gt=!1;if(M&&(L==="&"||L==="!")){let G=C.indexOf(" ");L==="&"&&G!==-1&&G<k&&C[G+1]==="!"&&(G=C.indexOf(" ",G+1)),(G===-1||k<G)&&(gt=!0)}gt||(O=`
44
+ ${t.indent}`)}}else(C===""||C[0]===`
45
+ `)&&(O="");return h+=O+C,t.inFlow?_&&n&&n():S&&!_?h+=hs.lineComment(h,t.indent,u(S)):m&&r&&r(),h}ic.stringifyPair=Tm});var Kr=I(zr=>{"use strict";var ac=require("process");function Em(s,...e){s==="debug"&&console.log(...e)}function $m(s,e){(s==="debug"||s==="warn")&&(typeof ac.emitWarning=="function"?ac.emitWarning(e):console.warn(e))}zr.debug=Em;zr.warn=$m});var Cn=I(An=>{"use strict";var gs=D(),cc=B(),_n="<<",In={identify:s=>s===_n||typeof s=="symbol"&&s.description===_n,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new cc.Scalar(Symbol(_n)),{addToJSMap:lc}),stringify:()=>_n},Nm=(s,e)=>(In.identify(e)||gs.isScalar(e)&&(!e.type||e.type===cc.Scalar.PLAIN)&&In.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===In.tag&&t.default);function lc(s,e,t){if(t=s&&gs.isAlias(t)?t.resolve(s.doc):t,gs.isSeq(t))for(let n of t.items)Ur(s,e,n);else if(Array.isArray(t))for(let n of t)Ur(s,e,n);else Ur(s,e,t)}function Ur(s,e,t){let n=s&&gs.isAlias(t)?t.resolve(s.doc):t;if(!gs.isMap(n))throw new Error("Merge sources must be maps or map aliases");let r=n.toJSON(null,s,Map);for(let[i,o]of r)e instanceof Map?e.has(i)||e.set(i,o):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}An.addMergeToJSMap=lc;An.isMergeKey=Nm;An.merge=In});var Yr=I(fc=>{"use strict";var Rm=Kr(),uc=Cn(),Pm=ms(),dc=D(),Vr=Le();function jm(s,e,{key:t,value:n}){if(dc.isNode(t)&&t.addToJSMap)t.addToJSMap(s,e,n);else if(uc.isMergeKey(s,t))uc.addMergeToJSMap(s,e,n);else{let r=Vr.toJS(t,"",s);if(e instanceof Map)e.set(r,Vr.toJS(n,r,s));else if(e instanceof Set)e.add(r);else{let i=qm(t,r,s),o=Vr.toJS(n,i,s);i in e?Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[i]=o}}return e}function qm(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(dc.isNode(s)&&t?.doc){let n=Pm.createStringifyContext(t.doc,{});n.anchors=new Set;for(let i of t.anchors.keys())n.anchors.add(i.anchor);n.inFlow=!0,n.inStringifyKey=!0;let r=s.toString(n);if(!t.mapKeyWarned){let i=JSON.stringify(r);i.length>40&&(i=i.substring(0,36)+'..."'),Rm.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return r}return JSON.stringify(e)}fc.addPairToJSMap=jm});var We=I(Zr=>{"use strict";var pc=ls(),Lm=oc(),Dm=Yr(),On=D();function Mm(s,e,t){let n=pc.createNode(s,void 0,t),r=pc.createNode(e,void 0,t);return new Tn(n,r)}var Tn=class s{constructor(e,t=null){Object.defineProperty(this,On.NODE_TYPE,{value:On.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return On.isNode(t)&&(t=t.clone(e)),On.isNode(n)&&(n=n.clone(e)),new s(t,n)}toJSON(e,t){let n=t?.mapAsMap?new Map:{};return Dm.addPairToJSMap(t,n,this)}toString(e,t,n){return e?.doc?Lm.stringifyPair(this,e,t,n):JSON.stringify(this)}};Zr.Pair=Tn;Zr.createPair=Mm});var Hr=I(hc=>{"use strict";var ut=D(),mc=ms(),En=us();function Fm(s,e,t){return(e.inFlow??s.flow?Bm:Wm)(s,e,t)}function Wm({comment:s,items:e},t,{blockItemPrefix:n,flowChars:r,itemIndent:i,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:u}}=t,p=Object.assign({},t,{indent:i,type:null}),d=!1,f=[];for(let g=0;g<e.length;++g){let m=e[g],h=null;if(ut.isNode(m))!d&&m.spaceBefore&&f.push(""),$n(t,f,m.commentBefore,d),m.comment&&(h=m.comment);else if(ut.isPair(m)){let b=ut.isNode(m.key)?m.key:null;b&&(!d&&b.spaceBefore&&f.push(""),$n(t,f,b.commentBefore,d))}d=!1;let v=mc.stringify(m,p,()=>h=null,()=>d=!0);h&&(v+=En.lineComment(v,i,u(h))),d&&h&&(d=!1),f.push(n+v)}let y;if(f.length===0)y=r.start+r.end;else{y=f[0];for(let g=1;g<f.length;++g){let m=f[g];y+=m?`
46
+ ${l}${m}`:`
47
+ `}}return s?(y+=`
48
+ `+En.indentComment(u(s),l),a&&a()):d&&o&&o(),y}function Bm({items:s},e,{flowChars:t,itemIndent:n}){let{indent:r,indentStep:i,flowCollectionPadding:o,options:{commentString:a}}=e;n+=i;let l=Object.assign({},e,{indent:n,inFlow:!0,type:null}),u=!1,p=0,d=[];for(let g=0;g<s.length;++g){let m=s[g],h=null;if(ut.isNode(m))m.spaceBefore&&d.push(""),$n(e,d,m.commentBefore,!1),m.comment&&(h=m.comment);else if(ut.isPair(m)){let b=ut.isNode(m.key)?m.key:null;b&&(b.spaceBefore&&d.push(""),$n(e,d,b.commentBefore,!1),b.comment&&(u=!0));let S=ut.isNode(m.value)?m.value:null;S?(S.comment&&(h=S.comment),S.commentBefore&&(u=!0)):m.value==null&&b?.comment&&(h=b.comment)}h&&(u=!0);let v=mc.stringify(m,l,()=>h=null);u||(u=d.length>p||v.includes(`
49
+ `)),g<s.length-1?v+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(u||(u=d.reduce((b,S)=>b+S.length+2,2)+(v.length+2)>e.options.lineWidth)),u&&(v+=",")),h&&(v+=En.lineComment(v,n,a(h))),d.push(v),p=d.length}let{start:f,end:y}=t;if(d.length===0)return f+y;if(!u){let g=d.reduce((m,h)=>m+h.length+2,2);u=e.options.lineWidth>0&&g>e.options.lineWidth}if(u){let g=f;for(let m of d)g+=m?`
50
+ ${i}${r}${m}`:`
51
+ `;return`${g}
52
+ ${r}${y}`}else return`${f}${o}${d.join(" ")}${o}${y}`}function $n({indent:s,options:{commentString:e}},t,n,r){if(n&&r&&(n=n.replace(/^\n+/,"")),n){let i=En.indentComment(e(n),s);t.push(i.trimStart())}}hc.stringifyCollection=Fm});var Ge=I(Qr=>{"use strict";var Gm=Hr(),zm=Yr(),Km=bn(),Be=D(),Nn=We(),Um=B();function ys(s,e){let t=Be.isScalar(e)?e.value:e;for(let n of s)if(Be.isPair(n)&&(n.key===e||n.key===t||Be.isScalar(n.key)&&n.key.value===t))return n}var Jr=class extends Km.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Be.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,o=new this(e),a=(l,u)=>{if(typeof i=="function")u=i.call(t,l,u);else if(Array.isArray(i)&&!i.includes(l))return;(u!==void 0||r)&&o.items.push(Nn.createPair(l,u,n))};if(t instanceof Map)for(let[l,u]of t)a(l,u);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;Be.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new Nn.Pair(e,e?.value):n=new Nn.Pair(e.key,e.value);let r=ys(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw new Error(`Key ${n.key} already set`);Be.isScalar(r.value)&&Um.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let o=this.items.findIndex(a=>i(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let t=ys(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let r=ys(this.items,e)?.value;return(!t&&Be.isScalar(r)?r.value:r)??void 0}has(e){return!!ys(this.items,e)}set(e,t){this.add(new Nn.Pair(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let i of this.items)zm.addPairToJSMap(t,r,i);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let r of this.items)if(!Be.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Gm.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}};Qr.YAMLMap=Jr;Qr.findPair=ys});var Lt=I(yc=>{"use strict";var Vm=D(),gc=Ge(),Ym={collection:"map",default:!0,nodeClass:gc.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(s,e){return Vm.isMap(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>gc.YAMLMap.from(s,e,t)};yc.map=Ym});var ze=I(bc=>{"use strict";var Zm=ls(),Hm=Hr(),Jm=bn(),Pn=D(),Qm=B(),Xm=Le(),Xr=class extends Jm.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Pn.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Rn(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=Rn(e);if(typeof n!="number")return;let r=this.items[n];return!t&&Pn.isScalar(r)?r.value:r}has(e){let t=Rn(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=Rn(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Pn.isScalar(r)&&Qm.isScalarValue(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let i of this.items)n.push(Xm.toJS(i,String(r++),t));return n}toString(e,t,n){return e?Hm.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof r=="function"){let l=t instanceof Set?a:String(o++);a=r.call(t,l,a)}i.items.push(Zm.createNode(a,void 0,n))}}return i}};function Rn(s){let e=Pn.isScalar(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}bc.YAMLSeq=Xr});var Dt=I(vc=>{"use strict";var eh=D(),wc=ze(),th={collection:"seq",default:!0,nodeClass:wc.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(s,e){return eh.isSeq(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>wc.YAMLSeq.from(s,e,t)};vc.seq=th});var bs=I(Sc=>{"use strict";var sh=ps(),nh={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),sh.stringifyString(s,e,t,n)}};Sc.string=nh});var jn=I(_c=>{"use strict";var kc=B(),xc={identify:s=>s==null,createNode:()=>new kc.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new kc.Scalar(null),stringify:({source:s},e)=>typeof s=="string"&&xc.test.test(s)?s:e.options.nullStr};_c.nullTag=xc});var ei=I(Ac=>{"use strict";var rh=B(),Ic={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new rh.Scalar(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&Ic.test.test(s)){let n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};Ac.boolTag=Ic});var Mt=I(Cc=>{"use strict";function ih({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);let r=typeof n=="number"?n:Number(n);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let i=Object.is(n,-0)?"-0":JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(i)){let o=i.indexOf(".");o<0&&(o=i.length,i+=".");let a=e-(i.length-o-1);for(;a-- >0;)i+="0"}return i}Cc.stringifyNumber=ih});var si=I(qn=>{"use strict";var oh=B(),ti=Mt(),ah={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ti.stringifyNumber},ch={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():ti.stringifyNumber(s)}},lh={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){let e=new oh.Scalar(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:ti.stringifyNumber};qn.float=lh;qn.floatExp=ch;qn.floatNaN=ah});var ri=I(Dn=>{"use strict";var Oc=Mt(),Ln=s=>typeof s=="bigint"||Number.isInteger(s),ni=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Tc(s,e,t){let{value:n}=s;return Ln(n)&&n>=0?t+n.toString(e):Oc.stringifyNumber(s)}var uh={identify:s=>Ln(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>ni(s,2,8,t),stringify:s=>Tc(s,8,"0o")},dh={identify:Ln,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>ni(s,0,10,t),stringify:Oc.stringifyNumber},fh={identify:s=>Ln(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>ni(s,2,16,t),stringify:s=>Tc(s,16,"0x")};Dn.int=dh;Dn.intHex=fh;Dn.intOct=uh});var $c=I(Ec=>{"use strict";var ph=Lt(),mh=jn(),hh=Dt(),gh=bs(),yh=ei(),ii=si(),oi=ri(),bh=[ph.map,hh.seq,gh.string,mh.nullTag,yh.boolTag,oi.intOct,oi.int,oi.intHex,ii.floatNaN,ii.floatExp,ii.float];Ec.schema=bh});var Pc=I(Rc=>{"use strict";var wh=B(),vh=Lt(),Sh=Dt();function Nc(s){return typeof s=="bigint"||Number.isInteger(s)}var Mn=({value:s})=>JSON.stringify(s),kh=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Mn},{identify:s=>s==null,createNode:()=>new wh.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Mn},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:Mn},{identify:Nc,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>Nc(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Mn}],xh={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},_h=[vh.map,Sh.seq].concat(kh,xh);Rc.schema=_h});var ci=I(jc=>{"use strict";var ws=require("buffer"),ai=B(),Ih=ps(),Ah={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof ws.Buffer=="function")return ws.Buffer.from(s,"base64");if(typeof atob=="function"){let t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,r,i){if(!t)return"";let o=t,a;if(typeof ws.Buffer=="function")a=o instanceof ws.Buffer?o.toString("base64"):ws.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let u=0;u<o.length;++u)l+=String.fromCharCode(o[u]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=ai.Scalar.BLOCK_LITERAL),e!==ai.Scalar.QUOTE_DOUBLE){let l=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),u=Math.ceil(a.length/l),p=new Array(u);for(let d=0,f=0;d<u;++d,f+=l)p[d]=a.substr(f,l);a=p.join(e===ai.Scalar.BLOCK_LITERAL?`
53
+ `:" ")}return Ih.stringifyString({comment:s,type:e,value:a},n,r,i)}};jc.binary=Ah});var Bn=I(Wn=>{"use strict";var Fn=D(),li=We(),Ch=B(),Oh=ze();function qc(s,e){if(Fn.isSeq(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!Fn.isPair(n)){if(Fn.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let r=n.items[0]||new li.Pair(new Ch.Scalar(null));if(n.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${n.commentBefore}
54
+ ${r.key.commentBefore}`:n.commentBefore),n.comment){let i=r.value??r.key;i.comment=i.comment?`${n.comment}
55
+ ${i.comment}`:n.comment}n=r}s.items[t]=Fn.isPair(n)?n:new li.Pair(n)}}else e("Expected a sequence for this tag");return s}function Lc(s,e,t){let{replacer:n}=t,r=new Oh.YAMLSeq(s);r.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(i++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let u=Object.keys(o);if(u.length===1)a=u[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=o;r.items.push(li.createPair(a,l,t))}return r}var Th={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:qc,createNode:Lc};Wn.createPairs=Lc;Wn.pairs=Th;Wn.resolvePairs=qc});var fi=I(di=>{"use strict";var Dc=D(),ui=Le(),vs=Ge(),Eh=ze(),Mc=Bn(),dt=class s extends Eh.YAMLSeq{constructor(){super(),this.add=vs.YAMLMap.prototype.add.bind(this),this.delete=vs.YAMLMap.prototype.delete.bind(this),this.get=vs.YAMLMap.prototype.get.bind(this),this.has=vs.YAMLMap.prototype.has.bind(this),this.set=vs.YAMLMap.prototype.set.bind(this),this.tag=s.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let r of this.items){let i,o;if(Dc.isPair(r)?(i=ui.toJS(r.key,"",t),o=ui.toJS(r.value,i,t)):i=ui.toJS(r,"",t),n.has(i))throw new Error("Ordered maps must not include duplicate keys");n.set(i,o)}return n}static from(e,t,n){let r=Mc.createPairs(e,t,n),i=new this;return i.items=r.items,i}};dt.tag="tag:yaml.org,2002:omap";var $h={collection:"seq",identify:s=>s instanceof Map,nodeClass:dt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){let t=Mc.resolvePairs(s,e),n=[];for(let{key:r}of t.items)Dc.isScalar(r)&&(n.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):n.push(r.value));return Object.assign(new dt,t)},createNode:(s,e,t)=>dt.from(s,e,t)};di.YAMLOMap=dt;di.omap=$h});var zc=I(pi=>{"use strict";var Fc=B();function Wc({value:s,source:e},t){return e&&(s?Bc:Gc).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}var Bc={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Fc.Scalar(!0),stringify:Wc},Gc={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Fc.Scalar(!1),stringify:Wc};pi.falseTag=Gc;pi.trueTag=Bc});var Kc=I(Gn=>{"use strict";var Nh=B(),mi=Mt(),Rh={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:mi.stringifyNumber},Ph={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():mi.stringifyNumber(s)}},jh={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let e=new Nh.Scalar(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){let n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:mi.stringifyNumber};Gn.float=jh;Gn.floatExp=Ph;Gn.floatNaN=Rh});var Vc=I(ks=>{"use strict";var Uc=Mt(),Ss=s=>typeof s=="bigint"||Number.isInteger(s);function zn(s,e,t,{intAsBigInt:n}){let r=s[0];if((r==="-"||r==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let o=BigInt(s);return r==="-"?BigInt(-1)*o:o}let i=parseInt(s,t);return r==="-"?-1*i:i}function hi(s,e,t){let{value:n}=s;if(Ss(n)){let r=n.toString(e);return n<0?"-"+t+r.substr(1):t+r}return Uc.stringifyNumber(s)}var qh={identify:Ss,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>zn(s,2,2,t),stringify:s=>hi(s,2,"0b")},Lh={identify:Ss,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>zn(s,1,8,t),stringify:s=>hi(s,8,"0")},Dh={identify:Ss,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>zn(s,0,10,t),stringify:Uc.stringifyNumber},Mh={identify:Ss,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>zn(s,2,16,t),stringify:s=>hi(s,16,"0x")};ks.int=Dh;ks.intBin=qh;ks.intHex=Mh;ks.intOct=Lh});var yi=I(gi=>{"use strict";var Vn=D(),Kn=We(),Un=Ge(),ft=class s extends Un.YAMLMap{constructor(e){super(e),this.tag=s.tag}add(e){let t;Vn.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new Kn.Pair(e.key,null):t=new Kn.Pair(e,null),Un.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let n=Un.findPair(this.items,e);return!t&&Vn.isPair(n)?Vn.isScalar(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Un.findPair(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Kn.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof r=="function"&&(o=r.call(t,o,o)),i.items.push(Kn.createPair(o,null,n));return i}};ft.tag="tag:yaml.org,2002:set";var Fh={collection:"map",identify:s=>s instanceof Set,nodeClass:ft,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>ft.from(s,e,t),resolve(s,e){if(Vn.isMap(s)){if(s.hasAllNullValues(!0))return Object.assign(new ft,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};gi.YAMLSet=ft;gi.set=Fh});var wi=I(Yn=>{"use strict";var Wh=Mt();function bi(s,e){let t=s[0],n=t==="-"||t==="+"?s.substring(1):s,r=o=>e?BigInt(o):Number(o),i=n.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return t==="-"?r(-1)*i:i}function Yc(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return Wh.stringifyNumber(s);let n="";e<0&&(n="-",e*=t(-1));let r=t(60),i=[e%r];return e<60?i.unshift(0):(e=(e-i[0])/r,i.unshift(e%r),e>=60&&(e=(e-i[0])/r,i.unshift(e))),n+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Bh={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>bi(s,t),stringify:Yc},Gh={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>bi(s,!1),stringify:Yc},Zc={identify:s=>s 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(s){let e=s.match(Zc.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,n,r,i,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,u=Date.UTC(t,n-1,r,i||0,o||0,a||0,l),p=e[8];if(p&&p!=="Z"){let d=bi(p,!1);Math.abs(d)<30&&(d*=60),u-=6e4*d}return new Date(u)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Yn.floatTime=Gh;Yn.intTime=Bh;Yn.timestamp=Zc});var Qc=I(Jc=>{"use strict";var zh=Lt(),Kh=jn(),Uh=Dt(),Vh=bs(),Yh=ci(),Hc=zc(),vi=Kc(),Zn=Vc(),Zh=Cn(),Hh=fi(),Jh=Bn(),Qh=yi(),Si=wi(),Xh=[zh.map,Uh.seq,Vh.string,Kh.nullTag,Hc.trueTag,Hc.falseTag,Zn.intBin,Zn.intOct,Zn.int,Zn.intHex,vi.floatNaN,vi.floatExp,vi.float,Yh.binary,Zh.merge,Hh.omap,Jh.pairs,Qh.set,Si.intTime,Si.floatTime,Si.timestamp];Jc.schema=Xh});var cl=I(_i=>{"use strict";var sl=Lt(),eg=jn(),nl=Dt(),tg=bs(),sg=ei(),ki=si(),xi=ri(),ng=$c(),rg=Pc(),rl=ci(),xs=Cn(),il=fi(),ol=Bn(),Xc=Qc(),al=yi(),Hn=wi(),el=new Map([["core",ng.schema],["failsafe",[sl.map,nl.seq,tg.string]],["json",rg.schema],["yaml11",Xc.schema],["yaml-1.1",Xc.schema]]),tl={binary:rl.binary,bool:sg.boolTag,float:ki.float,floatExp:ki.floatExp,floatNaN:ki.floatNaN,floatTime:Hn.floatTime,int:xi.int,intHex:xi.intHex,intOct:xi.intOct,intTime:Hn.intTime,map:sl.map,merge:xs.merge,null:eg.nullTag,omap:il.omap,pairs:ol.pairs,seq:nl.seq,set:al.set,timestamp:Hn.timestamp},ig={"tag:yaml.org,2002:binary":rl.binary,"tag:yaml.org,2002:merge":xs.merge,"tag:yaml.org,2002:omap":il.omap,"tag:yaml.org,2002:pairs":ol.pairs,"tag:yaml.org,2002:set":al.set,"tag:yaml.org,2002:timestamp":Hn.timestamp};function og(s,e,t){let n=el.get(e);if(n&&!s)return t&&!n.includes(xs.merge)?n.concat(xs.merge):n.slice();let r=n;if(!r)if(Array.isArray(s))r=[];else{let i=Array.from(el.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(s))for(let i of s)r=r.concat(i);else typeof s=="function"&&(r=s(r.slice()));return t&&(r=r.concat(xs.merge)),r.reduce((i,o)=>{let a=typeof o=="string"?tl[o]:o;if(!a){let l=JSON.stringify(o),u=Object.keys(tl).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${u}`)}return i.includes(a)||i.push(a),i},[])}_i.coreKnownTags=ig;_i.getTags=og});var Ci=I(ll=>{"use strict";var Ii=D(),ag=Lt(),cg=Dt(),lg=bs(),Jn=cl(),ug=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0,Ai=class s{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Jn.getTags(e,"compat"):e?Jn.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=r?Jn.coreKnownTags:{},this.tags=Jn.getTags(t,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Ii.MAP,{value:ag.map}),Object.defineProperty(this,Ii.SCALAR,{value:lg.string}),Object.defineProperty(this,Ii.SEQ,{value:cg.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?ug:null}clone(){let e=Object.create(s.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};ll.Schema=Ai});var dl=I(ul=>{"use strict";var dg=D(),Oi=ms(),_s=us();function fg(s,e){let t=[],n=e.directives===!0;if(e.directives!==!1&&s.directives){let l=s.directives.toString(s);l?(t.push(l),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");let r=Oi.createStringifyContext(s,e),{commentString:i}=r.options;if(s.commentBefore){t.length!==1&&t.unshift("");let l=i(s.commentBefore);t.unshift(_s.indentComment(l,""))}let o=!1,a=null;if(s.contents){if(dg.isNode(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){let p=i(s.contents.commentBefore);t.push(_s.indentComment(p,""))}r.forceBlockIndent=!!s.comment,a=s.contents.comment}let l=a?void 0:()=>o=!0,u=Oi.stringify(s.contents,r,()=>a=null,l);a&&(u+=_s.lineComment(u,"",i(a))),(u[0]==="|"||u[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${u}`:t.push(u)}else t.push(Oi.stringify(s.contents,r));if(s.directives?.docEnd)if(s.comment){let l=i(s.comment);l.includes(`
56
+ `)?(t.push("..."),t.push(_s.indentComment(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=s.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(_s.indentComment(i(l),"")))}return t.join(`
57
+ `)+`
58
+ `}ul.stringifyDocument=fg});var Is=I(fl=>{"use strict";var pg=cs(),Ft=bn(),le=D(),mg=We(),hg=Le(),gg=Ci(),yg=dl(),Ti=mn(),bg=Rr(),wg=ls(),Ei=Nr(),$i=class s{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,le.NODE_TYPE,{value:le.DOC});let r=null;typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=i;let{version:o}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Ei.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let e=Object.create(s.prototype,{[le.NODE_TYPE]:{value:le.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=le.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Wt(this.contents)&&this.contents.add(e)}addIn(e,t){Wt(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Ti.anchorNames(this);e.anchor=!t||n.has(t)?Ti.findNewAnchor(t||"a",n):t}return new pg.Alias(e.anchor)}createNode(e,t,n){let r;if(typeof t=="function")e=t.call({"":e},"",e),r=t;else if(Array.isArray(t)){let h=b=>typeof b=="number"||b instanceof String||b instanceof Number,v=t.filter(h).map(String);v.length>0&&(t=t.concat(v)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:u,tag:p}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:y}=Ti.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:i??!0,keepUndefined:l??!1,onAnchor:d,onTagObj:u,replacer:r,schema:this.schema,sourceObjects:y},m=wg.createNode(e,p,g);return a&&le.isCollection(m)&&(m.flow=!0),f(),m}createPair(e,t,n={}){let r=this.createNode(e,null,n),i=this.createNode(t,null,n);return new mg.Pair(r,i)}delete(e){return Wt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ft.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Wt(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return le.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Ft.isEmptyPath(e)?!t&&le.isScalar(this.contents)?this.contents.value:this.contents:le.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return le.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Ft.isEmptyPath(e)?this.contents!==void 0:le.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ft.collectionFromPath(this.schema,[e],t):Wt(this.contents)&&this.contents.set(e,t)}setIn(e,t){Ft.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=Ft.collectionFromPath(this.schema,Array.from(e),t):Wt(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Ei.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Ei.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new gg.Schema(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},l=hg.toJS(this.contents,t??"",a);if(typeof i=="function")for(let{count:u,res:p}of a.anchors.values())i(p,u);return typeof o=="function"?bg.applyReviver(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return yg.stringifyDocument(this,e)}};function Wt(s){if(le.isCollection(s))return!0;throw new Error("Expected a YAML collection as document contents")}fl.Document=$i});var Os=I(Cs=>{"use strict";var As=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},Ni=class extends As{constructor(e,t,n){super("YAMLParseError",e,t,n)}},Ri=class extends As{constructor(e,t,n){super("YAMLWarning",e,t,n)}},vg=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:n,col:r}=t.linePos[0];t.message+=` at line ${n}, column ${r}`;let i=r-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(i>=60&&o.length>80){let a=Math.min(i-39,o.length-79);o="\u2026"+o.substring(a),i-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,i))){let a=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
59
+ `),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l?.line===n&&l.col>r&&(a=Math.max(1,Math.min(l.col-r,80-i)));let u=" ".repeat(i)+"^".repeat(a);t.message+=`:
60
+
61
+ ${o}
62
+ ${u}
63
+ `}};Cs.YAMLError=As;Cs.YAMLParseError=Ni;Cs.YAMLWarning=Ri;Cs.prettifyError=vg});var Ts=I(pl=>{"use strict";function Sg(s,{flow:e,indicator:t,next:n,offset:r,onError:i,parentIndent:o,startOnNewline:a}){let l=!1,u=a,p=a,d="",f="",y=!1,g=!1,m=null,h=null,v=null,b=null,S=null,_=null,C=null;for(let k of s)switch(g&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&i(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),m&&(u&&k.type!=="comment"&&k.type!=="newline"&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),k.type){case"space":!e&&(t!=="doc-start"||n?.type!=="flow-collection")&&k.source.includes(" ")&&(m=k),p=!0;break;case"comment":{p||i(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=k.source.substring(1)||" ";d?d+=f+M:d=M,f="",u=!1;break}case"newline":u?d?d+=k.source:(!_||t!=="seq-item-ind")&&(l=!0):f+=k.source,u=!0,y=!0,(h||v)&&(b=k),p=!0;break;case"anchor":h&&i(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&i(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=k,C??(C=k.offset),u=!1,p=!1,g=!0;break;case"tag":{v&&i(k,"MULTIPLE_TAGS","A node can have at most one tag"),v=k,C??(C=k.offset),u=!1,p=!1,g=!0;break}case t:(h||v)&&i(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),_&&i(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),_=k,u=t==="seq-item-ind"||t==="explicit-key-ind",p=!1;break;case"comma":if(e){S&&i(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=k,u=!1,p=!1;break}default:i(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),u=!1,p=!1}let O=s[s.length-1],L=O?O.offset+O.source.length:r;return g&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&i(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(u&&m.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:_,spaceBefore:l,comment:d,hasNewline:y,anchor:h,tag:v,newlineAfterProp:b,end:L,start:C??L}}pl.resolveProps=Sg});var Qn=I(ml=>{"use strict";function Pi(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
64
+ `))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(Pi(e.key)||Pi(e.value))return!0}return!1;default:return!0}}ml.containsNewline=Pi});var ji=I(hl=>{"use strict";var kg=Qn();function xg(s,e,t){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&kg.containsNewline(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}hl.flowIndentCheck=xg});var qi=I(yl=>{"use strict";var gl=D();function _g(s,e,t){let{uniqueKeys:n}=s.options;if(n===!1)return!1;let r=typeof n=="function"?n:(i,o)=>i===o||gl.isScalar(i)&&gl.isScalar(o)&&i.value===o.value;return e.some(i=>r(i.key,t))}yl.mapIncludes=_g});var xl=I(kl=>{"use strict";var bl=We(),Ig=Ge(),wl=Ts(),Ag=Qn(),vl=ji(),Cg=qi(),Sl="All mapping items must start at the same column";function Og({composeNode:s,composeEmptyNode:e},t,n,r,i){let o=i?.nodeClass??Ig.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,u=null;for(let p of n.items){let{start:d,key:f,sep:y,value:g}=p,m=wl.resolveProps(d,{indicator:"explicit-key-ind",next:f??y?.[0],offset:l,onError:r,parentIndent:n.indent,startOnNewline:!0}),h=!m.found;if(h){if(f&&(f.type==="block-seq"?r(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==n.indent&&r(l,"BAD_INDENT",Sl)),!m.anchor&&!m.tag&&!y){u=m.end,m.comment&&(a.comment?a.comment+=`
65
+ `+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||Ag.containsNewline(f))&&r(f??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==n.indent&&r(l,"BAD_INDENT",Sl);t.atKey=!0;let v=m.end,b=f?s(t,f,m,r):e(t,v,d,null,m,r);t.schema.compat&&vl.flowIndentCheck(n.indent,f,r),t.atKey=!1,Cg.mapIncludes(t,a.items,b)&&r(v,"DUPLICATE_KEY","Map keys must be unique");let S=wl.resolveProps(y??[],{indicator:"map-value-ind",next:g,offset:b.range[2],onError:r,parentIndent:n.indent,startOnNewline:!f||f.type==="block-scalar"});if(l=S.end,S.found){h&&(g?.type==="block-map"&&!S.hasNewline&&r(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&m.start<S.found.offset-1024&&r(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let _=g?s(t,g,S,r):e(t,l,y,null,S,r);t.schema.compat&&vl.flowIndentCheck(n.indent,g,r),l=_.range[2];let C=new bl.Pair(b,_);t.options.keepSourceTokens&&(C.srcToken=p),a.items.push(C)}else{h&&r(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(b.comment?b.comment+=`
66
+ `+S.comment:b.comment=S.comment);let _=new bl.Pair(b);t.options.keepSourceTokens&&(_.srcToken=p),a.items.push(_)}}return u&&u<l&&r(u,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,l,u??l],a}kl.resolveBlockMap=Og});var Il=I(_l=>{"use strict";var Tg=ze(),Eg=Ts(),$g=ji();function Ng({composeNode:s,composeEmptyNode:e},t,n,r,i){let o=i?.nodeClass??Tg.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=n.offset,u=null;for(let{start:p,value:d}of n.items){let f=Eg.resolveProps(p,{indicator:"seq-item-ind",next:d,offset:l,onError:r,parentIndent:n.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||d)d?.type==="block-seq"?r(f.end,"BAD_INDENT","All sequence items must start at the same column"):r(l,"MISSING_CHAR","Sequence item without - indicator");else{u=f.end,f.comment&&(a.comment=f.comment);continue}let y=d?s(t,d,f,r):e(t,f.end,p,null,f,r);t.schema.compat&&$g.flowIndentCheck(n.indent,d,r),l=y.range[2],a.items.push(y)}return a.range=[n.offset,l,u??l],a}_l.resolveBlockSeq=Ng});var Bt=I(Al=>{"use strict";function Rg(s,e,t,n){let r="";if(s){let i=!1,o="";for(let a of s){let{source:l,type:u}=a;switch(u){case"space":i=!0;break;case"comment":{t&&!i&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let p=l.substring(1)||" ";r?r+=o+p:r=p,o="";break}case"newline":r&&(o+=l),i=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}e+=l.length}}return{comment:r,offset:e}}Al.resolveEnd=Rg});var El=I(Tl=>{"use strict";var Pg=D(),jg=We(),Cl=Ge(),qg=ze(),Lg=Bt(),Ol=Ts(),Dg=Qn(),Mg=qi(),Li="Block collections are not allowed within flow collections",Di=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Fg({composeNode:s,composeEmptyNode:e},t,n,r,i){let o=n.start.source==="{",a=o?"flow map":"flow sequence",l=i?.nodeClass??(o?Cl.YAMLMap:qg.YAMLSeq),u=new l(t.schema);u.flow=!0;let p=t.atRoot;p&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let d=n.offset+n.start.source.length;for(let h=0;h<n.items.length;++h){let v=n.items[h],{start:b,key:S,sep:_,value:C}=v,O=Ol.resolveProps(b,{flow:a,indicator:"explicit-key-ind",next:S??_?.[0],offset:d,onError:r,parentIndent:n.indent,startOnNewline:!1});if(!O.found){if(!O.anchor&&!O.tag&&!_&&!C){h===0&&O.comma?r(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<n.items.length-1&&r(O.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),O.comment&&(u.comment?u.comment+=`
67
+ `+O.comment:u.comment=O.comment),d=O.end;continue}!o&&t.options.strict&&Dg.containsNewline(S)&&r(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)O.comma&&r(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(O.comma||r(O.start,"MISSING_CHAR",`Missing , between ${a} items`),O.comment){let L="";e:for(let k of b)switch(k.type){case"comma":case"space":break;case"comment":L=k.source.substring(1);break e;default:break e}if(L){let k=u.items[u.items.length-1];Pg.isPair(k)&&(k=k.value??k.key),k.comment?k.comment+=`
68
+ `+L:k.comment=L,O.comment=O.comment.substring(L.length+1)}}if(!o&&!_&&!O.found){let L=C?s(t,C,O,r):e(t,O.end,_,null,O,r);u.items.push(L),d=L.range[2],Di(C)&&r(L.range,"BLOCK_IN_FLOW",Li)}else{t.atKey=!0;let L=O.end,k=S?s(t,S,O,r):e(t,L,b,null,O,r);Di(S)&&r(k.range,"BLOCK_IN_FLOW",Li),t.atKey=!1;let M=Ol.resolveProps(_??[],{flow:a,indicator:"map-value-ind",next:C,offset:k.range[2],onError:r,parentIndent:n.indent,startOnNewline:!1});if(M.found){if(!o&&!O.found&&t.options.strict){if(_)for(let G of _){if(G===M.found)break;if(G.type==="newline"){r(G,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}O.start<M.found.offset-1024&&r(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else C&&("source"in C&&C.source?.[0]===":"?r(C,"MISSING_CHAR",`Missing space after : in ${a}`):r(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let re=C?s(t,C,M,r):M.found?e(t,M.end,_,null,M,r):null;re?Di(C)&&r(re.range,"BLOCK_IN_FLOW",Li):M.comment&&(k.comment?k.comment+=`
69
+ `+M.comment:k.comment=M.comment);let gt=new jg.Pair(k,re);if(t.options.keepSourceTokens&&(gt.srcToken=v),o){let G=u;Mg.mapIncludes(t,G.items,k)&&r(L,"DUPLICATE_KEY","Map keys must be unique"),G.items.push(gt)}else{let G=new Cl.YAMLMap(t.schema);G.flow=!0,G.items.push(gt);let ho=(re??k).range;G.range=[k.range[0],ho[1],ho[2]],u.items.push(G)}d=re?re.range[2]:M.end}}let f=o?"}":"]",[y,...g]=n.end,m=d;if(y?.source===f)m=y.offset+y.source.length;else{let h=a[0].toUpperCase()+a.substring(1),v=p?`${h} must end with a ${f}`:`${h} in block collection must be sufficiently indented and end with a ${f}`;r(d,p?"MISSING_CHAR":"BAD_INDENT",v),y&&y.source.length!==1&&g.unshift(y)}if(g.length>0){let h=Lg.resolveEnd(g,m,t.options.strict,r);h.comment&&(u.comment?u.comment+=`
70
+ `+h.comment:u.comment=h.comment),u.range=[n.offset,m,h.offset]}else u.range=[n.offset,m,m];return u}Tl.resolveFlowCollection=Fg});var Nl=I($l=>{"use strict";var Wg=D(),Bg=B(),Gg=Ge(),zg=ze(),Kg=xl(),Ug=Il(),Vg=El();function Mi(s,e,t,n,r,i){let o=t.type==="block-map"?Kg.resolveBlockMap(s,e,t,n,i):t.type==="block-seq"?Ug.resolveBlockSeq(s,e,t,n,i):Vg.resolveFlowCollection(s,e,t,n,i),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function Yg(s,e,t,n,r){let i=n.tag,o=i?e.directives.tagName(i.source,f=>r(i,"TAG_RESOLVE_FAILED",f)):null;if(t.type==="block-seq"){let{anchor:f,newlineAfterProp:y}=n,g=f&&i?f.offset>i.offset?f:i:f??i;g&&(!y||y.offset<g.offset)&&r(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!i||!o||o==="!"||o===Gg.YAMLMap.tagName&&a==="map"||o===zg.YAMLSeq.tagName&&a==="seq")return Mi(s,e,t,r,o);let l=e.schema.tags.find(f=>f.tag===o&&f.collection===a);if(!l){let f=e.schema.knownTags[o];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),l=f;else return f?r(i,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Mi(s,e,t,r,o)}let u=Mi(s,e,t,r,o,l),p=l.resolve?.(u,f=>r(i,"TAG_RESOLVE_FAILED",f),e.options)??u,d=Wg.isNode(p)?p:new Bg.Scalar(p);return d.range=u.range,d.tag=o,l?.format&&(d.format=l.format),d}$l.composeCollection=Yg});var Wi=I(Rl=>{"use strict";var Fi=B();function Zg(s,e,t){let n=e.offset,r=Hg(e,s.options.strict,t);if(!r)return{value:"",type:null,comment:"",range:[n,n,n]};let i=r.mode===">"?Fi.Scalar.BLOCK_FOLDED:Fi.Scalar.BLOCK_LITERAL,o=e.source?Jg(e.source):[],a=o.length;for(let m=o.length-1;m>=0;--m){let h=o[m][1];if(h===""||h==="\r")a=m;else break}if(a===0){let m=r.chomp==="+"&&o.length>0?`
71
+ `.repeat(Math.max(1,o.length-1)):"",h=n+r.length;return e.source&&(h+=e.source.length),{value:m,type:i,comment:r.comment,range:[n,h,h]}}let l=e.indent+r.indent,u=e.offset+r.length,p=0;for(let m=0;m<a;++m){let[h,v]=o[m];if(v===""||v==="\r")r.indent===0&&h.length>l&&(l=h.length);else{h.length<l&&t(u+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(l=h.length),p=m,l===0&&!s.atRoot&&t(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=h.length+v.length+1}for(let m=o.length-1;m>=a;--m)o[m][0].length>l&&(a=m+1);let d="",f="",y=!1;for(let m=0;m<p;++m)d+=o[m][0].slice(l)+`
72
+ `;for(let m=p;m<a;++m){let[h,v]=o[m];u+=h.length+v.length+1;let b=v[v.length-1]==="\r";if(b&&(v=v.slice(0,-1)),v&&h.length<l){let _=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;t(u-v.length-(b?2:1),"BAD_INDENT",_),h=""}i===Fi.Scalar.BLOCK_LITERAL?(d+=f+h.slice(l)+v,f=`
73
+ `):h.length>l||v[0]===" "?(f===" "?f=`
74
+ `:!y&&f===`
75
+ `&&(f=`
76
+
77
+ `),d+=f+h.slice(l)+v,f=`
78
+ `,y=!0):v===""?f===`
79
+ `?d+=`
80
+ `:f=`
81
+ `:(d+=f+v,f=" ",y=!1)}switch(r.chomp){case"-":break;case"+":for(let m=a;m<o.length;++m)d+=`
82
+ `+o[m][0].slice(l);d[d.length-1]!==`
83
+ `&&(d+=`
84
+ `);break;default:d+=`
85
+ `}let g=n+r.length+e.source.length;return{value:d,type:i,comment:r.comment,range:[n,g,g]}}function Hg({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],i=r[0],o=0,a="",l=-1;for(let f=1;f<r.length;++f){let y=r[f];if(!a&&(y==="-"||y==="+"))a=y;else{let g=Number(y);!o&&g?o=g:l===-1&&(l=s+f)}}l!==-1&&n(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let u=!1,p="",d=r.length;for(let f=1;f<e.length;++f){let y=e[f];switch(y.type){case"space":u=!0;case"newline":d+=y.source.length;break;case"comment":t&&!u&&n(y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=y.source.length,p=y.source.substring(1);break;case"error":n(y,"UNEXPECTED_TOKEN",y.message),d+=y.source.length;break;default:{let g=`Unexpected token in block scalar header: ${y.type}`;n(y,"UNEXPECTED_TOKEN",g);let m=y.source;m&&typeof m=="string"&&(d+=m.length)}}}return{mode:i,indent:o,chomp:a,comment:p,length:d}}function Jg(s){let e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),i=[n?.[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)i.push([e[o],e[o+1]]);return i}Rl.resolveBlockScalar=Zg});var Gi=I(jl=>{"use strict";var Bi=B(),Qg=Bt();function Xg(s,e,t){let{offset:n,type:r,source:i,end:o}=s,a,l,u=(f,y,g)=>t(n+f,y,g);switch(r){case"scalar":a=Bi.Scalar.PLAIN,l=ey(i,u);break;case"single-quoted-scalar":a=Bi.Scalar.QUOTE_SINGLE,l=ty(i,u);break;case"double-quoted-scalar":a=Bi.Scalar.QUOTE_DOUBLE,l=sy(i,u);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[n,n+i.length,n+i.length]}}let p=n+i.length,d=Qg.resolveEnd(o,p,e,t);return{value:l,type:a,comment:d.comment,range:[n,p,d.offset]}}function ey(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Pl(s)}function ty(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),Pl(s.slice(1,-1)).replace(/''/g,"'")}function Pl(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
86
+ `,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
87
+ `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(s);if(!n)return s;let r=n[1],i=" ",o=e.lastIndex;for(t.lastIndex=o;n=t.exec(s);)n[1]===""?i===`
88
+ `?r+=i:i=`
89
+ `:(r+=i+n[1],i=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,n=a.exec(s),r+i+(n?.[1]??"")}function sy(s,e){let t="";for(let n=1;n<s.length-1;++n){let r=s[n];if(!(r==="\r"&&s[n+1]===`
90
+ `))if(r===`
91
+ `){let{fold:i,offset:o}=ny(s,n);t+=i,n=o}else if(r==="\\"){let i=s[++n],o=ry[i];if(o)t+=o;else if(i===`
92
+ `)for(i=s[n+1];i===" "||i===" ";)i=s[++n+1];else if(i==="\r"&&s[n+1]===`
93
+ `)for(i=s[++n+1];i===" "||i===" ";)i=s[++n+1];else if(i==="x"||i==="u"||i==="U"){let a={x:2,u:4,U:8}[i];t+=iy(s,n+1,a,e),n+=a}else{let a=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(r===" "||r===" "){let i=n,o=s[n+1];for(;o===" "||o===" ";)o=s[++n+1];o!==`
94
+ `&&!(o==="\r"&&s[n+2]===`
95
+ `)&&(t+=n>i?s.slice(i,n+1):r)}else t+=r}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function ny(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`
96
+ `||n==="\r")&&!(n==="\r"&&s[e+2]!==`
97
+ `);)n===`
98
+ `&&(t+=`
99
+ `),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}var ry={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
100
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function iy(s,e,t,n){let r=s.substr(e,t),o=r.length===t&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;if(isNaN(o)){let a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}jl.resolveFlowScalar=Xg});var Dl=I(Ll=>{"use strict";var pt=D(),ql=B(),oy=Wi(),ay=Gi();function cy(s,e,t,n){let{value:r,type:i,comment:o,range:a}=e.type==="block-scalar"?oy.resolveBlockScalar(s,e,n):ay.resolveFlowScalar(e,s.options.strict,n),l=t?s.directives.tagName(t.source,d=>n(t,"TAG_RESOLVE_FAILED",d)):null,u;s.options.stringKeys&&s.atKey?u=s.schema[pt.SCALAR]:l?u=ly(s.schema,r,l,t,n):e.type==="scalar"?u=uy(s,r,e,n):u=s.schema[pt.SCALAR];let p;try{let d=u.resolve(r,f=>n(t??e,"TAG_RESOLVE_FAILED",f),s.options);p=pt.isScalar(d)?d:new ql.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(t??e,"TAG_RESOLVE_FAILED",f),p=new ql.Scalar(r)}return p.range=a,p.source=r,i&&(p.type=i),l&&(p.tag=l),u.format&&(p.format=u.format),o&&(p.comment=o),p}function ly(s,e,t,n,r){if(t==="!")return s[pt.SCALAR];let i=[];for(let a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)i.push(a);else return a;for(let a of i)if(a.test?.test(e))return a;let o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[pt.SCALAR])}function uy({atKey:s,directives:e,schema:t},n,r,i){let o=t.tags.find(a=>(a.default===!0||s&&a.default==="key")&&a.test?.test(n))||t[pt.SCALAR];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(n))??t[pt.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),u=e.tagString(a.tag),p=`Value may be parsed as either ${l} or ${u}`;i(r,"TAG_RESOLVE_FAILED",p,!0)}}return o}Ll.composeScalar=cy});var Fl=I(Ml=>{"use strict";function dy(s,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let r=e[n];switch(r.type){case"space":case"comment":case"newline":s-=r.source.length;continue}for(r=e[++n];r?.type==="space";)s+=r.source.length,r=e[++n];break}}return s}Ml.emptyScalarPosition=dy});var Gl=I(Ki=>{"use strict";var fy=cs(),py=D(),my=Nl(),Wl=Dl(),hy=Bt(),gy=Fl(),yy={composeNode:Bl,composeEmptyNode:zi};function Bl(s,e,t,n){let r=s.atKey,{spaceBefore:i,comment:o,anchor:a,tag:l}=t,u,p=!0;switch(e.type){case"alias":u=by(s,e,n),(a||l)&&n(e,"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=Wl.composeScalar(s,e,l,n),a&&(u.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=my.composeCollection(yy,s,e,t,n),a&&(u.anchor=a.source.substring(1))}catch(d){let f=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",f)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),p=!1}}return u??(u=zi(s,e.offset,void 0,null,t,n)),a&&u.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&s.options.stringKeys&&(!py.isScalar(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&n(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(u.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?u.comment=o:u.commentBefore=o),s.options.keepSourceTokens&&p&&(u.srcToken=e),u}function zi(s,e,t,n,{spaceBefore:r,comment:i,anchor:o,tag:a,end:l},u){let p={type:"scalar",offset:gy.emptyScalarPosition(e,t,n),indent:-1,source:""},d=Wl.composeScalar(s,p,a,u);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&u(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(d.spaceBefore=!0),i&&(d.comment=i,d.range[2]=l),d}function by({options:s},{offset:e,source:t,end:n},r){let i=new fy.Alias(t.substring(1));i.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&r(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=hy.resolveEnd(n,o,s.strict,r);return i.range=[e,o,a.offset],a.comment&&(i.comment=a.comment),i}Ki.composeEmptyNode=zi;Ki.composeNode=Bl});var Ul=I(Kl=>{"use strict";var wy=Is(),zl=Gl(),vy=Bt(),Sy=Ts();function ky(s,e,{offset:t,start:n,value:r,end:i},o){let a=Object.assign({_directives:e},s),l=new wy.Document(void 0,a),u={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},p=Sy.resolveProps(n,{indicator:"doc-start",next:r??i?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});p.found&&(l.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!p.hasNewline&&o(p.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=r?zl.composeNode(u,r,p,o):zl.composeEmptyNode(u,p.end,n,null,p,o);let d=l.contents.range[2],f=vy.resolveEnd(i,d,!1,o);return f.comment&&(l.comment=f.comment),l.range=[t,d,f.offset],l}Kl.composeDoc=ky});var Vi=I(Zl=>{"use strict";var xy=require("process"),_y=Nr(),Iy=Is(),Es=Os(),Vl=D(),Ay=Ul(),Cy=Bt();function $s(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Yl(s){let e="",t=!1,n=!1;for(let r=0;r<s.length;++r){let i=s[r];switch(i[0]){case"#":e+=(e===""?"":n?`
101
+
102
+ `:`
103
+ `)+(i.substring(1)||" "),t=!0,n=!1;break;case"%":s[r+1]?.[0]!=="#"&&(r+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}var Ui=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,r,i)=>{let o=$s(t);i?this.warnings.push(new Es.YAMLWarning(o,n,r)):this.errors.push(new Es.YAMLParseError(o,n,r))},this.directives=new _y.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Yl(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
104
+ ${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(Vl.isCollection(i)&&!i.flow&&i.items.length>0){let o=i.items[0];Vl.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${n}
105
+ ${a}`:n}else{let o=i.commentBefore;i.commentBefore=o?`${n}
106
+ ${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Yl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let r of e)yield*this.next(r);yield*this.end(t,n)}*next(e){switch(xy.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,n,r)=>{let i=$s(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Ay.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Es.YAMLParseError($s(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Es.YAMLParseError($s(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let t=Cy.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
107
+ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Es.YAMLParseError($s(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),r=new Iy.Document(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,t,t],this.decorate(r,!1),yield r}}};Zl.Composer=Ui});var Ql=I(Xn=>{"use strict";var Oy=Wi(),Ty=Gi(),Ey=Os(),Hl=ps();function $y(s,e=!0,t){if(s){let n=(r,i,o)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(t)t(a,i,o);else throw new Ey.YAMLParseError([a,a+1],i,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ty.resolveFlowScalar(s,e,n);case"block-scalar":return Oy.resolveBlockScalar({options:{strict:e}},s,n)}}return null}function Ny(s,e){let{implicitKey:t=!1,indent:n,inFlow:r=!1,offset:i=-1,type:o="PLAIN"}=e,a=Hl.stringifyString({type:o,value:s},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:n,source:`
108
+ `}];switch(a[0]){case"|":case">":{let u=a.indexOf(`
109
+ `),p=a.substring(0,u),d=a.substring(u+1)+`
110
+ `,f=[{type:"block-scalar-header",offset:i,indent:n,source:p}];return Jl(f,l)||f.push({type:"newline",offset:-1,indent:n,source:`
111
+ `}),{type:"block-scalar",offset:i,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:i,indent:n,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:i,indent:n,source:a,end:l};default:return{type:"scalar",offset:i,indent:n,source:a,end:l}}}function Ry(s,e,t={}){let{afterKey:n=!1,implicitKey:r=!1,inFlow:i=!1,type:o}=t,a="indent"in s?s.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let u=s.props[0];if(u.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=Hl.stringifyString({type:o,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":Py(s,l);break;case'"':Yi(s,l,"double-quoted-scalar");break;case"'":Yi(s,l,"single-quoted-scalar");break;default:Yi(s,l,"scalar")}}function Py(s,e){let t=e.indexOf(`
112
+ `),n=e.substring(0,t),r=e.substring(t+1)+`
113
+ `;if(s.type==="block-scalar"){let i=s.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=n,s.source=r}else{let{offset:i}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:n}];Jl(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
114
+ `});for(let l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:r})}}function Jl(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function Yi(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let n=s.props.slice(1),r=e.length;s.props[0].type==="block-scalar-header"&&(r-=s.props[0].source.length);for(let i of n)i.offset+=r;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{let r={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`
115
+ `};delete s.items,Object.assign(s,{type:t,source:e,end:[r]});break}default:{let n="indent"in s?s.indent:-1,r="end"in s&&Array.isArray(s.end)?s.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(s))i!=="type"&&i!=="offset"&&delete s[i];Object.assign(s,{type:t,indent:n,source:e,end:r})}}}Xn.createScalarToken=Ny;Xn.resolveAsScalar=$y;Xn.setScalarValue=Ry});var eu=I(Xl=>{"use strict";var jy=s=>"type"in s?tr(s):er(s);function tr(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=tr(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=er(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=er(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=er(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function er({start:s,key:e,sep:t,value:n}){let r="";for(let i of s)r+=i.source;if(e&&(r+=tr(e)),t)for(let i of t)r+=i.source;return n&&(r+=tr(n)),r}Xl.stringify=jy});var ru=I(nu=>{"use strict";var Zi=Symbol("break visit"),qy=Symbol("skip children"),tu=Symbol("remove item");function mt(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),su(Object.freeze([]),s,e)}mt.BREAK=Zi;mt.SKIP=qy;mt.REMOVE=tu;mt.itemAtPath=(s,e)=>{let t=s;for(let[n,r]of e){let i=t?.[n];if(i&&"items"in i)t=i.items[r];else return}return t};mt.parentCollection=(s,e)=>{let t=mt.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],r=t?.[n];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function su(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(let r of["key","value"]){let i=e[r];if(i&&"items"in i){for(let o=0;o<i.items.length;++o){let a=su(Object.freeze(s.concat([[r,o]])),i.items[o],t);if(typeof a=="number")o=a-1;else{if(a===Zi)return Zi;a===tu&&(i.items.splice(o,1),o-=1)}}typeof n=="function"&&r==="key"&&(n=n(e,s))}}return typeof n=="function"?n(e,s):n}nu.visit=mt});var sr=I(se=>{"use strict";var Hi=Ql(),Ly=eu(),Dy=ru(),Ji="\uFEFF",Qi="",Xi="",eo="",My=s=>!!s&&"items"in s,Fy=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function Wy(s){switch(s){case Ji:return"<BOM>";case Qi:return"<DOC>";case Xi:return"<FLOW_END>";case eo:return"<SCALAR>";default:return JSON.stringify(s)}}function By(s){switch(s){case Ji:return"byte-order-mark";case Qi:return"doc-mode";case Xi:return"flow-error-end";case eo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
116
+ `:case`\r
117
+ `: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(s[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}se.createScalarToken=Hi.createScalarToken;se.resolveAsScalar=Hi.resolveAsScalar;se.setScalarValue=Hi.setScalarValue;se.stringify=Ly.stringify;se.visit=Dy.visit;se.BOM=Ji;se.DOCUMENT=Qi;se.FLOW_END=Xi;se.SCALAR=eo;se.isCollection=My;se.isScalar=Fy;se.prettyToken=Wy;se.tokenType=By});var no=I(ou=>{"use strict";var Ns=sr();function me(s){switch(s){case void 0:case" ":case`
118
+ `:case"\r":case" ":return!0;default:return!1}}var iu=new Set("0123456789ABCDEFabcdef"),Gy=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),nr=new Set(",[]{}"),zy=new Set(` ,[]{}
119
+ \r `),to=s=>!s||zy.has(s),so=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(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
120
+ `?!0:t==="\r"?this.buffer[e+1]===`
121
+ `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let r=this.buffer[n+e+1];if(r===`
122
+ `||!r&&!this.atEnd)return e+n+1}return t===`
123
+ `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&me(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
124
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){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 e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Ns.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");for(;n!==-1;){let i=e[n-1];if(i===" "||i===" "){t=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let i=e[t-1];if(i===" "||i===" ")t-=1;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield Ns.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&me(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!me(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&me(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);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(to),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&r[0]!=="#"||n===0&&(r.startsWith("---")||r.startsWith("..."))&&me(r[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield Ns.FLOW_END,yield*this.parseLineStart();let i=0;for(;r[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-i),"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(to),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||me(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let i=0;for(;this.buffer[t-1-i]==="\\";)i+=1;if(i%2===0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
125
+ `,this.pos);if(r!==-1){for(;r!==-1;){let i=this.continueScalar(r+1);if(i===-1)break;r=n.indexOf(`
126
+ `,i)}r!==-1&&(t=r-(n[r-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>me(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`
127
+ `:e=i,t=0;break;case"\r":{let o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
128
+ `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
129
+ `,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===" ";)n=this.buffer[++r];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
130
+ `;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let i=e-1,o=this.buffer[i];o==="\r"&&(o=this.buffer[--i]);let a=i;for(;o===" ";)o=this.buffer[--i];if(o===`
131
+ `&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield Ns.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===":"){let i=this.buffer[n+1];if(me(i)||e&&nr.has(i))break;t=n}else if(me(r)){let i=this.buffer[n+1];if(r==="\r"&&(i===`
132
+ `?(n+=1,r=`
133
+ `,i=this.buffer[n+1]):t=n),i==="#"||e&&nr.has(i))break;if(r===`
134
+ `){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&nr.has(r))break;t=n}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield Ns.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(to))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(me(t)||e&&nr.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!me(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Gy.has(t))t=this.buffer[++e];else if(t==="%"&&iu.has(this.buffer[e+1])&&iu.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
135
+ `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
136
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};ou.Lexer=so});var io=I(au=>{"use strict";var ro=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let i=t+n>>1;this.lineStarts[i]<e?t=i+1:n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};au.LineCounter=ro});var ao=I(fu=>{"use strict";var Ky=require("process"),cu=sr(),Uy=no();function Ke(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function lu(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function du(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function rr(s){switch(s.type){case"document":return s.start;case"block-map":{let e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function Gt(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function uu(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!Ke(e.start,"explicit-key-ind")&&!Ke(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,du(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var oo=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Uy.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,Ky.env.LOG_TOKENS&&console.log("|",cu.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=cu.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.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 e=this.peek(1);if(this.type==="doc-end"&&e?.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(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&uu(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let r=n.items[n.items.length-1];if(r.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=t;else{Object.assign(r,{key:t,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=n.items[n.items.length-1];r.value?n.items.push({start:[],value:t}):r.value=t;break}case"flow-collection":{let r=n.items[n.items.length-1];!r||r.value?n.items.push({start:[],key:t,sep:[]}):r.sep?r.value=t:Object.assign(r,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let r=t.items[t.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&lu(r.start)===-1&&(t.indent===0||r.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(n.type==="document"?n.end=r.start:n.items.push({start:r.start}),t.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 e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{lu(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=rr(this.peek(2)),n=Gt(t),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
137
+ `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
138
+ `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(r&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,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(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ke(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(du(t.key)&&!Ke(t.sep,"newline")){let o=Gt(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(Ke(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Gt(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Ke(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!Ke(t.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 n&&e.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||Ke(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:r,sep:[]}):t.sep?this.stack.push(r):Object.assign(t,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let r=rr(n),i=Gt(r);uu(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
139
+ `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
140
+ `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){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 t=rr(e),n=Gt(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=rr(e),n=Gt(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){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:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};fu.Parser=oo});var yu=I(Ps=>{"use strict";var pu=Vi(),Vy=Is(),Rs=Os(),Yy=Kr(),Zy=D(),Hy=io(),mu=ao();function hu(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Hy.LineCounter||null,prettyErrors:e}}function Jy(s,e={}){let{lineCounter:t,prettyErrors:n}=hu(e),r=new mu.Parser(t?.addNewLine),i=new pu.Composer(e),o=Array.from(i.compose(r.parse(s)));if(n&&t)for(let a of o)a.errors.forEach(Rs.prettifyError(s,t)),a.warnings.forEach(Rs.prettifyError(s,t));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function gu(s,e={}){let{lineCounter:t,prettyErrors:n}=hu(e),r=new mu.Parser(t?.addNewLine),i=new pu.Composer(e),o=null;for(let a of i.compose(r.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Rs.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(Rs.prettifyError(s,t)),o.warnings.forEach(Rs.prettifyError(s,t))),o}function Qy(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);let r=gu(s,t);if(!r)return null;if(r.warnings.forEach(i=>Yy.warn(r.options.logLevel,i)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:n},t))}function Xy(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let r=Math.round(t);t=r<1?void 0:r>8?{indent:8}:{indent:r}}if(s===void 0){let{keepUndefined:r}=t??e??{};if(!r)return}return Zy.isDocument(s)&&!n?s.toString(t):new Vy.Document(s,n,t).toString(t)}Ps.parse=Qy;Ps.parseAllDocuments=Jy;Ps.parseDocument=gu;Ps.stringify=Xy});var wu=I(F=>{"use strict";var eb=Vi(),tb=Is(),sb=Ci(),co=Os(),nb=cs(),Ue=D(),rb=We(),ib=B(),ob=Ge(),ab=ze(),cb=sr(),lb=no(),ub=io(),db=ao(),ir=yu(),bu=rs();F.Composer=eb.Composer;F.Document=tb.Document;F.Schema=sb.Schema;F.YAMLError=co.YAMLError;F.YAMLParseError=co.YAMLParseError;F.YAMLWarning=co.YAMLWarning;F.Alias=nb.Alias;F.isAlias=Ue.isAlias;F.isCollection=Ue.isCollection;F.isDocument=Ue.isDocument;F.isMap=Ue.isMap;F.isNode=Ue.isNode;F.isPair=Ue.isPair;F.isScalar=Ue.isScalar;F.isSeq=Ue.isSeq;F.Pair=rb.Pair;F.Scalar=ib.Scalar;F.YAMLMap=ob.YAMLMap;F.YAMLSeq=ab.YAMLSeq;F.CST=cb;F.Lexer=lb.Lexer;F.LineCounter=ub.LineCounter;F.Parser=db.Parser;F.parse=ir.parse;F.parseAllDocuments=ir.parseAllDocuments;F.parseDocument=ir.parseDocument;F.stringify=ir.stringify;F.visit=bu.visit;F.visitAsync=bu.visitAsync});var Ou=require("node:fs"),dr=require("node:path"),Tu=require("node:url");var ke=class{constructor(e,t){this.id=e;this.value=t}},Ms=class extends Error{constructor(e,t,n){super(`Non-determinism at position ${e}: expected "${t}", got "${n}"`)}},Fs=class extends Error{constructor(e){super(`Duplicate call id: "${e}"`)}},j=class{constructor(e,t){this.persistence=e;this.resolver=t;let n=e.load();if(!n)throw new Error("WorkflowContext requires initialized persistence; call persistence.initialize() first");this.state=n}cursor=0;seen=new Set;state;fidelity={checked:0,mismatched:0,details:[]};lastPrompt=null;async call(e,t){if(this.cursor<this.state.entries.length){let n=this.state.entries[this.cursor];if(n.id!==e)throw new Ms(this.cursor,n.id,e);if(this.seen.add(n.id),this.cursor++,"suspended"in n)try{let r=await t();return this.state.entries[this.cursor-1]={id:e,value:r},this.persistence.save(this.state),r}catch(r){throw r instanceof ke&&(this.state.status="suspended",this.persistence.save(this.state)),r}return n.value}if(this.seen.has(e))throw new Fs(e);this.seen.add(e);try{let n=await t();return this.state.entries.push({id:e,value:n}),this.cursor++,this.persistence.save(this.state),n}catch(n){throw n instanceof ke&&(this.state.entries.push({id:e,suspended:!0}),this.state.status="suspended",this.cursor++,this.persistence.save(this.state)),n}}get lastPromptId(){return this.lastPrompt}get currentSource(){return this.lastPrompt?{promptId:this.lastPrompt}:void 0}fidelityResult(){return this.fidelity}async infer(e,t){let n=typeof e=="string"?e:e.id,r=typeof e=="string"?t:{message:e.message,schema:e.schema},i={id:n,type:"infer",request:r},o=await this.call(n,()=>this.resolver(i));if(r.schema&&(o==null||typeof o!="object")){let a=Object.keys(r.schema);return this.fidelity.checked++,this.fidelity.mismatched++,this.fidelity.details.push({id:n,expectedKeys:a,actualKeys:[],missingKeys:a,reason:"non-object"}),{}}return r.schema&&o!=null&&typeof o=="object"&&this.checkFidelity(n,r.schema,o),o}checkFidelity(e,t,n){let r=Object.keys(t),i=Object.keys(n),o=r.filter(a=>!(a in n));this.fidelity.checked++,o.length>0&&(this.fidelity.mismatched++,this.fidelity.details.push({id:e,expectedKeys:r,actualKeys:i,missingKeys:o,reason:"missing-keys"}))}async prompt(e,t){let n=typeof e=="string"?e:e.id,r=typeof e=="string"?t:{message:e.message,...e.suggestions?{suggestions:e.suggestions}:{}};r.message=Fu(r.message),this.lastPrompt=n;let i={id:n,type:"prompt",request:r},o=await this.call(n,()=>this.resolver(i));return typeof o!="string"?"":o}};function Fu(s){return s.split(`
141
+ `).map(e=>e.trim()).join(`
142
+ `).replace(/\n{3,}/g,`
143
+
144
+ `).trim()}var Wu={checked:0,mismatched:0,details:[]};async function pr(s,e,t){let n=s.load();if(!n)s.initialize();else{if(n.status==="completed")return{fidelity:Wu};n.status!=="running"&&s.setStatus("running")}let r=new j(s,t);try{return await e(r),s.setStatus("completed"),{fidelity:r.fidelityResult()}}catch(i){throw i instanceof ke||s.setStatus("failed"),i}}var c={};Du(c,{BRAND:()=>pd,DIRTY:()=>Ze,EMPTY_PATH:()=>Ku,INVALID:()=>$,NEVER:()=>Jd,OK:()=>Y,ParseStatus:()=>K,Schema:()=>P,ZodAny:()=>Pe,ZodArray:()=>de,ZodBigInt:()=>He,ZodBoolean:()=>Ce,ZodBranded:()=>Yt,ZodCatch:()=>ot,ZodDate:()=>Je,ZodDefault:()=>it,ZodDiscriminatedUnion:()=>Gs,ZodEffects:()=>oe,ZodEnum:()=>Oe,ZodError:()=>Q,ZodFirstPartyTypeKind:()=>N,ZodFunction:()=>Ks,ZodIntersection:()=>tt,ZodIssueCode:()=>w,ZodLazy:()=>st,ZodLiteral:()=>nt,ZodMap:()=>xt,ZodNaN:()=>It,ZodNativeEnum:()=>rt,ZodNever:()=>ue,ZodNull:()=>Xe,ZodNullable:()=>ne,ZodNumber:()=>Ae,ZodObject:()=>H,ZodOptional:()=>Z,ZodParsedType:()=>A,ZodPipeline:()=>Zt,ZodPromise:()=>je,ZodReadonly:()=>at,ZodRecord:()=>zs,ZodSchema:()=>P,ZodSet:()=>_t,ZodString:()=>ge,ZodSymbol:()=>St,ZodTransformer:()=>oe,ZodTuple:()=>ye,ZodType:()=>P,ZodUndefined:()=>Qe,ZodUnion:()=>et,ZodUnknown:()=>Ie,ZodVoid:()=>kt,addIssueToContext:()=>x,any:()=>kd,array:()=>Ad,bigint:()=>yd,boolean:()=>Ao,coerce:()=>Hd,custom:()=>xo,date:()=>bd,datetimeRegex:()=>So,defaultErrorMap:()=>xe,discriminatedUnion:()=>Ed,effect:()=>Bd,enum:()=>Md,function:()=>qd,getErrorMap:()=>bt,getParsedType:()=>he,instanceof:()=>hd,intersection:()=>$d,isAborted:()=>Ws,isAsync:()=>wt,isDirty:()=>Bs,isValid:()=>Re,late:()=>md,lazy:()=>Ld,literal:()=>Dd,makeIssue:()=>Vt,map:()=>Pd,nan:()=>gd,nativeEnum:()=>Fd,never:()=>_d,null:()=>Sd,nullable:()=>zd,number:()=>Io,object:()=>Cd,objectUtil:()=>mr,oboolean:()=>Zd,onumber:()=>Yd,optional:()=>Gd,ostring:()=>Vd,pipeline:()=>Ud,preprocess:()=>Kd,promise:()=>Wd,quotelessJson:()=>Bu,record:()=>Rd,set:()=>jd,setErrorMap:()=>zu,strictObject:()=>Od,string:()=>_o,symbol:()=>wd,transformer:()=>Bd,tuple:()=>Nd,undefined:()=>vd,union:()=>Td,unknown:()=>xd,util:()=>q,void:()=>Id});var q;(function(s){s.assertEqual=r=>{};function e(r){}s.assertIs=e;function t(r){throw new Error}s.assertNever=t,s.arrayToEnum=r=>{let i={};for(let o of r)i[o]=o;return i},s.getValidEnumValues=r=>{let i=s.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),o={};for(let a of i)o[a]=r[a];return s.objectValues(o)},s.objectValues=r=>s.objectKeys(r).map(function(i){return r[i]}),s.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let i=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&i.push(o);return i},s.find=(r,i)=>{for(let o of r)if(i(o))return o},s.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}s.joinValues=n,s.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(q||(q={}));var mr;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(mr||(mr={}));var A=q.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),he=s=>{switch(typeof s){case"undefined":return A.undefined;case"string":return A.string;case"number":return Number.isNaN(s)?A.nan:A.number;case"boolean":return A.boolean;case"function":return A.function;case"bigint":return A.bigint;case"symbol":return A.symbol;case"object":return Array.isArray(s)?A.array:s===null?A.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?A.promise:typeof Map<"u"&&s instanceof Map?A.map:typeof Set<"u"&&s instanceof Set?A.set:typeof Date<"u"&&s instanceof Date?A.date:A.object;default:return A.unknown}};var w=q.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Bu=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:"),Q=class s extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(i){return i.message},n={_errors:[]},r=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let a=n,l=0;for(;l<o.path.length;){let u=o.path[l];l===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(o))):a[u]=a[u]||{_errors:[]},a=a[u],l++}}};return r(this),n}static assert(e){if(!(e instanceof s))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,q.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let i=r.path[0];t[i]=t[i]||[],t[i].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Q.create=s=>new Q(s);var Gu=(s,e)=>{let t;switch(s.code){case w.invalid_type:s.received===A.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case w.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,q.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:t=`Unrecognized key(s) in object: ${q.joinValues(s.keys,", ")}`;break;case w.invalid_union:t="Invalid input";break;case w.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${q.joinValues(s.options)}`;break;case w.invalid_enum_value:t=`Invalid enum value. Expected ${q.joinValues(s.options)}, received '${s.received}'`;break;case w.invalid_arguments:t="Invalid function arguments";break;case w.invalid_return_type:t="Invalid function return type";break;case w.invalid_date:t="Invalid date";break;case w.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:q.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case w.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case w.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case w.custom:t="Invalid input";break;case w.invalid_intersection_types:t="Intersection results could not be merged";break;case w.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case w.not_finite:t="Number must be finite";break;default:t=e.defaultError,q.assertNever(s)}return{message:t}},xe=Gu;var go=xe;function zu(s){go=s}function bt(){return go}var Vt=s=>{let{data:e,path:t,errorMaps:n,issueData:r}=s,i=[...t,...r.path||[]],o={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let a="",l=n.filter(u=>!!u).slice().reverse();for(let u of l)a=u(o,{data:e,defaultError:a}).message;return{...r,path:i,message:a}},Ku=[];function x(s,e){let t=bt(),n=Vt({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===xe?void 0:xe].filter(r=>!!r)});s.common.issues.push(n)}var K=class s{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let r of t){if(r.status==="aborted")return $;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let r of t){let i=await r.key,o=await r.value;n.push({key:i,value:o})}return s.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:i,value:o}=r;if(i.status==="aborted"||o.status==="aborted")return $;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}},$=Object.freeze({status:"aborted"}),Ze=s=>({status:"dirty",value:s}),Y=s=>({status:"valid",value:s}),Ws=s=>s.status==="aborted",Bs=s=>s.status==="dirty",Re=s=>s.status==="valid",wt=s=>typeof Promise<"u"&&s instanceof Promise;var T;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(T||(T={}));var ie=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},yo=(s,e)=>{if(Re(e))return{success:!0,data:e.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Q(s.common.issues);return this._error=t,this._error}}};function R(s){if(!s)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:r}=s;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,a)=>{let{message:l}=s;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??n??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??t??a.defaultError}},description:r}}var P=class{get description(){return this._def.description}_getType(e){return he(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new K,ctx:{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(wt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)},r=this._parseSync({data:e,path:n.path,parent:n});return yo(n,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Re(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>Re(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(wt(r)?r:Promise.resolve(r));return yo(n,i)}refine(e,t){let n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,i)=>{let o=e(r),a=()=>i.addIssue({code:w.custom,...n(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new oe({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Z.create(this,this._def)}nullable(){return ne.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return de.create(this)}promise(){return je.create(this,this._def)}or(e){return et.create([this,e],this._def)}and(e){return tt.create(this,e,this._def)}transform(e){return new oe({...R(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new it({...R(this._def),innerType:this,defaultValue:t,typeName:N.ZodDefault})}brand(){return new Yt({typeName:N.ZodBranded,type:this,...R(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new ot({...R(this._def),innerType:this,catchValue:t,typeName:N.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Zt.create(this,e)}readonly(){return at.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Uu=/^c[^\s-]{8,}$/i,Vu=/^[0-9a-z]+$/,Yu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zu=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Hu=/^[a-z0-9_-]{21}$/i,Ju=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qu=/^[-+]?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)?)??$/,Xu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ed="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",hr,td=/^(?:(?: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])$/,sd=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,nd=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,rd=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,id=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,od=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wo="((\\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])))",ad=new RegExp(`^${wo}$`);function vo(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);let t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function cd(s){return new RegExp(`^${vo(s)}$`)}function So(s){let e=`${wo}T${vo(s)}`,t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ld(s,e){return!!((e==="v4"||!e)&&td.test(s)||(e==="v6"||!e)&&nd.test(s))}function ud(s,e){if(!Ju.test(s))return!1;try{let[t]=s.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function dd(s,e){return!!((e==="v4"||!e)&&sd.test(s)||(e==="v6"||!e)&&rd.test(s))}var ge=class s extends P{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==A.string){let i=this._getOrReturnCtx(e);return x(i,{code:w.invalid_type,expected:A.string,received:i.parsedType}),$}let n=new K,r;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),x(r,{code:w.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),x(r,{code:w.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(r=this._getOrReturnCtx(e,r),o?x(r,{code:w.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&x(r,{code:w.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Xu.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"email",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")hr||(hr=new RegExp(ed,"u")),hr.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"emoji",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Zu.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"uuid",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Hu.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"nanoid",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Uu.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"cuid",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Vu.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"cuid2",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Yu.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"ulid",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),x(r,{validation:"url",code:w.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"regex",code:w.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),x(r,{code:w.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),x(r,{code:w.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),x(r,{code:w.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?So(i).test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{code:w.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?ad.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{code:w.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?cd(i).test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{code:w.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Qu.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"duration",code:w.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?ld(e.data,i.version)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"ip",code:w.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?ud(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"jwt",code:w.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?dd(e.data,i.version)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"cidr",code:w.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?id.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"base64",code:w.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?od.test(e.data)||(r=this._getOrReturnCtx(e,r),x(r,{validation:"base64url",code:w.invalid_string,message:i.message}),n.dirty()):q.assertNever(i);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:w.invalid_string,...T.errToObj(n)})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...T.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...T.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...T.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...T.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...T.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...T.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...T.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...T.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...T.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...T.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...T.errToObj(t)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new s({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new s({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};ge.create=s=>new ge({checks:[],typeName:N.ZodString,coerce:s?.coerce??!1,...R(s)});function fd(s,e){let t=(s.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,i=Number.parseInt(s.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return i%o/10**r}var Ae=class s extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==A.number){let i=this._getOrReturnCtx(e);return x(i,{code:w.invalid_type,expected:A.number,received:i.parsedType}),$}let n,r=new K;for(let i of this._def.checks)i.kind==="int"?q.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:w.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?fd(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:w.not_finite,message:i.message}),r.dirty()):q.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,n,r){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:T.toString(r)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&q.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ae.create=s=>new Ae({checks:[],typeName:N.ZodNumber,coerce:s?.coerce||!1,...R(s)});var He=class s extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==A.bigint)return this._getInvalidInput(e);let n,r=new K;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),x(n,{code:w.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):q.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return x(t,{code:w.invalid_type,expected:A.bigint,received:t.parsedType}),$}gte(e,t){return this.setLimit("min",e,!0,T.toString(t))}gt(e,t){return this.setLimit("min",e,!1,T.toString(t))}lte(e,t){return this.setLimit("max",e,!0,T.toString(t))}lt(e,t){return this.setLimit("max",e,!1,T.toString(t))}setLimit(e,t,n,r){return new s({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:T.toString(r)}]})}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};He.create=s=>new He({checks:[],typeName:N.ZodBigInt,coerce:s?.coerce??!1,...R(s)});var Ce=class extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==A.boolean){let n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:A.boolean,received:n.parsedType}),$}return Y(e.data)}};Ce.create=s=>new Ce({typeName:N.ZodBoolean,coerce:s?.coerce||!1,...R(s)});var Je=class s extends P{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==A.date){let i=this._getOrReturnCtx(e);return x(i,{code:w.invalid_type,expected:A.date,received:i.parsedType}),$}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return x(i,{code:w.invalid_date}),$}let n=new K,r;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),x(r,{code:w.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),x(r,{code:w.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):q.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new s({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:T.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Je.create=s=>new Je({checks:[],coerce:s?.coerce||!1,typeName:N.ZodDate,...R(s)});var St=class extends P{_parse(e){if(this._getType(e)!==A.symbol){let n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:A.symbol,received:n.parsedType}),$}return Y(e.data)}};St.create=s=>new St({typeName:N.ZodSymbol,...R(s)});var Qe=class extends P{_parse(e){if(this._getType(e)!==A.undefined){let n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:A.undefined,received:n.parsedType}),$}return Y(e.data)}};Qe.create=s=>new Qe({typeName:N.ZodUndefined,...R(s)});var Xe=class extends P{_parse(e){if(this._getType(e)!==A.null){let n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:A.null,received:n.parsedType}),$}return Y(e.data)}};Xe.create=s=>new Xe({typeName:N.ZodNull,...R(s)});var Pe=class extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return Y(e.data)}};Pe.create=s=>new Pe({typeName:N.ZodAny,...R(s)});var Ie=class extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Y(e.data)}};Ie.create=s=>new Ie({typeName:N.ZodUnknown,...R(s)});var ue=class extends P{_parse(e){let t=this._getOrReturnCtx(e);return x(t,{code:w.invalid_type,expected:A.never,received:t.parsedType}),$}};ue.create=s=>new ue({typeName:N.ZodNever,...R(s)});var kt=class extends P{_parse(e){if(this._getType(e)!==A.undefined){let n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:A.void,received:n.parsedType}),$}return Y(e.data)}};kt.create=s=>new kt({typeName:N.ZodVoid,...R(s)});var de=class s extends P{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==A.array)return x(t,{code:w.invalid_type,expected:A.array,received:t.parsedType}),$;if(r.exactLength!==null){let o=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(o||a)&&(x(t,{code:o?w.too_big:w.too_small,minimum:a?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(x(t,{code:w.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(x(t,{code:w.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>r.type._parseAsync(new ie(t,o,t.path,a)))).then(o=>K.mergeArray(n,o));let i=[...t.data].map((o,a)=>r.type._parseSync(new ie(t,o,t.path,a)));return K.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new s({...this._def,minLength:{value:e,message:T.toString(t)}})}max(e,t){return new s({...this._def,maxLength:{value:e,message:T.toString(t)}})}length(e,t){return new s({...this._def,exactLength:{value:e,message:T.toString(t)}})}nonempty(e){return this.min(1,e)}};de.create=(s,e)=>new de({type:s,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...R(e)});function vt(s){if(s instanceof H){let e={};for(let t in s.shape){let n=s.shape[t];e[t]=Z.create(vt(n))}return new H({...s._def,shape:()=>e})}else return s instanceof de?new de({...s._def,type:vt(s.element)}):s instanceof Z?Z.create(vt(s.unwrap())):s instanceof ne?ne.create(vt(s.unwrap())):s instanceof ye?ye.create(s.items.map(e=>vt(e))):s}var H=class s extends P{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=q.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==A.object){let u=this._getOrReturnCtx(e);return x(u,{code:w.invalid_type,expected:A.object,received:u.parsedType}),$}let{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof ue&&this._def.unknownKeys==="strip"))for(let u in r.data)o.includes(u)||a.push(u);let l=[];for(let u of o){let p=i[u],d=r.data[u];l.push({key:{status:"valid",value:u},value:p._parse(new ie(r,d,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof ue){let u=this._def.unknownKeys;if(u==="passthrough")for(let p of a)l.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(u==="strict")a.length>0&&(x(r,{code:w.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let p of a){let d=r.data[p];l.push({key:{status:"valid",value:p},value:u._parse(new ie(r,d,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let p of l){let d=await p.key,f=await p.value;u.push({key:d,value:f,alwaysSet:p.alwaysSet})}return u}).then(u=>K.mergeObjectSync(n,u)):K.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new s({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let r=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:T.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new s({...this._def,unknownKeys:"strip"})}passthrough(){return new s({...this._def,unknownKeys:"passthrough"})}extend(e){return new s({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new s({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:N.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new s({...this._def,catchall:e})}pick(e){let t={};for(let n of q.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new s({...this._def,shape:()=>t})}omit(e){let t={};for(let n of q.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new s({...this._def,shape:()=>t})}deepPartial(){return vt(this)}partial(e){let t={};for(let n of q.objectKeys(this.shape)){let r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new s({...this._def,shape:()=>t})}required(e){let t={};for(let n of q.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Z;)i=i._def.innerType;t[n]=i}return new s({...this._def,shape:()=>t})}keyof(){return ko(q.objectKeys(this.shape))}};H.create=(s,e)=>new H({shape:()=>s,unknownKeys:"strip",catchall:ue.create(),typeName:N.ZodObject,...R(e)});H.strictCreate=(s,e)=>new H({shape:()=>s,unknownKeys:"strict",catchall:ue.create(),typeName:N.ZodObject,...R(e)});H.lazycreate=(s,e)=>new H({shape:s,unknownKeys:"strip",catchall:ue.create(),typeName:N.ZodObject,...R(e)});var et=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new Q(a.ctx.common.issues));return x(t,{code:w.invalid_union,unionErrors:o}),$}if(t.common.async)return Promise.all(n.map(async i=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let i,o=[];for(let l of n){let u={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!i&&(i={result:p,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(l=>new Q(l));return x(t,{code:w.invalid_union,unionErrors:a}),$}}get options(){return this._def.options}};et.create=(s,e)=>new et({options:s,typeName:N.ZodUnion,...R(e)});var _e=s=>s instanceof st?_e(s.schema):s instanceof oe?_e(s.innerType()):s instanceof nt?[s.value]:s instanceof Oe?s.options:s instanceof rt?q.objectValues(s.enum):s instanceof it?_e(s._def.innerType):s instanceof Qe?[void 0]:s instanceof Xe?[null]:s instanceof Z?[void 0,..._e(s.unwrap())]:s instanceof ne?[null,..._e(s.unwrap())]:s instanceof Yt||s instanceof at?_e(s.unwrap()):s instanceof ot?_e(s._def.innerType):[],Gs=class s extends P{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==A.object)return x(t,{code:w.invalid_type,expected:A.object,received:t.parsedType}),$;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(x(t,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),$)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let i of t){let o=_e(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(r.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);r.set(a,i)}}return new s({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...R(n)})}};function gr(s,e){let t=he(s),n=he(e);if(s===e)return{valid:!0,data:s};if(t===A.object&&n===A.object){let r=q.objectKeys(e),i=q.objectKeys(s).filter(a=>r.indexOf(a)!==-1),o={...s,...e};for(let a of i){let l=gr(s[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===A.array&&n===A.array){if(s.length!==e.length)return{valid:!1};let r=[];for(let i=0;i<s.length;i++){let o=s[i],a=e[i],l=gr(o,a);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return t===A.date&&n===A.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}var tt=class extends P{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(i,o)=>{if(Ws(i)||Ws(o))return $;let a=gr(i.value,o.value);return a.valid?((Bs(i)||Bs(o))&&t.dirty(),{status:t.value,value:a.data}):(x(n,{code:w.invalid_intersection_types}),$)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,o])=>r(i,o)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};tt.create=(s,e,t)=>new tt({left:s,right:e,typeName:N.ZodIntersection,...R(t)});var ye=class s extends P{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==A.array)return x(n,{code:w.invalid_type,expected:A.array,received:n.parsedType}),$;if(n.data.length<this._def.items.length)return x(n,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$;!this._def.rest&&n.data.length>this._def.items.length&&(x(n,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...n.data].map((o,a)=>{let l=this._def.items[a]||this._def.rest;return l?l._parse(new ie(n,o,n.path,a)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>K.mergeArray(t,o)):K.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new s({...this._def,rest:e})}};ye.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ye({items:s,typeName:N.ZodTuple,rest:null,...R(e)})};var zs=class s extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==A.object)return x(n,{code:w.invalid_type,expected:A.object,received:n.parsedType}),$;let r=[],i=this._def.keyType,o=this._def.valueType;for(let a in n.data)r.push({key:i._parse(new ie(n,a,n.path,a)),value:o._parse(new ie(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?K.mergeObjectAsync(t,r):K.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof P?new s({keyType:e,valueType:t,typeName:N.ZodRecord,...R(n)}):new s({keyType:ge.create(),valueType:e,typeName:N.ZodRecord,...R(t)})}},xt=class extends P{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==A.map)return x(n,{code:w.invalid_type,expected:A.map,received:n.parsedType}),$;let r=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([a,l],u)=>({key:r._parse(new ie(n,a,n.path,[u,"key"])),value:i._parse(new ie(n,l,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let l of o){let u=await l.key,p=await l.value;if(u.status==="aborted"||p.status==="aborted")return $;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),a.set(u.value,p.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let l of o){let u=l.key,p=l.value;if(u.status==="aborted"||p.status==="aborted")return $;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),a.set(u.value,p.value)}return{status:t.value,value:a}}}};xt.create=(s,e,t)=>new xt({valueType:e,keyType:s,typeName:N.ZodMap,...R(t)});var _t=class s extends P{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==A.set)return x(n,{code:w.invalid_type,expected:A.set,received:n.parsedType}),$;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(x(n,{code:w.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(x(n,{code:w.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function o(l){let u=new Set;for(let p of l){if(p.status==="aborted")return $;p.status==="dirty"&&t.dirty(),u.add(p.value)}return{status:t.value,value:u}}let a=[...n.data.values()].map((l,u)=>i._parse(new ie(n,l,n.path,u)));return n.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new s({...this._def,minSize:{value:e,message:T.toString(t)}})}max(e,t){return new s({...this._def,maxSize:{value:e,message:T.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};_t.create=(s,e)=>new _t({valueType:s,minSize:null,maxSize:null,typeName:N.ZodSet,...R(e)});var Ks=class s extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==A.function)return x(t,{code:w.invalid_type,expected:A.function,received:t.parsedType}),$;function n(a,l){return Vt({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bt(),xe].filter(u=>!!u),issueData:{code:w.invalid_arguments,argumentsError:l}})}function r(a,l){return Vt({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bt(),xe].filter(u=>!!u),issueData:{code:w.invalid_return_type,returnTypeError:l}})}let i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof je){let a=this;return Y(async function(...l){let u=new Q([]),p=await a._def.args.parseAsync(l,i).catch(y=>{throw u.addIssue(n(l,y)),u}),d=await Reflect.apply(o,this,p);return await a._def.returns._def.type.parseAsync(d,i).catch(y=>{throw u.addIssue(r(d,y)),u})})}else{let a=this;return Y(function(...l){let u=a._def.args.safeParse(l,i);if(!u.success)throw new Q([n(l,u.error)]);let p=Reflect.apply(o,this,u.data),d=a._def.returns.safeParse(p,i);if(!d.success)throw new Q([r(p,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new s({...this._def,args:ye.create(e).rest(Ie.create())})}returns(e){return new s({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new s({args:e||ye.create([]).rest(Ie.create()),returns:t||Ie.create(),typeName:N.ZodFunction,...R(n)})}},st=class extends P{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};st.create=(s,e)=>new st({getter:s,typeName:N.ZodLazy,...R(e)});var nt=class extends P{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return x(t,{received:t.data,code:w.invalid_literal,expected:this._def.value}),$}return{status:"valid",value:e.data}}get value(){return this._def.value}};nt.create=(s,e)=>new nt({value:s,typeName:N.ZodLiteral,...R(e)});function ko(s,e){return new Oe({values:s,typeName:N.ZodEnum,...R(e)})}var Oe=class s extends P{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{expected:q.joinValues(n),received:t.parsedType,code:w.invalid_type}),$}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{received:t.data,code:w.invalid_enum_value,options:n}),$}return Y(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return s.create(e,{...this._def,...t})}exclude(e,t=this._def){return s.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};Oe.create=ko;var rt=class extends P{_parse(e){let t=q.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==A.string&&n.parsedType!==A.number){let r=q.objectValues(t);return x(n,{expected:q.joinValues(r),received:n.parsedType,code:w.invalid_type}),$}if(this._cache||(this._cache=new Set(q.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=q.objectValues(t);return x(n,{received:n.data,code:w.invalid_enum_value,options:r}),$}return Y(e.data)}get enum(){return this._def.values}};rt.create=(s,e)=>new rt({values:s,typeName:N.ZodNativeEnum,...R(e)});var je=class extends P{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==A.promise&&t.common.async===!1)return x(t,{code:w.invalid_type,expected:A.promise,received:t.parsedType}),$;let n=t.parsedType===A.promise?t.data:Promise.resolve(t.data);return Y(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};je.create=(s,e)=>new je({type:s,typeName:N.ZodPromise,...R(e)});var oe=class extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:o=>{x(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){let o=r.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return $;let l=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return l.status==="aborted"?$:l.status==="dirty"?Ze(l.value):t.value==="dirty"?Ze(l.value):l});{if(t.value==="aborted")return $;let a=this._def.schema._parseSync({data:o,path:n.path,parent:n});return a.status==="aborted"?$:a.status==="dirty"?Ze(a.value):t.value==="dirty"?Ze(a.value):a}}if(r.type==="refinement"){let o=a=>{let l=r.refinement(a,i);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?$:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?$:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(r.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Re(o))return $;let a=r.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Re(o)?Promise.resolve(r.transform(o.value,i)).then(a=>({status:t.value,value:a})):$);q.assertNever(r)}};oe.create=(s,e,t)=>new oe({schema:s,typeName:N.ZodEffects,effect:e,...R(t)});oe.createWithPreprocess=(s,e,t)=>new oe({schema:e,effect:{type:"preprocess",transform:s},typeName:N.ZodEffects,...R(t)});var Z=class extends P{_parse(e){return this._getType(e)===A.undefined?Y(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z.create=(s,e)=>new Z({innerType:s,typeName:N.ZodOptional,...R(e)});var ne=class extends P{_parse(e){return this._getType(e)===A.null?Y(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ne.create=(s,e)=>new ne({innerType:s,typeName:N.ZodNullable,...R(e)});var it=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===A.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};it.create=(s,e)=>new it({innerType:s,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...R(e)});var ot=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return wt(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Q(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Q(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ot.create=(s,e)=>new ot({innerType:s,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...R(e)});var It=class extends P{_parse(e){if(this._getType(e)!==A.nan){let n=this._getOrReturnCtx(e);return x(n,{code:w.invalid_type,expected:A.nan,received:n.parsedType}),$}return{status:"valid",value:e.data}}};It.create=s=>new It({typeName:N.ZodNaN,...R(s)});var pd=Symbol("zod_brand"),Yt=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Zt=class s extends P{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?$:i.status==="dirty"?(t.dirty(),Ze(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?$:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new s({in:e,out:t,typeName:N.ZodPipeline})}},at=class extends P{_parse(e){let t=this._def.innerType._parse(e),n=r=>(Re(r)&&(r.value=Object.freeze(r.value)),r);return wt(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}};at.create=(s,e)=>new at({innerType:s,typeName:N.ZodReadonly,...R(e)});function bo(s,e){let t=typeof s=="function"?s(e):typeof s=="string"?{message:s}:s;return typeof t=="string"?{message:t}:t}function xo(s,e={},t){return s?Pe.create().superRefine((n,r)=>{let i=s(n);if(i instanceof Promise)return i.then(o=>{if(!o){let a=bo(e,n),l=a.fatal??t??!0;r.addIssue({code:"custom",...a,fatal:l})}});if(!i){let o=bo(e,n),a=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:a})}}):Pe.create()}var md={object:H.lazycreate},N;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(N||(N={}));var hd=(s,e={message:`Input not instance of ${s.name}`})=>xo(t=>t instanceof s,e),_o=ge.create,Io=Ae.create,gd=It.create,yd=He.create,Ao=Ce.create,bd=Je.create,wd=St.create,vd=Qe.create,Sd=Xe.create,kd=Pe.create,xd=Ie.create,_d=ue.create,Id=kt.create,Ad=de.create,Cd=H.create,Od=H.strictCreate,Td=et.create,Ed=Gs.create,$d=tt.create,Nd=ye.create,Rd=zs.create,Pd=xt.create,jd=_t.create,qd=Ks.create,Ld=st.create,Dd=nt.create,Md=Oe.create,Fd=rt.create,Wd=je.create,Bd=oe.create,Gd=Z.create,zd=ne.create,Kd=oe.createWithPreprocess,Ud=Zt.create,Vd=()=>_o().optional(),Yd=()=>Io().optional(),Zd=()=>Ao().optional(),Hd={string:(s=>ge.create({...s,coerce:!0})),number:(s=>Ae.create({...s,coerce:!0})),boolean:(s=>Ce.create({...s,coerce:!0})),bigint:(s=>He.create({...s,coerce:!0})),date:(s=>Je.create({...s,coerce:!0}))};var Jd=$;var be=c.object({promptId:c.string()}),Co=c.enum(["fuzzy","elaborated","confirmed"]),Ht={fuzzy:.5,elaborated:.7,confirmed:.9},Us=c.object({id:c.string(),description:c.string().min(1),relatedGoals:c.array(c.string()).default([]),confidence:c.number().min(0).max(1),source:be.optional()}),Vs=c.object({id:c.string(),description:c.string().min(1),reason:c.string().default(""),relatedGoals:c.array(c.string()).default([]),confidence:c.number().min(0).max(1),source:be.optional()}),Ys=c.object({id:c.string(),description:c.string().min(1),source:be.optional()}),At=c.enum(["primary","secondary","external"]),Oo=c.enum(["identified","elaborated","confirmed"]),Jt={identified:.5,elaborated:.7,confirmed:.9},Zs=c.object({statement:c.string().min(1),confidence:c.number().min(0).max(1),source:be.optional()}),Hs=c.object({id:c.string(),title:c.string().min(1),description:c.string(),rationale:c.string().optional(),status:Co,confidence:c.number().min(0).max(1),source:be.optional()}),Js=c.object({id:c.string(),name:c.string().min(1),type:At,role:c.string().default(""),concerns:c.array(c.string()).default([]),isRespondent:c.boolean().default(!1),status:Oo.default("identified"),confidence:c.number().min(0).max(1).default(.5),source:be.optional()}),Qs=c.object({statement:c.string().min(1),confidence:c.number().min(0).max(1),source:be.optional()}),Xs=c.object({statement:c.string().min(1),confidence:c.number().min(0).max(1),source:be.optional()}),To=c.enum(["unvalidated","validated","flagged"]),en={unvalidated:.5,validated:.9,flagged:.7},tn=c.enum(["hypothesis","invariant"]),sn=c.object({id:c.string(),statement:c.string().min(1),type:tn,status:To.default("unvalidated"),relatedGoals:c.array(c.string()).default([]),confidence:c.number().min(0).max(1),source:be.optional()}),Eo=c.object({id:c.string(),content:c.string().min(1)}),$o=c.object({id:c.string(),content:c.string().min(1),phase:c.string()}),No=c.object({id:c.string(),content:c.string().min(1),reason:c.string().min(1)}),Qd=c.object({purpose:Zs.optional(),advantage:Qs.optional(),measurement:Xs.optional(),goals:c.array(Hs).default([]),stakeholders:c.array(Js).default([]),inScope:c.array(Us).default([]),outOfScope:c.array(Vs).default([]),constraints:c.array(Ys).default([]),assumptions:c.array(sn).default([]),domainHints:c.array(c.string()).default([]),waitingRoom:c.array(Eo).default([]),findings:c.array($o).default([]),residual:c.array(No).default([])});function yr(){return{goals:[],stakeholders:[],inScope:[],outOfScope:[],constraints:[],assumptions:[],domainHints:[],waitingRoom:[],findings:[],residual:[]}}function Ro(s){return!s||s<.5?.5:s<.7?.7:s}function X(s,e){let t=e.reduce((n,r)=>{let i=parseInt(r.id.split("_").pop(),10);return isNaN(i)?n:Math.max(n,i)},0);return`${s}_${String(t+1).padStart(3,"0")}`}function nn(s,e,t,n,r){let i=s[e]?.source??r;s[e]={statement:t,confidence:n,...i&&{source:i}}}function Po(s,e,t,n){nn(s,"purpose",e,t,n)}function jo(s,e,t,n){nn(s,"advantage",e,t,n)}function qo(s,e,t,n){nn(s,"measurement",e,t,n)}function Lo(s,e=.9){for(let t of["purpose","advantage","measurement"]){let n=s[t];n&&(s[t]={...n,confidence:e})}}function Do(s,e,t){for(let n of["purpose","advantage","measurement"]){let r=e[n];r&&nn(s,n,r,Ro(s[n]?.confidence),t)}}function Ct(s,e){for(let t of e)s.waitingRoom.push({id:X("waiting",s.waitingRoom),content:t.content})}function Mo(s,e){e.size!==0&&(s.waitingRoom=s.waitingRoom.filter(t=>!e.has(t.id)))}function Fo(s,e){for(let t of e)s.residual.push({id:X("residual",s.residual),content:t.content,reason:t.reason})}function Wo(s){s.waitingRoom=[]}function Bo(s,e,t){let n=[];for(let r of e){let i=X("goal",s.goals);s.goals.push({id:i,title:r.title,description:r.description,rationale:r.rationale,status:"fuzzy",confidence:Ht.fuzzy,...t&&{source:t}}),n.push(i)}return n}function br(s,e,t){let n=rn(s,e);if(!n)return!1;let r=!1;return t.title&&(n.title=t.title,r=!0),t.description&&(n.description=t.description,r=!0),t.rationale&&(n.rationale=t.rationale,r=!0),r}function Go(s,e,t){let n=rn(s,e);n&&(n.status=t,n.confidence=Ht[t])}function zo(s,e){s.goals=s.goals.filter(t=>!e.has(t.id))}function Ko(s){for(let e of s.goals)e.status==="elaborated"&&(e.status="confirmed",e.confidence=Ht.confirmed)}function Uo(s,e,t){let n=br(s,e,{title:t.title,description:t.description,rationale:t.rationale});return Ct(s,t.waitingRoomItems??[]),n}function rn(s,e){return s.goals.find(t=>t.id===e)}function Vo(s,e,t){for(let n of e)s.stakeholders.push({id:X("stakeholder",s.stakeholders),name:n.name,type:n.type,role:"",concerns:[],isRespondent:!1,status:"identified",confidence:Jt.identified,...t&&{source:t}})}function wr(s,e,t){let n=Ot(s,e);if(!n)return!1;let r=!1;return t.role&&(n.role=t.role,r=!0),t.type&&(n.type=t.type,r=!0),r}function vr(s,e,t){let n=Ot(s,e);if(!n)return 0;let r=new Set(n.concerns),i=0;for(let o of t)r.has(o)||(n.concerns.push(o),r.add(o),i++);return i}function Yo(s,e){let t=Ot(s,e);t&&(t.isRespondent=!0)}function Zo(s,e,t){let n=Ot(s,e);n&&(n.status=t,n.confidence=Jt[t])}function Ho(s,e){s.stakeholders=s.stakeholders.filter(t=>!e.has(t.id))}function Jo(s){for(let e of s.stakeholders)e.status==="elaborated"&&(e.status="confirmed",e.confidence=Jt.confirmed)}function Qo(s,e,t){let n=!1;return t.role&&(n=wr(s,e,{role:t.role})||n),t.concerns&&t.concerns.length>0&&(n=vr(s,e,t.concerns)>0||n),Ct(s,t.waitingRoomItems??[]),n}function Ot(s,e){return s.stakeholders.find(t=>t.id===e)}function ta(s){return X("scope",[...s.inScope,...s.outOfScope])}function Sr(s){return s.toLowerCase().trim().replace(/\s+/g," ")}function sa(s,e){let t=Sr(e);return s.inScope.some(n=>Sr(n.description)===t)||s.outOfScope.some(n=>Sr(n.description)===t)}function na(s,e,t=.7,n){for(let r of e)sa(s,r.description)||s.inScope.push({id:ta(s),description:r.description,relatedGoals:r.relatedGoals??[],confidence:t,...n&&{source:n}})}function ra(s,e,t=.7,n){for(let r of e)sa(s,r.description)||s.outOfScope.push({id:ta(s),description:r.description,reason:r.reason??"",relatedGoals:r.relatedGoals??[],confidence:t,...n&&{source:n}})}function ia(s,e,t){for(let n of e)s.constraints.push({id:X("constraint",s.constraints),description:n.description,...t&&{source:t}})}function oa(s,e){s.inScope=s.inScope.filter(t=>!e.has(t.id)),s.outOfScope=s.outOfScope.filter(t=>!e.has(t.id))}function aa(s){for(let e of s.inScope)e.confidence=.9;for(let e of s.outOfScope)e.confidence=.9}function ca(s,e,t=en.unvalidated,n="unvalidated",r){for(let i of e)s.assumptions.push({id:X("assumption",s.assumptions),statement:i.statement,type:i.type??"hypothesis",status:n,relatedGoals:i.relatedGoals??[],confidence:t,...r&&{source:r}})}function la(s,e,t){let n=kr(s,e);n&&(n.status=t,n.confidence=en[t])}function ua(s,e){s.assumptions=s.assumptions.filter(t=>!e.has(t.id))}function kr(s,e){return s.assumptions.find(t=>t.id===e)}function da(s,e){s.domainHints.push(...e)}function fa(s,e,t){s.findings.push({id:X("finding",s.findings),content:e,phase:t})}function pa(s,e){return s.findings.filter(t=>t.phase===e)}var ct=class{data;constructor(){this.data=yr()}setPurpose(e,t,n){Po(this.data,e,t,n)}setAdvantage(e,t,n){jo(this.data,e,t,n)}setMeasurement(e,t,n){qo(this.data,e,t,n)}confirmPam(e=.9){Lo(this.data,e)}applyPamExtraction(e,t){Do(this.data,e,t)}addFuzzyGoals(e,t){return Bo(this.data,e,t)}updateGoal(e,t){return br(this.data,e,t)}setGoalStatus(e,t){Go(this.data,e,t)}removeGoals(e){zo(this.data,e)}confirmElaboratedGoals(){Ko(this.data)}applyGoalExtraction(e,t){return Uo(this.data,e,t)}goal(e){return rn(this.data,e)}addIdentifiedStakeholders(e,t){Vo(this.data,e,t)}updateStakeholder(e,t){return wr(this.data,e,t)}addConcerns(e,t){return vr(this.data,e,t)}setRespondent(e){Yo(this.data,e)}setStakeholderStatus(e,t){Zo(this.data,e,t)}removeStakeholders(e){Ho(this.data,e)}confirmElaboratedStakeholders(){Jo(this.data)}applyStakeholderElaboration(e,t){return Qo(this.data,e,t)}stakeholder(e){return Ot(this.data,e)}addInScopeItems(e,t,n){na(this.data,e,t,n)}addOutOfScopeItems(e,t,n){ra(this.data,e,t,n)}addConstraints(e,t){ia(this.data,e,t)}removeScopeItems(e){oa(this.data,e)}confirmScope(){aa(this.data)}addAssumptions(e,t,n,r){ca(this.data,e,t,n,r)}setAssumptionStatus(e,t){la(this.data,e,t)}removeAssumptions(e){ua(this.data,e)}assumption(e){return kr(this.data,e)}addDomainHints(e){da(this.data,e)}addFinding(e,t){fa(this.data,e,t)}findingsByPhase(e){return pa(this.data,e)}addWaitingRoomItems(e){Ct(this.data,e)}drainWaitingRoom(e){Mo(this.data,e)}addResidualItems(e){Fo(this.data,e)}drainAllWaitingRoom(){Wo(this.data)}summarize(){return{...this.data.purpose&&{purpose:this.data.purpose.statement},...this.data.advantage&&{advantage:this.data.advantage.statement},...this.data.measurement&&{measurement:this.data.measurement.statement},goals:this.data.goals.map(e=>({id:e.id,title:e.title,status:e.status})),stakeholders:this.data.stakeholders.map(e=>({id:e.id,name:e.name,type:e.type})),inScope:this.data.inScope.map(e=>e.description),outOfScope:this.data.outOfScope.map(e=>e.description),constraints:this.data.constraints.map(e=>e.description),assumptionCount:this.data.assumptions.length,findingCount:this.data.findings.length}}userConcern;setUserConcern(e){this.userConcern=e}};var ae=class extends Error{response;constructor(e){super(e),this.name="Confusion",this.response=e}},Qt=class extends Error{response;parkedItems;constructor(e,t){super(e),this.name="OffTopic",this.response=e,this.parkedItems=t??[]}},Tt=class extends Error{response;parkedItems;constructor(e,t){super(e),this.name="Pushback",this.response=e,this.parkedItems=t??[]}},Xt=class extends Error{response;parkedItems;constructor(e,t){super(e),this.name="TopicChange",this.response=e,this.parkedItems=t??[]}},Et=class extends Error{response;parkedItems;constructor(e,t){super(e),this.name="Frustration",this.response=e,this.parkedItems=t??[]}},af=[ae,Qt,Tt,Xt,Et];function $t(s){return af.some(e=>s instanceof e)}function xr(s,e,t){switch(s){case"answer":return null;case"confusion":return new ae(e);case"off_topic":return new Qt(e,t);case"pushback":return new Tt(e,t);case"topic_change":return new Xt(e,t);case"frustration":return new Et(e,t);default:return null}}function on(s){return s instanceof ae?"Let me put that differently.":s instanceof Et?"I understand \u2014 we're almost through this part. Let me keep it focused.":s instanceof Tt?"Fair question. This helps us make sure nothing important is missed. Let me continue.":"Thanks for that \u2014 I've noted it. Let me come back to what I was asking."}j.prototype.retryOnDeviation=async function(s,e){let t=e?.maxRetries??2,n=e?.retryOn,r;for(let i=0;i<=t;i++)try{return await s(i,r)}catch(o){if($t(o)){if(n&&!n.some(a=>o instanceof a))throw o;r=o;continue}throw o}if(e&&"defaults"in e)return e.defaults;throw r};function ma(s){let e=["opening","purpose","goal","goals","stakeholder","stakeholders","scope","assumption","assumptions","validation"],t=s;for(let n of e)if(t.startsWith(n+"-")){t=t.slice(n.length+1);break}return t=t.replace(/_0*(\d+)/g," #$1"),t=t.replace(/-r\d+$/,"").replace(/-\d+$/,""),t=t.replace(/-?question-?/g,"-").replace(/-?extraction-?/g,"-").replace(/-?composition-?/g,"-"),t=t.replace(/-+/g," ").trim(),t=t.replace(/\s+\d+$/,""),t}function an(s,e){if(!s)return"";let{step:t,total:n,label:r}=s,i=ma(e);return i?`[${t}/${n} ${r} \xB7 ${i}]`:`[${t}/${n} ${r}]`}j.prototype.progress=null;j.prototype.pendingTransition=null;j.prototype.setProgress=function(s,e,t){this.progress={step:s,total:e,label:t}};j.prototype.setTransition=function(s){this.pendingTransition=s??null};var cf=["setProgress","setTransition"];for(let s of cf)if(typeof j.prototype[s]!="function")throw new Error(`interview/progress.ts self-check failed: WorkflowContext.prototype.${s} is not a function.`);function es(){return`
145
+ <composition_rules>
146
+ You are composing a single interview question with optional suggested answers. Format output as markdown.
147
+
148
+ <questioning>
149
+ 1. Question stem under 20 words. One sentence, SVO structure, no embedded clauses.
150
+ 2. Compose context as a separate preceding statement \u2014 keep it out of the question.
151
+ 3. Keep total message concise \u2014 prefer 3-4 sentences.
152
+ 4. Use affirmative question stems ("Which of these are goals?" not "Which are NOT goals?").
153
+ 5. Attach a concrete handle to "why" questions ("What led you to\u2026?" not bare "Why?").
154
+ 6. Prefer experience-grounded questions ("Tell me about a time\u2026") over hypotheticals, except for negative probing.
155
+ 7. When rephrasing, change the approach and angle \u2014 offer a concrete example or scaffold when the respondent signals confusion.
156
+ 8. Ask exactly one question per message \u2014 never include two or more question marks.
157
+ </questioning>
158
+
159
+ <formatting>
160
+ 1. Bold the key noun phrase (2-4 words) in each question: "What **safety equipment** do you currently use?"
161
+ 2. Keep bolding under ~30% of text.
162
+ 3. Leave suggestions unbolded.
163
+ </formatting>
164
+
165
+ <bias>
166
+ 1. Use neutral language \u2014 no evaluative adjectives, no positive/negative framing preambles.
167
+ 2. Ask existence-checking questions before assuming specifics ("Walk me through your current process" before "What features do you want?").
168
+ 3. Frame for openness ("How do you feel about\u2026?" not "Do you agree that\u2026?").
169
+ 4. Normalize uncertainty when appropriate ("It's completely fine if you're not sure").
170
+ 5. Reflect the respondent's own words without upgrading their certainty or specificity.
171
+ 6. Present the question only \u2014 do not offer your own interpretation or answer within it.
172
+ 7. Vary suggested answers across different angles or specificity levels when the topic allows \u2014 avoid clustering all suggestions around the same type.
173
+ </bias>
174
+
175
+ <register>
176
+ 1. Approachable, clear tone \u2014 "knowledgeable friend." Not overly formal, not buddy-like.
177
+ 2. Mirror the respondent's vocabulary level.
178
+ 3. Gloss jargon only when the respondent hasn't used the term themselves.
179
+ 4. Frame questions from the respondent's perspective \u2014 use the name and role of the stakeholder marked isRespondent in the context. Do not frame questions for other stakeholders' perspectives.
180
+ </register>
181
+
182
+ Keep questions focused and unbiased. The respondent's words are the source of truth.
183
+ </composition_rules>
184
+ `}function _r(){return`
185
+ <classification_rules>
186
+ You are classifying whether the respondent approved a summary or requested a revision.
187
+
188
+ <bias_correction>
189
+ 1. Weight correction signals generously \u2014 if the respondent mentions anything to change, classify as revision even if they also express general approval.
190
+ 2. Treat ambiguous responses as revision requests, not approvals.
191
+ 3. Treat hedging language ("I guess it's fine", "mostly", "probably ok") as revision signals.
192
+ 4. Only classify as approved when the respondent clearly and unambiguously endorses the summary.
193
+ </bias_correction>
194
+
195
+ When in doubt, classify as revision. A false revision is cheaper than a missed correction.
196
+ </classification_rules>
197
+ `}function Ir(){return`
198
+ <extraction_rules>
199
+ You are extracting structured data from the respondent's words.
200
+
201
+ <fidelity>
202
+ 1. Extract the respondent's words faithfully \u2014 preserve their language, don't interpret or rephrase.
203
+ 2. Record what they said, not what you think they meant. "Mentioned mobile" stays "mentioned mobile", not "mobile-first requirement".
204
+ 3. Do not upgrade certainty \u2014 "might need" stays tentative, not "needs".
205
+ 4. Do not add evaluative framing ("key", "main", "critical") unless the respondent used those words.
206
+ 5. Do not infer fields the respondent did not mention \u2014 leave them empty.
207
+ </fidelity>
208
+
209
+ The respondent is the authority on their own intent. Extract, don't interpret.
210
+ </extraction_rules>
211
+ `}function cn(){return"...or better yet, describe in your own words \u2014 your phrasing captures nuances that pre-made options can't"}function ce(){return"What would you change or add? If this looks right as-is, let me know and we'll move on."}j.prototype.promptStep=async function(s){let e=s.message;this.pendingTransition&&(e=this.pendingTransition+`
212
+
213
+ `+e,this.pendingTransition=null);let t=an(this.progress,s.id);return this.prompt({...s,message:t?`${t}
214
+ ${e}`:e})};j.prototype.promptQuestion=async function(s,e){let t=e.question;if(e.suggestions&&e.suggestions.length>0){let r="abcdefghijklmnopqrstuvwxyz";t+=`
215
+
216
+ For example:`;for(let i=0;i<e.suggestions.length;i++)t+=`
217
+ ${r[i]}) ${e.suggestions[i]}`;cn()&&(t+=`
218
+ ${cn()}`)}this.pendingTransition&&(t=this.pendingTransition+`
219
+
220
+ `+t,this.pendingTransition=null);let n=an(this.progress,s);return this.prompt({id:s,message:n?`${n}
221
+ ${t}`:t,suggestions:e.suggestions})};j.prototype.promptContradiction=async function(s,e){let t=["I noticed something that might be inconsistent with what you said earlier:"];for(let i of e)t.push(`
222
+ - ${i}`);t.push(`
223
+
224
+ Could you help me understand what changed?`);let n=t.join("");this.pendingTransition&&(n=this.pendingTransition+`
225
+
226
+ `+n,this.pendingTransition=null);let r=an(this.progress,s);return this.prompt({id:s,message:r?`${r}
227
+ ${n}`:n})};var lf=["promptStep","promptQuestion","promptContradiction"];for(let s of lf)if(typeof j.prototype[s]!="function")throw new Error(`interview/prompt.ts self-check failed: WorkflowContext.prototype.${s} is not a function.`);j.prototype.compose=async function(s){let e=es(),t=e?{...s,message:e+`
228
+
229
+ `+s.message}:s,{question:n,suggestions:r}=await this.infer(t);return n?{question:n,suggestions:r}:{question:s.fallback}};if(typeof j.prototype.compose!="function")throw new Error("interview/composition.ts self-check failed: WorkflowContext.prototype.compose is not a function.");var ha=c.object({question:c.string().describe("the question to ask the stakeholder"),suggestions:c.array(c.string()).describe("2-3 suggested answers")});function ts(s,e=""){if(s instanceof Z)return ts(s._def.innerType,e);if(s instanceof ne)return`${ts(s._def.innerType,e)} | null`;if(s instanceof ge)return"string";if(s instanceof Ae)return"number";if(s instanceof Ce)return"boolean";if(s instanceof Oe)return s._def.values.map(n=>`"${n}"`).join(" | ");if(s instanceof de)return`${ts(s._def.type,`${e}[]`)}[]`;if(s instanceof H){let n=s._def.shape();return`{ ${Object.entries(n).map(([i,o])=>{let a=o instanceof Z?"?":"",l=ga(o),u=e?`${e}.${i}`:i,p=ts(o,u);return l?`${i}${a}: ${p} - ${l}`:`${i}${a}: ${p}`}).join(", ")} }`}let t=e?` at "${e}"`:"";throw new Error(`zodTypeToString: unsupported Zod type ${s._def?.typeName??"unknown"}${t}`)}function ga(s){return s.description?s.description:s instanceof Z&&s._def.innerType.description||s instanceof ne&&s._def.innerType.description?s._def.innerType.description:""}function W(s){let{id:e,message:t,schema:n}=s;return{id:e,message:t,schema:ya(n)}}function J(s){let{fallback:e,...t}=s;return{...W({schema:ha,...t}),fallback:e}}function ya(s){let e=s._def.shape(),t={};for(let[n,r]of Object.entries(e)){let i=ga(r),o=ts(r);t[n]=i?`${o} - ${i}`:o}return t}var uf=c.enum(["answer","confusion","off_topic","pushback","topic_change","frustration"]).describe("Classify the respondent's response: answer (addressed the question, even partially \u2014 includes disagreeing with content, pointing out conflicts, suggesting corrections, or challenging captured artifacts), confusion (asked what you mean or expressed confusion), off_topic (unrelated information), pushback (rejected the interview process itself \u2014 e.g. 'why are you asking me this' or 'this is pointless'), topic_change (steered to different subject), frustration (expressed fatigue/impatience). If in doubt, classify as answer.");function df(s,e,t){let n=[];if(t?.question&&(n.push(`Question asked: "${t.question}"`),t.suggestions&&t.suggestions.length>0)){let r="abcdefghijklmnopqrstuvwxyz",i=t.suggestions.map((o,a)=>`${r[a]}) ${o}`).join(", ");n.push(`Suggestions offered: ${i}`)}return n.push(`Their response: "${s}"`),n.push(""),n.push(`Existing artifacts: ${e}`),n}j.prototype.extract=async function(s){let e=ff(s),t=s.schema.extend({responseClass:uf}),n=await this.infer(W({id:s.id,message:e,schema:t}));return pf(n,s.response)};function ff(s){let{response:e,artifactsContext:t,asked:n,focus:r,guidance:i}=s,o=[],a=Ir();return a&&o.push(a),o.push(`<response_classification>
230
+ Before extracting, classify the respondent's response:
231
+ - "answer": They addressed the question (even partially or tangentially). This includes disagreeing with captured content, pointing out conflicts between items, suggesting corrections or restructuring, or challenging the substance of what was discussed. Content-level engagement is always an answer.
232
+ - "confusion": They asked what you mean, requested rephrasing, or expressed confusion about the question
233
+ - "off_topic": They provided unrelated information or introduced a new idea
234
+ - "pushback": They rejected the interview process itself \u2014 e.g. "why are you asking me this?", "this is pointless", "I don't see the point of this exercise". Challenging content or disagreeing with artifacts is NOT pushback \u2014 that is an answer.
235
+ - "topic_change": They tried to steer the conversation to a different subject
236
+ - "frustration": They expressed fatigue, impatience, or annoyance
237
+ Set responseClass accordingly. If in doubt, classify as "answer".
238
+ When responseClass is NOT "answer", deposit the respondent's actual content into waitingRoomItems (if the schema has that field) so it is preserved for later phases.
239
+ </response_classification>`),r&&o.push(`Focus: ${r}`),o.push(...df(e,t,n)),i&&o.push(i),o.join(`
240
+ `)}function pf(s,e){let{responseClass:t="answer",...n}=s,r=xr(t,e,n.waitingRoomItems);if(r)throw r;return n}j.prototype.seed=async function(s){let{id:e,artifactsContext:t,schema:n,guidance:r}=s,i=[];return r&&i.push(r),i.push(`
241
+ Conversation context:
242
+ ${t}`),this.infer(W({id:e,message:i.join(`
243
+ `),schema:n}))};j.prototype.reextract=async function(s,e,t,n){return this.extract({id:s,response:e,artifactsContext:t,schema:n,guidance:"The respondent clarified a contradiction. Re-extract incorporating the clarification."})};var mf=["extract","seed","reextract"];for(let s of mf)if(typeof j.prototype[s]!="function")throw new Error(`interview/extraction.ts self-check failed: WorkflowContext.prototype.${s} is not a function.`);j.prototype.review=async function(s,e,t,n,r,i){let o=i!==void 0?`${s}-r${i}`:s;return this.extract({id:o,response:e,artifactsContext:n,schema:r,guidance:`The respondent reacted to the presented list.
244
+ ${t?`Item IDs: ${t}`:"No items existed yet."}`})};if(typeof j.prototype.review!="function")throw new Error("interview/classification.ts self-check failed: WorkflowContext.prototype.review is not a function.");function hf(){return`The respondent asked for clarification. Rephrase the question using simpler language, a concrete example, or a different angle.
245
+
246
+ `}j.prototype.composePromptExtract=async function(s,e,t,n){return this.retryOnDeviation(async(r,i)=>{i&&!(i instanceof ae)&&"parkedItems"in i&&i.parkedItems.length>0&&n?.park?.(i.parkedItems);let o=e(),a=i instanceof ae?hf()+o.message:o.message,l=await this.compose({...o,message:a,id:`${s}-composition-r${r}`}),u=i&&!(i instanceof ae)?on(i)+`
247
+
248
+ `+l.question:l.question,p=await this.promptQuestion(`${s}-question-r${r}`,{...l,question:u});return this.extract({...t,id:`${s}-extraction-r${r}`,response:p,asked:l})},{maxRetries:n?.maxRetries??2,...n&&"defaults"in n?{defaults:n.defaults}:{}})};async function Ar(s,e,t,n){return s.retryOnDeviation(async(r,i)=>{i&&!(i instanceof ae)&&"parkedItems"in i&&i.parkedItems.length>0&&n?.park?.(i.parkedItems);let o=i?on(i)+`
249
+
250
+ `+e.message:e.message,a=await s.promptStep({...e,id:`${e.id}-r${r}`,message:o});return t(a,r)},{maxRetries:n?.maxRetries??1,...n?.defaults!==void 0?{defaults:n.defaults}:{}})}j.prototype.promptExtract=(async function(s,e,t){return Ar(this,s,(n,r)=>this.extract({...e,id:`${s.id}-extraction-r${r}`,response:n}),t)});j.prototype.promptConfirm=(async function(s,e,t){let n=t?.defaults?{...t,defaults:{...t.defaults,response:""}}:t;return Ar(this,s,async(r,i)=>({...await e(r,i),response:r}),n)});j.prototype.promptReview=(async function(s,e,t,n,r,i){return Ar(this,s,(o,a)=>this.review(e,o,t,n,r,a),i)});j.prototype.promptReextract=(async function(s,e,t,n,r){return this.retryOnDeviation(async(i,o)=>{o&&!(o instanceof ae)&&"parkedItems"in o&&o.parkedItems.length>0&&r?.park?.(o.parkedItems);let a=await this.promptContradiction(`${s}-r${i}`,e);return this.reextract(`${s}-reextraction-r${i}`,a,t,n)},{maxRetries:r?.maxRetries??1,...r?.defaults!==void 0?{defaults:r.defaults}:{}})});var gf=["composePromptExtract","promptExtract","promptConfirm","promptReview","promptReextract"];for(let s of gf)if(typeof j.prototype[s]!="function")throw new Error(`interview/macros.ts self-check failed: WorkflowContext.prototype.${s} is not a function.`);var yf=c.object({approved:c.boolean().describe("true if the stakeholder approved the summary"),revisionRequested:c.string().nullable().describe("what they want to change, null if approved"),targetId:c.string().nullable().optional().describe("ID of the specific item to revise (e.g. goal_001, sh_002), null if unclear or not applicable")});j.prototype.confirm=async function(s,e,t,n,r){let i=r!==void 0?`-r${r}`:"",l=`Classify the response to the ${t} summary.${t==="goals"||t==="stakeholders"?`
251
+ If revising, set targetId to the ID of the specific item they want to change.`:""}`,u=_r(),p=u?u+`
252
+ `+l:l;return this.extract({id:`${t}-confirmation-classification-${n}${i}`,response:s,artifactsContext:E(e),schema:yf,guidance:p})};function ee(s,e,t,n,r,i){return s.promptConfirm(e,(o,a)=>s.confirm(o,t,n,r,a),i)}function E(s,e){let t={};return s.purpose&&(t.purpose=Zs.pick({statement:!0}).parse(s.purpose)),s.advantage&&(t.advantage=Qs.pick({statement:!0}).parse(s.advantage)),s.measurement&&(t.measurement=Xs.pick({statement:!0}).parse(s.measurement)),s.goals.length>0&&(t.goals=s.goals.map(n=>Hs.pick({id:!0,title:!0,status:!0,rationale:!0}).parse(n))),s.stakeholders.length>0&&(t.stakeholders=s.stakeholders.map(n=>Js.pick({id:!0,name:!0,type:!0,role:!0,concerns:!0,isRespondent:!0,status:!0}).parse(n))),s.inScope.length>0&&(t.inScope=s.inScope.map(n=>Us.pick({description:!0,relatedGoals:!0}).parse(n))),s.outOfScope.length>0&&(t.outOfScope=s.outOfScope.map(n=>Vs.pick({description:!0,reason:!0,relatedGoals:!0}).parse(n))),s.constraints.length>0&&(t.constraints=s.constraints.map(n=>Ys.pick({id:!0,description:!0}).parse(n))),s.assumptions.length>0&&(t.assumptions=s.assumptions.map(n=>sn.pick({id:!0,statement:!0,type:!0,status:!0,relatedGoals:!0}).parse(n))),s.domainHints.length>0&&(t.domainHints=s.domainHints),e?.includeWaitingRoom&&s.waitingRoom.length>0&&(t.waitingRoom=s.waitingRoom.map(n=>({id:n.id,content:n.content}))),Object.keys(t).length>0?JSON.stringify(t):"(no artifacts captured yet)"}var bf=["confirm"];for(let s of bf)if(typeof j.prototype[s]!="function")throw new Error(`phases/shared.ts self-check failed: WorkflowContext.prototype.${s} is not a function. A prototype assignment was likely dropped.`);function fe(s,e){let t=e.filter(Boolean);return t.length===0?"":s?[s,...t].join(`
253
+ `):t.join(`
254
+ `)}function wf(){return{id:"opening-greet",message:`Hey \u2014 I'm Elaborate! I'll help you shape your project idea through a quick conversation.
255
+
256
+ What are you building, and what problem does it solve? If it builds on existing work, feel free to mention that too.`}}var vf=c.object({purpose:c.string().describe("the core purpose or problem being solved"),stakeholders:c.array(c.string()).describe("implied users or affected parties"),domainHints:c.array(c.string()).describe("domain or industry keywords")}),Sf=c.object({greenfieldConfidence:c.number().describe("1 (uncertain) to 10 (certain this is a brand-new project with no existing work)")}),kf=7,xf=c.object({isBrownfield:c.boolean().describe("true if the user indicated this is part of an existing project with existing artifacts to review"),sourceIndicators:c.array(c.string()).describe("file paths, URLs, or other source references the user mentioned, empty if greenfield")}),_f=c.object({items:c.array(c.string()).describe("atomic information items extracted from the sources, each a single fact about purpose, goals, stakeholders, scope, constraints, or assumptions")});function If(){return{id:"opening-brownfield",message:`If there's existing work this builds on \u2014 code, docs, URLs \u2014 describe it here.
257
+ Otherwise, **skip**.`}}function Af(s,e){let t=[];return s&&t.push(`So you want to ${s.toLowerCase()}.`),e&&e.length>0&&t.push(`It sounds like this is for ${e.join(", ")}.`),t.push(`
258
+ Does that sound right so far?`),{id:"opening-summary",message:t.join(" ")}}async function ba(s,e){let{purpose:t,stakeholders:n,domainHints:r}=await s.promptExtract(wf(),{artifactsContext:E(e.data),schema:vf},{defaults:{purpose:"",stakeholders:[],domainHints:[]}}),i=s.currentSource;t&&e.setPurpose(t,.5,i),n&&n.length>0&&e.addIdentifiedStakeholders(n.map(l=>({name:l,type:"primary"})),i),r&&r.length>0&&e.addDomainHints(r);let{greenfieldConfidence:o}=await s.infer(W({id:"opening-brownfield-screen",schema:Sf,message:`Based on the user's description, how confident are you that this is a brand-new project with no existing work to build on?
259
+
260
+ "Existing work" means concrete artifacts that THIS project inherits as its starting point \u2014 things the new work will extend, replace, integrate with, or add on to (e.g. prior versions, legacy systems, existing tools, institutional infrastructure, prototypes, documents, databases).
261
+
262
+ Everything else is context about the problem space, NOT existing work \u2014 this includes competitors, similar products, industry references, domain expertise, prior research, regulations, inspiration sources, or experience with unrelated projects.
263
+
264
+ Score high (greenfield) unless the user explicitly describes artifacts this project builds on.
265
+
266
+ Context: ${E(e.data)}`}));if(o<kf){let{isBrownfield:l,sourceIndicators:u}=await s.promptExtract(If(),{artifactsContext:E(e.data),schema:xf,guidance:`Classify the user's response to "Is this part of an existing project?"`},{defaults:{isBrownfield:!1,sourceIndicators:[]}});if(l&&u.length>0){let{items:p}=await s.seed({id:"opening-brownfield-extraction",artifactsContext:E(e.data),schema:_f,guidance:`Read the indicated sources using your tools and extract atomic information items relevant to the idea.
267
+ Each item should be a single fact \u2014 one goal, one stakeholder, one constraint, one assumption, etc.
268
+ Focus on: purpose, goals, stakeholders, scope boundaries, constraints, assumptions.
269
+ Sources to read: ${JSON.stringify(u)}`});p.length>0&&e.addWaitingRoomItems(p.map(d=>({content:d})))}}let{response:a}=await ee(s,Af(t,n),e.data,"opening",0,{defaults:{approved:!0,revisionRequested:null}});return a}var Cf=["purpose","advantage","measurement"],Of={purpose:3,advantage:2,measurement:2},Tf=3,wa={purpose:{fresh:"Ask what problem this project solves or what need it addresses.",rephrase:"The previous question about purpose didn't get a clear answer. Try a different angle \u2014 use a concrete example or offer choices."},advantage:{fresh:"Ask what makes this approach better than alternatives or the status quo.",rephrase:"The previous question about advantage didn't get a clear answer. Try offering concrete alternatives to react to."},measurement:{fresh:"Ask how the user would know if this project succeeded \u2014 what they would measure.",rephrase:"The previous question about measurement didn't get a clear answer. Offer concrete examples of metrics from similar projects."}},Ef={purpose:"What **problem** does this project solve?",advantage:"What makes this approach better than how people handle it today?",measurement:"How would you know if this project succeeded?"},va=["The stakeholder described a solution or feature. Ask WHY they need this \u2014 what underlying problem it solves.","The stakeholder hasn't yet articulated the core problem. Ask WHY this matters \u2014 what underlying need drives it.","Try a different angle. Ask what would be different for users if this problem were solved."],Nt=c.object({purpose:c.string().nullable().optional().describe("the core purpose/problem being solved, null if not addressed"),advantage:c.string().nullable().optional().describe("why this approach is better than alternatives, null if not addressed"),measurement:c.string().nullable().optional().describe("how success will be measured, null if not addressed"),responseInterpretation:c.string().describe("what the stakeholder meant, resolving any suggestion references (a, b, c) to their full text"),contradictions:c.array(c.string()).optional().describe("genuine logical contradictions with existing artifacts where both statements CANNOT be true simultaneously (e.g. 'app is free' vs 'revenue from subscriptions'). NOT: different priorities, complementary concerns, soft tensions, or different aspects of the same goal. Empty array if none")}),$f=c.object({framing:c.enum(["solution","problem","mixed"]).describe("whether the response describes a solution/feature (solution), a problem/need (problem), or both (mixed)"),solutionDescription:c.string().nullable().describe("the solution or feature described, null if problem-framed")});function Nf(s,e,t,n){return J({id:"",fallback:"What **underlying problem** does that solve?",message:`
270
+ Compose a WHY question to abstract upward from a solution description toward the underlying purpose.
271
+ ${va[Math.min(s,va.length-1)]}
272
+ The solution described: "${e}"
273
+ The stakeholder's original words: "${t}"
274
+ Include 2-3 suggested answers that show the expected level of specificity.
275
+
276
+ Context:
277
+ ${E(n)}
278
+ `})}var Rf=c.object({purpose:c.string().nullable().optional().describe("purpose hint extracted from waiting room items, null if none"),advantage:c.string().nullable().optional().describe("advantage hint extracted from waiting room items, null if none"),measurement:c.string().nullable().optional().describe("measurement hint extracted from waiting room items, null if none"),drainedWaitingRoomIds:c.array(c.string()).optional().describe('IDs of waiting room items consumed as purpose/advantage/measurement hints (e.g. ["waiting_001"]), empty if none')}),Sa=Nt.extend({waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("goals, stakeholder hints, or assumptions surfaced as byproducts \u2014 to be parked for later phases")});function Pf(s,e,t){let n=e>0?wa[s].rephrase:wa[s].fresh;return J({id:"",fallback:Ef[s],message:`
279
+ Compose a question for the stakeholder about: ${s}.
280
+ ${n}
281
+ Include 2-3 suggested answers that show the expected level of specificity.
282
+
283
+ Context:
284
+ ${E(t)}
285
+ `})}function jf(s){let e=s.findings.filter(n=>n.phase==="purpose"),t=e.length>0?`
286
+
287
+ **Gaps noted**:
288
+ ${e.map(n=>`- ${n.content}`).join(`
289
+ `)}`:"";return{id:"purpose-confirmation",message:`
290
+ Here's what I've captured so far:
291
+
292
+ **Purpose**: ${s.purpose?s.purpose.statement:"_(not yet defined)_"}
293
+ **Advantage**: ${s.advantage?s.advantage.statement:"_(not yet defined)_"}
294
+ **Measurement**: ${s.measurement?s.measurement.statement:"_(not yet defined)_"}${t}
295
+
296
+ ${ce()}
297
+ `}}async function ka(s,e,t){let n=e.data;if(n.waitingRoom.length>0){let a=new Set(n.waitingRoom.map(p=>p.id)),l=await s.seed({id:"purpose-seed-extraction",artifactsContext:E(n,{includeWaitingRoom:!0}),schema:Rf,guidance:"Extract purpose, advantage, or measurement hints from the waitingRoom items in the context. These are PAM (Purpose-Advantage-Measurement) slots. Return drainedWaitingRoomIds for the items you consumed."});e.applyPamExtraction(l,s.currentSource);let u=new Set((l.drainedWaitingRoomIds??[]).filter(p=>a.has(p)));e.drainWaitingRoom(u)}let r=!1;if(t)try{let a=await s.extract({id:"purpose-initial-extraction",response:t,artifactsContext:E(n),schema:Nt});if(e.applyPamExtraction(a,s.currentSource),r=!0,a.contradictions?.length){let l=await s.promptReextract("purpose-initial-contradiction",a.contradictions,E(n),Nt,{defaults:{purpose:null,advantage:null,measurement:null,responseInterpretation:"",contradictions:[]}});e.applyPamExtraction(l,s.currentSource)}}catch(a){if(!$t(a))throw a}if(r&&t&&!n.purpose){let{framing:a,solutionDescription:l}=await s.extract({id:"purpose-classify-framing",response:t,artifactsContext:E(n),schema:$f});if(a!=="problem"&&l)for(let u=0;u<Tf&&!n.purpose;u++){let p=await s.composePromptExtract(`purpose-ladder-${u}`,()=>Nf(u,l,t,n),{artifactsContext:E(n),schema:Sa},{park:d=>e.addWaitingRoomItems(d),defaults:{purpose:null,advantage:null,measurement:null,responseInterpretation:"",contradictions:[],waitingRoomItems:[]}});if(e.applyPamExtraction(p,s.currentSource),p.waitingRoomItems?.length&&e.addWaitingRoomItems(p.waitingRoomItems),p.contradictions?.length){let d=await s.promptReextract(`purpose-ladder-contradiction-${u}`,p.contradictions,E(n),Sa,{defaults:{purpose:null,advantage:null,measurement:null,responseInterpretation:"",contradictions:[],waitingRoomItems:[]}});e.applyPamExtraction(d,s.currentSource)}}}for(let a of Cf){if(n[a])continue;let l=!1,u=Of[a];for(let p=0;p<u&&!l;p++){let d=await s.composePromptExtract(`purpose-${a}-${p}`,()=>Pf(a,p,n),{artifactsContext:E(n),schema:Nt},{defaults:{purpose:null,advantage:null,measurement:null,responseInterpretation:"",contradictions:[]}});if(d.contradictions?.length){e.applyPamExtraction(d,s.currentSource);let f=await s.promptReextract(`purpose-contradiction-${a}-${p}`,d.contradictions,E(n),Nt,{defaults:{purpose:null,advantage:null,measurement:null,responseInterpretation:"",contradictions:[]}});e.applyPamExtraction(f,s.currentSource),l=!!n[a];continue}e.applyPamExtraction(d,s.currentSource),l=!!n[a]}n[a]||e.addFinding(`Stakeholder could not articulate ${a} after ${u} attempts`,"purpose")}let{response:i,approved:o}=await ee(s,jf(n),n,"purpose",0);if(!o){let a=await s.extract({id:"purpose-revision",response:i,artifactsContext:E(n),schema:Nt});e.applyPamExtraction(a,s.currentSource)}e.confirmPam(.9)}var Lf=2,Df=c.object({goals:c.array(c.object({title:c.string().describe("short goal name"),description:c.string().describe("what the goal means"),rationale:c.string().optional().describe("why this goal matters")})).optional().describe(`candidate goals extracted from the conversation so far, 1-${3} goals`),drainedWaitingRoomIds:c.array(c.string()).optional().describe('IDs of waiting room items used as goal sources (e.g. ["waiting_001"]), empty if none')}),Mf=c.object({responseInterpretation:c.string().describe("what the stakeholder meant, resolving any suggestion references"),confirmedGoalIds:c.array(c.string()).optional().describe("IDs the user confirmed (or all IDs if they confirmed)"),removedGoalIds:c.array(c.string()).optional().describe("IDs the user wants removed"),newGoals:c.array(c.object({title:c.string().describe("short goal name"),description:c.string().describe("what the goal means")})).optional().describe("new goals the user mentioned, empty if none"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that sound like scope or assumptions rather than goals, empty if none")}),Cr=c.object({responseInterpretation:c.string().describe("what the stakeholder meant, resolving any suggestion references (a, b, c) to their full text"),title:c.string().nullable().optional().describe("updated goal title if the response clarified it, null to keep current"),description:c.string().nullable().optional().describe("updated description if the response expanded it, null to keep current"),rationale:c.string().nullable().optional().describe("why this goal matters, extracted from the response, null if not addressed"),contradictions:c.array(c.string()).optional().describe("genuine logical contradictions with existing goals or purpose/advantage where both statements CANNOT be true simultaneously (e.g. 'goal requires real-time' vs 'constraint is batch-only'). NOT: different priorities between stakeholders, complementary concerns, soft tensions, or different aspects of the same goal. Empty array if none"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that sound like scope or assumptions rather than goals, empty if none")}),Ff=c.object({responseInterpretation:c.string().describe("what the stakeholder meant, resolving any suggestion references"),goals:c.array(c.object({title:c.string().describe("short goal name"),description:c.string().describe("what the goal means")})).optional().describe("goals mentioned by the stakeholder, empty if none"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that sound like scope or assumptions rather than goals, empty if none")}),Wf=c.object({rankedGoalIds:c.array(c.string()).describe("goal IDs ordered from highest to lowest priority for probing")});function Bf(s,e){let t=s.goals.map(i=>`[${i.id}] "${i.title}" \u2014 ${i.description}`).join("; "),n=[s.purpose?`Purpose: ${s.purpose}`:null,s.advantage?`Advantage: ${s.advantage}`:null,s.measurement?`Measurement: ${s.measurement}`:null].filter(Boolean).join("; "),r=e.length>0?`Confirmed from suggestions (not user-originated): ${e.join(", ")}`:"All goals are user-originated.";return W({id:"goal-sort",schema:Wf,message:`
298
+ Rank these goals by priority for detailed probing.
299
+
300
+ Goals: ${t}
301
+ PAM: ${n}
302
+ ${r}
303
+
304
+ Criteria (in order):
305
+ 1. Genuine uniqueness: goals that don't substantially overlap with purpose/advantage/measurement rank highest.
306
+ 2. User-originated: goals the user stated rank above goals they merely confirmed from suggestions.
307
+ 3. Listing order as tertiary tiebreaker.
308
+
309
+ Return ALL goal IDs, ordered from highest to lowest priority.
310
+ `})}function xa(s,e,t){let n=s.data.goals.filter(r=>!t.has(r.id));for(let r of n)s.addWaitingRoomItems([{content:`Goal: ${r.title} \u2014 ${r.description}`}]),delete e[r.id];s.removeGoals(new Set(n.map(r=>r.id)))}function Gf(s){let e="abcdefghijklmnopqrstuvwxyz";return{id:"goal-seed-present",message:`
311
+ Based on what you've told me, I see these potential goals:
312
+ ${s.map((n,r)=>`${e[r]}) **${n.title}** \u2014 ${n.description}`).join(`
313
+ `)}
314
+
315
+ Did I capture the right goals? You can confirm, add new ones, or tell me which to remove.
316
+ `}}function zf(s){return J({id:"",fallback:"What are the main **goals** for your project?",message:`
317
+ Compose a question asking the stakeholder about their project goals \u2014 the outcomes they want to achieve.
318
+ Suggest 2-3 concrete goals relevant to their stated purpose.
319
+
320
+ Context:
321
+ ${E(s)}
322
+ `})}function Kf(s,e,t,n){let r=t>0,i,o;switch(e){case"clarify":i=r?`The previous question about "${s}" didn't get a clear answer. Offer concrete examples or choices to help them articulate it.`:`Ask what "${s}" means concretely \u2014 what achieving it would look like in practice.`,o=`What would achieving "${s}" look like in practice?`;break;case"why":i=r?`Rephrase the "why" question for "${s}". Try grounding it in a specific scenario or user experience.`:`Ask why "${s}" is important \u2014 what value achieving it creates.`,o=`What **value** does achieving "${s}" create?`;break;case"negative":i=r?`Rephrase the negative question for "${s}". Try a concrete scenario \u2014 e.g., imagine launching without it, what workaround people would use.`:`Ask what would happen if "${s}" didn't exist or wasn't achieved.`,o=`What would happen if "${s}" wasn't achieved?`;break}return J({id:"",fallback:o,message:`
323
+ Compose a question for the stakeholder about goal: "${s}".
324
+ ${i}
325
+ Include 2-3 suggested answers that show the expected level of specificity.
326
+
327
+ Context:
328
+ ${E(n)}
329
+ `})}function Uf(s,e){let t=s.map(i=>{let o=i.rationale?`
330
+ _Why it matters:_ ${i.rationale}`:"";return`**${i.title}** [${i.status}]
331
+ ${i.description}${o}`}).join(`
332
+
333
+ `),n=e.filter(i=>i.phase==="goals"),r=n.length>0?`
334
+ **Gaps noted**:
335
+ ${n.map(i=>`- ${i.content}`).join(`
336
+ `)}
337
+ `:"";return{id:"goals-confirmation",message:`
338
+ Here's what I've captured for your project goals:
339
+
340
+ ${t}
341
+ ${r}
342
+ ${ce()}
343
+ `}}function Or(s,e,t,n){let r=s.addFuzzyGoals(t,n);for(let i of r)e[i]={attempts:0,probingStage:"clarify"}}async function _a(s,e){let t=e.data,n={},r=new Set(t.waitingRoom.map(f=>f.id)),i=await s.seed({id:"goal-seed-extraction",artifactsContext:E(t,{includeWaitingRoom:!0}),schema:Df,guidance:`Extract candidate project goals. Each goal: clear title (verb + outcome), description, optional rationale. 1-${3} goals. Prefer goals that capture outcomes beyond what's already stated in purpose, advantage, and measurement. Pull hints from the waitingRoom items in the context; return drainedWaitingRoomIds for the items you consumed.`}),o=i.goals??[],a=new Set((i.drainedWaitingRoomIds??[]).filter(f=>r.has(f)));if(e.drainWaitingRoom(a),o.length>0){Or(e,n,o,s.currentSource);let f=t.goals.map(m=>`${m.id}: "${m.title}"`).join(", "),y=await s.promptReview(Gf(t.goals),"goal-seed-classification",f,E(t),Mf,{defaults:{responseInterpretation:"",confirmedGoalIds:[],removedGoalIds:[],newGoals:[],waitingRoomItems:[]}}),g=new Set(y.removedGoalIds??[]);if(g.size>0){e.removeGoals(g);for(let m of g)delete n[m]}if(Or(e,n,y.newGoals??[],s.currentSource),e.addWaitingRoomItems(y.waitingRoomItems??[]),t.goals.length>3){let m=(y.confirmedGoalIds??[]).filter(_=>!g.has(_)),h=await s.infer(Bf(t,m)),v=new Set(t.goals.map(_=>_.id)),b=h.rankedGoalIds.filter(_=>v.has(_)),S=b.length>=3?new Set(b.slice(0,3)):new Set(t.goals.slice(0,3).map(_=>_.id));xa(e,n,S)}}else{let f=await s.composePromptExtract("goal-initial",()=>zf(t),{artifactsContext:E(t),schema:Ff},{defaults:{responseInterpretation:"",goals:[],waitingRoomItems:[]}});if(Or(e,n,f.goals??[],s.currentSource),e.addWaitingRoomItems(f.waitingRoomItems??[]),t.goals.length>3){let y=new Set(t.goals.slice(0,3).map(g=>g.id));xa(e,n,y)}}for(let f of t.goals){if(f.status!=="fuzzy")continue;if(f.rationale){e.setGoalStatus(f.id,"elaborated");continue}let y=n[f.id]??{attempts:0,probingStage:"clarify"};n[f.id]||(n[f.id]=y);let g=!1;for(;!g&&y.probingStage;){let m=!1;for(let h=y.attempts;h<Lf&&!m;h++){y.attempts=h+1;let v=y.probingStage,b=await s.composePromptExtract(`goal-refinement-${f.id}-${v}-${h}`,()=>Kf(f.title,v,h,t),{artifactsContext:E(t),schema:Cr,focus:`[${f.id}] "${f.title}"`},{defaults:{responseInterpretation:"",title:null,description:null,rationale:null,contradictions:[],waitingRoomItems:[]}});if(b.contradictions&&b.contradictions.length>0){e.applyGoalExtraction(f.id,b);let S=await s.promptReextract(`goal-contradiction-${f.id}-${v}-${h}`,b.contradictions,E(t),Cr,{defaults:{responseInterpretation:"",title:null,description:null,rationale:null,contradictions:[],waitingRoomItems:[]}});m=e.applyGoalExtraction(f.id,S);continue}m=e.applyGoalExtraction(f.id,b)}if(!m)e.addFinding(`Stakeholder could not elaborate goal "${f.title}" after ${y.attempts} attempts`,"goals"),g=!0;else{let h=null;y.probingStage==="clarify"&&!f.rationale?h="why":!1,h?(y.probingStage=h,y.attempts=0):(e.setGoalStatus(f.id,"elaborated"),g=!0)}}}t.goals.some(f=>f.status==="elaborated"||f.status==="confirmed")||e.addFinding("No goals reached elaborated status \u2014 downstream requirements may lack direction","goals");let{response:u,approved:p,targetId:d}=await ee(s,Uf(t.goals,t.findings),t,"goals",0);if(!p){let f=await s.extract({id:"goals-revision",response:u,artifactsContext:E(t),schema:Cr}),y=(d&&t.goals.find(g=>g.id===d))??t.goals[0];y&&e.applyGoalExtraction(y.id,f)}e.confirmElaboratedGoals()}var Ia=3,Hf=c.object({stakeholders:c.array(c.object({name:c.string().describe("stakeholder name or role"),type:At.optional().describe("'primary', 'secondary', or 'external'")})).optional().describe("stakeholder candidates from the waiting room, empty if none"),drainedWaitingRoomIds:c.array(c.string()).optional().describe('IDs of waiting room items used as stakeholder sources (e.g. ["waiting_001"]), empty if none')}),Jf=c.object({responseInterpretation:c.string().describe("what the respondent meant, resolving any references"),updatedTypes:c.array(c.object({id:c.string().describe("stakeholder ID"),type:At.describe("corrected type")})).optional().describe("type corrections (primary/secondary/external), empty if none"),removedIds:c.array(c.string()).optional().describe("stakeholder IDs to remove, empty if none"),newStakeholders:c.array(c.object({name:c.string().describe("stakeholder name or role"),type:At.describe("'primary', 'secondary', or 'external'")})).optional().describe("new stakeholders mentioned, empty if none")}),Qf=c.object({responseInterpretation:c.string().describe("what the respondent meant"),respondentId:c.string().nullable().optional().describe("ID of the stakeholder that IS the respondent, null if unclear")}),ss=c.object({responseInterpretation:c.string().describe("what the respondent meant, resolving any suggestion references (a, b, c) to their full text"),role:c.string().nullable().optional().describe("this specific stakeholder's role as described by the respondent \u2014 not the respondent's own role or any other stakeholder's role from context. null if not addressed"),concerns:c.array(c.string()).optional().describe("stakeholder concerns extracted from the response, empty if none"),contradictions:c.array(c.string()).optional().describe("genuine logical contradictions between stated concerns and existing goals or purpose where both statements CANNOT be true simultaneously (e.g. 'stakeholder opposes feature X' vs 'goal requires feature X'). NOT: different priorities between stakeholders, complementary concerns, soft tensions, or different aspects of the same goal. Empty array if none"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that sound like scope or assumptions rather than stakeholder concerns, empty if none")}),Xf=c.object({needed:c.boolean().describe("true if the elaboration answer has meaningful gaps worth probing \u2014 missing role, thin concerns (0-1), or unexplored domain-specific angles. false if role and 2+ specific concerns were captured"),question:c.string().optional().describe("a targeted follow-up question addressing the identified gap, only when needed is true"),suggestions:c.array(c.string()).optional().describe("2-3 suggested answers for the follow-up question, only when needed is true")}),ep=c.object({duplicateGroups:c.array(c.object({keepId:c.string().describe("the stakeholder ID to keep"),removeIds:c.array(c.string()).describe("stakeholder IDs that are semantically duplicate of keepId \u2014 same actor/role, different wording")})).describe("groups of semantically duplicate stakeholders \u2014 only flag entries you are CERTAIN represent the same actor/role with different wording")}),tp=c.object({rankedStakeholderIds:c.array(c.string()).describe("stakeholder IDs ordered from highest to lowest priority for probing")});function sp(s,e,t,n){let r=e.map(l=>`[${l.id}] "${l.name}" (${l.type})`).join("; "),i=t.goals.map(l=>`[${l.id}] "${l.title}" \u2014 ${l.description}`).join("; "),o=[t.purpose?`Purpose: ${t.purpose.statement}`:null,t.advantage?`Advantage: ${t.advantage.statement}`:null,t.measurement?`Measurement: ${t.measurement.statement}`:null].filter(Boolean).join("; "),a=n.length>0?`User-added during review (not agent-inferred): ${n.join(", ")}`:"All stakeholders are agent-inferred.";return W({id:`stakeholder-sort-${s}`,schema:tp,message:`
344
+ Rank these stakeholders by priority for detailed probing.
345
+
346
+ Stakeholders: ${r}
347
+ Goals: ${i}
348
+ PAM: ${o}
349
+ ${a}
350
+
351
+ Criteria (in order):
352
+ 1. Stakeholder importance: how central is this stakeholder to the product's value delivery? End-users and primary beneficiaries of the product rank highest \u2014 their unmet needs represent the highest-risk gaps.
353
+ 2. Information gap: how much do we actually know about their specific concerns vs. inferring from goals? Rank higher when concerns are unknown or merely assumed, even if they seem to echo stated goals.
354
+ 3. User-added: stakeholders the user named during review rank above agent-inferred ones.
355
+
356
+ Return ALL stakeholder IDs, ordered from highest to lowest priority.
357
+ `})}function np(s){let e=s.stakeholders.map(t=>`[${t.id}] "${t.name}" (${t.type})`).join("; ");return W({id:"stakeholder-dedup",schema:ep,message:`
358
+ Identify semantically duplicate stakeholders \u2014 entries that represent the same actor or role with different wording.
359
+
360
+ Stakeholders: ${e}
361
+
362
+ Rules:
363
+ 1. Only group entries you are CERTAIN represent the same actor/role (e.g. "Healthcare Providers" and "Healthcare Provider Representatives" describing the same group). Related but distinct actors are NOT duplicates.
364
+ 2. Actors with overlapping concerns but different roles are NOT duplicates (e.g. "Nurses" and "Doctors" both care about patient outcomes but are distinct stakeholders).
365
+ 3. For each group, pick the clearest/most specific name as keepId.
366
+ 4. Return an empty array if there are no duplicates.
367
+ `})}function rp(s){if(s.length===0)return{id:"stakeholder-review-present",message:`
368
+ I haven't identified any specific stakeholders yet from our conversation.
369
+
370
+ Who will be the main people involved in or affected by this project?
371
+ Think about: direct users, administrators, managers, external parties, regulators, etc.
372
+ `};let e="abcdefghijklmnopqrstuvwxyz";return{id:"stakeholder-review-present",message:`
373
+ Based on what you've told me, I see these people involved in your project:
374
+ ${s.map((n,r)=>`${e[r]}) **${n.name}** (${n.type})`).join(`
375
+ `)}
376
+
377
+ What would you change, add, or remove?
378
+ `}}function ip(s){return{id:"stakeholder-respondent-present",message:`Which of these roles best describes you \u2014 ${s.map(t=>t.name).join(", or ")}?`}}function op(s,e,t,n){let r=e?`The previous question about "${s.name}" didn't get a clear answer about their role or concerns. Try a different angle \u2014 offer concrete examples relevant to the project domain.`:`Ask about "${s.name}"'s role in the project and what they would care most about.`;return J({id:"",fallback:"Could you tell me more about this stakeholder's role and what they'd care most about?",message:`
379
+ Compose a question for the respondent about stakeholder: "${s.name}" (${s.type}).
380
+ ${r}
381
+ Include 2-3 suggested answers that show the expected level of specificity.
382
+
383
+ Context:
384
+ ${E(n)}
385
+ `})}function ap(s,e,t){let n=e.role??"(not captured)",r=(e.concerns??[]).length>0?(e.concerns??[]).join("; "):"(none captured)";return W({id:`stakeholder-followup-assessment-${s.id}`,schema:Xf,message:`
386
+ Assess whether a follow-up question about "${s.name}" (${s.type}) would surface meaningful new information.
387
+
388
+ Elaboration captured:
389
+ - Role: ${n}
390
+ - Concerns: ${r}
391
+
392
+ If the elaboration answer is rich (role present AND 2+ specific concerns), set needed=false.
393
+ If there are meaningful gaps (missing role, thin/generic concerns, unexplored domain-specific angles), set needed=true and compose a targeted follow-up question.
394
+
395
+ The follow-up should address the specific gap \u2014 do not default to "if you were in their shoes" unless no better angle exists. Consider:
396
+ - Missing role \u2192 ask about their relationship to the project
397
+ - Thin concerns \u2192 probe for specific domain-relevant worries
398
+ - Generic concerns \u2192 ask for concrete examples
399
+ - Perspective-switching is one option when the respondent struggles to articulate proxy concerns
400
+
401
+ ${es()}
402
+
403
+ Context:
404
+ ${E(t)}
405
+ `})}function cp(s,e){let t=s.map(i=>{let o=i.isRespondent?" _(you)_":"",a=i.role?`
406
+ Role: ${i.role}`:"",l=i.concerns.length>0?`
407
+ Concerns: ${i.concerns.join("; ")}`:"";return`**${i.name}** [${i.type}, ${i.status}]${o}${a}${l}`}).join(`
408
+
409
+ `),n=e.filter(i=>i.phase==="stakeholders"),r=n.length>0?`
410
+ **Notes**:
411
+ ${n.map(i=>`- ${i.content}`).join(`
412
+ `)}
413
+ `:"";return{id:"stakeholders-confirmation",message:`
414
+ Here's what I've captured for your project stakeholders:
415
+ ${t}
416
+ ${r}
417
+ ${ce()}`}}async function Aa(s,e){let t=e.data;if(t.waitingRoom.length>0){let g=new Set(t.waitingRoom.map(v=>v.id)),m=await s.seed({id:"stakeholder-seed-extraction",artifactsContext:E(t,{includeWaitingRoom:!0}),schema:Hf,guidance:"Identify stakeholder candidates \u2014 people, roles, groups, or organizations involved in or affected by the project. Pull hints from the waitingRoom items in the context; return drainedWaitingRoomIds for the items you consumed."});e.addIdentifiedStakeholders((m.stakeholders??[]).map(v=>({name:v.name,type:v.type??"secondary"})),s.currentSource);let h=new Set((m.drainedWaitingRoomIds??[]).filter(v=>g.has(v)));e.drainWaitingRoom(h)}let n=t.stakeholders.map(g=>`${g.id}: "${g.name}" (${g.type})`).join(", "),r=await s.promptReview(rp(t.stakeholders),"stakeholder-review-classification",n,E(t),Jf,{defaults:{responseInterpretation:"",updatedTypes:[],removedIds:[],newStakeholders:[]}});if(r.updatedTypes)for(let g of r.updatedTypes)e.updateStakeholder(g.id,{type:g.type});let i=new Set(r.removedIds??[]);i.size>0&&e.removeStakeholders(i);let o=new Set(t.stakeholders.map(g=>g.id));e.addIdentifiedStakeholders(r.newStakeholders??[],s.currentSource);let a=t.stakeholders.filter(g=>!o.has(g.id)).map(g=>g.id);if(t.stakeholders.length>0){let g=t.stakeholders.map(h=>`${h.id}: "${h.name}" (${h.type})`).join(", "),m=await s.promptExtract(ip(t.stakeholders),{artifactsContext:E(t),schema:Qf,guidance:`The respondent was asked which stakeholder best describes them.
418
+ Stakeholder IDs: ${g}
419
+ The respondent may describe their role in their own words rather than picking a listed name. This is a valid answer \u2014 match to the closest stakeholder by role overlap. Only classify as confusion if the response genuinely asks for clarification.`},{defaults:{responseInterpretation:"",respondentId:null}});m.respondentId&&(e.stakeholder(m.respondentId)?e.setRespondent(m.respondentId):e.addFinding(`Respondent identification failed \u2014 "${m.respondentId}" not found among stakeholder IDs`,"stakeholders"))}let l=new Set,u={primary:5,secondary:4,external:2};for(let g of["primary","secondary","external"]){let m=t.stakeholders.filter(v=>v.type===g),h=u[g];if(m.length<=h)for(let v of m)l.add(v.id);else{let v=await s.infer(sp(g,m,t,a.filter(C=>m.some(O=>O.id===C)))),b=new Set(m.map(C=>C.id)),S=v.rankedStakeholderIds.filter(C=>b.has(C)),_=S.length>=h?S.slice(0,h):m.slice(0,h).map(C=>C.id);for(let C of _)l.add(C)}}for(let g of t.stakeholders){if(g.status!=="identified"||!l.has(g.id))continue;let m=!1;for(let h=0;h<Ia&&!m;h++){let v=h>0,b=await s.composePromptExtract(`stakeholder-elaboration-${g.id}-${h}`,()=>op(g,v,h,t),{artifactsContext:E(t),schema:ss,focus:`[${g.id}] "${g.name}" (${g.type})`},{defaults:{responseInterpretation:"",role:null,concerns:[],contradictions:[],waitingRoomItems:[]}});if(b.contradictions&&b.contradictions.length>0){e.applyStakeholderElaboration(g.id,b);let S=await s.promptReextract(`stakeholder-elaboration-contradiction-${g.id}-${h}`,b.contradictions,E(t),ss,{defaults:{responseInterpretation:"",role:null,concerns:[],contradictions:[],waitingRoomItems:[]}});m=e.applyStakeholderElaboration(g.id,S);continue}m=e.applyStakeholderElaboration(g.id,b)}if(!m){e.addFinding(`Could not elaborate stakeholder "${g.name}" after ${Ia} attempts`,"stakeholders");continue}if(g.type==="primary"&&!g.isRespondent){let h=await s.infer(ap(g,{role:g.role,concerns:g.concerns},t));if(h.needed&&h.question){let v=await s.promptQuestion(`stakeholder-followup-${g.id}-question-r0`,{question:h.question,suggestions:h.suggestions}),b=await s.extract({id:`stakeholder-followup-${g.id}-extraction-r0`,response:v,artifactsContext:E(t),schema:ss,focus:`[${g.id}] "${g.name}" (${g.type})`});if(e.applyStakeholderElaboration(g.id,b),b.contradictions&&b.contradictions.length>0){let S=await s.promptReextract(`stakeholder-followup-contradiction-${g.id}`,b.contradictions,E(t),ss,{defaults:{responseInterpretation:"",role:null,concerns:[],contradictions:[],waitingRoomItems:[]}});e.applyStakeholderElaboration(g.id,S)}}g.concerns.length===0&&e.addFinding(`Respondent could not articulate concerns for "${g.name}" \u2014 proxy knowledge may be limited, consider direct validation`,"stakeholders")}e.setStakeholderStatus(g.id,"elaborated")}if(t.stakeholders.some(g=>g.type==="primary"&&l.has(g.id)&&(g.status==="elaborated"||g.status==="confirmed"))||e.addFinding("No primary stakeholder has been elaborated \u2014 downstream requirements may miss critical perspectives","stakeholders"),t.stakeholders.length>=2){let g=await s.infer(np(t));for(let m of g.duplicateGroups??[]){let h=e.stakeholder(m.keepId);if(!h)continue;let v=m.removeIds.filter(b=>e.stakeholder(b));for(let b of v){let S=e.stakeholder(b);S.concerns.length>0&&e.addConcerns(h.id,S.concerns),S.isRespondent&&e.setRespondent(h.id),S.status==="elaborated"&&h.status==="identified"&&e.setStakeholderStatus(h.id,"elaborated")}v.length>0&&e.removeStakeholders(new Set(v))}}let{response:d,approved:f,targetId:y}=await ee(s,cp(t.stakeholders,t.findings),t,"stakeholders",0);if(!f){let g=await s.extract({id:"stakeholders-revision",response:d,artifactsContext:E(t),schema:ss}),m=(y&&t.stakeholders.find(h=>h.id===y))??t.stakeholders[0];m&&e.applyStakeholderElaboration(m.id,g)}e.confirmElaboratedStakeholders()}var Ca=c.object({inScope:c.array(c.object({description:c.string().describe("what is in scope"),relatedGoals:c.array(c.string()).optional().describe("goal IDs this supports")})).optional().describe("items clearly in scope from the conversation, empty if none"),outOfScope:c.array(c.object({description:c.string().describe("what is excluded"),reason:c.string().optional().describe("why it's excluded"),relatedGoals:c.array(c.string()).optional().describe("goal IDs this relates to")})).optional().describe("items clearly excluded, empty if none"),ambiguous:c.array(c.object({description:c.string().describe("the ambiguous item"),relatedGoals:c.array(c.string()).optional().describe("goal IDs this relates to")})).optional().describe("items mentioned but unclear if in or out, empty if none"),drainedWaitingRoomIds:c.array(c.string()).optional().describe('IDs of waiting room items classified into scope (e.g. ["waiting_001"]), empty if none')}),lp=c.object({responseInterpretation:c.string().describe("what the respondent meant"),confirmedInScope:c.array(c.string()).optional().describe("IDs the user confirmed as in-scope (or all if confirmed)"),confirmedOutOfScope:c.array(c.string()).optional().describe("IDs the user confirmed as out-of-scope"),removedIds:c.array(c.string()).optional().describe("IDs to remove entirely"),newItems:c.array(c.object({description:c.string().describe("the scope item"),classification:c.string().optional().describe("'in', 'out', or 'ambiguous'")})).optional().describe("new items mentioned, empty if none"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that sound like assumptions rather than scope, empty if none")}),up=c.object({responseInterpretation:c.string().describe("what the respondent meant, resolving any suggestion references"),constraints:c.array(c.object({description:c.string().describe("the constraint")})).optional().describe("constraints extracted from the response, empty if none"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that sound like assumptions rather than constraints, empty if none")}),dp=c.object({responseInterpretation:c.string().describe("what the respondent meant, resolving any suggestion references"),classification:c.enum(["in","out","deferred"]).optional().describe("where this item belongs"),reason:c.string().optional().describe("why it's excluded (only if classification is 'out'), empty otherwise"),relatedGoals:c.array(c.string()).optional().describe("goal IDs this item relates to, empty if none"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that sound like assumptions, empty if none")}),fp=c.object({rankedAmbiguousIds:c.array(c.string()).describe("ambiguous item indices (as strings) ordered from highest to lowest priority for contrast questions"),autoClassifications:c.array(c.object({index:c.string().describe("the ambiguous item index (as string)"),classification:c.enum(["in","out"]).describe("best-guess classification"),relatedGoals:c.array(c.string()).optional().describe("goal IDs this item relates to"),reason:c.string().optional().describe("why classified out (only if 'out')")})).describe("default in/out classification for items that won't get contrast questions")});function pp(s,e){let t=s.map((i,o)=>{let a=i.relatedGoals?.length?` (goals: ${i.relatedGoals.join(", ")})`:"";return`[${o}] "${i.description}"${a}`}).join("; "),n=e.goals.map(i=>`[${i.id}] "${i.title}" \u2014 ${i.description}`).join("; "),r=[...e.inScope.map(i=>`IN: "${i.description}"`),...e.outOfScope.map(i=>`OUT: "${i.description}"`)].join("; ");return W({id:"scope-ambiguous-sort",schema:fp,message:`
420
+ Rank these ambiguous scope items by priority for boundary clarification, and provide default in/out classifications for lower-priority items.
421
+
422
+ Ambiguous items: ${t}
423
+ Goals: ${n}
424
+ Existing scope: ${r}
425
+
426
+ Ranking criteria (in order):
427
+ 1. Connected to more goals: items touching multiple goals affect more downstream requirements.
428
+ 2. Higher ambiguity: items where the in/out decision is genuinely unclear rank above items that are almost certainly one way.
429
+
430
+ Return ALL indices in rankedAmbiguousIds (highest priority first).
431
+ For items beyond the top ${3}, provide autoClassifications with your best-guess in/out.
432
+ `})}var mp=c.object({contradictions:c.array(c.object({description:c.string().describe("what the contradiction is"),scopeItemId:c.string().describe("the scope item ID"),goalId:c.string().describe("the conflicting goal ID")})).optional().describe("scope items that make a confirmed/elaborated goal infeasible \u2014 the goal CANNOT be achieved without this item. NOT: soft tensions where a goal is merely weakened, less efficient, or harder to achieve. Empty array if none"),orphans:c.array(c.object({scopeItemId:c.string().describe("the scope item ID"),description:c.string().describe("what the orphan item is")})).optional().describe("in-scope items with no goal connection")}),hp=c.object({duplicateGroups:c.array(c.object({keepId:c.string().describe("the scope item ID to keep"),removeIds:c.array(c.string()).describe("scope item IDs that are semantically duplicate of keepId")})).describe("groups of semantically duplicate scope items \u2014 only flag items you are CERTAIN describe the same thing with different wording")}),gp=c.object({responseInterpretation:c.string().describe("what the respondent meant, resolving any suggestion references"),inScope:c.array(c.object({description:c.string().describe("what is in scope"),relatedGoals:c.array(c.string()).optional().describe("goal IDs this supports")})).optional().describe("new or updated in-scope items, empty if none"),outOfScope:c.array(c.object({description:c.string().describe("what is excluded"),reason:c.string().optional().describe("why it's excluded"),relatedGoals:c.array(c.string()).optional().describe("goal IDs this relates to")})).optional().describe("new or updated out-of-scope items, empty if none"),removedIds:c.array(c.string()).optional().describe("scope item IDs to remove, empty if none"),reclassifiedItems:c.array(c.object({id:c.string().describe("scope item ID to reclassify"),newClassification:c.enum(["in","out"]).describe("new classification")})).optional().describe("existing scope items to move between in-scope and out-of-scope, empty if none"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that sound like assumptions, empty if none")});function yp(s,e){let t="abcdefghijklmnopqrstuvwxyz",r=s.inScope.length,i=r+s.outOfScope.length;if(i+e.length===0)return{id:"scope-seed-present",message:`I haven't identified specific **scope boundaries** from our conversation yet.
433
+
434
+ What are the main things your project will definitely include or exclude?`};let a=s.inScope.length>0?`**In scope:**
435
+ ${s.inScope.map((p,d)=>`${t[0+d]}) ${p.description}`).join(`
436
+ `)}
437
+
438
+ `:"",l=s.outOfScope.length>0?`**Out of scope:**
439
+ ${s.outOfScope.map((p,d)=>{let f=p.reason?` \u2014 ${p.reason}`:"";return`${t[r+d]}) ${p.description}${f}`}).join(`
440
+ `)}
441
+
442
+ `:"",u=e.length>0?`**Unclear (we'll sort these out):**
443
+ ${e.map((p,d)=>`${t[i+d]}) ${p}`).join(`
444
+ `)}
445
+
446
+ `:"";return{id:"scope-seed-present",message:`
447
+ Based on our conversation, here's what I see for your project scope:
448
+ ${a}${l}${u}
449
+ Does this look right? You can confirm, add items, remove items, or reclassify.
450
+ `}}function bp(s){return J({id:"",fallback:"Are there any constraints your project must work within? Think about technical limits, budget, timeline, or regulations.",message:`
451
+ Compose a question about project constraints \u2014 non-negotiable realities the project must work within.
452
+ Ask about technical, budget, timeline, regulatory, or organizational constraints.
453
+ Include 2-3 suggested constraints relevant to the project domain.
454
+
455
+ Context:
456
+ ${E(s)}
457
+ `})}function wp(s,e){return J({id:"",fallback:`Is "${s}" in scope or out of scope for this project?`,message:`
458
+ Compose a contrast question about: "${s}"
459
+ Ask whether this item is in scope or out of scope for the project.
460
+ Frame it as a clear choice. Include 2-3 suggested answers that clarify the boundary.
461
+
462
+ Context:
463
+ ${E(e)}
464
+ `})}function vp(){return{id:"scope-nudge",message:`
465
+ We haven't defined any scope boundaries yet.
466
+ Could you tell me at least one thing that's definitely part of this project, or one thing that's explicitly NOT part of it?`}}function Sp(s){let e=s.goals.map(n=>`[${n.id}] "${n.title}" (${n.status})`).join("; "),t=[...s.inScope.map(n=>`IN [${n.id}]: "${n.description}" (goals: ${n.relatedGoals.join(", ")||"none"})`),...s.outOfScope.map(n=>`OUT [${n.id}]: "${n.description}" (goals: ${n.relatedGoals.join(", ")||"none"})`),...s.constraints.map(n=>`CONSTRAINT [${n.id}]: "${n.description}"`)].join("; ");return W({id:"scope-contradiction-check",message:`
467
+ Check for contradictions between scope decisions and goals.
468
+
469
+ Goals: ${e}
470
+ Scope: ${t}
471
+
472
+ Find:
473
+ 1. Out-of-scope items needed by a confirmed/elaborated goal \u2192 contradiction
474
+ 2. Constraints that make a goal infeasible \u2192 contradiction
475
+ 3. In-scope items with no connection to any goal \u2192 orphan (not contradiction, just a note)
476
+ `,schema:mp})}function Oa(s,e){let t=[...s.inScope.map(n=>`IN [${n.id}]: "${n.description}"`),...s.outOfScope.map(n=>`OUT [${n.id}]: "${n.description}"`)].join("; ");return W({id:e?`scope-dedup-${e}`:"scope-dedup",schema:hp,message:`
477
+ Identify semantically duplicate scope items \u2014 items that describe the same concept with different wording.
478
+
479
+ Scope items: ${t}
480
+
481
+ Rules:
482
+ 1. Only group items you are CERTAIN are duplicates (same concept, different words). Related but distinct items are NOT duplicates.
483
+ 2. For each group, pick the clearest/most specific description as keepId.
484
+ 3. Items in different classifications (IN vs OUT) are never duplicates \u2014 they represent a conflict, not a duplicate.
485
+ 4. Return an empty array if there are no duplicates.
486
+ `})}function kp(s,e){let t=s.inScope.length>0?`**In scope:**
487
+ ${s.inScope.map(a=>{let l=a.relatedGoals.length>0?` (supports: ${a.relatedGoals.join(", ")})`:"";return`- ${a.description}${l}`}).join(`
488
+ `)}
489
+
490
+ `:"",n=s.outOfScope.length>0?`**Out of scope:**
491
+ ${s.outOfScope.map(a=>{let l=a.reason?` \u2014 ${a.reason}`:"";return`- ${a.description}${l}`}).join(`
492
+ `)}
493
+
494
+ `:"",r=s.constraints.length>0?`**Constraints:**
495
+ ${s.constraints.map(a=>`- ${a.description}`).join(`
496
+ `)}
497
+
498
+ `:"",i=e.filter(a=>a.phase==="scope"),o=i.length>0?`**Notes:**
499
+ ${i.map(a=>`- ${a.content}`).join(`
500
+ `)}
501
+
502
+ `:"";return{id:"scope-confirmation",message:`
503
+ Here's what I've captured for your project scope:
504
+ ${t}${n}${r}${o}
505
+ ${ce()}`}}async function Ta(s,e){let t=e.data,n=new Set(t.waitingRoom.map(b=>b.id)),r=await s.seed({id:"scope-seed-extraction",artifactsContext:E(t,{includeWaitingRoom:!0}),schema:Ca,guidance:"Extract scope candidates. Classify each as clearly in-scope, out-of-scope, or ambiguous. Link to goal IDs. Pull hints from the waitingRoom items in the context; return drainedWaitingRoomIds for the items you consumed."}),i=r.ambiguous??[],o=s.currentSource;e.addInScopeItems(r.inScope??[],void 0,o),e.addOutOfScopeItems(r.outOfScope??[],void 0,o);let a=new Set((r.drainedWaitingRoomIds??[]).filter(b=>n.has(b)));e.drainWaitingRoom(a);let l=i.map(b=>b.description),p=[...t.inScope,...t.outOfScope].map(b=>`${b.id}: "${b.description}"`).join(", "),d=await s.promptReview(yp(t,l),"scope-seed-classification",p,E(t),lp,{defaults:{responseInterpretation:"",confirmedInScope:[],confirmedOutOfScope:[],removedIds:[],newItems:[],waitingRoomItems:[]}}),f=new Set(d.removedIds??[]);f.size>0&&e.removeScopeItems(f);let y=s.currentSource;for(let b of d.newItems??[])b.classification==="out"?e.addOutOfScopeItems([b],void 0,y):e.addInScopeItems([b],void 0,y);e.addWaitingRoomItems(d.waitingRoomItems??[]);let g=await s.composePromptExtract("scope-constraint",()=>bp(t),{artifactsContext:E(t),schema:up,guidance:"Constraints are non-negotiable external realities (technical limits, budget, timeline, regulations)."},{park:b=>e.addWaitingRoomItems(b),maxRetries:2,defaults:{responseInterpretation:"",constraints:[],waitingRoomItems:[]}});e.addConstraints(g.constraints??[],s.currentSource),e.addWaitingRoomItems(g.waitingRoomItems??[]);let m;if(i.length>3){let b=await s.infer(pp(i,t)),S=new Set(i.map((k,M)=>String(M))),_=b.rankedAmbiguousIds.filter(k=>S.has(k)),C=_.length>=3?_.slice(0,3):i.slice(0,3).map((k,M)=>String(M)),O=new Set(C);m=C.map(k=>i[Number(k)]);let L=new Map(b.autoClassifications.map(k=>[k.index,k]));for(let k=0;k<i.length;k++){if(O.has(String(k)))continue;let M=L.get(String(k)),re=i[k];M?.classification==="out"?e.addOutOfScopeItems([{description:re.description,reason:M.reason,relatedGoals:M.relatedGoals}],void 0,o):e.addInScopeItems([{description:re.description,relatedGoals:M?.relatedGoals??re.relatedGoals}],void 0,o)}}else m=i;for(let b=0;b<m.length;b++){let S=m[b],_=await s.composePromptExtract(`scope-contrast-${b}`,()=>wp(S.description,t),{artifactsContext:E(t),schema:dp,focus:`"${S.description}"`},{defaults:{responseInterpretation:"",classification:"deferred",reason:"",relatedGoals:[],waitingRoomItems:[]}}),C=s.currentSource,O=_.responseInterpretation||S.description;_.classification==="in"?e.addInScopeItems([{description:O,relatedGoals:_.relatedGoals}],void 0,C):_.classification==="out"?e.addOutOfScopeItems([{description:O,reason:_.reason,relatedGoals:_.relatedGoals}],void 0,C):e.addWaitingRoomItems([{content:S.description}]),e.addWaitingRoomItems(_.waitingRoomItems??[])}if(t.goals.length>0&&(t.inScope.length>0||t.outOfScope.length>0)){let b=await s.infer(Sp(t));if(b.contradictions&&b.contradictions.length>0){let S=b.contradictions.map(_=>_.description);await s.promptReextract("scope-contradiction-clarification",S,E(t),c.object({}),{defaults:{}})}if(b.orphans&&b.orphans.length>0)for(let S of b.orphans)e.addFinding(`In-scope item "${S.description}" has no connection to any stated goal`,"scope")}if(t.inScope.length===0&&t.outOfScope.length===0){let b=await s.promptExtract(vp(),{artifactsContext:E(t),schema:Ca},{defaults:{inScope:[],outOfScope:[],ambiguous:[],drainedWaitingRoomIds:[]}}),S=s.currentSource;e.addInScopeItems(b.inScope??[],void 0,S),e.addOutOfScopeItems(b.outOfScope??[],void 0,S),t.inScope.length===0&&t.outOfScope.length===0&&e.addFinding("No scope boundaries defined \u2014 downstream requirements may lack focus","scope")}if(t.inScope.length+t.outOfScope.length>=2){let b=await s.infer(Oa(t));for(let S of b.duplicateGroups){let _=S.removeIds.filter(C=>t.inScope.some(O=>O.id===C)||t.outOfScope.some(O=>O.id===C));_.length>0&&e.removeScopeItems(new Set(_))}}let{response:h,approved:v}=await ee(s,kp(t,t.findings),t,"scope",0);if(!v){let b=await s.extract({id:"scope-revision",response:h,artifactsContext:E(t),schema:gp});for(let C of b.reclassifiedItems??[]){let O=t.inScope.find(L=>L.id===C.id)??t.outOfScope.find(L=>L.id===C.id);O&&(e.removeScopeItems(new Set([C.id])),C.newClassification==="in"?e.addInScopeItems([{description:O.description,relatedGoals:O.relatedGoals}],void 0,O.source):e.addOutOfScopeItems([{description:O.description,relatedGoals:O.relatedGoals}],void 0,O.source))}let S=s.currentSource;e.addInScopeItems(b.inScope??[],void 0,S),e.addOutOfScopeItems(b.outOfScope??[],void 0,S);let _=new Set(b.removedIds??[]);if(_.size>0&&e.removeScopeItems(_),e.addWaitingRoomItems(b.waitingRoomItems??[]),t.inScope.length+t.outOfScope.length>=2){let C=await s.infer(Oa(t,"post-revision"));for(let O of C.duplicateGroups??[]){let L=O.removeIds.filter(k=>t.inScope.some(M=>M.id===k)||t.outOfScope.some(M=>M.id===k));L.length>0&&e.removeScopeItems(new Set(L))}}}e.confirmScope()}var ln=c.object({statement:c.string().describe("the assumption text"),type:tn.optional().describe("'hypothesis' (testable) or 'invariant' (taken as given)"),relatedGoals:c.array(c.string()).optional().describe("goal IDs this assumption supports")}),xp=c.object({assumptions:c.array(ln).optional().describe("implicit assumptions from the conversation, empty if none"),drainedWaitingRoomIds:c.array(c.string()).optional().describe('IDs of waiting room items used as assumption sources (e.g. ["waiting_001"]), empty if none')}),_p=c.object({responseInterpretation:c.string().describe("what the respondent meant"),confirmedIds:c.array(c.string()).optional().describe("assumption IDs the user confirmed (or all if confirmed), empty if none"),removedIds:c.array(c.string()).optional().describe("assumption IDs to remove, empty if none"),newAssumptions:c.array(ln).optional().describe("new assumptions mentioned, empty if none"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that aren't assumptions, empty if none")}),Ip=c.object({responseInterpretation:c.string().describe("what the respondent meant, resolving any suggestion references"),assumptions:c.array(ln).optional().describe("assumptions extracted from the response, empty if none"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that aren't assumptions, empty if none")}),Ap=c.object({responseInterpretation:c.string().describe("what the respondent meant, resolving any suggestion references"),verdict:c.enum(["validated","flagged","unsure"]).optional().describe("whether the user confirmed, denied, or is uncertain about this assumption"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that aren't about this assumption, empty if none")}),Cp=c.object({responseInterpretation:c.string().describe("what the respondent meant"),impact:c.string().optional().describe("summary of what would change if the assumption weren't true"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("unrelated items, empty if none")}),Op=c.object({responseInterpretation:c.string().describe("what the respondent meant, resolving any suggestion references"),newAssumptions:c.array(ln).optional().describe("new assumptions to add, empty if none"),removedIds:c.array(c.string()).optional().describe("assumption IDs to remove, empty if none"),waitingRoomItems:c.array(c.object({content:c.string().describe("the item text")})).optional().describe("items that aren't assumptions, empty if none")});function Tp(s){if(s.length===0)return{id:"assumption-seed-present",message:`
506
+ I haven't identified any implicit assumptions from our conversation yet.
507
+ Are there things you're taking for granted about this project \u2014 beliefs about your users, technical feasibility, or the environment that haven't been verified?`};let e="abcdefghijklmnopqrstuvwxyz";return{id:"assumption-seed-present",message:`Based on our conversation, I've identified these implicit assumptions:
508
+ ${s.map((n,r)=>{let i=n.type==="invariant"?"invariant":"hypothesis";return`${e[r]}) ${n.statement} _(${i})_`}).join(`
509
+ `)}
510
+
511
+ Does this look right? You can confirm, add, remove, or rephrase.`}}function Ep(s){return J({id:"",fallback:"What needs to be true for your project goals to work? Think about users, technology, market, or resources you're counting on.",message:`
512
+ No assumptions were identified from the conversation. Compose a question using the SAST technique.
513
+ Ask: "What needs to be true for your project goals to work?"
514
+ Frame it around the specific goals and scope already captured.
515
+ Include 2-3 suggested assumptions relevant to the project domain.
516
+
517
+ Context:
518
+ ${E(s)}
519
+ `})}function $p(s,e){return J({id:"",fallback:"How confident are you that this assumption holds?",message:`
520
+ Compose a validation question for assumption: "${s.statement}" (${s.type}).
521
+ Ask whether the respondent believes this is true, and how confident they are.
522
+ Include 2-3 suggested answers: one confirming, one expressing uncertainty, one challenging.
523
+
524
+ Context:
525
+ ${E(e)}
526
+ `})}function Np(s,e){return J({id:"",fallback:"What would change about your project if this assumption turned out to be wrong?",message:`
527
+ The respondent is unsure about assumption: "${s.statement}".
528
+ Compose a probe question: "What would change if this weren't true?"
529
+ Frame it around the specific goals and scope this assumption relates to.
530
+ Include 2-3 suggested impacts.
531
+
532
+ Context:
533
+ ${E(e)}
534
+ `})}function Rp(s,e){let t=s.length===0?`No assumptions were identified for this project.
535
+ `:s.map(i=>{let o=i.type==="invariant"?"invariant":"hypothesis",a=i.relatedGoals.length>0?` (supports: ${i.relatedGoals.join(", ")})`:"",l=i.status==="validated"?"validated":i.status==="flagged"?"FLAGGED":"unvalidated";return`- ${i.statement} _(${o}, ${l})_${a}`}).join(`
536
+ `),n=e.filter(i=>i.phase==="assumptions"),r=n.length>0?`
537
+
538
+ **Notes:**
539
+ ${n.map(i=>`- ${i.content}`).join(`
540
+ `)}`:"";return{id:"assumptions-confirmation",message:`
541
+ Here's what I've captured for your project assumptions:
542
+ ${t}${r}
543
+ ${ce()}
544
+ `}}async function Ea(s,e){let t=e.data,n=new Set(t.waitingRoom.map(d=>d.id)),r=await s.seed({id:"assumption-seed-extraction",artifactsContext:E(t,{includeWaitingRoom:!0}),schema:xp,guidance:`Identify implicit assumptions \u2014 things that must be true but haven't been verified.
545
+ Classify each as "hypothesis" (testable belief) or "invariant" (unverified external reality). Link to goal IDs. Pull hints from the waitingRoom items in the context; return drainedWaitingRoomIds for the items you consumed.`});e.addAssumptions(r.assumptions??[],void 0,void 0,s.currentSource);let i=new Set((r.drainedWaitingRoomIds??[]).filter(d=>n.has(d)));e.drainWaitingRoom(i);let o=t.assumptions.map(d=>`${d.id}: "${d.statement}"`).join(", "),a=await s.promptReview(Tp(t.assumptions),"assumption-seed-classification",o,E(t),_p,{defaults:{responseInterpretation:"",confirmedIds:[],removedIds:[],newAssumptions:[],waitingRoomItems:[]}}),l=new Set(a.removedIds??[]);if(l.size>0&&e.removeAssumptions(l),e.addAssumptions(a.newAssumptions??[],void 0,void 0,s.currentSource),e.addWaitingRoomItems(a.waitingRoomItems??[]),t.assumptions.length===0){let d=await s.composePromptExtract("assumption-gap-fill",()=>Ep(t),{artifactsContext:E(t),schema:Ip},{park:f=>e.addWaitingRoomItems(f),maxRetries:2,defaults:{responseInterpretation:"",assumptions:[],waitingRoomItems:[]}});e.addAssumptions(d.assumptions??[],void 0,void 0,s.currentSource),e.addWaitingRoomItems(d.waitingRoomItems??[])}for(let d of t.assumptions){if(d.status!=="unvalidated")continue;let f=await s.composePromptExtract(`assumption-validation-${d.id}`,()=>$p(d,t),{artifactsContext:E(t),schema:Ap,focus:`"${d.statement}" (${d.type})`},{defaults:{responseInterpretation:"",verdict:"flagged",waitingRoomItems:[]}});if(e.addWaitingRoomItems(f.waitingRoomItems??[]),f.verdict==="validated")e.setAssumptionStatus(d.id,"validated");else if(f.verdict==="flagged")e.setAssumptionStatus(d.id,"flagged");else{let y=await s.composePromptExtract(`assumption-probe-${d.id}`,()=>Np(d,t),{artifactsContext:E(t),schema:Cp,focus:`"${d.statement}"`},{defaults:{responseInterpretation:"",impact:"",waitingRoomItems:[]}});e.addWaitingRoomItems(y.waitingRoomItems??[]),e.setAssumptionStatus(d.id,"flagged")}}for(let d of t.assumptions){if(d.status!=="flagged")continue;let f=d.relatedGoals.length>0?` \u2014 goals ${d.relatedGoals.join(", ")} carry unverified dependency risk`:"";e.addFinding(`Assumption "${d.statement}" could not be validated${f}`,"assumptions")}let{response:u,approved:p}=await ee(s,Rp(t.assumptions,t.findings),t,"assumptions",0);if(!p){let d=await s.extract({id:"assumptions-revision",response:u,artifactsContext:E(t),schema:Op});e.addAssumptions(d.newAssumptions??[],.9,"validated",s.currentSource);let f=new Set(d.removedIds??[]);f.size>0&&e.removeAssumptions(f),e.addWaitingRoomItems(d.waitingRoomItems??[])}}var Pp=c.object({routed:c.array(c.object({id:c.string().describe("waiting room item ID"),target:c.enum(["assumption","finding","residual"]).describe("where to route this item"),content:c.string().describe("the item content (may be rephrased for the target format)"),reason:c.string().describe("why this item belongs in the target category, or why it is residual")})).describe("classification for each remaining waiting room item")});function jp(s){return W({id:"validation-wr-classify",message:`
546
+ Classify each remaining waiting room item into the most appropriate artifact category.
547
+ For each item, choose one target:
548
+ - "assumption": an implicit belief that must be true for the project to succeed (testable or invariant)
549
+ - "finding": a gap, risk, or quality observation worth flagging
550
+ - "residual": content already absorbed into existing artifacts, too vague to classify, or genuinely not actionable
551
+
552
+ Waiting room items:
553
+ ${s.waitingRoom.map(e=>`- ${e.id}: "${e.content}"`).join(`
554
+ `)}
555
+
556
+ Current artifacts (for context \u2014 avoid duplicating what's already captured):
557
+ ${E(s)}
558
+ `,schema:Pp})}var qp=c.object({contradictions:c.array(c.object({description:c.string()})).optional().describe("cross-artifact contradictions found, empty if none")});function Lp(s){return W({id:"validation-consistency-check",message:`
559
+ Review all captured artifacts for cross-artifact contradictions.
560
+ Look for issues that no single phase could detect:
561
+ - Goal references a stakeholder that doesn't exist
562
+ - Scope item contradicts a stated goal
563
+ - Assumption references a goal that was removed
564
+ - Constraint makes a goal infeasible but wasn't flagged
565
+ - In-scope item has no supporting goal
566
+
567
+ Only report genuine cross-artifact contradictions.
568
+ Do NOT repeat issues already captured as findings.
569
+
570
+ Current artifacts:
571
+ ${E(s)}
572
+
573
+ Existing findings (do not duplicate):
574
+ ${s.findings.length>0?s.findings.map(e=>`- [${e.phase}] ${e.content}`).join(`
575
+ `):"(none)"}
576
+ `,schema:qp})}function Dp(s){let e=s.data;return{id:"validation-summary-present",message:["Here's a complete summary of everything we've captured:",fe("**Purpose**",[e.purpose?`- ${e.purpose.statement}`:"",e.advantage?`- Advantage: ${e.advantage.statement}`:"",e.measurement?`- Measurement: ${e.measurement.statement}`:""]),fe("**Goals**",e.goals.map(n=>`- ${n.title} _(${n.status})_${n.rationale?` \u2014 ${n.rationale}`:""}`)),fe("**Stakeholders**",e.stakeholders.map(n=>`- ${n.name} _(${n.type}, ${n.status})_${n.isRespondent?" (you)":""}${n.role?` \u2014 ${n.role}`:""}`)),fe("**Scope**",[...e.inScope.map(n=>`- IN: ${n.description}`),...e.outOfScope.map(n=>`- OUT: ${n.description}${n.reason?` \u2014 ${n.reason}`:""}`)]),fe("**Constraints**",e.constraints.map(n=>`- ${n.description}`)),fe("**Assumptions**",e.assumptions.map(n=>`- ${n.statement} _(${n.type}, ${n.status})_`)),fe("**Findings**",e.findings.map(n=>`- [${n.phase}] ${n.content}`)),fe("**Residual**",e.residual.map(n=>`- ${n.content} _(${n.reason})_`)),fe("**Gaps**",[!e.purpose||e.purpose.confidence<.5?"- No purpose defined":"",e.goals.some(n=>n.status!=="fuzzy")?"":"- No non-fuzzy goal",e.stakeholders.some(n=>n.type==="primary")?"":"- No primary stakeholder",e.inScope.length===0&&e.outOfScope.length===0?"- No scope boundary defined":""]),fe("**Notes**",[e.advantage?"":"- No advantage articulated",e.measurement?"":"- No measurement defined",e.assumptions.length===0?"- No assumptions captured":"",e.findings.length>0?`- ${e.findings.length} unresolved finding(s)`:""]),"What would you change or add? If everything looks right, let me know and we'll wrap up."].filter(Boolean).join(`
577
+
578
+ `)}}async function $a(s,e){if(e.data.waitingRoom.length>0){let{routed:i=[]}=await s.infer(jp(e.data));for(let o of i)o.target==="assumption"?e.addAssumptions([{statement:o.content,type:"hypothesis"}],void 0,void 0):o.target==="finding"?e.addFinding(o.content,"validation"):e.addResidualItems([{content:o.content,reason:o.reason}]);e.drainAllWaitingRoom()}let{contradictions:t=[]}=await s.infer(Lp(e.data));for(let{description:i}of t)e.addFinding(i,"validation");let{approved:n,revisionRequested:r}=await ee(s,Dp(e),e.data,"validation",0);!n&&r&&e.setUserConcern(r)}var V=yt(require("node:fs"),1),or=yt(require("node:path"),1),js=yt(wu(),1),fb=".elaborate",pb="session.yaml",mb="session.yaml.tmp",hb=new Set(["running","suspended","completed","failed"]);function zt(s){return or.join(s,fb)}function ht(s){return or.join(zt(s),pb)}function gb(s){let e=zt(s);V.existsSync(e)||V.mkdirSync(e,{recursive:!0})}function vu(s){return or.join(zt(s),mb)}function yb(s){let e=vu(s);if(V.existsSync(e))try{let t=(0,js.parse)(V.readFileSync(e,"utf-8"));Su(t,e),V.renameSync(e,ht(s))}catch{V.unlinkSync(e)}}function Su(s,e){if(s==null||typeof s!="object")throw new Error(`Corrupted session file (not an object): ${e}`);let t=s;if(typeof t.sessionId!="string")throw new Error(`Corrupted session file (missing sessionId): ${e}`);if(t.workflow!=null){if(typeof t.workflow!="object")throw new Error(`Corrupted session file (workflow not an object): ${e}`);let n=t.workflow;if(typeof n.status!="string"||!hb.has(n.status))throw new Error(`Corrupted session file (invalid workflow status): ${e}`);if(!Array.isArray(n.entries))throw new Error(`Corrupted session file (entries not an array): ${e}`);for(let r=0;r<n.entries.length;r++){let i=n.entries[r];if(typeof i?.id!="string")throw new Error(`Corrupted session file (entry ${r} missing id): ${e}`);if(!("value"in i)&&i.suspended!==!0)throw new Error(`Corrupted session file (entry ${r} missing value or suspended): ${e}`)}}return s}var Ve=class extends Error{file;constructor(e,t){let n=t instanceof Error?t.message:String(t);super(`Corrupted session file: ${e} \u2014 ${n}`),this.name="CorruptedSessionError",this.file=e}};function Se(s){yb(s);let e=ht(s);if(!V.existsSync(e))return null;try{return Su((0,js.parse)(V.readFileSync(e,"utf-8")),e)}catch(t){throw new Ve(e,t)}}function qs(s,e){gb(s),e.lastModified=new Date().toISOString();let t=vu(s);V.writeFileSync(t,(0,js.stringify)(e)),V.renameSync(t,ht(s))}function ku(){let s=new Date().toISOString().slice(0,10),e=Math.random().toString(36).slice(2,8);return`sess_${s}_${e}`}function ar(s){return V.existsSync(ht(s))}function cr(s){return{load(){return Se(s)?.workflow??null},save(e){let t=Se(s);t?(t.workflow=e,qs(s,t)):qs(s,{sessionId:ku(),createdAt:new Date().toISOString(),lastModified:new Date().toISOString(),workflow:e})},initialize(){this.save({status:"running",entries:[]})},setStatus(e){let t=this.load();t&&(t.status=e,this.save(t))},suspendedId(){let e=this.load();if(!e)return null;let t=e.entries[e.entries.length-1];return t&&"suspended"in t?t.id:null},phase(){let e=this.load();if(!e)return null;if(e.status==="completed")return"complete";let t=e.entries[e.entries.length-1];return!t||!("suspended"in t)?null:t.id.split(/[:\-]/)[0]||null},hasSession(){return ar(s)},sessionId(){return Se(s)?.sessionId??null},status(){return this.load()?.status??null},setUserConcern(e){let t=Se(s);t&&(t.userConcern=e,qs(s,t))},userConcern(){return Se(s)?.userConcern},setTitle(e){let t=Se(s);t&&(t.title=e,qs(s,t))},title(){return Se(s)?.title}}}var lo=yt(require("node:fs"),1),uo=yt(require("node:path"),1);var xu=80;function _u(s){let e=s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return e.length<=xu?e:e.slice(0,xu).replace(/-$/,"")}function lr(s){if(!ar(s))return null;let t=`session.yaml.corrupt.${new Date().toISOString().replace(/[:.]/g,"-")}`;return lo.renameSync(ht(s),uo.join(zt(s),t)),t}function Ls(s){let e=Se(s);if(!e)return null;let t=e.title?_u(e.title):"",n=t?`${t}_${e.sessionId}.yaml`:`${e.sessionId}.yaml`;return lo.renameSync(ht(s),uo.join(zt(s),n)),n}var Ye=6;function ur(s){return async e=>{e.setProgress(1,Ye,"Opening");let t=await ba(e,s);e.setProgress(2,Ye,"Purpose"),e.setTransition("Let's dig into the purpose behind this idea."),await ka(e,s,t),e.setProgress(3,Ye,"Goals"),e.setTransition("Good \u2014 now let's break that purpose down into concrete goals."),await _a(e,s),e.setProgress(4,Ye,"Stakeholders"),e.setTransition("Now let's talk about who's involved \u2014 the people affected by or contributing to this project."),await Aa(e,s),e.setProgress(5,Ye,"Scope"),e.setTransition("We're past the halfway point. Let's define what's in scope and what's not."),await Ta(e,s),!1,e.setProgress(Ye,Ye,"Validation"),e.setTransition("Last step \u2014 let's review everything together."),await $a(e,s)}}var Kt=require("node:fs"),Ds=require("node:path"),fo={info(){},error(){}};function bb(s){if(!s)return{};let e={};for(let[t,n]of Object.entries(s))e[t]=typeof n=="function"?n():n;return e}function Au(s,e,t){let n=(0,Ds.join)(s,".log");if(!(0,Kt.existsSync)(n))return fo;let r=(0,Ds.join)(e,".elaborate","log.jsonl");(0,Kt.mkdirSync)((0,Ds.dirname)(r),{recursive:!0});function i(o,a,l){let u={v:1,ts:new Date().toISOString(),level:o,...bb(t),...a};l!==void 0&&(u.msg=l),(0,Kt.appendFileSync)(r,JSON.stringify(u)+`
579
+ `)}return{info(o,a){i("info",o,a)},error(o,a){i("error",o,a)}}}var Cb={};function Eu(s,e){let t=s.find(r=>r.startsWith(`${e}=`));if(t)return t.slice(e.length+1);let n=s.indexOf(e);if(n!==-1&&n+1<s.length)return s[n+1]}var Ne=fo;function Ut(s){console.log(JSON.stringify(s))}function $e(s){Ne.error({event:"error"},s),Ut({error:s}),process.exit(1)}function po(s){return async e=>{if(s&&e.id===s.id)return s.value;throw new ke(e.id,e)}}function wb(s){return s.type==="prompt"?{message:s.request.message,target:"user",schema:{}}:{message:s.request.message,target:"agent",schema:s.request.schema??{}}}var vb={message:"This session is complete.",target:"end",schema:{}};function Cu(s,e){let t=s.data.purpose?.statement;t&&e.setTitle(t)}async function mo(s,e,t,n,r,i){try{let o=await pr(e,t,n);Sb(o.fidelity),r.userConcern&&e.setUserConcern(r.userConcern),Cu(r,e),Ls(s),Ut(vb)}catch(o){if(o instanceof ke){if(!o.value||typeof o.value!="object"||!("type"in o.value))throw new Error(`Suspend at ${o.id} carried non-Prompt value`);let a=o.value;Ne.info({event:"suspend",id:o.id,type:a.type,promptMessage:a.request.message,..."schema"in a.request?{schema:a.request.schema}:{}}),Cu(r,e);let l=wb(a);i?.includeContext&&(l.context=r.summarize()),i?.existingSession&&(l.existingSession=!0),Ut(l);return}throw o}}function Sb(s){if(s.mismatched!==0){for(let e of s.details)Ne.info({event:"fidelity:mismatch",id:e.id,expectedKeys:e.expectedKeys,actualKeys:e.actualKeys,missingKeys:e.missingKeys});Ne.error({event:"fidelity:summary",checked:s.checked,mismatched:s.mismatched},`Extraction fidelity: ${s.mismatched}/${s.checked} extractions had missing keys`)}}function $u(s){let e=s.suspendedId();return e||$e("No pending prompt. Run 'start' first."),e}async function kb(s,e,t){let n=t.includes("--new"),r=!1;try{e.hasSession()&&(e.status()==="completed"||n?Ls(s):r=!0)}catch(l){if(l instanceof Ve&&n){let u=lr(s);Ne.info({event:"recover:archive-corrupted",archived:u})}else throw l}let i=new ct,o=ur(i),a=po();await mo(s,e,o,a,i,r?{includeContext:!0,existingSession:!0}:void 0)}async function xb(s,e,t){let n=Eu(t,"--message");n===void 0&&(process.stdin.isTTY&&$e("Missing message. Provide --message argument or pipe text to stdin."),n=await Nu(),n.trim()||$e("No message received on stdin."));let r=$u(e);Ne.info({event:"resolve",id:r,type:"prompt",message:n});let i=new ct,o=ur(i),a=po({id:r,value:n});await mo(s,e,o,a,i)}async function Nu(){return new Promise((s,e)=>{let t="";process.stdin.setEncoding("utf8"),process.stdin.on("data",n=>t+=n),process.stdin.on("end",()=>s(t)),process.stdin.on("error",e)})}async function _b(s,e,t){let n=Eu(t,"--data");n===void 0&&(process.stdin.isTTY&&$e("Missing data. Provide --data argument or pipe JSON to stdin."),n=await Nu(),n.trim()||$e("No data received on stdin."));let r;try{r=JSON.parse(n)}catch{$e("Invalid JSON in --data argument.")}let i=$u(e);Ne.info({event:"resolve",id:i,type:"infer",data:r});let o=new ct,a=ur(o),l=po({id:i,value:r});await mo(s,e,a,l,o)}function Ib(s){if(!s.hasSession()){Ut({active:!1});return}let e=s.status(),t=s.title();Ut({active:!0,phase:s.phase()??"unknown",sessionId:s.sessionId(),...t?{title:t}:{},...e==="failed"?{status:"failed"}:{}})}async function Ab(){let s=typeof __dirname<"u"?__dirname:(0,dr.dirname)((0,Tu.fileURLToPath)(Cb.url));(0,Ou.existsSync)((0,dr.join)(s,".debug"))&&(await import("node:inspector")).default.open(9229,"127.0.0.1",!0);let e=process.argv.slice(2),t=e[0],n=process.cwd(),r=cr(n);Ne=Au(s,n,{sessionId:()=>r.sessionId()});try{switch(t){case"start":await kb(n,r,e.slice(1));break;case"response":await xb(n,r,e.slice(1));break;case"inference":await _b(n,r,e.slice(1));break;case"status":Ib(r);break;default:$e(`Unknown command: ${t??"(none)"}
580
+
581
+ Usage:
582
+ elaborate start [--new] Create session (--new: archive existing)
583
+ elaborate response --message="..." Process stakeholder message
584
+ elaborate inference --data='{...}' Provide extraction results
585
+ elaborate status Query session state`)}}catch(i){let o=i instanceof Error?i:new Error(String(i));Ne.error({event:"error",class:o.constructor.name},o.message),o instanceof Ve&&$e(`${o.message}
586
+
587
+ Run 'elaborate start --new' to archive the corrupt file and start fresh.`),$t(o)&&(Ut({error:"deviation_exhausted",deviation:o.name,response:o.response}),process.exit(1)),$e(o.message)}}Ab();
588
+
589
+ //# sourceMappingURL=elaborate.cjs.map