comet-dsh-plugin 0.0.0-stage → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +176 -0
- package/README.md +152 -2
- package/client.js +349 -0
- package/cordis.patch.yml +4 -0
- package/icon.png +0 -0
- package/index.js +183 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +57 -4
- package/rules/comet-workflow-guard.md +63 -0
- package/rules/migration-assets.json +218 -0
- package/server/comet-plugin-setup.mjs +192 -0
- package/skills/comet/SKILL.md +37 -0
- package/skills/comet/agents/openai.yaml +3 -0
- package/skills/comet/reference/change-walkthrough.md +77 -0
- package/skills/comet/reference/edit-review.md +26 -0
- package/skills/comet/reference/host-check.md +11 -0
- package/skills/comet/reference/platform-execution.md +34 -0
- package/skills/comet/reference/task-learning.md +39 -0
- package/skills/comet/runtime/classic/checks.yaml +6 -0
- package/skills/comet/runtime/classic/guardrails.yaml +13 -0
- package/skills/comet/runtime/classic/skill.yaml +122 -0
- package/skills/comet/scripts/comet-archive.mjs +310 -0
- package/skills/comet/scripts/comet-check.mjs +179 -0
- package/skills/comet/scripts/comet-entry-runtime.mjs +151 -0
- package/skills/comet/scripts/comet-env.mjs +15 -0
- package/skills/comet/scripts/comet-guard.mjs +335 -0
- package/skills/comet/scripts/comet-handoff.mjs +289 -0
- package/skills/comet/scripts/comet-hook-guard.mjs +294 -0
- package/skills/comet/scripts/comet-hook-router-guard.mjs +628 -0
- package/skills/comet/scripts/comet-hook-router.mjs +17 -0
- package/skills/comet/scripts/comet-intent.mjs +181 -0
- package/skills/comet/scripts/comet-plugin-hook.mjs +213 -0
- package/skills/comet/scripts/comet-resume-probe.mjs +205 -0
- package/skills/comet/scripts/comet-runtime.mjs +571 -0
- package/skills/comet/scripts/comet-state.mjs +381 -0
- package/skills/comet/scripts/comet-yaml-validate.mjs +182 -0
- package/skills/comet-any/SKILL.md +47 -0
- package/skills/comet-any/agents/openai.yaml +5 -0
- package/skills/comet-any/reference/sdk-creation.md +100 -0
- package/skills/comet-archive/SKILL.md +28 -0
- package/skills/comet-archive/agents/openai.yaml +5 -0
- package/skills/comet-archive/reference/compat.md +188 -0
- package/skills/comet-build/SKILL.md +35 -0
- package/skills/comet-build/agents/openai.yaml +5 -0
- package/skills/comet-build/reference/compat.md +191 -0
- package/skills/comet-classic/SKILL.md +98 -0
- package/skills/comet-classic/agents/openai.yaml +3 -0
- package/skills/comet-classic/reference/auto-transition.md +34 -0
- package/skills/comet-classic/reference/classic-layout.md +36 -0
- package/skills/comet-classic/reference/comet-yaml-fields.md +82 -0
- package/skills/comet-classic/reference/context-recovery.md +128 -0
- package/skills/comet-classic/reference/debug-gate.md +30 -0
- package/skills/comet-classic/reference/decision-point.md +109 -0
- package/skills/comet-classic/reference/dirty-worktree.md +59 -0
- package/skills/comet-classic/reference/file-structure.md +32 -0
- package/skills/comet-classic/reference/intent-frame.md +132 -0
- package/skills/comet-classic/reference/scripts.md +144 -0
- package/skills/comet-classic/reference/sdk-methods.md +136 -0
- package/skills/comet-classic/reference/subagent-dispatch.md +75 -0
- package/skills/comet-classic/reference/workspace.md +23 -0
- package/skills/comet-design/SKILL.md +25 -0
- package/skills/comet-design/agents/openai.yaml +5 -0
- package/skills/comet-design/reference/compat.md +191 -0
- package/skills/comet-hotfix/SKILL.md +46 -0
- package/skills/comet-hotfix/agents/openai.yaml +5 -0
- package/skills/comet-hotfix/reference/compat.md +240 -0
- package/skills/comet-memory/SKILL.md +68 -0
- package/skills/comet-memory/agents/openai.yaml +5 -0
- package/skills/comet-native/SKILL.md +139 -0
- package/skills/comet-native/agents/openai.yaml +3 -0
- package/skills/comet-native/reference/artifacts.md +118 -0
- package/skills/comet-native/reference/clarification.md +120 -0
- package/skills/comet-native/reference/commands.md +321 -0
- package/skills/comet-native/reference/edit-review.md +26 -0
- package/skills/comet-native/reference/recovery.md +64 -0
- package/skills/comet-native/reference/workspace.md +70 -0
- package/skills/comet-native/scripts/comet-native-archive.mjs +475 -0
- package/skills/comet-native/scripts/comet-native-cancel.mjs +461 -0
- package/skills/comet-native/scripts/comet-native-doctor.mjs +475 -0
- package/skills/comet-native/scripts/comet-native-hook-guard.mjs +470 -0
- package/skills/comet-native/scripts/comet-native-init.mjs +465 -0
- package/skills/comet-native/scripts/comet-native-new.mjs +478 -0
- package/skills/comet-native/scripts/comet-native-next.mjs +464 -0
- package/skills/comet-native/scripts/comet-native-root.mjs +472 -0
- package/skills/comet-native/scripts/comet-native-runtime.mjs +525 -0
- package/skills/comet-native/scripts/comet-native-select.mjs +468 -0
- package/skills/comet-native/scripts/comet-native-show.mjs +462 -0
- package/skills/comet-native/scripts/comet-native-spec.mjs +468 -0
- package/skills/comet-native/scripts/comet-native-status.mjs +467 -0
- package/skills/comet-native/scripts/comet-native-transfer.mjs +466 -0
- package/skills/comet-open/SKILL.md +265 -0
- package/skills/comet-open/agents/openai.yaml +5 -0
- package/skills/comet-open/reference/batch-changes.md +51 -0
- package/skills/comet-review/SKILL.md +121 -0
- package/skills/comet-review/agents/openai.yaml +5 -0
- package/skills/comet-tweak/SKILL.md +49 -0
- package/skills/comet-tweak/agents/openai.yaml +5 -0
- package/skills/comet-tweak/reference/compat.md +232 -0
- package/skills/comet-verify/SKILL.md +30 -0
- package/skills/comet-verify/agents/openai.yaml +5 -0
- package/skills/comet-verify/reference/compat.md +202 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {createRequire as __cometCreateRequire} from 'node:module'; const require=__cometCreateRequire(import.meta.url);
|
|
2
|
+
var El=Object.create;var zi=Object.defineProperty;var Pl=Object.getOwnPropertyDescriptor;var _l=Object.getOwnPropertyNames;var Al=Object.getPrototypeOf,Il=Object.prototype.hasOwnProperty;var _t=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var b=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}};var Ol=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _l(e))!Il.call(t,i)&&i!==n&&zi(t,i,{get:()=>e[i],enumerable:!(r=Pl(e,i))||r.enumerable});return t};var zn=(t,e,n)=>(n=t!=null?El(Al(t)):{},Ol(e||!t||!t.__esModule?zi(n,"default",{value:t,enumerable:!0}):n,t));var _=b(D=>{"use strict";var Yn=Symbol.for("yaml.alias"),io=Symbol.for("yaml.document"),Tt=Symbol.for("yaml.map"),oo=Symbol.for("yaml.pair"),Vn=Symbol.for("yaml.scalar"),Rt=Symbol.for("yaml.seq"),te=Symbol.for("yaml.node.type"),Dl=t=>!!t&&typeof t=="object"&&t[te]===Yn,Ml=t=>!!t&&typeof t=="object"&&t[te]===io,$l=t=>!!t&&typeof t=="object"&&t[te]===Tt,Fl=t=>!!t&&typeof t=="object"&&t[te]===oo,so=t=>!!t&&typeof t=="object"&&t[te]===Vn,Wl=t=>!!t&&typeof t=="object"&&t[te]===Rt;function ao(t){if(t&&typeof t=="object")switch(t[te]){case Tt:case Rt:return!0}return!1}function Bl(t){if(t&&typeof t=="object")switch(t[te]){case Yn:case Tt:case Vn:case Rt:return!0}return!1}var Hl=t=>(so(t)||ao(t))&&!!t.anchor;D.ALIAS=Yn;D.DOC=io;D.MAP=Tt;D.NODE_TYPE=te;D.PAIR=oo;D.SCALAR=Vn;D.SEQ=Rt;D.hasAnchor=Hl;D.isAlias=Dl;D.isCollection=ao;D.isDocument=Ml;D.isMap=$l;D.isNode=Bl;D.isPair=Fl;D.isScalar=so;D.isSeq=Wl});var Ke=b(Gn=>{"use strict";var L=_(),F=Symbol("break visit"),lo=Symbol("skip children"),G=Symbol("remove node");function Lt(t,e){let n=co(e);L.isDocument(t)?je(null,t.contents,n,Object.freeze([t]))===G&&(t.contents=null):je(null,t,n,Object.freeze([]))}Lt.BREAK=F;Lt.SKIP=lo;Lt.REMOVE=G;function je(t,e,n,r){let i=uo(t,e,n,r);if(L.isNode(i)||L.isPair(i))return fo(t,r,i),je(t,i,n,r);if(typeof i!="symbol"){if(L.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=je(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===F)return F;s===G&&(e.items.splice(o,1),o-=1)}}}else if(L.isPair(e)){r=Object.freeze(r.concat(e));let o=je("key",e.key,n,r);if(o===F)return F;o===G&&(e.key=null);let s=je("value",e.value,n,r);if(s===F)return F;s===G&&(e.value=null)}}return i}async function qt(t,e){let n=co(e);L.isDocument(t)?await xe(null,t.contents,n,Object.freeze([t]))===G&&(t.contents=null):await xe(null,t,n,Object.freeze([]))}qt.BREAK=F;qt.SKIP=lo;qt.REMOVE=G;async function xe(t,e,n,r){let i=await uo(t,e,n,r);if(L.isNode(i)||L.isPair(i))return fo(t,r,i),xe(t,i,n,r);if(typeof i!="symbol"){if(L.isCollection(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=await xe(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===F)return F;s===G&&(e.items.splice(o,1),o-=1)}}}else if(L.isPair(e)){r=Object.freeze(r.concat(e));let o=await xe("key",e.key,n,r);if(o===F)return F;o===G&&(e.key=null);let s=await xe("value",e.value,n,r);if(s===F)return F;s===G&&(e.value=null)}}return i}function co(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function uo(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(L.isMap(e))return n.Map?.(t,e,r);if(L.isSeq(e))return n.Seq?.(t,e,r);if(L.isPair(e))return n.Pair?.(t,e,r);if(L.isScalar(e))return n.Scalar?.(t,e,r);if(L.isAlias(e))return n.Alias?.(t,e,r)}function fo(t,e,n){let r=e[e.length-1];if(L.isCollection(r))r.items[t]=n;else if(L.isPair(r))t==="key"?r.key=n:r.value=n;else if(L.isDocument(r))r.contents=n;else{let i=L.isAlias(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}Gn.visit=Lt;Gn.visitAsync=qt});var Qn=b(po=>{"use strict";var mo=_(),Kl=Ke(),Jl={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},zl=t=>t.replace(/[!,[\]{}]/g,e=>Jl[e]),Je=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,s]=r;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(s){return n(String(s)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+zl(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&mo.isNode(e.contents)){let o={};Kl.visit(e.contents,(s,a)=>{mo.isNode(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of r)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
|
|
3
|
+
`)}};Je.defaultYaml={explicit:!1,version:"1.2"};Je.defaultTags={"!!":"tag:yaml.org,2002:"};po.Directives=Je});var Dt=b(ze=>{"use strict";var ho=_(),Ul=Ke();function Yl(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function go(t){let e=new Set;return Ul.visit(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function wo(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function Vl(t,e){let n=[],r=new Map,i=null;return{onAnchor:o=>{n.push(o),i??(i=go(t));let s=wo(e,i);return i.add(s),s},setAnchors:()=>{for(let o of n){let s=r.get(o);if(typeof s=="object"&&s.anchor&&(ho.isScalar(s.node)||ho.isCollection(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}ze.anchorIsValid=Yl;ze.anchorNames=go;ze.createNodeAnchors=Vl;ze.findNewAnchor=wo});var Xn=b(yo=>{"use strict";function Ue(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let s=r[i],a=Ue(t,r,String(i),s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),s=Ue(t,r,i,o);s===void 0?r.delete(i):s!==o&&r.set(i,s)}else if(r instanceof Set)for(let i of Array.from(r)){let o=Ue(t,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let s=Ue(t,r,i,o);s===void 0?delete r[i]:s!==o&&(r[i]=s)}return t.call(e,n,r)}yo.applyReviver=Ue});var se=b(bo=>{"use strict";var Gl=_();function ko(t,e,n){if(Array.isArray(t))return t.map((r,i)=>ko(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!Gl.hasAnchor(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=o=>{r.res=o,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}bo.toJS=ko});var Mt=b(So=>{"use strict";var Ql=Xn(),vo=_(),Xl=se(),Zn=class{constructor(e){Object.defineProperty(this,vo.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:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){if(!vo.isDocument(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Xl.toJS(this,"",s);if(typeof i=="function")for(let{count:l,res:c}of s.anchors.values())i(c,l);return typeof o=="function"?Ql.applyReviver(o,{"":a},"",a):a}};So.NodeBase=Zn});var Ye=b(Co=>{"use strict";var Zl=Dt(),ec=Ke(),Te=_(),tc=Mt(),nc=se(),er=class extends tc.NodeBase{constructor(e){super(Te.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],ec.visit(e,{Node:(o,s)=>{(Te.isAlias(s)||Te.hasAnchor(s))&&r.push(s)}}),n&&(n.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}return i}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:i,maxAliasCount:o}=n,s=this.resolve(i,n);if(!s){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=r.get(s);if(a||(nc.toJS(s,null,n),a=r.get(s)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=$t(i,s,r)),a.count*a.aliasCount>o)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,n,r){let i=`*${this.source}`;if(e){if(Zl.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function $t(t,e,n){if(Te.isAlias(e)){let r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Te.isCollection(e)){let r=0;for(let i of e.items){let o=$t(t,i,n);o>r&&(r=o)}return r}else if(Te.isPair(e)){let r=$t(t,e.key,n),i=$t(t,e.value,n);return Math.max(r,i)}return 1}Co.Alias=er});var x=b(tr=>{"use strict";var rc=_(),ic=Mt(),oc=se(),sc=t=>!t||typeof t!="function"&&typeof t!="object",ae=class extends ic.NodeBase{constructor(e){super(rc.SCALAR),this.value=e}toJSON(e,n){return n?.keep?this.value:oc.toJS(this.value,e,n)}toString(){return String(this.value)}};ae.BLOCK_FOLDED="BLOCK_FOLDED";ae.BLOCK_LITERAL="BLOCK_LITERAL";ae.PLAIN="PLAIN";ae.QUOTE_DOUBLE="QUOTE_DOUBLE";ae.QUOTE_SINGLE="QUOTE_SINGLE";tr.Scalar=ae;tr.isScalarValue=sc});var Ve=b(Po=>{"use strict";var ac=Ye(),ve=_(),Eo=x(),lc="tag:yaml.org,2002:";function cc(t,e,n){if(e){let r=n.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return n.find(r=>r.identify?.(t)&&!r.format)}function uc(t,e,n){if(ve.isDocument(t)&&(t=t.contents),ve.isNode(t))return t;if(ve.isPair(t)){let f=n.schema[ve.MAP].createNode?.(n.schema,null,n);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:s,sourceObjects:a}=n,l;if(r&&t&&typeof t=="object"){if(l=a.get(t),l)return l.anchor??(l.anchor=i(t)),new ac.Alias(l.anchor);l={anchor:null,node:null},a.set(t,l)}e?.startsWith("!!")&&(e=lc+e.slice(2));let c=cc(t,e,s.tags);if(!c){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new Eo.Scalar(t);return l&&(l.node=f),f}c=t instanceof Map?s[ve.MAP]:Symbol.iterator in Object(t)?s[ve.SEQ]:s[ve.MAP]}o&&(o(c),delete n.onTagObj);let p=c?.createNode?c.createNode(n.schema,t,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,t,n):new Eo.Scalar(t);return e?p.tag=e:c.default||(p.tag=c.tag),l&&(l.node=p),p}Po.createNode=uc});var Wt=b(Ft=>{"use strict";var fc=Ve(),Q=_(),dc=Mt();function nr(t,e,n){let r=n;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=r,r=s}else r=new Map([[o,r]])}return fc.createNode(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var _o=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,rr=class extends dc.NodeBase{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>Q.isNode(r)||Q.isPair(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(_o(e))this.add(n);else{let[r,...i]=e,o=this.get(r,!0);if(Q.isCollection(o))o.addIn(i,n);else if(o===void 0&&this.schema)this.set(r,nr(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(Q.isCollection(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!n&&Q.isScalar(o)?o.value:o:Q.isCollection(o)?o.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!Q.isPair(n))return!1;let r=n.value;return r==null||e&&Q.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let i=this.get(n,!0);return Q.isCollection(i)?i.hasIn(r):!1}setIn(e,n){let[r,...i]=e;if(i.length===0)this.set(r,n);else{let o=this.get(r,!0);if(Q.isCollection(o))o.setIn(i,n);else if(o===void 0&&this.schema)this.set(r,nr(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};Ft.Collection=rr;Ft.collectionFromPath=nr;Ft.isEmptyPath=_o});var Ge=b(Bt=>{"use strict";var mc=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function ir(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var pc=(t,e,n)=>t.endsWith(`
|
|
4
|
+
`)?ir(n,e):n.includes(`
|
|
5
|
+
`)?`
|
|
6
|
+
`+ir(n,e):(t.endsWith(" ")?"":" ")+n;Bt.indentComment=ir;Bt.lineComment=pc;Bt.stringifyComment=mc});var Io=b(Qe=>{"use strict";var hc="flow",or="block",Ht="quoted";function gc(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let l=Math.max(1+o,1+i-e.length);if(t.length<=l)return t;let c=[],p={},f=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?c.push(0):f=i-r);let u,m,g=!1,d=-1,h=-1,w=-1;n===or&&(d=Ao(t,d,e.length),d!==-1&&(f=d+l));for(let v;v=t[d+=1];){if(n===Ht&&v==="\\"){switch(h=d,t[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}w=d}if(v===`
|
|
7
|
+
`)n===or&&(d=Ao(t,d,e.length)),f=d+e.length+l,u=void 0;else{if(v===" "&&m&&m!==" "&&m!==`
|
|
8
|
+
`&&m!==" "){let k=t[d+1];k&&k!==" "&&k!==`
|
|
9
|
+
`&&k!==" "&&(u=d)}if(d>=f)if(u)c.push(u),f=u+l,u=void 0;else if(n===Ht){for(;m===" "||m===" ";)m=v,v=t[d+=1],g=!0;let k=d>w+1?d-2:h-1;if(p[k])return t;c.push(k),p[k]=!0,f=k+l,u=void 0}else g=!0}m=v}if(g&&a&&a(),c.length===0)return t;s&&s();let y=t.slice(0,c[0]);for(let v=0;v<c.length;++v){let k=c[v],C=c[v+1]||t.length;k===0?y=`
|
|
10
|
+
${e}${t.slice(0,C)}`:(n===Ht&&p[k]&&(y+=`${t[k]}\\`),y+=`
|
|
11
|
+
${e}${t.slice(k+1,C)}`)}return y}function Ao(t,e,n){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+n)o=t[++e];else{do o=t[++e];while(o&&o!==`
|
|
12
|
+
`);r=e,i=e+1,o=t[i]}return r}Qe.FOLD_BLOCK=or;Qe.FOLD_FLOW=hc;Qe.FOLD_QUOTED=Ht;Qe.foldFlowLines=gc});var Ze=b(Oo=>{"use strict";var U=x(),le=Io(),Jt=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),zt=t=>/^(%|---|\.\.\.)/m.test(t);function wc(t,e,n){if(!e||e<0)return!1;let r=e-n,i=t.length;if(i<=r)return!1;for(let o=0,s=0;o<i;++o)if(t[o]===`
|
|
13
|
+
`){if(o-s>r)return!0;if(s=o+1,i-s<=r)return!1}return!0}function Xe(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(zt(t)?" ":""),s="",a=0;for(let l=0,c=n[l];c;c=n[++l])if(c===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(s+=n.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(n[l+1]){case"u":{s+=n.slice(a,l);let p=n.substr(l+2,4);switch(p){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:p.substr(0,2)==="00"?s+="\\x"+p.substr(2):s+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(r||n[l+2]==='"'||n.length<i)l+=1;else{for(s+=n.slice(a,l)+`
|
|
14
|
+
|
|
15
|
+
`;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)s+=`
|
|
16
|
+
`,l+=2;s+=o,n[l+2]===" "&&(s+="\\"),l+=1,a=l+1}break;default:l+=1}return s=a?s+n.slice(a):n,r?s:le.foldFlowLines(s,o,le.FOLD_QUOTED,Jt(e,!1))}function sr(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return Xe(t,e);let n=e.indent||(zt(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${n}`)+"'";return e.implicitKey?r:le.foldFlowLines(r,n,le.FOLD_FLOW,Jt(e,!1))}function Re(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=Xe;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=sr:o&&!i?r=Xe:r=n?sr:Xe}return r(t,e)}var ar;try{ar=new RegExp(`(^|(?<!
|
|
19
|
+
))
|
|
20
|
+
+(?!
|
|
21
|
+
|$)`,"g")}catch{ar=/\n+(?!\n|$)/g}function Kt({comment:t,type:e,value:n},r,i,o){let{blockQuote:s,commentString:a,lineWidth:l}=r.options;if(!s||/\n[\t ]+$/.test(n))return Re(n,r);let c=r.indent||(r.forceBlockIndent||zt(n)?" ":""),p=s==="literal"?!0:s==="folded"||e===U.Scalar.BLOCK_FOLDED?!1:e===U.Scalar.BLOCK_LITERAL?!0:!wc(n,l,c.length);if(!n)return p?`|
|
|
22
|
+
`:`>
|
|
23
|
+
`;let f,u;for(u=n.length;u>0;--u){let C=n[u-1];if(C!==`
|
|
24
|
+
`&&C!==" "&&C!==" ")break}let m=n.substring(u),g=m.indexOf(`
|
|
25
|
+
`);g===-1?f="-":n===m||g!==m.length-1?(f="+",o&&o()):f="",m&&(n=n.slice(0,-m.length),m[m.length-1]===`
|
|
26
|
+
`&&(m=m.slice(0,-1)),m=m.replace(ar,`$&${c}`));let d=!1,h,w=-1;for(h=0;h<n.length;++h){let C=n[h];if(C===" ")d=!0;else if(C===`
|
|
27
|
+
`)w=h;else break}let y=n.substring(0,w<h?w+1:h);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${c}`));let k=(d?c?"2":"1":"")+f;if(t&&(k+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!p){let C=n.replace(/\n+/g,`
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),E=!1,O=Jt(r,!0);s!=="folded"&&e!==U.Scalar.BLOCK_FOLDED&&(O.onOverflow=()=>{E=!0});let S=le.foldFlowLines(`${y}${C}${m}`,c,le.FOLD_BLOCK,O);if(!E)return`>${k}
|
|
29
|
+
${c}${S}`}return n=n.replace(/\n+/g,`$&${c}`),`|${k}
|
|
30
|
+
${c}${y}${n}${m}`}function yc(t,e,n,r){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:l,indentStep:c,inFlow:p}=e;if(a&&o.includes(`
|
|
31
|
+
`)||p&&/[[\]{},]/.test(o))return Re(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||p||!o.includes(`
|
|
32
|
+
`)?Re(o,e):Kt(t,e,n,r);if(!a&&!p&&i!==U.Scalar.PLAIN&&o.includes(`
|
|
33
|
+
`))return Kt(t,e,n,r);if(zt(o)){if(l==="")return e.forceBlockIndent=!0,Kt(t,e,n,r);if(a&&l===c)return Re(o,e)}let f=o.replace(/\n+/g,`$&
|
|
34
|
+
${l}`);if(s){let u=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(f),{compat:m,tags:g}=e.doc.schema;if(g.some(u)||m?.some(u))return Re(o,e)}return a?f:le.foldFlowLines(f,l,le.FOLD_FLOW,Jt(e,!1))}function kc(t,e,n,r){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==U.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=U.Scalar.QUOTE_DOUBLE);let l=p=>{switch(p){case U.Scalar.BLOCK_FOLDED:case U.Scalar.BLOCK_LITERAL:return i||o?Re(s.value,e):Kt(s,e,n,r);case U.Scalar.QUOTE_DOUBLE:return Xe(s.value,e);case U.Scalar.QUOTE_SINGLE:return sr(s.value,e);case U.Scalar.PLAIN:return yc(s,e,n,r);default:return null}},c=l(a);if(c===null){let{defaultKeyType:p,defaultStringType:f}=e.options,u=i&&p||f;if(c=l(u),c===null)throw new Error(`Unsupported default string type ${u}`)}return c}Oo.stringifyString=kc});var et=b(lr=>{"use strict";var bc=Dt(),ce=_(),vc=Ge(),Sc=Ze();function Cc(t,e){let n=Object.assign({blockQuote:!0,commentString:vc.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},t.schema.toStringOptions,e),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Ec(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let n,r;if(ce.isScalar(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}n=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,n=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function Pc(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],o=(ce.isScalar(t)||ce.isCollection(t))&&t.anchor;o&&bc.anchorIsValid(o)&&(n.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(r.directives.tagString(s)),i.join(" ")}function _c(t,e,n,r){if(ce.isPair(t))return t.toString(e,n,r);if(ce.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=ce.isNode(t)?t:e.doc.createNode(t,{onTagObj:l=>i=l});i??(i=Ec(e.doc.schema.tags,o));let s=Pc(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,n,r):ce.isScalar(o)?Sc.stringifyString(o,e,n,r):o.toString(e,n,r);return s?ce.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
|
|
35
|
+
${e.indent}${a}`:a}lr.createStringifyContext=Cc;lr.stringify=_c});var To=b(xo=>{"use strict";var ne=_(),No=x(),jo=et(),tt=Ge();function Ac({key:t,value:e},n,r,i){let{allNullValues:o,doc:s,indent:a,indentStep:l,options:{commentString:c,indentSeq:p,simpleKeys:f}}=n,u=ne.isNode(t)&&t.comment||null;if(f){if(u)throw new Error("With simple keys, key nodes cannot have comments");if(ne.isCollection(t)||!ne.isNode(t)&&typeof t=="object"){let O="With simple keys, collection cannot be used as a key value";throw new Error(O)}}let m=!f&&(!t||u&&e==null&&!n.inFlow||ne.isCollection(t)||(ne.isScalar(t)?t.type===No.Scalar.BLOCK_FOLDED||t.type===No.Scalar.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(f||!o),indent:a+l});let g=!1,d=!1,h=jo.stringify(t,n,()=>g=!0,()=>d=!0);if(!m&&!n.inFlow&&h.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(o||e==null)return g&&r&&r(),h===""?"?":m?`? ${h}`:h}else if(o&&!f||e==null&&m)return h=`? ${h}`,u&&!g?h+=tt.lineComment(h,n.indent,c(u)):d&&i&&i(),h;g&&(u=null),m?(u&&(h+=tt.lineComment(h,n.indent,c(u))),h=`? ${h}
|
|
36
|
+
${a}:`):(h=`${h}:`,u&&(h+=tt.lineComment(h,n.indent,c(u))));let w,y,v;ne.isNode(e)?(w=!!e.spaceBefore,y=e.commentBefore,v=e.comment):(w=!1,y=null,v=null,e&&typeof e=="object"&&(e=s.createNode(e))),n.implicitKey=!1,!m&&!u&&ne.isScalar(e)&&(n.indentAtStart=h.length+1),d=!1,!p&&l.length>=2&&!n.inFlow&&!m&&ne.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let k=!1,C=jo.stringify(e,n,()=>k=!0,()=>d=!0),E=" ";if(u||w||y){if(E=w?`
|
|
37
|
+
`:"",y){let O=c(y);E+=`
|
|
38
|
+
${tt.indentComment(O,n.indent)}`}C===""&&!n.inFlow?E===`
|
|
39
|
+
`&&v&&(E=`
|
|
40
|
+
|
|
41
|
+
`):E+=`
|
|
42
|
+
${n.indent}`}else if(!m&&ne.isCollection(e)){let O=C[0],S=C.indexOf(`
|
|
43
|
+
`),T=S!==-1,ie=n.inFlow??e.flow??e.items.length===0;if(T||!ie){let Ne=!1;if(T&&(O==="&"||O==="!")){let R=C.indexOf(" ");O==="&"&&R!==-1&&R<S&&C[R+1]==="!"&&(R=C.indexOf(" ",R+1)),(R===-1||S<R)&&(Ne=!0)}Ne||(E=`
|
|
44
|
+
${n.indent}`)}}else(C===""||C[0]===`
|
|
45
|
+
`)&&(E="");return h+=E+C,n.inFlow?k&&r&&r():v&&!k?h+=tt.lineComment(h,n.indent,c(v)):d&&i&&i(),h}xo.stringifyPair=Ac});var ur=b(cr=>{"use strict";var Ro=_t("process");function Ic(t,...e){t==="debug"&&console.log(...e)}function Oc(t,e){(t==="debug"||t==="warn")&&(typeof Ro.emitWarning=="function"?Ro.emitWarning(e):console.warn(e))}cr.debug=Ic;cr.warn=Oc});var Qt=b(Gt=>{"use strict";var Vt=_(),Lo=x(),Ut="<<",Yt={identify:t=>t===Ut||typeof t=="symbol"&&t.description===Ut,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Lo.Scalar(Symbol(Ut)),{addToJSMap:qo}),stringify:()=>Ut},Nc=(t,e)=>(Yt.identify(e)||Vt.isScalar(e)&&(!e.type||e.type===Lo.Scalar.PLAIN)&&Yt.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Yt.tag&&n.default);function qo(t,e,n){let r=Do(t,n);if(Vt.isSeq(r))for(let i of r.items)fr(t,e,i);else if(Array.isArray(r))for(let i of r)fr(t,e,i);else fr(t,e,r)}function fr(t,e,n){let r=Do(t,n);if(!Vt.isMap(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function Do(t,e){return t&&Vt.isAlias(e)?e.resolve(t.doc,t):e}Gt.addMergeToJSMap=qo;Gt.isMergeKey=Nc;Gt.merge=Yt});var mr=b(Fo=>{"use strict";var jc=ur(),Mo=Qt(),xc=et(),$o=_(),dr=se();function Tc(t,e,{key:n,value:r}){if($o.isNode(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(Mo.isMergeKey(t,n))Mo.addMergeToJSMap(t,e,r);else{let i=dr.toJS(n,"",t);if(e instanceof Map)e.set(i,dr.toJS(r,i,t));else if(e instanceof Set)e.add(i);else{let o=Rc(n,i,t),s=dr.toJS(r,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Rc(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if($o.isNode(t)&&n?.doc){let r=xc.createStringifyContext(n.doc,{});r.anchors=new Set;for(let o of n.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!n.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),jc.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}Fo.addPairToJSMap=Tc});var ue=b(pr=>{"use strict";var Wo=Ve(),Lc=To(),qc=mr(),Xt=_();function Dc(t,e,n){let r=Wo.createNode(t,void 0,n),i=Wo.createNode(e,void 0,n);return new Zt(r,i)}var Zt=class t{constructor(e,n=null){Object.defineProperty(this,Xt.NODE_TYPE,{value:Xt.PAIR}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return Xt.isNode(n)&&(n=n.clone(e)),Xt.isNode(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return qc.addPairToJSMap(n,r,this)}toString(e,n,r){return e?.doc?Lc.stringifyPair(this,e,n,r):JSON.stringify(this)}};pr.Pair=Zt;pr.createPair=Dc});var hr=b(Ho=>{"use strict";var Se=_(),Bo=et(),en=Ge();function Mc(t,e,n){return(e.inFlow??t.flow?Fc:$c)(t,e,n)}function $c({comment:t,items:e},n,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:l,options:{commentString:c}}=n,p=Object.assign({},n,{indent:o,type:null}),f=!1,u=[];for(let g=0;g<e.length;++g){let d=e[g],h=null;if(Se.isNode(d))!f&&d.spaceBefore&&u.push(""),tn(n,u,d.commentBefore,f),d.comment&&(h=d.comment);else if(Se.isPair(d)){let y=Se.isNode(d.key)?d.key:null;y&&(!f&&y.spaceBefore&&u.push(""),tn(n,u,y.commentBefore,f))}f=!1;let w=Bo.stringify(d,p,()=>h=null,()=>f=!0);h&&(w+=en.lineComment(w,o,c(h))),f&&h&&(f=!1),u.push(r+w)}let m;if(u.length===0)m=i.start+i.end;else{m=u[0];for(let g=1;g<u.length;++g){let d=u[g];m+=d?`
|
|
46
|
+
${l}${d}`:`
|
|
47
|
+
`}}return t?(m+=`
|
|
48
|
+
`+en.indentComment(c(t),l),a&&a()):f&&s&&s(),m}function Fc({items:t},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;r+=o;let l=Object.assign({},e,{indent:r,inFlow:!0,type:null}),c=!1,p=0,f=[];for(let g=0;g<t.length;++g){let d=t[g],h=null;if(Se.isNode(d))d.spaceBefore&&f.push(""),tn(e,f,d.commentBefore,!1),d.comment&&(h=d.comment);else if(Se.isPair(d)){let y=Se.isNode(d.key)?d.key:null;y&&(y.spaceBefore&&f.push(""),tn(e,f,y.commentBefore,!1),y.comment&&(c=!0));let v=Se.isNode(d.value)?d.value:null;v?(v.comment&&(h=v.comment),v.commentBefore&&(c=!0)):d.value==null&&y?.comment&&(h=y.comment)}h&&(c=!0);let w=Bo.stringify(d,l,()=>h=null);c||(c=f.length>p||w.includes(`
|
|
49
|
+
`)),g<t.length-1?w+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=f.reduce((y,v)=>y+v.length+2,2)+(w.length+2)>e.options.lineWidth)),c&&(w+=",")),h&&(w+=en.lineComment(w,r,a(h))),f.push(w),p=f.length}let{start:u,end:m}=n;if(f.length===0)return u+m;if(!c){let g=f.reduce((d,h)=>d+h.length+2,2);c=e.options.lineWidth>0&&g>e.options.lineWidth}if(c){let g=u;for(let d of f)g+=d?`
|
|
50
|
+
${o}${i}${d}`:`
|
|
51
|
+
`;return`${g}
|
|
52
|
+
${i}${m}`}else return`${u}${s}${f.join(" ")}${s}${m}`}function tn({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=en.indentComment(e(r),t);n.push(o.trimStart())}}Ho.stringifyCollection=Mc});var de=b(wr=>{"use strict";var Wc=hr(),Bc=mr(),Hc=Wt(),fe=_(),nn=ue(),Kc=x();function nt(t,e){let n=fe.isScalar(e)?e.value:e;for(let r of t)if(fe.isPair(r)&&(r.key===e||r.key===n||fe.isScalar(r.key)&&r.key.value===n))return r}var gr=class extends Hc.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(fe.MAP,e),this.items=[]}static from(e,n,r){let{keepUndefined:i,replacer:o}=r,s=new this(e),a=(l,c)=>{if(typeof o=="function")c=o.call(n,l,c);else if(Array.isArray(o)&&!o.includes(l))return;(c!==void 0||i)&&s.items.push(nn.createPair(l,c,r))};if(n instanceof Map)for(let[l,c]of n)a(l,c);else if(n&&typeof n=="object")for(let l of Object.keys(n))a(l,n[l]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,n){let r;fe.isPair(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new nn.Pair(e,e?.value):r=new nn.Pair(e.key,e.value);let i=nt(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);fe.isScalar(i.value)&&Kc.isScalarValue(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let s=this.items.findIndex(a=>o(r,a)<0);s===-1?this.items.push(r):this.items.splice(s,0,r)}else this.items.push(r)}delete(e){let n=nt(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=nt(this.items,e)?.value;return(!n&&fe.isScalar(i)?i.value:i)??void 0}has(e){return!!nt(this.items,e)}set(e,n){this.add(new nn.Pair(e,n),!0)}toJSON(e,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let o of this.items)Bc.addPairToJSMap(n,i,o);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!fe.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Wc.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};wr.YAMLMap=gr;wr.findPair=nt});var Le=b(Jo=>{"use strict";var Jc=_(),Ko=de(),zc={collection:"map",default:!0,nodeClass:Ko.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Jc.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Ko.YAMLMap.from(t,e,n)};Jo.map=zc});var me=b(zo=>{"use strict";var Uc=Ve(),Yc=hr(),Vc=Wt(),on=_(),Gc=x(),Qc=se(),yr=class extends Vc.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(on.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=rn(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=rn(e);if(typeof r!="number")return;let i=this.items[r];return!n&&on.isScalar(i)?i.value:i}has(e){let n=rn(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=rn(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];on.isScalar(i)&&Gc.isScalarValue(n)?i.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let o of this.items)r.push(Qc.toJS(o,String(i++),n));return r}toString(e,n,r){return e?Yc.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof i=="function"){let l=n instanceof Set?a:String(s++);a=i.call(n,l,a)}o.items.push(Uc.createNode(a,void 0,r))}}return o}};function rn(t){let e=on.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}zo.YAMLSeq=yr});var qe=b(Yo=>{"use strict";var Xc=_(),Uo=me(),Zc={collection:"seq",default:!0,nodeClass:Uo.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Xc.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Uo.YAMLSeq.from(t,e,n)};Yo.seq=Zc});var rt=b(Vo=>{"use strict";var eu=Ze(),tu={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),eu.stringifyString(t,e,n,r)}};Vo.string=tu});var sn=b(Xo=>{"use strict";var Go=x(),Qo={identify:t=>t==null,createNode:()=>new Go.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Go.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Qo.test.test(t)?t:e.options.nullStr};Xo.nullTag=Qo});var kr=b(es=>{"use strict";var nu=x(),Zo={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new nu.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Zo.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};es.boolTag=Zo});var De=b(ts=>{"use strict";function ru({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}ts.stringifyNumber=ru});var vr=b(an=>{"use strict";var iu=x(),br=De(),ou={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:br.stringifyNumber},su={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():br.stringifyNumber(t)}},au={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new iu.Scalar(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:br.stringifyNumber};an.float=au;an.floatExp=su;an.floatNaN=ou});var Cr=b(cn=>{"use strict";var ns=De(),ln=t=>typeof t=="bigint"||Number.isInteger(t),Sr=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function rs(t,e,n){let{value:r}=t;return ln(r)&&r>=0?n+r.toString(e):ns.stringifyNumber(t)}var lu={identify:t=>ln(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>Sr(t,2,8,n),stringify:t=>rs(t,8,"0o")},cu={identify:ln,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>Sr(t,0,10,n),stringify:ns.stringifyNumber},uu={identify:t=>ln(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>Sr(t,2,16,n),stringify:t=>rs(t,16,"0x")};cn.int=cu;cn.intHex=uu;cn.intOct=lu});var os=b(is=>{"use strict";var fu=Le(),du=sn(),mu=qe(),pu=rt(),hu=kr(),Er=vr(),Pr=Cr(),gu=[fu.map,mu.seq,pu.string,du.nullTag,hu.boolTag,Pr.intOct,Pr.int,Pr.intHex,Er.floatNaN,Er.floatExp,Er.float];is.schema=gu});var ls=b(as=>{"use strict";var wu=x(),yu=Le(),ku=qe();function ss(t){return typeof t=="bigint"||Number.isInteger(t)}var un=({value:t})=>JSON.stringify(t),bu=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:un},{identify:t=>t==null,createNode:()=>new wu.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:un},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:un},{identify:ss,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>ss(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:un}],vu={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Su=[yu.map,ku.seq].concat(bu,vu);as.schema=Su});var Ar=b(cs=>{"use strict";var it=_t("buffer"),_r=x(),Cu=Ze(),Eu={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof it.Buffer=="function")return it.Buffer.from(t,"base64");if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},r,i,o){if(!n)return"";let s=n,a;if(typeof it.Buffer=="function")a=s instanceof it.Buffer?s.toString("base64"):it.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<s.length;++c)l+=String.fromCharCode(s[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=_r.Scalar.BLOCK_LITERAL),e!==_r.Scalar.QUOTE_DOUBLE){let l=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),c=Math.ceil(a.length/l),p=new Array(c);for(let f=0,u=0;f<c;++f,u+=l)p[f]=a.substr(u,l);a=p.join(e===_r.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return Cu.stringifyString({comment:t,type:e,value:a},r,i,o)}};cs.binary=Eu});var mn=b(dn=>{"use strict";var fn=_(),Ir=ue(),Pu=x(),_u=me();function us(t,e){if(fn.isSeq(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!fn.isPair(r)){if(fn.isMap(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new Ir.Pair(new Pu.Scalar(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
|
|
54
|
+
${i.key.commentBefore}`:r.commentBefore),r.comment){let o=i.value??i.key;o.comment=o.comment?`${r.comment}
|
|
55
|
+
${o.comment}`:r.comment}r=i}t.items[n]=fn.isPair(r)?r:new Ir.Pair(r)}}else e("Expected a sequence for this tag");return t}function fs(t,e,n){let{replacer:r}=n,i=new _u.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof r=="function"&&(s=r.call(e,String(o++),s));let a,l;if(Array.isArray(s))if(s.length===2)a=s[0],l=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let c=Object.keys(s);if(c.length===1)a=c[0],l=s[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=s;i.items.push(Ir.createPair(a,l,n))}return i}var Au={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:us,createNode:fs};dn.createPairs=fs;dn.pairs=Au;dn.resolvePairs=us});var jr=b(Nr=>{"use strict";var ds=_(),Or=se(),ot=de(),Iu=me(),ms=mn(),Ce=class t extends Iu.YAMLSeq{constructor(){super(),this.add=ot.YAMLMap.prototype.add.bind(this),this.delete=ot.YAMLMap.prototype.delete.bind(this),this.get=ot.YAMLMap.prototype.get.bind(this),this.has=ot.YAMLMap.prototype.has.bind(this),this.set=ot.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let o,s;if(ds.isPair(i)?(o=Or.toJS(i.key,"",n),s=Or.toJS(i.value,o,n)):o=Or.toJS(i,"",n),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(e,n,r){let i=ms.createPairs(e,n,r),o=new this;return o.items=i.items,o}};Ce.tag="tag:yaml.org,2002:omap";var Ou={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ce,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=ms.resolvePairs(t,e),r=[];for(let{key:i}of n.items)ds.isScalar(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Ce,n)},createNode:(t,e,n)=>Ce.from(t,e,n)};Nr.YAMLOMap=Ce;Nr.omap=Ou});var ys=b(xr=>{"use strict";var ps=x();function hs({value:t,source:e},n){return e&&(t?gs:ws).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var gs={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new ps.Scalar(!0),stringify:hs},ws={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new ps.Scalar(!1),stringify:hs};xr.falseTag=ws;xr.trueTag=gs});var ks=b(pn=>{"use strict";var Nu=x(),Tr=De(),ju={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Tr.stringifyNumber},xu={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Tr.stringifyNumber(t)}},Tu={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Nu.Scalar(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:Tr.stringifyNumber};pn.float=Tu;pn.floatExp=xu;pn.floatNaN=ju});var vs=b(at=>{"use strict";var bs=De(),st=t=>typeof t=="bigint"||Number.isInteger(t);function hn(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return i==="-"?-1*o:o}function Rr(t,e,n){let{value:r}=t;if(st(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return bs.stringifyNumber(t)}var Ru={identify:st,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>hn(t,2,2,n),stringify:t=>Rr(t,2,"0b")},Lu={identify:st,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>hn(t,1,8,n),stringify:t=>Rr(t,8,"0")},qu={identify:st,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>hn(t,0,10,n),stringify:bs.stringifyNumber},Du={identify:st,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>hn(t,2,16,n),stringify:t=>Rr(t,16,"0x")};at.int=qu;at.intBin=Ru;at.intHex=Du;at.intOct=Lu});var qr=b(Lr=>{"use strict";var yn=_(),gn=ue(),wn=de(),Ee=class t extends wn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let n;yn.isPair(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new gn.Pair(e.key,null):n=new gn.Pair(e,null),wn.findPair(this.items,n.key)||this.items.push(n)}get(e,n){let r=wn.findPair(this.items,e);return!n&&yn.isPair(r)?yn.isScalar(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=wn.findPair(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new gn.Pair(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof i=="function"&&(s=i.call(n,s,s)),o.items.push(gn.createPair(s,null,r));return o}};Ee.tag="tag:yaml.org,2002:set";var Mu={collection:"map",identify:t=>t instanceof Set,nodeClass:Ee,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Ee.from(t,e,n),resolve(t,e){if(yn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ee,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Lr.YAMLSet=Ee;Lr.set=Mu});var Mr=b(kn=>{"use strict";var $u=De();function Dr(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function Ss(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return $u.stringifyNumber(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Fu={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>Dr(t,n),stringify:Ss},Wu={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Dr(t,!1),stringify:Ss},Cs={identify:t=>t 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(t){let e=t.match(Cs.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,o,s,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(n,r-1,i,o||0,s||0,a||0,l),p=e[8];if(p&&p!=="Z"){let f=Dr(p,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};kn.floatTime=Wu;kn.intTime=Fu;kn.timestamp=Cs});var _s=b(Ps=>{"use strict";var Bu=Le(),Hu=sn(),Ku=qe(),Ju=rt(),zu=Ar(),Es=ys(),$r=ks(),bn=vs(),Uu=Qt(),Yu=jr(),Vu=mn(),Gu=qr(),Fr=Mr(),Qu=[Bu.map,Ku.seq,Ju.string,Hu.nullTag,Es.trueTag,Es.falseTag,bn.intBin,bn.intOct,bn.int,bn.intHex,$r.floatNaN,$r.floatExp,$r.float,zu.binary,Uu.merge,Yu.omap,Vu.pairs,Gu.set,Fr.intTime,Fr.floatTime,Fr.timestamp];Ps.schema=Qu});var qs=b(Hr=>{"use strict";var Ns=Le(),Xu=sn(),js=qe(),Zu=rt(),ef=kr(),Wr=vr(),Br=Cr(),tf=os(),nf=ls(),xs=Ar(),lt=Qt(),Ts=jr(),Rs=mn(),As=_s(),Ls=qr(),vn=Mr(),Is=new Map([["core",tf.schema],["failsafe",[Ns.map,js.seq,Zu.string]],["json",nf.schema],["yaml11",As.schema],["yaml-1.1",As.schema]]),Os={binary:xs.binary,bool:ef.boolTag,float:Wr.float,floatExp:Wr.floatExp,floatNaN:Wr.floatNaN,floatTime:vn.floatTime,int:Br.int,intHex:Br.intHex,intOct:Br.intOct,intTime:vn.intTime,map:Ns.map,merge:lt.merge,null:Xu.nullTag,omap:Ts.omap,pairs:Rs.pairs,seq:js.seq,set:Ls.set,timestamp:vn.timestamp},rf={"tag:yaml.org,2002:binary":xs.binary,"tag:yaml.org,2002:merge":lt.merge,"tag:yaml.org,2002:omap":Ts.omap,"tag:yaml.org,2002:pairs":Rs.pairs,"tag:yaml.org,2002:set":Ls.set,"tag:yaml.org,2002:timestamp":vn.timestamp};function of(t,e,n){let r=Is.get(e);if(r&&!t)return n&&!r.includes(lt.merge)?r.concat(lt.merge):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(Is.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(lt.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?Os[s]:s;if(!a){let l=JSON.stringify(s),c=Object.keys(Os).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return o.includes(a)||o.push(a),o},[])}Hr.coreKnownTags=rf;Hr.getTags=of});var zr=b(Ds=>{"use strict";var Kr=_(),sf=Le(),af=qe(),lf=rt(),Sn=qs(),cf=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Jr=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Sn.getTags(e,"compat"):e?Sn.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Sn.coreKnownTags:{},this.tags=Sn.getTags(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Kr.MAP,{value:sf.map}),Object.defineProperty(this,Kr.SCALAR,{value:lf.string}),Object.defineProperty(this,Kr.SEQ,{value:af.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?cf:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Ds.Schema=Jr});var $s=b(Ms=>{"use strict";var uf=_(),Ur=et(),ct=Ge();function ff(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let l=t.directives.toString(t);l?(n.push(l),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=Ur.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let l=o(t.commentBefore);n.unshift(ct.indentComment(l,""))}let s=!1,a=null;if(t.contents){if(uf.isNode(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let p=o(t.contents.commentBefore);n.push(ct.indentComment(p,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let l=a?void 0:()=>s=!0,c=Ur.stringify(t.contents,i,()=>a=null,l);a&&(c+=ct.lineComment(c,"",o(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Ur.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let l=o(t.comment);l.includes(`
|
|
56
|
+
`)?(n.push("..."),n.push(ct.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=t.comment;l&&s&&(l=l.replace(/^\n+/,"")),l&&((!s||a)&&n[n.length-1]!==""&&n.push(""),n.push(ct.indentComment(o(l),"")))}return n.join(`
|
|
57
|
+
`)+`
|
|
58
|
+
`}Ms.stringifyDocument=ff});var ut=b(Fs=>{"use strict";var df=Ye(),Me=Wt(),J=_(),mf=ue(),pf=se(),hf=zr(),gf=$s(),Yr=Dt(),wf=Xn(),yf=Ve(),Vr=Qn(),Gr=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,J.NODE_TYPE,{value:J.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:s}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new Vr.Directives({version:s}),this.setSchema(s,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[J.NODE_TYPE]:{value:J.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=J.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){$e(this.contents)&&this.contents.add(e)}addIn(e,n){$e(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=Yr.anchorNames(this);e.anchor=!n||r.has(n)?Yr.findNewAnchor(n||"a",r):n}return new df.Alias(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let h=y=>typeof y=="number"||y instanceof String||y instanceof Number,w=n.filter(h).map(String);w.length>0&&(n=n.concat(w)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:l,onTagObj:c,tag:p}=r??{},{onAnchor:f,setAnchors:u,sourceObjects:m}=Yr.createNodeAnchors(this,s||"a"),g={aliasDuplicateObjects:o??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:m},d=yf.createNode(e,p,g);return a&&J.isCollection(d)&&(d.flow=!0),u(),d}createPair(e,n,r={}){let i=this.createNode(e,null,r),o=this.createNode(n,null,r);return new mf.Pair(i,o)}delete(e){return $e(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Me.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):$e(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return J.isCollection(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return Me.isEmptyPath(e)?!n&&J.isScalar(this.contents)?this.contents.value:this.contents:J.isCollection(this.contents)?this.contents.getIn(e,n):void 0}has(e){return J.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Me.isEmptyPath(e)?this.contents!==void 0:J.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=Me.collectionFromPath(this.schema,[e],n):$e(this.contents)&&this.contents.set(e,n)}setIn(e,n){Me.isEmptyPath(e)?this.contents=n:this.contents==null?this.contents=Me.collectionFromPath(this.schema,Array.from(e),n):$e(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Vr.Directives({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Vr.Directives({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new hf.Schema(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=pf.toJS(this.contents,n??"",a);if(typeof o=="function")for(let{count:c,res:p}of a.anchors.values())o(p,c);return typeof s=="function"?wf.applyReviver(s,{"":l},"",l):l}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}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 n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return gf.stringifyDocument(this,e)}};function $e(t){if(J.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Fs.Document=Gr});var mt=b(dt=>{"use strict";var ft=class extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}},Qr=class extends ft{constructor(e,n,r){super("YAMLParseError",e,n,r)}},Xr=class extends ft{constructor(e,n,r){super("YAMLWarning",e,n,r)}},kf=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(s.substring(0,o))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
59
|
+
`),s=a+s}if(/[^ ]/.test(s)){let a=1,l=n.linePos[1];l?.line===r&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-o)));let c=" ".repeat(o)+"^".repeat(a);n.message+=`:
|
|
60
|
+
|
|
61
|
+
${s}
|
|
62
|
+
${c}
|
|
63
|
+
`}};dt.YAMLError=ft;dt.YAMLParseError=Qr;dt.YAMLWarning=Xr;dt.prettifyError=kf});var pt=b(Ws=>{"use strict";function bf(t,{flow:e,indicator:n,next:r,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let l=!1,c=a,p=a,f="",u="",m=!1,g=!1,d=null,h=null,w=null,y=null,v=null,k=null,C=null;for(let S of t)switch(g&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&o(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),d&&(c&&S.type!=="comment"&&S.type!=="newline"&&o(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),d=null),S.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&S.source.includes(" ")&&(d=S),p=!0;break;case"comment":{p||o(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let T=S.source.substring(1)||" ";f?f+=u+T:f=T,u="",c=!1;break}case"newline":c?f?f+=S.source:(!k||n!=="seq-item-ind")&&(l=!0):u+=S.source,c=!0,m=!0,(h||w)&&(y=S),p=!0;break;case"anchor":h&&o(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&o(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=S,C??(C=S.offset),c=!1,p=!1,g=!0;break;case"tag":{w&&o(S,"MULTIPLE_TAGS","A node can have at most one tag"),w=S,C??(C=S.offset),c=!1,p=!1,g=!0;break}case n:(h||w)&&o(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),k&&o(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${e??"collection"}`),k=S,c=n==="seq-item-ind"||n==="explicit-key-ind",p=!1;break;case"comma":if(e){v&&o(S,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),v=S,c=!1,p=!1;break}default:o(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),c=!1,p=!1}let E=t[t.length-1],O=E?E.offset+E.source.length:i;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d&&(c&&d.indent<=s||r?.type==="block-map"||r?.type==="block-seq")&&o(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:v,found:k,spaceBefore:l,comment:f,hasNewline:m,anchor:h,tag:w,newlineAfterProp:y,end:O,start:C??O}}Ws.resolveProps=bf});var Cn=b(Bs=>{"use strict";function Zr(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
64
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(Zr(e.key)||Zr(e.value))return!0}return!1;default:return!0}}Bs.containsNewline=Zr});var ei=b(Hs=>{"use strict";var vf=Cn();function Sf(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&vf.containsNewline(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Hs.flowIndentCheck=Sf});var ti=b(Js=>{"use strict";var Ks=_();function Cf(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,s)=>o===s||Ks.isScalar(o)&&Ks.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,n))}Js.mapIncludes=Cf});var Qs=b(Gs=>{"use strict";var zs=ue(),Ef=de(),Us=pt(),Pf=Cn(),Ys=ei(),_f=ti(),Vs="All mapping items must start at the same column";function Af({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Ef.YAMLMap,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let l=r.offset,c=null;for(let p of r.items){let{start:f,key:u,sep:m,value:g}=p,d=Us.resolveProps(f,{indicator:"explicit-key-ind",next:u??m?.[0],offset:l,onError:i,parentIndent:r.indent,startOnNewline:!0}),h=!d.found;if(h){if(u&&(u.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==r.indent&&i(l,"BAD_INDENT",Vs)),!d.anchor&&!d.tag&&!m){c=d.end,d.comment&&(a.comment?a.comment+=`
|
|
65
|
+
`+d.comment:a.comment=d.comment);continue}(d.newlineAfterProp||Pf.containsNewline(u))&&i(u??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else d.found?.indent!==r.indent&&i(l,"BAD_INDENT",Vs);n.atKey=!0;let w=d.end,y=u?t(n,u,d,i):e(n,w,f,null,d,i);n.schema.compat&&Ys.flowIndentCheck(r.indent,u,i),n.atKey=!1,_f.mapIncludes(n,a.items,y)&&i(w,"DUPLICATE_KEY","Map keys must be unique");let v=Us.resolveProps(m??[],{indicator:"map-value-ind",next:g,offset:y.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type==="block-scalar"});if(l=v.end,v.found){h&&(g?.type==="block-map"&&!v.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&d.start<v.found.offset-1024&&i(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=g?t(n,g,v,i):e(n,l,m,null,v,i);n.schema.compat&&Ys.flowIndentCheck(r.indent,g,i),l=k.range[2];let C=new zs.Pair(y,k);n.options.keepSourceTokens&&(C.srcToken=p),a.items.push(C)}else{h&&i(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),v.comment&&(y.comment?y.comment+=`
|
|
66
|
+
`+v.comment:y.comment=v.comment);let k=new zs.Pair(y);n.options.keepSourceTokens&&(k.srcToken=p),a.items.push(k)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,l,c??l],a}Gs.resolveBlockMap=Af});var Zs=b(Xs=>{"use strict";var If=me(),Of=pt(),Nf=ei();function jf({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??If.YAMLSeq,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=r.offset,c=null;for(let{start:p,value:f}of r.items){let u=Of.resolveProps(p,{indicator:"seq-item-ind",next:f,offset:l,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||f)f?.type==="block-seq"?i(u.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=u.end,u.comment&&(a.comment=u.comment);continue}let m=f?t(n,f,u,i):e(n,u.end,p,null,u,i);n.schema.compat&&Nf.flowIndentCheck(r.indent,f,i),l=m.range[2],a.items.push(m)}return a.range=[r.offset,l,c??l],a}Xs.resolveBlockSeq=jf});var Fe=b(ea=>{"use strict";function xf(t,e,n,r){let i="";if(t){let o=!1,s="";for(let a of t){let{source:l,type:c}=a;switch(c){case"space":o=!0;break;case"comment":{n&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let p=l.substring(1)||" ";i?i+=s+p:i=p,s="";break}case"newline":i&&(s+=l),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}ea.resolveEnd=xf});var ia=b(ra=>{"use strict";var Tf=_(),Rf=ue(),ta=de(),Lf=me(),qf=Fe(),na=pt(),Df=Cn(),Mf=ti(),ni="Block collections are not allowed within flow collections",ri=t=>t&&(t.type==="block-map"||t.type==="block-seq");function $f({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=r.start.source==="{",a=s?"flow map":"flow sequence",l=o?.nodeClass??(s?ta.YAMLMap:Lf.YAMLSeq),c=new l(n.schema);c.flow=!0;let p=n.atRoot;p&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let h=0;h<r.items.length;++h){let w=r.items[h],{start:y,key:v,sep:k,value:C}=w,E=na.resolveProps(y,{flow:a,indicator:"explicit-key-ind",next:v??k?.[0],offset:f,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!k&&!C){h===0&&E.comma?i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<r.items.length-1&&i(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(c.comment?c.comment+=`
|
|
67
|
+
`+E.comment:c.comment=E.comment),f=E.end;continue}!s&&n.options.strict&&Df.containsNewline(v)&&i(v,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)E.comma&&i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||i(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let O="";e:for(let S of y)switch(S.type){case"comma":case"space":break;case"comment":O=S.source.substring(1);break e;default:break e}if(O){let S=c.items[c.items.length-1];Tf.isPair(S)&&(S=S.value??S.key),S.comment?S.comment+=`
|
|
68
|
+
`+O:S.comment=O,E.comment=E.comment.substring(O.length+1)}}if(!s&&!k&&!E.found){let O=C?t(n,C,E,i):e(n,E.end,k,null,E,i);c.items.push(O),f=O.range[2],ri(C)&&i(O.range,"BLOCK_IN_FLOW",ni)}else{n.atKey=!0;let O=E.end,S=v?t(n,v,E,i):e(n,O,y,null,E,i);ri(v)&&i(S.range,"BLOCK_IN_FLOW",ni),n.atKey=!1;let T=na.resolveProps(k??[],{flow:a,indicator:"map-value-ind",next:C,offset:S.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(T.found){if(!s&&!E.found&&n.options.strict){if(k)for(let R of k){if(R===T.found)break;if(R.type==="newline"){i(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<T.found.offset-1024&&i(T.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]===":"?i(C,"MISSING_CHAR",`Missing space after : in ${a}`):i(T.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let ie=C?t(n,C,T,i):T.found?e(n,T.end,k,null,T,i):null;ie?ri(C)&&i(ie.range,"BLOCK_IN_FLOW",ni):T.comment&&(S.comment?S.comment+=`
|
|
69
|
+
`+T.comment:S.comment=T.comment);let Ne=new Rf.Pair(S,ie);if(n.options.keepSourceTokens&&(Ne.srcToken=w),s){let R=c;Mf.mapIncludes(n,R.items,S)&&i(O,"DUPLICATE_KEY","Map keys must be unique"),R.items.push(Ne)}else{let R=new ta.YAMLMap(n.schema);R.flow=!0,R.items.push(Ne);let Ji=(ie??S).range;R.range=[S.range[0],Ji[1],Ji[2]],c.items.push(R)}f=ie?ie.range[2]:T.end}}let u=s?"}":"]",[m,...g]=r.end,d=f;if(m?.source===u)d=m.offset+m.source.length;else{let h=a[0].toUpperCase()+a.substring(1),w=p?`${h} must end with a ${u}`:`${h} in block collection must be sufficiently indented and end with a ${u}`;i(f,p?"MISSING_CHAR":"BAD_INDENT",w),m&&m.source.length!==1&&g.unshift(m)}if(g.length>0){let h=qf.resolveEnd(g,d,n.options.strict,i);h.comment&&(c.comment?c.comment+=`
|
|
70
|
+
`+h.comment:c.comment=h.comment),c.range=[r.offset,d,h.offset]}else c.range=[r.offset,d,d];return c}ra.resolveFlowCollection=$f});var sa=b(oa=>{"use strict";var Ff=_(),Wf=x(),Bf=de(),Hf=me(),Kf=Qs(),Jf=Zs(),zf=ia();function ii(t,e,n,r,i,o){let s=n.type==="block-map"?Kf.resolveBlockMap(t,e,n,r,o):n.type==="block-seq"?Jf.resolveBlockSeq(t,e,n,r,o):zf.resolveFlowCollection(t,e,n,r,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Uf(t,e,n,r,i){let o=r.tag,s=o?e.directives.tagName(o.source,u=>i(o,"TAG_RESOLVE_FAILED",u)):null;if(n.type==="block-seq"){let{anchor:u,newlineAfterProp:m}=r,g=u&&o?u.offset>o.offset?u:o:u??o;g&&(!m||m.offset<g.offset)&&i(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===Bf.YAMLMap.tagName&&a==="map"||s===Hf.YAMLSeq.tagName&&a==="seq")return ii(t,e,n,i,s);let l=e.schema.tags.find(u=>u.tag===s&&u.collection===a);if(!l){let u=e.schema.knownTags[s];if(u?.collection===a)e.schema.tags.push(Object.assign({},u,{default:!1})),l=u;else return u?i(o,"BAD_COLLECTION_TYPE",`${u.tag} used for ${a} collection, but expects ${u.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),ii(t,e,n,i,s)}let c=ii(t,e,n,i,s,l),p=l.resolve?.(c,u=>i(o,"TAG_RESOLVE_FAILED",u),e.options)??c,f=Ff.isNode(p)?p:new Wf.Scalar(p);return f.range=c.range,f.tag=s,l?.format&&(f.format=l.format),f}oa.composeCollection=Uf});var si=b(aa=>{"use strict";var oi=x();function Yf(t,e,n){let r=e.offset,i=Vf(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?oi.Scalar.BLOCK_FOLDED:oi.Scalar.BLOCK_LITERAL,s=e.source?Gf(e.source):[],a=s.length;for(let d=s.length-1;d>=0;--d){let h=s[d][1];if(h===""||h==="\r")a=d;else break}if(a===0){let d=i.chomp==="+"&&s.length>0?`
|
|
71
|
+
`.repeat(Math.max(1,s.length-1)):"",h=r+i.length;return e.source&&(h+=e.source.length),{value:d,type:o,comment:i.comment,range:[r,h,h]}}let l=e.indent+i.indent,c=e.offset+i.length,p=0;for(let d=0;d<a;++d){let[h,w]=s[d];if(w===""||w==="\r")i.indent===0&&h.length>l&&(l=h.length);else{h.length<l&&n(c+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(l=h.length),p=d,l===0&&!t.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=h.length+w.length+1}for(let d=s.length-1;d>=a;--d)s[d][0].length>l&&(a=d+1);let f="",u="",m=!1;for(let d=0;d<p;++d)f+=s[d][0].slice(l)+`
|
|
72
|
+
`;for(let d=p;d<a;++d){let[h,w]=s[d];c+=h.length+w.length+1;let y=w[w.length-1]==="\r";if(y&&(w=w.slice(0,-1)),w&&h.length<l){let k=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-w.length-(y?2:1),"BAD_INDENT",k),h=""}o===oi.Scalar.BLOCK_LITERAL?(f+=u+h.slice(l)+w,u=`
|
|
73
|
+
`):h.length>l||w[0]===" "?(u===" "?u=`
|
|
74
|
+
`:!m&&u===`
|
|
75
|
+
`&&(u=`
|
|
76
|
+
|
|
77
|
+
`),f+=u+h.slice(l)+w,u=`
|
|
78
|
+
`,m=!0):w===""?u===`
|
|
79
|
+
`?f+=`
|
|
80
|
+
`:u=`
|
|
81
|
+
`:(f+=u+w,u=" ",m=!1)}switch(i.chomp){case"-":break;case"+":for(let d=a;d<s.length;++d)f+=`
|
|
82
|
+
`+s[d][0].slice(l);f[f.length-1]!==`
|
|
83
|
+
`&&(f+=`
|
|
84
|
+
`);break;default:f+=`
|
|
85
|
+
`}let g=r+i.length+e.source.length;return{value:f,type:o,comment:i.comment,range:[r,g,g]}}function Vf({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",l=-1;for(let u=1;u<i.length;++u){let m=i[u];if(!a&&(m==="-"||m==="+"))a=m;else{let g=Number(m);!s&&g?s=g:l===-1&&(l=t+u)}}l!==-1&&r(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,p="",f=i.length;for(let u=1;u<e.length;++u){let m=e[u];switch(m.type){case"space":c=!0;case"newline":f+=m.source.length;break;case"comment":n&&!c&&r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=m.source.length,p=m.source.substring(1);break;case"error":r(m,"UNEXPECTED_TOKEN",m.message),f+=m.source.length;break;default:{let g=`Unexpected token in block scalar header: ${m.type}`;r(m,"UNEXPECTED_TOKEN",g);let d=m.source;d&&typeof d=="string"&&(f+=d.length)}}}return{mode:o,indent:s,chomp:a,comment:p,length:f}}function Gf(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}aa.resolveBlockScalar=Yf});var li=b(ca=>{"use strict";var ai=x(),Qf=Fe();function Xf(t,e,n){let{offset:r,type:i,source:o,end:s}=t,a,l,c=(u,m,g)=>n(r+u,m,g);switch(i){case"scalar":a=ai.Scalar.PLAIN,l=Zf(o,c);break;case"single-quoted-scalar":a=ai.Scalar.QUOTE_SINGLE,l=ed(o,c);break;case"double-quoted-scalar":a=ai.Scalar.QUOTE_DOUBLE,l=td(o,c);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let p=r+o.length,f=Qf.resolveEnd(s,p,e,n);return{value:l,type:a,comment:f.comment,range:[r,p,f.offset]}}function Zf(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),la(t)}function ed(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),la(t.slice(1,-1)).replace(/''/g,"'")}function la(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
86
|
+
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
87
|
+
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let i=r[1],o=" ",s=e.lastIndex;for(n.lastIndex=s;r=n.exec(t);)r[1]===""?o===`
|
|
88
|
+
`?i+=o:o=`
|
|
89
|
+
`:(i+=o+r[1],o=" "),s=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,r=a.exec(t),i+o+(r?.[1]??"")}function td(t,e){let n="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
|
|
90
|
+
`))if(i===`
|
|
91
|
+
`){let{fold:o,offset:s}=nd(t,r);n+=o,r=s}else if(i==="\\"){let o=t[++r],s=rd[o];if(s)n+=s;else if(o===`
|
|
92
|
+
`)for(o=t[r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="\r"&&t[r+1]===`
|
|
93
|
+
`)for(o=t[++r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;n+=id(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(i===" "||i===" "){let o=r,s=t[r+1];for(;s===" "||s===" ";)s=t[++r+1];s!==`
|
|
94
|
+
`&&!(s==="\r"&&t[r+2]===`
|
|
95
|
+
`)&&(n+=r>o?t.slice(o,r+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function nd(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
|
|
96
|
+
`||r==="\r")&&!(r==="\r"&&t[e+2]!==`
|
|
97
|
+
`);)r===`
|
|
98
|
+
`&&(n+=`
|
|
99
|
+
`),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var rd={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 id(t,e,n,r){let i=t.substr(e,n),s=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}ca.resolveFlowScalar=Xf});var da=b(fa=>{"use strict";var Pe=_(),ua=x(),od=si(),sd=li();function ad(t,e,n,r){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?od.resolveBlockScalar(t,e,r):sd.resolveFlowScalar(e,t.options.strict,r),l=n?t.directives.tagName(n.source,f=>r(n,"TAG_RESOLVE_FAILED",f)):null,c;t.options.stringKeys&&t.atKey?c=t.schema[Pe.SCALAR]:l?c=ld(t.schema,i,l,n,r):e.type==="scalar"?c=cd(t,i,e,r):c=t.schema[Pe.SCALAR];let p;try{let f=c.resolve(i,u=>r(n??e,"TAG_RESOLVE_FAILED",u),t.options);p=Pe.isScalar(f)?f:new ua.Scalar(f)}catch(f){let u=f instanceof Error?f.message:String(f);r(n??e,"TAG_RESOLVE_FAILED",u),p=new ua.Scalar(i)}return p.range=a,p.source=i,o&&(p.type=o),l&&(p.tag=l),c.format&&(p.format=c.format),s&&(p.comment=s),p}function ld(t,e,n,r,i){if(n==="!")return t[Pe.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[n];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Pe.SCALAR])}function cd({atKey:t,directives:e,schema:n},r,i,o){let s=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[Pe.SCALAR];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(r))??n[Pe.SCALAR];if(s.tag!==a.tag){let l=e.tagString(s.tag),c=e.tagString(a.tag),p=`Value may be parsed as either ${l} or ${c}`;o(i,"TAG_RESOLVE_FAILED",p,!0)}}return s}fa.composeScalar=ad});var pa=b(ma=>{"use strict";function ud(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}ma.emptyScalarPosition=ud});var wa=b(ui=>{"use strict";var fd=Ye(),dd=_(),md=sa(),ha=da(),pd=Fe(),hd=pa(),gd={composeNode:ga,composeEmptyNode:ci};function ga(t,e,n,r){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:l}=n,c,p=!0;switch(e.type){case"alias":c=wd(t,e,r),(a||l)&&r(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":c=ha.composeScalar(t,e,l,r),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=md.composeCollection(gd,t,e,n,r),a&&(c.anchor=a.source.substring(1))}catch(f){let u=f instanceof Error?f.message:String(f);r(e,"RESOURCE_EXHAUSTION",u)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",f),p=!1}}return c??(c=ci(t,e.offset,void 0,null,n,r)),a&&c.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!dd.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&r(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(c.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?c.comment=s:c.commentBefore=s),t.options.keepSourceTokens&&p&&(c.srcToken=e),c}function ci(t,e,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:l},c){let p={type:"scalar",offset:hd.emptyScalarPosition(e,n,r),indent:-1,source:""},f=ha.composeScalar(t,p,a,c);return s&&(f.anchor=s.source.substring(1),f.anchor===""&&c(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),o&&(f.comment=o,f.range[2]=l),f}function wd({options:t},{offset:e,source:n,end:r},i){let o=new fd.Alias(n.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+n.length,a=pd.resolveEnd(r,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ui.composeEmptyNode=ci;ui.composeNode=ga});var ba=b(ka=>{"use strict";var yd=ut(),ya=wa(),kd=Fe(),bd=pt();function vd(t,e,{offset:n,start:r,value:i,end:o},s){let a=Object.assign({_directives:e},t),l=new yd.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},p=bd.resolveProps(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});p.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!p.hasNewline&&s(p.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?ya.composeNode(c,i,p,s):ya.composeEmptyNode(c,p.end,r,null,p,s);let f=l.contents.range[2],u=kd.resolveEnd(o,f,!1,s);return u.comment&&(l.comment=u.comment),l.range=[n,f,u.offset],l}ka.composeDoc=vd});var di=b(Ca=>{"use strict";var Sd=_t("process"),Cd=Qn(),Ed=ut(),ht=mt(),va=_(),Pd=ba(),_d=Fe();function gt(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function Sa(t){let e="",n=!1,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
|
|
101
|
+
|
|
102
|
+
`:`
|
|
103
|
+
`)+(o.substring(1)||" "),n=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var fi=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,o)=>{let s=gt(n);o?this.warnings.push(new ht.YAMLWarning(s,r,i)):this.errors.push(new ht.YAMLParseError(s,r,i))},this.directives=new Cd.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:i}=Sa(this.prelude);if(r){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
|
|
104
|
+
${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(va.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];va.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${r}
|
|
105
|
+
${a}`:r}else{let s=o.commentBefore;o.commentBefore=s?`${r}
|
|
106
|
+
${s}`:r}}if(n){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Sa(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(n,r)}*next(e){switch(Sd.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(n,r,i)=>{let o=gt(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=Pd.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new ht.YAMLParseError(gt(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new ht.YAMLParseError(gt(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=_d.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
107
|
+
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new ht.YAMLParseError(gt(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),i=new Ed.Document(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};Ca.Composer=fi});var _a=b(En=>{"use strict";var Ad=si(),Id=li(),Od=mt(),Ea=Ze();function Nd(t,e=!0,n){if(t){let r=(i,o,s)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,o,s);else throw new Od.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Id.resolveFlowScalar(t,e,r);case"block-scalar":return Ad.resolveBlockScalar({options:{strict:e}},t,r)}}return null}function jd(t,e){let{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=Ea.stringifyString({type:s,value:t},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:r,source:`
|
|
108
|
+
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
109
|
+
`),p=a.substring(0,c),f=a.substring(c+1)+`
|
|
110
|
+
`,u=[{type:"block-scalar-header",offset:o,indent:r,source:p}];return Pa(u,l)||u.push({type:"newline",offset:-1,indent:r,source:`
|
|
111
|
+
`}),{type:"block-scalar",offset:o,indent:r,props:u,source:f}}case'"':return{type:"double-quoted-scalar",offset:o,indent:r,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:o,indent:r,source:a,end:l};default:return{type:"scalar",offset:o,indent:r,source:a,end:l}}}function xd(t,e,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=n,a="indent"in t?t.indent:null;if(r&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let c=t.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let l=Ea.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":Td(t,l);break;case'"':mi(t,l,"double-quoted-scalar");break;case"'":mi(t,l,"single-quoted-scalar");break;default:mi(t,l,"scalar")}}function Td(t,e){let n=e.indexOf(`
|
|
112
|
+
`),r=e.substring(0,n),i=e.substring(n+1)+`
|
|
113
|
+
`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=r,t.source=i}else{let{offset:o}=t,s="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:s,source:r}];Pa(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
|
|
114
|
+
`});for(let l of Object.keys(t))l!=="type"&&l!=="offset"&&delete t[l];Object.assign(t,{type:"block-scalar",indent:s,props:a,source:i})}}function Pa(t,e){if(e)for(let n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function mi(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{let r=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let o of r)o.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:r});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
115
|
+
`};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{let r="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:n,indent:r,source:e,end:i})}}}En.createScalarToken=jd;En.resolveAsScalar=Nd;En.setScalarValue=xd});var Ia=b(Aa=>{"use strict";var Rd=t=>"type"in t?_n(t):Pn(t);function _n(t){switch(t.type){case"block-scalar":{let e="";for(let n of t.props)e+=_n(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(let n of t.items)e+=Pn(n);return e}case"flow-collection":{let e=t.start.source;for(let n of t.items)e+=Pn(n);for(let n of t.end)e+=n.source;return e}case"document":{let e=Pn(t);if(t.end)for(let n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let n of t.end)e+=n.source;return e}}}function Pn({start:t,key:e,sep:n,value:r}){let i="";for(let o of t)i+=o.source;if(e&&(i+=_n(e)),n)for(let o of n)i+=o.source;return r&&(i+=_n(r)),i}Aa.stringify=Rd});var xa=b(ja=>{"use strict";var pi=Symbol("break visit"),Ld=Symbol("skip children"),Oa=Symbol("remove item");function _e(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Na(Object.freeze([]),t,e)}_e.BREAK=pi;_e.SKIP=Ld;_e.REMOVE=Oa;_e.itemAtPath=(t,e)=>{let n=t;for(let[r,i]of e){let o=n?.[r];if(o&&"items"in o)n=o.items[i];else return}return n};_e.parentCollection=(t,e)=>{let n=_e.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Na(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let s=0;s<o.items.length;++s){let a=Na(Object.freeze(t.concat([[i,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===pi)return pi;a===Oa&&(o.items.splice(s,1),s-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}ja.visit=_e});var An=b(W=>{"use strict";var hi=_a(),qd=Ia(),Dd=xa(),gi="\uFEFF",wi="",yi="",ki="",Md=t=>!!t&&"items"in t,$d=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Fd(t){switch(t){case gi:return"<BOM>";case wi:return"<DOC>";case yi:return"<FLOW_END>";case ki:return"<SCALAR>";default:return JSON.stringify(t)}}function Wd(t){switch(t){case gi:return"byte-order-mark";case wi:return"doc-mode";case yi:return"flow-error-end";case ki: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(t[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}W.createScalarToken=hi.createScalarToken;W.resolveAsScalar=hi.resolveAsScalar;W.setScalarValue=hi.setScalarValue;W.stringify=qd.stringify;W.visit=Dd.visit;W.BOM=gi;W.DOCUMENT=wi;W.FLOW_END=yi;W.SCALAR=ki;W.isCollection=Md;W.isScalar=$d;W.prettyToken=Fd;W.tokenType=Wd});var Si=b(Ra=>{"use strict";var wt=An();function Y(t){switch(t){case void 0:case" ":case`
|
|
118
|
+
`:case"\r":case" ":return!0;default:return!1}}var Ta=new Set("0123456789ABCDEFabcdef"),Bd=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),In=new Set(",[]{}"),Hd=new Set(` ,[]{}
|
|
119
|
+
\r `),bi=t=>!t||Hd.has(t),vi=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,n=!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=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
|
|
120
|
+
`?!0:n==="\r"?this.buffer[e+1]===`
|
|
121
|
+
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){let i=this.buffer[r+e+1];if(i===`
|
|
122
|
+
`||!i&&!this.atEnd)return e+r+1}return n===`
|
|
123
|
+
`||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&Y(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]===wt.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield wt.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 n=this.peek(3);if((n==="---"||n==="...")&&Y(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Y(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Y(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);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(bi),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&Y(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield wt.FLOW_END,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"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(bi),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||Y(s)||s===",")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),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
|
|
125
|
+
`,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=r.indexOf(`
|
|
126
|
+
`,o)}i!==-1&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Y(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":n+=1;break;case`
|
|
127
|
+
`:e=o,n=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
|
|
128
|
+
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
|
|
129
|
+
`,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
|
|
130
|
+
`;)r=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
|
|
131
|
+
`&&o>=this.pos&&o+1+n>a)e=o;else break}while(!0);return yield wt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(Y(o)||e&&In.has(o))break;n=r}else if(Y(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
|
|
132
|
+
`?(r+=1,i=`
|
|
133
|
+
`,o=this.buffer[r+1]):n=r),o==="#"||e&&In.has(o))break;if(i===`
|
|
134
|
+
`){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(e&&In.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield wt.SCALAR,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(bi),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(Y(r)||n&&In.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!Y(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(Bd.has(n))n=this.buffer[++e];else if(n==="%"&&Ta.has(this.buffer[e+1])&&Ta.has(this.buffer[e+2]))n=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 n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Ra.Lexer=vi});var Ei=b(La=>{"use strict";var Ci=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let o=n+r>>1;this.lineStarts[o]<e?n=o+1:r=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};La.LineCounter=Ci});var _i=b(Fa=>{"use strict";var Kd=_t("process"),qa=An(),Jd=Si();function pe(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Da(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function $a(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function On(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function We(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Nn(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function Ma(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!pe(e.start,"explicit-key-ind")&&!pe(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,$a(e.value)?e.value.end?Nn(e.value.end,e.sep):e.value.end=e.sep:Nn(e.start,e.sep),delete e.sep)}var Pi=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 Jd.Lexer,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,Kd.env.LOG_TOKENS&&console.log("|",qa.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=qa.tokenType(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){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 r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,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 n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Ma(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Da(i.start)===-1&&(n.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),n.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":{Da(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 n=this.startBlockValue(e);n?this.stack.push(n):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 n=On(this.peek(2)),r=We(n),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}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 n=this.source.indexOf(`
|
|
137
|
+
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
138
|
+
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Nn(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let l=n.sep[a];switch(l.type){case"newline":s.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(o.push(this.sourceToken),e.items.push({start:o,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(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(pe(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if($a(n.key)&&!pe(n.sep,"newline")){let s=We(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:l}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(pe(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=We(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):pe(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||n.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(s):(Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!n.explicitKey&&n.sep&&!pe(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:o});this.stack.push(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Nn(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||pe(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=On(r),o=We(i);Ma(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
|
|
139
|
+
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
140
|
+
`,n)+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 n=On(e),r=We(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=On(e),r=We(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.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())}}};Fa.Parser=Pi});var Ja=b(kt=>{"use strict";var Wa=di(),zd=ut(),yt=mt(),Ud=ur(),Yd=_(),Vd=Ei(),Ba=_i();function Ha(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Vd.LineCounter||null,prettyErrors:e}}function Gd(t,e={}){let{lineCounter:n,prettyErrors:r}=Ha(e),i=new Ba.Parser(n?.addNewLine),o=new Wa.Composer(e),s=Array.from(o.compose(i.parse(t)));if(r&&n)for(let a of s)a.errors.forEach(yt.prettifyError(t,n)),a.warnings.forEach(yt.prettifyError(t,n));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function Ka(t,e={}){let{lineCounter:n,prettyErrors:r}=Ha(e),i=new Ba.Parser(n?.addNewLine),o=new Wa.Composer(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new yt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach(yt.prettifyError(t,n)),s.warnings.forEach(yt.prettifyError(t,n))),s}function Qd(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=Ka(t,n);if(!i)return null;if(i.warnings.forEach(o=>Ud.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Xd(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=n??e??{};if(!i)return}return Yd.isDocument(t)&&!r?t.toString(n):new zd.Document(t,r,n).toString(n)}kt.parse=Qd;kt.parseAllDocuments=Gd;kt.parseDocument=Ka;kt.stringify=Xd});var xn=b(A=>{"use strict";var Zd=di(),em=ut(),tm=zr(),Ai=mt(),nm=Ye(),he=_(),rm=ue(),im=x(),om=de(),sm=me(),am=An(),lm=Si(),cm=Ei(),um=_i(),jn=Ja(),za=Ke();A.Composer=Zd.Composer;A.Document=em.Document;A.Schema=tm.Schema;A.YAMLError=Ai.YAMLError;A.YAMLParseError=Ai.YAMLParseError;A.YAMLWarning=Ai.YAMLWarning;A.Alias=nm.Alias;A.isAlias=he.isAlias;A.isCollection=he.isCollection;A.isDocument=he.isDocument;A.isMap=he.isMap;A.isNode=he.isNode;A.isPair=he.isPair;A.isScalar=he.isScalar;A.isSeq=he.isSeq;A.Pair=rm.Pair;A.Scalar=im.Scalar;A.YAMLMap=om.YAMLMap;A.YAMLSeq=sm.YAMLSeq;A.CST=am;A.Lexer=lm.Lexer;A.LineCounter=cm.LineCounter;A.Parser=um.Parser;A.parse=jn.parse;A.parseAllDocuments=jn.parseAllDocuments;A.parseDocument=jn.parseDocument;A.stringify=jn.stringify;A.visit=za.visit;A.visitAsync=za.visitAsync});import{promises as ee}from"node:fs";import j from"node:path";import ep from"node:os";import{createHash as tp}from"node:crypto";import{randomUUID as Tl}from"node:crypto";import{promises as oe}from"node:fs";import He from"node:path";import{performance as Qi}from"node:perf_hooks";import{createRequire as Nl}from"node:module";var jl=Nl(import.meta.url??__filename),At;function Ui(t,e){if(!At){let n=process.emitWarning;process.emitWarning=((r,...i)=>{String(r instanceof Error?r.message:r).startsWith("SQLite is an experimental feature and might change at any time")||Reflect.apply(n,process,[r,...i])});try{At=jl("node:sqlite").DatabaseSync}finally{process.emitWarning=n}}return e===void 0?new At(t):new At(t,e)}import{AsyncLocalStorage as xl}from"node:async_hooks";var Yi=new xl,Un=class extends Error{code="OPERATION_BUDGET_EXCEEDED";constructor(){super("Operation time budget exceeded; unfinished work can be resumed.")}};function Vi(t){return Math.max(0,Math.min(t,(Yi.getStore()?.deadline??1/0)-performance.now()))}function Gi(){let t=Yi.getStore();if(t&&(t.signal.aborted||performance.now()>=t.deadline))throw new Un}async function Xi(t){let e,n;try{let r=await oe.lstat(t);if(!r.isFile()||r.isSymbolicLink())throw new Error("File lock metadata must be a regular file: "+t);n=[r.dev,r.ino,r.size,r.mtimeMs].join(":"),e=await oe.readFile(t,"utf8")}catch(r){if(r.code==="ENOENT")return null;throw r}try{let r=JSON.parse(e),i=r.nonce??r.id,o=typeof r.createdAt=="number"?r.createdAt:Date.parse(r.createdAt);if(typeof i=="string"&&i&&Number.isFinite(o))return{owner:{nonce:i,createdAt:o,...r.protocolVersion===2?{protocolVersion:2}:{},...typeof r.operation=="string"?{operation:r.operation}:{}},token:i,legacy:r.protocolVersion!==2}}catch{}return{owner:null,token:n,legacy:!0}}async function Rl(t){let e=t+".sqlite";try{let r=await oe.lstat(e);if(!r.isFile()||r.isSymbolicLink())throw new Error("File lock database must be a regular file: "+e)}catch(r){if(r.code!=="ENOENT")throw r}let n;try{n=Ui(He.toNamespacedPath(e))}catch(r){throw new Error("Unable to open Runtime lock database "+e,{cause:r})}try{return n.exec("PRAGMA busy_timeout=0; BEGIN IMMEDIATE;"),n}catch(r){if(n.close(),/database is (?:locked|busy)/iu.test(String(r)))return null;throw new Error("Unable to acquire Runtime lock transaction "+e,{cause:r})}}function Zi(t){try{t.exec("ROLLBACK;")}finally{t.close()}}async function Ll(t,e={}){t=He.resolve(t),await oe.mkdir(He.dirname(t),{recursive:!0});let n=await oe.lstat(He.dirname(t));if(!n.isDirectory()||n.isSymbolicLink())throw new Error("File lock parent must be a real directory: "+He.dirname(t));let r=Qi.now()+Vi(e.timeoutMs??3e4),i;for(;Gi(),i=await Rl(t),!i;){if(Qi.now()>=r)throw new Error("Timed out waiting for file lock: "+t);await new Promise(a=>setTimeout(a,e.retryMs??20))}let o={protocolVersion:2,nonce:Tl(),createdAt:Date.now(),...e.operation?{operation:e.operation}:{}};try{let a=await Xi(t);if(a?.legacy)throw new Error("Legacy lock requires confirmation that its previous operation stopped: "+t+`
|
|
141
|
+
Inspect argv: `+JSON.stringify(["comet","doctor","--lock-file",t,"--json"]));a&&await oe.unlink(t),await oe.writeFile(t,JSON.stringify(o),{mode:384,flag:"wx"})}catch(a){throw Zi(i),a}let s=!1;return{owner:o,async release(){if(s)return!0;s=!0;let a=!0;try{let l=await Xi(t);l?.token===o.nonce?l.owner?.createdAt===o.createdAt&&l.owner.operation===o.operation?await oe.unlink(t):(a=!1,process.stderr.write("[comet] lock metadata changed while held; kept "+t+`
|
|
142
|
+
`)):l&&(a=!1,process.stderr.write("[comet] lock owned by another holder; kept "+t+`
|
|
143
|
+
`))}finally{Zi(i)}return a}}}async function It(t,e,n={}){let r=await Ll(t,n),i;try{i=await e()}catch(o){try{await r.release()}catch(s){process.stderr.write("[comet] lock cleanup failed; preserved the original operation error: "+String(s)+`
|
|
144
|
+
`)}throw o}return await r.release(),i}function Ot(t){let e=Buffer.from(JSON.stringify(t)).toString("base64");if(!/^[A-Za-z0-9+/]*={0,2}$/u.test(e))throw new TypeError("Hook \u53C2\u6570\u7F16\u7801\u5305\u542B\u65E0\u6548\u5B57\u7B26");return`node -e "const r=require('node:child_process').spawnSync(process.execPath,JSON.parse(Buffer.from('${e}','base64').toString()),{stdio:'inherit'});process.exit(r.status??1)"`}function eo(t){if(typeof t!="string")return null;let e=/Buffer\.from\('([A-Za-z0-9+/=]+)','base64'\)/u.exec(t)?.[1];if(!e)return null;try{let n=JSON.parse(Buffer.from(e,"base64").toString());return!Array.isArray(n)||!n.every(r=>typeof r=="string")?null:Ot(n)===t?n:null}catch{return null}}import Mm from"path";import{fileURLToPath as $m}from"url";import to from"os";import Nt from"path";function jt(t,e){if(t.id==="dsh"&&e==="global"){let n=Nt.resolve(to.homedir()),r=ql(n);return Nt.relative(n,r)||"."}return e==="global"&&t.globalSkillsDir?t.globalSkillsDir:t.skillsDir}function ql(t=to.homedir()){return Nt.resolve(process.env.DSH_HOME||Nt.join(t,".dsh"))}function no(t,e){return[...new Set([jt(t,e),...t.legacySkillsDirs??[]])]}function xt(t,e){return e==="global"&&t.globalConfigDir?t.globalConfigDir:t.configDir??jt(t,e)}var ro=[{id:"claude",name:"Claude Code",skillsDir:".claude",globalSkillsDir:".claude",openspecToolId:"claude",rulesDir:"rules",rulesFormat:"md",supportsHooks:!0,hookFormat:"claude-code"},{id:"cursor",name:"Cursor",skillsDir:".cursor",globalSkillsDir:".cursor",openspecToolId:"cursor",rulesDir:"rules",rulesFormat:"mdc"},{id:"codex",name:"Codex",skillsDir:".agents",globalSkillsDir:".agents",legacySkillsDirs:[".codex"],configDir:".codex",detectionPaths:[".codex"],openspecToolId:"codex",openspecSkillsDir:".agents",rulesBaseDir:".codex",rulesDir:"rules",rulesFormat:"md",supportsHooks:!0,hookFormat:"claude-code",hookConfigFile:"hooks.json",legacyHookConfigFiles:["settings.local.json"]},{id:"opencode",name:"OpenCode",skillsDir:".opencode",globalSkillsDir:".config/opencode",openspecToolId:"opencode",rulesDir:"rules",rulesFormat:"md"},{id:"windsurf",name:"Devin Desktop (formerly Windsurf)",skillsDir:".devin",globalSkillsDir:".devin",legacySkillsDirs:[".windsurf"],legacyConfigDirs:[".windsurf"],openspecToolId:"windsurf",rulesDir:"rules",rulesFormat:"md",supportsHooks:!0,hookFormat:"windsurf"},{id:"cline",name:"Cline",skillsDir:".cline",globalSkillsDir:".cline",openspecToolId:"cline",rulesBaseDir:"",rulesDir:".clinerules",rulesFormat:"md"},{id:"roocode",name:"RooCode",skillsDir:".roo",globalSkillsDir:".roo",openspecToolId:"roocode",rulesDir:"rules",rulesFormat:"md"},{id:"continue",name:"Continue",skillsDir:".continue",globalSkillsDir:".continue",openspecToolId:"continue",rulesDir:"rules",rulesFormat:"md"},{id:"github-copilot",name:"GitHub Copilot",skillsDir:".github",globalSkillsDir:".github",detectionPaths:[".github/copilot-instructions.md",".github/instructions",".github/prompts",".github/skills"],openspecToolId:"github-copilot",rulesDir:"instructions",rulesFormat:"copilot",supportsHooks:!0,hookFormat:"copilot"},{id:"gemini",name:"Gemini CLI",skillsDir:".gemini",globalSkillsDir:".gemini",openspecToolId:"gemini",supportsHooks:!0,hookFormat:"gemini"},{id:"grok",name:"Grok",skillsDir:".grok",globalSkillsDir:".grok",detectionPaths:[".grok"],openspecToolId:"codex",openspecMirrorFrom:"codex",rulesDir:"rules",rulesFormat:"md",supportsHooks:!0,hookFormat:"claude-code",hookConfigFile:"hooks/comet.json",hookMatcher:"Write|Edit|write|search_replace"},{id:"amazon-q",name:"Amazon Q Developer",skillsDir:".amazonq",globalSkillsDir:".amazonq",openspecToolId:"amazon-q",rulesDir:"rules",rulesFormat:"md",supportsHooks:!0,hookFormat:"claude-code"},{id:"qwen",name:"Qwen Code",skillsDir:".qwen",globalSkillsDir:".qwen",openspecToolId:"qwen",rulesDir:"rules",rulesFormat:"md",supportsHooks:!0,hookFormat:"qwen"},{id:"kilocode",name:"Kilo Code",skillsDir:".kilocode",globalSkillsDir:".kilocode",openspecToolId:"kilocode",rulesDir:"rules",rulesFormat:"md"},{id:"auggie",name:"Auggie (Augment CLI)",skillsDir:".augment",globalSkillsDir:".augment",openspecToolId:"auggie",rulesDir:"rules",rulesFormat:"md"},{id:"kiro",name:"Kiro",skillsDir:".kiro",globalSkillsDir:".kiro",openspecToolId:"kiro",rulesDir:"steering",rulesFormat:"md",supportsHooks:!0,hookFormat:"kiro"},{id:"kimicode",name:"Kimi Code",skillsDir:".kimi-code",globalSkillsDir:".kimi-code",openspecToolId:"kimi"},{id:"minimax-code",name:"MiniMax Code",skillsDir:".minimax",globalSkillsDir:".minimax",openspecToolId:"claude",openspecMirrorFrom:"claude"},{id:"lingma",name:"Lingma",skillsDir:".lingma",globalSkillsDir:".lingma",openspecToolId:"lingma",rulesDir:"rules",rulesFormat:"md"},{id:"junie",name:"Junie",skillsDir:".junie",openspecToolId:"junie"},{id:"codebuddy",name:"CodeBuddy",skillsDir:".codebuddy",globalSkillsDir:".codebuddy",openspecToolId:"codebuddy",supportsHooks:!0,hookFormat:"codebuddy",rulesDir:"rules",rulesFormat:"md"},{id:"workbuddy",name:"WorkBuddy",skillsDir:".workbuddy",globalSkillsDir:".workbuddy",openspecToolId:"codebuddy",openspecMirrorFrom:"codebuddy",supportsHooks:!0,hookFormat:"codebuddy"},{id:"costrict",name:"CoStrict",skillsDir:".cospec",openspecToolId:"costrict"},{id:"crush",name:"Crush",skillsDir:".crush",openspecToolId:"crush"},{id:"factory",name:"Factory Droid",skillsDir:".factory",openspecToolId:"factory"},{id:"iflow",name:"iFlow",skillsDir:".iflow",openspecToolId:"iflow"},{id:"pi",name:"Pi",skillsDir:".pi",globalSkillsDir:".pi/agent",openspecToolId:"pi"},{id:"prime-agent",name:"Prime Agent",skillsDir:".prime/agent",globalSkillsDir:".prime/agent",openspecToolId:"claude",openspecMirrorFrom:"claude",supportsHooks:!1},{id:"oh-my-pi",name:"Oh My Pi",skillsDir:".omp",globalSkillsDir:".omp/agent",openspecToolId:"oh-my-pi",rulesDir:"rules",rulesFormat:"mdc",supportsHooks:!0,supportsGlobalHooks:!0,hookFormat:"omp"},{id:"qoder",name:"Qoder",skillsDir:".qoder",globalSkillsDir:".qoder",openspecToolId:"qoder",rulesDir:"rules",rulesFormat:"md",supportsHooks:!0,hookFormat:"qoder"},{id:"antigravity",name:"Antigravity",skillsDir:".agents",globalSkillsDir:".gemini/antigravity",openspecToolId:"antigravity"},{id:"antigravity2",name:"Antigravity 2.0",skillsDir:".agents",globalSkillsDir:".gemini/config",openspecToolId:"antigravity"},{id:"bob",name:"Bob Shell",skillsDir:".bob",openspecToolId:"bob"},{id:"forgecode",name:"ForgeCode",skillsDir:".forge",openspecToolId:"forgecode"},{id:"trae",name:"Trae",skillsDir:".trae",globalSkillsDir:".trae",openspecToolId:"trae",rulesDir:"rules",rulesFormat:"md",supportsHooks:!0,hookFormat:"trae"},{id:"trae-cn",name:"Trae CN",skillsDir:".trae-cn",globalSkillsDir:".trae-cn",configDir:".trae",globalConfigDir:".trae-cn",openspecToolId:"trae",rulesDir:"rules",rulesFormat:"md",supportsHooks:!0,hookFormat:"trae"},{id:"zcode",name:"ZCode",skillsDir:".zcode",globalSkillsDir:".zcode",globalConfigDir:".zcode/cli",openspecToolId:"opencode",openspecMirrorFrom:"opencode",rulesDir:"rules",rulesFormat:"md",supportsHooks:!0,supportsGlobalHooks:!0,hookFormat:"zcode",supportsProjectHooks:!1},{id:"mimocode",name:"MimoCode",skillsDir:".mimocode",globalSkillsDir:".config/mimocode",openspecToolId:"opencode",openspecMirrorFrom:"opencode",rulesDir:"rules",rulesFormat:"md"},{id:"dsh",name:"DeepSeek Harness",skillsDir:".dsh",globalSkillsDir:".dsh",openspecToolId:"claude",rulesFormat:"dsh",supportsHooks:!0,supportsGlobalHooks:!0,hookFormat:"dsh",hookConfigFile:"hooks.json",hookMatcher:"write|edit"}];var fm=zn(xn(),1),Ua=[{id:"en",label:"English"},{id:"zh-CN",label:"Simplified Chinese"}];function dm(){return Ua.map(t=>t.id).join(" | ")}function Ya(t){let e=t??"en",n=Ua.find(r=>r.id===e);if(!n)throw new Error(`Invalid artifact language: '${e}'. Valid values: ${dm()}`);return n}import{promises as X}from"fs";import I from"path";import{AsyncLocalStorage as ym}from"node:async_hooks";import{constants as we,promises as B}from"fs";import{createHash as mm}from"node:crypto";function ge(t){return t!==0&&t!==0n&&t!=="0"}function Va(t,e){return ge(t.dev)&&ge(e.dev)&&ge(t.ino)&&ge(e.ino)}function Be(t,e){let n=ge(t.dev)&&ge(e.dev);if(n&&t.dev!==e.dev)return!1;let r=ge(t.ino)&&ge(e.ino);return r&&t.ino!==e.ino?!1:n&&r?!0:t.birthtime===e.birthtime}var z=class extends Error{reason;constructor(e,n,r){super(n,r),this.name="RaceSafeReadError",this.reason=e}};function Ii(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Tn(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function ke(t){return{dev:t.dev,ino:t.ino,birthtime:Ii(t)}}function pm(t,e){let n=ke(t),r=ke(e);return Va(n,r)?Be(n,r):Be(n,r)&&Ii(t)===Ii(e)&&Tn(t)===Tn(e)&&t.size===e.size}function ye(t,e){let n=r=>"mtimeNs"in r?r.mtimeNs:r.mtimeMs;return pm(t,e)&&t.size===e.size&&t.mode===e.mode&&n(t)===n(e)&&Tn(t)===Tn(e)}async function Ga(t,e,n={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let r=n.label??"file",i=n.bigint===!0,o=await B.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new z("not-regular-file",`${r} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new z("too-large",`${r} exceeds ${e} bytes`);let s=await B.realpath(t);await n.verify?.("pre-open",{realPath:s,identity:ke(o)});let a=process.platform==="win32"?we.O_RDONLY:we.O_RDONLY|we.O_NOFOLLOW|we.O_NONBLOCK,l;try{l=await B.open(t,a)}catch(c){throw c.code==="ELOOP"?new z("not-regular-file",`${r} must be a regular file`,{cause:c}):c}try{let[c,p,f]=await Promise.all([l.stat({bigint:i}),B.lstat(t,{bigint:i}),B.realpath(t)]);if(!c.isFile()||!p.isFile()||p.isSymbolicLink()||f!==s||!ye(o,c)||!ye(o,p))throw new z("changed",`${r} changed while opening`);await n.verify?.("post-open",{realPath:f,identity:ke(c)}),await n.hooks?.afterOpen?.();let u=[],m=0,g=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let y=e+1-m,{bytesRead:v}=await l.read(g,0,Math.min(g.length,y),null);if(v===0)break;if(m+=v,m>e)throw new z("too-large",`${r} exceeds ${e} bytes`);u.push(Buffer.from(g.subarray(0,v)))}await n.hooks?.beforeFinalCheck?.();let[d,h,w]=await Promise.all([l.stat({bigint:i}),B.lstat(t,{bigint:i}),B.realpath(t)]);if(!h.isFile()||h.isSymbolicLink()||w!==s||!ye(o,d)||!ye(o,h))throw new z("changed",`${r} changed while reading`);return await n.verify?.("post-read",{realPath:w,identity:ke(d)}),{bytes:Buffer.concat(u,m),stat:d,realPath:w}}finally{await l.close()}}async function Qa(t,e={}){let n=e.label??"file",r=e.bigint===!0,i=await B.lstat(t,{bigint:r});if(!i.isFile()||i.isSymbolicLink())throw new z("not-regular-file",`${n} must be a regular file`);let o=await B.realpath(t);await e.verify?.("pre-open",{realPath:o,identity:ke(i)});let s=process.platform==="win32"?we.O_RDONLY:we.O_RDONLY|we.O_NOFOLLOW|we.O_NONBLOCK,a;try{a=await B.open(t,s)}catch(l){throw l.code==="ELOOP"?new z("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,c,p]=await Promise.all([a.stat({bigint:r}),B.lstat(t,{bigint:r}),B.realpath(t)]);if(!l.isFile()||!c.isFile()||c.isSymbolicLink()||p!==o||!ye(i,l)||!ye(i,c))throw new z("changed",`${n} changed while opening`);await e.verify?.("post-open",{realPath:p,identity:ke(l)}),await e.hooks?.afterOpen?.();let f=mm(e.algorithm??"sha256"),u=Buffer.allocUnsafe(64*1024);for(;;){let{bytesRead:h}=await a.read(u,0,u.length,null);if(h===0)break;f.update(u.subarray(0,h))}await e.hooks?.beforeFinalCheck?.();let[m,g,d]=await Promise.all([a.stat({bigint:r}),B.lstat(t,{bigint:r}),B.realpath(t)]);if(!g.isFile()||g.isSymbolicLink()||d!==o||!ye(i,m)||!ye(i,g))throw new z("changed",`${n} changed while reading`);return await e.verify?.("post-read",{realPath:d,identity:ke(m)}),{digest:f.digest("hex"),stat:m,realPath:d}}finally{await a.close()}}import Xa from"path";var Ae=zn(xn(),1),Oi=Number.MAX_SAFE_INTEGER;var hm={en:{schema:"# Configuration schema used by Comet. Do not edit this value.",default_workflow:"# Default workflow entered by /comet. Must also appear in workflows.",workflows:"# Workflows enabled in this project: native, classic, or both.",change_walkthrough:`# Generate a standalone HTML change walkthrough for Native and Classic. Enabling it uses extra explanation tokens.
|
|
145
|
+
# change_walkthrough: true | false (default: true)`,ambient_resume:`# Enables automatic recovery through the read-only Ambient Resume probe for both Native and Classic. Set false to disable it.
|
|
146
|
+
# ambient_resume: true | false`,memory:"# Project policy for automatic personal-memory learning and retrieval.","memory.learning":`# Allows workflow events in this project to form new personal memories automatically.
|
|
147
|
+
# learning: true | false`,"memory.retrieval":`# Allows personal memories to be injected into Agent context for this project.
|
|
148
|
+
# retrieval: true | false`,knowledge:"# Project knowledge retrieval provider used by ordinary Comet tasks.","knowledge.provider":`# Provider for project knowledge.
|
|
149
|
+
# provider: local | remote`,"knowledge.local":"# Additional project-relative Markdown globs used by the local provider.","knowledge.local.include":"# One project-relative Markdown glob per list item; appended to the built-in corpus.","knowledge.local.max_file_mb":"# Maximum size in MB for one local Markdown document. Increase it for long specifications or verification reports.","knowledge.local.max_total_mb":"# Maximum total size in MB of the local Markdown retrieval corpus.","knowledge.remote":"# Fixed Comet Retrieval API v1 settings used when provider is remote.","knowledge.remote.endpoint":"# HTTPS endpoint; loopback HTTP is allowed.","knowledge.remote.token_env":"# Optional environment variable containing the bearer token.","knowledge.remote.scope":"# Optional opaque remote knowledge scope.","knowledge.remote.timeout_ms":"# Remote request timeout in milliseconds (100-30000).",hook:"# Hook write policy shared by Native and Classic. Paths are project-relative.","hook.allow_paths":"# Project-relative directories allowed during guarded phases. Use one path per list item; empty by default.",native:"# Native workflow settings. They do not change Classic state or behavior.","native.artifact_root":"# Root directory where Native stores Comet specs and changes. Runtime data stays under .comet.","native.language":`# Artifact language used by Native workflow documents.
|
|
150
|
+
# language: en | zh-CN`,"native.clarification_mode":`# Controls how Native asks clarifying questions: batch asks every currently answerable question per round (default), sequential asks one at a time.
|
|
151
|
+
# clarification_mode: batch | sequential`,"native.archive_confirmation":`# Controls whether Native archives automatically after a successful preview or waits for explicit user confirmation.
|
|
152
|
+
# archive_confirmation: automatic | required`,"native.max_verify_failures":"# Maximum failed Verify outcomes allowed for one confirmed acceptance target before Native stops the completion loop.","native.max_parallel_children":"# Maximum dispatched Supervisor children awaiting integration and archive. Defaults to 2; single-session always uses 1. Changes apply at the next dispatch.","native.document_writes":`# Controls documentation file writes during Shape, Verify, and Archive: allow treats them as neutral instead of returning the change to Build, revert restores the strict behavior.
|
|
153
|
+
# document_writes: allow | revert`,"native.finish":"# Optional repository-owned finish providers. Native keeps commit, push, generic remote verification, and recovery ownership.",classic:"# Classic workflow settings. They do not change Native state or behavior.","classic.artifact_layout":`# Selects the Classic artifact layout. The default is docs; update preserves detected root-level legacy artifacts.
|
|
154
|
+
# artifact_layout: legacy | docs`,"classic.language":`# Artifact language used by Classic workflow documents.
|
|
155
|
+
# language: en | zh-CN`,"classic.context_compression":`# Controls beta context compression for new Classic changes.
|
|
156
|
+
# context_compression: off | beta`,"classic.review_mode":`# Sets the default review depth for new Classic changes.
|
|
157
|
+
# review_mode: off | standard | thorough`,"classic.auto_transition":`# Automatically enters the next Classic phase after a phase passes.
|
|
158
|
+
# auto_transition: true | false`,"classic.check_timeout_ms":"# Default check timeout in milliseconds (1-3600000); --timeout-ms overrides it. Default: 300000.","classic.document_evidence":`# Controls how documentation edits affect recorded check evidence: neutral keeps build and verify evidence valid when only documentation files changed, strict binds every working-tree file again.
|
|
159
|
+
# document_evidence: neutral | strict`},"zh-CN":{schema:"# Comet \u4F7F\u7528\u7684\u914D\u7F6E\u683C\u5F0F\u7248\u672C\uFF0C\u8BF7\u52FF\u4FEE\u6539\u6B64\u503C\u3002",default_workflow:"# `/comet` \u9ED8\u8BA4\u8FDB\u5165\u7684\u5DE5\u4F5C\u6D41\uFF1B\u8BE5\u503C\u4E5F\u5FC5\u987B\u51FA\u73B0\u5728 workflows \u4E2D\u3002",workflows:"# \u6B64\u9879\u76EE\u542F\u7528\u7684\u5DE5\u4F5C\u6D41\uFF0C\u53EF\u586B\u5199 native\u3001classic \u6216\u540C\u65F6\u542F\u7528\u4E24\u8005\u3002",change_walkthrough:`# \u662F\u5426\u751F\u6210\u53EF\u76F4\u63A5\u6253\u5F00\u7684 HTML \u53D8\u66F4\u8BF4\u660E\uFF0C\u540C\u65F6\u4F5C\u7528\u4E8E Native \u548C Classic\uFF1B\u5F00\u542F\u4F1A\u589E\u52A0\u8BB2\u89E3\u5185\u5BB9\u7684 token \u6D88\u8017\u3002
|
|
160
|
+
# change_walkthrough: true | false\uFF08\u9ED8\u8BA4 true\uFF09`,ambient_resume:`# \u662F\u5426\u542F\u7528\u53EA\u8BFB\u7684\u73AF\u5883\u611F\u77E5\u6062\u590D\u63A2\u9488\uFF0C\u540C\u65F6\u4F5C\u7528\u4E8E Native \u548C Classic\uFF1B\u8BBE\u4E3A false \u53EF\u5173\u95ED\u81EA\u52A8\u5DE5\u4F5C\u6D41\u6062\u590D\u3002
|
|
161
|
+
# ambient_resume: true | false`,memory:"# \u5F53\u524D\u9879\u76EE\u7684\u4E2A\u4EBA\u8BB0\u5FC6\u81EA\u52A8\u5B66\u4E60\u4E0E\u6CE8\u5165\u7B56\u7565\u3002","memory.learning":`# \u662F\u5426\u5141\u8BB8\u5F53\u524D\u9879\u76EE\u901A\u8FC7\u5DE5\u4F5C\u6D41\u4E8B\u4EF6\u81EA\u52A8\u6C89\u6DC0\u65B0\u7684\u4E2A\u4EBA\u8BB0\u5FC6\u3002
|
|
162
|
+
# \u53EF\u9009\u503C\uFF1Atrue | false`,"memory.retrieval":`# \u662F\u5426\u5141\u8BB8\u5F53\u524D\u9879\u76EE\u628A\u4E2A\u4EBA\u8BB0\u5FC6\u81EA\u52A8\u6CE8\u5165 Agent \u4E0A\u4E0B\u6587\u3002
|
|
163
|
+
# \u53EF\u9009\u503C\uFF1Atrue | false`,knowledge:"# \u666E\u901A Comet \u4EFB\u52A1\u4F7F\u7528\u7684\u9879\u76EE\u77E5\u8BC6\u68C0\u7D22 Provider\u3002","knowledge.provider":`# \u9879\u76EE\u77E5\u8BC6 Provider\u3002
|
|
164
|
+
# \u53EF\u9009\u503C\uFF1Alocal | remote`,"knowledge.local":"# Local Provider \u989D\u5916\u52A0\u8F7D\u7684\u9879\u76EE\u76F8\u5BF9 Markdown \u8DEF\u5F84\u3002","knowledge.local.include":"# \u6BCF\u9879\u586B\u5199\u4E00\u4E2A\u9879\u76EE\u76F8\u5BF9 Markdown glob\uFF1B\u4F1A\u8FFD\u52A0\u5230\u5185\u7F6E\u8BED\u6599\u3002","knowledge.local.max_file_mb":"# \u5355\u4E2A\u672C\u5730 Markdown \u6587\u6863\u5141\u8BB8\u53C2\u4E0E\u68C0\u7D22\u7684\u6700\u5927 MB \u6570\uFF1B\u8F83\u957F\u7684\u89C4\u683C\u6216\u9A8C\u8BC1\u62A5\u544A\u53EF\u6309\u9700\u63D0\u9AD8\u3002","knowledge.local.max_total_mb":"# \u672C\u5730 Markdown \u68C0\u7D22\u8BED\u6599\u5141\u8BB8\u8BFB\u53D6\u7684\u603B MB \u6570\u3002","knowledge.remote":"# provider \u4E3A remote \u65F6\u4F7F\u7528\u7684\u56FA\u5B9A Comet Retrieval API v1 \u914D\u7F6E\u3002","knowledge.remote.endpoint":"# HTTPS \u5730\u5740\uFF1Bloopback \u5730\u5740\u5141\u8BB8\u4F7F\u7528 HTTP\u3002","knowledge.remote.token_env":"# \u53EF\u9009\u7684 Bearer Token \u73AF\u5883\u53D8\u91CF\u540D\u3002","knowledge.remote.scope":"# \u53EF\u9009\u7684\u4E0D\u900F\u660E\u8FDC\u7AEF\u77E5\u8BC6\u5E93\u8303\u56F4\u3002","knowledge.remote.timeout_ms":"# \u8FDC\u7AEF\u8BF7\u6C42\u8D85\u65F6\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF0C100-30000\uFF09\u3002",hook:"# Native \u548C Classic \u5171\u4EAB\u7684 Hook \u5199\u5165\u7B56\u7565\uFF1B\u8DEF\u5F84\u5FC5\u987B\u662F\u9879\u76EE\u76F8\u5BF9\u8DEF\u5F84\u3002","hook.allow_paths":"# \u5728\u53D7\u4FDD\u62A4\u9636\u6BB5\u5141\u8BB8\u5199\u5165\u7684\u9879\u76EE\u76F8\u5BF9\u76EE\u5F55\uFF1B\u6BCF\u9879\u586B\u5199\u4E00\u4E2A\u76EE\u5F55\uFF0C\u9ED8\u8BA4\u4E3A\u7A7A\u3002",native:"# Native \u5DE5\u4F5C\u6D41\u914D\u7F6E\uFF0C\u4E0D\u4F1A\u6539\u53D8 Classic \u7684\u72B6\u6001\u6216\u884C\u4E3A\u3002","native.artifact_root":"# Native \u89C4\u683C\u548C change \u7684\u5B58\u653E\u6839\u76EE\u5F55\uFF1B\u8FD0\u884C\u65F6\u6570\u636E\u59CB\u7EC8\u4F4D\u4E8E .comet\u3002","native.language":`# Native \u5DE5\u4F5C\u6D41\u6587\u6863\u4F7F\u7528\u7684\u4EA7\u7269\u8BED\u8A00\u3002
|
|
165
|
+
# \u53EF\u9009\u503C\uFF1Aen | zh-CN`,"native.clarification_mode":`# Native \u63D0\u95EE\u6F84\u6E05\u95EE\u9898\u7684\u65B9\u5F0F\uFF1Abatch \u6BCF\u8F6E\u4E00\u6B21\u63D0\u51FA\u5F53\u524D\u6240\u6709\u53EF\u56DE\u7B54\u7684\u95EE\u9898\uFF08\u9ED8\u8BA4\uFF09\uFF0Csequential \u6BCF\u8F6E\u53EA\u95EE\u4E00\u4E2A\u3002
|
|
166
|
+
# \u53EF\u9009\u503C\uFF1Abatch | sequential`,"native.archive_confirmation":`# Native \u5F52\u6863\u68C0\u67E5\u6210\u529F\u540E\u81EA\u52A8\u5F52\u6863\uFF0C\u6216\u7B49\u5F85\u7528\u6237\u660E\u786E\u786E\u8BA4\u3002
|
|
167
|
+
# \u53EF\u9009\u503C\uFF1Aautomatic | required`,"native.max_verify_failures":"# \u540C\u4E00\u4E2A\u5DF2\u786E\u8BA4\u9A8C\u6536\u76EE\u6807\u6700\u591A\u5141\u8BB8\u7684 Verify \u5931\u8D25\u6B21\u6570\uFF1B\u8FBE\u5230\u4E0A\u9650\u540E\u505C\u6B62\u5B8C\u6210\u5FAA\u73AF\u3002","native.max_parallel_children":"# Supervisor \u5DF2\u6D3E\u53D1\u4E14\u5C1A\u672A\u5B8C\u6210\u96C6\u6210\u5F52\u6863\u7684\u5B50\u4EFB\u52A1\u4E0A\u9650\uFF1B\u9ED8\u8BA4 2\uFF0Csingle-session \u56FA\u5B9A\u4E3A 1\uFF1B\u8C03\u6574\u4ECE\u4E0B\u4E00\u8F6E\u6D3E\u53D1\u751F\u6548\u3002","native.document_writes":`# Shape\u3001Verify \u548C Archive \u9636\u6BB5\u7684\u6587\u6863\u7C7B\u5199\u5165\u5904\u7406\u65B9\u5F0F\uFF1Aallow \u89C6\u4E3A\u4E2D\u6027\u5199\u5165\u3001\u4E0D\u518D\u628A change \u6253\u56DE Build\uFF0Crevert \u6062\u590D\u4E25\u683C\u884C\u4E3A\u3002
|
|
168
|
+
# \u53EF\u9009\u503C\uFF1Aallow | revert`,"native.finish":"# \u53EF\u9009\u7684\u4ED3\u5E93\u81EA\u6709\u6536\u5C3E provider\uFF1B\u63D0\u4EA4\u3001\u63A8\u9001\u3001\u901A\u7528\u8FDC\u7AEF\u6838\u9A8C\u548C\u6062\u590D\u4ECD\u7531 Native \u8D1F\u8D23\u3002",classic:"# Classic \u5DE5\u4F5C\u6D41\u914D\u7F6E\uFF0C\u4E0D\u4F1A\u6539\u53D8 Native \u7684\u72B6\u6001\u6216\u884C\u4E3A\u3002","classic.artifact_layout":`# Classic \u4EA7\u7269\u5E03\u5C40\uFF1B\u9ED8\u8BA4\u4F7F\u7528 docs\uFF0Cupdate \u68C0\u6D4B\u5230\u6839\u76EE\u5F55 legacy \u4EA7\u7269\u65F6\u4E88\u4EE5\u4FDD\u7559\u3002
|
|
169
|
+
# \u53EF\u9009\u503C\uFF1Alegacy | docs`,"classic.language":`# Classic \u5DE5\u4F5C\u6D41\u6587\u6863\u4F7F\u7528\u7684\u4EA7\u7269\u8BED\u8A00\u3002
|
|
170
|
+
# \u53EF\u9009\u503C\uFF1Aen | zh-CN`,"classic.context_compression":`# \u65B0\u5EFA Classic change \u662F\u5426\u542F\u7528 beta \u4E0A\u4E0B\u6587\u538B\u7F29\u3002
|
|
171
|
+
# \u53EF\u9009\u503C\uFF1Aoff | beta`,"classic.review_mode":`# \u65B0\u5EFA Classic change \u9ED8\u8BA4\u4F7F\u7528\u7684\u5BA1\u67E5\u6DF1\u5EA6\u3002
|
|
172
|
+
# \u53EF\u9009\u503C\uFF1Aoff | standard | thorough`,"classic.auto_transition":`# Classic \u9636\u6BB5\u901A\u8FC7\u540E\u662F\u5426\u81EA\u52A8\u8FDB\u5165\u4E0B\u4E00\u9636\u6BB5\u3002
|
|
173
|
+
# \u53EF\u9009\u503C\uFF1Atrue | false`,"classic.check_timeout_ms":"# \u68C0\u67E5\u547D\u4EE4\u9ED8\u8BA4\u8D85\u65F6\uFF0C\u5355\u4F4D\u6BEB\u79D2\uFF0C\u8303\u56F4 1-3600000\uFF0C\u7F3A\u7701\u4E3A 300000\uFF1B\u547D\u4EE4\u884C --timeout-ms \u4F18\u5148\u3002","classic.document_evidence":`# \u6587\u6863\u7F16\u8F91\u5BF9\u5DF2\u8BB0\u5F55\u68C0\u67E5\u8BC1\u636E\u7684\u5F71\u54CD\uFF1Aneutral \u5728\u53EA\u6709\u6587\u6863\u6587\u4EF6\u53D8\u5316\u65F6\u4FDD\u6301 build \u548C verify \u8BC1\u636E\u6709\u6548\uFF0Cstrict \u91CD\u65B0\u7ED1\u5B9A\u5DE5\u4F5C\u533A\u7684\u5168\u90E8\u6587\u4EF6\u3002
|
|
174
|
+
# \u53EF\u9009\u503C\uFF1Aneutral | strict`}};function H(t,e){return hm[e][t]}function Ni(t,e,n=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim().replaceAll("\\","/");if(r.length===0||Xa.posix.isAbsolute(r)||Xa.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be relative to its declared path base`);let i=r.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!n&&/[*?]/u.test(r))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}import{AsyncLocalStorage as gm}from"node:async_hooks";var wm=new gm;function Za(){let t=wm.getStore();return t?.active?t:null}function el(t,e){let n=t;for(let r of e)n+="\0"+(typeof r=="string"?r:JSON.stringify(r));return n}function bt(t,e){return(...n)=>{let r=Za();if(r===null)return e(...n);let i=el(`async:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n).catch(a=>{throw r.entries.get(i)?.value===s&&r.entries.delete(i),a});return r.entries.set(i,{value:s}),s}}function tl(t,e){return(...n)=>{let r=Za();if(r===null)return e(...n);let i=el(`sync:${t}`,n),o=r.entries.get(i);if(o)return o.value;let s=e(...n);return r.entries.set(i,{value:s}),s}}var km=new ym;async function nl(t,e,n={}){let r=I.resolve(t),i=await ol(r,e),o=new Map,s=!1,a=u=>[u.dev,u.ino,u.mode,u.birthtimeNs,u.mtimeNs,u.ctimeNs].join(":"),l=u=>[u.dev,u.ino,u.mode,u.birthtimeNs].join(":"),c=async(u,m)=>JSON.stringify((await X.readdir(u,{withFileTypes:!0})).filter(g=>!m(g)).map(g=>[g.name,g.isDirectory(),g.isSymbolicLink()]).sort((g,d)=>String(g[0]).localeCompare(String(d[0]),"en"))),p=u=>{let m=o.get(u);return m||(m=(async()=>{let g=await X.lstat(u,{bigint:!0});if(!g.isDirectory()||g.isSymbolicLink())throw new Error(`${e} crosses a symbolic link, junction or invalid directory at ${I.relative(r,u)||"."}`);let d=await X.realpath(u);if(!vt(i,d))throw new Error(`${e} resolves outside the project root`);let h=n.ignoredDirectoryEntries?.(I.relative(r,u).replaceAll("\\","/")||".");return{stat:g,real:d,...h?{ignoreEntry:h,namespace:await c(u,h)}:{}}})(),m=m.catch(g=>{throw o.delete(u),g}),o.set(u,m)),m};await p(r);let f=async u=>{if(s)throw new Error(`${e} read session is already finished`);let m=Ni(u,e),g=r;for(let d of m.split("/").slice(0,-1))g=I.join(g,d),await p(g);return I.resolve(r,...m.split("/"))};return{observePath:f,async observeDirectory(u){let m=await f(u);return await p(m),m},async stat(u){let m=await f(u),g=await X.lstat(m,{bigint:!0});if(!g.isFile()||g.isSymbolicLink())throw new Error(`${e} must be a real file: ${u}`);return{target:m,stat:g}},async hash(u){let m=await f(u);return Qa(m,{bigint:!0,label:`${e} ${u}`,verify:async(g,d)=>{if(!vt(i,d.realPath))throw new Error(`${e} resolves outside the project root`);let h=r,w=[r];for(let y of I.relative(r,I.dirname(m)).split(I.sep).filter(Boolean))h=I.join(h,y),w.push(h);for(let y of w){let v=await o.get(y),k=await X.lstat(y,{bigint:!0});if(!k.isDirectory()||k.isSymbolicLink()||l(k)!==l(v.stat))throw new Error(`${e} directory changed while reading: ${I.relative(r,y)||"."}`)}}})},async read(u,m,g={}){let d=await f(u);return Ga(d,m,{...g,label:`${e} ${u}`,verify:async(h,w)=>{if(!vt(i,w.realPath))throw new Error(`${e} resolves outside the project root`);if(n.deferDirectoryChecks)return;let y=r,v=[r];for(let k of I.relative(r,I.dirname(d)).split(I.sep).filter(Boolean))y=I.join(y,k),v.push(y);for(let k of v){let C=await o.get(k),E=await X.lstat(k,{bigint:!0});if(!E.isDirectory()||E.isSymbolicLink()||l(E)!==l(C.stat))throw new Error(`${e} directory changed while reading: ${I.relative(r,k)||"."}`)}}})},async finish(u={}){if(s)throw new Error(`${e} read session is already finished`);s=!0;let m=[];for(let[g,d]of o){let h=await d,w=await X.lstat(g,{bigint:!0});if(!w.isDirectory()||w.isSymbolicLink()||l(h.stat)!==l(w)||!u.allowDirectoryContentChanges&&a(h.stat)!==a(w)&&(!h.ignoreEntry||await c(g,h.ignoreEntry)!==h.namespace)||await X.realpath(g)!==h.real)throw new Error(`${e} directory changed while observing: ${I.relative(r,g)||"."}`);a(h.stat)!==a(w)&&m.push(I.relative(r,g).replaceAll("\\","/")||".")}return{changedDirectories:m}}}}function bm(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function vt(t,e){let n=I.relative(t,e);return n===""||!I.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${I.sep}`)}var rl=bt("protectedChainLstat",t=>X.lstat(t)),il=bt("protectedChainRealpath",t=>X.realpath(t)),vm=tl("protectedChainInside",vt);async function ol(t,e){let n=I.resolve(t),r=await rl(n);if(!r.isDirectory()||r.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return il(n)}async function Sm(t,e,n,r){let i=t;for(let o=0;o<n.length;o++){i=I.join(i,n[o]);let s;try{s=await rl(i)}catch(c){if(bm(c))return{exists:!1,kind:"missing"};throw c}if(s.isSymbolicLink()){let c=I.relative(t,i).replaceAll("\\","/");throw new Error(`${r.label} crosses a symbolic link or junction at ${c}`)}let a=o===n.length-1;if(!a&&!s.isDirectory()){let c=I.relative(t,i).replaceAll("\\","/");throw new Error(`${r.label} ancestor ${c} must be a real directory`)}if(a&&(r.expected==="file"&&!s.isFile()||r.expected==="directory"&&!s.isDirectory()||r.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${r.label} must be a real ${r.expected}`);let l=await il(i);if(!vm(e,l))throw new Error(`${r.label} resolves outside the project root`);if(a)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function Cm(t,e,n){let r=Ni(e,n.label),i=I.resolve(t),o=await ol(i,n.label),s=r.split("/"),a=I.resolve(i,...s);if(!vt(i,a))throw new Error(`${n.label} must stay inside the project root`);let l=await Sm(i,o,s,n);return{projectRoot:i,target:a,relative:r,exists:l.exists,kind:l.kind}}var eg=bt("protectedInspectPath",(t,e,n)=>Cm(t,e,{label:"Protected project path",expected:n}));async function Em(t,e,n,r){let i=!r.hooks&&!r.bigint?km.getStore():void 0;if(i){let a=I.resolve(t),l=i.get(a);return l||(l=nl(a,r.label,{deferDirectoryChecks:!0}).catch(c=>{throw i.delete(a),c}),i.set(a,l)),(await l).read(e,n,r)}let o=await nl(t,r.label),s=await o.read(e,n,r);return await o.finish({allowDirectoryContentChanges:!0}),s}var Pm="Cached protected project read",tg=bt("protectedReadFile",(t,e,n)=>Em(t,e,n,{label:Pm}));import{promises as Ti}from"node:fs";var _m=new Set(["EPERM","EACCES","EBUSY","ENOTEMPTY"]),xi=[50,100,200];async function Ri(t,e){let n;for(let r=0;r<=xi.length;r+=1)try{return await t()}catch(i){n=i;let o=i.code;if(r===xi.length||!_m.has(o??""))throw i;await new Promise(s=>setTimeout(s,xi[r]))}throw n}async function al(t,e){await Ri(()=>Ti.rename(t,e),`rename ${e}`)}async function ll(t){await Ri(()=>Ti.unlink(t),`unlink ${t}`)}async function Li(t,e){await Ri(()=>Ti.link(t,e),`link ${e}`)}import{randomUUID as Am}from"crypto";import{constants as Im,promises as q}from"fs";import M from"path";async function qi(t,e){try{return await Li(t,e),{linked:!0}}catch(n){let r=n.code;if(r!=="ENOTSUP"&&r!=="EOPNOTSUPP")throw n}return await q.copyFile(t,e,Im.COPYFILE_EXCL),{linked:!1}}function Ie(t,e){let n=M.relative(t,e);return n===""||!M.isAbsolute(n)&&n!==".."&&!n.startsWith(`..${M.sep}`)}function Rn(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Om(t,e){return Be(t,Rn(e))}function Ln(t,e){return Be(Rn(t),Rn(e))}function cl(t,e){return Ln(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function qn(t){let e=await q.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await q.realpath(t),...Rn(e)}}async function re(t){for(let e of t){let n=await q.lstat(e.path);if(!n.isDirectory()||n.isSymbolicLink()||!Om(e,n)||await q.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Nm(t,e,n){let[r,i]=await Promise.all([q.lstat(t),q.realpath(t),re(n)]);if(!r.isFile()||r.isSymbolicLink()||!Ln(r,e)||!Ie(n[0].realPath,i))throw new Error("Contained atomic write temporary file changed after close");return r}async function jm(t,e){let n=await ul(t,e);if(n)return n;let r=M.resolve(t),i=M.resolve(e);if(!Ie(r,i))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let o=[await qn(r)],s=M.relative(r,i).split(M.sep).filter(Boolean),a=r;for(let l of s){await re(o),a=M.join(a,l);try{await q.mkdir(a)}catch(p){if(p.code!=="EEXIST")throw p}let c=await qn(a);if(!Ie(o[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${a}`);o.push(c)}return await re(o),o}async function ul(t,e){let n=M.resolve(t),r=M.resolve(e);if(!Ie(n,r))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await qn(n)],o=M.relative(n,r).split(M.sep).filter(Boolean),s=n;for(let a of o){s=M.join(s,a);try{let l=await qn(s);if(!Ie(i[0].realPath,l.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(l)}catch(l){if(l.code==="ENOENT")return null;throw l}}return await re(i),i}async function fl(t){let e;try{e=await q.open(t,"r"),await e.sync()}catch(n){let r=n.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(r??""))throw n}finally{await e?.close()}}async function dl(t,e,n){let r=M.dirname(t),i=await jm(n.containedRoot,r),o=M.join(r,`.${M.basename(t)}.${Am()}.tmp`),s,a,l;try{await n.beforeTemporaryOpen?.(),s=await q.open(o,"wx"),a=await s.stat();let[c,p]=await Promise.all([q.lstat(o),q.realpath(o)]);if(await re(i),!c.isFile()||c.isSymbolicLink()||!Ln(a,c)||!Ie(i[0].realPath,p))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),l=await s.stat(),!Ln(a,l))throw new Error("Contained atomic write temporary file changed while writing");if(await s.close(),s=void 0,await n.afterTemporaryClose?.(),!l)throw new Error("Contained atomic write temporary file was not written");l=await Nm(o,l,i),await n.beforeCommit?.(),await re(i);let f=await q.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!l||!cl(f,l))throw new Error("Contained atomic write temporary file changed before commit");n.exclusive?(n.requireAtomicPublication?await Li(o,t):await qi(o,t),await q.unlink(o)):await al(o,t),await fl(r)}catch(c){await s?.close();try{await re(i),await q.rm(o,{force:!0})}catch{}throw c}}async function be(t,e,n){await dl(t,e,n)}async function Dn(t,e,n){await dl(t,e,n)}async function ml(t,e){let n=M.dirname(t),r=await ul(e.containedRoot,n);if(!r)return!1;let i,o;try{i=await q.lstat(t),o=await q.realpath(t)}catch(l){if(l.code==="ENOENT")return!1;throw l}if(!i.isFile()||i.isSymbolicLink()||!Ie(r[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await re(r);let[s,a]=await Promise.all([q.lstat(t),q.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!cl(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await ll(t),await re(r),await fl(n),!0}var _g=Number.MAX_SAFE_INTEGER;var $n=zn(xn(),1);var qm="<!-- COMET:DSH:START -->",Dm="<!-- COMET:DSH:END -->";var lw=new RegExp(`${gl(qm)}[\\s\\S]*?${gl(Dm)}`,"u");function gl(t){return t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}var Fm=$m(import.meta.url),Rw=Mm.dirname(Fm);function Wm(t){let e=[],n="",r,i=!1,o=!1;for(let s=0;s<t.length;s++){let a=t[s];if(r){a===r?(r=void 0,o=!0):a==="\\"&&t[s+1]===r?(n+=r,s++):n+=a;continue}if(a==="\r"||a===`
|
|
175
|
+
`||";|&<>`".includes(a))return;if(/\s/u.test(a)){i&&(e.push(n),n="",i=!1,o=!1);continue}if(o)return;if(a==='"'||a==="'"){if(i)return;r=a,i=!0;continue}n+=a,i=!0}if(!r)return i&&e.push(n),e}function Fi(t,e,n){if(typeof t!="string")return!1;let r=a=>a.replace(/\\/g,"/").replace(/\.(?:sh|mjs)$/u,""),i=a=>e.some(l=>r(a).endsWith(`/skills/${r(l.replace(/\\/g,"/"))}`));if(Array.isArray(n)){let a=t.replace(/\\/g,"/").split("/").pop()?.toLowerCase(),l=n[0];return(a==="node"||a==="node.exe")&&typeof l=="string"&&i(l)}let o=eo(t);if(o)return typeof o[0]=="string"&&i(o[0]);let s=Wm(t.trim());return!s||s.length<2||!["node","bash","sh"].includes(s[0])?!1:i(s[1].replace(/\\/g,"/"))}function wl(t,e,n){return[...t.flatMap(i=>{if(!i||typeof i!="object"||Array.isArray(i))return[i];let o=i;if(!Array.isArray(o.hooks))return[o];let s=o.hooks.filter(c=>{let p=c&&typeof c=="object"?c:{};return!Fi(p.command,n,p.args)}),a=s.length!==o.hooks.length,l=Object.keys(o).every(c=>c==="matcher"||c==="hooks");return a&&s.length===0&&l?[]:[{...o,hooks:s}]}),...e]}function Bm(t="en"){let e=Ya(t),n=e.id==="zh-CN"?"zh-CN":"en",r=[{key:"change_walkthrough",def:"true",comment:H("change_walkthrough",n)},{key:"ambient_resume",def:"true",comment:H("ambient_resume",n)}],i=[{key:"artifact_layout",def:"docs",comment:H("classic.artifact_layout",n)},{key:"language",def:e.id,comment:H("classic.language",n)},{key:"context_compression",def:"off",comment:H("classic.context_compression",n)},{key:"review_mode",def:"standard",comment:H("classic.review_mode",n)},{key:"auto_transition",def:"true",comment:H("classic.auto_transition",n)}],o=[{key:"artifact_root",def:"docs",comment:H("native.artifact_root",n)},{key:"language",def:"en",comment:H("native.language",n)},{key:"clarification_mode",def:"batch",comment:H("native.clarification_mode",n)},{key:"archive_confirmation",def:"automatic",comment:H("native.archive_confirmation",n)},{key:"max_verify_failures",def:"5",comment:H("native.max_verify_failures",n)}];return{top:r,native:o,classic:i}}var Lw=Bm();import{promises as Jn}from"node:fs";import N from"node:path";import Gm from"node:os";import{createHash as Qm}from"node:crypto";function Hm(t,e){let n=t.slice(0,e).split(/\r?\n/);return[n.length,n.pop().length+1]}function Km(t,e,n){let r=t.split(/\r?\n/),i="",o=(Math.log10(e+1)|0)+1;for(let s=e-1;s<=e+1;s++){let a=r[s-1];a&&(i+=s.toString().padEnd(o," "),i+=": ",i+=a,i+=`
|
|
176
|
+
`,s===e&&(i+=" ".repeat(o+n+2),i+=`^
|
|
177
|
+
`))}return i}var P=class t extends Error{line;column;codeblock;constructor(e,n){let[r,i]=Hm(n.toml,n.ptr),o=Km(n.toml,r,i);super(`Invalid TOML document: ${e}
|
|
178
|
+
|
|
179
|
+
${o}`,n),this.line=r,this.column=i,this.codeblock=o}static x(e,n,r){throw new t(e,{toml:n.s,ptr:r??n.p})}};function Fn(t){let e=t.p,n=t.s.charCodeAt(t.p++),r=n,i=n===39,o=n===t.s.charCodeAt(t.p)&&n===t.s.charCodeAt(t.p+1);o&&((n=t.s.charCodeAt(t.p+=2))===10?t.p++:n===13&&t.s.charCodeAt(t.p+1)===10&&(t.p+=2));let s="",a=t.p,l=0;for(;t.p<t.s.length;t.p++)if(n=t.s.charCodeAt(t.p),o&&(n===10||n===13&&t.s.charCodeAt(t.p+1)===10))l=l&&3;else if(n<32&&n!==9||n===127)P.x("control characters are not allowed in strings",t);else if((!l||l===3)&&n===r&&(!o||t.s.charCodeAt(t.p+1)===r&&t.s.charCodeAt(t.p+2)===r)){if(o&&(t.s.charCodeAt(t.p+3)===r&&t.p++,t.s.charCodeAt(t.p+3)===r&&t.p++),!l){let c=t.s.slice(a,t.p);s=s?s+c:c}return t.p+=o?3:1,s}else if(!l)!i&&n===92&&(s+=t.s.slice(a,a=t.p),l=1);else if(l===1)if(n===120||n===117||n===85){let c=t.p++-1,p=0,f=n===120?2:n===117?4:8;for(let u=0;u<f;u++,t.p++){let m=t.s.charCodeAt(t.p),g=m>=48&&m<=57?m-48:m>=65&&m<=70?m-65+10:m>=97&&m<=102?m-97+10:-1;g<0&&P.x("invalid non-hex character in unicode escape",t),p=p<<4|g}(p<0||p>1114111||p>=55296&&p<=57343)&&P.x("invalid unicode escape",t,c),s+=String.fromCodePoint(p),a=t.p--,l=0}else o&&(n===32||n===9)?l=2:(n===98?s+="\b":n===116?s+=" ":n===110?s+=`
|
|
180
|
+
`:n===102?s+="\f":n===114?s+="\r":n===101?s+="\x1B":n===34?s+='"':n===92?s+="\\":P.x("unrecognised escape sequence",t),a=t.p+1,l=0);else n!==32&&n!==9&&(l===2&&P.x("invalid escape: only line-ending whitespace may be escaped",t,a),l=!i&&n===92?1:0,a=t.p);P.x("unfinished string",t,e)}var Jm=/^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i,St=class t extends Date{#t=!1;#n=!1;#e=null;constructor(e,n,r){let i=!0,o=!0,s="Z",a;if(typeof e=="string")if(n)e:{if(n<3){if(+e.slice(11,13)>23){e="";break e}n===2?(s=null,e+="Z"):(a=e.charCodeAt(e.length-1))!==90&&a!==122&&(s=e.slice(e.length-6)),r&&(e=e.slice(0,10)+"T"+e.slice(11))}else n===4&&(e=+e.slice(0,2)>23?"":`0000-01-01T${e}Z`);i=n!==4,o=n!==3}else{let l=e.match(Jm);l?(l[1]||(i=!1,e=`0000-01-01T${e}`),o=!!l[2],o&&e[10]===" "&&(e=e.replace(" ","T")),l[2]&&+l[2]>23?e="":(s=l[3]||null,!s&&o&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=i,this.#n=o,this.#e=s)}isDateTime(){return this.#t&&this.#n}isLocal(){return!this.#t||!this.#n||!this.#e}isDate(){return this.#t&&!this.#n}isTime(){return this.#n&&!this.#t}isValid(){return this.#t||this.#n}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z"||this.#e==="z")return e;let n=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return n=this.#e[0]==="-"?n:-n,new Date(this.getTime()-n*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,n="Z"){let r=new t(e);return r.#e=n,r}static wrapAsLocalDateTime(e){let n=new t(e);return n.#e=null,n}static wrapAsLocalDate(e){let n=new t(e);return n.#n=!1,n.#e=null,n}static wrapAsLocalTime(e){let n=new t(e);return n.#t=!1,n.#e=null,n}};function K(t,e=10){return e===16?t>47&&t<58||t>64&&t<71||t>96&&t<103:t>47&&t<48+e}function Bi(t,e){return t===32||t===9||t===10||t===13||e&&(t===e||t===44)||t===35}function Et(t,e){let n=t.p,r=t.s.charCodeAt(t.p);if(r===91||r===123){t.d--||P.x("document contains excessively nested structures. aborting.",t);let i=r===91?bl(t):kl(t);return t.d++,i}return r===34||r===39?Fn(t):r===116?((t.s.charCodeAt(++t.p)!==114||t.s.charCodeAt(++t.p)!==117||t.s.charCodeAt(++t.p)!==101)&&P.x("invalid value",t,n),t.p++,!0):r===102?((t.s.charCodeAt(++t.p)!==97||t.s.charCodeAt(++t.p)!==108||t.s.charCodeAt(++t.p)!==115||t.s.charCodeAt(++t.p)!==101)&&P.x("invalid value",t,n),t.p++,!1):r===43||r===45?Wn(t,t.p,t.s.charCodeAt(++t.p),44-r,e):t.s.charCodeAt(t.p+4)===45&&t.s.charCodeAt(t.p+7)===45?zm(t,r,e):t.s.charCodeAt(t.p+2)===58?Um(t,r,e):Wn(t,t.p,r,0,e)}function Wn(t,e,n,r,i){let o=n,s=0,a=!1;if(o===105)return(t.s.charCodeAt(++t.p)!==110||t.s.charCodeAt(++t.p)!==102)&&P.x("invalid value",t,e),t.p++,(r||1)/0;if(o===110)return(t.s.charCodeAt(++t.p)!==97||t.s.charCodeAt(++t.p)!==110)&&P.x("invalid value",t,e),t.p++,NaN;if(o===48){if(++t.p>=t.s.length||Bi(o=t.s.charCodeAt(t.p),i))return t.bi===!0?0n:0;if(!r){if(o===120)return Wi(t,e,16,i);if(o===98)return Wi(t,e,2,i);if(o===111)return Wi(t,e,8,i)}o===46?s=2:o===101||o===69?s=4:P.x("illegal leading zero",t,e)}else K(o)||P.x("invalid value",t,e);for(;++t.p<t.s.length&&(o=t.s.charCodeAt(t.p),!Bi(o,i));)s||(s=1),o===95?(s&1||P.x("illegal underscore",t),s+=11,a=!0):s===1&&o===46?s=2:(s===1||s===3)&&(o===101||o===69)?s=4:s===4&&(o===43||o===45)?s=6:K(o)?s>9?s-=11:s&1||s++:P.x("illegal character in numeric literal",t);if(!s){let c=(n-48)*(r||1);return t.bi===!0?BigInt(c):c}s&1||P.x("unfinished numeric value",t,e);let l=t.s.slice(e,t.p);return a&&(l=l.replaceAll("_","")),s>1?parseFloat(l):yl(t,l,10,e)}function Wi(t,e,n,r){let i,o=1;for(;++t.p<t.s.length&&(i=t.s.charCodeAt(t.p),!Bi(i,r));)i===95?(o&1&&P.x("illegal underscore",t),o=3):K(i,n)?o&1&&o--:P.x("illegal character in numeric literal",t);o&1&&P.x("unfinished numeric value",t);let s=t.s.slice(e+2,t.p);return o&&(s=s.replaceAll("_","")),yl(t,s,n,e)}function yl(t,e,n,r){if(t.bi!==!0)e:{let i=parseInt(e,n);if(!Number.isSafeInteger(i)){if(t.bi)break e;P.x("integer value cannot be represented losslessly",t,r)}return i}return BigInt(n===10?e:(n===2?"0b":n===8?"0o":"0x")+e)}function zm(t,e,n){let r=t.p++,i;if(!K(e)||!K(t.s.charCodeAt(t.p++))||!K(t.s.charCodeAt(t.p++))||!K(t.s.charCodeAt(t.p++)))return Wn(t,t.p=r,e,0,n);if(t.p+=5,K(t.s.charCodeAt(t.p++))||P.x("invalid date-time: date part is malformed",t,r),t.p>=t.s.length||((e=t.s.charCodeAt(t.p))!==32||(i=!0,!K(t.s.charCodeAt(t.p+1))))&&e!==84&&e!==116){let s=t.s.slice(r,t.p);return Ct(t,s,3,!1,r)}if(t.s.charCodeAt(t.p+=3)!==58&&P.x("invalid date-time: time part is malformed",t,r),t.s.charCodeAt(t.p+=3)===58&&(t.p+=3),t.s.charCodeAt(t.p)===46)for(;K(t.s.charCodeAt(++t.p)););if(e=t.s.charCodeAt(t.p)){if(e===90||e===122){let s=t.s.slice(r,++t.p);return Ct(t,s,1,i,r,"[+00:00]")}if(e===43||e===45){let s=t.s.slice(r,t.p+=6);return Ct(t,s,1,i,r,!t.ld&&"["+t.s.slice(t.p-6,t.p)+"]")}}let o=t.s.slice(r,t.p);return Ct(t,o,2,i,r)}function Um(t,e,n){let r=t.p;if(!K(e)||!K(t.s.charCodeAt(++t.p)))return Wn(t,--t.p,e,0,n);if(t.s.charCodeAt(t.p+=4)===58&&(t.p+=3),t.s.charCodeAt(t.p)===46)for(;K(t.s.charCodeAt(++t.p)););let i=t.s.slice(r,t.p);return Ct(t,i,4,!1,r)}function Ct(t,e,n,r,i,o){if(t.ld){let s=new St(e,n,r);return s.isValid()||P.x("invalid date",t,i),s}try{switch(o&&(e+=o),n){case 1:return Temporal.ZonedDateTime.from(e);case 2:return Temporal.PlainDateTime.from(e);case 3:return Temporal.PlainDate.from(e);case 4:return Temporal.PlainTime.from(e)}}catch(s){P.x(s instanceof Error?s.message:""+s,t,i)}}function Ym(t){for(;t.p<t.s.length;t.p++){let e=t.s.charCodeAt(t.p);if(e===10)break;if(e===13&&t.s.charCodeAt(t.p+1)===10){t.p++;break}(e<32&&e!==9||e===127)&&P.x("control characters are not allowed in comments",t)}}function V(t,e,n){let r;for(;t.p<t.s.length;){for(;t.p<t.s.length&&((r=t.s.charCodeAt(t.p))===32||r===9||!e&&(r===10||r===13&&t.s.charCodeAt(t.p+1)===10));)t.p++;if(n||r!==35)break;Ym(t)}}function Bn(t,e=61){let n,r=0,i=[],o,s=t.s.charCodeAt(n=t.p);do{if(s===e)return r||P.x("unexpected end of key",t),r===1&&i.push(t.s.slice(o,t.p)),t.p++,i;s===46?(r||P.x("illegal empty bare key",t),r===1&&i.push(t.s.slice(o,t.p)),r=0):!r&&(s===34||s===39)?(s===t.s.charCodeAt(t.p+1)&&s===t.s.charCodeAt(t.p+2)&&P.x("illegal quoted key: multiline strings are not allowed",t),i.push(Fn(t)),r=2,t.p--):s===32||s===9?r===1&&(i.push(t.s.slice(o,t.p)),r=2):r===2||s<48&&s!==45||s>57&&s<65||s>90&&s<97&&s!==95||s>122?P.x("illegal character in key",t):r||(r=1,o=t.p)}while(s=t.s.charCodeAt(++t.p));P.x("incomplete key-value: cannot find end of key",t,n)}function kl(t){let e=t.p++,n=Object.create(null),r=new Set,i;for(;t.p<t.s.length;){if(V(t),(i=t.s.charCodeAt(t.p))===125)return t.p++,n;let o,s=n,a=!1,l=t.p,c=Bn(t);for(let f=0;f<c.length;f++){f&&(s=a?s[o]:s[o]=Object.create(null)),o=c[f],(a=Object.hasOwn(s,o))&&(typeof s[o]!="object"||r.has(s[o]))&&P.x("trying to redefine an already defined value",t,l);let u=o==="__proto__";if(t.uk&&(u||o==="constructor")){s=t.uk!==1&&P.x("document contains an unsafe property",t,l);break}!a&&u&&Object.defineProperty(s,o,{enumerable:!0,configurable:!0,writable:!0})}a&&P.x("trying to redefine an already defined value",t,l),V(t,!0,!0);let p=Et(t,125);if(s&&typeof(s[o]=p)=="object"&&r.add(p),V(t),(i=t.s.charCodeAt(t.p++))===125)return n;i!==44&&P.x("expected comma or end of structure",t,t.p-1)}P.x("unfinished table",t,e)}function bl(t){let e=t.p++,n=[],r;for(;t.p<t.s.length;){if(V(t),(r=t.s.charCodeAt(t.p))===93)return t.p++,n;if(n.push(Et(t,93)),V(t),(r=t.s.charCodeAt(t.p++))===93)return n;r!==44&&P.x("expected comma or end of structure",t,t.p-1)}P.x("unfinished array",t,e)}function vl(t,e,n,r,i){let o=n,s=r,a,l=!1,c;for(let p=0;p<e.length;p++){if(p){if(o=l?o[a]:o[a]=Object.create(null),s=(c=s[a]).c,i===0&&(c.t===1||c.t===2))return null;if(c.t===2){let f=o.length-1;o=o[f],s=s[f].c}}if(a=e[p],(l=Object.hasOwn(o,a))&&s[a]?.t===0&&s[a]?.d)return null;if(!l){let f=a==="__proto__";if(t.uk&&(f||a==="constructor"))return!1;f&&(Object.defineProperty(o,a,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(s,a,{enumerable:!0,configurable:!0,writable:!0})),s[a]={t:p<e.length-1&&i===2?3:i,d:!1,i:0,c:Object.create(null)}}}if(c=s[a],c.t!==i&&!(i===1&&c.t===3)||(i===2&&(c.d||(c.d=!0,o[a]=[]),o[a].push(o=Object.create(null)),c.c[c.i++]=c={t:1,d:!1,i:0,c:Object.create(null)}),c.d))return null;if(c.d=!0,i===1)o=l?o[a]:o[a]=Object.create(null);else if(i===0&&l)return null;return[a,o,c.c]}function Sl(t,e,n){(e===null||t.uk===2)&&P.x(e===null?"trying to redefine an already defined table or value":"document contains an unsafe property",t,n)}function Hn(t,e={}){let n={s:t,p:0,d:e.maxDepth??1e3,bi:e.integersAsBigInt??!1,ld:e.useLegacyDate??!0,uk:e.unsafeKeyBehaviour==="throw"?2:e.unsafeKeyBehaviour==="drop"?1:0},r=Object.create(null),i=Object.create(null),o,s=!1,a=r,l=i;for(t.charCodeAt(0)===65279&&n.p++,V(n);n.p<t.length;){if(t.charCodeAt(n.p)===91){let c=t.charCodeAt(++n.p)===91;o=n.p+=+c,s=!1;let p=Bn(n,93);c&&(t.charCodeAt(n.p)!==93&&P.x("expected end of table array declaration",n),n.p++);let f=vl(n,p,r,i,c?2:1);f?(l=f[2],a=f[1]):(Sl(n,f,o),s=!0)}else{o=n.p;let c=Bn(n),p=vl(n,c,a,l,0);!p&&!s&&Sl(n,p,o),V(n,!0,!0);let f=Et(n,void 0);p&&!s&&(p[1][p[0]]=f)}V(n,!0),n.p<t.length&&(o=t.charCodeAt(n.p))!==10&&(o!==13||t.charCodeAt(n.p+1)!==10)&&P.x("each key-value declaration must be followed by an end-of-line",n),V(n)}return r}var iy=!!"".isWellFormed;import $ from"node:path";import{promises as Vm}from"node:fs";async function Cl(t){let e=ro.find(a=>a.id===t.platform),n=(a,l=!1)=>{let c=l?t.configRoot:$.join(a,xt(e,"project"));return{root:a,skills:l?t.platform==="codex"?[$.join(a,".agents/skills"),$.join(c,"skills")]:[$.join(c,"skills")]:no(e,"project").map(p=>$.join(a,p,"skills")),hooks:[$.join(c,"hooks.json"),...t.platform==="codex"?[$.join(c,"settings.local.json")]:[]],rules:t.platform==="codex"?["comet-workflow-guard","comet-phase-guard","comet-native-phase-guard"].map(p=>$.join(c,"rules",p+".md")):[],...t.platform==="dsh"?{instruction:l?$.join(c,"AGENTS.md"):$.join(a,"AGENTS.local.md")}:{}}},r=[n($.resolve(t.homeDir),!0)];if(!t.projectPath)return r;let i=$.resolve(t.projectPath),o=[],s=!1;for(;i!==$.parse(i).root;){if(o.push(i),await Vm.lstat($.join(i,".git")).catch(()=>null)){s=!0;break}i=$.dirname(i)}for(let a of s?o:o.slice(0,1))a!==$.resolve(t.homeDir)&&r.push(n(a));return r}var Oe=t=>Qm("sha256").update(t).digest("hex"),Hi=t=>Oe(t.toString("utf8").replaceAll(`\r
|
|
181
|
+
`,`
|
|
182
|
+
`)),Kn=t=>process.platform==="win32"?N.resolve(t).toLowerCase():N.resolve(t),Xm=["comet/scripts/comet-hook-router.mjs","comet/scripts/comet-hook-guard.mjs","comet-native/scripts/comet-native-hook-guard.mjs"];async function Z(t){let e=N.resolve(t),n=N.parse(e).root;for(let r of e.slice(n.length).split(N.sep)){n=N.join(n,r);let i=await Jn.lstat(n).catch(o=>{if(o.code==="ENOENT")return null;throw o});if(!i)return null;if(i.isSymbolicLink())throw new Error("\u76EE\u5F55\u6216\u6587\u4EF6\u4E3A\u94FE\u63A5\uFF0C\u5DF2\u4FDD\u7559");if(n!==e&&!i.isDirectory())throw new Error("\u7236\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55");if(n===e&&!i.isFile())throw new Error("\u8DEF\u5F84\u4E0D\u662F\u666E\u901A\u6587\u4EF6")}return Jn.readFile(e)}async function Zm(t){let e={changed:[],backups:[],preserved:[]},n=N.resolve(t.configRoot),r=N.join(await Jn.realpath(t.pluginRoot),"rules/migration-assets.json"),i=await Z(r);if(!i)return e;let o=JSON.parse(i.toString());if(o.schema!=="comet.plugin-migration-assets.v1"||!o.skills||!Array.isArray(o.rules))throw new Error("Comet \u8FC1\u79FB\u8D44\u6E90\u6E05\u5355\u65E0\u6548");for(let[l,c]of Object.entries(o.skills))if(!/^comet(?:-[a-z]+)*$/.test(l)||!Array.isArray(c)||c.some(p=>!/^\w{64}$/.test(p)))throw new Error("Comet \u8FC1\u79FB Skill \u6E05\u5355\u65E0\u6548");await Jn.mkdir(n,{recursive:!0});let s=await Cl({...t,configRoot:n,homeDir:t.homeDir??Gm.homedir()}),a=(l,c)=>e.preserved.push({path:l,reason:c instanceof Error?c.message:String(c)});return await It(N.join(n,"comet-plugin-setup.lock"),async()=>{async function l(f,u,m,g){let d=N.relative(n,f);d!==".."&&!d.startsWith(`..${N.sep}`)&&!N.isAbsolute(d)&&(g=n);let h=Oe(N.resolve(f)+"\0"+(u?Oe(u):"missing")+"\0"+m),w=N.join(n,"comet-plugin/migration-backups",h+".bin"),y=N.join(n,"comet-plugin/migration-backups",h+".json"),v=u??Buffer.alloc(0),k=await Z(w);if(!k)await Dn(w,v,{containedRoot:n,exclusive:!0});else if(!k.equals(v))throw new Error("\u5DF2\u6709\u8FC1\u79FB\u5907\u4EFD\u4E0D\u5339\u914D");if(!(await Z(w))?.equals(v))throw new Error("\u8FC1\u79FB\u5907\u4EFD\u6821\u9A8C\u5931\u8D25");await be(y,JSON.stringify({schema:"comet.plugin-migration-backup.v1",source:f,backup:w,beforeHash:u?Oe(u):null,afterHash:m===null?null:Oe(m),platform:t.platform},null,2)+`
|
|
183
|
+
`,{containedRoot:n});let C=async()=>{let E=await Z(f);if(E===null?u!==null:u===null||!E.equals(u))throw new Error("\u8FC1\u79FB\u671F\u95F4\u6587\u4EF6\u5DF2\u6539\u53D8\uFF0C\u5DF2\u4FDD\u7559")};await C(),m===null?await ml(f,{containedRoot:g,beforeRemove:C}):await be(f,m,{containedRoot:g,beforeCommit:C}),e.changed.push(f),e.backups.push(w)}let c=new Set;for(let f of s){for(let u of f.skills)for(let[m,g]of Object.entries(o.skills)){let d=N.join(u,m,"SKILL.md");try{let h=await Z(d);if(!h)continue;if(!g.includes(Hi(h))){a(d,"Skill \u5185\u5BB9\u4E0E\u5DF2\u77E5 Comet \u7248\u672C\u4E0D\u540C\uFF0C\u5DF2\u4FDD\u7559");continue}t.platform==="codex"?c.add(d):t.hookExecuted&&await l(d,h,null,f.root)}catch(h){a(d,h)}}if(t.hookExecuted){for(let u of f.rules)try{let m=await Z(u);if(!m)continue;o.rules.includes(Hi(m))?await l(u,m,null,f.root):a(u,"Rule \u5185\u5BB9\u4E0E\u5DF2\u77E5 Comet \u7248\u672C\u4E0D\u540C\uFF0C\u5DF2\u4FDD\u7559")}catch(m){a(u,m)}if(f.instruction){let u=f.instruction;try{let m=await Z(u);if(m){let g=m.toString(),d=[...g.matchAll(/<!-- COMET:DSH:START -->\r?\n([\s\S]*?)\r?\n<!-- COMET:DSH:END -->/g)];d.length===1&&o.rules.includes(Hi(Buffer.from(d[0][1]+`
|
|
184
|
+
`)))?await l(u,m,g.slice(0,d[0].index)+g.slice(d[0].index+d[0][0].length),f.root):g.includes("<!-- COMET:DSH:")&&a(u,"DSH Rule \u5DF2\u4FEE\u6539\u6216\u6807\u8BB0\u4E0D\u5B8C\u6574\uFF0C\u5DF2\u4FDD\u7559")}}catch(m){a(u,m)}}for(let u of f.hooks)try{let m=await Z(u);if(!m)continue;let g=JSON.parse(m.toString());if(!g||typeof g!="object"||Array.isArray(g))throw new Error("Hook \u914D\u7F6E\u65E0\u6548");let d=g.hooks?.PreToolUse;if(d===void 0)continue;if(!Array.isArray(d))throw new Error("PreToolUse \u5FC5\u987B\u662F\u6570\u7EC4");let h=0;g.hooks.PreToolUse=d.map(w=>{if(!w||!Array.isArray(w.hooks))return w;let y=w.hooks.filter(v=>Fi(v?.command,Xm,v?.args)?(h++,!1):!0);return{...w,hooks:y}}),h&&await l(u,m,JSON.stringify(g,null,2)+`
|
|
185
|
+
`,f.root)}catch(m){a(u,m)}}}if(t.platform==="codex"&&c.size){let f=N.join(n,"config.toml");try{let u=await Z(f),m=u?.toString()??"",g=Hn(m);if(g.skills?.config!==void 0&&!Array.isArray(g.skills.config))throw new Error("skills.config \u5FC5\u987B\u662F\u6570\u7EC4");let d=g.skills?.config??[];for(let h of c){let w=N.basename(N.dirname(h)),y=d.filter(k=>k.name===w||k.path&&Kn(k.path)===Kn(h)).at(-1);if(y){y.enabled!==!1&&a(h,"\u5DF2\u6709\u7528\u6237 Skill \u542F\u7528\u8BBE\u7F6E\uFF0C\u5DF2\u4FDD\u7559");continue}let v=Oe(h);m+=`
|
|
186
|
+
# comet-plugin-migration:${v}
|
|
187
|
+
[[skills.config]]
|
|
188
|
+
path = ${JSON.stringify(h)}
|
|
189
|
+
enabled = false
|
|
190
|
+
`}m!==(u?.toString()??"")&&(Hn(m),await l(f,u,m,n),e.changed.pop(),e.changed.push(...[...c].filter(h=>!d.some(w=>w.name===N.basename(N.dirname(h))||w.path&&Kn(w.path)===Kn(h)))))}catch(u){a(f,u)}}let p=N.join(n,"comet-plugin/migration-reports",Oe(t.platform+"\0"+(t.projectPath??"user"))+".json");e.changed.length||e.preserved.length?(e.reportPath=p,await be(p,JSON.stringify(e,null,2)+`
|
|
191
|
+
`,{containedRoot:n})):await Z(p)&&(e.reportPath=p)},{timeoutMs:3e4,retryMs:50}),e}var Ki="comet/scripts/comet-plugin-hook.mjs";async function np(t){let e=tp("sha256").update(j.resolve(t));async function n(r){for(let i of(await ee.readdir(r)).sort()){let o=j.join(r,i),s=await ee.lstat(o);if(s.isSymbolicLink())throw new Error(`Comet \u63D2\u4EF6\u8D44\u6E90\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\uFF1A${o}`);s.isDirectory()?await n(o):(await Pt(o),e.update(j.relative(t,o)),e.update("\0"),e.update(await ee.readFile(o)))}}return await n(j.join(t,"skills")),await n(j.join(t,"rules")),e.digest("hex")}async function Pt(t,e=!1){let n=await ee.lstat(t).catch(r=>{if(e&&r.code==="ENOENT")return null;throw r});if(n&&(!n.isFile()||n.isSymbolicLink()))throw new Error(`Comet \u63D2\u4EF6\u6587\u4EF6\u4E0D\u662F\u666E\u901A\u6587\u4EF6\uFF1A${t}`)}async function Ry(t){let{platform:e}=t,n=j.resolve(t.pluginRoot),r=t.homeDir??ep.homedir(),i=t.env??process.env,o=j.resolve(e==="codex"?i.CODEX_HOME??j.join(r,".codex"):i.DSH_HOME??j.join(r,".dsh")),s=j.join(n,"skills",Ki);await Pt(s),await Pt(j.join(n,"rules/comet-workflow-guard.md"));let a=await ee.readFile(s),l=await np(n),c=l.slice(0,24),p=j.join(o,"comet-plugin",c),f=j.join(p,"skills",Ki),u=e==="codex"?j.join(o,"hooks.json"):j.join(p,"hooks.json");if(await ee.mkdir(o,{recursive:!0}),(await ee.lstat(o)).isSymbolicLink())throw new Error("Comet \u63D2\u4EF6\u914D\u7F6E\u76EE\u5F55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5");if(await Pt(f,!0),await ee.readFile(f).catch(()=>null)===null&&await Dn(f,a,{containedRoot:o,exclusive:!0}).catch(h=>{if(h.code!=="EEXIST")throw h}),!(await ee.readFile(f)).equals(a))throw new Error("Comet \u63D2\u4EF6\u542F\u52A8\u5668\u5185\u5BB9\u4E0E\u5B89\u88C5\u5305\u4E0D\u4E00\u81F4");let g=j.basename(j.dirname(n))==="comet"?`comet@${j.basename(j.dirname(j.dirname(n)))}`:void 0,d=h=>Ot([f,"--platform",e,"--plugin-root",n,"--event",h,"--config-root",o,"--package-hash",l,...g&&e==="codex"?["--plugin-key",g]:[],...t.cliEntry?["--cli-entry",t.cliEntry]:[]]);return await It(j.join(o,"comet-plugin-setup.lock"),async()=>{await Pt(u,!0);let h=await ee.readFile(u,"utf8").catch(k=>{if(k.code==="ENOENT")return"{}";throw k}),w=JSON.parse(h);if(!w||typeof w!="object"||Array.isArray(w))throw new Error("Hook \u914D\u7F6E\u5FC5\u987B\u662F JSON \u5BF9\u8C61");if(w.hooks!==void 0&&(!w.hooks||typeof w.hooks!="object"||Array.isArray(w.hooks)))throw new Error("hooks \u5FC5\u987B\u662F JSON \u5BF9\u8C61");let y=w.hooks??{};for(let k of["SessionStart","PreToolUse"]){if(y[k]!==void 0&&!Array.isArray(y[k]))throw new Error(`${k} \u5FC5\u987B\u662F\u6570\u7EC4`);y[k]=wl(y[k]??[],[{matcher:e==="dsh"&&k==="PreToolUse"?"write|edit":"",hooks:[{type:"command",command:d(k)}]}],[Ki])}w.hooks=y;let v=`${JSON.stringify(w,null,2)}
|
|
192
|
+
`;h!==v&&await be(u,v,{containedRoot:o})},{timeoutMs:3e4,retryMs:50}),{platform:e,hookConfigPath:u,requiresHookTrust:e==="codex"}}export{np as hashPluginRuntime,Zm as migratePluginInstallation,Ry as preparePluginIntegration};
|